add missing build dependency, update patches
This commit is contained in:
parent
1922d307ed
commit
11a0bc08dd
@ -1,34 +1,41 @@
|
|||||||
From 4f59e6c80f5ef17ed216dc0b9033ed811197ec33 Mon Sep 17 00:00:00 2001
|
From c1ecb97befdb6a1106c1651da69f08cfb34f754a Mon Sep 17 00:00:00 2001
|
||||||
From: Jan200101 <sentrycraft123@gmail.com>
|
From: Jan200101 <sentrycraft123@gmail.com>
|
||||||
Date: Mon, 7 Jun 2021 01:14:05 +0200
|
Date: Sat, 12 Jun 2021 11:23:04 +0200
|
||||||
Subject: [PATCH] specify the output lib, exe and include paths with flags
|
Subject: [PATCH 1/2] specify the output lib, exe and include paths with flags
|
||||||
|
|
||||||
Signed-off-by: Jan200101 <sentrycraft123@gmail.com>
|
Signed-off-by: Jan200101 <sentrycraft123@gmail.com>
|
||||||
---
|
---
|
||||||
lib/std/build.zig | 26 +++++++++++++++++++++-----
|
lib/std/build.zig | 34 ++++++++++++++++++++++++++++----
|
||||||
lib/std/special/build_runner.zig | 25 +++++++++++++++++++++++--
|
lib/std/special/build_runner.zig | 24 ++++++++++++++++++++--
|
||||||
2 files changed, 44 insertions(+), 7 deletions(-)
|
2 files changed, 52 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
diff --git a/lib/std/build.zig b/lib/std/build.zig
|
diff --git a/lib/std/build.zig b/lib/std/build.zig
|
||||||
index 572f2b2be..f7f90fb51 100644
|
index 572f2b2be..a12186464 100644
|
||||||
--- a/lib/std/build.zig
|
--- a/lib/std/build.zig
|
||||||
+++ b/lib/std/build.zig
|
+++ b/lib/std/build.zig
|
||||||
@@ -190,8 +190,12 @@ pub const Builder = struct {
|
@@ -122,6 +122,12 @@ pub const Builder = struct {
|
||||||
|
description: []const u8,
|
||||||
|
};
|
||||||
|
|
||||||
|
+ pub const DirList = struct {
|
||||||
|
+ lib_dir: ?[]const u8 = null,
|
||||||
|
+ exe_dir: ?[]const u8 = null,
|
||||||
|
+ include_dir: ?[]const u8 = null,
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
pub fn create(
|
||||||
|
allocator: *Allocator,
|
||||||
|
zig_exe: []const u8,
|
||||||
|
@@ -190,7 +196,7 @@ pub const Builder = struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This function is intended to be called by std/special/build_runner.zig, not a build.zig file.
|
/// This function is intended to be called by std/special/build_runner.zig, not a build.zig file.
|
||||||
- pub fn resolveInstallPrefix(self: *Builder, install_prefix: ?[]const u8) void {
|
- pub fn resolveInstallPrefix(self: *Builder, install_prefix: ?[]const u8) void {
|
||||||
- if (self.dest_dir) |dest_dir| {
|
+ pub fn resolveInstallPrefix(self: *Builder, install_prefix: ?[]const u8, dir_list: DirList) void {
|
||||||
+ pub fn resolveInstallPrefix(self: *Builder, install_prefix: ?[]const u8, lib_dir: ?[]const u8, exe_dir: ?[]const u8, h_dir: ?[]const u8) void {
|
if (self.dest_dir) |dest_dir| {
|
||||||
+ var dest_dir: []const u8 = "";
|
|
||||||
+
|
|
||||||
+ if (self.dest_dir) |self_dest_dir| {
|
|
||||||
+ dest_dir = self_dest_dir;
|
|
||||||
+
|
|
||||||
self.install_prefix = install_prefix orelse "/usr";
|
self.install_prefix = install_prefix orelse "/usr";
|
||||||
self.install_path = fs.path.join(self.allocator, &[_][]const u8{ dest_dir, self.install_prefix }) catch unreachable;
|
self.install_path = fs.path.join(self.allocator, &[_][]const u8{ dest_dir, self.install_prefix }) catch unreachable;
|
||||||
} else {
|
@@ -199,9 +205,29 @@ pub const Builder = struct {
|
||||||
@@ -199,9 +203,21 @@ pub const Builder = struct {
|
|
||||||
(fs.path.join(self.allocator, &[_][]const u8{ self.build_root, "zig-out" }) catch unreachable);
|
(fs.path.join(self.allocator, &[_][]const u8{ self.build_root, "zig-out" }) catch unreachable);
|
||||||
self.install_path = self.install_prefix;
|
self.install_path = self.install_prefix;
|
||||||
}
|
}
|
||||||
@ -36,84 +43,91 @@ index 572f2b2be..f7f90fb51 100644
|
|||||||
- self.exe_dir = fs.path.join(self.allocator, &[_][]const u8{ self.install_path, "bin" }) catch unreachable;
|
- self.exe_dir = fs.path.join(self.allocator, &[_][]const u8{ self.install_path, "bin" }) catch unreachable;
|
||||||
- self.h_dir = fs.path.join(self.allocator, &[_][]const u8{ self.install_path, "include" }) catch unreachable;
|
- self.h_dir = fs.path.join(self.allocator, &[_][]const u8{ self.install_path, "include" }) catch unreachable;
|
||||||
+
|
+
|
||||||
+ self.lib_dir = if (lib_dir != null)
|
+ var lib_list = [_][]const u8{ self.install_path, "lib" };
|
||||||
+ (fs.path.join(self.allocator, &[_][]const u8{ dest_dir, lib_dir.? }) catch unreachable)
|
+ var exe_list = [_][]const u8{ self.install_path, "bin" };
|
||||||
+ else
|
+ var h_list = [_][]const u8{ self.install_path, "include" };
|
||||||
+ (fs.path.join(self.allocator, &[_][]const u8{ self.install_path, "lib" }) catch unreachable);
|
|
||||||
+
|
+
|
||||||
+ self.exe_dir = if (exe_dir != null)
|
+ if (dir_list.lib_dir) |dir| {
|
||||||
+ (fs.path.join(self.allocator, &[_][]const u8{ dest_dir, exe_dir.? }) catch unreachable)
|
+ if (std.fs.path.isAbsolute(dir)) lib_list[0] = self.dest_dir orelse "";
|
||||||
+ else
|
+ lib_list[1] = dir;
|
||||||
+ (fs.path.join(self.allocator, &[_][]const u8{ self.install_path, "bin" }) catch unreachable);
|
+ }
|
||||||
+
|
+
|
||||||
+ self.h_dir = if (h_dir != null)
|
+ if (dir_list.exe_dir) |dir| {
|
||||||
+ (fs.path.join(self.allocator, &[_][]const u8{ dest_dir, h_dir.? }) catch unreachable)
|
+ if (std.fs.path.isAbsolute(dir)) exe_list[0] = self.dest_dir orelse "";
|
||||||
+ else
|
+ exe_list[1] = dir;
|
||||||
+ (fs.path.join(self.allocator, &[_][]const u8{ self.install_path, "include" }) catch unreachable);
|
+ }
|
||||||
|
+
|
||||||
|
+ if (dir_list.include_dir) |dir| {
|
||||||
|
+ if (std.fs.path.isAbsolute(dir)) h_list[0] = self.dest_dir orelse "";
|
||||||
|
+ h_list[1] = dir;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ self.lib_dir = fs.path.join(self.allocator, &lib_list) catch unreachable;
|
||||||
|
+ self.exe_dir = fs.path.join(self.allocator, &exe_list) catch unreachable;
|
||||||
|
+ self.h_dir = fs.path.join(self.allocator, &h_list) catch unreachable;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn addExecutable(self: *Builder, name: []const u8, root_src: ?[]const u8) *LibExeObjStep {
|
pub fn addExecutable(self: *Builder, name: []const u8, root_src: ?[]const u8) *LibExeObjStep {
|
||||||
diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
|
diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
|
||||||
index c6185ef09..883bb053e 100644
|
index c6185ef09..da50548c6 100644
|
||||||
--- a/lib/std/special/build_runner.zig
|
--- a/lib/std/special/build_runner.zig
|
||||||
+++ b/lib/std/special/build_runner.zig
|
+++ b/lib/std/special/build_runner.zig
|
||||||
@@ -61,6 +61,9 @@ pub fn main() !void {
|
@@ -61,6 +61,8 @@ pub fn main() !void {
|
||||||
const stdout_stream = io.getStdOut().writer();
|
const stdout_stream = io.getStdOut().writer();
|
||||||
|
|
||||||
var install_prefix: ?[]const u8 = null;
|
var install_prefix: ?[]const u8 = null;
|
||||||
+ var lib_dir: ?[]const u8 = null;
|
+ var dir_list = Builder.DirList{};
|
||||||
+ var exe_dir: ?[]const u8 = null;
|
+
|
||||||
+ var h_dir: ?[]const u8 = null;
|
|
||||||
while (nextArg(args, &arg_idx)) |arg| {
|
while (nextArg(args, &arg_idx)) |arg| {
|
||||||
if (mem.startsWith(u8, arg, "-D")) {
|
if (mem.startsWith(u8, arg, "-D")) {
|
||||||
const option_contents = arg[2..];
|
const option_contents = arg[2..];
|
||||||
@@ -87,6 +90,21 @@ pub fn main() !void {
|
@@ -87,6 +89,21 @@ pub fn main() !void {
|
||||||
warn("Expected argument after {s}\n\n", .{arg});
|
warn("Expected argument after {s}\n\n", .{arg});
|
||||||
return usageAndErr(builder, false, stderr_stream);
|
return usageAndErr(builder, false, stderr_stream);
|
||||||
};
|
};
|
||||||
+ } else if (mem.eql(u8, arg, "--output-lib-dir")) {
|
+ } else if (mem.eql(u8, arg, "--lib-dir")) {
|
||||||
+ lib_dir = nextArg(args, &arg_idx) orelse {
|
+ dir_list.lib_dir = nextArg(args, &arg_idx) orelse {
|
||||||
+ warn("Expected argument after {s}\n\n", .{arg});
|
+ warn("Expected argument after {s}\n\n", .{arg});
|
||||||
+ return usageAndErr(builder, false, stderr_stream);
|
+ return usageAndErr(builder, false, stderr_stream);
|
||||||
+ };
|
+ };
|
||||||
+ } else if (mem.eql(u8, arg, "--output-exe-dir")) {
|
+ } else if (mem.eql(u8, arg, "--exe-dir")) {
|
||||||
+ exe_dir = nextArg(args, &arg_idx) orelse {
|
+ dir_list.exe_dir = nextArg(args, &arg_idx) orelse {
|
||||||
+ warn("Expected argument after {s}\n\n", .{arg});
|
+ warn("Expected argument after {s}\n\n", .{arg});
|
||||||
+ return usageAndErr(builder, false, stderr_stream);
|
+ return usageAndErr(builder, false, stderr_stream);
|
||||||
+ };
|
+ };
|
||||||
+ } else if (mem.eql(u8, arg, "--output-include-dir")) {
|
+ } else if (mem.eql(u8, arg, "--include-dir")) {
|
||||||
+ h_dir = nextArg(args, &arg_idx) orelse {
|
+ dir_list.include_dir = nextArg(args, &arg_idx) orelse {
|
||||||
+ warn("Expected argument after {s}\n\n", .{arg});
|
+ warn("Expected argument after {s}\n\n", .{arg});
|
||||||
+ return usageAndErr(builder, false, stderr_stream);
|
+ return usageAndErr(builder, false, stderr_stream);
|
||||||
+ };
|
+ };
|
||||||
} else if (mem.eql(u8, arg, "--search-prefix")) {
|
} else if (mem.eql(u8, arg, "--search-prefix")) {
|
||||||
const search_prefix = nextArg(args, &arg_idx) orelse {
|
const search_prefix = nextArg(args, &arg_idx) orelse {
|
||||||
warn("Expected argument after --search-prefix\n\n", .{});
|
warn("Expected argument after --search-prefix\n\n", .{});
|
||||||
@@ -135,7 +153,7 @@ pub fn main() !void {
|
@@ -135,7 +152,7 @@ pub fn main() !void {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- builder.resolveInstallPrefix(install_prefix);
|
- builder.resolveInstallPrefix(install_prefix);
|
||||||
+ builder.resolveInstallPrefix(install_prefix, lib_dir, exe_dir, h_dir);
|
+ builder.resolveInstallPrefix(install_prefix, dir_list);
|
||||||
try runBuild(builder);
|
try runBuild(builder);
|
||||||
|
|
||||||
if (builder.validateUserInputDidItFail())
|
if (builder.validateUserInputDidItFail())
|
||||||
@@ -163,7 +181,7 @@ fn runBuild(builder: *Builder) anyerror!void {
|
@@ -163,7 +180,7 @@ fn runBuild(builder: *Builder) anyerror!void {
|
||||||
fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void {
|
fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void {
|
||||||
// run the build script to collect the options
|
// run the build script to collect the options
|
||||||
if (!already_ran_build) {
|
if (!already_ran_build) {
|
||||||
- builder.resolveInstallPrefix(null);
|
- builder.resolveInstallPrefix(null);
|
||||||
+ builder.resolveInstallPrefix(null, null, null, null);
|
+ builder.resolveInstallPrefix(null, .{});
|
||||||
try runBuild(builder);
|
try runBuild(builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,6 +207,9 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
|
@@ -189,6 +206,9 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
|
||||||
\\ -h, --help Print this help and exit
|
\\ -h, --help Print this help and exit
|
||||||
\\ --verbose Print commands before executing them
|
\\ --verbose Print commands before executing them
|
||||||
\\ -p, --prefix [path] Override default install prefix
|
\\ -p, --prefix [path] Override default install prefix
|
||||||
+ \\ --output-lib-dir [path] Override default library directory path
|
+ \\ --lib-dir [path] Override default library directory path
|
||||||
+ \\ --output-exe-dir [path] Override default executable directory path
|
+ \\ --exe-dir [path] Override default executable directory path
|
||||||
+ \\ --output-include-dir [path] Override default include directory path
|
+ \\ --include-dir [path] Override default include directory path
|
||||||
\\ --search-prefix [path] Add a path to look for binaries, libraries, headers
|
\\ --search-prefix [path] Add a path to look for binaries, libraries, headers
|
||||||
\\ --color [auto|off|on] Enable or disable colored error messages
|
\\ --color [auto|off|on] Enable or disable colored error messages
|
||||||
\\
|
\\
|
||||||
|
62
0002-zig-build-rename-lib-dir-include-dir-exe-dir.patch
Normal file
62
0002-zig-build-rename-lib-dir-include-dir-exe-dir.patch
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
From c95b2bd1f14f602b78f90714d5e614251fa83552 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Andrew Kelley <andrew@ziglang.org>
|
||||||
|
Date: Mon, 14 Jun 2021 11:56:58 -0700
|
||||||
|
Subject: [PATCH 2/2] zig build: rename --lib-dir, --include-dir, --exe-dir
|
||||||
|
|
||||||
|
To --prefix-lib-dir, --prefix-include-dir, --prefix-exe-dir,
|
||||||
|
respectively.
|
||||||
|
|
||||||
|
Signed-off-by: Jan200101 <sentrycraft123@gmail.com>
|
||||||
|
---
|
||||||
|
lib/std/special/build_runner.zig | 18 ++++++++++--------
|
||||||
|
1 file changed, 10 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
|
||||||
|
index da50548c6..f3c74279a 100644
|
||||||
|
--- a/lib/std/special/build_runner.zig
|
||||||
|
+++ b/lib/std/special/build_runner.zig
|
||||||
|
@@ -89,17 +89,17 @@ pub fn main() !void {
|
||||||
|
warn("Expected argument after {s}\n\n", .{arg});
|
||||||
|
return usageAndErr(builder, false, stderr_stream);
|
||||||
|
};
|
||||||
|
- } else if (mem.eql(u8, arg, "--lib-dir")) {
|
||||||
|
+ } else if (mem.eql(u8, arg, "--prefix-lib-dir")) {
|
||||||
|
dir_list.lib_dir = nextArg(args, &arg_idx) orelse {
|
||||||
|
warn("Expected argument after {s}\n\n", .{arg});
|
||||||
|
return usageAndErr(builder, false, stderr_stream);
|
||||||
|
};
|
||||||
|
- } else if (mem.eql(u8, arg, "--exe-dir")) {
|
||||||
|
+ } else if (mem.eql(u8, arg, "--prefix-exe-dir")) {
|
||||||
|
dir_list.exe_dir = nextArg(args, &arg_idx) orelse {
|
||||||
|
warn("Expected argument after {s}\n\n", .{arg});
|
||||||
|
return usageAndErr(builder, false, stderr_stream);
|
||||||
|
};
|
||||||
|
- } else if (mem.eql(u8, arg, "--include-dir")) {
|
||||||
|
+ } else if (mem.eql(u8, arg, "--prefix-include-dir")) {
|
||||||
|
dir_list.include_dir = nextArg(args, &arg_idx) orelse {
|
||||||
|
warn("Expected argument after {s}\n\n", .{arg});
|
||||||
|
return usageAndErr(builder, false, stderr_stream);
|
||||||
|
@@ -203,13 +203,15 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
|
||||||
|
try out_stream.writeAll(
|
||||||
|
\\
|
||||||
|
\\General Options:
|
||||||
|
+ \\ -p, --prefix [path] Override default install prefix
|
||||||
|
+ \\ --prefix-lib-dir [path] Override default library directory path
|
||||||
|
+ \\ --prefix-exe-dir [path] Override default executable directory path
|
||||||
|
+ \\ --prefix-include-dir [path] Override default include directory path
|
||||||
|
+ \\
|
||||||
|
+ \\ --search-prefix [path] Add a path to look for binaries, libraries, headers
|
||||||
|
+ \\
|
||||||
|
\\ -h, --help Print this help and exit
|
||||||
|
\\ --verbose Print commands before executing them
|
||||||
|
- \\ -p, --prefix [path] Override default install prefix
|
||||||
|
- \\ --lib-dir [path] Override default library directory path
|
||||||
|
- \\ --exe-dir [path] Override default executable directory path
|
||||||
|
- \\ --include-dir [path] Override default include directory path
|
||||||
|
- \\ --search-prefix [path] Add a path to look for binaries, libraries, headers
|
||||||
|
\\ --color [auto|off|on] Enable or disable colored error messages
|
||||||
|
\\
|
||||||
|
\\Project-Specific Options:
|
||||||
|
--
|
||||||
|
2.31.1
|
||||||
|
|
@ -11,11 +11,11 @@
|
|||||||
%zig_install \
|
%zig_install \
|
||||||
DESTDIR="%{buildroot}" %zig_build \\\
|
DESTDIR="%{buildroot}" %zig_build \\\
|
||||||
--prefix "%{_prefix}" \\
|
--prefix "%{_prefix}" \\
|
||||||
--output-lib-dir "%{_libdir}" \\\
|
--prefix-lib-dir "%{_libdir}" \\\
|
||||||
--output-exe-dir "%{_bindir}" \\\
|
--prefix-exe-dir "%{_bindir}" \\\
|
||||||
--output-include-dir "%{_includedir}" \\\
|
--prefix-include-dir "%{_includedir}" \\\
|
||||||
install
|
install
|
||||||
|
|
||||||
%zig_test \
|
%zig_test \
|
||||||
%zig_build \\\
|
%zig_build \\\
|
||||||
test
|
test
|
||||||
|
3
zig.spec
3
zig.spec
@ -14,6 +14,7 @@ Source1: macros.%{name}
|
|||||||
|
|
||||||
# https://github.com/ziglang/zig/pull/9020
|
# https://github.com/ziglang/zig/pull/9020
|
||||||
Patch0: 0001-specify-the-output-lib-exe-and-include-paths-with-fl.patch
|
Patch0: 0001-specify-the-output-lib-exe-and-include-paths-with-fl.patch
|
||||||
|
Patch1: 0002-zig-build-rename-lib-dir-include-dir-exe-dir.patch
|
||||||
|
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
BuildRequires: gcc-c++
|
BuildRequires: gcc-c++
|
||||||
@ -23,6 +24,8 @@ BuildRequires: clang-devel
|
|||||||
BuildRequires: lld-devel
|
BuildRequires: lld-devel
|
||||||
# for man page generation
|
# for man page generation
|
||||||
BuildRequires: help2man
|
BuildRequires: help2man
|
||||||
|
# for the macro
|
||||||
|
BuildRequires: sed
|
||||||
# for testing
|
# for testing
|
||||||
#BuildRequires: elfutils-libelf-devel
|
#BuildRequires: elfutils-libelf-devel
|
||||||
#BuildRequires: libstdc++-static
|
#BuildRequires: libstdc++-static
|
||||||
|
Loading…
Reference in New Issue
Block a user