at master 762 B view raw
1{ 2 lib, 3 stdenv, 4 jemalloc, 5 writeText, 6 7 unprefixed ? false, 8}: 9 10let 11 # On some platforms the unprefixed feature will be ignored: 12 # https://github.com/tikv/jemallocator/blob/ab0676d77e81268cd09b059260c75b38dbef2d51/jemalloc-sys/src/env.rs 13 unprefixed' = 14 unprefixed 15 && !stdenv.hostPlatform.isMusl 16 && !stdenv.hostPlatform.isDarwin 17 && !stdenv.hostPlatform.isAndroid; 18 19in 20jemalloc.overrideAttrs (oldAttrs: { 21 configureFlags = 22 oldAttrs.configureFlags 23 ++ [ 24 "--with-private-namespace=_rjem_" 25 ] 26 ++ lib.optionals (!unprefixed') [ 27 "--with-jemalloc-prefix=_rjem_" 28 ]; 29 30 setupHook = writeText "setup-hook.sh" '' 31 export JEMALLOC_OVERRIDE="@out@/lib/libjemalloc${stdenv.hostPlatform.extensions.library}" 32 ''; 33})