2018-12-30 02:29:37 +01:00
|
|
|
{ lib, stdenv, fetchurl, fetchsvn, makeWrapper, makeDesktopItem, jdk, jre, ant
|
2018-02-25 03:23:58 +01:00
|
|
|
, gtk3, gsettings-desktop-schemas, p7zip, libXxf86vm }:
|
2014-04-15 14:12:44 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
|
2016-03-03 06:22:46 +01:00
|
|
|
# TODO: Should we move this to `lib`? Seems like its would be useful in many cases.
|
2017-02-12 20:22:35 +01:00
|
|
|
extensionOf = filePath:
|
|
|
|
lib.concatStringsSep "." (lib.tail (lib.splitString "." (builtins.baseNameOf filePath)));
|
2016-03-03 06:22:46 +01:00
|
|
|
|
|
|
|
installIcons = iconName: icons: lib.concatStringsSep "\n" (lib.mapAttrsToList (size: iconFile: ''
|
|
|
|
mkdir -p "$out/share/icons/hicolor/${size}/apps"
|
|
|
|
ln -s -T "${iconFile}" "$out/share/icons/hicolor/${size}/apps/${iconName}.${extensionOf iconFile}"
|
|
|
|
'') icons);
|
|
|
|
|
2014-04-15 14:12:44 +02:00
|
|
|
mkSweetHome3D =
|
2019-11-24 18:22:28 +01:00
|
|
|
{ pname, module, version, src, license, description, desktopName, icons }:
|
2014-04-15 14:12:44 +02:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-11-24 18:22:28 +01:00
|
|
|
inherit pname version src description;
|
2021-01-15 06:42:41 +01:00
|
|
|
exec = lib.toLower module;
|
2014-04-15 14:12:44 +02:00
|
|
|
sweethome3dItem = makeDesktopItem {
|
2016-03-03 06:22:46 +01:00
|
|
|
inherit exec desktopName;
|
2019-11-24 18:22:28 +01:00
|
|
|
name = pname;
|
|
|
|
icon = pname;
|
2014-04-15 14:12:44 +02:00
|
|
|
comment = description;
|
|
|
|
genericName = "Computer Aided (Interior) Design";
|
2020-06-25 04:18:37 +02:00
|
|
|
categories = "Graphics;2DGraphics;3DGraphics;";
|
2014-04-15 14:12:44 +02:00
|
|
|
};
|
|
|
|
|
2017-02-17 18:59:01 +01:00
|
|
|
patchPhase = ''
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2020-07-13 18:42:52 +02:00
|
|
|
buildInputs = [ ant jdk makeWrapper p7zip gtk3 gsettings-desktop-schemas ];
|
2014-04-15 14:12:44 +02:00
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
ant furniture textures help
|
|
|
|
mkdir -p $out/share/{java,applications}
|
2015-03-18 12:52:32 +01:00
|
|
|
mv "build/"*.jar $out/share/java/.
|
2014-04-15 14:12:44 +02:00
|
|
|
ant
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp install/${module}-${version}.jar $out/share/java/.
|
2016-03-03 06:22:46 +01:00
|
|
|
|
2019-11-24 18:22:28 +01:00
|
|
|
${installIcons pname icons}
|
2016-03-03 06:22:46 +01:00
|
|
|
|
2015-03-18 12:52:32 +01:00
|
|
|
cp "${sweethome3dItem}/share/applications/"* $out/share/applications
|
2016-03-03 06:22:46 +01:00
|
|
|
|
2020-09-04 17:25:51 +02:00
|
|
|
# MESA_GL_VERSION_OVERRIDE is needed since the update from MESA 19.3.3 to 20.0.2:
|
|
|
|
# without it a "Profiles [GL4bc, GL3bc, GL2, GLES1] not available on device null"
|
|
|
|
# exception is thrown on startup.
|
|
|
|
# https://discourse.nixos.org/t/glx-not-recognised-after-mesa-update/6753
|
2014-04-15 14:12:44 +02:00
|
|
|
makeWrapper ${jre}/bin/java $out/bin/$exec \
|
2020-09-04 17:25:51 +02:00
|
|
|
--set MESA_GL_VERSION_OVERRIDE 2.1 \
|
2018-02-25 03:23:58 +01:00
|
|
|
--prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gtk3.out}/share:${gsettings-desktop-schemas}/share:$out/share:$GSETTINGS_SCHEMAS_PATH" \
|
2020-07-13 18:42:52 +02:00
|
|
|
--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}"
|
2014-04-15 14:12:44 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
dontStrip = true;
|
|
|
|
|
|
|
|
meta = {
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "http://www.sweethome3d.com/index.jsp";
|
2014-04-15 14:12:44 +02:00
|
|
|
inherit description;
|
|
|
|
inherit license;
|
2021-01-15 06:42:41 +01:00
|
|
|
maintainers = [ lib.maintainers.edwtjo ];
|
|
|
|
platforms = lib.platforms.linux;
|
2014-04-15 14:12:44 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-01-15 06:42:41 +01:00
|
|
|
d2u = lib.replaceChars ["."] ["_"];
|
2014-04-15 14:12:44 +02:00
|
|
|
|
2019-08-13 23:52:01 +02:00
|
|
|
in {
|
2014-04-15 14:12:44 +02:00
|
|
|
|
|
|
|
application = mkSweetHome3D rec {
|
2021-01-15 06:42:41 +01:00
|
|
|
pname = lib.toLower module + "-application";
|
2020-09-04 17:25:51 +02:00
|
|
|
version = "6.4.2";
|
2014-04-15 14:12:44 +02:00
|
|
|
module = "SweetHome3D";
|
2014-06-15 13:49:18 +02:00
|
|
|
description = "Design and visualize your future home";
|
2021-01-15 06:42:41 +01:00
|
|
|
license = lib.licenses.gpl2Plus;
|
2018-12-30 02:29:37 +01:00
|
|
|
src = fetchsvn {
|
|
|
|
url = "https://svn.code.sf.net/p/sweethome3d/code/tags/V_" + d2u version + "/SweetHome3D/";
|
2020-09-04 17:25:51 +02:00
|
|
|
sha256 = "13rczayakwb5246hqnp8lnw61p0p7ywr2294bnlp4zwsrz1in9z4";
|
|
|
|
rev = "7504";
|
2014-04-15 14:12:44 +02:00
|
|
|
};
|
2016-03-03 06:22:46 +01:00
|
|
|
desktopName = "Sweet Home 3D";
|
|
|
|
icons = {
|
|
|
|
"32x32" = fetchurl {
|
|
|
|
url = "http://sweethome3d.cvs.sourceforge.net/viewvc/sweethome3d/SweetHome3D/deploy/SweetHome3DIcon32x32.png";
|
|
|
|
sha256 = "1r2fhfg27mx00nfv0qj66rhf719s2g1vhdis7bdc9mqk9x0mb0ir";
|
|
|
|
};
|
|
|
|
"48x48" = fetchurl {
|
|
|
|
url = "http://sweethome3d.cvs.sourceforge.net/viewvc/sweethome3d/SweetHome3D/deploy/SweetHome3DIcon48x48.png";
|
|
|
|
sha256 = "1ap6d75dyqqvx21wddvn8vw2apq3v803vmbxdriwd0dw9rq3zn4g";
|
|
|
|
};
|
2014-10-07 08:45:26 +02:00
|
|
|
};
|
2014-04-15 14:12:44 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|