diff --git a/pkgs/applications/misc/prusa-slicer/default.nix b/pkgs/applications/misc/prusa-slicer/default.nix index 75c1ed16e1d1..9c996e321152 100644 --- a/pkgs/applications/misc/prusa-slicer/default.nix +++ b/pkgs/applications/misc/prusa-slicer/default.nix @@ -31,10 +31,10 @@ , wxGTK31 , xorg , fetchpatch -, wxGTK31-override ? null +, withSystemd ? stdenv.isLinux }: let - wxGTK31-prusa = wxGTK31.overrideAttrs (old: rec { + wxGTK-prusa = wxGTK31.overrideAttrs (old: rec { pname = "wxwidgets-prusa3d-patched"; version = "3.1.4"; src = fetchFromGitHub { @@ -45,7 +45,6 @@ let fetchSubmodules = true; }; }); - wxGTK31-override' = if wxGTK31-override == null then wxGTK31-prusa else wxGTK31-override; in stdenv.mkDerivation rec { pname = "prusa-slicer"; @@ -78,10 +77,11 @@ stdenv.mkDerivation rec { opencascade-occt openvdb pcre - systemd tbb - wxGTK31-override' + wxGTK-prusa xorg.libX11 + ] ++ lib.optionals withSystemd [ + systemd ] ++ checkInputs; patches = [ @@ -119,7 +119,7 @@ stdenv.mkDerivation rec { NIX_CFLAGS_COMPILE = "-Wno-ignored-attributes"; # prusa-slicer uses dlopen on `libudev.so` at runtime - NIX_LDFLAGS = "-ludev"; + NIX_LDFLAGS = lib.optionalString withSystemd "-ludev"; prePatch = '' # Since version 2.5.0 of nlopt we need to link to libnlopt, as libnlopt_cxx @@ -139,6 +139,13 @@ stdenv.mkDerivation rec { substituteInPlace src/libslic3r/Format/STEP.cpp \ --replace 'libpath /= "OCCTWrapper.so";' 'libpath = "OCCTWrapper.so";' fi + + # Fix resources folder location on macOS + substituteInPlace src/PrusaSlicer.cpp \ + --replace "#ifdef __APPLE__" "#if 0" + '' + lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) '' + # Disable segfault tests + sed -i '/libslic3r/d' tests/CMakeLists.txt ''; src = fetchFromGitHub { @@ -149,6 +156,7 @@ stdenv.mkDerivation rec { }; cmakeFlags = [ + "-DSLIC3R_STATIC=0" "-DSLIC3R_FHS=1" "-DSLIC3R_GTK=3" ]; @@ -157,7 +165,7 @@ stdenv.mkDerivation rec { ln -s "$out/bin/prusa-slicer" "$out/bin/prusa-gcodeviewer" mkdir -p "$out/lib" - mv -v $out/bin/*.so $out/lib/ + mv -v $out/bin/*.* $out/lib/ mkdir -p "$out/share/pixmaps/" ln -s "$out/share/PrusaSlicer/icons/PrusaSlicer.png" "$out/share/pixmaps/PrusaSlicer.png" diff --git a/pkgs/applications/misc/prusa-slicer/super-slicer.nix b/pkgs/applications/misc/prusa-slicer/super-slicer.nix index a3c8fc6cdcc6..147f3484f18f 100644 --- a/pkgs/applications/misc/prusa-slicer/super-slicer.nix +++ b/pkgs/applications/misc/prusa-slicer/super-slicer.nix @@ -1,4 +1,4 @@ -{ lib, fetchFromGitHub, fetchpatch, makeDesktopItem, prusa-slicer, wxGTK31 }: +{ lib, fetchFromGitHub, fetchpatch, makeDesktopItem, prusa-slicer }: let appname = "SuperSlicer"; pname = "super-slicer"; @@ -22,7 +22,13 @@ let # Fix compile error with boost 1.79. See https://github.com/supermerill/SuperSlicer/issues/2823 (fetchpatch { url = "https://raw.githubusercontent.com/gentoo/gentoo/81e3ca3b7c131e8345aede89e3bbcd700e1ad567/media-gfx/superslicer/files/superslicer-2.4.58.3-boost-1.79-port-v2.patch"; - sha256 = "sha256-xMbUjumPZ/7ulyRuBA76CwIv4BOpd+yKXCINSf58FxI="; + # Excludes Linux-only patches + excludes = [ + "src/slic3r/GUI/FreeCADDialog.cpp" + "src/slic3r/GUI/Tab.cpp" + "src/slic3r/Utils/Http.cpp" + ]; + sha256 = "sha256-v0q2MhySayij7+qBTE5q01IOq/DyUcWnjpbzB/AV34c="; }) ]; }; @@ -39,6 +45,12 @@ let fetchSubmodules = true; }; + # wxScintilla is not used on macOS + prePatch = super.prePatch + '' + substituteInPlace src/CMakeLists.txt \ + --replace "scintilla" "" + ''; + # We don't need PS overrides anymore, and gcode-viewer is embedded in the binary. postInstall = null; separateDebugInfo = true; @@ -71,7 +83,6 @@ let passthru = allVersions; }; - prusa-slicer' = prusa-slicer.override { wxGTK31-override = wxGTK31; }; - allVersions = builtins.mapAttrs (_name: version: (prusa-slicer'.overrideAttrs (override version))) versions; + allVersions = builtins.mapAttrs (_name: version: (prusa-slicer.overrideAttrs (override version))) versions; in allVersions.stable diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4bae0a7823cb..1edd514e6864 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -32082,21 +32082,11 @@ with pkgs; printrun = callPackage ../applications/misc/printrun { }; - prusa-slicer = callPackage ../applications/misc/prusa-slicer { }; + prusa-slicer = darwin.apple_sdk_11_0.callPackage ../applications/misc/prusa-slicer { }; - super-slicer = callPackage ../applications/misc/prusa-slicer/super-slicer.nix { - wxGTK31 = wxGTK31.override { - # https://github.com/supermerill/SuperSlicer/issues/1093 - withEGL = false; - }; - }; + super-slicer = darwin.apple_sdk_11_0.callPackage ../applications/misc/prusa-slicer/super-slicer.nix { }; - super-slicer-latest = (callPackage ../applications/misc/prusa-slicer/super-slicer.nix { - wxGTK31 = wxGTK31.override { - # https://github.com/supermerill/SuperSlicer/issues/1093 - withEGL = false; - }; - }).latest; + super-slicer-latest = super-slicer.latest; snapmaker-luban = callPackage ../applications/misc/snapmaker-luban { };