2021-10-28 06:52:43 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, canonicalize-jars-hook
|
|
|
|
, fetchzip
|
|
|
|
, pkg-config
|
|
|
|
, atk
|
|
|
|
, glib
|
|
|
|
, gtk2
|
|
|
|
, jdk
|
|
|
|
, libGL
|
|
|
|
, libGLU
|
|
|
|
, libXt
|
|
|
|
, libXtst
|
|
|
|
, gnome2
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
platformMap = {
|
|
|
|
x86_64-linux =
|
|
|
|
{ platform = "gtk-linux-x86_64";
|
2021-10-28 06:52:43 +00:00
|
|
|
sha256 = "17frac2nsx22hfa72264as31rn35hfh9gfgy0n6wvc3knl5d2716"; };
|
2020-04-24 23:36:52 +00:00
|
|
|
i686-linux =
|
|
|
|
{ platform = "gtk-linux-x86";
|
2021-10-28 06:52:43 +00:00
|
|
|
sha256 = "13ca17rga9yvdshqvh0sfzarmdcl4wv4pid0ls7v35v4844zbc8b"; };
|
2020-04-24 23:36:52 +00:00
|
|
|
x86_64-darwin =
|
|
|
|
{ platform = "cocoa-macosx-x86_64";
|
2021-10-28 06:52:43 +00:00
|
|
|
sha256 = "0wjyxlw7i9zd2m8syd6k1q85fj8pzhxlfsrl8fpgsj37p698bd0a"; };
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
metadata = assert platformMap ? ${stdenv.hostPlatform.system};
|
|
|
|
platformMap.${stdenv.hostPlatform.system};
|
2020-04-24 23:36:52 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
2021-10-28 06:52:43 +00:00
|
|
|
pname = "swt";
|
2020-04-24 23:36:52 +00:00
|
|
|
version = "4.5";
|
|
|
|
fullVersion = "${version}-201506032000";
|
|
|
|
|
|
|
|
hardeningDisable = [ "format" ];
|
|
|
|
|
|
|
|
# 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.
|
2021-10-28 06:52:43 +00:00
|
|
|
src = fetchzip {
|
|
|
|
url = "https://archive.eclipse.org/eclipse/downloads/drops4/" +
|
|
|
|
"R-${fullVersion}/${pname}-${version}-${metadata.platform}.zip";
|
|
|
|
inherit (metadata) sha256;
|
|
|
|
stripRoot = false;
|
2022-06-16 17:23:12 +00:00
|
|
|
postFetch = ''
|
2021-10-28 06:52:43 +00:00
|
|
|
mkdir "$unpackDir"
|
|
|
|
cd "$unpackDir"
|
|
|
|
|
|
|
|
renamed="$TMPDIR/src.zip"
|
|
|
|
mv "$out/src.zip" "$renamed"
|
|
|
|
unpackFile "$renamed"
|
|
|
|
rm -r "$out"
|
|
|
|
|
|
|
|
mv "$unpackDir" "$out"
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
canonicalize-jars-hook
|
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
buildInputs = [
|
|
|
|
atk
|
|
|
|
gtk2
|
|
|
|
jdk
|
|
|
|
libGL
|
|
|
|
libGLU
|
|
|
|
libXtst
|
|
|
|
gnome2.gnome_vfs
|
|
|
|
gnome2.libgnome
|
|
|
|
gnome2.libgnomeui
|
|
|
|
] ++ lib.optionals (lib.hasPrefix "8u" jdk.version) [
|
|
|
|
libXt
|
|
|
|
];
|
|
|
|
|
|
|
|
patches = [ ./awt-libs.patch ./gtk-libs.patch ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
prePatch = ''
|
|
|
|
# clear whitespace from makefiles (since we match on EOL later)
|
|
|
|
sed -i 's/ \+$//' ./*.mak
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
postPatch = let makefile-sed = builtins.toFile "swt-makefile.sed" (''
|
|
|
|
# fix pkg-config invocations in CFLAGS/LIBS pairs.
|
|
|
|
#
|
|
|
|
# change:
|
|
|
|
# FOOCFLAGS = `pkg-config --cflags `foo bar`
|
|
|
|
# FOOLIBS = `pkg-config --libs-only-L foo` -lbaz
|
|
|
|
# into:
|
|
|
|
# FOOCFLAGS = `pkg-config --cflags foo bar`
|
|
|
|
# FOOLIBS = `pkg-config --libs foo bar`
|
|
|
|
#
|
|
|
|
# the latter works more consistently.
|
|
|
|
/^[A-Z0-9_]\+CFLAGS = `pkg-config --cflags [^`]\+`$/ {
|
|
|
|
N
|
|
|
|
s'' +
|
|
|
|
"/" + ''
|
|
|
|
^\([A-Z0-9_]\+\)CFLAGS = `pkg-config --cflags \(.\+\)`\
|
|
|
|
\1LIBS = `pkg-config --libs-only-L .\+$'' +
|
|
|
|
"/" + ''
|
|
|
|
\1CFLAGS = `pkg-config --cflags \2`\
|
|
|
|
\1LIBS = `pkg-config --libs \2`'' +
|
|
|
|
"/\n" + ''
|
|
|
|
}
|
|
|
|
# fix WebKit libs not being there
|
|
|
|
s/\$(WEBKIT_LIB) \$(WEBKIT_OBJECTS)$/\0 `pkg-config --libs glib-2.0`/g
|
|
|
|
''); in ''
|
|
|
|
declare -a makefiles=(./*.mak)
|
|
|
|
sed -i -f ${makefile-sed} "''${makefiles[@]}"
|
|
|
|
# assign Makefile variables eagerly & change backticks to `$(shell …)`
|
|
|
|
sed -i -e 's/ = `\([^`]\+\)`/ := $(shell \1)/' \
|
|
|
|
-e 's/`\([^`]\+\)`/$(shell \1)/' \
|
|
|
|
"''${makefiles[@]}"
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPhase = ''
|
2021-10-28 06:52:43 +00:00
|
|
|
runHook preBuild
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
export JAVA_HOME=${jdk}
|
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
./build.sh
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
mkdir out
|
2021-10-28 06:52:43 +00:00
|
|
|
find org/ -name '*.java' -type f -exec javac -d out/ {} +
|
|
|
|
|
|
|
|
runHook postBuild
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2021-10-28 06:52:43 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
if [ -n "$prefix" ]; then
|
|
|
|
mkdir -p "$prefix"
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p "$out/lib"
|
|
|
|
cp -t "$out/lib" ./*.so
|
|
|
|
|
|
|
|
mkdir -p "$out/jars"
|
|
|
|
cp -t out/ version.txt
|
|
|
|
(cd out && jar -c *) > "$out/jars/swt.jar"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2021-10-28 06:52:43 +00:00
|
|
|
homepage = "https://www.eclipse.org/swt/";
|
|
|
|
description = ''
|
|
|
|
A widget toolkit for Java to access the user-interface facilities of
|
|
|
|
the operating systems on which it is implemented.
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.epl10;
|
2021-10-28 06:52:43 +00:00
|
|
|
maintainers = with maintainers; [ bb010g ];
|
|
|
|
platforms = platforms.linux;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|