nixpkgs/pkgs/applications/misc/sweethome3d/editors.nix
2014-10-05 15:59:12 +02:00

90 lines
2.7 KiB
Nix

{ stdenv, fetchurl, fetchcvs, makeWrapper, makeDesktopItem, jdk, jre, ant
, p7zip, sweethome3dApp }:
let
sweetExec = with stdenv.lib;
m: "sweethome3d-"
+ removeSuffix "libraryeditor" (toLower m)
+ "-editor";
sweetName = m: v: sweetExec m + "-" + v;
mkEditorProject =
{ name, module, version, src, license, description }:
stdenv.mkDerivation rec {
application = sweethome3dApp;
inherit name module version src description;
exec = sweetExec module;
editorItem = makeDesktopItem {
inherit name exec;
comment = description;
desktopName = name;
genericName = "Computer Aided (Interior) Design";
categories = "Application;CAD;";
};
buildInputs = [ ant jre jdk makeWrapper ];
patchPhase = ''
sed -i -e 's,../SweetHome3D,${application.src},g' build.xml
'';
buildPhase = ''
ant -lib ${application.src}/libtest -lib ${application.src}/lib -lib ${jdk}/lib
'';
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 ${jre}/bin/java $out/bin/$exec \
--add-flags "-jar $out/share/java/${module}-${version}.jar ${if stdenv.system == "x86_64-linux" then "-d64" else "-d32"}"
'';
dontStrip = true;
meta = {
homepage = "http://www.sweethome3d.com/index.jsp";
inherit description;
inherit license;
maintainers = [ stdenv.lib.maintainers.edwtjo ];
platforms = stdenv.lib.platforms.linux;
};
};
d2u = stdenv.lib.replaceChars ["."] ["_"];
in rec {
textures-editor = mkEditorProject rec {
version = "1.4";
module = "TexturesLibraryEditor";
name = sweetName module version;
description = "Easily create SH3T files and edit the properties of the texture images it contain";
license = stdenv.lib.licenses.gpl2Plus;
src = fetchcvs {
cvsRoot = ":pserver:anonymous@sweethome3d.cvs.sourceforge.net:/cvsroot/sweethome3d";
sha256 = "1j1ygb32dca48hng5bsna9f84vyin5qc3ds44xi39057izmw8499";
module = module;
tag = "V_" + d2u version;
};
};
furniture-editor = mkEditorProject rec {
version = "1.14";
module = "FurnitureLibraryEditor";
name = sweetName module version;
description = "Quickly create SH3F files and edit the properties of the 3D models it contain";
license = stdenv.lib.licenses.gpl2;
src = fetchcvs {
cvsRoot = ":pserver:anonymous@sweethome3d.cvs.sourceforge.net:/cvsroot/sweethome3d";
sha256 = "0rdcd8vjbcv9jdms2xr3y7ykm2a9bkmwj4y7ybk9zcldayqsgn6z";
module = module;
tag = "V_" + d2u version;
};
};
}