lol
1{ stdenv, fetchurl, fetchcvs, makeWrapper, makeDesktopItem, jdk, jre, ant
2, gtk3, gsettings_desktop_schemas, p7zip, sweethome3dApp }:
3
4let
5
6 sweetExec = with stdenv.lib;
7 m: "sweethome3d-"
8 + removeSuffix "libraryeditor" (toLower m)
9 + "-editor";
10 sweetName = m: v: sweetExec m + "-" + v;
11
12 mkEditorProject =
13 { name, module, version, src, license, description }:
14
15 stdenv.mkDerivation rec {
16 application = sweethome3dApp;
17 inherit name module version src description;
18 exec = sweetExec module;
19 editorItem = makeDesktopItem {
20 inherit name exec;
21 comment = description;
22 desktopName = name;
23 genericName = "Computer Aided (Interior) Design";
24 categories = "Application;CAD;";
25 };
26
27 buildInputs = [ ant jre jdk makeWrapper gtk3 gsettings_desktop_schemas ];
28
29 patchPhase = ''
30 sed -i -e 's,../SweetHome3D,${application.src},g' build.xml
31 '';
32
33 buildPhase = ''
34 ant -lib ${application.src}/libtest -lib ${application.src}/lib -lib ${jdk}/lib
35 '';
36
37 installPhase = ''
38 mkdir -p $out/bin
39 mkdir -p $out/share/{java,applications}
40 cp ${module}-${version}.jar $out/share/java/.
41 cp "${editorItem}/share/applications/"* $out/share/applications
42 makeWrapper ${jre}/bin/java $out/bin/$exec \
43 --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gtk3}/share:${gsettings_desktop_schemas}/share:$out/share:$GSETTINGS_SCHEMAS_PATH" \
44 --add-flags "-jar $out/share/java/${module}-${version}.jar ${if stdenv.system == "x86_64-linux" then "-d64" else "-d32"}"
45 '';
46
47 dontStrip = true;
48
49 meta = {
50 homepage = "http://www.sweethome3d.com/index.jsp";
51 inherit description;
52 inherit license;
53 maintainers = [ stdenv.lib.maintainers.edwtjo ];
54 platforms = stdenv.lib.platforms.linux;
55 };
56
57 };
58
59 d2u = stdenv.lib.replaceChars ["."] ["_"];
60
61in {
62
63 textures-editor = mkEditorProject rec {
64 version = "1.4";
65 module = "TexturesLibraryEditor";
66 name = sweetName module version;
67 description = "Easily create SH3T files and edit the properties of the texture images it contain";
68 license = stdenv.lib.licenses.gpl2Plus;
69 src = fetchcvs {
70 cvsRoot = ":pserver:anonymous@sweethome3d.cvs.sourceforge.net:/cvsroot/sweethome3d";
71 sha256 = "1j1ygb32dca48hng5bsna9f84vyin5qc3ds44xi39057izmw8499";
72 module = module;
73 tag = "V_" + d2u version;
74 };
75 };
76
77 furniture-editor = mkEditorProject rec {
78 version = "1.16";
79 module = "FurnitureLibraryEditor";
80 name = sweetName module version;
81 description = "Quickly create SH3F files and edit the properties of the 3D models it contain";
82 license = stdenv.lib.licenses.gpl2;
83 src = fetchcvs {
84 cvsRoot = ":pserver:anonymous@sweethome3d.cvs.sourceforge.net:/cvsroot/sweethome3d";
85 sha256 = "09dmb0835kncs1ngszhyp1pgvj7vqjjrp9q405gakm8ylrzym374";
86 module = module;
87 tag = "V_" + d2u version;
88 };
89 };
90
91}