2021-01-15 13:21:58 +00:00
|
|
|
{ lib, stdenv, makeDesktopItem, freetype, fontconfig, libX11, libXrender
|
2020-04-16 19:24:50 +00:00
|
|
|
, zlib, jdk, glib, gtk, libXtst, gsettings-desktop-schemas, webkitgtk
|
2020-11-19 18:27:15 +00:00
|
|
|
, makeWrapper, perl, ... }:
|
2015-11-06 13:41:35 +00:00
|
|
|
|
2018-08-20 19:11:29 +00:00
|
|
|
{ name, src ? builtins.getAttr stdenv.hostPlatform.system sources, sources ? null, description }:
|
2015-11-06 13:41:35 +00: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";
|
2020-06-25 02:18:37 +00:00
|
|
|
categories = "Development;";
|
2015-11-06 13:41:35 +00:00
|
|
|
};
|
|
|
|
|
2017-03-14 10:14:29 +00:00
|
|
|
buildInputs = [
|
2020-04-16 19:24:50 +00:00
|
|
|
fontconfig freetype glib gsettings-desktop-schemas gtk jdk libX11
|
2017-03-14 10:14:29 +00:00
|
|
|
libXrender libXtst makeWrapper zlib
|
2021-01-15 13:21:58 +00:00
|
|
|
] ++ lib.optional (webkitgtk != null) webkitgtk;
|
2015-11-06 13:41:35 +00:00
|
|
|
|
|
|
|
buildCommand = ''
|
|
|
|
# Unpack tarball.
|
|
|
|
mkdir -p $out
|
|
|
|
tar xfvz $src -C $out
|
|
|
|
|
|
|
|
# Patch binaries.
|
2016-04-28 17:31:14 +00:00
|
|
|
interpreter=$(echo ${stdenv.glibc.out}/lib/ld-linux*.so.2)
|
2015-11-06 13:41:35 +00:00
|
|
|
libCairo=$out/eclipse/libcairo-swt.so
|
|
|
|
patchelf --set-interpreter $interpreter $out/eclipse/eclipse
|
2021-01-15 13:21:58 +00:00
|
|
|
[ -f $libCairo ] && patchelf --set-rpath ${lib.makeLibraryPath [ freetype fontconfig libX11 libXrender zlib ]} $libCairo
|
2015-11-06 13:41:35 +00: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 20:15:48 +00:00
|
|
|
--prefix PATH : ${jdk}/bin \
|
2021-01-15 13:21:58 +00:00
|
|
|
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath ([ glib gtk libXtst ] ++ lib.optional (webkitgtk != null) webkitgtk)} \
|
2017-03-14 10:14:29 +00:00
|
|
|
--prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH" \
|
2015-11-06 13:41:35 +00: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
|
2020-11-19 18:27:15 +00:00
|
|
|
|
|
|
|
# ensure eclipse.ini does not try to use a justj jvm, as those aren't compatible with nix
|
|
|
|
${perl}/bin/perl -i -p0e 's|-vm\nplugins/org.eclipse.justj.*/jre/bin\n||' $out/eclipse/eclipse.ini
|
2015-11-06 13:41:35 +00:00
|
|
|
''; # */
|
|
|
|
|
|
|
|
meta = {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "http://www.eclipse.org/";
|
2015-11-06 13:41:35 +00:00
|
|
|
inherit description;
|
2019-02-11 18:22:02 +00:00
|
|
|
platforms = [ "x86_64-linux" ];
|
2015-11-06 13:41:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|