lol
fork

Configure Feed

Select the types of activity you want to include in your feed.

sweethome3d: add darwin support (#375760)

authored by

Gaétan Lepage and committed by
GitHub
0454e851 26710437

+275 -122
+15
pkgs/applications/misc/sweethome3d/build-xml.patch
··· 1 + --- /build.xml 2 + +++ /build.xml 3 + @@ -1134,6 +1134,12 @@ 4 + <arg value="${javaHome_macosx_arm64}/legal"/> 5 + <arg value="install/macosx/SweetHome3D-${version}/Sweet Home 3D.app/Contents/runtime/Contents/Home"/> 6 + </exec> 7 + + <!-- Fix permissions --> 8 + + <exec executable="chmod" failonerror="yes"> 9 + + <arg value="-R"/> 10 + + <arg value="u+w"/> 11 + + <arg value="install/macosx/SweetHome3D-${version}/Sweet Home 3D.app/Contents/runtime/Contents/Home/legal"/> 12 + + </exec> 13 + <!-- Remove legal files not exported by jpackage --> 14 + <delete dir="install/macosx/SweetHome3D-${version}/Sweet Home 3D.app/Contents/runtime/Contents/Home/legal/jdk.jcmd"/> 15 + <delete dir="install/macosx/SweetHome3D-${version}/Sweet Home 3D.app/Contents/runtime/Contents/Home/legal/jdk.internal.vm.compiler"/>
+13
pkgs/applications/misc/sweethome3d/config.patch
··· 1 + --- "a/install/macosx/Sweet Home 3D/Contents/app/SweetHome3D.cfg" 2 + +++ "b/install/macosx/Sweet Home 3D/Contents/app/SweetHome3D.cfg" 3 + @@ -6,6 +6,10 @@ 4 + 5 + [JavaOptions] 6 + java-options=-Xmx2000m 7 + +java-options=--add-opens=java.desktop/java.awt=ALL-UNNAMED 8 + +java-options=--add-opens=java.desktop/sun.awt=ALL-UNNAMED 9 + +java-options=--add-opens=java.desktop/com.apple.eio=ALL-UNNAMED 10 + +java-options=--add-opens=java.desktop/com.apple.eawt=ALL-UNNAMED 11 + java-options=-Djava.library.path=$APPDIR 12 + java-options=-Djogamp.gluegen.UseTempJarCache=false 13 + java-options=-Djava.locale.providers=COMPAT,SPI
+55
pkgs/applications/misc/sweethome3d/darwin.nix
··· 1 + { 2 + lib, 3 + stdenv, 4 + fetchzip, 5 + fetchurl, 6 + makeBinaryWrapper, 7 + zulu, 8 + ant, 9 + darwin, 10 + 11 + pname, 12 + version, 13 + src, 14 + meta, 15 + patches, 16 + }: 17 + 18 + stdenv.mkDerivation (finalAttrs: { 19 + inherit 20 + pname 21 + version 22 + src 23 + meta 24 + patches 25 + ; 26 + 27 + nativeBuildInputs = [ 28 + darwin.autoSignDarwinBinariesHook 29 + makeBinaryWrapper 30 + ant 31 + ]; 32 + buildInputs = [ 33 + zulu 34 + ]; 35 + 36 + buildPhase = '' 37 + runHook preBuild 38 + 39 + ant macosxBundle -DjavaHome_macosx_arm64=${zulu.home}/zulu-${lib.versions.major zulu.version}.jdk/Contents/Home 40 + 41 + runHook postBuild 42 + ''; 43 + 44 + installPhase = '' 45 + runHook preInstall 46 + 47 + mkdir -p $out/Applications 48 + mv "install/macosx/SweetHome3D-${finalAttrs.version}/Sweet Home 3D.app" $out/Applications 49 + makeWrapper "$out/Applications/Sweet Home 3D.app/Contents/MacOS/SweetHome3D" $out/bin/sweethome3d 50 + 51 + runHook postInstall 52 + ''; 53 + 54 + dontStrip = true; 55 + })
+51 -122
pkgs/applications/misc/sweethome3d/default.nix
··· 1 - { lib 2 - , stdenv 3 - , fetchzip 4 - , fetchurl 5 - , makeWrapper 6 - , makeDesktopItem 7 - , jdk 8 - , ant 9 - , stripJavaArchivesHook 10 - , gtk3 11 - , gsettings-desktop-schemas 12 - , p7zip 13 - , autoPatchelfHook 14 - , libXxf86vm 15 - , libGL 1 + { 2 + lib, 3 + fetchzip, 4 + stdenv, 5 + callPackage, 16 6 }: 17 7 18 8 let 19 - 20 - # TODO: Should we move this to `lib`? Seems like its would be useful in many cases. 21 - extensionOf = filePath: 22 - lib.concatStringsSep "." (lib.tail (lib.splitString "." (builtins.baseNameOf filePath))); 9 + pname = "sweethome3d"; 10 + version = "7.5"; 23 11 24 - installIcons = iconName: icons: lib.concatStringsSep "\n" (lib.mapAttrsToList (size: iconFile: '' 25 - mkdir -p "$out/share/icons/hicolor/${size}/apps" 26 - ln -s -T "${iconFile}" "$out/share/icons/hicolor/${size}/apps/${iconName}.${extensionOf iconFile}" 27 - '') icons); 12 + src = fetchzip { 13 + url = "mirror://sourceforge/sweethome3d/SweetHome3D-${version}-src.zip"; 14 + hash = "sha256-+rAhq5sFXC34AMYCcdAYZzrUa3LDy4S5Zid4DlEVvTQ="; 15 + }; 28 16 29 - mkSweetHome3D = 30 - { pname, module, version, src, license, description, desktopName, icons }: 17 + patches = [ 18 + ./build-xml.patch 19 + ./config.patch 20 + ]; 31 21 32 - stdenv.mkDerivation rec { 33 - inherit pname version src description; 34 - exec = lib.toLower module; 35 - sweethome3dItem = makeDesktopItem { 36 - inherit exec desktopName; 37 - name = pname; 38 - icon = pname; 39 - comment = description; 40 - genericName = "Computer Aided (Interior) Design"; 41 - categories = [ "Graphics" "2DGraphics" "3DGraphics" ]; 42 - }; 43 - 44 - postPatch = '' 45 - addAutoPatchelfSearchPath ${jdk}/lib/openjdk/lib/ 46 - autoPatchelf lib 47 - 48 - # Nix cannot see the runtime references to the paths we just patched in 49 - # once they've been compressed into the .jar. Scan for and remember them 50 - # as plain text so they don't get overlooked. 51 - find . -name '*.so' | xargs strings | { grep '/nix/store' || :; } >> ./.jar-paths 52 - ''; 53 - 54 - nativeBuildInputs = [ makeWrapper autoPatchelfHook stripJavaArchivesHook ]; 55 - buildInputs = [ ant jdk p7zip gtk3 gsettings-desktop-schemas libXxf86vm ]; 56 - 57 - # upstream targets Java 7 by default 58 - env.ANT_ARGS = "-DappletClassSource=8 -DappletClassTarget=8 -DclassSource=8 -DclassTarget=8"; 59 - 60 - buildPhase = '' 61 - runHook preBuild 62 - 63 - ant furniture textures help 64 - mkdir -p $out/share/{java,applications} 65 - mv "build/"*.jar $out/share/java/. 66 - ant 67 - 68 - runHook postBuild 69 - ''; 70 - 71 - installPhase = '' 72 - runHook preInstall 73 - 74 - mkdir -p $out/bin 75 - cp install/${module}-${version}.jar $out/share/java/. 76 - 77 - ${installIcons pname icons} 78 - 79 - cp "${sweethome3dItem}/share/applications/"* $out/share/applications 80 - 81 - makeWrapper ${jdk}/bin/java $out/bin/$exec \ 82 - --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gtk3.out}/share:${gsettings-desktop-schemas}/share:$out/share:$GSETTINGS_SCHEMAS_PATH" \ 83 - --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libGL ]}" \ 84 - --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}" 85 - 86 - 87 - # remember the store paths found inside the .jar libraries. note that 88 - # which file they are in does not matter in particular, just that some 89 - # file somewhere lists them in plain-text 90 - mkdir -p $out/nix-support 91 - cp .jar-paths $out/nix-support/depends 92 - 93 - runHook postInstall 94 - ''; 95 - 96 - dontStrip = true; 97 - 98 - meta = { 99 - homepage = "http://www.sweethome3d.com/index.jsp"; 100 - inherit description; 101 - inherit license; 102 - maintainers = [ lib.maintainers.edwtjo ]; 103 - platforms = lib.platforms.linux; 104 - mainProgram = exec; 105 - }; 106 - }; 107 - in { 108 - 109 - application = mkSweetHome3D rec { 110 - pname = lib.toLower module + "-application"; 111 - version = "7.5"; 112 - module = "SweetHome3D"; 22 + meta = { 23 + homepage = "https://www.sweethome3d.com/index.jsp"; 113 24 description = "Design and visualize your future home"; 114 25 license = lib.licenses.gpl2Plus; 115 - src = fetchzip { 116 - url = "mirror://sourceforge/sweethome3d/${module}-${version}-src.zip"; 117 - hash = "sha256-+rAhq5sFXC34AMYCcdAYZzrUa3LDy4S5Zid4DlEVvTQ="; 118 - }; 119 - desktopName = "Sweet Home 3D"; 120 - icons = { 121 - "32x32" = fetchurl { 122 - url = "http://sweethome3d.cvs.sourceforge.net/viewvc/sweethome3d/SweetHome3D/deploy/SweetHome3DIcon32x32.png"; 123 - sha256 = "1r2fhfg27mx00nfv0qj66rhf719s2g1vhdis7bdc9mqk9x0mb0ir"; 124 - }; 125 - "48x48" = fetchurl { 126 - url = "http://sweethome3d.cvs.sourceforge.net/viewvc/sweethome3d/SweetHome3D/deploy/SweetHome3DIcon48x48.png"; 127 - sha256 = "1ap6d75dyqqvx21wddvn8vw2apq3v803vmbxdriwd0dw9rq3zn4g"; 26 + maintainers = with lib.maintainers; [ 27 + edwtjo 28 + DimitarNestorov 29 + ]; 30 + platforms = [ 31 + "i686-linux" 32 + "x86_64-darwin" 33 + "x86_64-linux" 34 + "aarch64-darwin" 35 + ]; 36 + mainProgram = "sweethome3d"; 37 + }; 38 + in 39 + { 40 + application = 41 + if stdenv.hostPlatform.isDarwin then 42 + callPackage ./darwin.nix { 43 + inherit 44 + pname 45 + version 46 + src 47 + meta 48 + patches 49 + ; 50 + } 51 + else 52 + callPackage ./linux.nix { 53 + inherit 54 + pname 55 + version 56 + src 57 + meta 58 + patches 59 + ; 128 60 }; 129 - }; 130 - }; 131 - 132 61 }
+141
pkgs/applications/misc/sweethome3d/linux.nix
··· 1 + { 2 + lib, 3 + stdenv, 4 + fetchzip, 5 + fetchurl, 6 + makeWrapper, 7 + makeDesktopItem, 8 + jdk, 9 + ant, 10 + stripJavaArchivesHook, 11 + gtk3, 12 + gsettings-desktop-schemas, 13 + p7zip, 14 + autoPatchelfHook, 15 + libXxf86vm, 16 + libGL, 17 + copyDesktopItems, 18 + 19 + pname, 20 + version, 21 + src, 22 + meta, 23 + patches, 24 + }: 25 + 26 + let 27 + 28 + # TODO: Should we move this to `lib`? Seems like its would be useful in many cases. 29 + extensionOf = 30 + filePath: lib.concatStringsSep "." (lib.tail (lib.splitString "." (builtins.baseNameOf filePath))); 31 + 32 + installIcons = 33 + iconName: icons: 34 + lib.concatStringsSep "\n" ( 35 + lib.mapAttrsToList (size: iconFile: '' 36 + mkdir -p "$out/share/icons/hicolor/${size}/apps" 37 + ln -s -T "${iconFile}" "$out/share/icons/hicolor/${size}/apps/${iconName}.${extensionOf iconFile}" 38 + '') icons 39 + ); 40 + 41 + icons = { 42 + "32x32" = fetchurl { 43 + url = "http://sweethome3d.cvs.sourceforge.net/viewvc/sweethome3d/SweetHome3D/deploy/SweetHome3DIcon32x32.png"; 44 + sha256 = "1r2fhfg27mx00nfv0qj66rhf719s2g1vhdis7bdc9mqk9x0mb0ir"; 45 + }; 46 + "48x48" = fetchurl { 47 + url = "http://sweethome3d.cvs.sourceforge.net/viewvc/sweethome3d/SweetHome3D/deploy/SweetHome3DIcon48x48.png"; 48 + sha256 = "1ap6d75dyqqvx21wddvn8vw2apq3v803vmbxdriwd0dw9rq3zn4g"; 49 + }; 50 + }; 51 + 52 + in 53 + stdenv.mkDerivation { 54 + inherit 55 + pname 56 + version 57 + src 58 + meta 59 + patches 60 + ; 61 + 62 + desktopItems = [ 63 + (makeDesktopItem { 64 + name = "sweethome3d"; 65 + desktopName = "Sweet Home 3D"; 66 + icon = "sweethome3d"; 67 + comment = meta.description; 68 + exec = meta.mainProgram; 69 + genericName = "Computer Aided (Interior) Design"; 70 + categories = [ 71 + "Graphics" 72 + "2DGraphics" 73 + "3DGraphics" 74 + ]; 75 + }) 76 + ]; 77 + 78 + postPatch = '' 79 + addAutoPatchelfSearchPath ${jdk}/lib/openjdk/lib/ 80 + autoPatchelf lib 81 + 82 + # Nix cannot see the runtime references to the paths we just patched in 83 + # once they've been compressed into the .jar. Scan for and remember them 84 + # as plain text so they don't get overlooked. 85 + find . -name '*.so' | xargs strings | { grep '/nix/store' || :; } >> ./.jar-paths 86 + ''; 87 + 88 + nativeBuildInputs = [ 89 + makeWrapper 90 + autoPatchelfHook 91 + stripJavaArchivesHook 92 + copyDesktopItems 93 + ]; 94 + buildInputs = [ 95 + ant 96 + jdk 97 + p7zip 98 + gtk3 99 + gsettings-desktop-schemas 100 + libXxf86vm 101 + ]; 102 + 103 + # upstream targets Java 7 by default 104 + env.ANT_ARGS = "-DappletClassSource=8 -DappletClassTarget=8 -DclassSource=8 -DclassTarget=8"; 105 + 106 + buildPhase = '' 107 + runHook preBuild 108 + 109 + ant furniture textures help 110 + mkdir -p $out/share/{java,applications} 111 + mv "build/"*.jar $out/share/java/. 112 + ant 113 + 114 + runHook postBuild 115 + ''; 116 + 117 + installPhase = '' 118 + runHook preInstall 119 + 120 + mkdir -p $out/bin 121 + cp install/SweetHome3D-${version}.jar $out/share/java/. 122 + 123 + ${installIcons "sweethome3d" icons} 124 + 125 + makeWrapper ${jdk}/bin/java $out/bin/${meta.mainProgram} \ 126 + --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gtk3.out}/share:${gsettings-desktop-schemas}/share:$out/share:$GSETTINGS_SCHEMAS_PATH" \ 127 + --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libGL ]}" \ 128 + --add-flags "-Dsun.java2d.opengl=true -jar $out/share/java/SweetHome3D-${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}" 129 + 130 + 131 + # remember the store paths found inside the .jar libraries. note that 132 + # which file they are in does not matter in particular, just that some 133 + # file somewhere lists them in plain-text 134 + mkdir -p $out/nix-support 135 + cp .jar-paths $out/nix-support/depends 136 + 137 + runHook postInstall 138 + ''; 139 + 140 + dontStrip = true; 141 + }