nixpkgs/pkgs/applications/editors/eclipse/build-eclipse.nix
Matt McHenry cb66a7468e eclipse: jdk8 -> jdk10
in combination with the parent commit that makes jdk10 use gtk3, this
lets us get onto a current webkitgtk.

since the current version of webkitgtk is still receiving security
updates, this also reverts 49ea0e2736
"eclipse: Do not use webkitgtk2 by default".
2018-04-03 12:30:21 -04:00

60 lines
2.2 KiB
Nix

{ stdenv, makeDesktopItem, freetype, fontconfig, libX11, libXrender
, zlib, jdk, glib, gtk3, libXtst, gsettings-desktop-schemas, webkitgtk
, makeWrapper, ... }:
{ name, src ? builtins.getAttr stdenv.system sources, sources ? null, description }:
stdenv.mkDerivation rec {
inherit name src;
desktopItem = makeDesktopItem {
name = "Eclipse";
exec = "eclipse";
icon = "eclipse";
comment = "Integrated Development Environment";
desktopName = "Eclipse IDE";
genericName = "Integrated Development Environment";
categories = "Application;Development;";
};
buildInputs = [
fontconfig freetype glib gsettings-desktop-schemas gtk3 jdk libX11
libXrender libXtst makeWrapper zlib
] ++ stdenv.lib.optional (webkitgtk != null) webkitgtk;
buildCommand = ''
# Unpack tarball.
mkdir -p $out
tar xfvz $src -C $out
# Patch binaries.
interpreter=$(echo ${stdenv.glibc.out}/lib/ld-linux*.so.2)
libCairo=$out/eclipse/libcairo-swt.so
patchelf --set-interpreter $interpreter $out/eclipse/eclipse
[ -f $libCairo ] && patchelf --set-rpath ${stdenv.lib.makeLibraryPath [ freetype fontconfig libX11 libXrender zlib ]} $libCairo
# Create wrapper script. Pass -configuration to store
# settings in ~/.eclipse/org.eclipse.platform_<version> rather
# than ~/.eclipse/org.eclipse.platform_<version>_<number>.
productId=$(sed 's/id=//; t; d' $out/eclipse/.eclipseproduct)
productVersion=$(sed 's/version=//; t; d' $out/eclipse/.eclipseproduct)
makeWrapper $out/eclipse/eclipse $out/bin/eclipse \
--prefix PATH : ${jdk}/bin \
--prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath ([ glib gtk3 libXtst ] ++ stdenv.lib.optional (webkitgtk != null) webkitgtk)} \
--prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH" \
--add-flags "-configuration \$HOME/.eclipse/''${productId}_$productVersion/configuration"
# Create desktop item.
mkdir -p $out/share/applications
cp ${desktopItem}/share/applications/* $out/share/applications
mkdir -p $out/share/pixmaps
ln -s $out/eclipse/icon.xpm $out/share/pixmaps/eclipse.xpm
''; # */
meta = {
homepage = http://www.eclipse.org/;
inherit description;
};
}