leiningen: Simplify build.

This commit is contained in:
Moritz Ulrich 2016-08-23 12:38:24 +02:00
parent 320367c273
commit 08933f8a07
3 changed files with 23 additions and 33 deletions

View file

@ -1,23 +0,0 @@
#!/bin/bash
source $stdenv/setup
mkdir -pv $out/bin $out/share/java
out_bin=$out/bin/lein
cp -v $src $out_bin
cp -v $jarsrc "$out/share/java/$name-standalone.jar"
for p in $patches;
do
patch --verbose $out_bin -p0 < $p
done
chmod -v 755 $out_bin
patchShebangs $out
wrapProgram $out_bin \
--prefix PATH ":" "${stdenv.lib.makeBinPath [ rlwrap coreutils findutils ]}" \
--set LEIN_GPG ${gnupg1compat}/bin/gpg \
--set JAVA_CMD ${jdk}/bin/java

View file

@ -1,5 +1,5 @@
{ stdenv, fetchurl, makeWrapper
, coreutils, findutils, jdk, rlwrap, gnupg1compat }:
, coreutils, jdk, rlwrap, gnupg1compat }:
stdenv.mkDerivation rec {
pname = "leiningen";
@ -17,16 +17,33 @@ stdenv.mkDerivation rec {
sha256 = "1533msarx6gb3xc2sp2nmspllnqy7anpnv9a0ifl0psxm3xph06p";
};
patches = [ ./lein-fix-jar-path.patch ];
JARNAME = "${name}-standalone.jar";
inherit rlwrap gnupg1compat findutils coreutils jdk;
builder = ./builder.sh;
unpackPhase = "true";
buildInputs = [ makeWrapper ];
propagatedBuildInputs = [ jdk ];
installPhase = ''
mkdir -p $out/bin $out/share/java
cp -v $src $out/bin/lein
cp -v $jarsrc $out/share/java/$JARNAME
'';
fixupPhase = ''
chmod +x $out/bin/lein
patchShebangs $out/bin/lein
substituteInPlace $out/bin/lein \
--replace 'LEIN_JAR=/usr/share/java/leiningen-$LEIN_VERSION-standalone.jar' "LEIN_JAR=$out/share/java/$JARNAME"
wrapProgram $out/bin/lein \
--prefix PATH ":" "${stdenv.lib.makeBinPath [ rlwrap coreutils ]}" \
--set LEIN_GPG ${gnupg1compat}/bin/gpg \
--set JAVA_CMD ${jdk}/bin/java
'';
meta = {
homepage = http://leiningen.org/;
description = "Project automation for Clojure";

View file

@ -1,4 +0,0 @@
46c47
< LEIN_JAR=/usr/share/java/leiningen-$LEIN_VERSION-standalone.jar
---
> LEIN_JAR=$(find $(dirname $0)/../share/java -name *-standalone.jar | head -n 1)