Skip to content

Commit

Permalink
Fix boost
Browse files Browse the repository at this point in the history
  • Loading branch information
tvorogme committed Jun 11, 2024
1 parent 80f9839 commit 337164f
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 44 deletions.
14 changes: 6 additions & 8 deletions assembly/nix/linux-arm64-static.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@
}:
let
microhttpdmy = (import ./microhttpd.nix) { inherit pkgs; };
in
let
# Define pkgsStatic with a custom overlay
pkgsStatic = import <nixpkgs> {
inherit system;
overlays = [ (import ./static-overlay.nix) ];
};
staticLibs = import ./static-libs.nix { inherit pkgs; };
staticBoost = staticLibs.staticBoost;
staticLibrdkafka = staticLibs.staticLibrdkafka;
in
with import microhttpdmy;
stdenv.mkDerivation {
Expand All @@ -30,7 +26,9 @@ stdenv.mkDerivation {

buildInputs = with pkgs;
[
pkgsStatic.openssl microhttpdmy pkgsStatic.zlib pkgsStatic.libsodium.dev pkgsStatic.secp256k1 glibc.static pkgsStatic.boost pkgsStatic.librdkafka
pkgsStatic.openssl microhttpdmy pkgsStatic.zlib pkgsStatic.libsodium.dev pkgsStatic.secp256k1 glibc.static
staticBoost
staticLibrdkafka
];

makeStatic = true;
Expand Down
14 changes: 6 additions & 8 deletions assembly/nix/linux-arm64-tonlib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@
}:
let
microhttpdmy = (import ./microhttpd.nix) { inherit pkgs; };
in
let
# Define pkgsStatic with a custom overlay
pkgsStatic = import <nixpkgs> {
inherit system;
overlays = [ (import ./static-overlay.nix) ];
};
staticLibs = import ./static-libs.nix { inherit pkgs; };
staticBoost = staticLibs.staticBoost;
staticLibrdkafka = staticLibs.staticLibrdkafka;
in
with import microhttpdmy;
pkgs.llvmPackages_16.stdenv.mkDerivation {
Expand All @@ -30,7 +26,9 @@ pkgs.llvmPackages_16.stdenv.mkDerivation {

buildInputs = with pkgs;
[
pkgsStatic.openssl microhttpdmy pkgsStatic.zlib pkgsStatic.secp256k1 staticBoost pkgsStatic.boost pkgsStatic.librdkafka
pkgsStatic.openssl microhttpdmy pkgsStatic.zlib pkgsStatic.secp256k1 staticBoost
staticBoost
staticLibrdkafka
(pkgsStatic.libsodium.overrideAttrs (oldAttrs: {
# https://github.com/jedisct1/libsodium/issues/292#issuecomment-137135369
configureFlags = oldAttrs.configureFlags ++ [ " --disable-pie" ];
Expand Down
14 changes: 6 additions & 8 deletions assembly/nix/linux-x86-64-static.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@
}:
let
microhttpdmy = (import ./microhttpd.nix) { inherit pkgs; };
in
let
# Define pkgsStatic with a custom overlay
pkgsStatic = import <nixpkgs> {
inherit system;
overlays = [ (import ./static-overlay.nix) ];
};
staticLibs = import ./static-libs.nix { inherit pkgs; };
staticBoost = staticLibs.staticBoost;
staticLibrdkafka = staticLibs.staticLibrdkafka;
in
with import microhttpdmy;
stdenv.mkDerivation {
Expand All @@ -30,7 +26,9 @@ stdenv.mkDerivation {

buildInputs = with pkgs;
[
pkgsStatic.openssl microhttpdmy pkgsStatic.zlib pkgsStatic.libsodium.dev pkgsStatic.secp256k1 glibc.static pkgsStatic.boost pkgsStatic.librdkafka
pkgsStatic.openssl microhttpdmy pkgsStatic.zlib pkgsStatic.libsodium.dev pkgsStatic.secp256k1 glibc.static
staticBoost
staticLibrdkafka
];

makeStatic = true;
Expand Down
15 changes: 6 additions & 9 deletions assembly/nix/linux-x86-64-tonlib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,9 @@ let
bintools = pkgs.binutils.override { libc = glibc227; };
};
in (pkgs.overrideCC pkgs.stdenv cc);

in
let
# Define pkgsStatic with a custom overlay
pkgsStatic = import <nixpkgs> {
inherit system;
overlays = [ (import ./static-overlay.nix) ];
};
staticLibs = import ./static-libs.nix { inherit pkgs; };
staticBoost = staticLibs.staticBoost;
staticLibrdkafka = staticLibs.staticLibrdkafka;
in
stdenv227.mkDerivation {
pname = "ton";
Expand All @@ -41,7 +36,9 @@ stdenv227.mkDerivation {

buildInputs = with pkgs;
[
pkgsStatic.openssl pkgsStatic.zlib pkgsStatic.libmicrohttpd.dev pkgsStatic.secp256k1 pkgsStatic.boost pkgsStatic.librdkafka
pkgsStatic.openssl pkgsStatic.zlib pkgsStatic.libmicrohttpd.dev pkgsStatic.secp256k1
staticBoost
staticLibrdkafka
(pkgsStatic.libsodium.overrideAttrs (oldAttrs: {
# https://github.com/jedisct1/libsodium/issues/292#issuecomment-137135369
configureFlags = oldAttrs.configureFlags ++ [ " --disable-pie" ];
Expand Down
12 changes: 5 additions & 7 deletions assembly/nix/macos-static.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
, src ? ./.
}:
let
# Define pkgsStatic with a custom overlay
pkgsStatic = import <nixpkgs> {
inherit system;
overlays = [ (import ./static-overlay.nix) ];
};
staticLibs = import ./static-libs.nix { inherit pkgs; };
staticBoost = staticLibs.staticBoost;
staticLibrdkafka = staticLibs.staticLibrdkafka;
in
pkgs.llvmPackages_14.stdenv.mkDerivation {
pname = "ton";
Expand All @@ -32,8 +30,8 @@ pkgs.llvmPackages_14.stdenv.mkDerivation {
(openssl.override { static = true; }).dev
(zlib.override { shared = false; }).dev
(libiconv.override { enableStatic = true; enableShared = false; })
pkgsStatic.boost
pkgsStatic.librdkafka
staticBoost
staticLibrdkafka
];


Expand Down
8 changes: 8 additions & 0 deletions assembly/nix/macos-tonlib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
, system ? builtins.currentSystem
, src ? ./.
}:
let
# Import custom static packages
staticLibs = import ./static-libs.nix { inherit pkgs; };
staticBoost = staticLibs.staticBoost;
staticLibrdkafka = staticLibs.staticLibrdkafka;
in
pkgs.llvmPackages_14.stdenv.mkDerivation {
pname = "ton";
version = "dev-lib";
Expand All @@ -24,6 +30,8 @@ pkgs.llvmPackages_14.stdenv.mkDerivation {
(openssl.override { static = true; }).dev
(zlib.override { shared = false; }).dev
(libiconv.override { enableStatic = true; enableShared = false; })
staticBoost
staticLibrdkafka
];

dontAddStaticConfigureFlags = true;
Expand Down
16 changes: 12 additions & 4 deletions assembly/nix/static-overlay.nix → assembly/nix/static-libs.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
self: super: {
boost = super.boost.overrideAttrs (oldAttrs: {
buildInputs = (oldAttrs.buildInputs or []) ++ [ super.stdenv ];
{ pkgs }:

let
staticBoost = pkgs.boost.overrideAttrs (oldAttrs: {
buildInputs = (oldAttrs.buildInputs or []) ++ [ pkgs.stdenv ];
doCheck = false;
configurePhase = '' ''; # No configure phase
buildPhase = ''
Expand All @@ -9,7 +11,13 @@ self: super: {
'';
});

librdkafka = super.librdkafka.overrideAttrs (oldAttrs: {
staticLibrdkafka = pkgs.librdkafka.overrideAttrs (oldAttrs: {
configureFlags = (oldAttrs.configureFlags or []) ++ [ "--enable-static", "--disable-shared" ];
postInstall = ''
moveToOutput lib "$lib"
'';
});
in
{
inherit staticBoost staticLibrdkafka;
}

0 comments on commit 337164f

Please sign in to comment.