From f25b7795e758a62ef17fc663c9273bf8d16662d2 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Thu, 17 Jun 2021 16:13:02 +0000 Subject: [PATCH 1/3] zig: backport 3 upstream commits These patches are required in order to integrate zig's crosscompilation features with xbps when using the zig build system. All 3 of these commits have landed in the 0.8.x branch upstream and will be included in the upcoming 0.8.1 release. --- ...01-zig-build-add-libc-general-option.patch | 65 +++++ .../0002-stage2-add-sysroot-link-option.patch | 245 ++++++++++++++++++ ...std-build-add-sysroot-general-option.patch | 61 +++++ srcpkgs/zig/template | 2 +- 4 files changed, 372 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch create mode 100644 srcpkgs/zig/patches/0002-stage2-add-sysroot-link-option.patch create mode 100644 srcpkgs/zig/patches/0003-std-build-add-sysroot-general-option.patch diff --git a/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch b/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch new file mode 100644 index 000000000000..6c6d894c8e41 --- /dev/null +++ b/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch @@ -0,0 +1,65 @@ +From 3e4f3a1924150e22e0ca87e906681ebadcf8433e Mon Sep 17 00:00:00 2001 +From: Isaac Freund +Date: Sun, 13 Jun 2021 04:49:54 +0000 +Subject: [PATCH 1/3] zig build: add --libc general option + +This new option sets a default libc paths file to be used for all +LibExeObjSteps. Setting LibExeObjStep.libc_file overrides this default. + +This is required to allow users to cross compile projects linking system +libraries without needing to patch the build.zig. +--- + lib/std/build.zig | 4 ++++ + lib/std/special/build_runner.zig | 7 +++++++ + 2 files changed, 11 insertions(+) + +diff --git a/lib/std/build.zig b/lib/std/build.zig +index 7628a18c5..e433ec386 100644 +--- a/lib/std/build.zig ++++ b/lib/std/build.zig +@@ -58,6 +58,7 @@ pub const Builder = struct { + h_dir: []const u8, + install_path: []const u8, + search_prefixes: ArrayList([]const u8), ++ libc_file: ?[]const u8 = null, + installed_files: ArrayList(InstalledFile), + build_root: []const u8, + cache_root: []const u8, +@@ -2377,6 +2378,9 @@ pub const LibExeObjStep = struct { + if (self.libc_file) |libc_file| { + try zig_args.append("--libc"); + try zig_args.append(builder.pathFromRoot(libc_file)); ++ } else if (builder.libc_file) |libc_file| { ++ try zig_args.append("--libc"); ++ try zig_args.append(libc_file); + } + + switch (self.build_mode) { +diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig +index c6185ef09..2a0ca86d7 100644 +--- a/lib/std/special/build_runner.zig ++++ b/lib/std/special/build_runner.zig +@@ -93,6 +93,12 @@ pub fn main() !void { + return usageAndErr(builder, false, stderr_stream); + }; + builder.addSearchPrefix(search_prefix); ++ } else if (mem.eql(u8, arg, "--libc")) { ++ const libc_file = nextArg(args, &arg_idx) orelse { ++ warn("Expected argument after --libc\n\n", .{}); ++ return usageAndErr(builder, false, stderr_stream); ++ }; ++ builder.libc_file = libc_file; + } else if (mem.eql(u8, arg, "--color")) { + const next_arg = nextArg(args, &arg_idx) orelse { + warn("expected [auto|on|off] after --color", .{}); +@@ -190,6 +196,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void + \\ --verbose Print commands before executing them + \\ -p, --prefix [path] Override default install prefix + \\ --search-prefix [path] Add a path to look for binaries, libraries, headers ++ \\ --libc [file] Provide a file which specifies libc paths + \\ --color [auto|off|on] Enable or disable colored error messages + \\ + \\Project-Specific Options: +-- +2.32.0 + diff --git a/srcpkgs/zig/patches/0002-stage2-add-sysroot-link-option.patch b/srcpkgs/zig/patches/0002-stage2-add-sysroot-link-option.patch new file mode 100644 index 000000000000..947a4aae1df0 --- /dev/null +++ b/srcpkgs/zig/patches/0002-stage2-add-sysroot-link-option.patch @@ -0,0 +1,245 @@ +From 16228e87d6d7d8929305083e8c76168603780f5f Mon Sep 17 00:00:00 2001 +From: Isaac Freund +Date: Mon, 21 Jun 2021 22:45:43 +0200 +Subject: [PATCH 2/3] stage2: add --sysroot link option + +This feature is necessary for cross-compiling code that dynamically +links system libraries, at least with the current feature set of lld. +--- + src/Compilation.zig | 42 +++++++++++++++++++++++++----------------- + src/link.zig | 4 ++-- + src/link/Elf.zig | 5 +++++ + src/link/MachO.zig | 8 ++++---- + src/main.zig | 11 ++++++++++- + 5 files changed, 46 insertions(+), 24 deletions(-) + +diff --git a/src/Compilation.zig b/src/Compilation.zig +index 977c9f4b8..5f5c1c5dd 100644 +--- a/src/Compilation.zig ++++ b/src/Compilation.zig +@@ -612,6 +612,7 @@ pub const InitOptions = struct { + output_mode: std.builtin.OutputMode, + thread_pool: *ThreadPool, + dynamic_linker: ?[]const u8 = null, ++ sysroot: ?[]const u8 = null, + /// `null` means to not emit a binary file. + emit_bin: ?EmitLoc, + /// `null` means to not emit a C header file. +@@ -868,25 +869,32 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { + break :blk false; + }; + +- const DarwinOptions = struct { +- syslibroot: ?[]const u8 = null, +- system_linker_hack: bool = false, ++ const darwin_can_use_system_linker_and_sdk = ++ // comptime conditions ++ ((build_options.have_llvm and comptime std.Target.current.isDarwin()) and ++ // runtime conditions ++ (use_lld and std.builtin.os.tag == .macos and options.target.isDarwin())); ++ ++ const darwin_system_linker_hack = blk: { ++ if (darwin_can_use_system_linker_and_sdk) { ++ break :blk std.os.getenv("ZIG_SYSTEM_LINKER_HACK") != null; ++ } else { ++ break :blk false; ++ } + }; + +- const darwin_options: DarwinOptions = if (build_options.have_llvm and comptime std.Target.current.isDarwin()) outer: { +- const opts: DarwinOptions = if (use_lld and std.builtin.os.tag == .macos and options.target.isDarwin()) inner: { ++ const sysroot = blk: { ++ if (options.sysroot) |sysroot| { ++ break :blk sysroot; ++ } else if (darwin_can_use_system_linker_and_sdk) { + // TODO Revisit this targeting versions lower than macOS 11 when LLVM 12 is out. + // See https://github.com/ziglang/zig/issues/6996 + const at_least_big_sur = options.target.os.getVersionRange().semver.min.major >= 11; +- const syslibroot = if (at_least_big_sur) try std.zig.system.getSDKPath(arena) else null; +- const system_linker_hack = std.os.getenv("ZIG_SYSTEM_LINKER_HACK") != null; +- break :inner .{ +- .syslibroot = syslibroot, +- .system_linker_hack = system_linker_hack, +- }; +- } else .{}; +- break :outer opts; +- } else .{}; ++ break :blk if (at_least_big_sur) try std.zig.system.getSDKPath(arena) else null; ++ } else { ++ break :blk null; ++ } ++ }; + + const lto = blk: { + if (options.want_lto) |explicit| { +@@ -897,7 +905,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { + break :blk false; + } else if (options.c_source_files.len == 0) { + break :blk false; +- } else if (darwin_options.system_linker_hack) { ++ } else if (darwin_system_linker_hack) { + break :blk false; + } else switch (options.output_mode) { + .Lib, .Obj => break :blk false, +@@ -1273,13 +1281,14 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { + .module = module, + .target = options.target, + .dynamic_linker = options.dynamic_linker, ++ .sysroot = sysroot, + .output_mode = options.output_mode, + .link_mode = link_mode, + .object_format = ofmt, + .optimize_mode = options.optimize_mode, + .use_lld = use_lld, + .use_llvm = use_llvm, +- .system_linker_hack = darwin_options.system_linker_hack, ++ .system_linker_hack = darwin_system_linker_hack, + .link_libc = link_libc, + .link_libcpp = link_libcpp, + .link_libunwind = link_libunwind, +@@ -1287,7 +1296,6 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { + .frameworks = options.frameworks, + .framework_dirs = options.framework_dirs, + .system_libs = system_libs, +- .syslibroot = darwin_options.syslibroot, + .lib_dirs = options.lib_dirs, + .rpath_list = options.rpath_list, + .strip = strip, +diff --git a/src/link.zig b/src/link.zig +index fcb263f03..2d2c1ebea 100644 +--- a/src/link.zig ++++ b/src/link.zig +@@ -37,6 +37,8 @@ pub const Options = struct { + /// Not every Compilation compiles .zig code! For example you could do `zig build-exe foo.o`. + module: ?*Module, + dynamic_linker: ?[]const u8, ++ /// The root path for the dynamic linker and system libraries (as well as frameworks on Darwin) ++ sysroot: ?[]const u8, + /// Used for calculating how much space to reserve for symbols in case the binary file + /// does not already have a symbol table. + symbol_count_hint: u64 = 32, +@@ -103,8 +105,6 @@ pub const Options = struct { + llvm_cpu_features: ?[*:0]const u8, + /// Extra args passed directly to LLD. Ignored when not linking with LLD. + extra_lld_args: []const []const u8, +- /// Darwin-only. Set the root path to the system libraries and frameworks. +- syslibroot: ?[]const u8, + + objects: []const []const u8, + framework_dirs: []const []const u8, +diff --git a/src/link/Elf.zig b/src/link/Elf.zig +index 5bf20fdd2..981211151 100644 +--- a/src/link/Elf.zig ++++ b/src/link/Elf.zig +@@ -1354,6 +1354,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { + man.hash.add(allow_shlib_undefined); + man.hash.add(self.base.options.bind_global_refs_locally); + man.hash.add(self.base.options.tsan); ++ man.hash.addOptionalBytes(self.base.options.sysroot); + + // We don't actually care whether it's a cache hit or miss; we just need the digest and the lock. + _ = try man.hit(); +@@ -1423,6 +1424,10 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { + + try argv.append("-error-limit=0"); + ++ if (self.base.options.sysroot) |sysroot| { ++ try argv.append(try std.fmt.allocPrint(arena, "--sysroot={s}", .{sysroot})); ++ } ++ + if (self.base.options.lto) { + switch (self.base.options.optimize_mode) { + .Debug => {}, +diff --git a/src/link/MachO.zig b/src/link/MachO.zig +index 24dfa2c32..1e11a3258 100644 +--- a/src/link/MachO.zig ++++ b/src/link/MachO.zig +@@ -590,7 +590,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void { + man.hash.add(allow_shlib_undefined); + man.hash.add(self.base.options.bind_global_refs_locally); + man.hash.add(self.base.options.system_linker_hack); +- man.hash.addOptionalBytes(self.base.options.syslibroot); ++ man.hash.addOptionalBytes(self.base.options.sysroot); + + // We don't actually care whether it's a cache hit or miss; we just need the digest and the lock. + _ = try man.hit(); +@@ -720,7 +720,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void { + for (self.base.options.lib_dirs) |path| { + if (fs.path.isAbsolute(path)) { + var candidates = std.ArrayList([]const u8).init(arena); +- if (self.base.options.syslibroot) |syslibroot| { ++ if (self.base.options.sysroot) |syslibroot| { + const full_path = try fs.path.join(arena, &[_][]const u8{ syslibroot, path }); + try candidates.append(full_path); + } +@@ -813,7 +813,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void { + try argv.append("zig"); + try argv.append("ld"); + +- if (self.base.options.syslibroot) |syslibroot| { ++ if (self.base.options.sysroot) |syslibroot| { + try argv.append("-syslibroot"); + try argv.append(syslibroot); + } +@@ -959,7 +959,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void { + } + } + +- if (self.base.options.syslibroot) |dir| { ++ if (self.base.options.sysroot) |dir| { + try argv.append("-syslibroot"); + try argv.append(dir); + } +diff --git a/src/main.zig b/src/main.zig +index f5bda4379..b136a05bd 100644 +--- a/src/main.zig ++++ b/src/main.zig +@@ -377,6 +377,7 @@ const usage_build_generic = + \\ -T[script], --script [script] Use a custom linker script + \\ --version-script [path] Provide a version .map file + \\ --dynamic-linker [path] Set the dynamic interpreter path (usually ld.so) ++ \\ --sysroot [path] Set the system root directory (usually /) + \\ --version [ver] Dynamic library semver + \\ -fsoname[=name] (Linux) Override the default SONAME value + \\ -fno-soname (Linux) Disable emitting a SONAME +@@ -602,6 +603,7 @@ fn buildOutputType( + var link_eh_frame_hdr = false; + var link_emit_relocs = false; + var each_lib_rpath: ?bool = null; ++ var sysroot: ?[]const u8 = null; + var libc_paths_file: ?[]const u8 = try optionalStringEnvVar(arena, "ZIG_LIBC"); + var machine_code_model: std.builtin.CodeModel = .default; + var runtime_args_start: ?usize = null; +@@ -859,6 +861,10 @@ fn buildOutputType( + if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg}); + i += 1; + target_dynamic_linker = args[i]; ++ } else if (mem.eql(u8, arg, "--sysroot")) { ++ if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg}); ++ i += 1; ++ sysroot = args[i]; + } else if (mem.eql(u8, arg, "--libc")) { + if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg}); + i += 1; +@@ -1621,7 +1627,9 @@ fn buildOutputType( + want_native_include_dirs = true; + } + +- if (cross_target.isNativeOs() and (system_libs.items.len != 0 or want_native_include_dirs)) { ++ if (sysroot == null and cross_target.isNativeOs() and ++ (system_libs.items.len != 0 or want_native_include_dirs)) ++ { + const paths = std.zig.system.NativePaths.detect(arena, target_info) catch |err| { + fatal("unable to detect native system paths: {s}", .{@errorName(err)}); + }; +@@ -1898,6 +1906,7 @@ fn buildOutputType( + .is_native_os = cross_target.isNativeOs(), + .is_native_abi = cross_target.isNativeAbi(), + .dynamic_linker = target_info.dynamic_linker.get(), ++ .sysroot = sysroot, + .output_mode = output_mode, + .root_pkg = root_pkg, + .emit_bin = emit_bin_loc, +-- +2.32.0 + diff --git a/srcpkgs/zig/patches/0003-std-build-add-sysroot-general-option.patch b/srcpkgs/zig/patches/0003-std-build-add-sysroot-general-option.patch new file mode 100644 index 000000000000..fbb579d44b06 --- /dev/null +++ b/srcpkgs/zig/patches/0003-std-build-add-sysroot-general-option.patch @@ -0,0 +1,61 @@ +From e75dfbcb3f1892f67fa9a86157bc503fad300772 Mon Sep 17 00:00:00 2001 +From: Isaac Freund +Date: Fri, 25 Jun 2021 14:04:38 +0200 +Subject: [PATCH 3/3] std/build: add --sysroot general option + +--- + lib/std/build.zig | 5 +++++ + lib/std/special/build_runner.zig | 7 +++++++ + 2 files changed, 12 insertions(+) + +diff --git a/lib/std/build.zig b/lib/std/build.zig +index e433ec386..9b7ebb1f4 100644 +--- a/lib/std/build.zig ++++ b/lib/std/build.zig +@@ -57,6 +57,7 @@ pub const Builder = struct { + exe_dir: []const u8, + h_dir: []const u8, + install_path: []const u8, ++ sysroot: ?[]const u8 = null, + search_prefixes: ArrayList([]const u8), + libc_file: ?[]const u8 = null, + installed_files: ArrayList(InstalledFile), +@@ -2601,6 +2602,10 @@ pub const LibExeObjStep = struct { + } + } + ++ if (builder.sysroot) |sysroot| { ++ try zig_args.appendSlice(&[_][]const u8{ "--sysroot", sysroot }); ++ } ++ + for (builder.search_prefixes.items) |search_prefix| { + try zig_args.append("-L"); + try zig_args.append(try fs.path.join(builder.allocator, &[_][]const u8{ +diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig +index 2a0ca86d7..d1154add0 100644 +--- a/lib/std/special/build_runner.zig ++++ b/lib/std/special/build_runner.zig +@@ -87,6 +87,12 @@ pub fn main() !void { + warn("Expected argument after {s}\n\n", .{arg}); + return usageAndErr(builder, false, stderr_stream); + }; ++ } else if (mem.eql(u8, arg, "--sysroot")) { ++ const sysroot = nextArg(args, &arg_idx) orelse { ++ warn("Expected argument after --sysroot\n\n", .{}); ++ return usageAndErr(builder, false, stderr_stream); ++ }; ++ builder.sysroot = sysroot; + } else if (mem.eql(u8, arg, "--search-prefix")) { + const search_prefix = nextArg(args, &arg_idx) orelse { + warn("Expected argument after --search-prefix\n\n", .{}); +@@ -195,6 +201,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void + \\ -h, --help Print this help and exit + \\ --verbose Print commands before executing them + \\ -p, --prefix [path] Override default install prefix ++ \\ --sysroot [path] Set the system root directory (usually /) + \\ --search-prefix [path] Add a path to look for binaries, libraries, headers + \\ --libc [file] Provide a file which specifies libc paths + \\ --color [auto|off|on] Enable or disable colored error messages +-- +2.32.0 + diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template index baefd41af01e..f9a4c61839aa 100644 --- a/srcpkgs/zig/template +++ b/srcpkgs/zig/template @@ -1,7 +1,7 @@ # Template file for 'zig' pkgname=zig version=0.8.0 -revision=1 +revision=2 archs="x86_64* aarch64*" build_style=cmake make_cmd=make From b8f2fc18e34e0ec802d970486da0ab068c668b06 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Thu, 17 Jun 2021 16:20:30 +0000 Subject: [PATCH 2/3] build-styles: add zig-build We call this "zig-build" instead of just "zig" as this build-style relies on usage of the zig build system. In the future, other build systems such as meson may support zig code. Furthermore, the zig build system may be used to build C/C++ code as well, not just zig. --- common/build-profiles/README | 2 ++ common/build-profiles/aarch64-musl.sh | 2 ++ common/build-profiles/aarch64.sh | 2 ++ common/build-profiles/armv6l-musl.sh | 2 ++ common/build-profiles/armv6l.sh | 2 ++ common/build-profiles/armv7l-musl.sh | 2 ++ common/build-profiles/armv7l.sh | 2 ++ common/build-profiles/i686-musl.sh | 2 ++ common/build-profiles/i686.sh | 2 ++ common/build-profiles/ppc-musl.sh | 2 ++ common/build-profiles/ppc.sh | 2 ++ common/build-profiles/ppc64-musl.sh | 2 ++ common/build-profiles/ppc64.sh | 2 ++ common/build-profiles/ppc64le-musl.sh | 2 ++ common/build-profiles/ppc64le.sh | 2 ++ common/build-profiles/ppcle-musl.sh | 2 ++ common/build-profiles/ppcle.sh | 2 ++ common/build-profiles/x86_64-musl.sh | 2 ++ common/build-profiles/x86_64.sh | 2 ++ common/build-style/zig-build.sh | 40 ++++++++++++++++++++++++++ common/cross-profiles/README | 2 ++ common/cross-profiles/aarch64-musl.sh | 2 ++ common/cross-profiles/aarch64.sh | 2 ++ common/cross-profiles/armv5tel-musl.sh | 2 ++ common/cross-profiles/armv5tel.sh | 2 ++ common/cross-profiles/armv6l-musl.sh | 2 ++ common/cross-profiles/armv6l.sh | 2 ++ common/cross-profiles/armv7l-musl.sh | 2 ++ common/cross-profiles/armv7l.sh | 2 ++ common/cross-profiles/i686-musl.sh | 2 ++ common/cross-profiles/i686.sh | 2 ++ common/cross-profiles/mips-musl.sh | 2 ++ common/cross-profiles/mipsel-musl.sh | 2 ++ common/cross-profiles/mipselhf-musl.sh | 2 ++ common/cross-profiles/mipshf-musl.sh | 2 ++ common/cross-profiles/ppc-musl.sh | 2 ++ common/cross-profiles/ppc.sh | 2 ++ common/cross-profiles/ppc64-musl.sh | 2 ++ common/cross-profiles/ppc64.sh | 2 ++ common/cross-profiles/ppc64le-musl.sh | 2 ++ common/cross-profiles/ppc64le.sh | 2 ++ common/cross-profiles/ppcle-musl.sh | 2 ++ common/cross-profiles/ppcle.sh | 2 ++ common/cross-profiles/x86_64-musl.sh | 2 ++ common/cross-profiles/x86_64.sh | 2 ++ 45 files changed, 128 insertions(+) create mode 100644 common/build-style/zig-build.sh diff --git a/common/build-profiles/README b/common/build-profiles/README index e4457c16f22c..41b18fc1174e 100644 --- a/common/build-profiles/README +++ b/common/build-profiles/README @@ -9,6 +9,8 @@ for a specific architecture: - XBPS_CXXFLAGS (C++ compiler flags for the host compiler) - XBPS_FFLAGS (Fortran compiler flags for the host compiler) - XBPS_RUST_TARGET (the compiler triplet for usage by cargo) + - XBPS_ZIG_TARGET (the arch-os-abi target triplet for zig) + - XBPS_ZIG_CPU (the cpu/feature set for zig) These properties are also set in a cross environment, but the compiler flags are not added into the global flags. XBPS_RUST_TARGET is also diff --git a/common/build-profiles/aarch64-musl.sh b/common/build-profiles/aarch64-musl.sh index 76249d0b75c8..8427d0478a9a 100644 --- a/common/build-profiles/aarch64-musl.sh +++ b/common/build-profiles/aarch64-musl.sh @@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TRIPLET="aarch64-unknown-linux-musl" XBPS_RUST_TARGET="$XBPS_TRIPLET" +XBPS_ZIG_TARGET="aarch64-linux-musl" +XBPS_ZIG_CPU="baseline" diff --git a/common/build-profiles/aarch64.sh b/common/build-profiles/aarch64.sh index ccf7d5af3d54..59855dfc0c82 100644 --- a/common/build-profiles/aarch64.sh +++ b/common/build-profiles/aarch64.sh @@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TRIPLET="aarch64-unknown-linux-gnu" XBPS_RUST_TARGET="$XBPS_TRIPLET" +XBPS_ZIG_TARGET="aarch64-linux-gnu" +XBPS_ZIG_CPU="baseline" diff --git a/common/build-profiles/armv6l-musl.sh b/common/build-profiles/armv6l-musl.sh index 172e56e81a82..b46941a39976 100644 --- a/common/build-profiles/armv6l-musl.sh +++ b/common/build-profiles/armv6l-musl.sh @@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TRIPLET="armv6l-linux-musleabihf" XBPS_RUST_TARGET="arm-unknown-linux-musleabihf" +XBPS_ZIG_TARGET="arm-linux-musleabihf" +XBPS_ZIG_CPU="generic+v6" diff --git a/common/build-profiles/armv6l.sh b/common/build-profiles/armv6l.sh index d84b6bdb2cc2..3b182234cb6d 100644 --- a/common/build-profiles/armv6l.sh +++ b/common/build-profiles/armv6l.sh @@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TRIPLET="armv6l-unknown-linux-gnueabihf" XBPS_RUST_TARGET="arm-unknown-linux-gnueabihf" +XBPS_ZIG_TARGET="arm-linux-gnueabihf" +XBPS_ZIG_CPU="generic+v6" diff --git a/common/build-profiles/armv7l-musl.sh b/common/build-profiles/armv7l-musl.sh index f81ad699e07a..dbf3eb0d5b92 100644 --- a/common/build-profiles/armv7l-musl.sh +++ b/common/build-profiles/armv7l-musl.sh @@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_CXXFLAGS" XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TRIPLET="armv7l-linux-musleabihf" XBPS_RUST_TARGET="armv7-unknown-linux-musleabihf" +XBPS_ZIG_TARGET="arm-linux-musleabihf" +XBPS_ZIG_CPU="generic+v7a+vfp3" diff --git a/common/build-profiles/armv7l.sh b/common/build-profiles/armv7l.sh index a100e410f9a9..141639b132b0 100644 --- a/common/build-profiles/armv7l.sh +++ b/common/build-profiles/armv7l.sh @@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TRIPLET="armv7l-unknown-linux-gnueabihf" XBPS_RUST_TARGET="armv7-unknown-linux-gnueabihf" +XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf" +XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3" diff --git a/common/build-profiles/i686-musl.sh b/common/build-profiles/i686-musl.sh index e76ab89d6ae3..a607ef619e79 100644 --- a/common/build-profiles/i686-musl.sh +++ b/common/build-profiles/i686-musl.sh @@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TRIPLET="i686-linux-musl" XBPS_RUST_TARGET="i686-unknown-linux-musl" +XBPS_ZIG_TARGET="i686-linux-musl" +XBPS_ZIG_CPU="baseline" diff --git a/common/build-profiles/i686.sh b/common/build-profiles/i686.sh index 036a91b2b92b..ff872ed9d4b2 100644 --- a/common/build-profiles/i686.sh +++ b/common/build-profiles/i686.sh @@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TRIPLET="i686-pc-linux-gnu" XBPS_RUST_TARGET="i686-unknown-linux-gnu" +XBPS_ZIG_TARGET="i686-linux-gnu" +XBPS_ZIG_CPU="baseline" diff --git a/common/build-profiles/ppc-musl.sh b/common/build-profiles/ppc-musl.sh index 17296432e97b..60b2e700270a 100644 --- a/common/build-profiles/ppc-musl.sh +++ b/common/build-profiles/ppc-musl.sh @@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TRIPLET="powerpc-linux-musl" XBPS_RUST_TARGET="powerpc-unknown-linux-musl" +XBPS_ZIG_TARGET="powerpc-linux-musl" +XBPS_ZIG_CPU="baseline" diff --git a/common/build-profiles/ppc.sh b/common/build-profiles/ppc.sh index f7ec35b69a64..b7a113139792 100644 --- a/common/build-profiles/ppc.sh +++ b/common/build-profiles/ppc.sh @@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TRIPLET="powerpc-linux-gnu" XBPS_RUST_TARGET="powerpc-unknown-linux-gnu" +XBPS_ZIG_TARGET="powerpc-linux-gnu" +XBPS_ZIG_CPU="baseline" diff --git a/common/build-profiles/ppc64-musl.sh b/common/build-profiles/ppc64-musl.sh index 53c5ea6fb3f8..4ec7430b39a9 100644 --- a/common/build-profiles/ppc64-musl.sh +++ b/common/build-profiles/ppc64-musl.sh @@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TRIPLET="powerpc64-unknown-linux-musl" XBPS_RUST_TARGET="$XBPS_TRIPLET" +XBPS_ZIG_TARGET="powerpc64-linux-musl" +XBPS_ZIG_CPU="970" diff --git a/common/build-profiles/ppc64.sh b/common/build-profiles/ppc64.sh index aa9af966ea78..1d0c04ae3747 100644 --- a/common/build-profiles/ppc64.sh +++ b/common/build-profiles/ppc64.sh @@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TRIPLET="powerpc64-unknown-linux-gnu" XBPS_RUST_TARGET="$XBPS_TRIPLET" +XBPS_ZIG_TARGET="powerpc64-linux-gnu" +XBPS_ZIG_CPU="970" diff --git a/common/build-profiles/ppc64le-musl.sh b/common/build-profiles/ppc64le-musl.sh index cb9423f99748..8d2db1b2b518 100644 --- a/common/build-profiles/ppc64le-musl.sh +++ b/common/build-profiles/ppc64le-musl.sh @@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TRIPLET="powerpc64le-unknown-linux-musl" XBPS_RUST_TARGET="$XBPS_TRIPLET" +XBPS_ZIG_TARGET="powerpc64le-linux-musl" +XBPS_ZIG_CPU="baseline" diff --git a/common/build-profiles/ppc64le.sh b/common/build-profiles/ppc64le.sh index c91ea054789e..8f0e735f873e 100644 --- a/common/build-profiles/ppc64le.sh +++ b/common/build-profiles/ppc64le.sh @@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TRIPLET="powerpc64le-unknown-linux-gnu" XBPS_RUST_TARGET="$XBPS_TRIPLET" +XBPS_ZIG_TARGET="powerpc64le-linux-gnu" +XBPS_ZIG_CPU="baseline" diff --git a/common/build-profiles/ppcle-musl.sh b/common/build-profiles/ppcle-musl.sh index 7585c4f6919d..c8d7e28e4834 100644 --- a/common/build-profiles/ppcle-musl.sh +++ b/common/build-profiles/ppcle-musl.sh @@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TRIPLET="powerpcle-linux-musl" XBPS_RUST_TARGET="powerpcle-unknown-linux-musl" +XBPS_ZIG_TARGET="powerpcle-linux-musl" +XBPS_ZIG_CPU="pwr8" diff --git a/common/build-profiles/ppcle.sh b/common/build-profiles/ppcle.sh index 0cdc6cc853c9..7eccadf4ed26 100644 --- a/common/build-profiles/ppcle.sh +++ b/common/build-profiles/ppcle.sh @@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TRIPLET="powerpcle-linux-gnu" XBPS_RUST_TARGET="powerpcle-unknown-linux-gnu" +XBPS_ZIG_TARGET="powerpcle-linux-gnu" +XBPS_ZIG_CPU="pwr8" diff --git a/common/build-profiles/x86_64-musl.sh b/common/build-profiles/x86_64-musl.sh index b0bbb30bd160..538baea0b613 100644 --- a/common/build-profiles/x86_64-musl.sh +++ b/common/build-profiles/x86_64-musl.sh @@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TRIPLET="x86_64-unknown-linux-musl" XBPS_RUST_TARGET="${XBPS_TRIPLET}" +XBPS_ZIG_TARGET="x86_64-linux-musl" +XBPS_ZIG_CPU="baseline" diff --git a/common/build-profiles/x86_64.sh b/common/build-profiles/x86_64.sh index a53f4aafdacd..388b5561a6d2 100644 --- a/common/build-profiles/x86_64.sh +++ b/common/build-profiles/x86_64.sh @@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS" XBPS_TRIPLET="x86_64-unknown-linux-gnu" XBPS_RUST_TARGET="${XBPS_TRIPLET}" +XBPS_ZIG_TARGET="x86_64-linux-gnu" +XBPS_ZIG_CPU="baseline" diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh new file mode 100644 index 000000000000..9a8825ddf9e7 --- /dev/null +++ b/common/build-style/zig-build.sh @@ -0,0 +1,40 @@ +do_build() { + local zig_target zig_cpu + + # TODO: This duplication between build-profiles and cross-profiles + # is totally unnecessary. It would be nice if there was some way to + # avoid it. + if [ "$CROSS_BUILD" ]; then + zig_target="${XBPS_CROSS_ZIG_TARGET}" + zig_cpu="${XBPS_CROSS_ZIG_CPU}" + else + zig_target="${XBPS_ZIG_TARGET}" + zig_cpu="${XBPS_ZIG_CPU}" + fi + + # Inform zig of the required libc include paths. + cat > xbps_zig_libc.txt <<-EOF + include_dir=${XBPS_CROSS_BASE}/usr/include + sys_include_dir=${XBPS_CROSS_BASE}/usr/include + crt_dir=${XBPS_CROSS_BASE}/usr/lib + msvc_lib_dir= + kernel32_lib_dir= + gcc_dir= + EOF + + # The Zig build system only has a single install step, there is no + # way to build artifacts for a given prefix and then install those artifacts + # to that prefix at some later time. Therefore, we build and install to the zig-out + # directory and later copy the artifacts to the destdir in do_install(). + # We use zig-out to avoid path conflicts as it is the default install + # prefix used by the zig build system. + DESTDIR="zig-out" zig build \ + --sysroot "${XBPS_CROSS_BASE}" \ + --libc xbps_zig_libc.txt \ + -Dtarget="${zig_target}" -Dcpu="${zig_cpu}" \ + -Drelease-safe --prefix /usr install +} + +do_install() { + cp -r zig-out/* "${DESTDIR}" +} diff --git a/common/cross-profiles/README b/common/cross-profiles/README index 2a2a1d4b423a..f2300b5d5a94 100644 --- a/common/cross-profiles/README +++ b/common/cross-profiles/README @@ -13,5 +13,7 @@ A cross profile file must provide the following variables: - XBPS_CROSS_LDFLAGS (Linker flags for the cross compiler) - XBPS_CROSS_RUST_TARGET (the rust triplet for the rust cross compiler) - XBPS_CROSS_RUSTFLAGS (rust compiler flags for the cross compiler) + - XBPS_CROSS_ZIG_TARGET (the arch-os-abi target triplet for zig) + - XBPS_CROSS_ZIG_CPU (the cpu/feature set for zig) A source package matching `cross-${XBPS_CROSS_TRIPLET}' must also exist. diff --git a/common/cross-profiles/aarch64-musl.sh b/common/cross-profiles/aarch64-musl.sh index 56ce2d32964a..892abba9ef3c 100644 --- a/common/cross-profiles/aarch64-musl.sh +++ b/common/cross-profiles/aarch64-musl.sh @@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-musl" +XBPS_CROSS_ZIG_TARGET="aarch64-linux-musl" +XBPS_CROSS_ZIG_CPU="baseline" diff --git a/common/cross-profiles/aarch64.sh b/common/cross-profiles/aarch64.sh index 068870a31588..7a99e6fc72c6 100644 --- a/common/cross-profiles/aarch64.sh +++ b/common/cross-profiles/aarch64.sh @@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-gnu" +XBPS_CROSS_ZIG_TARGET="aarch64-linux-gnu" +XBPS_CROSS_ZIG_CPU="baseline" diff --git a/common/cross-profiles/armv5tel-musl.sh b/common/cross-profiles/armv5tel-musl.sh index 3894f0c87313..0eb813a54d64 100644 --- a/common/cross-profiles/armv5tel-musl.sh +++ b/common/cross-profiles/armv5tel-musl.sh @@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabi" +XBPS_CROSS_ZIG_TARGET="arm-linux-musleabi" +XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float" diff --git a/common/cross-profiles/armv5tel.sh b/common/cross-profiles/armv5tel.sh index d56c50a80063..f5828360f112 100644 --- a/common/cross-profiles/armv5tel.sh +++ b/common/cross-profiles/armv5tel.sh @@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabi" +XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabi" +XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float" diff --git a/common/cross-profiles/armv6l-musl.sh b/common/cross-profiles/armv6l-musl.sh index 58b67f85a97e..5f32f9ba0aec 100644 --- a/common/cross-profiles/armv6l-musl.sh +++ b/common/cross-profiles/armv6l-musl.sh @@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabihf" +XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf" +XBPS_CROSS_ZIG_CPU="generic+v6" diff --git a/common/cross-profiles/armv6l.sh b/common/cross-profiles/armv6l.sh index b146eb87219b..7040996ea1c1 100644 --- a/common/cross-profiles/armv6l.sh +++ b/common/cross-profiles/armv6l.sh @@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabihf" +XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf" +XBPS_CROSS_ZIG_CPU="generic+v6" diff --git a/common/cross-profiles/armv7l-musl.sh b/common/cross-profiles/armv7l-musl.sh index 93e3cc5b3d72..9a38832e0d7d 100644 --- a/common/cross-profiles/armv7l-musl.sh +++ b/common/cross-profiles/armv7l-musl.sh @@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-musleabihf" +XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf" +XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3" diff --git a/common/cross-profiles/armv7l.sh b/common/cross-profiles/armv7l.sh index 674165e238a1..b8c9c41d35a5 100644 --- a/common/cross-profiles/armv7l.sh +++ b/common/cross-profiles/armv7l.sh @@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-gnueabihf" +XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf" +XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3" diff --git a/common/cross-profiles/i686-musl.sh b/common/cross-profiles/i686-musl.sh index fcb3d8ec4b49..c1cdf60f5ebb 100644 --- a/common/cross-profiles/i686-musl.sh +++ b/common/cross-profiles/i686-musl.sh @@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" XBPS_CROSS_RUST_TARGET="i686-unknown-linux-musl" +XBPS_CROSS_ZIG_TARGET="i686-linux-musl" +XBPS_CROSS_ZIG_CPU="baseline" diff --git a/common/cross-profiles/i686.sh b/common/cross-profiles/i686.sh index 07ee8883707a..452db8eaf386 100644 --- a/common/cross-profiles/i686.sh +++ b/common/cross-profiles/i686.sh @@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" XBPS_CROSS_RUST_TARGET="i686-unknown-linux-gnu" +XBPS_CROSS_ZIG_TARGET="i686-linux-gnu" +XBPS_CROSS_ZIG_CPU="baseline" diff --git a/common/cross-profiles/mips-musl.sh b/common/cross-profiles/mips-musl.sh index f1d9fe2fd1a3..7c44de7577e2 100644 --- a/common/cross-profiles/mips-musl.sh +++ b/common/cross-profiles/mips-musl.sh @@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl" +XBPS_CROSS_ZIG_TARGET="mips-linux-musl" +XBPS_CROSS_ZIG_CPU="generic+soft_float" diff --git a/common/cross-profiles/mipsel-musl.sh b/common/cross-profiles/mipsel-musl.sh index 0d1117deb06c..fa4390c98dcd 100644 --- a/common/cross-profiles/mipsel-musl.sh +++ b/common/cross-profiles/mipsel-musl.sh @@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl" +XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl" +XBPS_CROSS_ZIG_CPU="generic+soft_float" diff --git a/common/cross-profiles/mipselhf-musl.sh b/common/cross-profiles/mipselhf-musl.sh index 8587a88e6ca5..49f4558ca2fa 100644 --- a/common/cross-profiles/mipselhf-musl.sh +++ b/common/cross-profiles/mipselhf-musl.sh @@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl" +XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl" +XBPS_CROSS_ZIG_CPU="generic" diff --git a/common/cross-profiles/mipshf-musl.sh b/common/cross-profiles/mipshf-musl.sh index 2914eaf19f85..513391b6284e 100644 --- a/common/cross-profiles/mipshf-musl.sh +++ b/common/cross-profiles/mipshf-musl.sh @@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl" +XBPS_CROSS_ZIG_TARGET="mips-linux-musl" +XBPS_CROSS_ZIG_CPU="generic" diff --git a/common/cross-profiles/ppc-musl.sh b/common/cross-profiles/ppc-musl.sh index 631b1fb427e9..327ae2341b99 100644 --- a/common/cross-profiles/ppc-musl.sh +++ b/common/cross-profiles/ppc-musl.sh @@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-musl" +XBPS_ZIG_TARGET="powerpc-linux-musl" +XBPS_ZIG_CPU="baseline" diff --git a/common/cross-profiles/ppc.sh b/common/cross-profiles/ppc.sh index 4647c62de2dd..787f6bb2943b 100644 --- a/common/cross-profiles/ppc.sh +++ b/common/cross-profiles/ppc.sh @@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-gnu" +XBPS_ZIG_TARGET="powerpc-linux-gnu" +XBPS_ZIG_CPU="baseline" diff --git a/common/cross-profiles/ppc64-musl.sh b/common/cross-profiles/ppc64-musl.sh index 2cc74b352a13..c4b0f35e094b 100644 --- a/common/cross-profiles/ppc64-musl.sh +++ b/common/cross-profiles/ppc64-musl.sh @@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-musl" +XBPS_CROSS_ZIG_TARGET="powerpc64-linux-musl" +XBPS_CROSS_ZIG_CPU="970" diff --git a/common/cross-profiles/ppc64.sh b/common/cross-profiles/ppc64.sh index 4fedf210000d..7ed5bc0d5f1f 100644 --- a/common/cross-profiles/ppc64.sh +++ b/common/cross-profiles/ppc64.sh @@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-gnu" +XBPS_CROSS_ZIG_TARGET="powerpc64-linux-gnu" +XBPS_CROSS_ZIG_CPU="970" diff --git a/common/cross-profiles/ppc64le-musl.sh b/common/cross-profiles/ppc64le-musl.sh index b08f78c91f33..df18c300ddb0 100644 --- a/common/cross-profiles/ppc64le-musl.sh +++ b/common/cross-profiles/ppc64le-musl.sh @@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-musl" +XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-musl" +XBPS_CROSS_ZIG_CPU="baseline" diff --git a/common/cross-profiles/ppc64le.sh b/common/cross-profiles/ppc64le.sh index 88e8649a7658..3fe7b2da47b6 100644 --- a/common/cross-profiles/ppc64le.sh +++ b/common/cross-profiles/ppc64le.sh @@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-gnu" +XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-gnu" +XBPS_CROSS_ZIG_CPU="baseline" diff --git a/common/cross-profiles/ppcle-musl.sh b/common/cross-profiles/ppcle-musl.sh index 2ba308f224d5..48e27c04b90f 100644 --- a/common/cross-profiles/ppcle-musl.sh +++ b/common/cross-profiles/ppcle-musl.sh @@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-musl" +XBPS_CROSS_ZIG_TARGET="powerpcle-linux-musl" +XBPS_CROSS_ZIG_CPU="pwr8" diff --git a/common/cross-profiles/ppcle.sh b/common/cross-profiles/ppcle.sh index 3e5230b194ef..a59158233660 100644 --- a/common/cross-profiles/ppcle.sh +++ b/common/cross-profiles/ppcle.sh @@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-gnu" +XBPS_CROSS_ZIG_TARGET="powerpcle-linux-gnu" +XBPS_CROSS_ZIG_CPU="pwr8" diff --git a/common/cross-profiles/x86_64-musl.sh b/common/cross-profiles/x86_64-musl.sh index a1c27c6f7933..38642a07f8a9 100644 --- a/common/cross-profiles/x86_64-musl.sh +++ b/common/cross-profiles/x86_64-musl.sh @@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-musl" +XBPS_CROSS_ZIG_TARGET="x86_64-linux-musl" +XBPS_CROSS_ZIG_CPU="baseline" diff --git a/common/cross-profiles/x86_64.sh b/common/cross-profiles/x86_64.sh index 360dd2068fc2..bd966d0e01df 100644 --- a/common/cross-profiles/x86_64.sh +++ b/common/cross-profiles/x86_64.sh @@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS" XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr" XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-gnu" +XBPS_CROSS_ZIG_TARGET="x86_64-linux-gnu" +XBPS_CROSS_ZIG_CPU="baseline" From 217d259f407b7b4510a7176b6142cd1fec0b1a2d Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Thu, 17 Jun 2021 01:40:15 +0000 Subject: [PATCH 3/3] New package: rundird-0.2.0 --- srcpkgs/rundird/files/rundird/run | 2 ++ srcpkgs/rundird/template | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 srcpkgs/rundird/files/rundird/run create mode 100644 srcpkgs/rundird/template diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run new file mode 100644 index 000000000000..e4aae8c83b4b --- /dev/null +++ b/srcpkgs/rundird/files/rundird/run @@ -0,0 +1,2 @@ +#!/bin/sh +exec rundird diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template new file mode 100644 index 000000000000..3d4dc8b75d59 --- /dev/null +++ b/srcpkgs/rundird/template @@ -0,0 +1,17 @@ +# Template file for 'rundird' +pkgname=rundird +version=0.2.0 +revision=1 +build_style=zig-build +hostmakedepends="zig" +makedepends="pam-devel" +short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR" +maintainer="Isaac Freund " +license="GPL-3.0-or-later" +homepage="https://github.com/ifreund/rundird" +distfiles="${homepage}/archive/v${version}.tar.gz" +checksum=1dea207f39388e8c2c275b8a9aada0166d1f587a806f2e5e4486d98259e23e4c + +post_install() { + vsv rundird +}