nixpkgs/pkgs/development/tools/mold/default.nix
Austin Seipp e4db1840dc mold: patch an upstream bug in --strip-debug
Mold currently has a bug where `--strip-debug` is treated the same as
`--strip-all`; this causes things like Rust backtraces to stop working
because the symbol tables get stripped.

The fix is trivial and obvious, and comes from an upstream patch that
needs to be merged and release.

GitHub Issue: rui314/mold#1038
Signed-off-by: Austin Seipp <aseipp@pobox.com>
2023-07-14 05:46:34 -05:00

69 lines
1.5 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, cmake
, mimalloc
, ninja
, openssl
, zlib
, testers
, mold
}:
stdenv.mkDerivation rec {
pname = "mold";
version = "1.11.0";
src = fetchFromGitHub {
owner = "rui314";
repo = pname;
rev = "refs/tags/v${version}";
hash = "sha256-dfdrXp05eJALTQnx2F3GxRWKMA+Icj0mRPcb72z7qMw=";
};
nativeBuildInputs = [
cmake
ninja
];
buildInputs = [
openssl
zlib
] ++ lib.optionals (!stdenv.isDarwin) [
mimalloc
];
patches = [
./fix-debug-strip.patch # fix --debug-strip; https://github.com/rui314/mold/pull/1038
];
postPatch = ''
sed -i CMakeLists.txt -e '/.*set(DEST\ .*/d'
'';
cmakeFlags = [
"-DMOLD_USE_SYSTEM_MIMALLOC:BOOL=ON"
];
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.isDarwin [
"-faligned-allocation"
]);
passthru.tests.version = testers.testVersion { package = mold; };
meta = with lib; {
description = "A faster drop-in replacement for existing Unix linkers";
longDescription = ''
mold is a faster drop-in replacement for existing Unix linkers. It is
several times faster than the LLVM lld linker. mold is designed to
increase developer productivity by reducing build time, especially in
rapid debug-edit-rebuild cycles.
'';
homepage = "https://github.com/rui314/mold";
changelog = "https://github.com/rui314/mold/releases/tag/v${version}";
license = licenses.agpl3Plus;
maintainers = with maintainers; [ azahi nitsky ];
platforms = platforms.unix;
};
}