summary refs log tree commit diff
path: root/pkgs/applications/science/logic/isabelle
diff options
context:
space:
mode:
authorJan van Brügge <supermanitu@gmail.com>2022-02-02 14:04:46 +0100
committerJan van Brügge <supermanitu@gmail.com>2022-02-14 15:17:58 +0100
commit75f5b1f5b287f8f34cc5442891406438d6cd6ac7 (patch)
tree3ee2d13ade4c57a23913f972c858ac1ab9377189 /pkgs/applications/science/logic/isabelle
parent69a4d3855b5ad6c0b7bf76d05ca9ea4c1355c2cc (diff)
downloadnixpkgs-75f5b1f5b287f8f34cc5442891406438d6cd6ac7.tar
nixpkgs-75f5b1f5b287f8f34cc5442891406438d6cd6ac7.tar.gz
nixpkgs-75f5b1f5b287f8f34cc5442891406438d6cd6ac7.tar.bz2
nixpkgs-75f5b1f5b287f8f34cc5442891406438d6cd6ac7.tar.lz
nixpkgs-75f5b1f5b287f8f34cc5442891406438d6cd6ac7.tar.xz
nixpkgs-75f5b1f5b287f8f34cc5442891406438d6cd6ac7.tar.zst
nixpkgs-75f5b1f5b287f8f34cc5442891406438d6cd6ac7.zip
isabelle: Rebuild isabelle_setup.jar
This jar contained a call to /usr/bin/env bash which was causing an
error during the build of the HOL session (which could be ignored) and
caused other errors during the development of https://github.com/NixOS/nixpkgs/pull/157515
 (which could not be ignored). This commit patches the java sources to
 call `bash` directly and rebuild the jar.
Diffstat (limited to 'pkgs/applications/science/logic/isabelle')
-rw-r--r--pkgs/applications/science/logic/isabelle/default.nix24
1 files changed, 23 insertions, 1 deletions
diff --git a/pkgs/applications/science/logic/isabelle/default.nix b/pkgs/applications/science/logic/isabelle/default.nix
index 0f041002425..bdfe881c1c3 100644
--- a/pkgs/applications/science/logic/isabelle/default.nix
+++ b/pkgs/applications/science/logic/isabelle/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurl, coreutils, nettools, java, polyml, z3, veriT, vampire, eprover-ho, rlwrap, makeDesktopItem }:
+{ lib, stdenv, fetchurl, coreutils, nettools, java, scala, polyml, z3, veriT, vampire, eprover-ho, rlwrap, perl, makeDesktopItem }:
 # nettools needed for hostname
 
 stdenv.mkDerivation rec {
@@ -77,6 +77,10 @@ stdenv.mkDerivation rec {
     substituteInPlace lib/Tools/env \
       --replace /usr/bin/env ${coreutils}/bin/env
 
+    substituteInPlace src/Tools/Setup/src/Environment.java \
+      --replace 'cmd.add("/usr/bin/env");' "" \
+      --replace 'cmd.add("bash");' "cmd.add(\"$SHELL\");"
+
     rm -r heaps
   '' + (if ! stdenv.isLinux then "" else ''
     arch=${if stdenv.hostPlatform.system == "x86_64-linux" then "x86_64-linux" else "x86-linux"}
@@ -90,6 +94,24 @@ stdenv.mkDerivation rec {
 
   buildPhase = ''
     export HOME=$TMP # The build fails if home is not set
+    setup_name=$(basename contrib/isabelle_setup*)
+
+    #The following is adapted from https://isabelle.sketis.net/repos/isabelle/file/Isabelle2021-1/Admin/lib/Tools/build_setup
+    TARGET_DIR="contrib/$setup_name/lib"
+    rm -rf "$TARGET_DIR"
+    mkdir -p "$TARGET_DIR/isabelle/setup"
+    declare -a ARGS=("-Xlint:unchecked")
+
+    SOURCES="$(${perl}/bin/perl -e 'while (<>) { if (m/(\S+\.java)/)  { print "$1 "; } }' "src/Tools/Setup/etc/build.props")"
+    for SRC in $SOURCES
+    do
+      ARGS["''${#ARGS[@]}"]="src/Tools/Setup/$SRC"
+    done
+    ${java}/bin/javac -d "$TARGET_DIR" -classpath ${scala}/lib/scala-compiler.jar "''${ARGS[@]}"
+    ${java}/bin/jar -c -f "$TARGET_DIR/isabelle_setup.jar" -e "isabelle.setup.Setup" -C "$TARGET_DIR" isabelle
+    rm -rf "$TARGET_DIR/isabelle"
+
+    # Prebuild HOL Session
     bin/isabelle build -v -o system_heaps -b HOL
   '';