Skip to content

Commit

Permalink
WIP jenkins pipeline: include mac nix build
Browse files Browse the repository at this point in the history
  • Loading branch information
neodix42 committed Dec 20, 2023
1 parent 9d7b0fe commit 99ff2e3
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 41 deletions.
46 changes: 7 additions & 39 deletions assembly/cicd/jenkins/test-builds.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,6 @@ pipeline {
}
}
}
stage('Ubuntu 20.04 x86-64 (portable)') {
agent {
label 'Ubuntu_x86-64'
}
steps {
timeout(time: 90, unit: 'MINUTES') {
sh '''
cp assembly/native/build-ubuntu-20.04-portable.sh .
chmod +x build-ubuntu-20.04-portable.sh
./build-ubuntu-20.04-portable.sh -t -a
'''
sh 'zip -r ton-x86_64-linux-portable ./artifacts/*'
archiveArtifacts artifacts: 'ton-x86_64-linux-portable.zip'
}
}
}
stage('Ubuntu 20.04 x86-64 (nix)') {
agent {
label 'Ubuntu_x86-64'
Expand Down Expand Up @@ -80,22 +64,6 @@ pipeline {
}
}
}
stage('Ubuntu 20.04 aarch64 (portable)') {
agent {
label 'Ubuntu_arm64'
}
steps {
timeout(time: 90, unit: 'MINUTES') {
sh '''
cp assembly/native/build-ubuntu-20.04-portable.sh .
chmod +x build-ubuntu-20.04-portable.sh
./build-ubuntu-20.04-portable.sh -t -a
'''
sh 'zip -r ton-arm64-linux-portable ./artifacts/*'
archiveArtifacts artifacts: 'ton-arm64-linux-portable.zip'
}
}
}
stage('Ubuntu 20.04 aarch64 (nix)') {
agent {
label 'Ubuntu_arm64'
Expand Down Expand Up @@ -141,18 +109,18 @@ pipeline {
steps {
timeout(time: 90, unit: 'MINUTES') {
sh '''
cp assembly/native/build-macos-portable.sh .
chmod +x build-macos-portable.sh
./build-macos-portable.sh -t -a -o 12.7
cp assembly/nix/macos-arm64-* .
export NIX_PATH=nixpkgs=https://github.com/nixOS/nixpkgs/archive/23.11.tar.gz
nix-build macos-arm64-static.nix
'''
sh 'zip -r ton-x86-64-macos-portable ./artifacts/*'
archiveArtifacts artifacts: 'ton-x86-64-macos-portable.zip'
sh 'zip -r ton-arm64-macos-portable ./artifacts/bin/*'
archiveArtifacts artifacts: 'ton-arm64-macos-portable.zip'
}
}
}
stage('macOS 12.6 aarch64 (shared)') {
agent {
label 'macOS_12.6.3-arm64'
label 'macOS_12.6-arm64-m1'
}
steps {
timeout(time: 90, unit: 'MINUTES') {
Expand All @@ -168,7 +136,7 @@ pipeline {
}
stage('macOS 12.6 aarch64 (portable)') {
agent {
label 'macOS_12.6.3-arm64'
label 'macOS_12.6-arm64-m1'
}
steps {
timeout(time: 90, unit: 'MINUTES') {
Expand Down
2 changes: 1 addition & 1 deletion assembly/nix/linux-x86-64-static.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pkgs.stdenv.mkDerivation { # gcc

buildInputs = with pkgs;
[
pkgsStatic.openssl pkgsStatic.zlib pkgsStatic.libmicrohttpd.dev pkgsStatic.libsodium.dev pkgsStatic.secp256k1 glibc.static
pkgsStatic.openssl_3_0 pkgsStatic.zlib pkgsStatic.libmicrohttpd.dev pkgsStatic.libsodium.dev pkgsStatic.secp256k1 glibc.static
];

makeStatic = true;
Expand Down
2 changes: 1 addition & 1 deletion assembly/nix/linux-x86-64-tonlib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ stdenv227.mkDerivation {

buildInputs = with pkgs;
[
pkgsStatic.openssl pkgsStatic.zlib pkgsStatic.libmicrohttpd.dev pkgsStatic.libsodium.dev pkgsStatic.secp256k1
pkgsStatic.openssl_3_0 pkgsStatic.zlib pkgsStatic.libmicrohttpd.dev pkgsStatic.libsodium.dev pkgsStatic.secp256k1
];

dontAddStaticConfigureFlags = false;
Expand Down
65 changes: 65 additions & 0 deletions assembly/nix/macos-arm64-static.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# 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
}:

pkgs.stdenv.mkDerivation { # clang default
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; })
];


dontAddStaticConfigureFlags = true;
doCheck = false;
makeStatic = true;


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"
];

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" ];
}

0 comments on commit 99ff2e3

Please sign in to comment.