13 stripJavaArchivesHook,
16 stdenv.mkDerivation (finalAttrs: {
19 fullVersion = "${finalAttrs.version}-201506032000";
21 hardeningDisable = [ "format" ];
23 passthru.srcMetadataByPlatform = {
24 x86_64-linux.platform = "gtk-linux-x86_64";
25 x86_64-linux.sha256 = "17frac2nsx22hfa72264as31rn35hfh9gfgy0n6wvc3knl5d2716";
26 i686-linux.platform = "gtk-linux-x86";
27 i686-linux.sha256 = "13ca17rga9yvdshqvh0sfzarmdcl4wv4pid0ls7v35v4844zbc8b";
28 x86_64-darwin.platform = "cocoa-macosx-x86_64";
29 x86_64-darwin.sha256 = "0wjyxlw7i9zd2m8syd6k1q85fj8pzhxlfsrl8fpgsj37p698bd0a";
31 passthru.srcMetadata =
32 finalAttrs.passthru.srcMetadataByPlatform.${stdenv.hostPlatform.system} or null;
33 # Alas, the Eclipse Project apparently doesn't produce source-only
34 # releases of SWT. So we just grab a binary release and extract
35 # "src.zip" from that.
38 inherit (finalAttrs.passthru) srcMetadata;
40 assert srcMetadata != null;
42 url = "https://archive.eclipse.org/eclipse/downloads/drops4/R-${finalAttrs.fullVersion}/swt-${finalAttrs.version}-${srcMetadata.platform}.zip";
43 inherit (srcMetadata) sha256;
49 renamed="$TMPDIR/src.zip"
50 mv -- "$out/src.zip" "$renamed"
54 mv -- "$unpackDir" "$out"
69 ] ++ lib.optionals (lib.hasPrefix "8u" jdk.version) [ libXt ];
77 # clear whitespace from makefiles (since we match on EOL later)
78 sed -i 's/ \+$//' ./*.mak
83 makefile-sed = builtins.toFile "swt-makefile.sed" ''
84 # fix pkg-config invocations in CFLAGS/LIBS pairs.
87 # FOOCFLAGS = `pkg-config --cflags `foo bar`
88 # FOOLIBS = `pkg-config --libs-only-L foo` -lbaz
90 # FOOCFLAGS = `pkg-config --cflags foo bar`
91 # FOOLIBS = `pkg-config --libs foo bar`
93 # the latter works more consistently.
94 /^[A-Z0-9_]\+CFLAGS = `pkg-config --cflags [^`]\+`$/ {
97 ^\([A-Z0-9_]\+\)CFLAGS = `pkg-config --cflags \(.\+\)`\
98 \1LIBS = `pkg-config --libs-only-L .\+$''}/${''
99 \1CFLAGS = `pkg-config --cflags \2`\
100 \1LIBS = `pkg-config --libs \2`''}/
102 # fix WebKit libs not being there
103 s/\$(WEBKIT_LIB) \$(WEBKIT_OBJECTS)$/\0 `pkg-config --libs glib-2.0`/g
107 declare -a makefiles=(./*.mak)
108 sed -i -f ${makefile-sed} "''${makefiles[@]}"
109 # assign Makefile variables eagerly & change backticks to `$(shell …)`
110 sed -i -e 's/ = `\([^`]\+\)`/ := $(shell \1)/' \
111 -e 's/`\([^`]\+\)`/$(shell \1)/' \
118 export JAVA_HOME=${jdk}
123 find org/ -name '*.java' -type f -exec javac -d out/ {} +
131 if [[ -n "$prefix" ]]; then
132 install -d -- "$prefix"
135 install -Dm 644 -t "$out/lib" -- *.so
137 install -d -- "$out/jars"
138 install -m 644 -t out -- version.txt
139 (cd out && jar -c *) > "$out/jars/swt.jar"
145 homepage = "https://www.eclipse.org/swt/";
147 A widget toolkit for Java to access the user-interface facilities of
148 the operating systems on which it is implemented.
150 license = lib.licenses.epl10;
152 platforms = lib.platforms.linux;