build: workaround lack of -n on gnu xxd

This commit is contained in:
ochafik 2024-04-13 17:04:17 +01:00
parent b5f9c7021e
commit 13a36efbef
3 changed files with 3 additions and 6 deletions

View file

@ -794,7 +794,7 @@ server: examples/server/server.cpp examples/server/utils.hpp examples/server/htt
$(CXX) $(CXXFLAGS) $(filter-out %.h %.hpp $<,$^) -Iexamples/server $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS) $(LWINSOCK2)
examples/server/%.hpp: examples/server/public/%
xxd -n $(notdir $<) -i $< $@
( cd examples/server/public && xxd -i $(notdir $<) ../$(notdir $<).hpp )
gguf: examples/gguf/gguf.cpp ggml.o $(OBJS)
$(CXX) $(CXXFLAGS) -c $< -o $(call GET_OBJ_FILE, $<)

View file

@ -142,10 +142,7 @@ pub fn build(b: *std.build.Builder) !void {
const server_assets = [_][]const u8{ "index.html", "index.js", "completion.js", "json-schema-to-grammar.mjs" };
for (server_assets) |asset| {
// Note: code can be simplified once setCwd is standard.
const gen_hpp = b.addSystemCommand(
&.{ "xxd", "-n", asset, "-i", b.fmt("examples/server/public/{s}", .{asset}), b.fmt("examples/server/{s}.hpp", .{asset}) },
);
const gen_hpp = b.addSystemCommand(&.{ "bash", "-c", b.fmt("cd examples/server/public && xxd -i {s} ../{s}.hpp", .{ asset, asset }) });
server.step.dependOn(&gen_hpp.step);
}
}

View file

@ -1,4 +1,4 @@
set(SERVER_ASSETS
set(SERVER_ASSETS
index.html
index.js
completion.js