reduce (not eliminate) dependencies on host
This commit is contained in:
parent
9249ad092e
commit
8a9a22fdeb
23
build.zig
23
build.zig
|
@ -15,10 +15,27 @@ pub fn build(b: *std.build.Builder) void {
|
||||||
exe.setTarget(target);
|
exe.setTarget(target);
|
||||||
exe.setBuildMode(mode);
|
exe.setBuildMode(mode);
|
||||||
if (std.builtin.os.tag == .linux) {
|
if (std.builtin.os.tag == .linux) {
|
||||||
|
// LibX11 1.7.2: https://gitlab.freedesktop.org/xorg/lib/libx11/-/archive/libX11-1.7.2/libx11-libX11-1.7.2.tar.gz
|
||||||
|
// LibXfixes 5.0.3: https://gitlab.freedesktop.org/xorg/lib/libxfixes/-/archive/libXfixes-5.0.3/libxfixes-libXfixes-5.0.3.tar.gz
|
||||||
|
// XOrg Proto: https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/archive/xorgproto-2021.5/xorgproto-xorgproto-2021.5.tar.gz
|
||||||
|
// We can download the above by taking each url and processing in a
|
||||||
|
// command e.g.:
|
||||||
|
// curl <url> | tar xz --wildcards '*.h'
|
||||||
exe.linkLibC();
|
exe.linkLibC();
|
||||||
exe.addIncludeDir("/usr/include/");
|
exe.addIncludeDir("libx11-libX11-1.7.2/include");
|
||||||
exe.linkSystemLibrary("X11");
|
exe.addIncludeDir("libxfixes-libXfixes-5.0.3/include");
|
||||||
exe.linkSystemLibrary("Xfixes");
|
exe.addIncludeDir("xorgproto-xorgproto-2021.5/include");
|
||||||
|
|
||||||
|
// More than a little messy. We're grabbing libX11 and libXfixes from
|
||||||
|
// the host, while using downloaded headers. This assumes debian
|
||||||
|
// bullseye host, and also means you can't cross-compile from Windows.
|
||||||
|
// TODO: Make this better
|
||||||
|
const dependent_objects = .{
|
||||||
|
"/usr/lib/x86_64-linux-gnu/libX11.so.6",
|
||||||
|
"/usr/lib/x86_64-linux-gnu/libXfixes.so.3",
|
||||||
|
};
|
||||||
|
inline for (dependent_objects) |obj|
|
||||||
|
exe.addObjectFile(obj);
|
||||||
}
|
}
|
||||||
if (std.builtin.os.tag == .windows) {
|
if (std.builtin.os.tag == .windows) {
|
||||||
// exe.linkLibC();
|
// exe.linkLibC();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user