1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-02-15 04:32:21 +00:00
ton/assembly/nix/macos-static.nix
neodix42 b7849249c6
lz4 support in multiple builds (#946)
* Compress block candidates in validator-session

* Compress blocks in full-node (disabled for now)

* test pipeline with lz4

* tonlib compilation required lz4;
try win compile;

* install lz4 on mac.

* wip, test builds

* remove FindLZ4.cmake

* fix typo

* fix wasm lz4 path

* increase groovy timeout to 120 sec

* add lz4 for android and emscripten builds

* add lz4 for android and emscripten builds

* fix win build include path for lz4

* add precompiled lz4 for android

* cleanup

* adjust android include dir for lz4

* fix path for android arm of lz4

* cleanup

* minor fix

---------

Co-authored-by: SpyCheese <mikle98@yandex.ru>
2024-03-28 10:18:11 +03:00

67 lines
2 KiB
Nix

# export NIX_PATH=nixpkgs=https://github.com/nixOS/nixpkgs/archive/23.05.tar.gz
{ pkgs ? import <nixpkgs> { system = builtins.currentSystem; }
, lib ? pkgs.lib
, stdenv ? pkgs.stdenv
, testing ? false
}:
pkgs.llvmPackages_14.stdenv.mkDerivation {
pname = "ton";
version = "dev-bin";
src = ./.;
nativeBuildInputs = with pkgs;
[ cmake ninja git pkg-config ];
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
]
(x: x.overrideAttrs(oldAttrs: rec { configureFlags = (oldAttrs.configureFlags or []) ++ [ "--enable-static" "--disable-shared" "--disable-tests" ]; dontDisableStatic = true; }))
++ [
darwin.apple_sdk.frameworks.CoreFoundation
(openssl.override { static = true; }).dev
(zlib.override { shared = false; }).dev
(libiconv.override { enableStatic = true; enableShared = false; })
(lz4.override { enableStatic = true; enableShared = false; }).dev
];
dontAddStaticConfigureFlags = true;
makeStatic = true;
doCheck = testing;
configureFlags = [];
cmakeFlags = [
"-DTON_USE_ABSEIL=OFF"
"-DNIX=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 = [
"-static-libstdc++"
"-framework CoreFoundation"
];
postInstall = ''
moveToOutput bin "$bin"
'';
preFixup = ''
for fn in "$bin"/bin/* "$out"/lib/*.dylib; do
echo Fixing libc++ in "$fn"
install_name_tool -change "$(otool -L "$fn" | grep libc++.1 | cut -d' ' -f1 | xargs)" libc++.1.dylib "$fn"
install_name_tool -change "$(otool -L "$fn" | grep libc++abi.1 | cut -d' ' -f1 | xargs)" libc++abi.dylib "$fn"
done
'';
outputs = [ "bin" "out" ];
}