From 2fc54219173ef398e4579fbd29468f253ab7585e Mon Sep 17 00:00:00 2001
From: Guy Repta <50716988+gtrepta@users.noreply.github.com>
Date: Tue, 21 Nov 2023 15:17:56 -0600
Subject: [PATCH 1/4] Install nailgun to lib/kframework/bin
---
k-distribution/src/main/assembly/bin.xml | 2 +-
k-distribution/src/main/scripts/lib/setenv | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/k-distribution/src/main/assembly/bin.xml b/k-distribution/src/main/assembly/bin.xml
index d322cd42ab8..f6b04650adc 100644
--- a/k-distribution/src/main/assembly/bin.xml
+++ b/k-distribution/src/main/assembly/bin.xml
@@ -7,7 +7,7 @@
k
- /bin
+ /lib/kframework/bin
*:uexe:${native.os.classifier}:*
diff --git a/k-distribution/src/main/scripts/lib/setenv b/k-distribution/src/main/scripts/lib/setenv
index d007e109ac7..7e007d7a8ac 100644
--- a/k-distribution/src/main/scripts/lib/setenv
+++ b/k-distribution/src/main/scripts/lib/setenv
@@ -9,7 +9,7 @@ else
fi
K_LIB_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-export PATH="$K_LIB_DIR/../../bin:$PATH"
+export PATH="$K_LIB_DIR/../../bin:$K_LIB_DIR/bin:$PATH"
source "$K_LIB_DIR/checkJava" # sets ARCH and JAVA
From 7ab650ea4cc8cf6c916b6ea7e0fcd6f14cbc3107 Mon Sep 17 00:00:00 2001
From: Guy Repta <50716988+gtrepta@users.noreply.github.com>
Date: Tue, 21 Nov 2023 15:56:54 -0600
Subject: [PATCH 2/4] nix/k.nix: Include lib/kframework/bin in bin-unwrapped
---
nix/k.nix | 1 +
1 file changed, 1 insertion(+)
diff --git a/nix/k.nix b/nix/k.nix
index 2551f4208fc..a344af91787 100644
--- a/nix/k.nix
+++ b/nix/k.nix
@@ -57,6 +57,7 @@ let
chmod +x $out/bin/k-which-python
cp -r k-distribution/target/release/k/bin/* $out/bin-unwrapped/
+ cp -r k-distribution/target/release/k/lib/kframework/bin/* $out/bin-unwrapped/
cp -r k-distribution/target/release/k/{include,lib} $out/
mkdir -p $out/lib/cmake/kframework
From 30f354b94abd3a773633a29dad4ba8bc8b1b8f02 Mon Sep 17 00:00:00 2001
From: Guy Repta <50716988+gtrepta@users.noreply.github.com>
Date: Mon, 27 Nov 2023 12:04:21 -0600
Subject: [PATCH 3/4] Invoke nailgun more directly instead of adding to PATH
---
k-distribution/src/main/scripts/lib/checkJava | 7 ++++---
k-distribution/src/main/scripts/lib/setenv | 2 +-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/k-distribution/src/main/scripts/lib/checkJava b/k-distribution/src/main/scripts/lib/checkJava
index 263256a6795..733a6a50e32 100755
--- a/k-distribution/src/main/scripts/lib/checkJava
+++ b/k-distribution/src/main/scripts/lib/checkJava
@@ -23,17 +23,18 @@ function setarch {
fi
}
+NG="$(dirname "${BASH_SOURCE[0]}")/bin/ng"
KSERVER_SOCKET="${KSERVER_SOCKET:-$HOME/.kserver}"
-KSERVER_INSTANCE="ng --nailgun-server local:$KSERVER_SOCKET/socket"
+KSERVER_INSTANCE="$NG --nailgun-server local:$KSERVER_SOCKET/socket"
version=$($KSERVER_INSTANCE org.kframework.main.JavaVersion 2>&1)
if [ $? -eq 0 ]; then
setarch
JAVA="$KSERVER_INSTANCE"
else
- version=$(ng org.kframework.main.JavaVersion 2>&1)
+ version=$($NG org.kframework.main.JavaVersion 2>&1)
if [ $? -eq 0 ]; then
setarch
- JAVA=ng
+ JAVA=$NG
else
version=$("$_java" -version 2>&1)
setarch
diff --git a/k-distribution/src/main/scripts/lib/setenv b/k-distribution/src/main/scripts/lib/setenv
index 7e007d7a8ac..d007e109ac7 100644
--- a/k-distribution/src/main/scripts/lib/setenv
+++ b/k-distribution/src/main/scripts/lib/setenv
@@ -9,7 +9,7 @@ else
fi
K_LIB_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-export PATH="$K_LIB_DIR/../../bin:$K_LIB_DIR/bin:$PATH"
+export PATH="$K_LIB_DIR/../../bin:$PATH"
source "$K_LIB_DIR/checkJava" # sets ARCH and JAVA
From ab46e70b8a24dc481cdb55b1a5cf11984c3cd93d Mon Sep 17 00:00:00 2001
From: Guy Repta <50716988+gtrepta@users.noreply.github.com>
Date: Mon, 27 Nov 2023 12:13:32 -0600
Subject: [PATCH 4/4] nix: Patch ng in place instead of copying it to
bin-unwrapped
---
nix/k.nix | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/nix/k.nix b/nix/k.nix
index a344af91787..37ab9f957d8 100644
--- a/nix/k.nix
+++ b/nix/k.nix
@@ -57,7 +57,6 @@ let
chmod +x $out/bin/k-which-python
cp -r k-distribution/target/release/k/bin/* $out/bin-unwrapped/
- cp -r k-distribution/target/release/k/lib/kframework/bin/* $out/bin-unwrapped/
cp -r k-distribution/target/release/k/{include,lib} $out/
mkdir -p $out/lib/cmake/kframework
@@ -105,7 +104,7 @@ let
'';
preFixup = lib.optionalString (!stdenv.isDarwin) ''
- patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$out/bin-unwrapped/ng"
+ patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$out/lib/kframework/bin/ng"
'';
passthru =