From 5d991aed245974614437baec9903aee90c9d8879 Mon Sep 17 00:00:00 2001 From: J08nY Date: Mon, 19 Aug 2024 21:02:16 +0200 Subject: [PATCH] Unify shim nix files and add versions to them. --- nix/boringsslshim.nix | 9 ++++++--- nix/botanshim.nix | 18 +++++++++++------- nix/commonlibs.nix | 2 +- nix/cryptoppshim.nix | 4 ++-- nix/gcryptshim.nix | 11 ++++++++--- nix/ippcpshim.nix | 6 +++--- nix/libresslshim.nix | 11 ++++++++--- nix/mbedtlsshim.nix | 9 ++++++--- nix/nettleshim.nix | 11 ++++++++--- nix/opensslshim.nix | 11 ++++++++--- nix/tomcryptshim.nix | 4 ++-- 11 files changed, 63 insertions(+), 33 deletions(-) diff --git a/nix/boringsslshim.nix b/nix/boringsslshim.nix index 4fb8a026..7fc337f6 100644 --- a/nix/boringsslshim.nix +++ b/nix/boringsslshim.nix @@ -1,20 +1,23 @@ { pkgs, boringssl }: with pkgs; stdenv.mkDerivation { - name = "BoringSSLShim"; + name = "BoringSSLShim-${boringssl.version}"; src = ../standalone/src/main/resources/cz/crcs/ectester/standalone/libs/jni; buildInputs = [ boringssl pkg-config - jdk + pkgs.jdk_headless ]; buildPhase = '' make boringssl ''; - BORINGSSL_CFLAGS = "-I${boringssl.dev.outPath}/include -DECTESTER_BORINGSSL_${boringssl.version}=1"; + BORINGSSL_CFLAGS = '' + -I${boringssl.dev.outPath}/include \ + -DECTESTER_BORINGSSL_${boringssl.version}=1 \ + ''; installPhase = '' mkdir --parents $out/lib diff --git a/nix/botanshim.nix b/nix/botanshim.nix index eb74a6b3..086d6538 100644 --- a/nix/botanshim.nix +++ b/nix/botanshim.nix @@ -1,24 +1,28 @@ { - stdenv, - botan2, - pkg-config, - jdk, + pkgs, + botan2 }: +with pkgs; stdenv.mkDerivation { - name = "BotanShim"; + name = "BotanShim-${botan2.version}"; src = ../standalone/src/main/resources/cz/crcs/ectester/standalone/libs/jni; buildInputs = [ botan2 pkg-config - jdk + pkgs.jdk_headless ]; buildPhase = '' make botan ''; - BOTAN_CXXFLAGS = "-DECTESTER_BOTAN_${builtins.replaceStrings ["."] ["_"] botan2.version}=1"; + BOTAN_CXXFLAGS = '' + -DECTESTER_BOTAN_${builtins.replaceStrings ["."] ["_"] botan2.version}=1 \ + -DECTESTER_BOTAN_MAJOR=${pkgs.lib.versions.major botan2.version} \ + -DECTESTER_BOTAN_MINOR=${pkgs.lib.versions.minor botan2.version} \ + -DECTESTER_BOTAN_PATCH=${pkgs.lib.versions.patch botan2.version} \ + ''; installPhase = '' mkdir --parents $out/lib diff --git a/nix/commonlibs.nix b/nix/commonlibs.nix index f0546837..ab649370 100644 --- a/nix/commonlibs.nix +++ b/nix/commonlibs.nix @@ -8,7 +8,7 @@ stdenv.mkDerivation rec { pkg-config cmake which - jdk + pkgs.jdk_headless ]; dontUseCmakeConfigure = true; diff --git a/nix/cryptoppshim.nix b/nix/cryptoppshim.nix index c225e8cf..627c5c9a 100644 --- a/nix/cryptoppshim.nix +++ b/nix/cryptoppshim.nix @@ -4,13 +4,13 @@ let dotVersion = builtins.replaceStrings ["_"] ["."] cryptopp.version; in stdenv.mkDerivation { - name = "Crypto++ Shim"; + name = "Crypto++Shim-${cryptopp.version}"; src = ../standalone/src/main/resources/cz/crcs/ectester/standalone/libs/jni; buildInputs = [ cryptopp pkg-config - jdk + pkgs.jdk_headless ]; buildPhase = '' diff --git a/nix/gcryptshim.nix b/nix/gcryptshim.nix index 869bcd9d..d31b4cca 100644 --- a/nix/gcryptshim.nix +++ b/nix/gcryptshim.nix @@ -5,21 +5,26 @@ }: with pkgs; stdenv.mkDerivation { - name = "Gcrypt Shim"; + name = "GcryptShim-${libgcrypt.version}"; src = ../standalone/src/main/resources/cz/crcs/ectester/standalone/libs/jni; buildInputs = [ libgcrypt libgpg-error pkg-config - jdk11_headless + pkgs.jdk_headless ]; buildPhase = '' make gcrypt ''; - LIBGCRYPT_CFLAGS = "-DECTESTER_LIBGCRYPT_${builtins.replaceStrings ["."] ["_"] libgcrypt.version}=1"; + LIBGCRYPT_CFLAGS = '' + -DECTESTER_LIBGCRYPT_${builtins.replaceStrings ["."] ["_"] libgcrypt.version}=1 \ + -DECTESTER_LIBGCRYPT_MAJOR=${pkgs.lib.versions.major libgcrypt.version} \ + -DECTESTER_LIBGCRYPT_MINOR=${pkgs.lib.versions.minor libgcrypt.version} \ + -DECTESTER_LIBGCRYPT_PATCH=${pkgs.lib.versions.patch libgcrypt.version} \ + ''; installPhase = '' mkdir --parents $out/lib diff --git a/nix/ippcpshim.nix b/nix/ippcpshim.nix index 465c3c26..33333ba1 100644 --- a/nix/ippcpshim.nix +++ b/nix/ippcpshim.nix @@ -1,16 +1,16 @@ { pkgs, ipp-crypto }: with pkgs; stdenv.mkDerivation rec { - name = "IppCryptoShim"; + name = "IppCryptoShim-${ipp-crypto.version}"; src = ../standalone/src/main/resources/cz/crcs/ectester/standalone/libs/jni; buildInputs = [ ipp-crypto pkg-config - jdk + pkgs.jdk_headless ]; - IPP_CRYPTO_CFLAGS = "-I${ipp-crypto.dev}/include -DECTESTER_IPPCP_VERSION=${ipp-crypto.version}"; + IPP_CRYPTO_CFLAGS = "-I${ipp-crypto.dev}/include -DECTESTER_IPPCP_${ipp-crypto.version}=1"; IPP_CRYPTO_LFLAGS = "-L${ipp-crypto}/lib/"; buildPhase = '' diff --git a/nix/libresslshim.nix b/nix/libresslshim.nix index 100e9411..c6c86777 100644 --- a/nix/libresslshim.nix +++ b/nix/libresslshim.nix @@ -1,20 +1,25 @@ { pkgs, libressl }: with pkgs; stdenv.mkDerivation rec { - name = "LibreSSLShim"; + name = "LibreSSLShim-${libressl.version}"; src = ../standalone/src/main/resources/cz/crcs/ectester/standalone/libs/jni; buildInputs = [ libressl pkg-config - jdk + pkgs.jdk_headless ]; buildPhase = '' make libressl ''; - LIBRESSL_CFLAGS = "-DECTESTER_LIBRESSL_${builtins.replaceStrings ["."] ["_"] libressl.version}=1"; + LIBRESSL_CFLAGS = '' + -DECTESTER_LIBRESSL_${builtins.replaceStrings ["."] ["_"] libressl.version}=1 \ + -DECTESTER_LIBRESSL_MAJOR=${pkgs.lib.versions.major libressl.version} \ + -DECTESTER_LIBRESSL_MINOR=${pkgs.lib.versions.minor libressl.version} \ + -DECTESTER_LIBRESSL_PATCH=${pkgs.lib.versions.patch libressl.version} \ + ''; installPhase = '' mkdir --parents $out/lib diff --git a/nix/mbedtlsshim.nix b/nix/mbedtlsshim.nix index 0b319078..5f9b1c5c 100644 --- a/nix/mbedtlsshim.nix +++ b/nix/mbedtlsshim.nix @@ -1,14 +1,17 @@ { pkgs, mbedtls }: with pkgs; +let + rawVersion = pkgs.lib.strings.removePrefix "v" mbedtls.version; +in stdenv.mkDerivation rec { - name = "MbedTLSShim"; + name = "MbedTLSShim-${mbedtls.version}"; src = ../standalone/src/main/resources/cz/crcs/ectester/standalone/libs/jni; - rawVersion = pkgs.lib.strings.removePrefix "v" mbedtls.version; + buildInputs = [ mbedtls pkg-config - jdk + pkgs.jdk_headless ]; buildPhase = '' diff --git a/nix/nettleshim.nix b/nix/nettleshim.nix index 42da7ff7..8aba8671 100644 --- a/nix/nettleshim.nix +++ b/nix/nettleshim.nix @@ -5,21 +5,26 @@ }: with pkgs; stdenv.mkDerivation rec { - name = "NettleShim"; + name = "NettleShim-${nettle.version}"; src = ../standalone/src/main/resources/cz/crcs/ectester/standalone/libs/jni; buildInputs = [ nettle gmp pkg-config - jdk + pkgs.jdk_headless ]; buildPhase = '' make nettle ''; - NETTLE_CFLAGS = "-DECTESTER_NETTLE_${builtins.replaceStrings ["."] ["_"] nettle.version}=1"; + NETTLE_CFLAGS = '' + -DECTESTER_NETTLE_${builtins.replaceStrings ["."] ["_"] nettle.version}=1 \ + -DECTESTER_NETTLE_MAJOR=${pkgs.lib.versions.major nettle.version} \ + -DECTESTER_NETTLE_MINOR=${pkgs.lib.versions.minor nettle.version} \ + -DECTESTER_NETTLE_PATCH=${pkgs.lib.versions.patch nettle.version} \ + ''; installPhase = '' mkdir --parents $out/lib diff --git a/nix/opensslshim.nix b/nix/opensslshim.nix index 7c585fc8..78df0fd2 100644 --- a/nix/opensslshim.nix +++ b/nix/opensslshim.nix @@ -1,20 +1,25 @@ { pkgs, openssl }: with pkgs; stdenv.mkDerivation { - name = "OpenSSL Shim"; + name = "OpenSSLShim-${openssl.version}"; src = ../standalone/src/main/resources/cz/crcs/ectester/standalone/libs/jni; buildInputs = [ openssl pkg-config - jdk + pkgs.jdk_headless ]; buildPhase = '' make openssl ''; - OPENSSL_CFLAGS = "-DECTESTER_OPENSSL_${builtins.replaceStrings ["."] ["_"] openssl.version}=1"; + OPENSSL_CFLAGS = '' + -DECTESTER_OPENSSL_${builtins.replaceStrings ["."] ["_"] openssl.version}=1 \ + -DECTESTER_OPENSSL_MAJOR=${pkgs.lib.versions.major openssl.version} \ + -DECTESTER_OPENSSL_MINOR=${pkgs.lib.versions.minor openssl.version} \ + -DECTESTER_OPENSSL_PATCH=${pkgs.lib.versions.patch openssl.version} \ + ''; installPhase = '' mkdir --parents $out/lib diff --git a/nix/tomcryptshim.nix b/nix/tomcryptshim.nix index d4f1f2f0..565cb015 100644 --- a/nix/tomcryptshim.nix +++ b/nix/tomcryptshim.nix @@ -5,14 +5,14 @@ }: with pkgs; stdenv.mkDerivation { - name = "TomCryptShim"; + name = "TomCryptShim-${libtomcrypt.version}"; src = ../standalone/src/main/resources/cz/crcs/ectester/standalone/libs/jni; buildInputs = [ libtommath libtomcrypt pkg-config - jdk + pkgs.jdk_headless ]; buildPhase = ''