about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorArnout Engelen <arnout@bzzt.net>2021-02-21 15:57:19 +0100
committerArnout Engelen <arnout@bzzt.net>2021-02-21 21:13:01 +0100
commitb47bb058b814c7aae264e3b445b0711e53a3e790 (patch)
tree195537008d2e9bb106befc8dc88848f9d6a5b7e4 /pkgs
parent9816b99e71c3504b0b4c1f8b2e004148460029d4 (diff)
sweethome3d: run using the default jre
The default jdk was updated, but various applications were kept at
jdk8 so they could be updated one-by-one, testing that the update
does not break those packages.

I tested sweethome3d, and found out that while it runs fine with
the default jre, the build script of the current release does not
work on JDK9 or higher. This has already been fixed on trunk but
not yet released. Since this is specific to this package, I
moved the selection of 'jdk8' to inside the packages' .nix, with a
note so we don't forget to update to the default jdk as well when
a new version of sweethome3d is released.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/misc/sweethome3d/default.nix31
-rw-r--r--pkgs/applications/misc/sweethome3d/editors.nix26
-rw-r--r--pkgs/top-level/all-packages.nix16
3 files changed, 54 insertions, 19 deletions
diff --git a/pkgs/applications/misc/sweethome3d/default.nix b/pkgs/applications/misc/sweethome3d/default.nix
index afbf5b364ed4f..2f0a58b8e4253 100644
--- a/pkgs/applications/misc/sweethome3d/default.nix
+++ b/pkgs/applications/misc/sweethome3d/default.nix
@@ -1,5 +1,20 @@
-{ lib, stdenv, fetchurl, fetchsvn, makeWrapper, makeDesktopItem, jdk, jre, ant
-, gtk3, gsettings-desktop-schemas, p7zip, libXxf86vm }:
+{ lib
+, stdenv
+, fetchurl
+, fetchsvn
+, makeWrapper
+, makeDesktopItem
+# sweethome3d 6.4.2 does not yet build with jdk 9 and later.
+# this is fixed on trunk (7699?) but let's build with jdk8 until then.
+, jdk8
+# it can run on the latest stable jre fine though
+, jre
+, ant
+, gtk3
+, gsettings-desktop-schemas
+, p7zip
+, libXxf86vm
+}:
 
 let
 
@@ -27,23 +42,29 @@ let
       categories = "Graphics;2DGraphics;3DGraphics;";
     };
 
-    patchPhase = ''
+    postPatch = ''
       patchelf --set-rpath ${libXxf86vm}/lib lib/java3d-1.6/linux/amd64/libnativewindow_awt.so
       patchelf --set-rpath ${libXxf86vm}/lib lib/java3d-1.6/linux/amd64/libnativewindow_x11.so
       patchelf --set-rpath ${libXxf86vm}/lib lib/java3d-1.6/linux/i586/libnativewindow_awt.so
       patchelf --set-rpath ${libXxf86vm}/lib lib/java3d-1.6/linux/i586/libnativewindow_x11.so
     '';
 
-    buildInputs = [ ant jdk makeWrapper p7zip gtk3 gsettings-desktop-schemas ];
+    buildInputs = [ ant jdk8 makeWrapper p7zip gtk3 gsettings-desktop-schemas ];
 
     buildPhase = ''
+      runHook preBuild
+
       ant furniture textures help
       mkdir -p $out/share/{java,applications}
       mv "build/"*.jar $out/share/java/.
       ant
+
+      runHook postBuild
     '';
 
     installPhase = ''
+      runHook preInstall
+
       mkdir -p $out/bin
       cp install/${module}-${version}.jar $out/share/java/.
 
@@ -59,6 +80,8 @@ let
         --set MESA_GL_VERSION_OVERRIDE 2.1 \
         --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gtk3.out}/share:${gsettings-desktop-schemas}/share:$out/share:$GSETTINGS_SCHEMAS_PATH" \
         --add-flags "-Dsun.java2d.opengl=true -jar $out/share/java/${module}-${version}.jar -cp $out/share/java/Furniture.jar:$out/share/java/Textures.jar:$out/share/java/Help.jar -d${toString stdenv.hostPlatform.parsed.cpu.bits}"
+
+      runHook postInstall
     '';
 
     dontStrip = true;
diff --git a/pkgs/applications/misc/sweethome3d/editors.nix b/pkgs/applications/misc/sweethome3d/editors.nix
index 08bc5b90fd9ca..a008b49ba7183 100644
--- a/pkgs/applications/misc/sweethome3d/editors.nix
+++ b/pkgs/applications/misc/sweethome3d/editors.nix
@@ -1,5 +1,17 @@
-{ lib, stdenv, fetchcvs, makeWrapper, makeDesktopItem, jdk, jre, ant
-, gtk3, gsettings-desktop-schemas, sweethome3dApp }:
+{ lib
+, stdenv
+, fetchcvs
+, makeWrapper
+, makeDesktopItem
+# sweethome3d 6.4.2 does not yet build with jdk 9 and later.
+# this is fixed on trunk (7699?) but let's build with jdk8 until then.
+, jdk8
+# it can run on the latest stable jre fine though
+, jre
+, ant
+, gtk3
+, gsettings-desktop-schemas
+, sweethome3dApp }:
 
 let
 
@@ -23,15 +35,19 @@ let
       categories = "Graphics;2DGraphics;3DGraphics;";
     };
 
-    buildInputs = [ ant jre jdk makeWrapper gtk3 gsettings-desktop-schemas ];
+    buildInputs = [ ant jdk8 makeWrapper gtk3 gsettings-desktop-schemas ];
 
-    patchPhase = ''
+    postPatch = ''
       sed -i -e 's,../SweetHome3D,${application.src},g' build.xml
       sed -i -e 's,lib/macosx/java3d-1.6/jogl-all.jar,lib/java3d-1.6/jogl-all.jar,g' build.xml
     '';
 
     buildPhase = ''
-      ant -lib ${application.src}/libtest -lib ${application.src}/lib -lib ${jdk}/lib
+      runHook preBuild
+
+      ant -lib ${application.src}/libtest -lib ${application.src}/lib -lib ${jdk8}/lib
+
+      runHook postBuild
     '';
 
     installPhase = ''
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 9edb546f79694..1c5b8c879b7dd 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -24948,16 +24948,12 @@ in
 
   linuxstopmotion = libsForQt5.callPackage ../applications/video/linuxstopmotion { };
 
-  sweethome3d = recurseIntoAttrs (  (callPackage ../applications/misc/sweethome3d {
-    jre = jre8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731
-    jdk = jdk8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731
-  })
-                                 // (callPackage ../applications/misc/sweethome3d/editors.nix {
-                                      jre = jre8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731
-                                      jdk = jdk8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731
-                                      sweethome3dApp = sweethome3d.application;
-                                    })
-                                 );
+  sweethome3d = recurseIntoAttrs (
+    (callPackage ../applications/misc/sweethome3d { }) //
+    (callPackage ../applications/misc/sweethome3d/editors.nix {
+      sweethome3dApp = sweethome3d.application;
+    })
+  );
 
   swingsane = callPackage ../applications/graphics/swingsane { };