diff --git a/0001-ignore-target-lib-dirs-when-invoked-with-feach-lib-r.patch b/0001-ignore-target-lib-dirs-when-invoked-with-feach-lib-r.patch new file mode 100644 index 0000000..f31b2f5 --- /dev/null +++ b/0001-ignore-target-lib-dirs-when-invoked-with-feach-lib-r.patch @@ -0,0 +1,40 @@ +From ef02f49f11a80492cc3792fe573167a6aa743f52 Mon Sep 17 00:00:00 2001 +From: Jan200101 +Date: Thu, 20 Jan 2022 18:57:39 +0100 +Subject: [PATCH] ignore target lib dirs when invoked with -feach-lib-rpath + +Signed-off-by: Jan200101 +--- + src/link/Elf.zig | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/src/link/Elf.zig b/src/link/Elf.zig +index 24f8a02b9..9e27dc786 100644 +--- a/src/link/Elf.zig ++++ b/src/link/Elf.zig +@@ -1551,7 +1551,22 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { + if (self.base.options.each_lib_rpath) { + var test_path = std.ArrayList(u8).init(self.base.allocator); + defer test_path.deinit(); ++ ++ const cross_target = std.zig.CrossTarget.fromTarget(target); ++ const target_info = try std.zig.system.NativeTargetInfo.detect(self.base.allocator, cross_target); ++ const native_paths = try std.zig.system.NativePaths.detect(self.base.allocator, target_info); ++ + for (self.base.options.lib_dirs) |lib_dir_path| { ++ var is_target_lib_dir = false; ++ for (native_paths.lib_dirs.items) |lib_dir| { ++ if (mem.eql(u8, lib_dir, lib_dir_path)) { ++ is_target_lib_dir = true; ++ break; ++ } ++ } ++ if (is_target_lib_dir) { ++ continue; ++ } + for (self.base.options.system_libs.keys()) |link_lib| { + test_path.clearRetainingCapacity(); + const sep = fs.path.sep_str; +-- +2.34.1 + diff --git a/macros.zig b/macros.zig index c647951..4aacbc5 100644 --- a/macros.zig +++ b/macros.zig @@ -3,18 +3,39 @@ %_zig_version @@ZIG_VERSION@@ %zig /usr/bin/zig +# expected features for each arch when targeting baseline +# found in https://github.com/ziglang/zig/tree/master/lib/std/target +# +# aarch64: +# ete, fuse_aes, neon, perfmon, use_postra_scheduler, +# +# x86_64: +# cx8 idivq_to_divl macrofusion slow_3ops_lea slow_incdec vzeroupper x87 +# +# riscv64: +# a, c, d, m +# +# mips64: +# mips32 +%_zig_cpu baseline +%_zig_target native + +# seperated build options +%_zig_general_options --verbose +%_zig_project_options -Dtarget=%{_zig_target} -Dcpu=%{_zig_cpu} -Drelease-safe +%_zig_advanced_options --cache-dir zig-cache + +%_zig_build_options %{?_zig_general_options} %{?_zig_project_options} %{?_zig_advanced_options} +%_zig_install_options --prefix "%{_prefix}" --prefix-lib-dir "%{_libdir}" --prefix-exe-dir "%{_bindir}" --prefix-include-dir "%{_includedir}" + %zig_build %zig \\\ build \\\ - --verbose \\\ - --cache-dir zig-cache + %{?_zig_build_options} %zig_install \ DESTDIR="%{buildroot}" %zig_build \\\ install \\\ - --prefix "%{_prefix}" \\\ - --prefix-lib-dir "%{_libdir}" \\\ - --prefix-exe-dir "%{_bindir}" \\\ - --prefix-include-dir "%{_includedir}" + %{?_zig_install_options} %zig_test \ %zig_build \\\ diff --git a/zig.spec b/zig.spec index e5065d3..78c16f1 100644 --- a/zig.spec +++ b/zig.spec @@ -1,4 +1,4 @@ -# https://ziglang.org/download/0.8.1/release-notes.html#Support-Table +# https://ziglang.org/download/%{version}/release-notes.html#Support-Table # 32 bit builds currently run out of memory https://github.com/ziglang/zig/issues/6485 %global zig_arches x86_64 aarch64 riscv64 %{mips64} @@ -22,13 +22,16 @@ Name: zig Version: 0.9.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Programming language for maintaining robust, optimal, and reusable software License: MIT and NCSA and LGPLv2+ and LGPLv2+ with exceptions and GPLv2+ and GPLv2+ with exceptions and BSD and Inner-Net and ISC and Public Domain and GFDL and ZPLv2.1 URL: https://ziglang.org Source0: https://github.com/ziglang/zig/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz Source1: macros.%{name} +# should prevent native directories from being in the rpath +# https://github.com/ziglang/zig/pull/10621 +Patch0: 0001-ignore-target-lib-dirs-when-invoked-with-feach-lib-r.patch BuildRequires: gcc BuildRequires: gcc-c++ @@ -78,11 +81,11 @@ and clarity. This package provides the zig compiler and the associated runtime. # the standard library contains only plain text %package libs -Summary: zig standard library +Summary: %{name} Standard Library BuildArch: noarch %description libs -Standard Zig library +%{name} Standard Library %if %{with docs} %package doc @@ -105,7 +108,7 @@ This package contains common RPM macros for %{name}. %endif %prep -%setup -q +%autosetup -p1 %build @@ -166,9 +169,14 @@ sed -i -e "s|@@ZIG_VERSION@@|%{version}|" %{buildroot}%{_rpmconfigdir}/macros.d %endif %changelog +* Thu Jan 27 2022 Jan Drögehoff - 0.9.0-3 +- Jan: add rpath patch +- Aleksei Bavshin: rpm macros: set default build flags + * Sat Jan 22 2022 Fedora Release Engineering - 0.9.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + * Mon Dec 20 2021 Jan Drögehoff - 0.9.0-1 - Update to 0.9.0