Merge pull request #104190 from jlesquembre/clj-fix

clojure: Mimic upstream install script
This commit is contained in:
Timo Kaufmann 2020-11-19 19:17:52 +01:00 committed by GitHub
commit 2e8d073cbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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
'';