From 7421b26a5767f0edf19edba5291c2b5d4482e602 Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Thu, 8 Jun 2023 12:44:55 -0600 Subject: [PATCH 01/13] wxGTK31: Support enabling WebRequest component --- pkgs/development/libraries/wxwidgets/wxGTK31.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/development/libraries/wxwidgets/wxGTK31.nix b/pkgs/development/libraries/wxwidgets/wxGTK31.nix index c05fcef2557a6..c8578fbe94109 100644 --- a/pkgs/development/libraries/wxwidgets/wxGTK31.nix +++ b/pkgs/development/libraries/wxwidgets/wxGTK31.nix @@ -1,6 +1,7 @@ { lib , stdenv , fetchFromGitHub +, curl , gst_all_1 , gtk3 , libGL @@ -14,6 +15,7 @@ , compat28 ? false , compat30 ? true , unicode ? true +, withCurl ? false , withEGL ? true , withMesa ? !stdenv.isDarwin , withWebKit ? stdenv.isDarwin @@ -59,6 +61,7 @@ stdenv.mkDerivation rec { libXxf86vm xorgproto ] + ++ lib.optional withCurl curl ++ lib.optional withMesa libGLU ++ lib.optional (withWebKit && !stdenv.isDarwin) webkitgtk ++ lib.optional (withWebKit && stdenv.isDarwin) WebKit @@ -85,6 +88,7 @@ stdenv.mkDerivation rec { ] ++ lib.optional (!withEGL) "--disable-glcanvasegl" ++ lib.optional unicode "--enable-unicode" + ++ lib.optional withCurl "--enable-webrequest" ++ lib.optional withMesa "--with-opengl" ++ lib.optionals stdenv.isDarwin [ "--with-osx_cocoa" From c4f640b9e460e528d9376cfba8692093e21a994a Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Thu, 8 Jun 2023 12:44:55 -0600 Subject: [PATCH 02/13] wxGTK31: Support enabling private fonts --- pkgs/development/libraries/wxwidgets/wxGTK31.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/libraries/wxwidgets/wxGTK31.nix b/pkgs/development/libraries/wxwidgets/wxGTK31.nix index c8578fbe94109..13052747eb5ea 100644 --- a/pkgs/development/libraries/wxwidgets/wxGTK31.nix +++ b/pkgs/development/libraries/wxwidgets/wxGTK31.nix @@ -16,6 +16,7 @@ , compat30 ? true , unicode ? true , withCurl ? false +, withPrivateFonts ? false , withEGL ? true , withMesa ? !stdenv.isDarwin , withWebKit ? stdenv.isDarwin @@ -89,6 +90,7 @@ stdenv.mkDerivation rec { ++ lib.optional (!withEGL) "--disable-glcanvasegl" ++ lib.optional unicode "--enable-unicode" ++ lib.optional withCurl "--enable-webrequest" + ++ lib.optional withPrivateFonts "--enable-privatefonts" ++ lib.optional withMesa "--with-opengl" ++ lib.optionals stdenv.isDarwin [ "--with-osx_cocoa" From 5147dcaae7dbc457618753c4c5443d005d1fa9ae Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Thu, 8 Jun 2023 12:44:55 -0600 Subject: [PATCH 03/13] bambu-studio: init at 01.06.02.04 Co-authored-by: Phileas Lebada --- ...-CMakeLists-Link-against-webkit2gtk-.patch | 34 ++++ .../misc/bambu-studio/default.nix | 175 ++++++++++++++++++ pkgs/top-level/all-packages.nix | 18 ++ 3 files changed, 227 insertions(+) create mode 100644 pkgs/applications/misc/bambu-studio/0001-not-for-upstream-CMakeLists-Link-against-webkit2gtk-.patch create mode 100644 pkgs/applications/misc/bambu-studio/default.nix diff --git a/pkgs/applications/misc/bambu-studio/0001-not-for-upstream-CMakeLists-Link-against-webkit2gtk-.patch b/pkgs/applications/misc/bambu-studio/0001-not-for-upstream-CMakeLists-Link-against-webkit2gtk-.patch new file mode 100644 index 0000000000000..15f1bf8f0b59e --- /dev/null +++ b/pkgs/applications/misc/bambu-studio/0001-not-for-upstream-CMakeLists-Link-against-webkit2gtk-.patch @@ -0,0 +1,34 @@ +From 7eed499898226222a949a792e0400ec10db4a1c9 Mon Sep 17 00:00:00 2001 +From: Zhaofeng Li +Date: Tue, 22 Nov 2022 13:00:39 -0700 +Subject: [PATCH] [not for upstream] CMakeLists: Link against webkit2gtk in + libslic3r_gui + +WebView.cpp uses symbols from webkitgtk directly. Upstream setup +links wxGTK statically so webkitgtk is already pulled in. + +> /nix/store/039g378vc3pc3dvi9dzdlrd0i4q93qwf-binutils-2.39/bin/ld: slic3r/liblibslic3r_gui.a(WebView.cpp.o): undefined reference to symbol 'webkit_web_view_run_javascript_finish' +> /nix/store/039g378vc3pc3dvi9dzdlrd0i4q93qwf-binutils-2.39/bin/ld: /nix/store/8yvy428jy2nwq4dhmrcs7gj5r27a2pv6-webkitgtk-2.38.2+abi=4.0/lib/libwebkit2gtk-4.0.so.37: error adding symbols: DSO missing from command line +--- + src/CMakeLists.txt | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 9c5cb96..e92a0e3 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -175,6 +175,11 @@ if (WIN32) + target_link_libraries(BambuStudio_app_gui PRIVATE boost_headeronly) + endif () + ++# We link against webkit2gtk symbols in src/slic3r/GUI/Widgets/WebView.cpp ++if (CMAKE_SYSTEM_NAME STREQUAL "Linux") ++ target_link_libraries(libslic3r_gui "-lwebkit2gtk-4.0") ++endif () ++ + # Link the resources dir to where Slic3r GUI expects it + set(output_dlls_Release "") + set(output_dlls_Debug "") +-- +2.38.1 + diff --git a/pkgs/applications/misc/bambu-studio/default.nix b/pkgs/applications/misc/bambu-studio/default.nix new file mode 100644 index 0000000000000..537236a9902f7 --- /dev/null +++ b/pkgs/applications/misc/bambu-studio/default.nix @@ -0,0 +1,175 @@ +{ stdenv +, lib +, binutils +, fetchFromGitHub +, cmake +, pkg-config +, wrapGAppsHook +, boost +, cereal +, cgal_5 +, curl +, dbus +, eigen +, expat +, gcc-unwrapped +, glew +, glfw +, glib +, glib-networking +, gmp +, gstreamer +, gst-plugins-base +, gst-plugins-bad +, gtest +, gtk3 +, hicolor-icon-theme +, ilmbase +, libpng +, mesa +, mpfr +, nlopt +, opencascade-occt +, openvdb +, pcre +, qhull +, systemd +, tbb +, webkitgtk +, wxGTK31 +, xorg +, fetchpatch +, withSystemd ? stdenv.isLinux +}: +let + wxGTK31' = wxGTK31.overrideAttrs (old: { + configureFlags = old.configureFlags ++ [ + # Disable noisy debug dialogs + "--enable-debug=no" + ]; + }); +in +stdenv.mkDerivation rec { + pname = "bambu-studio"; + version = "01.06.02.04"; + + src = fetchFromGitHub { + owner = "bambulab"; + repo = "BambuStudio"; + rev = "v${version}"; + hash = "sha256-k2/0ukIVjGhUUKhaJCldTRsQcHwX/mL2ROVaiTkv/eg="; + }; + + nativeBuildInputs = [ + cmake + pkg-config + wrapGAppsHook + ]; + + buildInputs = [ + binutils + boost + cereal + cgal_5 + curl + dbus + eigen + expat + gcc-unwrapped + glew + glfw + glib + glib-networking + gmp + gstreamer + gst-plugins-base + gst-plugins-bad + gtk3 + hicolor-icon-theme + ilmbase + libpng + mesa.osmesa + mpfr + nlopt + opencascade-occt + openvdb + pcre + tbb + webkitgtk + wxGTK31' + xorg.libX11 + ] ++ lib.optionals withSystemd [ + systemd + ] ++ checkInputs; + + patches = [ + # Fix for webkitgtk linking + ./0001-not-for-upstream-CMakeLists-Link-against-webkit2gtk-.patch + + # Fix null pointer deref with wxTranslations::Get() + # + # https://github.com/bambulab/BambuStudio/pull/1906 + (fetchpatch { + name = "Initialize-locale-before-wxTranslations-Get.patch"; + url = "https://github.com/zhaofengli/BambuStudio/commit/04728a14433ebd3b36032210c1ef806c63101166.patch"; + hash = "sha256-9rk/qaDMqqN9aaK0E1ElKz1qUkznOEBlgeMSE48wQh8="; + }) + ]; + + doCheck = true; + checkInputs = [ gtest ]; + + separateDebugInfo = true; + + # The build system uses custom logic - defined in + # cmake/modules/FindNLopt.cmake in the package source - for finding the nlopt + # library, which doesn't pick up the package in the nix store. We + # additionally need to set the path via the NLOPT environment variable. + NLOPT = nlopt; + + # Disable compiler warnings that clutter the build log. + # It seems to be a known issue for Eigen: + # http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1221 + NIX_CFLAGS_COMPILE = "-Wno-ignored-attributes"; + + # prusa-slicer uses dlopen on `libudev.so` at runtime + NIX_LDFLAGS = lib.optionalString withSystemd "-ludev"; + + # TODO: macOS + prePatch = '' + # Since version 2.5.0 of nlopt we need to link to libnlopt, as libnlopt_cxx + # now seems to be integrated into the main lib. + sed -i 's|nlopt_cxx|nlopt|g' cmake/modules/FindNLopt.cmake + ''; + + cmakeFlags = [ + "-DSLIC3R_STATIC=0" + "-DSLIC3R_FHS=1" + "-DSLIC3R_GTK=3" + + # BambuStudio-specific + "-DBBL_RELEASE_TO_PUBLIC=1" + "-DBBL_INTERNAL_TESTING=0" + "-DDEP_WX_GTK3=ON" + "-DSLIC3R_BUILD_TESTS=0" + "-DCMAKE_CXX_FLAGS=-DBOOST_LOG_DYN_LINK" + ]; + + preFixup = '' + gappsWrapperArgs+=( + --prefix LD_LIBRARY_PATH : "$out/lib" + + # Fixes intermittent crash + # The upstream setup links in glew statically + --prefix LD_PRELOAD : "${glew.out}/lib/libGLEW.so" + ) + ''; + + meta = with lib; { + description = "PC Software for BambuLab's 3D printers"; + homepage = "https://github.com/bambulab/BambuStudio"; + license = licenses.agpl3; + maintainers = with maintainers; [ zhaofengli ]; + mainProgram = "bambu-studio"; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c6994e8945ba4..3503e7a4576a3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -35451,6 +35451,24 @@ with pkgs; super-slicer-latest = super-slicer.latest; + bambu-studio = callPackage ../applications/misc/bambu-studio { + inherit (gst_all_1) gstreamer gst-plugins-base gst-plugins-bad; + + # Needs to be the same version as in the closed-source networking plugin. + curl = curl.override { openssl = openssl_1_1; }; + + glew = glew-egl; + + wxGTK31 = wxGTK31.override { + # https://github.com/supermerill/SuperSlicer/issues/1093 + #withEGL = false; + + withCurl = true; + withPrivateFonts = true; + withWebKit = true; + }; + }; + snapmaker-luban = callPackage ../applications/misc/snapmaker-luban { }; robustirc-bridge = callPackage ../servers/irc/robustirc-bridge { }; From 9c8d09d879843d1c9af32830ee086b76cd975e57 Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Sat, 15 Jul 2023 14:53:34 -0600 Subject: [PATCH 04/13] bambu-studio: 01.06.02.04 -> 01.07.00.65 --- pkgs/applications/misc/bambu-studio/default.nix | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/pkgs/applications/misc/bambu-studio/default.nix b/pkgs/applications/misc/bambu-studio/default.nix index 537236a9902f7..f1704aa3c1816 100644 --- a/pkgs/applications/misc/bambu-studio/default.nix +++ b/pkgs/applications/misc/bambu-studio/default.nix @@ -51,13 +51,13 @@ let in stdenv.mkDerivation rec { pname = "bambu-studio"; - version = "01.06.02.04"; + version = "01.07.00.65"; src = fetchFromGitHub { owner = "bambulab"; repo = "BambuStudio"; rev = "v${version}"; - hash = "sha256-k2/0ukIVjGhUUKhaJCldTRsQcHwX/mL2ROVaiTkv/eg="; + hash = "sha256-IYkfKumi9gy1pQ5FnOzbbozTbjd1HY/xu19hrv8Bs6s="; }; nativeBuildInputs = [ @@ -105,15 +105,6 @@ stdenv.mkDerivation rec { patches = [ # Fix for webkitgtk linking ./0001-not-for-upstream-CMakeLists-Link-against-webkit2gtk-.patch - - # Fix null pointer deref with wxTranslations::Get() - # - # https://github.com/bambulab/BambuStudio/pull/1906 - (fetchpatch { - name = "Initialize-locale-before-wxTranslations-Get.patch"; - url = "https://github.com/zhaofengli/BambuStudio/commit/04728a14433ebd3b36032210c1ef806c63101166.patch"; - hash = "sha256-9rk/qaDMqqN9aaK0E1ElKz1qUkznOEBlgeMSE48wQh8="; - }) ]; doCheck = true; From 5092224d7ab12c0801b540f99d68849739a9870f Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Sun, 24 Sep 2023 22:43:33 -0600 Subject: [PATCH 05/13] bambu-studio: 01.07.00.65 -> 01.07.06.92 The OpenSSL pin is no longer needed. --- pkgs/applications/misc/bambu-studio/default.nix | 4 ++-- pkgs/top-level/all-packages.nix | 6 ------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/pkgs/applications/misc/bambu-studio/default.nix b/pkgs/applications/misc/bambu-studio/default.nix index f1704aa3c1816..191aa4659a883 100644 --- a/pkgs/applications/misc/bambu-studio/default.nix +++ b/pkgs/applications/misc/bambu-studio/default.nix @@ -51,13 +51,13 @@ let in stdenv.mkDerivation rec { pname = "bambu-studio"; - version = "01.07.00.65"; + version = "01.07.06.92"; src = fetchFromGitHub { owner = "bambulab"; repo = "BambuStudio"; rev = "v${version}"; - hash = "sha256-IYkfKumi9gy1pQ5FnOzbbozTbjd1HY/xu19hrv8Bs6s="; + hash = "sha256-6GpPBVPXPcdZ/YvG1RNaBS1DMNp7nbRH5IP1/Z4CJCc="; }; nativeBuildInputs = [ diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3503e7a4576a3..c5c0ba150b8ee 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -35454,15 +35454,9 @@ with pkgs; bambu-studio = callPackage ../applications/misc/bambu-studio { inherit (gst_all_1) gstreamer gst-plugins-base gst-plugins-bad; - # Needs to be the same version as in the closed-source networking plugin. - curl = curl.override { openssl = openssl_1_1; }; - glew = glew-egl; wxGTK31 = wxGTK31.override { - # https://github.com/supermerill/SuperSlicer/issues/1093 - #withEGL = false; - withCurl = true; withPrivateFonts = true; withWebKit = true; From a0dbc34dfe422fbefff8d6c368047d0c18ca9ab1 Mon Sep 17 00:00:00 2001 From: Phileas Lebada Date: Sat, 11 Nov 2023 13:28:27 +0000 Subject: [PATCH 06/13] Switch to newer tbb version tbb was broken up into two versions for backwards compability https://github.com/NixOS/nixpkgs/pull/217585/files and put into prusa-slicer https://github.com/NixOS/nixpkgs/pull/238921/files Which fixes for 1.8 beta build ``` bambu-studio> CMake Error at src/libslic3r/CMakeLists.txt:490 (target_link_libraries): bambu-studio> Target "libslic3r" links to: bambu-studio> TBB::tbbmalloc bambu-studio> but the target was not found. Possible reasons include: bambu-studio> * There is a typo in the target name. bambu-studio> * A find_package call is missing for an IMPORTED target. bambu-studio> * An ALIAS target is missing. bambu-studio> bambu-studio> -- Generating done (0.2s) bambu-studio> CMake Warning: bambu-studio> Manually-specified variables were not used by the project: bambu-studio> CMAKE_EXPORT_NO_PACKAGE_REGISTRY bambu-studio> DEP_WX_GTK3 bambu-studio> bambu-studio> CMake Generate step failed. Build files cannot be regenerated correctly. error: builder for '/nix/store/rzgx01p1ni2xbx5ddg0133pjjlzs8618-bambu-studio-01.08.00.57.drv' failed with exit code 1; ``` --- pkgs/applications/misc/bambu-studio/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/misc/bambu-studio/default.nix b/pkgs/applications/misc/bambu-studio/default.nix index 191aa4659a883..618f0011f0cd5 100644 --- a/pkgs/applications/misc/bambu-studio/default.nix +++ b/pkgs/applications/misc/bambu-studio/default.nix @@ -34,7 +34,7 @@ , pcre , qhull , systemd -, tbb +, tbb_2021_8 , webkitgtk , wxGTK31 , xorg @@ -94,7 +94,7 @@ stdenv.mkDerivation rec { opencascade-occt openvdb pcre - tbb + tbb_2021_8 webkitgtk wxGTK31' xorg.libX11 From a3e39ad084173ef3ec17b1912b21beb6241c86af Mon Sep 17 00:00:00 2001 From: Phileas Lebada Date: Sat, 11 Nov 2023 13:30:50 +0000 Subject: [PATCH 07/13] bambu-studio: 01.07.06.92 -> 01.08.00.57 (beta) --- pkgs/applications/misc/bambu-studio/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/misc/bambu-studio/default.nix b/pkgs/applications/misc/bambu-studio/default.nix index 618f0011f0cd5..aeb0c18c10888 100644 --- a/pkgs/applications/misc/bambu-studio/default.nix +++ b/pkgs/applications/misc/bambu-studio/default.nix @@ -51,13 +51,13 @@ let in stdenv.mkDerivation rec { pname = "bambu-studio"; - version = "01.07.06.92"; + version = "01.08.00.57"; src = fetchFromGitHub { owner = "bambulab"; repo = "BambuStudio"; rev = "v${version}"; - hash = "sha256-6GpPBVPXPcdZ/YvG1RNaBS1DMNp7nbRH5IP1/Z4CJCc="; + hash = "sha256-yqn6248kdsxnVBevOca3LKZKicBF8cU+e/G5ynZK86k="; }; nativeBuildInputs = [ From 7db3baaa6c9dbd01bf14bcc6d094dda19c2e6df9 Mon Sep 17 00:00:00 2001 From: Phileas Lebada Date: Sat, 11 Nov 2023 16:10:13 +0000 Subject: [PATCH 08/13] bambu-studio: switch to custom openvdb tbb version --- pkgs/applications/misc/bambu-studio/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/misc/bambu-studio/default.nix b/pkgs/applications/misc/bambu-studio/default.nix index aeb0c18c10888..8069b3392b5b4 100644 --- a/pkgs/applications/misc/bambu-studio/default.nix +++ b/pkgs/applications/misc/bambu-studio/default.nix @@ -1,5 +1,8 @@ { stdenv , lib +, openexr +, jemalloc +, c-blosc , binutils , fetchFromGitHub , cmake @@ -48,6 +51,9 @@ let "--enable-debug=no" ]; }); + openvdb_tbb_2021_8 = openvdb.overrideAttrs (old: rec { + buildInputs = [ openexr boost tbb_2021_8 jemalloc c-blosc ilmbase ]; + }); in stdenv.mkDerivation rec { pname = "bambu-studio"; @@ -92,7 +98,7 @@ stdenv.mkDerivation rec { mpfr nlopt opencascade-occt - openvdb + openvdb_tbb_2021_8 pcre tbb_2021_8 webkitgtk From b928acef50b7acf3d2731edbe5d8a0016bd29986 Mon Sep 17 00:00:00 2001 From: Phileas Lebada Date: Sat, 11 Nov 2023 16:10:38 +0000 Subject: [PATCH 09/13] bambu-studio: chore update systemd include style --- pkgs/applications/misc/bambu-studio/default.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/applications/misc/bambu-studio/default.nix b/pkgs/applications/misc/bambu-studio/default.nix index 8069b3392b5b4..431c25fc64de9 100644 --- a/pkgs/applications/misc/bambu-studio/default.nix +++ b/pkgs/applications/misc/bambu-studio/default.nix @@ -36,13 +36,12 @@ , openvdb , pcre , qhull -, systemd , tbb_2021_8 , webkitgtk , wxGTK31 , xorg , fetchpatch -, withSystemd ? stdenv.isLinux +, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd }: let wxGTK31' = wxGTK31.overrideAttrs (old: { From 5c4b7a5bf96a8b25348c5c11f979856707c67e9a Mon Sep 17 00:00:00 2001 From: Phileas Lebada Date: Sat, 11 Nov 2023 20:19:10 +0000 Subject: [PATCH 10/13] bambu-studio add boost filesystem workaround --- .../bambu-studio/0002-boost-filesystem.patch | 151 ++++++++++++++++++ .../misc/bambu-studio/default.nix | 2 + 2 files changed, 153 insertions(+) create mode 100644 pkgs/applications/misc/bambu-studio/0002-boost-filesystem.patch diff --git a/pkgs/applications/misc/bambu-studio/0002-boost-filesystem.patch b/pkgs/applications/misc/bambu-studio/0002-boost-filesystem.patch new file mode 100644 index 0000000000000..1e04eda98d075 --- /dev/null +++ b/pkgs/applications/misc/bambu-studio/0002-boost-filesystem.patch @@ -0,0 +1,151 @@ +diff --git a/src/BambuStudio.cpp b/src/BambuStudio.cpp +index c113db5a..f4617ba6 100644 +--- a/src/BambuStudio.cpp ++++ b/src/BambuStudio.cpp +@@ -448,7 +448,7 @@ static int decode_png_to_thumbnail(std::string png_file, ThumbnailData& thumbnai + std::string png_buffer(size, '\0'); + png_buffer.reserve(size); + +- boost::filesystem::ifstream ifs(png_file, std::ios::binary); ++ boost::nowide::ifstream ifs(png_file, std::ios::binary); + ifs.read(png_buffer.data(), png_buffer.size()); + ifs.close(); + +diff --git a/src/libnest2d/tools/svgtools.hpp b/src/libnest2d/tools/svgtools.hpp +index 2bf090b3..9d832d40 100644 +--- a/src/libnest2d/tools/svgtools.hpp ++++ b/src/libnest2d/tools/svgtools.hpp +@@ -5,6 +5,7 @@ + #include + #include + ++#include + #include + #include + +@@ -144,7 +145,7 @@ public: + size_t last = svg_layers_.size() > 1 ? svg_layers_.size() : 0; + + for (auto &lyr : svg_layers_) { +- boost::filesystem::ofstream out(filepath, std::fstream::out); ++ boost::nowide::ofstream out(filepath, std::fstream::out); + if (out.is_open()) out << lyr; + if (lyrc == last && !finished_) out << "\n\n"; + out.flush(); +diff --git a/src/libslic3r/Format/bbs_3mf.cpp b/src/libslic3r/Format/bbs_3mf.cpp +index 69dd1e26..24e48d84 100644 +--- a/src/libslic3r/Format/bbs_3mf.cpp ++++ b/src/libslic3r/Format/bbs_3mf.cpp +@@ -5720,7 +5720,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) + MD5_CTX ctx; + MD5_Init(&ctx); + auto src_gcode_file = plate_data->gcode_file; +- boost::filesystem::ifstream ifs(src_gcode_file, std::ios::binary); ++ boost::nowide::ifstream ifs(src_gcode_file, std::ios::binary); + std::string buf(64 * 1024, 0); + const std::size_t & size = boost::filesystem::file_size(src_gcode_file); + std::size_t left_size = size; +@@ -7476,7 +7476,7 @@ bool _BBS_3MF_Exporter::_add_gcode_file_to_archive(mz_zip_archive& archive, cons + BOOST_LOG_TRIVIAL(error) << "Gcode is missing, filename = " << src_gcode_file; + result = false; + } +- boost::filesystem::ifstream ifs(src_gcode_file, std::ios::binary); ++ boost::nowide::ifstream ifs(src_gcode_file, std::ios::binary); + std::string buf(64 * 1024, 0); + while (ifs) { + ifs.read(buf.data(), buf.size()); +diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp +index 4584e569..95ae7e9c 100644 +--- a/src/libslic3r/Preset.cpp ++++ b/src/libslic3r/Preset.cpp +@@ -136,7 +136,7 @@ ConfigFileType guess_config_file_type(const ptree &tree) + VendorProfile VendorProfile::from_ini(const boost::filesystem::path &path, bool load_all) + { + ptree tree; +- boost::filesystem::ifstream ifs(path); ++ boost::nowide::ifstream ifs(path); + boost::property_tree::read_ini(ifs, tree); + return VendorProfile::from_ini(tree, path, load_all); + } +diff --git a/src/slic3r/GUI/PrintHostDialogs.cpp b/src/slic3r/GUI/PrintHostDialogs.cpp +index 3be2f89c..3e3002a4 100644 +--- a/src/slic3r/GUI/PrintHostDialogs.cpp ++++ b/src/slic3r/GUI/PrintHostDialogs.cpp +@@ -79,8 +79,9 @@ PrintHostSendDialog::PrintHostSendDialog(const fs::path &path, PrintHostPostUplo + + m_valid_suffix = recent_path.substr(recent_path.find_last_of('.')); + // .gcode suffix control +- auto validate_path = [this](const wxString &path) -> bool { +- if (! path.Lower().EndsWith(m_valid_suffix.Lower())) { ++ ++ auto validate_path = [this](const std::wstring &path) -> bool { ++ if (! wxString(path).Lower().EndsWith(m_valid_suffix.Lower())) { + MessageDialog msg_wingow(this, wxString::Format(_L("Upload filename doesn't end with \"%s\". Do you wish to continue?"), m_valid_suffix), wxString(SLIC3R_APP_NAME), wxYES | wxNO); + if (msg_wingow.ShowModal() == wxID_NO) + return false; +@@ -90,7 +91,7 @@ PrintHostSendDialog::PrintHostSendDialog(const fs::path &path, PrintHostPostUplo + + auto* btn_upload = add_button(wxID_YES, false, _L("Upload")); + btn_upload->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) { +- if (validate_path(txt_filename->GetValue())) { ++ if (validate_path(txt_filename->GetValue().ToStdWstring())) { + post_upload_action = PrintHostPostUploadAction::None; + EndDialog(wxID_OK); + } +@@ -99,7 +100,7 @@ PrintHostSendDialog::PrintHostSendDialog(const fs::path &path, PrintHostPostUplo + if (post_actions.has(PrintHostPostUploadAction::StartPrint)) { + auto* btn_print = add_button(wxID_YES, false, _L("Print")); + btn_print->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) { +- if (validate_path(txt_filename->GetValue())) { ++ if (validate_path(txt_filename->GetValue().ToStdWstring())) { + post_upload_action = PrintHostPostUploadAction::StartPrint; + EndDialog(wxID_OK); + } +@@ -110,7 +111,7 @@ PrintHostSendDialog::PrintHostSendDialog(const fs::path &path, PrintHostPostUplo + // Using wxID_MORE as a button identifier to be different from the other buttons, wxID_MORE has no other meaning here. + auto* btn_simulate = add_button(wxID_MORE, false, _L("Simulate")); + btn_simulate->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) { +- if (validate_path(txt_filename->GetValue())) { ++ if (validate_path(txt_filename->GetValue().ToStdWstring())) { + post_upload_action = PrintHostPostUploadAction::StartSimulation; + EndDialog(wxID_OK); + } +@@ -142,7 +143,7 @@ PrintHostSendDialog::PrintHostSendDialog(const fs::path &path, PrintHostPostUplo + + fs::path PrintHostSendDialog::filename() const + { +- return into_path(txt_filename->GetValue()); ++ return into_path(txt_filename->GetValue().ToStdWstring()); + } + + PrintHostPostUploadAction PrintHostSendDialog::post_action() const +@@ -164,7 +165,7 @@ void PrintHostSendDialog::EndModal(int ret) + { + if (ret == wxID_OK) { + // Persist path and print settings +- wxString path = txt_filename->GetValue(); ++ wxString path = txt_filename->GetValue().ToStdWstring(); + int last_slash = path.Find('/', true); + if (last_slash == wxNOT_FOUND) + path.clear(); +diff --git a/src/slic3r/GUI/Printer/PrinterFileSystem.cpp b/src/slic3r/GUI/Printer/PrinterFileSystem.cpp +index ee6a0637..273b6eba 100644 +--- a/src/slic3r/GUI/Printer/PrinterFileSystem.cpp ++++ b/src/slic3r/GUI/Printer/PrinterFileSystem.cpp +@@ -7,6 +7,7 @@ + #include "../../Utils/NetworkAgent.hpp" + #include "../BitmapCache.hpp" + ++#include + #include + #include + #include +@@ -234,7 +235,7 @@ struct PrinterFileSystem::Download : Progress + std::string path; + std::string local_path; + std::string error; +- boost::filesystem::ofstream ofs; ++ boost::nowide::ofstream ofs; + boost::uuids::detail::md5 boost_md5; + }; + diff --git a/pkgs/applications/misc/bambu-studio/default.nix b/pkgs/applications/misc/bambu-studio/default.nix index 431c25fc64de9..d4711a7ef061d 100644 --- a/pkgs/applications/misc/bambu-studio/default.nix +++ b/pkgs/applications/misc/bambu-studio/default.nix @@ -110,6 +110,8 @@ stdenv.mkDerivation rec { patches = [ # Fix for webkitgtk linking ./0001-not-for-upstream-CMakeLists-Link-against-webkit2gtk-.patch + # gentoo inspired boost workaround + ./0002-boost-filesystem.patch ]; doCheck = true; From 1a1b0d7b9ef76ff03bc96eb7fce0d91dee4ca894 Mon Sep 17 00:00:00 2001 From: Phileas Lebada Date: Sun, 26 Nov 2023 15:01:33 +0000 Subject: [PATCH 11/13] Revert "bambu-studio add boost filesystem workaround" This reverts commit 5c4b7a5bf96a8b25348c5c11f979856707c67e9a. --- .../bambu-studio/0002-boost-filesystem.patch | 151 ------------------ .../misc/bambu-studio/default.nix | 2 - 2 files changed, 153 deletions(-) delete mode 100644 pkgs/applications/misc/bambu-studio/0002-boost-filesystem.patch diff --git a/pkgs/applications/misc/bambu-studio/0002-boost-filesystem.patch b/pkgs/applications/misc/bambu-studio/0002-boost-filesystem.patch deleted file mode 100644 index 1e04eda98d075..0000000000000 --- a/pkgs/applications/misc/bambu-studio/0002-boost-filesystem.patch +++ /dev/null @@ -1,151 +0,0 @@ -diff --git a/src/BambuStudio.cpp b/src/BambuStudio.cpp -index c113db5a..f4617ba6 100644 ---- a/src/BambuStudio.cpp -+++ b/src/BambuStudio.cpp -@@ -448,7 +448,7 @@ static int decode_png_to_thumbnail(std::string png_file, ThumbnailData& thumbnai - std::string png_buffer(size, '\0'); - png_buffer.reserve(size); - -- boost::filesystem::ifstream ifs(png_file, std::ios::binary); -+ boost::nowide::ifstream ifs(png_file, std::ios::binary); - ifs.read(png_buffer.data(), png_buffer.size()); - ifs.close(); - -diff --git a/src/libnest2d/tools/svgtools.hpp b/src/libnest2d/tools/svgtools.hpp -index 2bf090b3..9d832d40 100644 ---- a/src/libnest2d/tools/svgtools.hpp -+++ b/src/libnest2d/tools/svgtools.hpp -@@ -5,6 +5,7 @@ - #include - #include - -+#include - #include - #include - -@@ -144,7 +145,7 @@ public: - size_t last = svg_layers_.size() > 1 ? svg_layers_.size() : 0; - - for (auto &lyr : svg_layers_) { -- boost::filesystem::ofstream out(filepath, std::fstream::out); -+ boost::nowide::ofstream out(filepath, std::fstream::out); - if (out.is_open()) out << lyr; - if (lyrc == last && !finished_) out << "\n\n"; - out.flush(); -diff --git a/src/libslic3r/Format/bbs_3mf.cpp b/src/libslic3r/Format/bbs_3mf.cpp -index 69dd1e26..24e48d84 100644 ---- a/src/libslic3r/Format/bbs_3mf.cpp -+++ b/src/libslic3r/Format/bbs_3mf.cpp -@@ -5720,7 +5720,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) - MD5_CTX ctx; - MD5_Init(&ctx); - auto src_gcode_file = plate_data->gcode_file; -- boost::filesystem::ifstream ifs(src_gcode_file, std::ios::binary); -+ boost::nowide::ifstream ifs(src_gcode_file, std::ios::binary); - std::string buf(64 * 1024, 0); - const std::size_t & size = boost::filesystem::file_size(src_gcode_file); - std::size_t left_size = size; -@@ -7476,7 +7476,7 @@ bool _BBS_3MF_Exporter::_add_gcode_file_to_archive(mz_zip_archive& archive, cons - BOOST_LOG_TRIVIAL(error) << "Gcode is missing, filename = " << src_gcode_file; - result = false; - } -- boost::filesystem::ifstream ifs(src_gcode_file, std::ios::binary); -+ boost::nowide::ifstream ifs(src_gcode_file, std::ios::binary); - std::string buf(64 * 1024, 0); - while (ifs) { - ifs.read(buf.data(), buf.size()); -diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp -index 4584e569..95ae7e9c 100644 ---- a/src/libslic3r/Preset.cpp -+++ b/src/libslic3r/Preset.cpp -@@ -136,7 +136,7 @@ ConfigFileType guess_config_file_type(const ptree &tree) - VendorProfile VendorProfile::from_ini(const boost::filesystem::path &path, bool load_all) - { - ptree tree; -- boost::filesystem::ifstream ifs(path); -+ boost::nowide::ifstream ifs(path); - boost::property_tree::read_ini(ifs, tree); - return VendorProfile::from_ini(tree, path, load_all); - } -diff --git a/src/slic3r/GUI/PrintHostDialogs.cpp b/src/slic3r/GUI/PrintHostDialogs.cpp -index 3be2f89c..3e3002a4 100644 ---- a/src/slic3r/GUI/PrintHostDialogs.cpp -+++ b/src/slic3r/GUI/PrintHostDialogs.cpp -@@ -79,8 +79,9 @@ PrintHostSendDialog::PrintHostSendDialog(const fs::path &path, PrintHostPostUplo - - m_valid_suffix = recent_path.substr(recent_path.find_last_of('.')); - // .gcode suffix control -- auto validate_path = [this](const wxString &path) -> bool { -- if (! path.Lower().EndsWith(m_valid_suffix.Lower())) { -+ -+ auto validate_path = [this](const std::wstring &path) -> bool { -+ if (! wxString(path).Lower().EndsWith(m_valid_suffix.Lower())) { - MessageDialog msg_wingow(this, wxString::Format(_L("Upload filename doesn't end with \"%s\". Do you wish to continue?"), m_valid_suffix), wxString(SLIC3R_APP_NAME), wxYES | wxNO); - if (msg_wingow.ShowModal() == wxID_NO) - return false; -@@ -90,7 +91,7 @@ PrintHostSendDialog::PrintHostSendDialog(const fs::path &path, PrintHostPostUplo - - auto* btn_upload = add_button(wxID_YES, false, _L("Upload")); - btn_upload->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) { -- if (validate_path(txt_filename->GetValue())) { -+ if (validate_path(txt_filename->GetValue().ToStdWstring())) { - post_upload_action = PrintHostPostUploadAction::None; - EndDialog(wxID_OK); - } -@@ -99,7 +100,7 @@ PrintHostSendDialog::PrintHostSendDialog(const fs::path &path, PrintHostPostUplo - if (post_actions.has(PrintHostPostUploadAction::StartPrint)) { - auto* btn_print = add_button(wxID_YES, false, _L("Print")); - btn_print->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) { -- if (validate_path(txt_filename->GetValue())) { -+ if (validate_path(txt_filename->GetValue().ToStdWstring())) { - post_upload_action = PrintHostPostUploadAction::StartPrint; - EndDialog(wxID_OK); - } -@@ -110,7 +111,7 @@ PrintHostSendDialog::PrintHostSendDialog(const fs::path &path, PrintHostPostUplo - // Using wxID_MORE as a button identifier to be different from the other buttons, wxID_MORE has no other meaning here. - auto* btn_simulate = add_button(wxID_MORE, false, _L("Simulate")); - btn_simulate->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) { -- if (validate_path(txt_filename->GetValue())) { -+ if (validate_path(txt_filename->GetValue().ToStdWstring())) { - post_upload_action = PrintHostPostUploadAction::StartSimulation; - EndDialog(wxID_OK); - } -@@ -142,7 +143,7 @@ PrintHostSendDialog::PrintHostSendDialog(const fs::path &path, PrintHostPostUplo - - fs::path PrintHostSendDialog::filename() const - { -- return into_path(txt_filename->GetValue()); -+ return into_path(txt_filename->GetValue().ToStdWstring()); - } - - PrintHostPostUploadAction PrintHostSendDialog::post_action() const -@@ -164,7 +165,7 @@ void PrintHostSendDialog::EndModal(int ret) - { - if (ret == wxID_OK) { - // Persist path and print settings -- wxString path = txt_filename->GetValue(); -+ wxString path = txt_filename->GetValue().ToStdWstring(); - int last_slash = path.Find('/', true); - if (last_slash == wxNOT_FOUND) - path.clear(); -diff --git a/src/slic3r/GUI/Printer/PrinterFileSystem.cpp b/src/slic3r/GUI/Printer/PrinterFileSystem.cpp -index ee6a0637..273b6eba 100644 ---- a/src/slic3r/GUI/Printer/PrinterFileSystem.cpp -+++ b/src/slic3r/GUI/Printer/PrinterFileSystem.cpp -@@ -7,6 +7,7 @@ - #include "../../Utils/NetworkAgent.hpp" - #include "../BitmapCache.hpp" - -+#include - #include - #include - #include -@@ -234,7 +235,7 @@ struct PrinterFileSystem::Download : Progress - std::string path; - std::string local_path; - std::string error; -- boost::filesystem::ofstream ofs; -+ boost::nowide::ofstream ofs; - boost::uuids::detail::md5 boost_md5; - }; - diff --git a/pkgs/applications/misc/bambu-studio/default.nix b/pkgs/applications/misc/bambu-studio/default.nix index d4711a7ef061d..431c25fc64de9 100644 --- a/pkgs/applications/misc/bambu-studio/default.nix +++ b/pkgs/applications/misc/bambu-studio/default.nix @@ -110,8 +110,6 @@ stdenv.mkDerivation rec { patches = [ # Fix for webkitgtk linking ./0001-not-for-upstream-CMakeLists-Link-against-webkit2gtk-.patch - # gentoo inspired boost workaround - ./0002-boost-filesystem.patch ]; doCheck = true; From a2e2c89bfa2564a5ed17f2b1b1a2dcf43e13f2b1 Mon Sep 17 00:00:00 2001 From: Phileas Lebada Date: Sun, 26 Nov 2023 15:43:10 +0000 Subject: [PATCH 12/13] Downgrade boost to 179 (181 is current default) --- pkgs/applications/misc/bambu-studio/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/misc/bambu-studio/default.nix b/pkgs/applications/misc/bambu-studio/default.nix index 431c25fc64de9..3a8de70d38f24 100644 --- a/pkgs/applications/misc/bambu-studio/default.nix +++ b/pkgs/applications/misc/bambu-studio/default.nix @@ -8,7 +8,7 @@ , cmake , pkg-config , wrapGAppsHook -, boost +, boost179 , cereal , cgal_5 , curl @@ -51,7 +51,7 @@ let ]; }); openvdb_tbb_2021_8 = openvdb.overrideAttrs (old: rec { - buildInputs = [ openexr boost tbb_2021_8 jemalloc c-blosc ilmbase ]; + buildInputs = [ openexr boost179 tbb_2021_8 jemalloc c-blosc ilmbase ]; }); in stdenv.mkDerivation rec { @@ -73,7 +73,7 @@ stdenv.mkDerivation rec { buildInputs = [ binutils - boost + boost179 cereal cgal_5 curl From 65de34b0c03973a15ee4ec39a98bb4f8d456b44d Mon Sep 17 00:00:00 2001 From: Phileas Lebada Date: Sun, 26 Nov 2023 15:43:26 +0000 Subject: [PATCH 13/13] bambu-studio: bump to latest 01.08.00.62 beta --- pkgs/applications/misc/bambu-studio/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/misc/bambu-studio/default.nix b/pkgs/applications/misc/bambu-studio/default.nix index 3a8de70d38f24..98925210e8d41 100644 --- a/pkgs/applications/misc/bambu-studio/default.nix +++ b/pkgs/applications/misc/bambu-studio/default.nix @@ -56,13 +56,13 @@ let in stdenv.mkDerivation rec { pname = "bambu-studio"; - version = "01.08.00.57"; + version = "01.08.00.62"; src = fetchFromGitHub { owner = "bambulab"; repo = "BambuStudio"; rev = "v${version}"; - hash = "sha256-yqn6248kdsxnVBevOca3LKZKicBF8cU+e/G5ynZK86k="; + hash = "sha256-Rb8YNf+ZQ8+9jAP/ZLze0PfY/liE7Rr2bJX33AENsbg="; }; nativeBuildInputs = [