2021-01-17 00:15:33 +00:00
|
|
|
{ lib, stdenv, makeDesktopItem, freetype, fontconfig, libX11, libXrender
|
2022-03-05 16:20:37 +00:00
|
|
|
, zlib, jdk, glib, glib-networking, gtk, libXtst, libsecret, gsettings-desktop-schemas, webkitgtk
|
2020-11-21 19:51:51 +00:00
|
|
|
, makeWrapper, perl, ... }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-19 01:06:50 +00:00
|
|
|
{ name, src ? builtins.getAttr stdenv.hostPlatform.system sources, sources ? null, description, productVersion }:
|
2020-04-24 23:36:52 +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";
|
2022-03-05 16:20:37 +00:00
|
|
|
categories = [ "Development" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
fontconfig freetype glib gsettings-desktop-schemas gtk jdk libX11
|
2021-08-18 13:19:15 +00:00
|
|
|
libXrender libXtst libsecret makeWrapper zlib
|
2021-01-17 00:15:33 +00:00
|
|
|
] ++ lib.optional (webkitgtk != null) webkitgtk;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
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
|
2021-01-17 00:15:33 +00:00
|
|
|
[ -f $libCairo ] && patchelf --set-rpath ${lib.makeLibraryPath [ freetype fontconfig libX11 libXrender zlib ]} $libCairo
|
2020-04-24 23:36:52 +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)
|
|
|
|
|
|
|
|
makeWrapper $out/eclipse/eclipse $out/bin/eclipse \
|
|
|
|
--prefix PATH : ${jdk}/bin \
|
2021-08-18 13:19:15 +00:00
|
|
|
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath ([ glib gtk libXtst libsecret ] ++ lib.optional (webkitgtk != null) webkitgtk)} \
|
2022-03-05 16:20:37 +00:00
|
|
|
--prefix GIO_EXTRA_MODULES : "${glib-networking}/lib/gio/modules" \
|
2020-04-24 23:36:52 +00:00
|
|
|
--prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH" \
|
2021-12-19 01:06:50 +00:00
|
|
|
--add-flags "-configuration \$HOME/.eclipse/''${productId}_${productVersion}/configuration"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# 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-21 19:51:51 +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
|
2020-04-24 23:36:52 +00:00
|
|
|
''; # */
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = "http://www.eclipse.org/";
|
|
|
|
inherit description;
|
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|