Skip to content

Commit 13a36ef

Browse files
author
ochafik
committed
build: workaround lack of -n on gnu xxd
1 parent b5f9c70 commit 13a36ef

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ server: examples/server/server.cpp examples/server/utils.hpp examples/server/htt
794794
$(CXX) $(CXXFLAGS) $(filter-out %.h %.hpp $<,$^) -Iexamples/server $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS) $(LWINSOCK2)
795795

796796
examples/server/%.hpp: examples/server/public/%
797-
xxd -n $(notdir $<) -i $< $@
797+
( cd examples/server/public && xxd -i $(notdir $<) ../$(notdir $<).hpp )
798798

799799
gguf: examples/gguf/gguf.cpp ggml.o $(OBJS)
800800
$(CXX) $(CXXFLAGS) -c $< -o $(call GET_OBJ_FILE, $<)

build.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,7 @@ pub fn build(b: *std.build.Builder) !void {
142142

143143
const server_assets = [_][]const u8{ "index.html", "index.js", "completion.js", "json-schema-to-grammar.mjs" };
144144
for (server_assets) |asset| {
145-
// Note: code can be simplified once setCwd is standard.
146-
const gen_hpp = b.addSystemCommand(
147-
&.{ "xxd", "-n", asset, "-i", b.fmt("examples/server/public/{s}", .{asset}), b.fmt("examples/server/{s}.hpp", .{asset}) },
148-
);
145+
const gen_hpp = b.addSystemCommand(&.{ "bash", "-c", b.fmt("cd examples/server/public && xxd -i {s} ../{s}.hpp", .{ asset, asset }) });
149146
server.step.dependOn(&gen_hpp.step);
150147
}
151148
}

examples/server/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
set(SERVER_ASSETS
1+
set(SERVER_ASSETS
22
index.html
33
index.js
44
completion.js

0 commit comments

Comments
 (0)