2016-09-11 22:24:51 +01:00
|
|
|
{ stdenv, lib, fetchurl, unzip, jdk, pkgconfig, gtk2
|
2019-11-10 16:44:34 +00:00
|
|
|
, libXt, libXtst, libXi, libGLU, libGL, webkitgtk, libsoup, xorg
|
2019-05-22 12:03:39 +01:00
|
|
|
, pango, gdk-pixbuf, glib
|
2011-01-24 19:57:15 +00:00
|
|
|
}:
|
2005-12-26 00:51:24 +00:00
|
|
|
|
2015-03-15 04:04:24 +00:00
|
|
|
let
|
2015-03-17 23:22:38 +00:00
|
|
|
platformMap = {
|
2019-08-13 22:52:01 +01:00
|
|
|
x86_64-linux =
|
2015-03-17 23:22:38 +00:00
|
|
|
{ platform = "gtk-linux-x86_64";
|
2016-09-04 06:54:41 +01:00
|
|
|
sha256 = "1qq0pjll6030v4ml0hifcaaik7sx3fl7ghybfdw95vsvxafwp2ff"; };
|
2019-08-13 22:52:01 +01:00
|
|
|
i686-linux =
|
2015-03-17 23:22:38 +00:00
|
|
|
{ platform = "gtk-linux-x86";
|
2016-09-04 06:54:41 +01:00
|
|
|
sha256 = "03mhzraikcs4fsz7d3h5af9pw1bbcfd6dglsvbk2ciwimy9zj30q"; };
|
2019-08-13 22:52:01 +01:00
|
|
|
x86_64-darwin =
|
2015-03-17 23:22:38 +00:00
|
|
|
{ platform = "cocoa-macosx-x86_64";
|
2016-09-04 06:54:41 +01:00
|
|
|
sha256 = "00k1mfbncvyh8klgmk0891w8jwnd5niqb16j1j8yacrm2smmlb05"; };
|
2015-03-17 23:22:38 +00:00
|
|
|
};
|
|
|
|
|
2018-08-20 20:11:29 +01:00
|
|
|
metadata = assert platformMap ? ${stdenv.hostPlatform.system}; platformMap.${stdenv.hostPlatform.system};
|
2015-03-15 04:04:24 +00:00
|
|
|
|
2015-03-07 16:47:58 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
2016-09-04 06:54:41 +01:00
|
|
|
version = "4.5";
|
|
|
|
fullVersion = "${version}-201506032000";
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "swt";
|
2015-03-07 16:47:58 +00:00
|
|
|
|
2016-02-26 17:38:15 +00:00
|
|
|
hardeningDisable = [ "format" ];
|
2016-02-24 16:07:13 +00:00
|
|
|
|
2005-12-26 00:51:24 +00:00
|
|
|
# Alas, the Eclipse Project apparently doesn't produce source-only
|
|
|
|
# releases of SWT. So we just grab a binary release and extract
|
|
|
|
# "src.zip" from that.
|
|
|
|
src = fetchurl {
|
2019-08-15 13:41:18 +01:00
|
|
|
url = "http://archive.eclipse.org/eclipse/downloads/drops4/R-${fullVersion}/${pname}-${version}-${metadata.platform}.zip";
|
2015-03-07 16:47:58 +00:00
|
|
|
sha256 = metadata.sha256;
|
2005-12-26 00:51:24 +00:00
|
|
|
};
|
2011-01-24 19:57:15 +00:00
|
|
|
|
2016-04-17 15:32:08 +01:00
|
|
|
sourceRoot = ".";
|
|
|
|
|
2016-09-04 06:54:41 +01:00
|
|
|
nativeBuildInputs = [ unzip pkgconfig ];
|
2019-11-10 16:44:34 +00:00
|
|
|
buildInputs = [ jdk gtk2 libXt libXtst libXi libGLU libGL webkitgtk libsoup ];
|
2016-04-17 15:32:08 +01:00
|
|
|
|
2019-11-09 23:52:53 +00:00
|
|
|
NIX_LFLAGS = toString (map (x: "-L${lib.getLib x}/lib") [ xorg.libX11 pango gdk-pixbuf glib ]) +
|
|
|
|
" -lX11 -lpango-1.0 -lgdk_pixbuf-2.0 -lglib-2.0";
|
2016-04-17 15:32:08 +01:00
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
unzip src.zip -d src
|
|
|
|
|
|
|
|
cd src
|
|
|
|
sed -i "s#^LFLAGS =#LFLAGS = $NIX_LFLAGS #g" *.mak
|
|
|
|
export JAVA_HOME=${jdk}
|
|
|
|
|
|
|
|
sh ./build.sh
|
|
|
|
|
|
|
|
mkdir out
|
|
|
|
javac -d out/ $(find org/ -name "*.java")
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/lib
|
|
|
|
cp *.so $out/lib
|
|
|
|
|
|
|
|
mkdir -p $out/jars
|
|
|
|
cp version.txt out/
|
|
|
|
cd out && jar -c * > $out/jars/swt.jar
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = http://www.eclipse.org/swt/;
|
|
|
|
description = "An widget toolkit for Java to access the user-interface facilities of the operating systems on which it is implemented";
|
|
|
|
license = licenses.epl10;
|
|
|
|
maintainers = with maintainers; [ pSub ];
|
2016-08-02 18:50:55 +01:00
|
|
|
platforms = with platforms; linux;
|
2016-04-17 15:32:08 +01:00
|
|
|
};
|
2005-12-26 00:51:24 +00:00
|
|
|
}
|