[packages/mold] Up to 3.0.0
arekm
arekm at pld-linux.org
Fri Nov 27 21:32:37 CET 2026
commit fb1729a33824631e73141e3020df9c4b74d82032
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Fri Nov 27 14:49:17 2026 +0100
Up to 3.0.0
mold.spec | 85 +++++++++++++++++++++++++++++++++++++++++----------------------
1 file changed, 56 insertions(+), 29 deletions(-)
---
diff --git a/mold.spec b/mold.spec
index 5abb001..25a1f88 100644
--- a/mold.spec
+++ b/mold.spec
@@ -2,31 +2,34 @@
# Conditional build:
%bcond_without tests # build without tests
+%define crates_ver 3.0.0
+
Summary: mold: A Modern Linker
Name: mold
-Version: 2.42.1
+Version: 3.0.0
Release: 1
License: MIT
Group: Development/Libraries
Source0: https://github.com/rui314/mold/archive/v%{version}/%{name}-%{version}.tar.gz
-# Source0-md5: 8aae68ecbb0c55429e24b31ca3ffa8f2
+# Source0-md5: a7e43d23f63338e06c6927c6d1d36c01
+# cd mold-%%{version}
+# cargo vendor
+# mkdir mold-crates-%%{crates_ver}; mv vendor mold-crates-%%{crates_ver}
+# tar cJf mold-crates-%%{crates_ver}.tar.xz mold-crates-%%{crates_ver}
+Source1: %{name}-crates-%{crates_ver}.tar.xz
+# Source1-md5: ac411fb797609bd4bb73949a73ca999d
URL: https://github.com/rui314/mold
-BuildRequires: blake3-devel
-BuildRequires: cmake >= 3.14
+BuildRequires: cargo
%{?with_tests:BuildRequires: glibc-static}
-%ifarch %{armv6} riscv64
-BuildRequires: libatomic-devel
-%endif
-BuildRequires: libstdc++-devel >= 6:10
-%{?with_tests:BuildRequires: libstdc++-static >= 6:10}
-BuildRequires: mimalloc-devel >= 3
-BuildRequires: rpmbuild(macros) >= 2.007
-BuildRequires: tbb-devel >= 2021.3.0
+BuildRequires: pkgconfig
+BuildRequires: rpmbuild(macros) >= 2.050
+BuildRequires: rust >= 1.95
+BuildRequires: tar >= 1:1.22
+BuildRequires: xz
BuildRequires: zlib-devel
BuildRequires: zstd-devel
-Requires: mimalloc >= 3
-Requires: tbb >= 2021.3.0
-ExclusiveArch: %{ix86} %{x8664} %{arm} aarch64 m68k ppc64 ppc64le riscv32 riscv64 s390x sparc64
+%{?rust_req}
+ExclusiveArch: %{rust_arches}
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
@@ -37,28 +40,52 @@ created for increasing developer productivity by reducing build time
especially in rapid debug-edit-rebuild cycles.
%prep
-%setup -q
+%setup -q -a1
+
+%{__mv} %{name}-crates-%{crates_ver}/vendor .
+
+# use our offline registry; kept apart from the project's own .cargo/config.toml
+export CARGO_HOME="$(pwd)/.cargo-home"
+
+mkdir -p "$CARGO_HOME"
+cat >"$CARGO_HOME/config.toml" <<EOF
+[source.crates-io]
+replace-with = 'vendored-sources'
+
+[source."git+https://github.com/rui314/mimalloc_rust?rev=3979460494f1cd1e7f936cb8e10f41e927c9f698"]
+git = "https://github.com/rui314/mimalloc_rust"
+rev = "3979460494f1cd1e7f936cb8e10f41e927c9f698"
+replace-with = 'vendored-sources'
-%{__rm} -r third-party/{mimalloc,tbb}
+[source.vendored-sources]
+directory = '$PWD/vendor'
+EOF
%build
-%cmake -B build \
- %{cmake_on_off tests BUILD_TESTING} \
- -DMOLD_USE_MIMALLOC:BOOL=ON \
- -DMOLD_USE_SYSTEM_MIMALLOC:BOOL=ON \
- -DMOLD_USE_SYSTEM_TBB:BOOL=ON
+export CARGO_HOME="$(pwd)/.cargo-home"
+export MOLD_LIBDIR=%{_libdir}
+export ZSTD_SYS_USE_PKG_CONFIG=1
-%{__make} -C build
+%cargo_build --frozen -p mold-cli
%if %{with tests}
-%{__make} -C build test
+# same flags as %%cargo_build, otherwise cargo rebuilds mold without debuginfo
+CC="%{__cc}" \
+CFLAGS="%{rpmcppflags} %{rpmcflags}" \
+LDFLAGS="%{rpmldflags}" \
+RUSTFLAGS="%{rpmrustflags}" \
+%{__cargo} %{__cargo_common_opts} test --frozen --release \
+ --target %{rust_target} --target-dir %{cargo_targetdir}
%endif
%install
rm -rf $RPM_BUILD_ROOT
-%{__make} -C build install \
- DESTDIR=$RPM_BUILD_ROOT
+PREFIX=%{_prefix} \
+MOLD_LIBDIR=%{_libdir} \
+DESTDIR=$RPM_BUILD_ROOT \
+CARGO_TARGET_DIR=$PWD/%{cargo_targetdir}/%{rust_target} \
+./install-mold.sh
%clean
rm -rf $RPM_BUILD_ROOT
@@ -66,11 +93,11 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
%doc LICENSE README.md docs/*.md
-%attr(755,root,root) %{_bindir}/ld.mold
+%{_bindir}/ld.mold
%attr(755,root,root) %{_bindir}/mold
%dir %{_libdir}/mold
-%attr(755,root,root) %{_libdir}/mold/mold-wrapper.so
+%{_libdir}/mold/mold-wrapper.so
%dir %{_libexecdir}/mold
-%attr(755,root,root) %{_libexecdir}/mold/ld
+%{_libexecdir}/mold/ld
%{_mandir}/man1/mold.1*
%{_mandir}/man1/ld.mold.1*
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/mold.git/commitdiff/fb1729a33824631e73141e3020df9c4b74d82032
More information about the pld-cvs-commit
mailing list