nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix

llvmPackages.bintuils: Hack ranlib to ignore `-t`

Old versions of libtool for OpenBSD insist on adding the `-t` flag to
ranlib, which updates the timestamp. llvm-ranlib does not support `-t`
and as no plans to do so [1], since it makes builds less reproducable.
OpenBSD upstream deals with this by patching ranlib to ignore the `-t`
flag [2].

Instead of writing patches for all LLVM versions or re-running `autoreconf`
on all packages that use libtool, we can wrap ranlib to ignore the flag.

[1]: https://github.com/llvm/llvm-project/issues/57129
[2]: https://github.com/openbsd/src/commit/d00990cc11fce25520b9dde416bb8cf50990e992

authored by

John Ericson and committed by
Artemis Tosini
70c2f444 09913b80

+28
+12
pkgs/build-support/bintools-wrapper/default.nix
··· 383 383 '' 384 384 385 385 ## 386 + ## LLVM ranlab lacks -t option that libtool expects. We can just 387 + ## skip it 388 + ## 389 + 390 + + optionalString (isLLVM && targetPlatform.isOpenBSD) '' 391 + rm $out/bin/${targetPrefix}ranlib 392 + wrap \ 393 + ${targetPrefix}ranlib ${./llvm-ranlib-wrapper.sh} \ 394 + "${bintools_bin}/bin/${targetPrefix}ranlib" 395 + '' 396 + 397 + ## 386 398 ## Extra custom steps 387 399 ## 388 400 + extraBuildCommands;
+16
pkgs/build-support/bintools-wrapper/llvm-ranlib-wrapper.sh
··· 1 + #! @shell@ 2 + # shellcheck shell=bash 3 + 4 + args=() 5 + for p in "$@"; do 6 + case "$p" in 7 + -t) 8 + # Skip, LLVM ranlib doesn't support 9 + ;; 10 + *) 11 + args+=("$p") 12 + ;; 13 + esac 14 + done 15 + 16 + @prog@ "${args[@]}"