3 , canonicalize-jars-hook
20 { platform = "gtk-linux-x86_64";
21 sha256 = "17frac2nsx22hfa72264as31rn35hfh9gfgy0n6wvc3knl5d2716"; };
23 { platform = "gtk-linux-x86";
24 sha256 = "13ca17rga9yvdshqvh0sfzarmdcl4wv4pid0ls7v35v4844zbc8b"; };
26 { platform = "cocoa-macosx-x86_64";
27 sha256 = "0wjyxlw7i9zd2m8syd6k1q85fj8pzhxlfsrl8fpgsj37p698bd0a"; };
30 metadata = assert platformMap ? ${stdenv.hostPlatform.system};
31 platformMap.${stdenv.hostPlatform.system};
32 in stdenv.mkDerivation rec {
35 fullVersion = "${version}-201506032000";
37 hardeningDisable = [ "format" ];
39 # Alas, the Eclipse Project apparently doesn't produce source-only
40 # releases of SWT. So we just grab a binary release and extract
41 # "src.zip" from that.
43 url = "https://archive.eclipse.org/eclipse/downloads/drops4/" +
44 "R-${fullVersion}/${pname}-${version}-${metadata.platform}.zip";
45 inherit (metadata) sha256;
51 renamed="$TMPDIR/src.zip"
52 mv "$out/src.zip" "$renamed"
56 mv "$unpackDir" "$out"
61 canonicalize-jars-hook
74 ] ++ lib.optionals (lib.hasPrefix "8u" jdk.version) [
78 patches = [ ./awt-libs.patch ./gtk-libs.patch ];
81 # clear whitespace from makefiles (since we match on EOL later)
82 sed -i 's/ \+$//' ./*.mak
85 postPatch = let makefile-sed = builtins.toFile "swt-makefile.sed" (''
86 # fix pkg-config invocations in CFLAGS/LIBS pairs.
89 # FOOCFLAGS = `pkg-config --cflags `foo bar`
90 # FOOLIBS = `pkg-config --libs-only-L foo` -lbaz
92 # FOOCFLAGS = `pkg-config --cflags foo bar`
93 # FOOLIBS = `pkg-config --libs foo bar`
95 # the latter works more consistently.
96 /^[A-Z0-9_]\+CFLAGS = `pkg-config --cflags [^`]\+`$/ {
100 ^\([A-Z0-9_]\+\)CFLAGS = `pkg-config --cflags \(.\+\)`\
101 \1LIBS = `pkg-config --libs-only-L .\+$'' +
103 \1CFLAGS = `pkg-config --cflags \2`\
104 \1LIBS = `pkg-config --libs \2`'' +
107 # fix WebKit libs not being there
108 s/\$(WEBKIT_LIB) \$(WEBKIT_OBJECTS)$/\0 `pkg-config --libs glib-2.0`/g
110 declare -a makefiles=(./*.mak)
111 sed -i -f ${makefile-sed} "''${makefiles[@]}"
112 # assign Makefile variables eagerly & change backticks to `$(shell …)`
113 sed -i -e 's/ = `\([^`]\+\)`/ := $(shell \1)/' \
114 -e 's/`\([^`]\+\)`/$(shell \1)/' \
121 export JAVA_HOME=${jdk}
126 find org/ -name '*.java' -type f -exec javac -d out/ {} +
134 if [ -n "$prefix" ]; then
139 cp -t "$out/lib" ./*.so
142 cp -t out/ version.txt
143 (cd out && jar -c *) > "$out/jars/swt.jar"
149 homepage = "https://www.eclipse.org/swt/";
151 A widget toolkit for Java to access the user-interface facilities of
152 the operating systems on which it is implemented.
154 license = licenses.epl10;
155 maintainers = with maintainers; [ bb010g ];
156 platforms = platforms.linux;