diff options
author | Markus S. Wamser <github-dev@mail2013.wamser.eu> | 2020-10-21 23:03:48 +0200 |
---|---|---|
committer | Markus S. Wamser <github-dev@mail2013.wamser.eu> | 2020-10-21 23:06:16 +0200 |
commit | cfeca3278464cf6eff7d3620c921a8d238b44404 (patch) | |
tree | 53e2f1509f79b03e2c43c68956170665ce8c1556 | |
parent | bdbcfb436060f46409a585c78335b1f75646695b (diff) |
jabref: 3.8.1 -> 5.1
-rw-r--r-- | pkgs/applications/office/jabref/default.nix | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/pkgs/applications/office/jabref/default.nix b/pkgs/applications/office/jabref/default.nix index 7ab53b19ce048..03da2170b3d35 100644 --- a/pkgs/applications/office/jabref/default.nix +++ b/pkgs/applications/office/jabref/default.nix @@ -1,14 +1,17 @@ -{ stdenv, fetchurl, makeWrapper, makeDesktopItem, jdk, jre, wrapGAppsHook, gtk3, gsettings-desktop-schemas }: +{ stdenv, fetchurl, makeWrapper, makeDesktopItem, wrapGAppsHook, gtk3, gsettings-desktop-schemas +, zlib , libX11, libXext, libXi, libXrender, libXtst, libGL, alsaLib, libav, cairo, freetype, pango, gdk-pixbuf, glib }: stdenv.mkDerivation rec { - version = "3.8.1"; + version = "5.1"; pname = "jabref"; src = fetchurl { - url = "https://github.com/JabRef/jabref/releases/download/v${version}/JabRef-${version}.jar"; - sha256 = "11asfym74zdq46i217z5n6vc79gylcx8xn7nvwacfqmym0bz79cg"; + url = "https://github.com/JabRef/jabref/releases/download/v${version}/JabRef-${version}-portable_linux.tar.gz"; + sha256 = "04f612byrq3agzy26byg1sgrjyhcpa8xfj0ssh8dl8d8vnhx9742"; }; + preferLocalBuild = true; + desktopItem = makeDesktopItem { comment = meta.description; name = "jabref"; @@ -19,21 +22,44 @@ stdenv.mkDerivation rec { exec = "jabref"; }; - buildInputs = [ makeWrapper jdk wrapGAppsHook gtk3 gsettings-desktop-schemas ]; + nativeBuildInputs = [ makeWrapper wrapGAppsHook ]; + buildInputs = [ gsettings-desktop-schemas ] ++ systemLibs; - dontUnpack = true; + systemLibs = [ gtk3 zlib libX11 libXext libXi libXrender libXtst libGL alsaLib libav cairo freetype pango gdk-pixbuf glib ]; + systemLibPaths = stdenv.lib.makeLibraryPath systemLibs; installPhase = '' - mkdir -p $out/bin $out/share/java $out/share/icons + mkdir -p $out/share/java $out/share/icons - cp -r ${desktopItem}/share/applications $out/share/ + cp -r lib $out/lib + + for f in $out/lib/runtime/bin/j*; do + patchelf \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ + --set-rpath "${ stdenv.lib.makeLibraryPath [ zlib ]}:$out/lib/runtime/lib:$out/lib/runtime/lib/server" $f + done + + for f in $out/lib/runtime/lib/*.so; do + patchelf \ + --set-rpath "${systemLibPaths}:$out/lib/runtime/lib:$out/lib/runtime/lib/server" $f + done - jar xf $src images/icons/JabRef-icon-mac.svg - cp images/icons/JabRef-icon-mac.svg $out/share/icons/jabref.svg + # patching the libs in the JImage runtime image is quite impossible as there is no documented way + # of rebuilding the image after it has been extracted + # the image format itself is "intendedly not documented" - maybe one of the reasons the + # devolpers constantly broke "jimage recreate" and dropped it in OpenJDK 9 Build 116 Early Access + # so, for now just copy the image and provide our lib paths through the wrapper + + makeWrapper $out/lib/runtime/bin/java $out/bin/jabref \ + --add-flags '-Djava.library.path=${systemLibPaths}' --add-flags "-p $out/lib/app -m org.jabref/org.jabref.JabRefLauncher" \ + --run 'export LD_LIBRARY_PATH=${systemLibPaths}:$LD_LIBRARY_PATH' + + cp -r ${desktopItem}/share/applications $out/share/ - ln -s $src $out/share/java/jabref-${version}.jar - makeWrapper ${jre}/bin/java $out/bin/jabref \ - --add-flags "-jar $out/share/java/jabref-${version}.jar" + # we still need to unpack the runtime image to get the icon + mkdir unpacked + $out/lib/runtime/bin/jimage extract --dir=./unpacked lib/runtime/lib/modules + cp unpacked/org.jabref/icons/jabref.svg $out/share/icons/jabref.svg ''; meta = with stdenv.lib; { |