nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 134 lines 3.5 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchzip, 5 makeWrapper, 6 makeDesktopItem, 7 jdk, 8 ant, 9 stripJavaArchivesHook, 10 gtk3, 11 gsettings-desktop-schemas, 12 sweethome3dApp, 13 unzip, 14}: 15 16let 17 18 sweetExec = m: "sweethome3d-" + lib.removeSuffix "libraryeditor" (lib.toLower m) + "-editor"; 19 20 mkEditorProject = 21 { 22 pname, 23 module, 24 version, 25 src, 26 license, 27 description, 28 desktopName, 29 }: 30 31 stdenv.mkDerivation rec { 32 application = sweethome3dApp; 33 inherit 34 pname 35 module 36 version 37 src 38 description 39 ; 40 exec = sweetExec module; 41 editorItem = makeDesktopItem { 42 inherit exec desktopName; 43 name = pname; 44 comment = description; 45 genericName = "Computer Aided (Interior) Design"; 46 categories = [ 47 "Graphics" 48 "2DGraphics" 49 "3DGraphics" 50 ]; 51 }; 52 53 nativeBuildInputs = [ 54 makeWrapper 55 stripJavaArchivesHook 56 ]; 57 buildInputs = [ 58 ant 59 jdk 60 gtk3 61 gsettings-desktop-schemas 62 ]; 63 64 # upstream targets Java 7 by default 65 env.ANT_ARGS = "-DappletClassSource=8 -DappletClassTarget=8 -DclassSource=8 -DclassTarget=8"; 66 67 postPatch = '' 68 sed -i -e 's,../SweetHome3D,${sweethome3dApp.src},g' build.xml 69 sed -i -e 's,lib/macosx/java3d-1.6/jogl-all.jar,lib/java3d-1.6/jogl-all.jar,g' build.xml 70 ''; 71 72 buildPhase = '' 73 runHook preBuild 74 75 ant -lib ${sweethome3dApp.src}/libtest -lib ${sweethome3dApp.src}/lib -lib ${jdk}/lib 76 77 runHook postBuild 78 ''; 79 80 installPhase = '' 81 mkdir -p $out/bin 82 mkdir -p $out/share/{java,applications} 83 cp ${module}-${version}.jar $out/share/java/. 84 cp "${editorItem}/share/applications/"* $out/share/applications 85 makeWrapper ${jdk}/bin/java $out/bin/$exec \ 86 --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gtk3.out}/share:${gsettings-desktop-schemas}/share:$out/share:$GSETTINGS_SCHEMAS_PATH" \ 87 --add-flags "-jar $out/share/java/${module}-${version}.jar -d${toString stdenv.hostPlatform.parsed.cpu.bits}" 88 ''; 89 90 dontStrip = true; 91 92 meta = { 93 homepage = "http://www.sweethome3d.com/index.jsp"; 94 inherit description; 95 inherit license; 96 maintainers = [ lib.maintainers.edwtjo ]; 97 platforms = lib.platforms.linux; 98 mainProgram = exec; 99 }; 100 101 }; 102 103 d2u = lib.replaceStrings [ "." ] [ "_" ]; 104 105in 106{ 107 108 textures-editor = mkEditorProject rec { 109 version = "1.7"; 110 module = "TexturesLibraryEditor"; 111 pname = module; 112 description = "Easily create SH3T files and edit the properties of the texture images it contain"; 113 license = lib.licenses.gpl2Plus; 114 src = fetchzip { 115 url = "mirror://sourceforge/sweethome3d/${module}-${version}-src.zip"; 116 hash = "sha256-v8hMEUujTgWvFnBTF8Dnd1iWgoIXBzGMUxBgmjdxx+g="; 117 }; 118 desktopName = "Sweet Home 3D - Textures Library Editor"; 119 }; 120 121 furniture-editor = mkEditorProject rec { 122 version = "1.28"; 123 module = "FurnitureLibraryEditor"; 124 pname = module; 125 description = "Quickly create SH3F files and edit the properties of the 3D models it contain"; 126 license = lib.licenses.gpl2Plus; 127 src = fetchzip { 128 url = "mirror://sourceforge/sweethome3d/${module}-${version}-src.zip"; 129 hash = "sha256-pqsSxQPzsyx4PS98fgU6UFhPWhpQoepGm0uJtkvV46c="; 130 }; 131 desktopName = "Sweet Home 3D - Furniture Library Editor"; 132 }; 133 134}