2018-12-30 01:29:37 +00:00
|
|
|
{ lib, stdenv, fetchurl, fetchsvn, makeWrapper, makeDesktopItem, jdk, jre, ant
|
2018-02-25 02:23:58 +00:00
|
|
|
, gtk3, gsettings-desktop-schemas, p7zip, libXxf86vm }:
|
2014-04-15 13:12:44 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
|
2016-03-03 05:22:46 +00:00
|
|
|
getDesktopFileName = drvName: (builtins.parseDrvName drvName).name;
|
|
|
|
|
|
|
|
# TODO: Should we move this to `lib`? Seems like its would be useful in many cases.
|
2017-02-12 19:22:35 +00:00
|
|
|
extensionOf = filePath:
|
|
|
|
lib.concatStringsSep "." (lib.tail (lib.splitString "." (builtins.baseNameOf filePath)));
|
2016-03-03 05:22:46 +00: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 13:12:44 +01:00
|
|
|
mkSweetHome3D =
|
2016-03-03 05:22:46 +00:00
|
|
|
{ name, module, version, src, license, description, desktopName, icons }:
|
2014-04-15 13:12:44 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2016-03-03 05:22:46 +00:00
|
|
|
inherit name version src description;
|
2014-04-15 13:12:44 +01:00
|
|
|
exec = stdenv.lib.toLower module;
|
|
|
|
sweethome3dItem = makeDesktopItem {
|
2016-03-03 05:22:46 +00:00
|
|
|
inherit exec desktopName;
|
|
|
|
name = getDesktopFileName name;
|
|
|
|
icon = getDesktopFileName name;
|
2014-04-15 13:12:44 +01:00
|
|
|
comment = description;
|
|
|
|
genericName = "Computer Aided (Interior) Design";
|
2016-03-03 05:22:46 +00:00
|
|
|
categories = "Application;Graphics;2DGraphics;3DGraphics;";
|
2014-04-15 13:12:44 +01:00
|
|
|
};
|
|
|
|
|
2017-02-17 17:59:01 +00: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
|
|
|
|
'';
|
|
|
|
|
2018-02-25 02:23:58 +00:00
|
|
|
buildInputs = [ ant jdk jre makeWrapper p7zip gtk3 gsettings-desktop-schemas ];
|
2014-04-15 13:12:44 +01:00
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
ant furniture textures help
|
|
|
|
mkdir -p $out/share/{java,applications}
|
2015-03-18 11:52:32 +00:00
|
|
|
mv "build/"*.jar $out/share/java/.
|
2014-04-15 13:12:44 +01:00
|
|
|
ant
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp install/${module}-${version}.jar $out/share/java/.
|
2016-03-03 05:22:46 +00:00
|
|
|
|
|
|
|
${installIcons (getDesktopFileName name) icons}
|
|
|
|
|
2015-03-18 11:52:32 +00:00
|
|
|
cp "${sweethome3dItem}/share/applications/"* $out/share/applications
|
2016-03-03 05:22:46 +00:00
|
|
|
|
2014-04-15 13:12:44 +01:00
|
|
|
makeWrapper ${jre}/bin/java $out/bin/$exec \
|
2018-02-25 02:23:58 +00:00
|
|
|
--prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gtk3.out}/share:${gsettings-desktop-schemas}/share:$out/share:$GSETTINGS_SCHEMAS_PATH" \
|
2018-08-20 20:11:29 +01:00
|
|
|
--add-flags "-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 13:12:44 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
dontStrip = true;
|
|
|
|
|
|
|
|
meta = {
|
2017-08-01 21:03:30 +01:00
|
|
|
homepage = http://www.sweethome3d.com/index.jsp;
|
2014-04-15 13:12:44 +01:00
|
|
|
inherit description;
|
|
|
|
inherit license;
|
|
|
|
maintainers = [ stdenv.lib.maintainers.edwtjo ];
|
|
|
|
platforms = stdenv.lib.platforms.linux;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
d2u = stdenv.lib.replaceChars ["."] ["_"];
|
|
|
|
|
|
|
|
in rec {
|
|
|
|
|
|
|
|
application = mkSweetHome3D rec {
|
2019-08-20 08:38:18 +01:00
|
|
|
version = "6.2";
|
2014-04-15 13:12:44 +01:00
|
|
|
module = "SweetHome3D";
|
|
|
|
name = stdenv.lib.toLower module + "-application-" + version;
|
2014-06-15 12:49:18 +01:00
|
|
|
description = "Design and visualize your future home";
|
2014-04-15 13:12:44 +01:00
|
|
|
license = stdenv.lib.licenses.gpl2Plus;
|
2018-12-30 01:29:37 +00:00
|
|
|
src = fetchsvn {
|
|
|
|
url = "https://svn.code.sf.net/p/sweethome3d/code/tags/V_" + d2u version + "/SweetHome3D/";
|
2019-08-20 08:38:18 +01:00
|
|
|
sha256 = "0a514a1zmipykvawil46v826ivkw9c00vdkyggyl6m41giay15zf";
|
|
|
|
rev = "6822";
|
2014-04-15 13:12:44 +01:00
|
|
|
};
|
2016-03-03 05:22:46 +00: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 07:45:26 +01:00
|
|
|
};
|
2014-04-15 13:12:44 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|