diff options
author | Alyssa Ross <hi@alyssa.is> | 2022-01-03 23:55:00 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2022-02-19 11:03:39 +0000 |
commit | f4cf97a04cd5d0b86aa46baec9fb228a8f671c03 (patch) | |
tree | 28192415ff39a661d0001563bf81cc93fa25d16d /nixpkgs/pkgs/development/libraries/java/swt | |
parent | f8422837c9bde058e8f2de37702e7e94b2226040 (diff) | |
parent | 18c84ea816348e2a098390101b92d1e39a9dbd45 (diff) | |
download | nixlib-f4cf97a04cd5d0b86aa46baec9fb228a8f671c03.tar nixlib-f4cf97a04cd5d0b86aa46baec9fb228a8f671c03.tar.gz nixlib-f4cf97a04cd5d0b86aa46baec9fb228a8f671c03.tar.bz2 nixlib-f4cf97a04cd5d0b86aa46baec9fb228a8f671c03.tar.lz nixlib-f4cf97a04cd5d0b86aa46baec9fb228a8f671c03.tar.xz nixlib-f4cf97a04cd5d0b86aa46baec9fb228a8f671c03.tar.zst nixlib-f4cf97a04cd5d0b86aa46baec9fb228a8f671c03.zip |
Merge commit '18c84ea816348e2a098390101b92d1e39a9dbd45'
Conflicts: nixpkgs/nixos/modules/misc/documentation.nix nixpkgs/pkgs/applications/networking/browsers/firefox/packages.nix nixpkgs/pkgs/applications/window-managers/sway/default.nix nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix nixpkgs/pkgs/development/go-modules/generic/default.nix nixpkgs/pkgs/development/interpreters/ruby/default.nix nixpkgs/pkgs/development/interpreters/ruby/patchsets.nix nixpkgs/pkgs/development/libraries/boehm-gc/7.6.6.nix nixpkgs/pkgs/development/python-modules/django-mailman3/default.nix nixpkgs/pkgs/servers/mail/mailman/web.nix nixpkgs/pkgs/top-level/aliases.nix nixpkgs/pkgs/top-level/all-packages.nix nixpkgs/pkgs/top-level/impure.nix
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/java/swt')
3 files changed, 138 insertions, 31 deletions
diff --git a/nixpkgs/pkgs/development/libraries/java/swt/awt-libs.patch b/nixpkgs/pkgs/development/libraries/java/swt/awt-libs.patch new file mode 100644 index 000000000000..6c3ff53b7983 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/java/swt/awt-libs.patch @@ -0,0 +1,8 @@ +--- a/make_linux.mak ++++ b/make_linux.mak +@@ -63,4 +63,4 @@ + + AWT_LFLAGS = -shared ${SWT_LFLAGS} +-AWT_LIBS = -L$(AWT_LIB_PATH) -ljawt ++AWT_LIBS = `pkg-config --libs x11` -L$(AWT_LIB_PATH) -ljawt + diff --git a/nixpkgs/pkgs/development/libraries/java/swt/default.nix b/nixpkgs/pkgs/development/libraries/java/swt/default.nix index bf35490f9a88..b85b348a9640 100644 --- a/nixpkgs/pkgs/development/libraries/java/swt/default.nix +++ b/nixpkgs/pkgs/development/libraries/java/swt/default.nix @@ -1,73 +1,158 @@ -{ stdenv, lib, fetchurl, unzip, jdk, pkg-config, gtk2 -, libXt, libXtst, libXi, libGLU, libGL, webkitgtk, libsoup, xorg -, pango, gdk-pixbuf, glib +{ lib +, stdenv +, canonicalize-jars-hook +, fetchzip +, pkg-config +, atk +, glib +, gtk2 +, jdk +, libGL +, libGLU +, libXt +, libXtst +, gnome2 }: let platformMap = { x86_64-linux = { platform = "gtk-linux-x86_64"; - sha256 = "1qq0pjll6030v4ml0hifcaaik7sx3fl7ghybfdw95vsvxafwp2ff"; }; + sha256 = "17frac2nsx22hfa72264as31rn35hfh9gfgy0n6wvc3knl5d2716"; }; i686-linux = { platform = "gtk-linux-x86"; - sha256 = "03mhzraikcs4fsz7d3h5af9pw1bbcfd6dglsvbk2ciwimy9zj30q"; }; + sha256 = "13ca17rga9yvdshqvh0sfzarmdcl4wv4pid0ls7v35v4844zbc8b"; }; x86_64-darwin = { platform = "cocoa-macosx-x86_64"; - sha256 = "00k1mfbncvyh8klgmk0891w8jwnd5niqb16j1j8yacrm2smmlb05"; }; + sha256 = "0wjyxlw7i9zd2m8syd6k1q85fj8pzhxlfsrl8fpgsj37p698bd0a"; }; }; - metadata = assert platformMap ? ${stdenv.hostPlatform.system}; platformMap.${stdenv.hostPlatform.system}; - + metadata = assert platformMap ? ${stdenv.hostPlatform.system}; + platformMap.${stdenv.hostPlatform.system}; in stdenv.mkDerivation rec { + pname = "swt"; version = "4.5"; fullVersion = "${version}-201506032000"; - pname = "swt"; 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. - src = fetchurl { - url = "http://archive.eclipse.org/eclipse/downloads/drops4/R-${fullVersion}/${pname}-${version}-${metadata.platform}.zip"; - sha256 = metadata.sha256; + src = fetchzip { + url = "https://archive.eclipse.org/eclipse/downloads/drops4/" + + "R-${fullVersion}/${pname}-${version}-${metadata.platform}.zip"; + inherit (metadata) sha256; + stripRoot = false; + extraPostFetch = '' + mkdir "$unpackDir" + cd "$unpackDir" + + renamed="$TMPDIR/src.zip" + mv "$out/src.zip" "$renamed" + unpackFile "$renamed" + rm -r "$out" + + mv "$unpackDir" "$out" + ''; }; - sourceRoot = "."; + 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 ]; - nativeBuildInputs = [ unzip pkg-config ]; - buildInputs = [ jdk gtk2 libXt libXtst libXi libGLU libGL webkitgtk libsoup ]; + prePatch = '' + # clear whitespace from makefiles (since we match on EOL later) + sed -i 's/ \+$//' ./*.mak + ''; - 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"; + 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[@]}" + ''; buildPhase = '' - unzip src.zip -d src + runHook preBuild - cd src - sed -i "s#^LFLAGS =#LFLAGS = $NIX_LFLAGS #g" *.mak export JAVA_HOME=${jdk} - sh ./build.sh + ./build.sh mkdir out - javac -d out/ $(find org/ -name "*.java") + find org/ -name '*.java' -type f -exec javac -d out/ {} + + + runHook postBuild ''; installPhase = '' - mkdir -p $out/lib - cp *.so $out/lib + 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" - mkdir -p $out/jars - cp version.txt out/ - cd out && jar -c * > $out/jars/swt.jar + runHook postInstall ''; meta = with 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"; + 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. + ''; license = licenses.epl10; - maintainers = with maintainers; [ pSub ]; - platforms = with platforms; linux; + maintainers = with maintainers; [ bb010g ]; + platforms = platforms.linux; }; } diff --git a/nixpkgs/pkgs/development/libraries/java/swt/gtk-libs.patch b/nixpkgs/pkgs/development/libraries/java/swt/gtk-libs.patch new file mode 100644 index 000000000000..cd13082b5df7 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/java/swt/gtk-libs.patch @@ -0,0 +1,14 @@ +--- a/make_linux.mak ++++ b/make_linux.mak +@@ -53,9 +53,4 @@ + +-# Do not use pkg-config to get libs because it includes unnecessary dependencies (i.e. pangoxft-1.0) +-GTKCFLAGS = `pkg-config --cflags gtk+-$(GTK_VERSION) gtk+-unix-print-$(GTK_VERSION)` ++GTKCFLAGS = `pkg-config --cflags gtk+-$(GTK_VERSION) gthread-2.0 gtk+-unix-print-$(GTK_VERSION) x11 xtst` ++GTKLIBS = `pkg-config --libs gtk+-$(GTK_VERSION) gthread-2.0 gtk+-unix-print-$(GTK_VERSION) x11 xtst` +-ifeq ($(GTK_VERSION), 3.0) +-GTKLIBS = `pkg-config --libs-only-L gtk+-$(GTK_VERSION) gthread-2.0` $(XLIB64) -L/usr/X11R6/lib -lgtk-3 -lgdk-3 -lcairo -lgthread-2.0 -lXtst +-else +-GTKLIBS = `pkg-config --libs-only-L gtk+-$(GTK_VERSION) gthread-2.0` $(XLIB64) -L/usr/X11R6/lib -lgtk-x11-$(GTK_VERSION) -lgthread-2.0 -lXtst +-endif + |