aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md20
-rw-r--r--flake.nix71
2 files changed, 91 insertions, 0 deletions
diff --git a/README.md b/README.md
index 5c43f2d..ab4ec9e 100644
--- a/README.md
+++ b/README.md
@@ -358,6 +358,26 @@ with a given library version and arguments do:
nix run "?submodules=1#libressl.v392" -- test default LibreSSL
```
+To build the JavaCard applets:
+```shell
+nix build "?submodules=1#applets"
+# or individually
+nix build "?submodules=1#applet222"
+nix build "?submodules=1#applet305"
+nix build "?submodules=1#applet320"
+```
+
+To build or run the reader you can:
+```shell
+nix build '.?submodules=1#reader'
+nix run '.?submodules=1#reader'
+```
+
+If needed, you can also build the `common` library:
+```shell
+nix build '.?submodules=1#common'
+```
+
#### Gradle
```shell
diff --git a/flake.nix b/flake.nix
index 6ca0ef9..9ede30e 100644
--- a/flake.nix
+++ b/flake.nix
@@ -689,6 +689,63 @@
}
);
+ buildReader = { jdkVersion ? pkgs.jdk17_headless }: with pkgs; gradle2nix.builders.${system}.buildGradlePackage rec {
+ pname = "ECTesterReader";
+ version = "0.3.3";
+ lockFile = ./gradle.lock;
+ buildJdk = pkgs.jdk_headless;
+ gradleBuildFlags = [ ":reader:uberJar" ];
+ src = ./.;
+
+ installPhase = ''
+ mkdir -p $out
+ cp -r reader/build $out
+ '';
+
+ nativeBuildInputs = [ makeWrapper ];
+
+ postFixup = ''
+ makeWrapper \
+ ${jdk_headless}/bin/java $out/bin/${pname} \
+ --add-flags "-Dstdout.encoding=UTF8 -Dstderr.encoding=UTF8 -jar $out/build/libs/${pname}.jar"
+ '';
+ };
+
+ buildApplet = { jdkVersion ? pkgs.jdk8_headless }: with pkgs; gradle2nix.builders.${system}.buildGradlePackage rec {
+ pname = "applet";
+ # since the gradle target builds applets for multiple JC SDKs, the
+ # single version cannot reflet that
+ version = "0.3.3";
+ lockFile = ./gradle.lock;
+ buildJdk = jdkVersion;
+ gradleBuildFlags = [ ":applet:buildJavaCard" ];
+ src = ./.;
+
+ installPhase = ''
+ mkdir --parents $out
+ cp --recursive applet/build/* $out
+ '';
+
+ nativeBuildInputs = [ makeWrapper ];
+ };
+
+ buildCommon = { jdkVersion ? pkgs.jdk17_headless }: with pkgs; gradle2nix.builders.${system}.buildGradlePackage rec {
+ pname = "common";
+ version = "0.3.3";
+ lockFile = ./gradle.lock;
+ buildJdk = jdkVersion;
+ gradleBuildFlags = [ ":common:build" ];
+ src = ./.;
+
+ installPhase = ''
+ mkdir --parents $out
+ cp --recursive common/build/* $out
+ '';
+
+ nativeBuildInputs = [ makeWrapper ];
+ };
+
+
defaultVersion =
# Default version is the last one, aka the newest that we fetched
libName:
@@ -774,6 +831,20 @@
function = buildECTesterStandalone;
};
+ reader = buildReader {};
+ common = buildCommon {};
+ applets = pkgs.buildEnv {
+ name = "applets";
+ paths = [
+ applet222
+ applet305
+ applet320
+ ];
+ };
+ applet222 = buildApplet { jdkVersion = pkgs.jdk8_headless; };
+ applet305 = buildApplet { jdkVersion = pkgs.jdk8_headless; };
+ applet320 = buildApplet { jdkVersion = pkgs.jdk17_headless; };
+
shim = {
tomcrypt = loadVersionsForShim {
libName = "tomcrypt";