2022-09-22 12:36:57 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2021-07-18 21:22:44 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
2022-09-22 12:36:57 +00:00
|
|
|
, mimalloc
|
|
|
|
, ninja
|
2021-07-18 21:22:44 +00:00
|
|
|
, openssl
|
2022-09-22 12:36:57 +00:00
|
|
|
, zlib
|
|
|
|
, testers
|
|
|
|
, mold
|
2023-08-04 22:07:22 +00:00
|
|
|
, nix-update-script
|
2021-07-18 21:22:44 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "mold";
|
2023-08-22 20:05:09 +00:00
|
|
|
version = "2.1.0";
|
2021-07-18 21:22:44 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "rui314";
|
|
|
|
repo = pname;
|
2023-01-11 07:51:40 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2023-08-22 20:05:09 +00:00
|
|
|
hash = "sha256-4W6quVSkxS2I6KEy3fVyBTypD0fg4EecgeEVM0Yw58s=";
|
2021-07-18 21:22:44 +00:00
|
|
|
};
|
|
|
|
|
2023-01-11 07:51:40 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
ninja
|
|
|
|
];
|
2021-07-18 21:22:44 +00:00
|
|
|
|
2023-01-11 07:51:40 +00:00
|
|
|
buildInputs = [
|
|
|
|
openssl
|
|
|
|
zlib
|
|
|
|
] ++ lib.optionals (!stdenv.isDarwin) [
|
|
|
|
mimalloc
|
|
|
|
];
|
2021-07-18 21:22:44 +00:00
|
|
|
|
2023-01-11 07:51:40 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DMOLD_USE_SYSTEM_MIMALLOC:BOOL=ON"
|
|
|
|
];
|
2022-09-22 12:36:57 +00:00
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.isDarwin [
|
2023-01-11 07:51:40 +00:00
|
|
|
"-faligned-allocation"
|
2023-03-04 12:14:45 +00:00
|
|
|
]);
|
2022-09-22 12:36:57 +00:00
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
passthru = {
|
|
|
|
updateScript = nix-update-script { };
|
|
|
|
tests.version = testers.testVersion { package = mold; };
|
|
|
|
};
|
2022-01-27 00:19:43 +00:00
|
|
|
|
2021-07-18 21:22:44 +00:00
|
|
|
meta = with lib; {
|
2022-09-22 12:36:57 +00:00
|
|
|
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.
|
|
|
|
'';
|
2021-07-18 21:22:44 +00:00
|
|
|
homepage = "https://github.com/rui314/mold";
|
2023-01-11 07:51:40 +00:00
|
|
|
changelog = "https://github.com/rui314/mold/releases/tag/v${version}";
|
2023-08-04 22:07:22 +00:00
|
|
|
license = licenses.mit;
|
2023-08-22 20:05:09 +00:00
|
|
|
maintainers = with maintainers; [ azahi nitsky paveloom ];
|
2023-10-09 19:29:22 +00:00
|
|
|
mainProgram = "mold";
|
2022-04-27 09:35:20 +00:00
|
|
|
platforms = platforms.unix;
|
2021-07-18 21:22:44 +00:00
|
|
|
};
|
|
|
|
}
|