1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

Use jemalloc in portable artifacts (#1003)

* use jemalloc in portable builds;
also avoid mixing musl with glibc artifacts in nix builds;

* minor fix for ubuntu arm nix build
This commit is contained in:
neodix42 2024-06-07 17:52:11 +02:00 committed by GitHub
parent 5186c4755c
commit 0a0a92c6b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 122 additions and 112 deletions

View file

@ -6,9 +6,23 @@
, testing ? false
}:
let
microhttpdmy = (import ./microhttpd.nix) {};
staticOptions = pkg: pkg.overrideAttrs(oldAttrs: {
dontDisableStatic = true;
enableSharedExecutables = false;
configureFlags = (oldAttrs.configureFlags or []) ++ [ "--without-shared" "--disable-shared" "--disable-tests" ];
});
secp256k1Static = (staticOptions pkgs.secp256k1);
libsodiumStatic = (staticOptions pkgs.libsodium);
jemallocStatic = (staticOptions pkgs.jemalloc);
microhttpdStatic = pkgs.libmicrohttpd.overrideAttrs(oldAttrs: {
dontDisableStatic = true;
enableSharedExecutables = false;
configureFlags = (oldAttrs.configureFlags or []) ++ [ "--enable-static" "--disable-tests" "--disable-benchmark" "--disable-shared" "--disable-https" "--with-pic" ];
});
in
with import microhttpdmy;
stdenv.mkDerivation {
pname = "ton";
version = "dev-bin";
@ -16,31 +30,33 @@ stdenv.mkDerivation {
src = ./.;
nativeBuildInputs = with pkgs;
[
cmake ninja git pkg-config
];
[ cmake ninja git pkg-config ];
buildInputs = with pkgs;
[
pkgsStatic.openssl microhttpdmy pkgsStatic.zlib pkgsStatic.libsodium.dev pkgsStatic.secp256k1 glibc.static pkgsStatic.lz4
(openssl.override { static = true; }).dev
microhttpdStatic.dev
(zlib.override { shared = false; }).dev
(lz4.override { enableStatic = true; enableShared = false; }).dev
jemallocStatic
secp256k1Static
libsodiumStatic.dev
glibc.static
];
makeStatic = true;
doCheck = testing;
cmakeFlags = [
"-DTON_USE_ABSEIL=OFF"
"-DNIX=ON"
"-DBUILD_SHARED_LIBS=OFF"
"-DCMAKE_LINK_SEARCH_START_STATIC=ON"
"-DCMAKE_LINK_SEARCH_END_STATIC=ON"
"-DMHD_FOUND=1"
"-DMHD_INCLUDE_DIR=${microhttpdmy}/usr/local/include"
"-DMHD_LIBRARY=${microhttpdmy}/usr/local/lib/libmicrohttpd.a"
"-DCMAKE_CTEST_ARGUMENTS=--timeout;1800"
"-DTON_USE_JEMALLOC=ON"
];
makeStatic = true;
doCheck = testing;
LDFLAGS = [
"-static-libgcc" "-static-libstdc++" "-static"
"-static-libgcc" "-static-libstdc++" "-static"
];
}