Skip to content

Commit

Permalink
Unify shim nix files and add versions to them.
Browse files Browse the repository at this point in the history
  • Loading branch information
J08nY committed Aug 19, 2024
1 parent 2a9e594 commit 5d991ae
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 33 deletions.
9 changes: 6 additions & 3 deletions nix/boringsslshim.nix
Original file line number Diff line number Diff line change
@@ -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
Expand Down
18 changes: 11 additions & 7 deletions nix/botanshim.nix
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion nix/commonlibs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
pkg-config
cmake
which
jdk
pkgs.jdk_headless
];

dontUseCmakeConfigure = true;
Expand Down
4 changes: 2 additions & 2 deletions nix/cryptoppshim.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
Expand Down
11 changes: 8 additions & 3 deletions nix/gcryptshim.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions nix/ippcpshim.nix
Original file line number Diff line number Diff line change
@@ -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 = ''
Expand Down
11 changes: 8 additions & 3 deletions nix/libresslshim.nix
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 6 additions & 3 deletions nix/mbedtlsshim.nix
Original file line number Diff line number Diff line change
@@ -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 = ''
Expand Down
11 changes: 8 additions & 3 deletions nix/nettleshim.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 8 additions & 3 deletions nix/opensslshim.nix
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions nix/tomcryptshim.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
Expand Down

0 comments on commit 5d991ae

Please sign in to comment.