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.
This commit is contained in:
Arnout Engelen 2021-02-21 15:57:19 +01:00
parent 9816b99e71
commit b47bb058b8
No known key found for this signature in database
GPG Key ID: 061107B0F74A6DAA
3 changed files with 54 additions and 19 deletions

View File

@ -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;

View File

@ -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 = ''

View File

@ -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 { };