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";
|
2022-12-28 21:21:41 +00:00
|
|
|
version = "1.8.0";
|
2021-07-18 21:22:44 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "rui314";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2022-12-28 21:21:41 +00:00
|
|
|
hash = "sha256-VykBOXeU3I6ZSmRIlngLdoLF4V2nb5QW/f8tr9Wn9o8=";
|
2021-07-18 21:22:44 +00:00
|
|
|
};
|
|
|
|
|
2022-09-22 12:36:57 +00:00
|
|
|
nativeBuildInputs = [ cmake ninja ];
|
2021-07-18 21:22:44 +00:00
|
|
|
|
2022-09-22 12:36:57 +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'
|
|
|
|
'';
|
|
|
|
|
|
|
|
cmakeFlags = [ "-DMOLD_USE_SYSTEM_MIMALLOC:BOOL=ON" ];
|
|
|
|
|
|
|
|
NIX_CFLAGS_COMPILE = lib.optionals stdenv.isDarwin [ "-faligned-allocation" ];
|
|
|
|
|
|
|
|
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";
|
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
|
|
|
};
|
|
|
|
}
|