nixpkgs/pkgs/applications/misc/sweethome3d/editors.nix
Dmitry Ivankov 9236fe835f sweethome3d: 6.4.2 -> 6.5.2, also bump editors, use fetchurl and fix build
fixes build failures
https://hydra.nixos.org/build/142550788/nixlog/2
https://hydra.nixos.org/build/142549864/nixlog/2

Replaces fetchsvn/fetchcvs with fetchurl because fetchcvs wasn't able to fetch newer versions.

jre8 seems to be required due to InaccessibleObjectException/IllegalAccessException on app start on jdk9+

ZHF: #122042
2021-05-13 09:46:22 -07:00

115 lines
3.2 KiB
Nix

{ lib
, stdenv
, fetchurl
, makeWrapper
, makeDesktopItem
# sweethome3d 6.5.2 does not yet fully build&run with jdk 9 and later?
, jdk8
, jre8
, ant
, gtk3
, gsettings-desktop-schemas
, sweethome3dApp
, unzip
}:
let
sweetExec = with lib;
m: "sweethome3d-"
+ removeSuffix "libraryeditor" (toLower m)
+ "-editor";
applicationSrc = stdenv.mkDerivation {
name = "application-src";
src = sweethome3dApp.src;
nativeBuildInputs = [ unzip ];
buildPhase = "";
installPhase = "cp -r . $out";
};
mkEditorProject =
{ pname, module, version, src, license, description, desktopName }:
stdenv.mkDerivation rec {
application = sweethome3dApp;
inherit pname module version src description;
exec = sweetExec module;
editorItem = makeDesktopItem {
inherit exec desktopName;
name = pname;
comment = description;
genericName = "Computer Aided (Interior) Design";
categories = "Graphics;2DGraphics;3DGraphics;";
};
nativeBuildInputs = [ makeWrapper unzip ];
buildInputs = [ ant jre8 jdk8 gtk3 gsettings-desktop-schemas ];
postPatch = ''
sed -i -e 's,../SweetHome3D,${applicationSrc},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 = ''
runHook preBuild
ant -lib ${applicationSrc}/libtest -lib ${applicationSrc}/lib -lib ${jdk8}/lib
runHook postBuild
'';
installPhase = ''
mkdir -p $out/bin
mkdir -p $out/share/{java,applications}
cp ${module}-${version}.jar $out/share/java/.
cp "${editorItem}/share/applications/"* $out/share/applications
makeWrapper ${jre8}/bin/java $out/bin/$exec \
--prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gtk3.out}/share:${gsettings-desktop-schemas}/share:$out/share:$GSETTINGS_SCHEMAS_PATH" \
--add-flags "-jar $out/share/java/${module}-${version}.jar -d${toString stdenv.hostPlatform.parsed.cpu.bits}"
'';
dontStrip = true;
meta = {
homepage = "http://www.sweethome3d.com/index.jsp";
inherit description;
inherit license;
maintainers = [ lib.maintainers.edwtjo ];
platforms = lib.platforms.linux;
};
};
d2u = lib.replaceChars ["."] ["_"];
in {
textures-editor = mkEditorProject rec {
version = "1.7";
module = "TexturesLibraryEditor";
pname = module;
description = "Easily create SH3T files and edit the properties of the texture images it contain";
license = lib.licenses.gpl2Plus;
src = fetchurl {
url = "mirror://sourceforge/sweethome3d/${module}-${version}-src.zip";
sha256 = "03vb9y645qzffxxdhgbjb0d98k3lafxckg2vh2s86j62b6357d0h";
};
desktopName = "Sweet Home 3D - Textures Library Editor";
};
furniture-editor = mkEditorProject rec {
version = "1.27";
module = "FurnitureLibraryEditor";
pname = module;
description = "Quickly create SH3F files and edit the properties of the 3D models it contain";
license = lib.licenses.gpl2;
src = fetchurl {
url = "mirror://sourceforge/sweethome3d/${module}-${version}-src.zip";
sha256 = "1zxbcn9awgax8lalzkc05f5yfwbgnrayc17fkyv5i19j4qb3r2a0";
};
desktopName = "Sweet Home 3D - Furniture Library Editor";
};
}