2017-03-14 11:14:29 +01:00
|
|
|
{ stdenv, makeDesktopItem, freetype, fontconfig, libX11, libXrender
|
2018-03-07 21:29:51 +01:00
|
|
|
, zlib, jdk, glib, gtk3, libXtst, gsettings-desktop-schemas, webkitgtk
|
2017-03-14 11:14:29 +01:00
|
|
|
, makeWrapper, ... }:
|
2015-11-06 14:41:35 +01:00
|
|
|
|
2018-08-20 21:11:29 +02:00
|
|
|
{ name, src ? builtins.getAttr stdenv.hostPlatform.system sources, sources ? null, description }:
|
2015-11-06 14:41:35 +01:00
|
|
|
|
|
|
|
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;";
|
|
|
|
};
|
|
|
|
|
2017-03-14 11:14:29 +01:00
|
|
|
buildInputs = [
|
2018-03-07 21:29:51 +01:00
|
|
|
fontconfig freetype glib gsettings-desktop-schemas gtk3 jdk libX11
|
2017-03-14 11:14:29 +01:00
|
|
|
libXrender libXtst makeWrapper zlib
|
2018-03-07 21:29:51 +01:00
|
|
|
] ++ stdenv.lib.optional (webkitgtk != null) webkitgtk;
|
2015-11-06 14:41:35 +01:00
|
|
|
|
|
|
|
buildCommand = ''
|
|
|
|
# Unpack tarball.
|
|
|
|
mkdir -p $out
|
|
|
|
tar xfvz $src -C $out
|
|
|
|
|
|
|
|
# Patch binaries.
|
2016-04-28 19:31:14 +02:00
|
|
|
interpreter=$(echo ${stdenv.glibc.out}/lib/ld-linux*.so.2)
|
2015-11-06 14:41:35 +01:00
|
|
|
libCairo=$out/eclipse/libcairo-swt.so
|
|
|
|
patchelf --set-interpreter $interpreter $out/eclipse/eclipse
|
2016-08-22 23:04:39 +02:00
|
|
|
[ -f $libCairo ] && patchelf --set-rpath ${stdenv.lib.makeLibraryPath [ freetype fontconfig libX11 libXrender zlib ]} $libCairo
|
2015-11-06 14:41:35 +01:00
|
|
|
|
|
|
|
# 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 \
|
2016-02-04 21:15:48 +01:00
|
|
|
--prefix PATH : ${jdk}/bin \
|
2018-03-07 21:29:51 +01:00
|
|
|
--prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath ([ glib gtk3 libXtst ] ++ stdenv.lib.optional (webkitgtk != null) webkitgtk)} \
|
2017-03-14 11:14:29 +01:00
|
|
|
--prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH" \
|
2015-11-06 14:41:35 +01:00
|
|
|
--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;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|