From a899f7d5eb46d56ca7c5d79767cf5e12baec17e0 Mon Sep 17 00:00:00 2001 From: quapka Date: Wed, 24 Jul 2024 16:51:35 +0200 Subject: Link GNU Crypto library statically --- flake.nix | 13 ++++++++++++- .../resources/cz/crcs/ectester/standalone/libs/jni/Makefile | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 93d87ed..33563a6 100644 --- a/flake.nix +++ b/flake.nix @@ -57,6 +57,12 @@ # FIXME Removing patches might cause unwanted things; this should be version based! patches = []; }); + libgcrypt = pkgs.libgcrypt.overrideAttrs (final: prev: { + configureFlags = ( prev.configureFlags or [] ) ++ [ "--enable-static" ]; + }); + libgpg-error = pkgs.libgpg-error.overrideAttrs (final: prev: { + configureFlags = ( prev.configureFlags or [] ) ++ [ "--enable-static" ]; + }); libressl = pkgs.libressl.overrideAttrs (_old: rec { # devLibPath = pkgs.lib.makeLibraryPath [ pkgs.libressl.dev ]; # pname = "libressl"; @@ -115,7 +121,8 @@ # gradleInstallFlags = [ "installDist" ]; # gradleBuildFlags = [ "standalone:uberJar" ]; # ":standalone:compileJava" ":standalone:uberJar" ]; "--no-build-cache" lockFile = ./gradle.lock; - gradleBuildFlags = [ ":standalone:uberJar"]; # ":standalone:compileJava" ":standalone:uberJar" ]; "--no-build-cache" + # FIXME all libs need to be built, but combining Gradle build all-libs and dedicated shim derivations won't work + gradleBuildFlags = [ "libs" "-PlibName=gcrypt" ":standalone:uberJar"]; # ":standalone:compileJava" ":standalone:uberJar" ]; "--no-build-cache" src = ./.; preConfigure = '' @@ -163,6 +170,7 @@ clang libgcrypt + libgpg-error mbedtls nasm libtool @@ -192,6 +200,7 @@ botan2 cryptopp libgcrypt + libgpg-error opensslx patched_boringssl ninja @@ -281,6 +290,7 @@ # clang libgcrypt + libgpg-error mbedtls nasm libtool @@ -307,6 +317,7 @@ (openssl {}) patched_boringssl libgcrypt + libgpg-error nettle gmp libgpg-error diff --git a/standalone/src/main/resources/cz/crcs/ectester/standalone/libs/jni/Makefile b/standalone/src/main/resources/cz/crcs/ectester/standalone/libs/jni/Makefile index e4a0b26..ec72744 100644 --- a/standalone/src/main/resources/cz/crcs/ectester/standalone/libs/jni/Makefile +++ b/standalone/src/main/resources/cz/crcs/ectester/standalone/libs/jni/Makefile @@ -107,7 +107,7 @@ boringssl.o: boringssl.c gcrypt: gcrypt_provider.so gcrypt_provider.so: gcrypt.o c_utils.o | lib_timing.so lib_csignals.so - $(CC) $(LFLAGS) -o $@ -Wl,-rpath,'$$ORIGIN/lib' $^ -L. -pthread -lpthread $(shell libgcrypt-config --libs) -l:lib_timing.so -l:lib_csignals.so + $(CC) $(LFLAGS) -o $@ -Wl,-rpath,'$$ORIGIN/lib' $^ -L. -pthread -lpthread -Wl,-Bstatic $(shell libgcrypt-config --libs) -Wl,-Bdynamic -l:lib_timing.so -l:lib_csignals.so gcrypt.o: gcrypt.c $(CC) $(shell libgcrypt-config --cflags) $(CFLAGS) -c $< -- cgit v1.3.1