2020-10-21 22:03:48 +01:00
|
|
|
{ stdenv, fetchurl, makeWrapper, makeDesktopItem, wrapGAppsHook, gtk3, gsettings-desktop-schemas
|
|
|
|
, zlib , libX11, libXext, libXi, libXrender, libXtst, libGL, alsaLib, libav, cairo, freetype, pango, gdk-pixbuf, glib }:
|
2015-03-27 17:03:38 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2020-10-21 22:03:48 +01:00
|
|
|
version = "5.1";
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "jabref";
|
2016-06-13 12:40:16 +01:00
|
|
|
|
2015-03-27 17:03:38 +00:00
|
|
|
src = fetchurl {
|
2020-10-21 22:03:48 +01:00
|
|
|
url = "https://github.com/JabRef/jabref/releases/download/v${version}/JabRef-${version}-portable_linux.tar.gz";
|
|
|
|
sha256 = "04f612byrq3agzy26byg1sgrjyhcpa8xfj0ssh8dl8d8vnhx9742";
|
2015-03-27 17:03:38 +00:00
|
|
|
};
|
|
|
|
|
2020-10-21 22:03:48 +01:00
|
|
|
preferLocalBuild = true;
|
|
|
|
|
2015-03-27 17:03:38 +00:00
|
|
|
desktopItem = makeDesktopItem {
|
|
|
|
comment = meta.description;
|
|
|
|
name = "jabref";
|
|
|
|
desktopName = "JabRef";
|
|
|
|
genericName = "Bibliography manager";
|
2020-06-25 03:18:37 +01:00
|
|
|
categories = "Office;";
|
2015-03-27 17:03:38 +00:00
|
|
|
icon = "jabref";
|
|
|
|
exec = "jabref";
|
|
|
|
};
|
|
|
|
|
2020-10-21 22:03:48 +01:00
|
|
|
nativeBuildInputs = [ makeWrapper wrapGAppsHook ];
|
|
|
|
buildInputs = [ gsettings-desktop-schemas ] ++ systemLibs;
|
2015-03-27 17:03:38 +00:00
|
|
|
|
2020-10-21 22:03:48 +01:00
|
|
|
systemLibs = [ gtk3 zlib libX11 libXext libXi libXrender libXtst libGL alsaLib libav cairo freetype pango gdk-pixbuf glib ];
|
|
|
|
systemLibPaths = stdenv.lib.makeLibraryPath systemLibs;
|
2015-03-27 17:03:38 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2020-10-21 22:03:48 +01:00
|
|
|
mkdir -p $out/share/java $out/share/icons
|
2016-06-13 12:40:16 +01:00
|
|
|
|
2020-10-21 22:03:48 +01:00
|
|
|
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
|
2016-06-13 12:40:16 +01:00
|
|
|
|
2020-10-21 22:03:48 +01:00
|
|
|
# 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/
|
2016-06-13 12:40:16 +01:00
|
|
|
|
2020-10-21 22:03:48 +01:00
|
|
|
# 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
|
2015-03-27 17:03:38 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Open source bibliography reference manager";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://www.jabref.org";
|
2015-03-27 17:03:38 +00:00
|
|
|
license = licenses.gpl2;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = [ maintainers.gebner ];
|
|
|
|
};
|
|
|
|
}
|