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
|
2021-07-18 21:22:44 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "mold";
|
2023-02-02 18:25:31 +00:00
|
|
|
version = "1.10.1";
|
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-02-02 18:25:31 +00:00
|
|
|
hash = "sha256-5zE5a+BYzQjgVb0Ti7bSQrGzTyysOTTR0NMOO5IKG68=";
|
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
|
|
|
|
2022-09-22 12:36:57 +00:00
|
|
|
postPatch = ''
|
|
|
|
sed -i CMakeLists.txt -e '/.*set(DEST\ .*/d'
|
|
|
|
'';
|
|
|
|
|
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
|
|
|
|
|
|
|
passthru.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}";
|
2022-09-22 12:36:57 +00:00
|
|
|
license = licenses.agpl3Plus;
|
|
|
|
maintainers = with maintainers; [ azahi nitsky ];
|
2022-04-27 09:35:20 +00:00
|
|
|
platforms = platforms.unix;
|
2021-07-18 21:22:44 +00:00
|
|
|
};
|
|
|
|
}
|