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:
parent
5186c4755c
commit
0a0a92c6b0
10 changed files with 122 additions and 112 deletions
|
@ -15,8 +15,6 @@ while getopts 't' flag; do
|
|||
done
|
||||
|
||||
cp assembly/nix/linux-arm64* .
|
||||
cp assembly/nix/microhttpd.nix .
|
||||
cp assembly/nix/openssl.nix .
|
||||
export NIX_PATH=nixpkgs=https://github.com/nixOS/nixpkgs/archive/23.05.tar.gz
|
||||
|
||||
if [ "$with_tests" = true ]; then
|
||||
|
@ -30,7 +28,9 @@ cp ./result/bin/* artifacts/
|
|||
test $? -eq 0 || { echo "No artifacts have been built..."; exit 1; }
|
||||
chmod +x artifacts/*
|
||||
rm -rf result
|
||||
|
||||
nix-build linux-arm64-tonlib.nix
|
||||
|
||||
cp ./result/lib/libtonlibjson.so.0.5 artifacts/libtonlibjson.so
|
||||
cp ./result/lib/libemulator.so artifacts/
|
||||
cp ./result/lib/fift/* artifacts/lib/
|
||||
|
|
|
@ -15,8 +15,6 @@ while getopts 't' flag; do
|
|||
done
|
||||
|
||||
cp assembly/nix/linux-x86-64* .
|
||||
cp assembly/nix/microhttpd.nix .
|
||||
cp assembly/nix/openssl.nix .
|
||||
export NIX_PATH=nixpkgs=https://github.com/nixOS/nixpkgs/archive/23.05.tar.gz
|
||||
|
||||
if [ "$with_tests" = true ]; then
|
||||
|
@ -30,7 +28,9 @@ cp ./result/bin/* artifacts/
|
|||
test $? -eq 0 || { echo "No artifacts have been built..."; exit 1; }
|
||||
chmod +x artifacts/*
|
||||
rm -rf result
|
||||
|
||||
nix-build linux-x86-64-tonlib.nix
|
||||
|
||||
cp ./result/lib/libtonlibjson.so.0.5 artifacts/libtonlibjson.so
|
||||
cp ./result/lib/libemulator.so artifacts/
|
||||
cp ./result/lib/fift/* artifacts/lib/
|
||||
|
|
|
@ -28,7 +28,9 @@ cp ./result-bin/bin/* artifacts/
|
|||
test $? -eq 0 || { echo "No artifacts have been built..."; exit 1; }
|
||||
chmod +x artifacts/*
|
||||
rm -rf result-bin
|
||||
|
||||
nix-build macos-tonlib.nix
|
||||
|
||||
cp ./result/lib/libtonlibjson.dylib artifacts/
|
||||
cp ./result/lib/libemulator.dylib artifacts/
|
||||
cp ./result/lib/fift/* artifacts/lib/
|
||||
|
|
|
@ -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,30 +30,32 @@ 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"
|
||||
];
|
||||
|
|
|
@ -5,9 +5,21 @@
|
|||
, stdenv ? pkgs.stdenv
|
||||
}:
|
||||
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);
|
||||
|
||||
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;
|
||||
pkgs.llvmPackages_16.stdenv.mkDerivation {
|
||||
pname = "ton";
|
||||
version = "dev-lib";
|
||||
|
@ -21,7 +33,12 @@ pkgs.llvmPackages_16.stdenv.mkDerivation {
|
|||
|
||||
buildInputs = with pkgs;
|
||||
[
|
||||
pkgsStatic.openssl microhttpdmy pkgsStatic.zlib pkgsStatic.libsodium.dev pkgsStatic.secp256k1 pkgsStatic.lz4
|
||||
(openssl.override { static = true; }).dev
|
||||
microhttpdStatic.dev
|
||||
(zlib.override { shared = false; }).dev
|
||||
(lz4.override { enableStatic = true; enableShared = false; }).dev
|
||||
secp256k1Static
|
||||
libsodiumStatic.dev
|
||||
];
|
||||
|
||||
dontAddStaticConfigureFlags = false;
|
||||
|
@ -29,9 +46,6 @@ pkgs.llvmPackages_16.stdenv.mkDerivation {
|
|||
cmakeFlags = [
|
||||
"-DTON_USE_ABSEIL=OFF"
|
||||
"-DNIX=ON"
|
||||
"-DMHD_FOUND=1"
|
||||
"-DMHD_INCLUDE_DIR=${microhttpdmy}/usr/local/include"
|
||||
"-DMHD_LIBRARY=${microhttpdmy}/usr/local/lib/libmicrohttpd.a"
|
||||
];
|
||||
|
||||
LDFLAGS = [
|
||||
|
|
|
@ -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++" "-fPIC"
|
||||
];
|
||||
}
|
||||
|
|
|
@ -9,6 +9,21 @@
|
|||
let
|
||||
system = builtins.currentSystem;
|
||||
|
||||
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);
|
||||
|
||||
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" ];
|
||||
});
|
||||
|
||||
nixos1909 = (import (builtins.fetchTarball {
|
||||
url = "https://channels.nixos.org/nixos-19.09/nixexprs.tar.xz";
|
||||
sha256 = "1vp1h2gkkrckp8dzkqnpcc6xx5lph5d2z46sg2cwzccpr8ay58zy";
|
||||
|
@ -34,7 +49,12 @@ stdenv227.mkDerivation {
|
|||
|
||||
buildInputs = with pkgs;
|
||||
[
|
||||
pkgsStatic.openssl pkgsStatic.zlib pkgsStatic.libmicrohttpd.dev pkgsStatic.libsodium.dev pkgsStatic.secp256k1 pkgsStatic.lz4
|
||||
(openssl.override { static = true; }).dev
|
||||
microhttpdStatic.dev
|
||||
(zlib.override { shared = false; }).dev
|
||||
(lz4.override { enableStatic = true; enableShared = false; }).dev
|
||||
secp256k1Static
|
||||
libsodiumStatic.dev
|
||||
];
|
||||
|
||||
dontAddStaticConfigureFlags = false;
|
||||
|
|
|
@ -17,7 +17,7 @@ pkgs.llvmPackages_14.stdenv.mkDerivation {
|
|||
|
||||
buildInputs = with pkgs;
|
||||
lib.forEach [
|
||||
secp256k1 libsodium.dev libmicrohttpd.dev gmp.dev nettle.dev libtasn1.dev libidn2.dev libunistring.dev gettext (gnutls.override { withP11-kit = false; }).dev
|
||||
secp256k1 libsodium.dev libmicrohttpd.dev gmp.dev nettle.dev libtasn1.dev libidn2.dev libunistring.dev gettext jemalloc (gnutls.override { withP11-kit = false; }).dev
|
||||
]
|
||||
(x: x.overrideAttrs(oldAttrs: rec { configureFlags = (oldAttrs.configureFlags or []) ++ [ "--enable-static" "--disable-shared" "--disable-tests" ]; dontDisableStatic = true; }))
|
||||
++ [
|
||||
|
@ -38,13 +38,13 @@ pkgs.llvmPackages_14.stdenv.mkDerivation {
|
|||
cmakeFlags = [
|
||||
"-DTON_USE_ABSEIL=OFF"
|
||||
"-DNIX=ON"
|
||||
"-DTON_USE_JEMALLOC=ON"
|
||||
"-DCMAKE_CROSSCOMPILING=OFF"
|
||||
"-DCMAKE_LINK_SEARCH_START_STATIC=ON"
|
||||
"-DCMAKE_LINK_SEARCH_END_STATIC=ON"
|
||||
"-DBUILD_SHARED_LIBS=OFF"
|
||||
"-DCMAKE_CXX_FLAGS=-stdlib=libc++"
|
||||
"-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=11.3"
|
||||
"-DCMAKE_CTEST_ARGUMENTS=--timeout;1800"
|
||||
];
|
||||
|
||||
LDFLAGS = [
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
{ pkgs ? import <nixpkgs> { system = builtins.currentSystem; }
|
||||
, stdenv ? pkgs.stdenv
|
||||
, fetchgit ? pkgs.fetchgit
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "microhttpdmy";
|
||||
|
||||
|
||||
src = fetchgit {
|
||||
url = "https://git.gnunet.org/libmicrohttpd.git";
|
||||
rev = "refs/tags/v0.9.77";
|
||||
sha256 = "sha256-x+nfB07PbZwBlFc6kZZFYiRpk0a3QN/ByHB+hC8na/o=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = with pkgs; [ automake libtool autoconf texinfo ];
|
||||
|
||||
buildInputs = with pkgs; [ ];
|
||||
|
||||
configurePhase = ''
|
||||
./autogen.sh
|
||||
./configure --enable-static --disable-tests --disable-benchmark --disable-shared --disable-https --with-pic
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
make install DESTDIR=$out
|
||||
'';
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
{ pkgs ? import <nixpkgs> { system = builtins.currentSystem; }
|
||||
, stdenv ? pkgs.stdenv
|
||||
, fetchFromGitHub ? pkgs.fetchFromGitHub
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "opensslmy";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "openssl";
|
||||
repo = "openssl";
|
||||
rev = "refs/tags/openssl-3.1.4";
|
||||
sha256 = "sha256-Vvf1wiNb4ikg1lIS9U137aodZ2JzM711tSWMJFYWtWI=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = with pkgs; [ perl ];
|
||||
|
||||
buildInputs = with pkgs; [ ];
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs Configure
|
||||
'';
|
||||
|
||||
configurePhase = ''
|
||||
./Configure no-shared
|
||||
'';
|
||||
installPhase = ''
|
||||
make install DESTDIR=$out
|
||||
'';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue