jameica: get rid of launcher script, only use makeWrapper

This also switches using java paths suggested by docs instead of
$out/share/libexec
This commit is contained in:
Florian Klink 2018-08-17 16:22:00 +02:00
parent c03d0b52ac
commit 30f0011bb2

View File

@ -11,11 +11,6 @@ let
else if stdenv.system == "x86_64-darwin" then "macos64"
else throw "Unsupported system: ${stdenv.system}";
launcher = ''
#!${stdenv.shell}
exec ${jre}/bin/java -Xmx512m ${ stdenv.lib.optionalString stdenv.isDarwin ''-Xdock:name="Jameica" -XstartOnFirstThread''} de.willuhn.jameica.Main "$@"
'';
desktopItem = makeDesktopItem {
name = "jameica";
exec = "jameica";
@ -56,24 +51,24 @@ stdenv.mkDerivation rec {
'';
installPhase = ''
mkdir -p $out/libexec $out/lib $out/bin $out/share/applications
mkdir -p $out/libexec $out/lib $out/bin $out/share/{applications,${name},java}/
# copy libraries except SWT
cp $(find lib -type f -iname '*.jar' | grep -ve 'swt/.*/swt.jar') $out/lib/
cp $(find lib -type f -iname '*.jar' | grep -ve 'swt/.*/swt.jar') $out/share/${name}/
# copy platform-specific SWT
cp lib/swt/${swtSystem}/swt.jar $out/lib
cp lib/swt/${swtSystem}/swt.jar $out/share/${name}/
install -Dm644 releases/${_version}-*/jameica/jameica.jar $out/libexec/
install -Dm644 plugin.xml $out/libexec/
install -Dm644 releases/${_version}-*/jameica/jameica.jar $out/share/java/
install -Dm644 plugin.xml $out/share/java/
install -Dm644 build/jameica-icon.png $out/share/pixmaps/jameica.png
cp ${desktopItem}/share/applications/* $out/share/applications/
echo "${launcher}" > $out/bin/jameica
chmod +x $out/bin/jameica
wrapProgram $out/bin/jameica --prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath buildInputs} \
--set CLASSPATH "$out/libexec/jameica.jar:$out/lib/*" \
--run "cd $out/libexec"
# jameica expects its working dir set to the "program directory"
makeWrapper ${jre}/bin/java $out/bin/jameica \
--add-flags "-cp $out/share/java/jameica.jar:$out/share/${name}/* ${
stdenv.lib.optionalString stdenv.isDarwin ''-Xdock:name="Jameica" -XstartOnFirstThread''
} de.willuhn.jameica.Main" \
--prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath buildInputs} \
--run "cd $out/share/java/"
'';
meta = with stdenv.lib; {