clojure: Mimic upstream install script

Also installs exec.jar in the expected location
This commit is contained in:
José Luis Lafuente 2020-11-18 17:47:54 +01:00
parent 6625284c39
commit b364168989
No known key found for this signature in database
GPG Key ID: 8A3455EBE455489A

View File

@ -14,22 +14,28 @@ stdenv.mkDerivation rec {
makeWrapper
];
# See https://github.com/clojure/brew-install/blob/1.10.1/src/main/resources/clojure/install/linux-install.sh
installPhase =
let
binPath = stdenv.lib.makeBinPath [ rlwrap jdk ];
in
''
mkdir -p $out/libexec
cp clojure-tools-${version}.jar $out/libexec
cp example-deps.edn $out
cp deps.edn $out
cp exec.jar $out
clojure_lib_dir=$out
bin_dir=$out/bin
echo "Installing libs into $clojure_lib_dir"
install -Dm644 deps.edn "$clojure_lib_dir/deps.edn"
install -Dm644 example-deps.edn "$clojure_lib_dir/example-deps.edn"
install -Dm644 exec.jar "$clojure_lib_dir/libexec/exec.jar"
install -Dm644 clojure-tools-${version}.jar "$clojure_lib_dir/libexec/clojure-tools-${version}.jar"
echo "Installing clojure and clj into $bin_dir"
substituteInPlace clojure --replace PREFIX $out
install -Dm755 clojure "$bin_dir/clojure"
install -Dm755 clj "$bin_dir/clj"
install -Dt $out/bin clj clojure
wrapProgram $out/bin/clj --prefix PATH : $out/bin:${binPath}
wrapProgram $out/bin/clojure --prefix PATH : $out/bin:${binPath}
wrapProgram $bin_dir/clojure --prefix PATH : $out/bin:${binPath}
wrapProgram $bin_dir/clj --prefix PATH : $out/bin:${binPath}
installManPage clj.1 clojure.1
'';