pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

prusaslicer: Update to release 2.4.0



Module Name:	pkgsrc-wip
Committed By:	Paul Ripke <stix%stix.id.au@localhost>
Pushed By:	stix
Date:		Thu Dec 23 15:47:41 2021 +1100
Changeset:	d7db0922c8d4f9dadca38bc29568c84dfa611fc5

Modified Files:
	prusaslicer/Makefile
	prusaslicer/PLIST
	prusaslicer/distinfo
	prusaslicer/patches/patch-CMakeLists.txt
	prusaslicer/patches/patch-cmake_modules_FindOpenVDB.cmake
	prusaslicer/patches/patch-src_CMakeLists_txt
	prusaslicer/patches/patch-src_libslic3r_Platform.cpp
	prusaslicer/patches/patch-src_libslic3r_Platform.hpp
	prusaslicer/patches/patch-src_libslic3r_Thread.cpp
	prusaslicer/patches/patch-src_slic3r_GUI_InstanceCheck.hpp
	prusaslicer/patches/patch-src_slic3r_GUI_Mouse3DController.cpp
	prusaslicer/patches/patch-src_slic3r_GUI_Mouse3DController.hpp
	prusaslicer/patches/patch-src_slic3r_GUI_RemovableDriveManager.cpp
Added Files:
	prusaslicer/patches/patch-src_libslic3r_LocalesUtils.cpp
	prusaslicer/patches/patch-src_libslic3r_LocalesUtils.hpp
	prusaslicer/patches/patch-src_slic3r_GUI_ConfigWizard.cpp
	prusaslicer/patches/patch-src_slic3r_GUI_ConfigWizard__private.hpp
	prusaslicer/patches/patch-src_slic3r_GUI_DesktopIntegrationDialog.cpp
	prusaslicer/patches/patch-src_slic3r_GUI_DesktopIntegrationDialog.hpp
	prusaslicer/patches/patch-src_slic3r_GUI_ExtraRenderers.cpp
	prusaslicer/patches/patch-src_slic3r_GUI_GLCanvas3D.cpp
	prusaslicer/patches/patch-src_slic3r_GUI_GUI__App.cpp
	prusaslicer/patches/patch-src_slic3r_GUI_GUI__App.hpp
	prusaslicer/patches/patch-src_slic3r_GUI_GUI__Preview.cpp
	prusaslicer/patches/patch-src_slic3r_GUI_GUI__Preview.hpp
	prusaslicer/patches/patch-src_slic3r_GUI_GUI__Utils.cpp
	prusaslicer/patches/patch-src_slic3r_GUI_HintNotification.cpp
	prusaslicer/patches/patch-src_slic3r_GUI_NotificationManager.cpp
	prusaslicer/patches/patch-src_slic3r_GUI_Plater.cpp
	prusaslicer/patches/patch-src_slic3r_GUI_PresetComboBoxes.cpp
	prusaslicer/patches/patch-src_slic3r_GUI_PresetComboBoxes.hpp
	prusaslicer/patches/patch-src_slic3r_GUI_PrintHostDialogs.cpp
	prusaslicer/patches/patch-src_slic3r_GUI_Tab.cpp
	prusaslicer/patches/patch-src_slic3r_GUI_UnsavedChangesDialog.cpp
	prusaslicer/patches/patch-src_slic3r_GUI_UnsavedChangesDialog.hpp
	prusaslicer/patches/patch-src_slic3r_GUI_wxExtensions.cpp
Removed Files:
	prusaslicer/patches/patch-cmake_modules_FindTBB.cmake
	prusaslicer/patches/patch-src_PrusaSlicer.cpp
	prusaslicer/patches/patch-src_libslic3r_Print.cpp
	prusaslicer/patches/patch-src_libslic3r_PrintBase.cpp
	prusaslicer/patches/patch-src_libslic3r_PrintBase.hpp
	prusaslicer/patches/patch-src_libslic3r_PrintObject.cpp
	prusaslicer/patches/patch-src_libslic3r_SLAPrint.cpp
	prusaslicer/patches/patch-src_libslic3r_SLA_Concurrency.hpp
	prusaslicer/patches/patch-src_libslic3r_SLA_SupportTree.cpp
	prusaslicer/patches/patch-src_libslic3r_SupportMaterial.cpp
	prusaslicer/patches/patch-src_libslic3r_pchheader.hpp
	prusaslicer/patches/patch-src_libslic3r_utils.cpp
	prusaslicer/patches/patch-src_slic3r_GUI_BackgroundSlicingProcess.cpp
	prusaslicer/patches/patch-src_slic3r_GUI_BackgroundSlicingProcess.hpp
	prusaslicer/patches/patch-src_slic3r_GUI_RemovableDriveManager.hpp

Log Message:
prusaslicer: Update to release 2.4.0

Noteworthy changes:
- Multi material painting
- Bottom layers bridges
- FDM supports improvements
- FDM support generator bugfixes
- FDM Raft enhancements
- First layer height
- Brim and skirt enhancements
- Negative volumes, modifier & extruder override rules
- Fuzzy skin
- Multi-material wipe tower
- Support for 3DLabPrint airplane models
- Sequential print
- G-code generator, firmware flavors
- G-code viewer improvements
- Arrangement, SLA auto-orientation
- SLA improvements and bugfixes
- Project state
- Moving the object below the print bed
- Automatic Color Print for signs
- Shape Gallery
- Windows Dark Mode
- "Did you know" aka "Tip of the day" notifications
- Upload progress
- Mesh simplification
- Other UI improvements

Full release change log available at:
- https://github.com/prusa3d/PrusaSlicer/wiki/PrusaSlicer-2.4.0-alpha1-full-change-log

Additional bugfixes:
- https://github.com/prusa3d/PrusaSlicer/releases/tag/version_2.4.0-alpha2
- https://github.com/prusa3d/PrusaSlicer/releases/tag/version_2.4.0-alpha3
- https://github.com/prusa3d/PrusaSlicer/releases/tag/version_2.4.0-beta1
- https://github.com/prusa3d/PrusaSlicer/releases/tag/version_2.4.0-beta2
- https://github.com/prusa3d/PrusaSlicer/releases/tag/version_2.4.0-beta3
- https://github.com/prusa3d/PrusaSlicer/releases/tag/version_2.4.0-beta4
- https://github.com/prusa3d/PrusaSlicer/releases/tag/version_2.4.0-rc
- https://github.com/prusa3d/PrusaSlicer/releases/tag/version_2.4.0-rc2
- https://github.com/prusa3d/PrusaSlicer/releases/tag/version_2.4.0

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=d7db0922c8d4f9dadca38bc29568c84dfa611fc5

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 prusaslicer/Makefile                               |  17 +-
 prusaslicer/PLIST                                  | 228 +++++------
 prusaslicer/distinfo                               |  65 ++--
 prusaslicer/patches/patch-CMakeLists.txt           |   8 +-
 .../patches/patch-cmake_modules_FindOpenVDB.cmake  | 101 +++--
 .../patches/patch-cmake_modules_FindTBB.cmake      | 420 ---------------------
 prusaslicer/patches/patch-src_CMakeLists_txt       |  12 +-
 prusaslicer/patches/patch-src_PrusaSlicer.cpp      |  30 --
 .../patches/patch-src_libslic3r_LocalesUtils.cpp   |  38 ++
 .../patches/patch-src_libslic3r_LocalesUtils.hpp   |  15 +
 .../patches/patch-src_libslic3r_Platform.cpp       |  12 +-
 .../patches/patch-src_libslic3r_Platform.hpp       |  26 +-
 prusaslicer/patches/patch-src_libslic3r_Print.cpp  |  34 --
 .../patches/patch-src_libslic3r_PrintBase.cpp      |  16 -
 .../patches/patch-src_libslic3r_PrintBase.hpp      | 122 ------
 .../patches/patch-src_libslic3r_PrintObject.cpp    |  15 -
 .../patches/patch-src_libslic3r_SLAPrint.cpp       |  52 ---
 .../patch-src_libslic3r_SLA_Concurrency.hpp        |  29 --
 .../patch-src_libslic3r_SLA_SupportTree.cpp        |  17 -
 .../patch-src_libslic3r_SupportMaterial.cpp        |  15 -
 prusaslicer/patches/patch-src_libslic3r_Thread.cpp |  59 +--
 .../patches/patch-src_libslic3r_pchheader.hpp      |  20 -
 prusaslicer/patches/patch-src_libslic3r_utils.cpp  |  27 --
 ...tch-src_slic3r_GUI_BackgroundSlicingProcess.cpp |  34 --
 ...tch-src_slic3r_GUI_BackgroundSlicingProcess.hpp |  16 -
 .../patches/patch-src_slic3r_GUI_ConfigWizard.cpp  |  33 ++
 .../patch-src_slic3r_GUI_ConfigWizard__private.hpp |  15 +
 ...tch-src_slic3r_GUI_DesktopIntegrationDialog.cpp |  19 +
 ...tch-src_slic3r_GUI_DesktopIntegrationDialog.hpp |  19 +
 .../patch-src_slic3r_GUI_ExtraRenderers.cpp        |  15 +
 .../patches/patch-src_slic3r_GUI_GLCanvas3D.cpp    |  15 +
 .../patches/patch-src_slic3r_GUI_GUI__App.cpp      | 114 ++++++
 .../patches/patch-src_slic3r_GUI_GUI__App.hpp      |  15 +
 .../patches/patch-src_slic3r_GUI_GUI__Preview.cpp  |  32 ++
 .../patches/patch-src_slic3r_GUI_GUI__Preview.hpp  |  15 +
 .../patches/patch-src_slic3r_GUI_GUI__Utils.cpp    |  15 +
 .../patch-src_slic3r_GUI_HintNotification.cpp      |  25 ++
 .../patches/patch-src_slic3r_GUI_InstanceCheck.hpp |  22 +-
 .../patch-src_slic3r_GUI_Mouse3DController.cpp     | 171 +--------
 .../patch-src_slic3r_GUI_Mouse3DController.hpp     |  49 +--
 .../patch-src_slic3r_GUI_NotificationManager.cpp   |  18 +
 .../patches/patch-src_slic3r_GUI_Plater.cpp        |  15 +
 .../patch-src_slic3r_GUI_PresetComboBoxes.cpp      |  24 ++
 .../patch-src_slic3r_GUI_PresetComboBoxes.hpp      |  15 +
 .../patch-src_slic3r_GUI_PrintHostDialogs.cpp      |  15 +
 .../patch-src_slic3r_GUI_RemovableDriveManager.cpp | 116 +-----
 .../patch-src_slic3r_GUI_RemovableDriveManager.hpp |  28 --
 prusaslicer/patches/patch-src_slic3r_GUI_Tab.cpp   |  51 +++
 .../patch-src_slic3r_GUI_UnsavedChangesDialog.cpp  |  60 +++
 .../patch-src_slic3r_GUI_UnsavedChangesDialog.hpp  |  24 ++
 .../patches/patch-src_slic3r_GUI_wxExtensions.cpp  |  27 ++
 51 files changed, 958 insertions(+), 1437 deletions(-)

diffs:
diff --git a/prusaslicer/Makefile b/prusaslicer/Makefile
index fabeccc49c..9d21ef3c03 100644
--- a/prusaslicer/Makefile
+++ b/prusaslicer/Makefile
@@ -1,11 +1,12 @@
 # $NetBSD$
 
-PKGNAME=	${DISTNAME:tl}
-DISTNAME=	PrusaSlicer-2.3.3
+PKGVERSION=	2.4.0
+PKGNAME=	prusaslicer-${PKGVERSION}
+DISTNAME=	PrusaSlicer-${PKGVERSION:S/rc/-rc/}
 CATEGORIES=	cad
 MASTER_SITES=	${MASTER_SITE_GITHUB:=prusa3d/}
 GITHUB_PROJECT=	PrusaSlicer
-GITHUB_TAG=	version_${PKGVERSION_NOREV}
+GITHUB_TAG=	version_${PKGVERSION:S/rc/-rc/}
 # Needed, else we strip the 'v' and look for "ersion".
 WRKSRC=		${WRKDIR}/${GITHUB_PROJECT}-${GITHUB_TAG}
 
@@ -16,29 +17,32 @@ LICENSE=	gnu-agpl-v3
 
 ONLY_FOR_PLATFORM=	*-*-aarch64 *-*-x86_64 *-*-earmv6 *-*-earmv7 *-*-i386
 
-USE_LANGUAGES=	c c++
+GCC_REQD+=	10
+USE_LANGUAGES=	c c++17
 USE_TOOLS+=	cmake gmake
 USE_CMAKE=	yes
 
 .include "../../mk/bsd.prefs.mk"
 
 CMAKE_ARGS+=	-DSLIC3R_WX_STABLE=1
+#CMAKE_ARGS+=	-DCMAKE_CXX_FLAGS=-g
 
 .include "../../comms/libhidapi/buildlink3.mk"
 .include "../../databases/shared-mime-info/buildlink3.mk"
+.include "../../devel/at-spi2-atk/buildlink3.mk"
 .include "../../devel/atk/buildlink3.mk"
 .include "../../devel/boost-headers/buildlink3.mk"
-.include "../../devel/glib/buildlink3.mk"
+.include "../../devel/glib2/buildlink3.mk"
 .include "../../devel/pango/buildlink3.mk"
 .include "../../devel/wayland/buildlink3.mk"
 .include "../../devel/zlib/buildlink3.mk"
-.include "../../devel/zlib/buildlink3.mk"
 .include "../../fonts/fontconfig/buildlink3.mk"
 .include "../../graphics/cairo/buildlink3.mk"
 .include "../../graphics/freetype2/buildlink3.mk"
 .include "../../graphics/glew/buildlink3.mk"
 .include "../../graphics/graphite2/buildlink3.mk"
 .include "../../graphics/png/buildlink3.mk"
+.include "../../graphics/tiff/buildlink3.mk"
 .include "../../math/cgal/buildlink3.mk"
 .include "../../math/eigen3/buildlink3.mk"
 .include "../../math/imath/buildlink3.mk"
@@ -50,6 +54,7 @@ CMAKE_ARGS+=	-DSLIC3R_WX_STABLE=1
 .include "../../wip/nlopt/buildlink3.mk"
 .include "../../wip/openvdb/buildlink3.mk"
 .include "../../www/curl/buildlink3.mk"
+.include "../../x11/xcursor/buildlink3.mk"
 .include "../../x11/gtk3/buildlink3.mk"
 .include "../../x11/wxGTK30/buildlink3.mk"
 .include "../../x11/xcb-proto/buildlink3.mk"
diff --git a/prusaslicer/PLIST b/prusaslicer/PLIST
index 707e9d0eef..4d03bc307f 100644
--- a/prusaslicer/PLIST
+++ b/prusaslicer/PLIST
@@ -3,19 +3,22 @@ bin/prusa-gcodeviewer
 bin/prusa-slicer
 resources/applications/PrusaGcodeviewer.desktop
 resources/applications/PrusaSlicer.desktop
-resources/data/flatpak/com.prusa3d.PrusaSlicer.desktop
-resources/data/flatpak/com.prusa3d.PrusaSlicer.metainfo.xml
+resources/data/hints.ini
 resources/fonts/NotoSans-Regular.ttf
 resources/fonts/NotoSansCJK-Regular.ttc
 resources/fonts/README.txt
 resources/icons/Pmetal_001.png
+resources/icons/PrusaSlicer-gcodeviewer-mac_128px.png
 resources/icons/PrusaSlicer-gcodeviewer.ico
+resources/icons/PrusaSlicer-gcodeviewer.svg
 resources/icons/PrusaSlicer-gcodeviewer_128px.png
 resources/icons/PrusaSlicer-gcodeviewer_192px.png
 resources/icons/PrusaSlicer-gcodeviewer_32px.png
+resources/icons/PrusaSlicer-mac_128px.png
 resources/icons/PrusaSlicer.icns
 resources/icons/PrusaSlicer.ico
 resources/icons/PrusaSlicer.png
+resources/icons/PrusaSlicer.svg
 resources/icons/PrusaSlicer_128px.png
 resources/icons/PrusaSlicer_192px.png
 resources/icons/PrusaSlicer_192px_grayscale.png
@@ -25,6 +28,7 @@ resources/icons/add.svg
 resources/icons/add_copies.svg
 resources/icons/add_gcode.svg
 resources/icons/add_modifier.svg
+resources/icons/add_negative.svg
 resources/icons/add_part.svg
 resources/icons/advanced_plus.svg
 resources/icons/arrange.svg
@@ -42,12 +46,9 @@ resources/icons/collapse.svg
 resources/icons/colorchange_add.svg
 resources/icons/colorchange_add_f.svg
 resources/icons/colorchange_add_m.svg
-resources/icons/colorchange_add_off.png
-resources/icons/colorchange_add_on.png
 resources/icons/colorchange_del.svg
 resources/icons/colorchange_del_f.svg
-resources/icons/colorchange_delete_off.png
-resources/icons/colorchange_delete_on.png
+resources/icons/compare.svg
 resources/icons/cooling.svg
 resources/icons/copy.svg
 resources/icons/copy_menu.svg
@@ -61,8 +62,8 @@ resources/icons/delete_all_menu.svg
 resources/icons/dot.svg
 resources/icons/dot_small.svg
 resources/icons/dot_white.svg
-resources/icons/down_half_circle.png
 resources/icons/drop_to_bed.svg
+resources/icons/edit_button.svg
 resources/icons/edit_gcode.svg
 resources/icons/edit_gcode_f.svg
 resources/icons/edit_layers_all.svg
@@ -72,9 +73,11 @@ resources/icons/editor.svg
 resources/icons/editor_menu.svg
 resources/icons/eject_sd.svg
 resources/icons/empty.svg
+resources/icons/equal.svg
 resources/icons/error_tick.svg
 resources/icons/error_tick_f.svg
 resources/icons/exclamation.svg
+resources/icons/exclamation_manifold.svg
 resources/icons/exit.svg
 resources/icons/export_config.svg
 resources/icons/export_config_bundle.svg
@@ -84,9 +87,11 @@ resources/icons/export_to_sd.svg
 resources/icons/eye_closed.svg
 resources/icons/eye_open.svg
 resources/icons/fdm_supports.svg
+resources/icons/fdm_supports_.svg
 resources/icons/flag_green.svg
 resources/icons/flag_red.svg
 resources/icons/funnel.svg
+resources/icons/fuzzy_skin.svg
 resources/icons/gcode.icns
 resources/icons/hollow.svg
 resources/icons/hollowing.svg
@@ -100,7 +105,7 @@ resources/icons/instance_remove.svg
 resources/icons/ironing.svg
 resources/icons/layers.svg
 resources/icons/layers_white.svg
-resources/icons/left_half_circle.png
+resources/icons/lock.svg
 resources/icons/lock_closed.svg
 resources/icons/lock_closed_f.svg
 resources/icons/lock_closed_white.svg
@@ -112,37 +117,40 @@ resources/icons/mark_Y.svg
 resources/icons/mark_Z.svg
 resources/icons/mirroring_off.svg
 resources/icons/mirroring_on.svg
-resources/icons/mirroring_transparent.png
+resources/icons/mirroring_transparent.svg
+resources/icons/mmu_segmentation.svg
+resources/icons/mmu_segmentation_.svg
 resources/icons/mode_advanced.svg
-resources/icons/mode_advanced_.png
-resources/icons/mode_advanced_sq.png
 resources/icons/mode_expert.svg
-resources/icons/mode_expert_.png
-resources/icons/mode_expert_sq.png
 resources/icons/mode_simple.svg
-resources/icons/mode_simple_.png
-resources/icons/mode_simple_sq.png
 resources/icons/move.svg
+resources/icons/not_equal.svg
 resources/icons/note.svg
+resources/icons/notification_cancel.svg
+resources/icons/notification_cancel_hover.svg
+resources/icons/notification_clippy.svg
 resources/icons/notification_close.svg
 resources/icons/notification_close_hover.svg
+resources/icons/notification_documentation.svg
+resources/icons/notification_documentation_hover.svg
 resources/icons/notification_eject_sd.svg
 resources/icons/notification_eject_sd_hover.svg
 resources/icons/notification_error.svg
+resources/icons/notification_info.svg
 resources/icons/notification_minimalize.svg
 resources/icons/notification_minimalize_hover.svg
+resources/icons/notification_preferences.svg
+resources/icons/notification_preferences_hover.svg
+resources/icons/notification_right.svg
+resources/icons/notification_right_hover.svg
 resources/icons/notification_warning.svg
 resources/icons/number_of_copies.svg
-resources/icons/one_layer_lock_off.png
-resources/icons/one_layer_lock_on.png
-resources/icons/one_layer_unlock_off.png
-resources/icons/one_layer_unlock_on.png
+resources/icons/objlist_info.svg
 resources/icons/open.svg
 resources/icons/output+page_white.svg
 resources/icons/pad.svg
 resources/icons/paste.svg
 resources/icons/paste_menu.svg
-resources/icons/pause_add.png
 resources/icons/pause_print.svg
 resources/icons/pause_print_f.svg
 resources/icons/place.svg
@@ -152,7 +160,6 @@ resources/icons/preview_menu.svg
 resources/icons/printer.svg
 resources/icons/printer_placeholder.png
 resources/icons/printer_white.svg
-resources/icons/prusa_slicer_logo.svg
 resources/icons/question.svg
 resources/icons/re_slice.svg
 resources/icons/redo.svg
@@ -163,19 +170,19 @@ resources/icons/remove_copies.svg
 resources/icons/remove_menu.svg
 resources/icons/resin.svg
 resources/icons/revert_all_.svg
-resources/icons/right_half_circle.png
 resources/icons/rotate.svg
-resources/icons/row.png
 resources/icons/save.svg
 resources/icons/scale.svg
 resources/icons/seam.svg
+resources/icons/seam_.svg
 resources/icons/search.svg
 resources/icons/search_.svg
 resources/icons/search_blink.svg
 resources/icons/search_gray.svg
 resources/icons/set_separate_obj.svg
 resources/icons/settings.svg
-resources/icons/shape_ungroup.png
+resources/icons/shape_gallery.svg
+resources/icons/sinking.svg
 resources/icons/skirt+brim.svg
 resources/icons/sla_printer.svg
 resources/icons/sla_supports.svg
@@ -191,7 +198,6 @@ resources/icons/support.svg
 resources/icons/support_blocker.svg
 resources/icons/support_enforcer.svg
 resources/icons/switch_presets.svg
-resources/icons/table.png
 resources/icons/test.svg
 resources/icons/thumb_down.svg
 resources/icons/thumb_left.svg
@@ -201,94 +207,17 @@ resources/icons/tick_mark.svg
 resources/icons/time.svg
 resources/icons/timer_dot.svg
 resources/icons/timer_dot_empty.svg
+resources/icons/toolbar_arrow.svg
 resources/icons/toolbar_background.png
 resources/icons/undo.svg
 resources/icons/undo_menu.svg
 resources/icons/undo_toolbar.svg
-resources/icons/up_half_circle.png
 resources/icons/upload_queue.svg
-resources/icons/variable_layer_height_reset.png
-resources/icons/variable_layer_height_tooltip.png
-resources/icons/white/add_copies.svg
-resources/icons/white/add_modifier.svg
-resources/icons/white/add_part.svg
-resources/icons/white/advanced+wrench.svg
-resources/icons/white/advanced_plus.svg
-resources/icons/white/cog.svg
-resources/icons/white/cooling.svg
-resources/icons/white/copy_menu.svg
-resources/icons/white/delete.svg
-resources/icons/white/delete_all_menu.svg
-resources/icons/white/dot.svg
-resources/icons/white/dot_small.svg
-resources/icons/white/drop_to_bed.svg
-resources/icons/white/edit_layers_all.svg
-resources/icons/white/edit_layers_some.svg
-resources/icons/white/edit_uni.svg
-resources/icons/white/editor_menu.svg
-resources/icons/white/exit.svg
-resources/icons/white/export_config.svg
-resources/icons/white/export_config_bundle.svg
-resources/icons/white/export_gcode.svg
-resources/icons/white/export_plate.svg
-resources/icons/white/export_plater.svg
-resources/icons/white/export_to_sd.svg
-resources/icons/white/extruder+funnel.svg
-resources/icons/white/eye_closed.svg
-resources/icons/white/eye_open.svg
-resources/icons/white/flag_green.svg
-resources/icons/white/flag_red.svg
-resources/icons/white/funnel.svg
-resources/icons/white/hollowing.svg
-resources/icons/white/import_config.svg
-resources/icons/white/import_config_bundle.svg
-resources/icons/white/import_plate.svg
-resources/icons/white/import_plater.svg
-resources/icons/white/infill.svg
-resources/icons/white/info.svg
-resources/icons/white/layers.svg
-resources/icons/white/lock2_closed.svg
-resources/icons/white/lock_closed.svg
-resources/icons/white/lock_closed_f.svg
-resources/icons/white/lock_open_sys.svg
-resources/icons/white/machine+cog.svg
-resources/icons/white/mirroring_off.svg
-resources/icons/white/mirroring_on.svg
-resources/icons/white/note.svg
-resources/icons/white/notes.svg
-resources/icons/white/number_of_copies.svg
-resources/icons/white/open.svg
-resources/icons/white/output+page_white.svg
-resources/icons/white/pad.svg
-resources/icons/white/paste_menu.svg
-resources/icons/white/plater.svg
-resources/icons/white/preview_menu.svg
-resources/icons/white/printer.svg
-resources/icons/white/re_slice.svg
-resources/icons/white/redo_menu.svg
-resources/icons/white/remove_copies.svg
-resources/icons/white/remove_menu.svg
-resources/icons/white/resin.svg
-resources/icons/white/save.svg
-resources/icons/white/search.svg
-resources/icons/white/set_separate_obj.svg
-resources/icons/white/skirt+brim.svg
-resources/icons/white/sla_printer.svg
-resources/icons/white/split_object_SMALL.svg
-resources/icons/white/split_parts_SMALL.svg
-resources/icons/white/spool.svg
-resources/icons/white/support.svg
-resources/icons/white/support_blocker.svg
-resources/icons/white/support_enforcer.svg
-resources/icons/white/switch_presets.svg
-resources/icons/white/test.svg
-resources/icons/white/time.svg
-resources/icons/white/undo_menu.svg
-resources/icons/white/upload_queue.svg
-resources/icons/white/wrench.svg
 resources/icons/wrench.svg
 resources/icons/wrench_white.svg
 resources/localization/PrusaSlicer.pot
+resources/localization/ca/PrusaSlicer.mo
+resources/localization/ca/PrusaSlicer_ca.po
 resources/localization/cs/PrusaSlicer.mo
 resources/localization/cs/PrusaSlicer_cs.po
 resources/localization/de/PrusaSlicer.mo
@@ -305,23 +234,27 @@ resources/localization/ja/PrusaSlicer.mo
 resources/localization/ja/PrusaSlicer_ja.po
 resources/localization/ko/PrusaSlicer.mo
 resources/localization/ko/PrusaSlicer_ko_KR.po
+resources/localization/ko_KR/PrusaSlicer.mo
+resources/localization/ko_KR/PrusaSlicer_ko.po
+resources/localization/ko_KR/PrusaSlicer_ko_KR.mo
+resources/localization/ko_KR/PrusaSlicer_ko_KR.po
 resources/localization/list.txt
 resources/localization/nl/PrusaSlicer.mo
 resources/localization/nl/PrusaSlicer_nl.po
 resources/localization/pl/PrusaSlicer.mo
 resources/localization/pl/PrusaSlicer_pl.po
-resources/localization/pt_br/PrusaSlicer.mo
-resources/localization/pt_br/PrusaSlicer_pt_br.po
+resources/localization/pt_BR/PrusaSlicer.mo
+resources/localization/pt_BR/PrusaSlicer_pt_BR.po
 resources/localization/ru/PrusaSlicer.mo
 resources/localization/ru/PrusaSlicer_ru.po
 resources/localization/tr/PrusaSlicer.mo
 resources/localization/tr/PrusaSlicer_tr.po
 resources/localization/uk/PrusaSlicer.mo
 resources/localization/uk/PrusaSlicer_uk.po
-resources/localization/zh_cn/PrusaSlicer.mo
-resources/localization/zh_cn/PrusaSlicer_zh_CN.po
-resources/localization/zh_tw/PrusaSlicer.mo
-resources/localization/zh_tw/PrusaSlicer_zh_TW.po
+resources/localization/zh_CN/PrusaSlicer.mo
+resources/localization/zh_CN/PrusaSlicer_zh_CN.po
+resources/localization/zh_TW/PrusaSlicer.mo
+resources/localization/zh_TW/PrusaSlicer_zh_TW.po
 resources/profiles/Anycubic.idx
 resources/profiles/Anycubic.ini
 resources/profiles/Anycubic/AK.png
@@ -374,9 +307,11 @@ resources/profiles/Creality/CR6SE_thumbnail.png
 resources/profiles/Creality/CR8_thumbnail.png
 resources/profiles/Creality/CRXPRO_thumbnail.png
 resources/profiles/Creality/CRX_thumbnail.png
+resources/profiles/Creality/ENDER2PRO_thumbnail.png
 resources/profiles/Creality/ENDER2_thumbnail.png
 resources/profiles/Creality/ENDER3BLTOUCH_thumbnail.png
 resources/profiles/Creality/ENDER3MAX_thumbnail.png
+resources/profiles/Creality/ENDER3S1_thumbnail.png
 resources/profiles/Creality/ENDER3V2_thumbnail.png
 resources/profiles/Creality/ENDER3_thumbnail.png
 resources/profiles/Creality/ENDER4_thumbnail.png
@@ -408,6 +343,8 @@ resources/profiles/Creality/cr8.svg
 resources/profiles/Creality/cr8_bed.stl
 resources/profiles/Creality/ender2.svg
 resources/profiles/Creality/ender2_bed.stl
+resources/profiles/Creality/ender2pro.svg
+resources/profiles/Creality/ender2pro_bed.stl
 resources/profiles/Creality/ender3.svg
 resources/profiles/Creality/ender3_bed.stl
 resources/profiles/Creality/ender3v2.svg
@@ -476,11 +413,56 @@ resources/profiles/TriLAB/DQXL_thumbnail.png
 resources/profiles/TriLAB/aq_bed.stl
 resources/profiles/TriLAB/aqp_bed.stl
 resources/profiles/TriLAB/dq2_bed.stl
+resources/profiles/Ultimaker.idx
+resources/profiles/Ultimaker.ini
+resources/profiles/Ultimaker/ULTIMAKER2_thumbnail.png
+resources/profiles/Ultimaker/ultimaker2.svg
+resources/profiles/Ultimaker/ultimaker2_bed.stl
+resources/profiles/Voron.idx
+resources/profiles/Voron.ini
+resources/profiles/Voron/Voron_v0_120_thumbnail.png
+resources/profiles/Voron/Voron_v1_250_afterburner_thumbnail.png
+resources/profiles/Voron/Voron_v1_300_afterburner_thumbnail.png
+resources/profiles/Voron/Voron_v2_250_afterburner_thumbnail.png
+resources/profiles/Voron/Voron_v2_250_thumbnail.png
+resources/profiles/Voron/Voron_v2_300_afterburner_thumbnail.png
+resources/profiles/Voron/Voron_v2_300_thumbnail.png
+resources/profiles/Voron/Voron_v2_350_afterburner_thumbnail.png
+resources/profiles/Voron/Voron_v2_350_thumbnail.png
+resources/profiles/Voron/bedtexture-v0-120.png
+resources/profiles/Voron/bedtexture-v1-250.png
+resources/profiles/Voron/bedtexture-v1-300.png
+resources/profiles/Voron/bedtexture-v2-250.png
+resources/profiles/Voron/bedtexture-v2-300.png
+resources/profiles/Voron/bedtexture-v2-350.png
+resources/profiles/Voron/printbed-v0-120.stl
+resources/profiles/Voron/printbed-v1-250.stl
+resources/profiles/Voron/printbed-v1-300.stl
+resources/profiles/Voron/printbed-v2-250.stl
+resources/profiles/Voron/printbed-v2-300.stl
+resources/profiles/Voron/printbed-v2-350.stl
+resources/profiles/gCreate.idx
+resources/profiles/gCreate.ini
+resources/profiles/gCreate/GMAX15P_thumbnail.png
+resources/profiles/gCreate/GMAX2DUAL2IN1_thumbnail.png
+resources/profiles/gCreate/GMAX2DUAL_thumbnail.png
+resources/profiles/gCreate/GMAX2PRO_thumbnail.png
+resources/profiles/gCreate/GMAX2_thumbnail.png
+resources/profiles/gCreate/gmax15p.svg
+resources/profiles/gCreate/gmax15p_bed.stl
+resources/profiles/gCreate/gmax2.svg
+resources/profiles/gCreate/gmax2_bed.stl
 resources/resources
 resources/shaders/gouraud.fs
 resources/shaders/gouraud.vs
 resources/shaders/gouraud_light.fs
 resources/shaders/gouraud_light.vs
+resources/shaders/gouraud_light_instanced.fs
+resources/shaders/gouraud_light_instanced.vs
+resources/shaders/mm_contour.fs
+resources/shaders/mm_contour.vs
+resources/shaders/mm_gouraud.fs
+resources/shaders/mm_gouraud.vs
 resources/shaders/options_110.fs
 resources/shaders/options_110.vs
 resources/shaders/options_120.fs
@@ -491,4 +473,28 @@ resources/shaders/toolpaths_lines.fs
 resources/shaders/toolpaths_lines.vs
 resources/shaders/variable_layer_height.fs
 resources/shaders/variable_layer_height.vs
+resources/shapes/M3_hex_nut.png
+resources/shapes/M3_hex_nut.stl
+resources/shapes/M3x10_screw.png
+resources/shapes/M3x10_screw.stl
+resources/shapes/OTHER_recycling_symbol.png
+resources/shapes/OTHER_recycling_symbol.stl
+resources/shapes/PETG_recycling_symbol.png
+resources/shapes/PETG_recycling_symbol.stl
+resources/shapes/box.png
+resources/shapes/box.stl
+resources/shapes/bunny.png
+resources/shapes/bunny.stl
+resources/shapes/cone.png
+resources/shapes/cone.stl
+resources/shapes/cylinder.png
+resources/shapes/cylinder.stl
+resources/shapes/helper_disk.png
+resources/shapes/helper_disk.stl
+resources/shapes/pyramid.png
+resources/shapes/pyramid.stl
+resources/shapes/sphere.png
+resources/shapes/sphere.stl
+resources/shapes/torus.png
+resources/shapes/torus.stl
 resources/udev/90-3dconnexion.rules
diff --git a/prusaslicer/distinfo b/prusaslicer/distinfo
index 60279c7702..e577fcf72b 100644
--- a/prusaslicer/distinfo
+++ b/prusaslicer/distinfo
@@ -1,33 +1,42 @@
 $NetBSD$
 
-RMD160 (PrusaSlicer-2.3.3.tar.gz) = a9a26c6042d65b28dde3f4d6384780fe3a18b76f
-SHA512 (PrusaSlicer-2.3.3.tar.gz) = 1f6b97e135202ad9de8f0bb212239ce2497de4205ea32f860b483473fb1f1783451d539a67cd97ef31f512a797b29c1067a1eff4134ea4a29b6218e5757657e2
-Size (PrusaSlicer-2.3.3.tar.gz) = 40659538 bytes
-SHA1 (patch-CMakeLists.txt) = bea477c9b88165a3debc6a77888aae9ee039aeb3
-SHA1 (patch-cmake_modules_FindOpenVDB.cmake) = 1ea4326710edb5a7638beed9693e99bbaafd0276
-SHA1 (patch-cmake_modules_FindTBB.cmake) = bb2e4fcc30d0f98b082ecbe98c0c2032488e53f8
-SHA1 (patch-src_CMakeLists_txt) = 1ec421e911ef96ae412643216080e1f26e5282c4
-SHA1 (patch-src_PrusaSlicer.cpp) = 130cfa729f8daf68a76a3face4934dfa55dcdb80
+SHA1 (PrusaSlicer-2.4.0.tar.gz) = 8f9d41a403da21eaf5c52e21acc2180c3d1f8537
+RMD160 (PrusaSlicer-2.4.0.tar.gz) = b2246c5c695ce4bfe495a6126812888b43a1cd0d
+SHA512 (PrusaSlicer-2.4.0.tar.gz) = e923e4e6273dbcfc3e2bc0e28f9eb8cda8530747c0a834f48aea715d75ba1d02be9cfee043689efccdaee40de00114f7964e43accad245b9acd801b997868e3c
+Size (PrusaSlicer-2.4.0.tar.gz) = 46397442 bytes
+SHA1 (patch-CMakeLists.txt) = 9d6c8e2f1f491b18b6781799bd5e99775e3e3e79
+SHA1 (patch-cmake_modules_FindOpenVDB.cmake) = 4f2afc423a70fe60617b33ff7f26859b39775faa
+SHA1 (patch-src_CMakeLists_txt) = 1a65b80d1e1008a7ca218b9f840e66c4923a4b3a
 SHA1 (patch-src_avrdude_arduino.c) = ff02a4cab1c2d8c82ec7b22c7447ed5ec360ac57
 SHA1 (patch-src_avrdude_libavrdude.h) = 62d48054b147985249664f257dbd8bbd670df233
-SHA1 (patch-src_libslic3r_Platform.cpp) = bc417c037cf26f0c72c34bfd2c44ea7ebd177e9e
-SHA1 (patch-src_libslic3r_Platform.hpp) = 5cb5946e30c8cfad305a6d6ee2efd2718eeadeb3
-SHA1 (patch-src_libslic3r_Print.cpp) = 9b8363c3550e5bb66a475ef3db2960ae07b860b8
-SHA1 (patch-src_libslic3r_PrintBase.cpp) = 1ecc626f929a0efbffae99219a771bb0d57465cd
-SHA1 (patch-src_libslic3r_PrintBase.hpp) = 8e42b2356c82fa5864975df4a1872f06d757a9f0
-SHA1 (patch-src_libslic3r_PrintObject.cpp) = b9c2fbd23d901ca5396fc0d5d5c85c26dad2f259
-SHA1 (patch-src_libslic3r_SLAPrint.cpp) = 3ba47b00ba00557cc6d7f6a1e055949a3f0eb0a9
-SHA1 (patch-src_libslic3r_SLA_Concurrency.hpp) = f64e4c2ebf8348972db54472e745ca1e4e6951b3
-SHA1 (patch-src_libslic3r_SLA_SupportTree.cpp) = 98e857e28642e2da7344ba94580c27845d277617
-SHA1 (patch-src_libslic3r_SupportMaterial.cpp) = 14d196e8a983bc2151b2003f0659a731c2738e5e
-SHA1 (patch-src_libslic3r_Thread.cpp) = b58e64288f81c6344de80923aad14ddc12a4aa0a
-SHA1 (patch-src_libslic3r_pchheader.hpp) = 95d15bceb7140e6895bedaa4513531dd90855abe
-SHA1 (patch-src_libslic3r_utils.cpp) = 33d04b0883198091531c444b595e9e29b8d9f165
-SHA1 (patch-src_slic3r_GUI_BackgroundSlicingProcess.cpp) = 15b0d124e6a75f9c198bc4d14c7712d46b8ac099
-SHA1 (patch-src_slic3r_GUI_BackgroundSlicingProcess.hpp) = b22658059ad2cc3c3ec510949157922ca7c79d54
+SHA1 (patch-src_libslic3r_LocalesUtils.cpp) = 33a473cadbc05eba7f0c218110e53babea36568c
+SHA1 (patch-src_libslic3r_LocalesUtils.hpp) = 7339ef576cbd16f30271c13b706d2487ae78b457
+SHA1 (patch-src_libslic3r_Platform.cpp) = 3066585efc98ba4963e41bda5952df38a7b095a0
+SHA1 (patch-src_libslic3r_Platform.hpp) = 5626058616d04396bff6c8550951d04fe03249e4
+SHA1 (patch-src_libslic3r_Thread.cpp) = 2e6e81e77e3efef5657ac55fb6b834b2ebec5d9a
+SHA1 (patch-src_slic3r_GUI_ConfigWizard.cpp) = 523d2eeb26c9f580ccdeb034743c301dcc56c727
+SHA1 (patch-src_slic3r_GUI_ConfigWizard__private.hpp) = 7ac3e3a9a67ebe7c99fbfc17ed9c0b2750d96974
+SHA1 (patch-src_slic3r_GUI_DesktopIntegrationDialog.cpp) = d61919d6f053cd598741255bffc29e80c79863df
+SHA1 (patch-src_slic3r_GUI_DesktopIntegrationDialog.hpp) = dd35d8a5c0ccaae50b969352f0f23f974a2ee89f
+SHA1 (patch-src_slic3r_GUI_ExtraRenderers.cpp) = ac803510123ff016b8fa6f22d491c898166e0929
+SHA1 (patch-src_slic3r_GUI_GLCanvas3D.cpp) = 7abaef0d1ffd79fd1fc2de5e8dc445a073386353
+SHA1 (patch-src_slic3r_GUI_GUI__App.cpp) = 0a3f722c5cf3e54d037e441d8bf08afd94d81af6
+SHA1 (patch-src_slic3r_GUI_GUI__App.hpp) = 9a4e30158b67fb6b73fc1b5ce45c458fb60c60a4
+SHA1 (patch-src_slic3r_GUI_GUI__Preview.cpp) = 8555c73aa6aa3d65b4d34fc93ccb1fbb2957a76f
+SHA1 (patch-src_slic3r_GUI_GUI__Preview.hpp) = 904556d0f85f28a8174845089647bb3691783f37
+SHA1 (patch-src_slic3r_GUI_GUI__Utils.cpp) = bcbc83109ba7806e6371d0ef10f3c05cc480d730
+SHA1 (patch-src_slic3r_GUI_HintNotification.cpp) = 955712c3a937f89824813b48fe561519e3410e69
 SHA1 (patch-src_slic3r_GUI_InstanceCheck.cpp) = c9ae1ec2db2b493578cc128383fa4cf0b3e2ae6a
-SHA1 (patch-src_slic3r_GUI_InstanceCheck.hpp) = 6ec1f000be65a65b6a2ca441d0da9d2defd62634
-SHA1 (patch-src_slic3r_GUI_Mouse3DController.cpp) = 7fb94a9949bc83057e0b0c8d77852e3e6df97f03
-SHA1 (patch-src_slic3r_GUI_Mouse3DController.hpp) = e22b1c018d870a099744e21d23731656a516d4f5
-SHA1 (patch-src_slic3r_GUI_RemovableDriveManager.cpp) = 37853e71f828bde540340b71935e526576e285d0
-SHA1 (patch-src_slic3r_GUI_RemovableDriveManager.hpp) = 5e87f153d560db5be1acbce54b416c15aaba6039
+SHA1 (patch-src_slic3r_GUI_InstanceCheck.hpp) = 2af0741f480c41d5cc5bd9d3e55480c8e6ab029c
+SHA1 (patch-src_slic3r_GUI_Mouse3DController.cpp) = bf8bf60e17e304a2022b9a80852d7ab38fc2451d
+SHA1 (patch-src_slic3r_GUI_Mouse3DController.hpp) = 6a008114e932b08951428b6fa882b41acaa85c0b
+SHA1 (patch-src_slic3r_GUI_NotificationManager.cpp) = 4e774bfdd777cba3e46ac4358b92c63896914b71
+SHA1 (patch-src_slic3r_GUI_Plater.cpp) = 5235502df6c7227befd58e29de0b4a0ab7f1975f
+SHA1 (patch-src_slic3r_GUI_PresetComboBoxes.cpp) = 89654aa2e0384b35b61a19a22399683e7f4417ae
+SHA1 (patch-src_slic3r_GUI_PresetComboBoxes.hpp) = 0c84c1b706a1f4e00f60c1677c7edf53845d4467
+SHA1 (patch-src_slic3r_GUI_PrintHostDialogs.cpp) = a5ce3c0a88d67fb78407856825e9cb2a1a6cfb20
+SHA1 (patch-src_slic3r_GUI_RemovableDriveManager.cpp) = 413499908128be48106d5fd6aea5d413bb959b35
+SHA1 (patch-src_slic3r_GUI_Tab.cpp) = 3c0f617eeb0d1a137e0050e416a52bc32d7a559e
+SHA1 (patch-src_slic3r_GUI_UnsavedChangesDialog.cpp) = c2e4e2bfccd8492506c4f794b7085fa2c1cbe846
+SHA1 (patch-src_slic3r_GUI_UnsavedChangesDialog.hpp) = cb399a0d751be5c9b25fcf88554612a17bc44d3c
+SHA1 (patch-src_slic3r_GUI_wxExtensions.cpp) = 14a6b3c6a6c0b082b126dcaf1fc869404fa3e9c9
diff --git a/prusaslicer/patches/patch-CMakeLists.txt b/prusaslicer/patches/patch-CMakeLists.txt
index f4b7f93b48..99eede1ec4 100644
--- a/prusaslicer/patches/patch-CMakeLists.txt
+++ b/prusaslicer/patches/patch-CMakeLists.txt
@@ -2,11 +2,11 @@ $NetBSD$
 
 Use GTK3, since that's how we build wxWidgets.
 
---- CMakeLists.txt.orig	2021-07-08 06:46:36.000000000 +0000
+--- CMakeLists.txt.orig	2021-12-17 14:00:02.000000000 +0000
 +++ CMakeLists.txt
-@@ -33,7 +33,7 @@ option(SLIC3R_MSVC_PDB          "Generat
- option(SLIC3R_PERL_XS           "Compile XS Perl module and enable Perl unit and integration tests" 0)
- option(SLIC3R_ASAN              "Enable ASan on Clang and GCC" 0)
+@@ -38,7 +38,7 @@ CMAKE_DEPENDENT_OPTION(SLIC3R_DESKTOP_IN
+ 
+ set(OPENVDB_FIND_MODULE_PATH "" CACHE PATH "Path to OpenVDB installation's find modules.")
  
 -set(SLIC3R_GTK "2" CACHE STRING "GTK version to use with wxWidgets on Linux")
 +set(SLIC3R_GTK "3" CACHE STRING "GTK version to use with wxWidgets on Linux")
diff --git a/prusaslicer/patches/patch-cmake_modules_FindOpenVDB.cmake b/prusaslicer/patches/patch-cmake_modules_FindOpenVDB.cmake
index df2ea5a7f9..bc2e52ddd6 100644
--- a/prusaslicer/patches/patch-cmake_modules_FindOpenVDB.cmake
+++ b/prusaslicer/patches/patch-cmake_modules_FindOpenVDB.cmake
@@ -3,7 +3,7 @@ $NetBSD$
 cmake file copied from OpenVDB 8.1.0 distribution, with unknown cmake
 function OPENVDB_GET_VERSION_DEFINE commented out.
 
---- cmake/modules/FindOpenVDB.cmake.orig	2021-07-16 10:14:03.000000000 +0000
+--- cmake/modules/FindOpenVDB.cmake.orig	2021-12-17 14:00:02.000000000 +0000
 +++ cmake/modules/FindOpenVDB.cmake
 @@ -1,28 +1,5 @@
 -# Copyright (c) DreamWorks Animation LLC
@@ -94,7 +94,7 @@ function OPENVDB_GET_VERSION_DEFINE commented out.
    Individual component libraries for OpenVDB
  
  Hints
-@@ -91,34 +83,30 @@ Hints
+@@ -91,55 +83,30 @@ Hints
  Instead of explicitly setting the cache variables, the following variables
  may be provided to tell this module where to look.
  
@@ -121,14 +121,35 @@ function OPENVDB_GET_VERSION_DEFINE commented out.
  
  #]=======================================================================]
  
+-# If an explicit openvdb module path was specified, that will be used
+-if (OPENVDB_FIND_MODULE_PATH)
+-  set(_module_path_bak ${CMAKE_MODULE_PATH})
+-  set(CMAKE_MODULE_PATH ${OPENVDB_FIND_MODULE_PATH})
+-  find_package(
+-    OpenVDB ${OpenVDB_FIND_VERSION} QUIET
+-    COMPONENTS
+-      ${OpenVDB_FIND_COMPONENTS}
+-  )
++cmake_minimum_required(VERSION 3.12)
++include(GNUInstallDirs)
+ 
+-  set(CMAKE_MODULE_PATH ${_module_path_bak})
+-  if (OpenVDB_FOUND)
+-    return()
+-  endif ()
+-
+-  if (NOT OpenVDB_FIND_QUIETLY)
+-    message(STATUS "Using bundled find module for OpenVDB")
+-  endif ()
+-endif ()
+-# ###########################################################################
+-
 -cmake_minimum_required(VERSION 3.3)
 -# Monitoring <PackageName>_ROOT variables
 -if(POLICY CMP0074)
 -  cmake_policy(SET CMP0074 NEW)
 -endif()
-+cmake_minimum_required(VERSION 3.12)
-+include(GNUInstallDirs)
- 
+-
 -if(OpenVDB_FIND_QUIETLY)
 -  set (_quiet "QUIET")
 -else()
@@ -143,7 +164,7 @@ function OPENVDB_GET_VERSION_DEFINE commented out.
  
  # Include utility functions for version information
  include(${CMAKE_CURRENT_LIST_DIR}/OpenVDBUtils.cmake)
-@@ -128,8 +116,17 @@ mark_as_advanced(
+@@ -149,8 +116,17 @@ mark_as_advanced(
    OpenVDB_LIBRARY
  )
  
@@ -161,7 +182,7 @@ function OPENVDB_GET_VERSION_DEFINE commented out.
  )
  
  if(OpenVDB_FIND_COMPONENTS)
-@@ -150,16 +147,65 @@ if(OpenVDB_FIND_COMPONENTS)
+@@ -171,16 +147,65 @@ if(OpenVDB_FIND_COMPONENTS)
    endif()
  else()
    set(OPENVDB_COMPONENTS_PROVIDED FALSE)
@@ -206,11 +227,11 @@ function OPENVDB_GET_VERSION_DEFINE commented out.
 +#
 +# (repo structure = <root>/cmake/FindOpenVDB.cmake)
 +# (inst structure = <root>/lib/cmake/OpenVDB/FindOpenVDB.cmake)
-+
-+get_filename_component(_DIR_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
  
 -find_package(PkgConfig ${_quiet} )
 -pkg_check_modules(PC_OpenVDB QUIET OpenVDB)
++get_filename_component(_DIR_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
++
 +if(${_DIR_NAME} STREQUAL "cmake")
 +  # Called from root repo for openvdb components
 +elseif(${_DIR_NAME} STREQUAL "OpenVDB")
@@ -232,7 +253,7 @@ function OPENVDB_GET_VERSION_DEFINE commented out.
  
  # ------------------------------------------------------------------------
  #  Search for OpenVDB include DIR
-@@ -168,24 +214,89 @@ pkg_check_modules(PC_OpenVDB QUIET OpenV
+@@ -189,24 +214,89 @@ pkg_check_modules(PC_OpenVDB QUIET OpenV
  set(_OPENVDB_INCLUDE_SEARCH_DIRS "")
  list(APPEND _OPENVDB_INCLUDE_SEARCH_DIRS
    ${OPENVDB_INCLUDEDIR}
@@ -303,11 +324,11 @@ function OPENVDB_GET_VERSION_DEFINE commented out.
 +  endif()
 +  unset(_VDB_COMPONENT_SEARCH_DIRS)
 +endforeach()
- 
--OPENVDB_VERSION_FROM_HEADER("${OpenVDB_INCLUDE_DIR}/openvdb/version.h"
++
 +set(OpenVDB_INCLUDE_DIR ${OpenVDB_openvdb_INCLUDE_DIR}
 +  CACHE PATH "The OpenVDB core include directory")
-+
+ 
+-OPENVDB_VERSION_FROM_HEADER("${OpenVDB_INCLUDE_DIR}/openvdb/version.h"
 +set(_OPENVDB_VERSION_HEADER "${OpenVDB_INCLUDE_DIR}/openvdb/version.h")
 +OPENVDB_VERSION_FROM_HEADER("${_OPENVDB_VERSION_HEADER}"
    VERSION OpenVDB_VERSION
@@ -329,7 +350,7 @@ function OPENVDB_GET_VERSION_DEFINE commented out.
  # ------------------------------------------------------------------------
  #  Search for OPENVDB lib DIR
  # ------------------------------------------------------------------------
-@@ -196,81 +307,95 @@ set(_OPENVDB_LIBRARYDIR_SEARCH_DIRS "")
+@@ -217,81 +307,95 @@ set(_OPENVDB_LIBRARYDIR_SEARCH_DIRS "")
  
  list(APPEND _OPENVDB_LIBRARYDIR_SEARCH_DIRS
    ${OPENVDB_LIBRARYDIR}
@@ -391,11 +412,6 @@ function OPENVDB_GET_VERSION_DEFINE commented out.
 -  find_library(OpenVDB_${COMPONENT}_LIBRARY_RELEASE ${LIB_NAME} lib${LIB_NAME}
 -    PATHS ${_OPENVDB_LIBRARYDIR_SEARCH_DIRS}
 -    PATH_SUFFIXES ${OPENVDB_PATH_SUFFIXES}
--  )
--
--  find_library(OpenVDB_${COMPONENT}_LIBRARY_DEBUG ${LIB_NAME}${OpenVDB_DEBUG_SUFFIX} lib${LIB_NAME}${OpenVDB_DEBUG_SUFFIX}
--    PATHS ${_OPENVDB_LIBRARYDIR_SEARCH_DIRS}
--    PATH_SUFFIXES ${OPENVDB_PATH_SUFFIXES}
 +  # Add in extra component paths
 +  set(_VDB_COMPONENT_SEARCH_DIRS ${_OPENVDB_LIBRARYDIR_SEARCH_DIRS})
 +  list(APPEND _VDB_COMPONENT_SEARCH_DIRS
@@ -403,6 +419,11 @@ function OPENVDB_GET_VERSION_DEFINE commented out.
 +    ${OPENVDB_${COMPONENT}_LIBRARYDIR}
    )
  
+-  find_library(OpenVDB_${COMPONENT}_LIBRARY_DEBUG ${LIB_NAME}${OpenVDB_DEBUG_SUFFIX} lib${LIB_NAME}${OpenVDB_DEBUG_SUFFIX}
+-    PATHS ${_OPENVDB_LIBRARYDIR_SEARCH_DIRS}
+-    PATH_SUFFIXES ${OPENVDB_PATH_SUFFIXES}
+-  )
+-
 -  if (_is_multi)
 -    list(APPEND OpenVDB_LIB_COMPONENTS ${OpenVDB_${COMPONENT}_LIBRARY_RELEASE})
 -    if (OpenVDB_${COMPONENT}_LIBRARY_DEBUG)
@@ -420,12 +441,6 @@ function OPENVDB_GET_VERSION_DEFINE commented out.
 -    set(OpenVDB_${COMPONENT}_LIBRARY ${OpenVDB_${COMPONENT}_LIBRARY_RELEASE})
 -  else ()
 -    string(TOUPPER "${CMAKE_BUILD_TYPE}" _BUILD_TYPE)
--
--    set(OpenVDB_${COMPONENT}_LIBRARY ${OpenVDB_${COMPONENT}_LIBRARY_${_BUILD_TYPE}})
--
--    if (NOT OpenVDB_${COMPONENT}_LIBRARY)
--      set(OpenVDB_${COMPONENT}_LIBRARY ${OpenVDB_${COMPONENT}_LIBRARY_RELEASE})
--    endif ()
 +  if(${COMPONENT} STREQUAL "pyopenvdb")
 +    set(_OPENVDB_ORIG_CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES})
 +    set(CMAKE_FIND_LIBRARY_PREFIXES ";lib") # find non-prefixed
@@ -446,7 +461,7 @@ function OPENVDB_GET_VERSION_DEFINE commented out.
 +    )
 +  endif()
  
--    list(APPEND OpenVDB_LIB_COMPONENTS ${OpenVDB_${COMPONENT}_LIBRARY})
+-    set(OpenVDB_${COMPONENT}_LIBRARY ${OpenVDB_${COMPONENT}_LIBRARY_${_BUILD_TYPE}})
 +  list(APPEND OpenVDB_LIB_COMPONENTS ${OpenVDB_${COMPONENT}_LIBRARY})
 +  if(OpenVDB_${COMPONENT}_LIBRARY)
 +    set(OpenVDB_${COMPONENT}_FOUND TRUE)
@@ -456,18 +471,24 @@ function OPENVDB_GET_VERSION_DEFINE commented out.
 +  unset(_VDB_COMPONENT_SEARCH_DIRS)
 +endforeach()
  
+-    if (NOT OpenVDB_${COMPONENT}_LIBRARY)
+-      set(OpenVDB_${COMPONENT}_LIBRARY ${OpenVDB_${COMPONENT}_LIBRARY_RELEASE})
+-    endif ()
++unset(OPENVDB_PYTHON_PATH_SUFFIXES)
++unset(OPENVDB_LIB_PATH_SUFFIXES)
+ 
+-    list(APPEND OpenVDB_LIB_COMPONENTS ${OpenVDB_${COMPONENT}_LIBRARY})
++# Reset library suffix
+ 
 -    if(OpenVDB_${COMPONENT}_LIBRARY)
 -      set(OpenVDB_${COMPONENT}_FOUND TRUE)
 -    else()
 -      set(OpenVDB_${COMPONENT}_FOUND FALSE)
 -    endif()
 -  endif ()
-+unset(OPENVDB_PYTHON_PATH_SUFFIXES)
-+unset(OPENVDB_LIB_PATH_SUFFIXES)
- 
+-
 -endforeach()
-+# Reset library suffix
- 
+-
 -if(UNIX AND OPENVDB_USE_STATIC_LIBS)
 -  set(CMAKE_FIND_LIBRARY_SUFFIXES ${_OPENVDB_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
 -  unset(_OPENVDB_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
@@ -477,7 +498,7 @@ function OPENVDB_GET_VERSION_DEFINE commented out.
  
  # ------------------------------------------------------------------------
  #  Cache and set OPENVDB_FOUND
-@@ -290,15 +415,25 @@ find_package_handle_standard_args(OpenVD
+@@ -311,15 +415,25 @@ find_package_handle_standard_args(OpenVD
  #  Determine ABI number
  # ------------------------------------------------------------------------
  
@@ -510,7 +531,7 @@ function OPENVDB_GET_VERSION_DEFINE commented out.
    if(NOT OpenVDB_ABI)
      message(WARNING "Unable to determine OpenVDB ABI version from OpenVDB "
        "installation. The library major version \"${OpenVDB_MAJOR_VERSION}\" "
-@@ -311,166 +446,209 @@ if(NOT OpenVDB_FIND_QUIETLY)
+@@ -332,166 +446,209 @@ if(NOT OpenVDB_FIND_QUIETLY)
  endif()
  
  # ------------------------------------------------------------------------
@@ -536,7 +557,7 @@ function OPENVDB_GET_VERSION_DEFINE commented out.
 -  return()
 -endmacro()
 -
--find_package(IlmBase QUIET COMPONENTS Half)
+-find_package(IlmBase QUIET)
 -if(NOT IlmBase_FOUND)
 -  pkg_check_modules(IlmBase QUIET IlmBase)
 -endif()
@@ -769,14 +790,14 @@ function OPENVDB_GET_VERSION_DEFINE commented out.
 -  find_package(Log4cplus ${_quiet} ${_required})
 +if(OpenVDB_USES_BLOSC)
 +  find_package(Blosc REQUIRED)
++endif()
++
++if(OpenVDB_USES_ZLIB)
++  find_package(ZLIB REQUIRED)
  endif()
  
 -if(OpenVDB_USES_ILM)
 -  find_package(IlmBase ${_quiet} ${_required})
-+if(OpenVDB_USES_ZLIB)
-+  find_package(ZLIB REQUIRED)
-+endif()
-+
 +if(OpenVDB_USES_LOG4CPLUS)
 +  find_package(Log4cplus REQUIRED)
  endif()
@@ -837,7 +858,7 @@ function OPENVDB_GET_VERSION_DEFINE commented out.
  endif()
  
  list(APPEND _OPENVDB_VISIBLE_DEPENDENCIES
-@@ -484,34 +662,26 @@ endif()
+@@ -505,34 +662,26 @@ endif()
  
  set(_OPENVDB_HIDDEN_DEPENDENCIES)
  
@@ -881,7 +902,7 @@ function OPENVDB_GET_VERSION_DEFINE commented out.
  set(OpenVDB_LIBRARY_DIRS "")
  foreach(LIB ${OpenVDB_LIB_COMPONENTS})
    get_filename_component(_OPENVDB_LIBDIR ${LIB} DIRECTORY)
-@@ -519,49 +689,102 @@ foreach(LIB ${OpenVDB_LIB_COMPONENTS})
+@@ -540,49 +689,102 @@ foreach(LIB ${OpenVDB_LIB_COMPONENTS})
  endforeach()
  list(REMOVE_DUPLICATES OpenVDB_LIBRARY_DIRS)
  
diff --git a/prusaslicer/patches/patch-cmake_modules_FindTBB.cmake b/prusaslicer/patches/patch-cmake_modules_FindTBB.cmake
deleted file mode 100644
index 48d4e7f21a..0000000000
--- a/prusaslicer/patches/patch-cmake_modules_FindTBB.cmake
+++ /dev/null
@@ -1,420 +0,0 @@
-$NetBSD$
-
-cmake file copied from TBB distro.
-
---- cmake/modules/FindTBB.cmake.orig	2021-07-16 10:14:03.000000000 +0000
-+++ cmake/modules/FindTBB.cmake
-@@ -1,332 +1,89 @@
--# The MIT License (MIT)
-+# Copyright (c) 2020-2021 Intel Corporation
- #
--# Copyright (c) 2015 Justus Calvin
--# 
--# Permission is hereby granted, free of charge, to any person obtaining a copy
--# of this software and associated documentation files (the "Software"), to deal
--# in the Software without restriction, including without limitation the rights
--# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
--# copies of the Software, and to permit persons to whom the Software is
--# furnished to do so, subject to the following conditions:
--# 
--# The above copyright notice and this permission notice shall be included in all
--# copies or substantial portions of the Software.
--# 
--# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
--# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
--# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
--# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
--# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
--# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
--# SOFTWARE.
--
--#
--# FindTBB
--# -------
--#
--# Find TBB include directories and libraries.
--#
--# Usage:
--#
--#  find_package(TBB [major[.minor]] [EXACT]
--#               [QUIET] [REQUIRED]
--#               [[COMPONENTS] [components...]]
--#               [OPTIONAL_COMPONENTS components...]) 
--#
--# where the allowed components are tbbmalloc and tbb_preview. Users may modify 
--# the behavior of this module with the following variables:
--#
--# * TBB_ROOT_DIR          - The base directory the of TBB installation.
--# * TBB_INCLUDE_DIR       - The directory that contains the TBB headers files.
--# * TBB_LIBRARY           - The directory that contains the TBB library files.
--# * TBB_<library>_LIBRARY - The path of the TBB the corresponding TBB library. 
--#                           These libraries, if specified, override the 
--#                           corresponding library search results, where <library>
--#                           may be tbb, tbb_debug, tbbmalloc, tbbmalloc_debug,
--#                           tbb_preview, or tbb_preview_debug.
--# * TBB_USE_DEBUG_BUILD   - The debug version of tbb libraries, if present, will
--#                           be used instead of the release version.
--# * TBB_STATIC            - Static linking of libraries with a _static suffix.
--#                           For example, on Windows a tbb_static.lib will be searched for
--#                           instead of tbb.lib.
--#
--# Users may modify the behavior of this module with the following environment
--# variables:
--#
--# * TBB_INSTALL_DIR 
--# * TBBROOT
--# * LIBRARY_PATH
--#
--# This module will set the following variables:
--#
--# * TBB_FOUND             - Set to false, or undefined, if we haven’t found, or
--#                           don’t want to use TBB.
--# * TBB_<component>_FOUND - If False, optional <component> part of TBB sytem is
--#                           not available.
--# * TBB_VERSION           - The full version string
--# * TBB_VERSION_MAJOR     - The major version
--# * TBB_VERSION_MINOR     - The minor version
--# * TBB_INTERFACE_VERSION - The interface version number defined in 
--#                           tbb/tbb_stddef.h.
--# * TBB_<library>_LIBRARY_RELEASE - The path of the TBB release version of 
--#                           <library>, where <library> may be tbb, tbb_debug,
--#                           tbbmalloc, tbbmalloc_debug, tbb_preview, or 
--#                           tbb_preview_debug.
--# * TBB_<library>_LIBRARY_DEGUG - The path of the TBB release version of 
--#                           <library>, where <library> may be tbb, tbb_debug,
--#                           tbbmalloc, tbbmalloc_debug, tbb_preview, or 
--#                           tbb_preview_debug.
--#
--# The following varibles should be used to build and link with TBB:
--#
--# * TBB_INCLUDE_DIRS        - The include directory for TBB.
--# * TBB_LIBRARIES           - The libraries to link against to use TBB.
--# * TBB_LIBRARIES_RELEASE   - The release libraries to link against to use TBB.
--# * TBB_LIBRARIES_DEBUG     - The debug libraries to link against to use TBB.
--# * TBB_DEFINITIONS         - Definitions to use when compiling code that uses
--#                             TBB.
--# * TBB_DEFINITIONS_RELEASE - Definitions to use when compiling release code that
--#                             uses TBB.
--# * TBB_DEFINITIONS_DEBUG   - Definitions to use when compiling debug code that
--#                             uses TBB.
--#
--# This module will also create the "tbb" target that may be used when building
--# executables and libraries.
--
--unset(TBB_FOUND CACHE)
--unset(TBB_INCLUDE_DIRS CACHE)
--unset(TBB_LIBRARIES)
--unset(TBB_LIBRARIES_DEBUG)
--unset(TBB_LIBRARIES_RELEASE)
-+# Licensed under the Apache License, Version 2.0 (the "License");
-+# you may not use this file except in compliance with the License.
-+# You may obtain a copy of the License at
-+#
-+#     http://www.apache.org/licenses/LICENSE-2.0
-+#
-+# Unless required by applicable law or agreed to in writing, software
-+# distributed under the License is distributed on an "AS IS" BASIS,
-+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-+# See the License for the specific language governing permissions and
-+# limitations under the License.
- 
- include(FindPackageHandleStandardArgs)
- 
--find_package(Threads QUIET REQUIRED)
-+# Firstly search for TBB in config mode (i.e. search for TBBConfig.cmake).
-+find_package(TBB QUIET CONFIG)
-+if (TBB_FOUND)
-+    find_package_handle_standard_args(TBB CONFIG_MODE)
-+    return()
-+endif()
-+
-+if (NOT TBB_FIND_COMPONENTS)
-+    set(TBB_FIND_COMPONENTS tbb tbbmalloc)
-+    foreach (_tbb_component ${TBB_FIND_COMPONENTS})
-+        set(TBB_FIND_REQUIRED_${_tbb_component} 1)
-+    endforeach()
-+endif()
- 
--if(NOT TBB_FOUND)
-+if (WIN32)
-+    list(APPEND ADDITIONAL_LIB_DIRS ENV PATH ENV LIB)
-+    list(APPEND ADDITIONAL_INCLUDE_DIRS ENV INCLUDE ENV CPATH)
-+else()
-+    list(APPEND ADDITIONAL_LIB_DIRS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH ENV DYLD_LIBRARY_PATH)
-+    list(APPEND ADDITIONAL_INCLUDE_DIRS ENV CPATH ENV C_INCLUDE_PATH ENV CPLUS_INCLUDE_PATH ENV INCLUDE_PATH)
-+endif()
- 
--  ##################################
--  # Check the build type
--  ##################################
--  
--  if(NOT DEFINED TBB_USE_DEBUG_BUILD)
--    if(CMAKE_BUILD_TYPE MATCHES "(Debug|DEBUG|debug)")
--      set(TBB_BUILD_TYPE DEBUG)
--    else()
--      set(TBB_BUILD_TYPE RELEASE)
--    endif()
--  elseif(TBB_USE_DEBUG_BUILD)
--    set(TBB_BUILD_TYPE DEBUG)
--  else()
--    set(TBB_BUILD_TYPE RELEASE)
--  endif()
--  
--  ##################################
--  # Set the TBB search directories
--  ##################################
--  
--  # Define search paths based on user input and environment variables
--  set(TBB_SEARCH_DIR ${TBB_ROOT_DIR} $ENV{TBB_INSTALL_DIR} $ENV{TBBROOT})
--  
--  # Define the search directories based on the current platform
--  if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
--    set(TBB_DEFAULT_SEARCH_DIR "C:/Program Files/Intel/TBB"
--                               "C:/Program Files (x86)/Intel/TBB")
--
--    # Set the target architecture
--    if(CMAKE_SIZEOF_VOID_P EQUAL 8)
--      set(TBB_ARCHITECTURE "intel64")
--    else()
--      set(TBB_ARCHITECTURE "ia32")
--    endif()
--
--    # Set the TBB search library path search suffix based on the version of VC
--    if(WINDOWS_STORE)
--      set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11_ui")
--    elseif(MSVC14)
--      set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc14")
--    elseif(MSVC12)
--      set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc12")
--    elseif(MSVC11)
--      set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11")
--    elseif(MSVC10)
--      set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc10")
--    endif()
--
--    # Add the library path search suffix for the VC independent version of TBB
--    list(APPEND TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc_mt")
--
--  elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
--    # OS X
--    set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb")
--    
--    # TODO: Check to see which C++ library is being used by the compiler.
--    if(NOT ${CMAKE_SYSTEM_VERSION} VERSION_LESS 13.0)
--      # The default C++ library on OS X 10.9 and later is libc++
--      set(TBB_LIB_PATH_SUFFIX "lib/libc++" "lib")
--    else()
--      set(TBB_LIB_PATH_SUFFIX "lib")
--    endif()
--  elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
--    # Linux
--    set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb")
--    
--    # TODO: Check compiler version to see the suffix should be <arch>/gcc4.1 or
--    #       <arch>/gcc4.1. For now, assume that the compiler is more recent than
--    #       gcc 4.4.x or later.
--    if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
--      set(TBB_LIB_PATH_SUFFIX "lib/intel64/gcc4.4")
--    elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
--      set(TBB_LIB_PATH_SUFFIX "lib/ia32/gcc4.4")
--    endif()
--  endif()
--  
--  ##################################
--  # Find the TBB include dir
--  ##################################
--  
--  find_path(TBB_INCLUDE_DIRS tbb/tbb.h
--      HINTS ${TBB_INCLUDE_DIR} ${TBB_SEARCH_DIR}
--      PATHS ${TBB_DEFAULT_SEARCH_DIR}
--      PATH_SUFFIXES include)
--
--  ##################################
--  # Set version strings
--  ##################################
--
--  if(TBB_INCLUDE_DIRS)
--    file(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _tbb_version_file)
--    string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1"
--        TBB_VERSION_MAJOR "${_tbb_version_file}")
--    string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1"
--        TBB_VERSION_MINOR "${_tbb_version_file}")
--    string(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1"
--        TBB_INTERFACE_VERSION "${_tbb_version_file}")
--    set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}")
--  endif()
--
--  ##################################
--  # Find TBB components
--  ##################################
--
--  if(TBB_VERSION VERSION_LESS 4.3)
--    set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc tbb)
--  else()
--    set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc_proxy tbbmalloc tbb)
--  endif()
--
--  if(TBB_STATIC)
--    set(TBB_STATIC_SUFFIX "_static")
--  endif()
--
--  # Find each component
--  foreach(_comp ${TBB_SEARCH_COMPOMPONENTS})
--    if(";${TBB_FIND_COMPONENTS};tbb;" MATCHES ";${_comp};")
--
--      unset(TBB_${_comp}_LIBRARY_DEBUG CACHE)
--      unset(TBB_${_comp}_LIBRARY_RELEASE CACHE)
--
--      # Search for the libraries
--      find_library(TBB_${_comp}_LIBRARY_RELEASE ${_comp}${TBB_STATIC_SUFFIX}
--          HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
--          PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
--          PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX})
--
--      find_library(TBB_${_comp}_LIBRARY_DEBUG ${_comp}${TBB_STATIC_SUFFIX}_debug
--          HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
--          PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
--          PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX})
--
--      if(TBB_${_comp}_LIBRARY_DEBUG)
--        list(APPEND TBB_LIBRARIES_DEBUG "${TBB_${_comp}_LIBRARY_DEBUG}")
--      endif()
--      if(TBB_${_comp}_LIBRARY_RELEASE)
--        list(APPEND TBB_LIBRARIES_RELEASE "${TBB_${_comp}_LIBRARY_RELEASE}")
--      endif()
--      if(TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE} AND NOT TBB_${_comp}_LIBRARY)
--        set(TBB_${_comp}_LIBRARY "${TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE}}")
--      endif()
--
--      if(TBB_${_comp}_LIBRARY AND EXISTS "${TBB_${_comp}_LIBRARY}")
--        set(TBB_${_comp}_FOUND TRUE)
--      else()
--        set(TBB_${_comp}_FOUND FALSE)
--      endif()
--
--      # Mark internal variables as advanced
--      mark_as_advanced(TBB_${_comp}_LIBRARY_RELEASE)
--      mark_as_advanced(TBB_${_comp}_LIBRARY_DEBUG)
--      mark_as_advanced(TBB_${_comp}_LIBRARY)
--
--    endif()
--  endforeach()
--
--  ##################################
--  # Set compile flags and libraries
--  ##################################
--
--  set(TBB_DEFINITIONS_RELEASE "")
--  set(TBB_DEFINITIONS_DEBUG "TBB_USE_DEBUG=1")
--    
--  if(TBB_LIBRARIES_${TBB_BUILD_TYPE})
--    set(TBB_LIBRARIES "${TBB_LIBRARIES_${TBB_BUILD_TYPE}}")
--  endif()
--  
--  if(NOT MSVC AND NOT TBB_LIBRARIES)
--    set(TBB_LIBRARIES ${TBB_LIBRARIES_RELEASE})
--  endif()
--
--  set(TBB_DEFINITIONS "")
--  if (MSVC AND TBB_STATIC)
--    set(TBB_DEFINITIONS __TBB_NO_IMPLICIT_LINKAGE)
--  endif ()
--
--  unset (TBB_STATIC_SUFFIX)
--
--  find_package_handle_standard_args(TBB 
--      REQUIRED_VARS TBB_INCLUDE_DIRS TBB_LIBRARIES
--      FAIL_MESSAGE "TBB library cannot be found. Consider set TBBROOT environment variable."
--      HANDLE_COMPONENTS
--      VERSION_VAR TBB_VERSION)
--
--  ##################################
--  # Create targets
--  ##################################
--
--  if(NOT CMAKE_VERSION VERSION_LESS 3.0 AND TBB_FOUND)
--    add_library(TBB::tbb UNKNOWN IMPORTED)
--    set_target_properties(TBB::tbb PROPERTIES
--          INTERFACE_COMPILE_DEFINITIONS "${TBB_DEFINITIONS}"
--          INTERFACE_LINK_LIBRARIES  "Threads::Threads;${CMAKE_DL_LIBS}"
--          INTERFACE_INCLUDE_DIRECTORIES  ${TBB_INCLUDE_DIRS}
--          IMPORTED_LOCATION              ${TBB_LIBRARIES})
--    if(TBB_LIBRARIES_RELEASE AND TBB_LIBRARIES_DEBUG)
--      set_target_properties(TBB::tbb PROPERTIES
--          INTERFACE_COMPILE_DEFINITIONS "${TBB_DEFINITIONS};$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:${TBB_DEFINITIONS_DEBUG}>;$<$<CONFIG:Release>:${TBB_DEFINITIONS_RELEASE}>"
--          IMPORTED_LOCATION_DEBUG          ${TBB_LIBRARIES_DEBUG}
--          IMPORTED_LOCATION_RELWITHDEBINFO ${TBB_LIBRARIES_RELEASE}
--          IMPORTED_LOCATION_RELEASE        ${TBB_LIBRARIES_RELEASE}
--          IMPORTED_LOCATION_MINSIZEREL     ${TBB_LIBRARIES_RELEASE}
--          )
--    endif()
--  endif()
--
--  mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARIES)
--
--  unset(TBB_ARCHITECTURE)
--  unset(TBB_BUILD_TYPE)
--  unset(TBB_LIB_PATH_SUFFIX)
--  unset(TBB_DEFAULT_SEARCH_DIR)
--
--  if(TBB_DEBUG)
--    message(STATUS "  TBB_FOUND               = ${TBB_FOUND}")
--    message(STATUS "  TBB_INCLUDE_DIRS        = ${TBB_INCLUDE_DIRS}")
--    message(STATUS "  TBB_DEFINITIONS         = ${TBB_DEFINITIONS}")
--    message(STATUS "  TBB_LIBRARIES           = ${TBB_LIBRARIES}")
--    message(STATUS "  TBB_DEFINITIONS_DEBUG   = ${TBB_DEFINITIONS_DEBUG}")
--    message(STATUS "  TBB_LIBRARIES_DEBUG     = ${TBB_LIBRARIES_DEBUG}")
--    message(STATUS "  TBB_DEFINITIONS_RELEASE = ${TBB_DEFINITIONS_RELEASE}")
--    message(STATUS "  TBB_LIBRARIES_RELEASE   = ${TBB_LIBRARIES_RELEASE}")
--  endif()
-+find_path(_tbb_include_dir NAMES tbb/tbb.h PATHS ${ADDITIONAL_INCLUDE_DIRS})
- 
-+if (_tbb_include_dir)
-+    # TODO: consider TBB_VERSION handling
-+    set(_TBB_BUILD_MODES RELEASE DEBUG)
-+    set(_TBB_DEBUG_SUFFIX _debug)
-+
-+    foreach (_tbb_component ${TBB_FIND_COMPONENTS})
-+        if (NOT TARGET TBB::${_tbb_component})
-+            add_library(TBB::${_tbb_component} SHARED IMPORTED)
-+            set_property(TARGET TBB::${_tbb_component} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_tbb_include_dir})
-+
-+            foreach(_TBB_BUILD_MODE ${_TBB_BUILD_MODES})
-+                set(_tbb_component_lib_name ${_tbb_component}${_TBB_${_TBB_BUILD_MODE}_SUFFIX})
-+                if (WIN32)
-+                    find_library(${_tbb_component_lib_name}_lib ${_tbb_component_lib_name} PATHS ${ADDITIONAL_LIB_DIRS})
-+                    find_file(${_tbb_component_lib_name}_dll ${_tbb_component_lib_name}.dll PATHS ${ADDITIONAL_LIB_DIRS})
-+
-+                    set_target_properties(TBB::${_tbb_component} PROPERTIES
-+                                          IMPORTED_LOCATION_${_TBB_BUILD_MODE} "${${_tbb_component_lib_name}_dll}"
-+                                          IMPORTED_IMPLIB_${_TBB_BUILD_MODE}   "${${_tbb_component_lib_name}_lib}"
-+                                          )
-+                else()
-+                    find_library(${_tbb_component_lib_name}_so ${_tbb_component_lib_name} PATHS ${ADDITIONAL_LIB_DIRS})
-+
-+                    set_target_properties(TBB::${_tbb_component} PROPERTIES
-+                                          IMPORTED_LOCATION_${_TBB_BUILD_MODE} "${${_tbb_component_lib_name}_so}"
-+                                          )
-+                endif()
-+                if (${_tbb_component_lib_name}_lib AND ${_tbb_component_lib_name}_dll OR ${_tbb_component_lib_name}_so)
-+                    set_property(TARGET TBB::${_tbb_component} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${_TBB_BUILD_MODE})
-+                    list(APPEND TBB_IMPORTED_TARGETS TBB::${_tbb_component})
-+                    set(TBB_${_tbb_component}_FOUND 1)
-+                endif()
-+                unset(${_tbb_component_lib_name}_lib CACHE)
-+                unset(${_tbb_component_lib_name}_dll CACHE)
-+                unset(${_tbb_component_lib_name}_so CACHE)
-+                unset(_tbb_component_lib_name)
-+            endforeach()
-+        endif()
-+    endforeach()
-+    unset(_TBB_BUILD_MODESS)
-+    unset(_TBB_DEBUG_SUFFIX)
- endif()
-+unset(_tbb_include_dir CACHE)
-+
-+list(REMOVE_DUPLICATES TBB_IMPORTED_TARGETS)
-+
-+find_package_handle_standard_args(TBB
-+                                  REQUIRED_VARS TBB_IMPORTED_TARGETS
-+                                  HANDLE_COMPONENTS)
diff --git a/prusaslicer/patches/patch-src_CMakeLists_txt b/prusaslicer/patches/patch-src_CMakeLists_txt
index c0ce918ff8..b9e43a3688 100644
--- a/prusaslicer/patches/patch-src_CMakeLists_txt
+++ b/prusaslicer/patches/patch-src_CMakeLists_txt
@@ -4,9 +4,9 @@ Use libhidapi from pkgsrc.
 Only use libdl on Linux.
 Allow use of stable track wxWidgets on NetBSD.
 
---- src/CMakeLists.txt.orig	2020-03-21 10:55:51.000000000 +0000
+--- src/CMakeLists.txt.orig	2021-12-17 14:00:02.000000000 +0000
 +++ src/CMakeLists.txt
-@@ -23,8 +23,6 @@ add_subdirectory(libslic3r)
+@@ -22,8 +22,6 @@ add_subdirectory(libslic3r)
  
  if (SLIC3R_GUI)
      add_subdirectory(imgui)
@@ -15,7 +15,7 @@ Allow use of stable track wxWidgets on NetBSD.
  
      if(WIN32)
          message(STATUS "WXWIN environment set to: $ENV{WXWIN}")
-@@ -37,10 +35,10 @@ if (SLIC3R_GUI)
+@@ -36,10 +34,10 @@ if (SLIC3R_GUI)
          endif()
      endif()
  
@@ -29,7 +29,7 @@ Allow use of stable track wxWidgets on NetBSD.
          else ()
              find_package(wxWidgets 3.1 QUIET COMPONENTS base core adv html gl)
  
-@@ -113,8 +111,10 @@ target_link_libraries(PrusaSlicer libsli
+@@ -151,8 +149,10 @@ target_link_libraries(PrusaSlicer libsli
          target_link_libraries(PrusaSlicer ws2_32 uxtheme setupapi)
      elseif (APPLE)
          target_link_libraries(PrusaSlicer "-framework OpenGL")
@@ -39,5 +39,5 @@ Allow use of stable track wxWidgets on NetBSD.
 +    else ()
 +        # nothing.
      endif ()
- endif ()
- 
+     if (WIN32)
+         find_library(PSAPI_LIB NAMES Psapi)
diff --git a/prusaslicer/patches/patch-src_PrusaSlicer.cpp b/prusaslicer/patches/patch-src_PrusaSlicer.cpp
deleted file mode 100644
index 1a47b5038e..0000000000
--- a/prusaslicer/patches/patch-src_PrusaSlicer.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-$NetBSD$
-
-Use /proc filesystem by default for the path to the running binary.
-
---- src/PrusaSlicer.cpp.orig	2021-07-16 10:14:03.000000000 +0000
-+++ src/PrusaSlicer.cpp
-@@ -612,7 +612,22 @@ bool CLI::setup(int argc, char **argv)
-     // Detect the operating system flavor after SLIC3R_LOGLEVEL is set.
-     detect_platform();
- 
--    boost::filesystem::path path_to_binary = boost::filesystem::system_complete(argv[0]);
-+    boost::filesystem::path path_to_binary;
-+    boost::system::error_code ec;
-+    // Linux
-+    path_to_binary = boost::filesystem::canonical("/proc/self/exe", ec);
-+    // NetBSD
-+    if (path_to_binary.empty()) {
-+        path_to_binary = boost::filesystem::canonical("/proc/curproc/exe", ec);
-+    }
-+    // FreeBSD
-+    if (path_to_binary.empty()) {
-+        path_to_binary = boost::filesystem::canonical("/proc/curproc/file", ec);
-+    }
-+    // fallback to old, incorrect method, which just appends the binary to the cwd.
-+    if (path_to_binary.empty()) {
-+        path_to_binary = boost::filesystem::canonical(boost::filesystem::system_complete(argv[0]));
-+    }
- 
-     // Path from the Slic3r binary to its resources.
- #ifdef __APPLE__
diff --git a/prusaslicer/patches/patch-src_libslic3r_LocalesUtils.cpp b/prusaslicer/patches/patch-src_libslic3r_LocalesUtils.cpp
new file mode 100644
index 0000000000..7b8b91d8f6
--- /dev/null
+++ b/prusaslicer/patches/patch-src_libslic3r_LocalesUtils.cpp
@@ -0,0 +1,38 @@
+$NetBSD$
+
+uselocale(3) is not found on NetBSD. Substitute setlocale(3) which is ugly
+as it affects the whole process rather than a single thread.
+See the following thread for rationale against uselocale(3):
+https://mail-index.netbsd.org/tech-userlevel/2015/12/28/msg009546.html
+
+--- src/libslic3r/LocalesUtils.cpp.orig	2021-12-17 14:00:02.000000000 +0000
++++ src/libslic3r/LocalesUtils.cpp
+@@ -21,11 +21,14 @@ CNumericLocalesSetter::CNumericLocalesSe
+     m_original_locale = uselocale((locale_t)0);
+     m_new_locale = newlocale(LC_NUMERIC_MASK, "C", m_original_locale);
+     uselocale(m_new_locale);
+-#else // linux / BSD
++#elif __LINUX__ || __OpenBSD__
+     m_original_locale = uselocale((locale_t)0);
+     m_new_locale = duplocale(m_original_locale);
+     m_new_locale = newlocale(LC_NUMERIC_MASK, "C", m_new_locale);
+     uselocale(m_new_locale);
++#elif __NetBSD__
++    m_original_locale = setlocale(LC_NUMERIC, nullptr);
++    setlocale(LC_NUMERIC, "C");
+ #endif
+ }
+ 
+@@ -35,9 +38,11 @@ CNumericLocalesSetter::~CNumericLocalesS
+ {
+ #ifdef _WIN32
+     std::setlocale(LC_NUMERIC, m_orig_numeric_locale.data());
+-#else
++#elif __APPLE__ || __LINUX__ || __OpenBSD__
+     uselocale(m_original_locale);
+     freelocale(m_new_locale);
++#elif __NetBSD__
++    setlocale(LC_NUMERIC, m_original_locale.c_str());
+ #endif
+ }
+ 
diff --git a/prusaslicer/patches/patch-src_libslic3r_LocalesUtils.hpp b/prusaslicer/patches/patch-src_libslic3r_LocalesUtils.hpp
new file mode 100644
index 0000000000..dc71321a7f
--- /dev/null
+++ b/prusaslicer/patches/patch-src_libslic3r_LocalesUtils.hpp
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Stash previous locale in a string on NetBSD.
+
+--- src/libslic3r/LocalesUtils.hpp.orig	2021-12-17 14:00:02.000000000 +0000
++++ src/libslic3r/LocalesUtils.hpp
+@@ -23,6 +23,8 @@ public:
+ private:
+ #ifdef _WIN32
+     std::string m_orig_numeric_locale;
++#elif __NetBSD__
++    std::string m_original_locale;
+ #else
+     locale_t m_original_locale;
+     locale_t m_new_locale;
diff --git a/prusaslicer/patches/patch-src_libslic3r_Platform.cpp b/prusaslicer/patches/patch-src_libslic3r_Platform.cpp
index 77fe85b8fd..7fcf680dda 100644
--- a/prusaslicer/patches/patch-src_libslic3r_Platform.cpp
+++ b/prusaslicer/patches/patch-src_libslic3r_Platform.cpp
@@ -2,9 +2,9 @@ $NetBSD$
 
 Add platform flavour NetBSD.
 
---- src/libslic3r/Platform.cpp.orig	2021-07-08 06:46:36.000000000 +0000
+--- src/libslic3r/Platform.cpp.orig	2021-12-17 14:00:02.000000000 +0000
 +++ src/libslic3r/Platform.cpp
-@@ -49,6 +49,10 @@ void detect_platform()
+@@ -86,6 +86,10 @@ void detect_platform()
      BOOST_LOG_TRIVIAL(info) << "Platform: OpenBSD";
  	s_platform 		  = Platform::BSDUnix;
  	s_platform_flavor = PlatformFlavor::OpenBSD;
@@ -15,3 +15,11 @@ Add platform flavour NetBSD.
  #else
  	// This should not happen.
      BOOST_LOG_TRIVIAL(info) << "Platform: Unknown";
+@@ -134,6 +138,7 @@ std::string platform_flavor_to_string(Pl
+         case PlatformFlavor::WSL             : return "WSL";
+         case PlatformFlavor::WSL2            : return "WSL2";
+         case PlatformFlavor::OpenBSD         : return "OpenBSD";
++        case PlatformFlavor::NetBSD          : return "NetBSD";
+         case PlatformFlavor::GenericOSX      : return "GenericOSX";
+         case PlatformFlavor::OSXOnX86        : return "OSXOnX86";
+         case PlatformFlavor::OSXOnArm        : return "OSXOnArm";
diff --git a/prusaslicer/patches/patch-src_libslic3r_Platform.hpp b/prusaslicer/patches/patch-src_libslic3r_Platform.hpp
index 72e9571c1c..80b62e88dd 100644
--- a/prusaslicer/patches/patch-src_libslic3r_Platform.hpp
+++ b/prusaslicer/patches/patch-src_libslic3r_Platform.hpp
@@ -3,22 +3,24 @@ $NetBSD$
 Add a NetBSD entry to the Platform enum.
 Undef a NetBSD macro that's coming in from somewhere.
 
---- src/libslic3r/Platform.hpp.orig	2021-07-08 06:46:36.000000000 +0000
+--- src/libslic3r/Platform.hpp.orig	2021-12-17 14:00:02.000000000 +0000
 +++ src/libslic3r/Platform.hpp
-@@ -1,6 +1,8 @@
- #ifndef SLIC3R_Platform_HPP
- #define SLIC3R_Platform_HPP
+@@ -3,6 +3,10 @@
  
+ #include <string>
+ 
++#ifdef NetBSD
 +#undef NetBSD
++#endif
 +
  namespace Slic3r {
  
  enum class Platform
-@@ -28,6 +30,7 @@ enum class PlatformFlavor
- 	WSL2,
- 	// For Platform::BSDUnix
- 	OpenBSD,
-+	NetBSD,
- };
- 
- // To be called on program start-up.
+@@ -25,6 +29,7 @@ enum class PlatformFlavor
+     WSL,             // Microsoft's Windows on Linux (Linux kernel simulated on NTFS kernel)
+     WSL2,            // Microsoft's Windows on Linux, version 2 (virtual machine)
+     OpenBSD,         // For Platform::BSDUnix
++    NetBSD,
+     GenericOSX,      // For Platform::OSX
+     OSXOnX86,        // For Apple's on Intel X86 CPU
+     OSXOnArm,        // For Apple's on Arm CPU
diff --git a/prusaslicer/patches/patch-src_libslic3r_Print.cpp b/prusaslicer/patches/patch-src_libslic3r_Print.cpp
deleted file mode 100644
index 4f53246796..0000000000
--- a/prusaslicer/patches/patch-src_libslic3r_Print.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-$NetBSD$
-
-Migrate away from features deprecated in tbb 2021.3.
-Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
-
---- src/libslic3r/Print.cpp.orig	2021-07-16 10:14:03.000000000 +0000
-+++ src/libslic3r/Print.cpp
-@@ -36,7 +36,7 @@ template class PrintState<PrintObjectSte
- 
- void Print::clear() 
- {
--	tbb::mutex::scoped_lock lock(this->state_mutex());
-+	std::scoped_lock<std::mutex> lock(this->state_mutex());
-     // The following call should stop background processing if it is running.
-     this->invalidate_all_steps();
- 	for (PrintObject *object : m_objects)
-@@ -262,7 +262,7 @@ bool Print::is_step_done(PrintObjectStep
- {
-     if (m_objects.empty())
-         return false;
--    tbb::mutex::scoped_lock lock(this->state_mutex());
-+    std::scoped_lock<std::mutex> lock(this->state_mutex());
-     for (const PrintObject *object : m_objects)
-         if (! object->is_step_done_unguarded(step))
-             return false;
-@@ -617,7 +617,7 @@ Print::ApplyStatus Print::apply(const Mo
-         update_apply_status(false);
- 
-     // Grab the lock for the Print / PrintObject milestones.
--	tbb::mutex::scoped_lock lock(this->state_mutex());
-+	std::scoped_lock<std::mutex> lock(this->state_mutex());
- 
-     // The following call may stop the background processing.
-     if (! print_diff.empty())
diff --git a/prusaslicer/patches/patch-src_libslic3r_PrintBase.cpp b/prusaslicer/patches/patch-src_libslic3r_PrintBase.cpp
deleted file mode 100644
index 2602a69fd7..0000000000
--- a/prusaslicer/patches/patch-src_libslic3r_PrintBase.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-$NetBSD$
-
-Migrate away from features deprecated in tbb 2021.3.
-Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
-
---- src/libslic3r/PrintBase.cpp.orig	2021-07-16 10:14:03.000000000 +0000
-+++ src/libslic3r/PrintBase.cpp
-@@ -97,7 +97,7 @@ void PrintBase::status_update_warnings(O
-     	printf("%s warning: %s\n", (object_id == this->id()) ? "print" : "print object", message.c_str());
- }
- 
--tbb::mutex& PrintObjectBase::state_mutex(PrintBase *print)
-+std::mutex& PrintObjectBase::state_mutex(PrintBase *print)
- { 
- 	return print->state_mutex();
- }
diff --git a/prusaslicer/patches/patch-src_libslic3r_PrintBase.hpp b/prusaslicer/patches/patch-src_libslic3r_PrintBase.hpp
deleted file mode 100644
index 9633e6ca2a..0000000000
--- a/prusaslicer/patches/patch-src_libslic3r_PrintBase.hpp
+++ /dev/null
@@ -1,122 +0,0 @@
-$NetBSD$
-
-Migrate away from features deprecated in tbb 2021.3.
-Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
-
---- src/libslic3r/PrintBase.hpp.orig	2021-07-16 10:14:03.000000000 +0000
-+++ src/libslic3r/PrintBase.hpp
-@@ -6,12 +6,8 @@
- #include <vector>
- #include <string>
- #include <functional>
--
--// tbb/mutex.h includes Windows, which in turn defines min/max macros. Convince Windows.h to not define these min/max macros.
--#ifndef NOMINMAX
--    #define NOMINMAX
--#endif
--#include "tbb/mutex.h"
-+#include <atomic>
-+#include <mutex>
- 
- #include "ObjectID.hpp"
- #include "Model.hpp"
-@@ -84,23 +80,23 @@ class PrintState : public PrintStateBase
- public:
-     PrintState() {}
- 
--    StateWithTimeStamp state_with_timestamp(StepType step, tbb::mutex &mtx) const {
--        tbb::mutex::scoped_lock lock(mtx);
-+    StateWithTimeStamp state_with_timestamp(StepType step, std::mutex &mtx) const {
-+        std::scoped_lock<std::mutex> lock(mtx);
-         StateWithTimeStamp state = m_state[step];
-         return state;
-     }
- 
--    StateWithWarnings state_with_warnings(StepType step, tbb::mutex &mtx) const {
--        tbb::mutex::scoped_lock lock(mtx);
-+    StateWithWarnings state_with_warnings(StepType step, std::mutex &mtx) const {
-+        std::scoped_lock<std::mutex> lock(mtx);
-         StateWithWarnings state = m_state[step];
-         return state;
-     }
- 
--    bool is_started(StepType step, tbb::mutex &mtx) const {
-+    bool is_started(StepType step, std::mutex &mtx) const {
-         return this->state_with_timestamp(step, mtx).state == STARTED;
-     }
- 
--    bool is_done(StepType step, tbb::mutex &mtx) const {
-+    bool is_done(StepType step, std::mutex &mtx) const {
-         return this->state_with_timestamp(step, mtx).state == DONE;
-     }
- 
-@@ -121,8 +117,8 @@ public:
-     // This is necessary to block until the Print::apply() updates its state, which may
-     // influence the processing step being entered.
-     template<typename ThrowIfCanceled>
--    bool set_started(StepType step, tbb::mutex &mtx, ThrowIfCanceled throw_if_canceled) {
--        tbb::mutex::scoped_lock lock(mtx);
-+    bool set_started(StepType step, std::mutex &mtx, ThrowIfCanceled throw_if_canceled) {
-+        std::scoped_lock<std::mutex> lock(mtx);
-         // If canceled, throw before changing the step state.
-         throw_if_canceled();
- #ifndef NDEBUG
-@@ -154,8 +150,8 @@ public:
-     // 		Timestamp when this stepentered the DONE state.
-     // 		bool indicates whether the UI has to update the slicing warnings of this step or not.
- 	template<typename ThrowIfCanceled>
--	std::pair<TimeStamp, bool> set_done(StepType step, tbb::mutex &mtx, ThrowIfCanceled throw_if_canceled) {
--        tbb::mutex::scoped_lock lock(mtx);
-+	std::pair<TimeStamp, bool> set_done(StepType step, std::mutex &mtx, ThrowIfCanceled throw_if_canceled) {
-+        std::scoped_lock<std::mutex> lock(mtx);
-         // If canceled, throw before changing the step state.
-         throw_if_canceled();
-         assert(m_state[step].state == STARTED);
-@@ -266,9 +262,9 @@ public:
-     // Return value:
-     // 		Current milestone (StepType).
-     // 		bool indicates whether the UI has to be updated or not.
--    std::pair<StepType, bool> active_step_add_warning(PrintStateBase::WarningLevel warning_level, const std::string &message, int message_id, tbb::mutex &mtx)
-+    std::pair<StepType, bool> active_step_add_warning(PrintStateBase::WarningLevel warning_level, const std::string &message, int message_id, std::mutex &mtx)
-     {
--        tbb::mutex::scoped_lock lock(mtx);
-+        std::scoped_lock<std::mutex> lock(mtx);
-         assert(m_step_active != -1);
-         StateWithWarnings &state = m_state[m_step_active];
-         assert(state.state == STARTED);
-@@ -314,7 +310,7 @@ protected:
-     PrintObjectBase(ModelObject *model_object) : m_model_object(model_object) {}
-     virtual ~PrintObjectBase() {}
-     // Declared here to allow access from PrintBase through friendship.
--	static tbb::mutex&                  state_mutex(PrintBase *print);
-+	static std::mutex&                  state_mutex(PrintBase *print);
- 	static std::function<void()>        cancel_callback(PrintBase *print);
- 	// Notify UI about a new warning of a milestone "step" on this PrintObjectBase.
- 	// The UI will be notified by calling a status callback registered on print.
-@@ -461,7 +457,7 @@ protected:
- 	friend class PrintObjectBase;
-     friend class BackgroundSlicingProcess;
- 
--    tbb::mutex&            state_mutex() const { return m_state_mutex; }
-+    std::mutex&            state_mutex() const { return m_state_mutex; }
-     std::function<void()>  cancel_callback() { return m_cancel_callback; }
- 	void				   call_cancel_callback() { m_cancel_callback(); }
- 	// Notify UI about a new warning of a milestone "step" on this PrintBase.
-@@ -486,7 +482,7 @@ protected:
-     status_callback_type                    m_status_callback;
- 
- private:
--    tbb::atomic<CancelStatus>               m_cancel_status;
-+    std::atomic<CancelStatus>               m_cancel_status;
- 
-     // Callback to be evoked to stop the background processing before a state is updated.
-     cancel_callback_type                    m_cancel_callback = [](){};
-@@ -494,7 +490,7 @@ private:
-     // Mutex used for synchronization of the worker thread with the UI thread:
-     // The mutex will be used to guard the worker thread against entering a stage
-     // while the data influencing the stage is modified.
--    mutable tbb::mutex                      m_state_mutex;
-+    mutable std::mutex                      m_state_mutex;
- };
- 
- template<typename PrintStepEnum, const size_t COUNT>
diff --git a/prusaslicer/patches/patch-src_libslic3r_PrintObject.cpp b/prusaslicer/patches/patch-src_libslic3r_PrintObject.cpp
deleted file mode 100644
index 20e2d1d2f5..0000000000
--- a/prusaslicer/patches/patch-src_libslic3r_PrintObject.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD$
-
-Migrate away from features deprecated in tbb 2021.3.
-Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
-
---- src/libslic3r/PrintObject.cpp.orig	2021-07-16 10:14:03.000000000 +0000
-+++ src/libslic3r/PrintObject.cpp
-@@ -19,7 +19,6 @@
- #include <float.h>
- 
- #include <tbb/parallel_for.h>
--#include <tbb/atomic.h>
- 
- #include <Shiny/Shiny.h>
- 
diff --git a/prusaslicer/patches/patch-src_libslic3r_SLAPrint.cpp b/prusaslicer/patches/patch-src_libslic3r_SLAPrint.cpp
deleted file mode 100644
index a7dc9c2660..0000000000
--- a/prusaslicer/patches/patch-src_libslic3r_SLAPrint.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-$NetBSD$
-
-Migrate away from features deprecated in tbb 2021.3.
-Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
-
---- src/libslic3r/SLAPrint.cpp.orig	2021-07-16 10:14:03.000000000 +0000
-+++ src/libslic3r/SLAPrint.cpp
-@@ -19,8 +19,6 @@
- #include <libnest2d/tools/benchmark.h>
- #endif
- 
--//#include <tbb/spin_mutex.h>//#include "tbb/mutex.h"
--
- #include "I18N.hpp"
- 
- //! macro used to mark string used at localization,
-@@ -118,7 +116,7 @@ bool validate_pad(const TriangleMesh &pa
- 
- void SLAPrint::clear()
- {
--    tbb::mutex::scoped_lock lock(this->state_mutex());
-+    std::scoped_lock<std::mutex> lock(this->state_mutex());
-     // The following call should stop background processing if it is running.
-     this->invalidate_all_steps();
-     for (SLAPrintObject *object : m_objects)
-@@ -212,7 +210,7 @@ SLAPrint::ApplyStatus SLAPrint::apply(co
-         update_apply_status(false);
- 
-     // Grab the lock for the Print / PrintObject milestones.
--    tbb::mutex::scoped_lock lock(this->state_mutex());
-+    std::scoped_lock<std::mutex> lock(this->state_mutex());
- 
-     // The following call may stop the background processing.
-     bool invalidate_all_model_objects = false;
-@@ -514,7 +512,7 @@ SLAPrint::ApplyStatus SLAPrint::apply(co
- void SLAPrint::set_task(const TaskParams &params)
- {
-     // Grab the lock for the Print / PrintObject milestones.
--    tbb::mutex::scoped_lock lock(this->state_mutex());
-+    std::scoped_lock<std::mutex> lock(this->state_mutex());
- 
-     int n_object_steps = int(params.to_object_step) + 1;
-     if (n_object_steps == 0)
-@@ -884,7 +882,7 @@ bool SLAPrint::is_step_done(SLAPrintObje
- {
-     if (m_objects.empty())
-         return false;
--    tbb::mutex::scoped_lock lock(this->state_mutex());
-+    std::scoped_lock<std::mutex> lock(this->state_mutex());
-     for (const SLAPrintObject *object : m_objects)
-         if (! object->is_step_done_unguarded(step))
-             return false;
diff --git a/prusaslicer/patches/patch-src_libslic3r_SLA_Concurrency.hpp b/prusaslicer/patches/patch-src_libslic3r_SLA_Concurrency.hpp
deleted file mode 100644
index 4b40252e99..0000000000
--- a/prusaslicer/patches/patch-src_libslic3r_SLA_Concurrency.hpp
+++ /dev/null
@@ -1,29 +0,0 @@
-$NetBSD$
-
-Migrate away from features deprecated in tbb 2021.3.
-Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
-
---- src/libslic3r/SLA/Concurrency.hpp.orig	2021-07-16 10:14:03.000000000 +0000
-+++ src/libslic3r/SLA/Concurrency.hpp
-@@ -2,11 +2,11 @@
- #define SLA_CONCURRENCY_H
- 
- #include <tbb/spin_mutex.h>
--#include <tbb/mutex.h>
- #include <tbb/parallel_for.h>
- #include <tbb/parallel_reduce.h>
- 
- #include <algorithm>
-+#include <mutex>
- #include <numeric>
- 
- #include <libslic3r/libslic3r.h>
-@@ -23,7 +23,7 @@ template<bool> struct _ccr {};
- template<> struct _ccr<true>
- {
-     using SpinningMutex = tbb::spin_mutex;
--    using BlockingMutex = tbb::mutex;
-+    using BlockingMutex = std::mutex;
- 
-     template<class Fn, class It>
-     static IteratorOnly<It, void> loop_(const tbb::blocked_range<It> &range, Fn &&fn)
diff --git a/prusaslicer/patches/patch-src_libslic3r_SLA_SupportTree.cpp b/prusaslicer/patches/patch-src_libslic3r_SLA_SupportTree.cpp
deleted file mode 100644
index e8a1234aba..0000000000
--- a/prusaslicer/patches/patch-src_libslic3r_SLA_SupportTree.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-$NetBSD$
-
-Migrate away from features deprecated in tbb 2021.3.
-Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
-
---- src/libslic3r/SLA/SupportTree.cpp.orig	2021-07-16 10:14:03.000000000 +0000
-+++ src/libslic3r/SLA/SupportTree.cpp
-@@ -16,9 +16,6 @@
- #include <libnest2d/optimizers/nlopt/genetic.hpp>
- #include <libnest2d/optimizers/nlopt/subplex.hpp>
- #include <boost/log/trivial.hpp>
--#include <tbb/parallel_for.h>
--#include <tbb/mutex.h>
--#include <tbb/spin_mutex.h>
- #include <libslic3r/I18N.hpp>
- 
- //! macro used to mark string used at localization,
diff --git a/prusaslicer/patches/patch-src_libslic3r_SupportMaterial.cpp b/prusaslicer/patches/patch-src_libslic3r_SupportMaterial.cpp
deleted file mode 100644
index 944af9550c..0000000000
--- a/prusaslicer/patches/patch-src_libslic3r_SupportMaterial.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD$
-
-Migrate away from features deprecated in tbb 2021.3.
-Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
-
---- src/libslic3r/SupportMaterial.cpp.orig	2021-07-16 10:14:03.000000000 +0000
-+++ src/libslic3r/SupportMaterial.cpp
-@@ -12,7 +12,6 @@
- #include <boost/log/trivial.hpp>
- 
- #include <tbb/parallel_for.h>
--#include <tbb/atomic.h>
- #include <tbb/spin_mutex.h>
- #include <tbb/task_group.h>
- 
diff --git a/prusaslicer/patches/patch-src_libslic3r_Thread.cpp b/prusaslicer/patches/patch-src_libslic3r_Thread.cpp
index 232e0afa69..603d855809 100644
--- a/prusaslicer/patches/patch-src_libslic3r_Thread.cpp
+++ b/prusaslicer/patches/patch-src_libslic3r_Thread.cpp
@@ -1,24 +1,9 @@
 $NetBSD$
 
 pthread_setname_np takes 3 arguments on NetBSD.
-Migrate away from features deprecated in tbb 2021.3.
-Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
 
---- src/libslic3r/Thread.cpp.orig	2021-07-16 10:14:03.000000000 +0000
+--- src/libslic3r/Thread.cpp.orig	2021-12-17 14:00:02.000000000 +0000
 +++ src/libslic3r/Thread.cpp
-@@ -9,10 +9,10 @@
- #include <atomic>
- #include <condition_variable>
- #include <mutex>
-+#include <thread>
-+#include <tbb/global_control.h>
- #include <tbb/parallel_for.h>
--#include <tbb/tbb_thread.h>
- #include <tbb/task_arena.h>
--#include <tbb/task_scheduler_init.h>
- 
- #include "Thread.hpp"
- 
 @@ -156,6 +156,36 @@ std::optional<std::string> get_current_t
  	return std::nullopt;
  }
@@ -67,29 +52,21 @@ Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
  
  #endif // _WIN32
  
-@@ -206,13 +238,13 @@ void name_tbb_thread_pool_threads()
- 	nthreads = 1;
+@@ -241,6 +273,9 @@ void name_tbb_thread_pool_threads_set_lo
+ #else
+ 				// We are leaking some memory here, because the newlocale() produced memory will never be released.
+ 				// This is not a problem though, as there will be a maximum one worker thread created per physical thread.
++#ifdef __NetBSD__
++                                setlocale(LC_ALL, "C");
++#else
+ 				uselocale(newlocale(
+ #ifdef __APPLE__
+ 					LC_ALL_MASK
+@@ -249,6 +284,7 @@ void name_tbb_thread_pool_threads_set_lo
  #endif
- 
--	if (nthreads != nthreads_hw) 
--		new tbb::task_scheduler_init(int(nthreads));
-+	if (nthreads != nthreads_hw)
-+		tbb::global_control(tbb::global_control::max_allowed_parallelism, nthreads);
- 
- 	std::atomic<size_t>		nthreads_running(0);
- 	std::condition_variable cv;
- 	std::mutex				cv_m;
--	auto					master_thread_id = tbb::this_tbb_thread::get_id();
-+	auto					master_thread_id = std::this_thread::get_id();
-     tbb::parallel_for(
-         tbb::blocked_range<size_t>(0, nthreads, 1),
-         [&nthreads_running, nthreads, &master_thread_id, &cv, &cv_m](const tbb::blocked_range<size_t> &range) {
-@@ -226,7 +258,7 @@ void name_tbb_thread_pool_threads()
- 				std::unique_lock<std::mutex> lk(cv_m);
- 			    cv.wait(lk, [&nthreads_running, nthreads]{return nthreads_running == nthreads;});
-         	}
--        	auto thread_id = tbb::this_tbb_thread::get_id();
-+        	auto thread_id = std::this_thread::get_id();
- 			if (thread_id == master_thread_id) {
- 				// The calling thread runs the 0'th task.
- 				assert(range.begin() == 0);
+ 					, "C", nullptr));
+ #endif
++#endif
+     		}
+         });
+ }
diff --git a/prusaslicer/patches/patch-src_libslic3r_pchheader.hpp b/prusaslicer/patches/patch-src_libslic3r_pchheader.hpp
deleted file mode 100644
index 39dc8a883a..0000000000
--- a/prusaslicer/patches/patch-src_libslic3r_pchheader.hpp
+++ /dev/null
@@ -1,20 +0,0 @@
-$NetBSD$
-
-Migrate away from features deprecated in tbb 2021.3.
-Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
-
---- src/libslic3r/pchheader.hpp.orig	2021-07-16 10:14:03.000000000 +0000
-+++ src/libslic3r/pchheader.hpp
-@@ -93,12 +93,9 @@
- #include <boost/thread.hpp>
- #include <boost/version.hpp>
- 
--#include <tbb/atomic.h>
- #include <tbb/parallel_for.h>
- #include <tbb/spin_mutex.h>
--#include <tbb/mutex.h>
- #include <tbb/task_group.h>
--#include <tbb/task_scheduler_init.h>
- 
- #include <Eigen/Dense>
- #include <Eigen/Geometry>
diff --git a/prusaslicer/patches/patch-src_libslic3r_utils.cpp b/prusaslicer/patches/patch-src_libslic3r_utils.cpp
deleted file mode 100644
index fbc68bbf85..0000000000
--- a/prusaslicer/patches/patch-src_libslic3r_utils.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-$NetBSD$
-
-Migrate away from features deprecated in tbb 2021.3.
-Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
-
---- src/libslic3r/utils.cpp.orig	2021-07-16 10:14:03.000000000 +0000
-+++ src/libslic3r/utils.cpp
-@@ -43,7 +43,7 @@
- #include <boost/nowide/convert.hpp>
- #include <boost/nowide/cstdio.hpp>
- 
--#include <tbb/task_scheduler_init.h>
-+#include <tbb/global_control.h>
- 
- #if defined(__linux__) || defined(__GNUC__ )
- #include <strings.h>
-@@ -118,9 +118,7 @@ void trace(unsigned int level, const cha
- void disable_multi_threading()
- {
-     // Disable parallelization so the Shiny profiler works
--    static tbb::task_scheduler_init *tbb_init = nullptr;
--    if (tbb_init == nullptr)
--        tbb_init = new tbb::task_scheduler_init(1);
-+    tbb::global_control(tbb::global_control::max_allowed_parallelism, 1);
- }
- 
- static std::string g_var_dir;
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_BackgroundSlicingProcess.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_BackgroundSlicingProcess.cpp
deleted file mode 100644
index d02bb5651a..0000000000
--- a/prusaslicer/patches/patch-src_slic3r_GUI_BackgroundSlicingProcess.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-$NetBSD$
-
-Migrate away from features deprecated in tbb 2021.3.
-Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
-
---- src/slic3r/GUI/BackgroundSlicingProcess.cpp.orig	2021-07-16 10:14:03.000000000 +0000
-+++ src/slic3r/GUI/BackgroundSlicingProcess.cpp
-@@ -465,7 +465,7 @@ void BackgroundSlicingProcess::schedule_
- 		return;
- 
- 	// Guard against entering the export step before changing the export path.
--	tbb::mutex::scoped_lock lock(m_print->state_mutex());
-+	std::scoped_lock<std::mutex> lock(m_print->state_mutex());
- 	this->invalidate_step(bspsGCodeFinalize);
- 	m_export_path = path;
- 	m_export_path_on_removable_media = export_path_on_removable_media;
-@@ -478,7 +478,7 @@ void BackgroundSlicingProcess::schedule_
- 		return;
- 
- 	// Guard against entering the export step before changing the export path.
--	tbb::mutex::scoped_lock lock(m_print->state_mutex());
-+	std::scoped_lock<std::mutex> lock(m_print->state_mutex());
- 	this->invalidate_step(bspsGCodeFinalize);
- 	m_export_path.clear();
- 	m_upload_job = std::move(upload_job);
-@@ -491,7 +491,7 @@ void BackgroundSlicingProcess::reset_exp
- 		m_export_path.clear();
- 		m_export_path_on_removable_media = false;
- 		// invalidate_step expects the mutex to be locked.
--		tbb::mutex::scoped_lock lock(m_print->state_mutex());
-+		std::scoped_lock<std::mutex> lock(m_print->state_mutex());
- 		this->invalidate_step(bspsGCodeFinalize);
- 	}
- }
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_BackgroundSlicingProcess.hpp b/prusaslicer/patches/patch-src_slic3r_GUI_BackgroundSlicingProcess.hpp
deleted file mode 100644
index abbff925eb..0000000000
--- a/prusaslicer/patches/patch-src_slic3r_GUI_BackgroundSlicingProcess.hpp
+++ /dev/null
@@ -1,16 +0,0 @@
-$NetBSD$
-
-Migrate away from features deprecated in tbb 2021.3.
-Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
-
---- src/slic3r/GUI/BackgroundSlicingProcess.hpp.orig	2021-07-16 10:14:03.000000000 +0000
-+++ src/slic3r/GUI/BackgroundSlicingProcess.hpp
-@@ -213,7 +213,7 @@ private:
- 	State 						m_state = STATE_INITIAL;
- 
-     PrintState<BackgroundSlicingProcessStep, bspsCount>   	m_step_state;
--    mutable tbb::mutex                      				m_step_state_mutex;
-+    mutable std::mutex                      				m_step_state_mutex;
- 	bool                set_step_started(BackgroundSlicingProcessStep step);
- 	void                set_step_done(BackgroundSlicingProcessStep step);
- 	bool 				is_step_done(BackgroundSlicingProcessStep step) const;
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_ConfigWizard.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_ConfigWizard.cpp
new file mode 100644
index 0000000000..eb224d25a9
--- /dev/null
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_ConfigWizard.cpp
@@ -0,0 +1,33 @@
+$NetBSD$
+
+Treat NetBSD like Linux.
+
+--- src/slic3r/GUI/ConfigWizard.cpp.orig	2021-12-17 14:00:02.000000000 +0000
++++ src/slic3r/GUI/ConfigWizard.cpp
+@@ -48,7 +48,7 @@
+ #include "MsgDialog.hpp"
+ #include "UnsavedChangesDialog.hpp"
+ 
+-#if defined(__linux__) && defined(__WXGTK3__)
++#if (defined(__linux__) || defined(__NetBSD__)) && defined(__WXGTK3__)
+ #define wxLinux_gtk3 true
+ #else
+ #define wxLinux_gtk3 false
+@@ -508,7 +508,7 @@ void PageWelcome::set_run_reason(ConfigW
+     const bool data_empty = run_reason == ConfigWizard::RR_DATA_EMPTY;
+     welcome_text->Show(data_empty);
+     cbox_reset->Show(!data_empty);
+-#if defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)
++#if (defined(__linux__) || defined(__NetBSD__)) && defined(SLIC3R_DESKTOP_INTEGRATION)
+     if (!DesktopIntegrationDialog::is_integrated())
+         cbox_integrate->Show(true);
+     else
+@@ -2595,7 +2595,7 @@ bool ConfigWizard::priv::apply_config(Ap
+         if ((check_unsaved_preset_changes = install_bundles.size() > 0))
+             header = _L_PLURAL("A new vendor was installed and one of its printers will be activated", "New vendors were installed and one of theirs printers will be activated", install_bundles.size());
+ 
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+     // Desktop integration on Linux
+     if (page_welcome->integrate_desktop()) 
+         DesktopIntegrationDialog::perform_desktop_integration();
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_ConfigWizard__private.hpp b/prusaslicer/patches/patch-src_slic3r_GUI_ConfigWizard__private.hpp
new file mode 100644
index 0000000000..221c444774
--- /dev/null
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_ConfigWizard__private.hpp
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Treat NetBSD like Linux.
+
+--- src/slic3r/GUI/ConfigWizard_private.hpp.orig	2021-12-17 14:00:02.000000000 +0000
++++ src/slic3r/GUI/ConfigWizard_private.hpp
+@@ -619,7 +619,7 @@ struct ConfigWizard::priv
+     bool apply_config(AppConfig *app_config, PresetBundle *preset_bundle, const PresetUpdater *updater, bool& apply_keeped_changes);
+     // #ys_FIXME_alise
+     void update_presets_in_config(const std::string& section, const std::string& alias_key, bool add);
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+     void perform_desktop_integration() const;
+ #endif
+     bool check_fff_selected();        // Used to decide whether to display Filaments page
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_DesktopIntegrationDialog.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_DesktopIntegrationDialog.cpp
new file mode 100644
index 0000000000..5d886a71d3
--- /dev/null
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_DesktopIntegrationDialog.cpp
@@ -0,0 +1,19 @@
+$NetBSD$
+
+Treat NetBSD like Linux.
+
+--- src/slic3r/GUI/DesktopIntegrationDialog.cpp.orig	2021-12-17 14:00:02.000000000 +0000
++++ src/slic3r/GUI/DesktopIntegrationDialog.cpp
+@@ -1,4 +1,4 @@
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+ #include "DesktopIntegrationDialog.hpp"
+ #include "GUI_App.hpp"
+ #include "GUI.hpp"
+@@ -503,4 +503,4 @@ DesktopIntegrationDialog::~DesktopIntegr
+ 
+ } // namespace GUI
+ } // namespace Slic3r
+-#endif // __linux__
+\ No newline at end of file
++#endif // __linux__
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_DesktopIntegrationDialog.hpp b/prusaslicer/patches/patch-src_slic3r_GUI_DesktopIntegrationDialog.hpp
new file mode 100644
index 0000000000..0fffc55a55
--- /dev/null
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_DesktopIntegrationDialog.hpp
@@ -0,0 +1,19 @@
+$NetBSD$
+
+Treat NetBSD like Linux.
+
+--- src/slic3r/GUI/DesktopIntegrationDialog.hpp.orig	2021-12-17 14:00:02.000000000 +0000
++++ src/slic3r/GUI/DesktopIntegrationDialog.hpp
+@@ -1,4 +1,4 @@
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+ #ifndef slic3r_DesktopIntegrationDialog_hpp_
+ #define slic3r_DesktopIntegrationDialog_hpp_
+ 
+@@ -36,4 +36,4 @@ private:
+ } // namespace Slic3r
+ 
+ #endif // slic3r_DesktopIntegrationDialog_hpp_
+-#endif // __linux__
+\ No newline at end of file
++#endif // __linux__
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_ExtraRenderers.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_ExtraRenderers.cpp
new file mode 100644
index 0000000000..3515758ca9
--- /dev/null
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_ExtraRenderers.cpp
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Treat NetBSD like Linux.
+
+--- src/slic3r/GUI/ExtraRenderers.cpp.orig	2021-12-17 14:00:02.000000000 +0000
++++ src/slic3r/GUI/ExtraRenderers.cpp
+@@ -320,7 +320,7 @@ wxWindow* BitmapChoiceRenderer::CreateEd
+     c_editor->SetSelection(atoi(data.GetText().c_str()));
+ 
+     
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+     c_editor->Bind(wxEVT_COMBOBOX, [this](wxCommandEvent& evt) {
+         // to avoid event propagation to other sidebar items
+         evt.StopPropagation();
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_GLCanvas3D.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_GLCanvas3D.cpp
new file mode 100644
index 0000000000..6de5d4bbb2
--- /dev/null
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_GLCanvas3D.cpp
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Undef any Convex macro, regardless of OS.
+
+--- src/slic3r/GUI/GLCanvas3D.cpp.orig	2021-12-17 14:00:02.000000000 +0000
++++ src/slic3r/GUI/GLCanvas3D.cpp
+@@ -96,7 +96,7 @@ float RetinaHelper::get_scale_factor() {
+ #endif // __WXGTK3__
+ 
+ // Fixed the collision between BuildVolume::Type::Convex and macro Convex defined inside /usr/include/X11/X.h that is included by WxWidgets 3.0.
+-#if defined(__linux__) && defined(Convex)
++#ifdef Convex
+ #undef Convex
+ #endif
+ 
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_GUI__App.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_GUI__App.cpp
new file mode 100644
index 0000000000..aa47130f26
--- /dev/null
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_GUI__App.cpp
@@ -0,0 +1,114 @@
+$NetBSD$
+
+Treat NetBSD like Linux.
+
+--- src/slic3r/GUI/GUI_App.cpp.orig	2021-12-17 14:00:02.000000000 +0000
++++ src/slic3r/GUI/GUI_App.cpp
+@@ -374,7 +374,7 @@ private:
+ };
+ 
+ 
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+ bool static check_old_linux_datadir(const wxString& app_name) {
+     // If we are on Linux and the datadir does not exist yet, look into the old
+     // location where the datadir was before version 2.3. If we find it there,
+@@ -833,7 +833,7 @@ wxGLContext* GUI_App::init_glcontext(wxG
+ 
+ bool GUI_App::init_opengl()
+ {
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+     bool status = m_opengl_mgr.init_gl();
+     m_opengl_initialized = true;
+     return status;
+@@ -873,7 +873,7 @@ void GUI_App::init_app_config()
+ 	// Mac : "~/Library/Application Support/Slic3r"
+ 
+     if (data_dir().empty()) {
+-        #ifndef __linux__
++        #if !defined(__linux__) && !defined(__NetBSD__)
+             set_data_dir(wxStandardPaths::Get().GetUserDataDir().ToUTF8().data());
+         #else
+             // Since version 2.3, config dir on Linux is in ${XDG_CONFIG_HOME}.
+@@ -1063,7 +1063,7 @@ bool GUI_App::on_init_inner()
+     wxCHECK_MSG(wxDirExists(resources_dir), false,
+         wxString::Format("Resources path does not exist or is not a directory: %s", resources_dir));
+ 
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+     if (! check_old_linux_datadir(GetAppName())) {
+         std::cerr << "Quitting, user chose to move their data to new location." << std::endl;
+         return false;
+@@ -1152,7 +1152,7 @@ bool GUI_App::on_init_inner()
+         // create splash screen with updated bmp
+         scrn = new SplashScreen(bmp.IsOk() ? bmp : create_scaled_bitmap("PrusaSlicer", nullptr, 400), 
+                                 wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_TIMEOUT, 4000, splashscreen_pos);
+-#ifndef __linux__
++#if !defined(__linux__) && !defined(__NetBSD__)
+         wxYield();
+ #endif
+         scrn->SetText(_L("Loading configuration")+ dots);
+@@ -1294,7 +1294,7 @@ bool GUI_App::on_init_inner()
+ 
+         // An ugly solution to GH #5537 in which GUI_App::init_opengl (normally called from events wxEVT_PAINT
+         // and wxEVT_SET_FOCUS before GUI_App::post_init is called) wasn't called before GUI_App::post_init and OpenGL wasn't initialized.
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+         if (update_gui_after_init && m_opengl_initialized) {
+ #else
+         if (update_gui_after_init) {
+@@ -1814,7 +1814,7 @@ bool GUI_App::switch_language()
+     }
+ }
+ 
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+ static const wxLanguageInfo* linux_get_existing_locale_language(const wxLanguageInfo* language,
+                                                                 const wxLanguageInfo* system_language)
+ {
+@@ -2003,7 +2003,7 @@ bool GUI_App::load_language(wxString lan
+ 				m_language_info_best = wxLocale::FindLanguageInfo(best_language);
+ 	        	BOOST_LOG_TRIVIAL(trace) << boost::format("Best translation language detected (may be different from user locales): %1%") % m_language_info_best->CanonicalName.ToUTF8().data();
+ 			}
+-            #ifdef __linux__
++            #if defined(__linux__) || defined(__NetBSD__)
+             wxString lc_all;
+             if (wxGetEnv("LC_ALL", &lc_all) && ! lc_all.IsEmpty()) {
+                 // Best language returned by wxWidgets on Linux apparently does not respect LC_ALL.
+@@ -2056,7 +2056,7 @@ bool GUI_App::load_language(wxString lan
+     } else if (m_language_info_system != nullptr && language_info->CanonicalName.BeforeFirst('_') == m_language_info_system->CanonicalName.BeforeFirst('_'))
+         language_info = m_language_info_system;
+ 
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+     // If we can't find this locale , try to use different one for the language
+     // instead of just reporting that it is impossible to switch.
+     if (! wxLocale::IsAvailable(language_info->Language)) {
+@@ -2156,7 +2156,7 @@ void GUI_App::add_config_menu(wxMenuBar 
+         local_menu->Append(config_id_base + ConfigMenuSnapshots, _L("&Configuration Snapshots") + dots, _L("Inspect / activate configuration snapshots"));
+         local_menu->Append(config_id_base + ConfigMenuTakeSnapshot, _L("Take Configuration &Snapshot"), _L("Capture a configuration snapshot"));
+         local_menu->Append(config_id_base + ConfigMenuUpdate, _L("Check for Configuration Updates"), _L("Check for configuration updates"));
+-#if defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION) 
++#if (defined(__linux__) || defined(__NetBSD__)) && defined(SLIC3R_DESKTOP_INTEGRATION) 
+         //if (DesktopIntegrationDialog::integration_possible())
+         local_menu->Append(config_id_base + ConfigMenuDesktopIntegration, _L("Desktop Integration"), _L("Desktop Integration"));    
+ #endif //(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)        
+@@ -2200,7 +2200,7 @@ void GUI_App::add_config_menu(wxMenuBar 
+ 		case ConfigMenuUpdate:
+ 			check_updates(true);
+ 			break;
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+         case ConfigMenuDesktopIntegration:
+             show_desktop_integration_dialog();
+             break;
+@@ -2817,7 +2817,7 @@ bool GUI_App::run_wizard(ConfigWizard::R
+ 
+ void GUI_App::show_desktop_integration_dialog()
+ {
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+     //wxCHECK_MSG(mainframe != nullptr, false, "Internal error: Main frame not created / null");
+     DesktopIntegrationDialog dialog(mainframe);
+     dialog.ShowModal();
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_GUI__App.hpp b/prusaslicer/patches/patch-src_slic3r_GUI_GUI__App.hpp
new file mode 100644
index 0000000000..6e35813672
--- /dev/null
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_GUI__App.hpp
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Treat NetBSD like Linux.
+
+--- src/slic3r/GUI/GUI_App.hpp.orig	2021-12-17 14:00:02.000000000 +0000
++++ src/slic3r/GUI/GUI_App.hpp
+@@ -112,7 +112,7 @@ private:
+     bool            m_app_conf_exists{ false };
+     EAppMode        m_app_mode{ EAppMode::Editor };
+     bool            m_is_recreating_gui{ false };
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+     bool            m_opengl_initialized{ false };
+ #endif
+ 
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_GUI__Preview.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_GUI__Preview.cpp
new file mode 100644
index 0000000000..7fab708879
--- /dev/null
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_GUI__Preview.cpp
@@ -0,0 +1,32 @@
+$NetBSD$
+
+Treat NetBSD like Linux.
+
+--- src/slic3r/GUI/GUI_Preview.cpp.orig	2021-12-17 14:00:02.000000000 +0000
++++ src/slic3r/GUI/GUI_Preview.cpp
+@@ -359,7 +359,7 @@ void Preview::load_print(bool keep_z_ran
+ 
+ void Preview::reload_print(bool keep_volumes)
+ {
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+     // We are getting mysterious crashes on Linux in gtk due to OpenGL context activation GH #1874 #1955.
+     // So we are applying a workaround here: a delayed release of OpenGL vertex buffers.
+     if (!IsShown())
+@@ -369,14 +369,14 @@ void Preview::reload_print(bool keep_vol
+     }
+ #endif /* __linux__ */
+     if (
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+         m_volumes_cleanup_required || 
+ #endif /* __linux__ */
+         !keep_volumes)
+     {
+         m_canvas->reset_volumes();
+         m_loaded = false;
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+         m_volumes_cleanup_required = false;
+ #endif /* __linux__ */
+     }
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_GUI__Preview.hpp b/prusaslicer/patches/patch-src_slic3r_GUI_GUI__Preview.hpp
new file mode 100644
index 0000000000..fbb2bab068
--- /dev/null
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_GUI__Preview.hpp
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Treat NetBSD like Linux.
+
+--- src/slic3r/GUI/GUI_Preview.hpp.orig	2021-12-17 14:00:02.000000000 +0000
++++ src/slic3r/GUI/GUI_Preview.hpp
+@@ -95,7 +95,7 @@ class Preview : public wxPanel
+     BackgroundSlicingProcess* m_process;
+     GCodeProcessorResult* m_gcode_result;
+ 
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+     // We are getting mysterious crashes on Linux in gtk due to OpenGL context activation GH #1874 #1955.
+     // So we are applying a workaround here.
+     bool m_volumes_cleanup_required { false };
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_GUI__Utils.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_GUI__Utils.cpp
new file mode 100644
index 0000000000..4118a6d6c2
--- /dev/null
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_GUI__Utils.cpp
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Treat NetBSD like Linux.
+
+--- src/slic3r/GUI/GUI_Utils.cpp.orig	2021-12-17 14:00:02.000000000 +0000
++++ src/slic3r/GUI/GUI_Utils.cpp
+@@ -48,7 +48,7 @@ void on_window_geometry(wxTopLevelWindow
+     // cf. https://groups.google.com/forum/#!topic/wx-users/c7ntMt6piRI
+     // OTOH the geometry is available very soon, so we can call the callback right away
+     callback();
+-#elif defined __linux__
++#elif defined(__linux__) || defined(__NetBSD__)
+     tlw->Bind(wxEVT_SHOW, [=](wxShowEvent &evt) {
+         // On Linux, the geometry is only available after wxEVT_SHOW + CallAfter
+         // cf. https://groups.google.com/forum/?pli=1#!topic/wx-users/fERSXdpVwAI
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_HintNotification.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_HintNotification.cpp
new file mode 100644
index 0000000000..d0ab57ceab
--- /dev/null
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_HintNotification.cpp
@@ -0,0 +1,25 @@
+$NetBSD$
+
+Treat NetBSD like Linux.
+
+--- src/slic3r/GUI/HintNotification.cpp.orig	2021-12-17 14:00:02.000000000 +0000
++++ src/slic3r/GUI/HintNotification.cpp
+@@ -715,8 +715,11 @@ void NotificationManager::HintNotificati
+ 	if (is_finished())
+ 		return;
+ 
++	// stix
++	// wxGetApp().imgui()->new_frame();
+ 	count_spaces();
+ 	count_lines();
++	// ImGui::EndFrame();
+ 
+ 	m_multiline = true;
+ 
+@@ -1058,4 +1061,4 @@ void NotificationManager::HintNotificati
+     }
+ }
+ } //namespace Slic3r 
+-} //namespace GUI 
+\ No newline at end of file
++} //namespace GUI 
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_InstanceCheck.hpp b/prusaslicer/patches/patch-src_slic3r_GUI_InstanceCheck.hpp
index 5d6cb5ce2f..b59f818eb9 100644
--- a/prusaslicer/patches/patch-src_slic3r_GUI_InstanceCheck.hpp
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_InstanceCheck.hpp
@@ -1,16 +1,24 @@
 $NetBSD$
 
-Migrate away from features deprecated in tbb 2021.3.
-Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
+Treat NetBSD like Linux.
 
---- src/slic3r/GUI/InstanceCheck.hpp.orig	2021-07-16 10:14:03.000000000 +0000
+--- src/slic3r/GUI/InstanceCheck.hpp.orig	2021-12-17 14:00:02.000000000 +0000
 +++ src/slic3r/GUI/InstanceCheck.hpp
-@@ -13,7 +13,7 @@
+@@ -11,7 +11,7 @@
  
- #if __linux__
+ #include <boost/filesystem.hpp>
+ 
+-#if __linux__
++#if defined(__linux__) || defined(__NetBSD__)
  #include <boost/thread.hpp>
--#include <tbb/mutex.h>
-+#include <mutex>
+ #include <mutex>
  #include <condition_variable>
+@@ -38,7 +38,7 @@ namespace GUI {
+ 
+ class MainFrame;
+ 
+-#if __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+     #define BACKGROUND_MESSAGE_LISTENER
  #endif // __linux__
  
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_Mouse3DController.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_Mouse3DController.cpp
index 5b1b2a321c..12f40e0fef 100644
--- a/prusaslicer/patches/patch-src_slic3r_GUI_Mouse3DController.cpp
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_Mouse3DController.cpp
@@ -1,159 +1,24 @@
 $NetBSD$
 
-Migrate away from features deprecated in tbb 2021.3.
-Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
+Treat NetBSD like Linux.
 
---- src/slic3r/GUI/Mouse3DController.cpp.orig	2021-07-16 10:14:03.000000000 +0000
+--- src/slic3r/GUI/Mouse3DController.cpp.orig	2021-12-17 14:00:02.000000000 +0000
 +++ src/slic3r/GUI/Mouse3DController.cpp
-@@ -66,7 +66,7 @@ void update_maximum(std::atomic<T>& maxi
+@@ -880,7 +880,7 @@ bool Mouse3DController::connect_device()
  
- void Mouse3DController::State::append_translation(const Vec3d& translation, size_t input_queue_max_size)
- {
--	tbb::mutex::scoped_lock lock(m_input_queue_mutex);
-+    std::scoped_lock<std::mutex> lock(m_input_queue_mutex);
-     while (m_input_queue.size() >= input_queue_max_size)
-         m_input_queue.pop_front();
-     m_input_queue.emplace_back(QueueItem::translation(translation));
-@@ -77,7 +77,7 @@ void Mouse3DController::State::append_tr
- 
- void Mouse3DController::State::append_rotation(const Vec3f& rotation, size_t input_queue_max_size)
- {
--	tbb::mutex::scoped_lock lock(m_input_queue_mutex);
-+    std::scoped_lock<std::mutex> lock(m_input_queue_mutex);
-     while (m_input_queue.size() >= input_queue_max_size)
-         m_input_queue.pop_front();
-     m_input_queue.emplace_back(QueueItem::rotation(rotation.cast<double>()));
-@@ -92,7 +92,7 @@ void Mouse3DController::State::append_ro
- 
- void Mouse3DController::State::append_button(unsigned int id, size_t /* input_queue_max_size */)
- {
--	tbb::mutex::scoped_lock lock(m_input_queue_mutex);
-+    std::scoped_lock<std::mutex> lock(m_input_queue_mutex);
-     m_input_queue.emplace_back(QueueItem::buttons(id));
- #if ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT
-     update_maximum(input_queue_max_size_achieved, m_input_queue.size());
-@@ -277,7 +277,7 @@ void Mouse3DController::device_attached(
- #if ENABLE_CTRL_M_ON_WINDOWS
-             m_device_str = format_device_string(vid, pid);
-             if (auto it_params = m_params_by_device.find(m_device_str); it_params != m_params_by_device.end()) {
--                tbb::mutex::scoped_lock lock(m_params_ui_mutex);
-+                std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
-                 m_params = m_params_ui = it_params->second;
-             }
-             else
-@@ -295,7 +295,7 @@ void Mouse3DController::device_detached(
-     int pid = 0;
-     if (sscanf(device.c_str(), "\\\\?\\HID#VID_%x&PID_%x&", &vid, &pid) == 2) {
-         if (std::find(_3DCONNEXION_VENDORS.begin(), _3DCONNEXION_VENDORS.end(), vid) != _3DCONNEXION_VENDORS.end()) {
--            tbb::mutex::scoped_lock lock(m_params_ui_mutex);
-+            std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
-             m_params_by_device[format_device_string(vid, pid)] = m_params_ui;
-         }
-     }
-@@ -307,12 +307,12 @@ void Mouse3DController::device_detached(
- // Filter out mouse scroll events produced by the 3DConnexion driver.
- bool Mouse3DController::State::process_mouse_wheel()
- {
--	tbb::mutex::scoped_lock lock(m_input_queue_mutex);
--	if (m_mouse_wheel_counter == 0)
--    	// No 3DConnexion rotation has been captured since the last mouse scroll event.
-+    std::scoped_lock<std::mutex> lock(m_input_queue_mutex);
-+    if (m_mouse_wheel_counter == 0)
-+        // No 3DConnexion rotation has been captured since the last mouse scroll event.
-         return false;
-     if (std::find_if(m_input_queue.begin(), m_input_queue.end(), [](const QueueItem &item){ return item.is_rotation(); }) != m_input_queue.end()) {
--    	// There is a rotation stored in the queue. Suppress one mouse scroll event.
-+        // There is a rotation stored in the queue. Suppress one mouse scroll event.
-         -- m_mouse_wheel_counter;
-         return true;
-     }
-@@ -329,7 +329,7 @@ bool Mouse3DController::State::apply(con
-     std::deque<QueueItem> input_queue;
-     {
-     	// Atomically move m_input_queue to input_queue.
--    	tbb::mutex::scoped_lock lock(m_input_queue_mutex);
-+    	std::scoped_lock<std::mutex> lock(m_input_queue_mutex);
-     	input_queue = std::move(m_input_queue);
-         m_input_queue.clear();
-     }
-@@ -418,7 +418,7 @@ bool Mouse3DController::apply(Camera& ca
- #if ENABLE_CTRL_M_ON_WINDOWS
- #ifdef _WIN32
-     {
--        tbb::mutex::scoped_lock lock(m_params_ui_mutex);
-+        std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
-         if (m_params_ui_changed) {
-             m_params = m_params_ui;
-             m_params_ui_changed = false;
-@@ -447,7 +447,7 @@ void Mouse3DController::render_settings_
-     Params params_copy;
-     bool   params_changed = false;
-     {
--    	tbb::mutex::scoped_lock lock(m_params_ui_mutex);
-+    	std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
-     	params_copy = m_params_ui;
-     }
- 
-@@ -565,7 +565,7 @@ void Mouse3DController::render_settings_
- 
-     if (params_changed) {
-         // Synchronize front end parameters to back end.
--    	tbb::mutex::scoped_lock lock(m_params_ui_mutex);
-+    	std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
-         auto pthis = const_cast<Mouse3DController*>(this);
- #if ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT
-         if (params_copy.input_queue_max_size != params_copy.input_queue_max_size)
-@@ -586,7 +586,7 @@ void Mouse3DController::connected(std::s
- 	m_device_str = device_name;
-     // Copy the parameters for m_device_str into the current parameters.
-     if (auto it_params = m_params_by_device.find(m_device_str); it_params != m_params_by_device.end()) {
--    	tbb::mutex::scoped_lock lock(m_params_ui_mutex);
-+    	std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
-     	m_params = m_params_ui = it_params->second;
-     }
-     m_connected = true;
-@@ -597,7 +597,7 @@ void Mouse3DController::disconnected()
-     // Copy the current parameters for m_device_str into the parameter database.
-     assert(m_connected == ! m_device_str.empty());
-     if (m_connected) {
--        tbb::mutex::scoped_lock lock(m_params_ui_mutex);
-+        std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
-         m_params_by_device[m_device_str] = m_params_ui;
- 	    m_device_str.clear();
- 	    m_connected = false;
-@@ -621,7 +621,7 @@ bool Mouse3DController::handle_input(con
-     {
-     	// Synchronize parameters between the UI thread and the background thread.
-     	//FIXME is this necessary on OSX? Are these notifications triggered from the main thread or from a worker thread?
--    	tbb::mutex::scoped_lock lock(m_params_ui_mutex);
-+    	std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
-     	if (m_params_ui_changed) {
-     		m_params = m_params_ui;
-     		m_params_ui_changed = false;
-@@ -733,7 +733,7 @@ void Mouse3DController::run()
- 
-     for (;;) {
-         {
--        	tbb::mutex::scoped_lock lock(m_params_ui_mutex);
-+        	std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
-         	if (m_stop)
-         		break;
-         	if (m_params_ui_changed) {
-@@ -998,7 +998,7 @@ bool Mouse3DController::connect_device()
+     for (const DetectedDevices::value_type& device : detected_devices) {
+         if (device.second.size() == 1) {
+-#if defined(__linux__)
++#if defined(__linux__) || defined(__NetBSD__)
+             hid_device* test_device = hid_open(device.first.first, device.first.second, nullptr);
+             if (test_device == nullptr) {
+                 BOOST_LOG_TRIVIAL(error) << "3DConnexion device cannot be opened: " << device.second.front().path <<
+@@ -905,7 +905,7 @@ bool Mouse3DController::connect_device()
+                 std::cout << "Test device: " << std::hex << device.first.first << std::dec << "/" << std::hex << device.first.second << std::dec << " \"" << data.path << "\"";
  #endif // ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT
-         // Copy the parameters for m_device_str into the current parameters.
-         if (auto it_params = m_params_by_device.find(m_device_str); it_params != m_params_by_device.end()) {
--	    	tbb::mutex::scoped_lock lock(m_params_ui_mutex);
-+	    	std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
- 	    	m_params = m_params_ui = it_params->second;
- 	    }
-     }
-@@ -1023,7 +1023,7 @@ void Mouse3DController::disconnect_devic
- 	    BOOST_LOG_TRIVIAL(info) << "Disconnected device: " << m_device_str;
-         // Copy the current parameters for m_device_str into the parameter database.
-         {
--	        tbb::mutex::scoped_lock lock(m_params_ui_mutex);
-+	        std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
- 	        m_params_by_device[m_device_str] = m_params_ui;
- 	    }
- 	    m_device_str.clear();
+ 
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+                 hid_device* test_device = hid_open_path(data.path.c_str());
+                 if (test_device != nullptr) {
+                     path = data.path;
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_Mouse3DController.hpp b/prusaslicer/patches/patch-src_slic3r_GUI_Mouse3DController.hpp
index 97cc39d568..ca8ed5a92a 100644
--- a/prusaslicer/patches/patch-src_slic3r_GUI_Mouse3DController.hpp
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_Mouse3DController.hpp
@@ -1,12 +1,10 @@
 $NetBSD$
 
 pkgsrc hidapi.h is one level deeper than builtin.
-Migrate away from features deprecated in tbb 2021.3.
-Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
 
---- src/slic3r/GUI/Mouse3DController.hpp.orig	2021-07-16 10:14:03.000000000 +0000
+--- src/slic3r/GUI/Mouse3DController.hpp.orig	2021-12-17 14:00:02.000000000 +0000
 +++ src/slic3r/GUI/Mouse3DController.hpp
-@@ -6,16 +6,16 @@
+@@ -6,7 +6,7 @@
  
  #include "libslic3r/Point.hpp"
  
@@ -15,46 +13,3 @@ Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
  
  #include <queue>
  #include <atomic>
-+#include <mutex>
- #include <thread>
- #include <vector>
- #include <chrono>
- #include <condition_variable>
- 
--#include <tbb/mutex.h>
- 
- namespace Slic3r {
- 
-@@ -85,7 +85,7 @@ class Mouse3DController
-     	// m_input_queue is accessed by the background thread and by the UI thread. Access to m_input_queue
-     	// is guarded with m_input_queue_mutex.
-         std::deque<QueueItem> m_input_queue;
--        mutable tbb::mutex	  m_input_queue_mutex;
-+        mutable std::mutex	  m_input_queue_mutex;
- 
- #ifdef WIN32
-         // When the 3Dconnexion driver is running the system gets, by default, mouse wheel events when rotations around the X axis are detected.
-@@ -112,12 +112,12 @@ class Mouse3DController
- 
- #if ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT
-         Vec3d               get_first_vector_of_type(unsigned int type) const {
--            tbb::mutex::scoped_lock lock(m_input_queue_mutex);
-+            std::scoped_lock<std::mutex> lock(m_input_queue_mutex);
-             auto it = std::find_if(m_input_queue.begin(), m_input_queue.end(), [type](const QueueItem& item) { return item.type_or_buttons == type; });
-             return (it == m_input_queue.end()) ? Vec3d::Zero() : it->vector;
-         }
-         size_t              input_queue_size_current() const { 
--        	tbb::mutex::scoped_lock lock(m_input_queue_mutex); 
-+        	std::scoped_lock<std::mutex> lock(m_input_queue_mutex); 
-         	return m_input_queue.size(); 
-         }
-         std::atomic<size_t> input_queue_max_size_achieved;
-@@ -133,7 +133,7 @@ class Mouse3DController
-     // UI thread will read / write this copy.
-     Params 				m_params_ui;
-     bool 	            m_params_ui_changed { false };
--    mutable tbb::mutex	m_params_ui_mutex;
-+    mutable std::mutex	m_params_ui_mutex;
- 
-     // This is a database of parametes of all 3DConnexion devices ever connected.
-     // This database is loaded from AppConfig on application start and it is stored to AppConfig on application exit.
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_NotificationManager.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_NotificationManager.cpp
new file mode 100644
index 0000000000..505985c0a0
--- /dev/null
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_NotificationManager.cpp
@@ -0,0 +1,18 @@
+$NetBSD$
+
+Treat NetBSD like Linux.
+
+--- src/slic3r/GUI/NotificationManager.cpp.orig	2021-12-17 14:00:02.000000000 +0000
++++ src/slic3r/GUI/NotificationManager.cpp
+@@ -337,8 +337,11 @@ void NotificationManager::PopNotificatio
+ 	if (is_finished())
+ 		return;
+ 
++	// stix
++	// wxGetApp().imgui()->new_frame();
+ 	count_spaces();
+ 	count_lines();
++	// ImGui::EndFrame();
+ 
+ 	if (m_lines_count == 3)
+ 		m_multiline = true;
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_Plater.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_Plater.cpp
new file mode 100644
index 0000000000..3aa387617e
--- /dev/null
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_Plater.cpp
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Treat NetBSD like Linux.
+
+--- src/slic3r/GUI/Plater.cpp.orig	2021-12-17 14:00:02.000000000 +0000
++++ src/slic3r/GUI/Plater.cpp
+@@ -4214,7 +4214,7 @@ void Plater::priv::on_right_click(RBtnEv
+     }
+ 
+     if (q != nullptr && menu) {
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+         // For some reason on Linux the menu isn't displayed if position is specified
+         // (even though the position is sane).
+         q->PopupMenu(menu);
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_PresetComboBoxes.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_PresetComboBoxes.cpp
new file mode 100644
index 0000000000..f72ce23787
--- /dev/null
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_PresetComboBoxes.cpp
@@ -0,0 +1,24 @@
+$NetBSD$
+
+Treat NetBSD like Linux.
+
+--- src/slic3r/GUI/PresetComboBoxes.cpp.orig	2021-12-17 14:00:02.000000000 +0000
++++ src/slic3r/GUI/PresetComboBoxes.cpp
+@@ -584,7 +584,7 @@ PlaterPresetComboBox::PlaterPresetComboB
+     {
+         // In a case of a physical printer, for its editing open PhysicalPrinterDialog
+         if (m_type == Preset::TYPE_PRINTER
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+             // To edit extruder color from the sidebar
+             || m_type == Preset::TYPE_FILAMENT
+ #endif //__linux__
+@@ -716,7 +716,7 @@ void PlaterPresetComboBox::show_edit_men
+     append_menu_item(menu, wxID_ANY, _L("Edit preset"), "",
+         [this](wxCommandEvent&) { this->switch_to_tab(); }, "cog", menu, []() { return true; }, wxGetApp().plater());
+ 
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+     // To edit extruder color from the sidebar
+     if (m_type == Preset::TYPE_FILAMENT) {
+         append_menu_item(menu, wxID_ANY, _L("Change extruder color"), "",
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_PresetComboBoxes.hpp b/prusaslicer/patches/patch-src_slic3r_GUI_PresetComboBoxes.hpp
new file mode 100644
index 0000000000..4aaed86147
--- /dev/null
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_PresetComboBoxes.hpp
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Treat NetBSD like Linux.
+
+--- src/slic3r/GUI/PresetComboBoxes.hpp.orig	2021-12-17 14:00:02.000000000 +0000
++++ src/slic3r/GUI/PresetComboBoxes.hpp
+@@ -111,7 +111,7 @@ protected:
+     void validate_selection(bool predicate = false);
+     void update_selection();
+ 
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+     static const char* separator_head() { return "------- "; }
+     static const char* separator_tail() { return " -------"; }
+ #else // __linux__ 
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_PrintHostDialogs.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_PrintHostDialogs.cpp
new file mode 100644
index 0000000000..1c3500c50d
--- /dev/null
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_PrintHostDialogs.cpp
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Treat NetBSD like Linux.
+
+--- src/slic3r/GUI/PrintHostDialogs.cpp.orig	2021-12-17 14:00:02.000000000 +0000
++++ src/slic3r/GUI/PrintHostDialogs.cpp
+@@ -121,7 +121,7 @@ PrintHostSendDialog::PrintHostSendDialog
+     }
+     finalize();
+ 
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+     // On Linux with GTK2 when text control lose the focus then selection (colored background) disappears but text color stay white
+     // and as a result the text is invisible with light mode
+     // see https://github.com/prusa3d/PrusaSlicer/issues/4532
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_RemovableDriveManager.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_RemovableDriveManager.cpp
index a1c940824e..34db9065ae 100644
--- a/prusaslicer/patches/patch-src_slic3r_GUI_RemovableDriveManager.cpp
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_RemovableDriveManager.cpp
@@ -1,109 +1,15 @@
 $NetBSD$
 
-Migrate away from features deprecated in tbb 2021.3.
-Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
+Treat NetBSD like Linux.
 
---- src/slic3r/GUI/RemovableDriveManager.cpp.orig	2021-07-16 10:14:03.000000000 +0000
+--- src/slic3r/GUI/RemovableDriveManager.cpp.orig	2021-12-17 14:00:02.000000000 +0000
 +++ src/slic3r/GUI/RemovableDriveManager.cpp
-@@ -84,7 +84,7 @@ void RemovableDriveManager::eject_drive(
- 	this->update();
- #endif // REMOVABLE_DRIVE_MANAGER_OS_CALLBACKS
- 	BOOST_LOG_TRIVIAL(info) << "Ejecting started"; 
--	tbb::mutex::scoped_lock lock(m_drives_mutex);
-+	std::scoped_lock<std::mutex> lock(m_drives_mutex);
- 	auto it_drive_data = this->find_last_save_path_drive_data();
- 	if (it_drive_data != m_current_drives.end()) {
- 		// get handle to device
-@@ -130,7 +130,7 @@ std::string RemovableDriveManager::get_r
- 	this->update();
- #endif // REMOVABLE_DRIVE_MANAGER_OS_CALLBACKS
- 
--	tbb::mutex::scoped_lock lock(m_drives_mutex);
-+	std::scoped_lock<std::mutex> lock(m_drives_mutex);
- 	if (m_current_drives.empty())
- 		return std::string();
- 	std::size_t found = path.find_last_of("\\");
-@@ -146,7 +146,7 @@ std::string RemovableDriveManager::get_r
- 
- std::string RemovableDriveManager::get_removable_drive_from_path(const std::string& path)
- {
--	tbb::mutex::scoped_lock lock(m_drives_mutex);
-+	std::scoped_lock<std::mutex> lock(m_drives_mutex);
- 	std::size_t found = path.find_last_of("\\");
- 	std::string new_path = path.substr(0, found);
- 	int letter = PathGetDriveNumberW(boost::nowide::widen(new_path).c_str());	
-@@ -285,7 +285,7 @@ void RemovableDriveManager::eject_drive(
- 
- 	DriveData drive_data;
- 	{
--		tbb::mutex::scoped_lock lock(m_drives_mutex);
-+		std::scoped_lock<std::mutex> lock(m_drives_mutex);
- 		auto it_drive_data = this->find_last_save_path_drive_data();
- 		if (it_drive_data == m_current_drives.end())
- 			return;
-@@ -341,7 +341,7 @@ void RemovableDriveManager::eject_drive(
- 		if (success) {
- 			// Remove the drive_data from m_current drives, searching by value, not by pointer, as m_current_drives may get modified during
- 			// asynchronous execution on m_eject_thread.
--			tbb::mutex::scoped_lock lock(m_drives_mutex);
-+			std::scoped_lock<std::mutex> lock(m_drives_mutex);
- 			auto it = std::find(m_current_drives.begin(), m_current_drives.end(), drive_data);
- 			if (it != m_current_drives.end())
- 				m_current_drives.erase(it);
-@@ -361,7 +361,7 @@ std::string RemovableDriveManager::get_r
- 	std::size_t found = path.find_last_of("/");
- 	std::string new_path = found == path.size() - 1 ? path.substr(0, found) : path;
- 
--	tbb::mutex::scoped_lock lock(m_drives_mutex);
-+	std::scoped_lock<std::mutex> lock(m_drives_mutex);
- 	for (const DriveData &data : m_current_drives)
- 		if (search_for_drives_internal::compare_filesystem_id(new_path, data.path))
- 			return path;
-@@ -377,7 +377,7 @@ std::string RemovableDriveManager::get_r
-     new_path = new_path.substr(0, found);
-     
- 	// check if same filesystem
--	tbb::mutex::scoped_lock lock(m_drives_mutex);
-+	std::scoped_lock<std::mutex> lock(m_drives_mutex);
- 	for (const DriveData &drive_data : m_current_drives)
- 		if (search_for_drives_internal::compare_filesystem_id(new_path, drive_data.path))
- 			return drive_data.path;
-@@ -452,7 +452,7 @@ RemovableDriveManager::RemovableDrivesSt
- 
- 	RemovableDriveManager::RemovableDrivesStatus out;
- 	{
--		tbb::mutex::scoped_lock lock(m_drives_mutex);
-+		std::scoped_lock<std::mutex> lock(m_drives_mutex);
- 		out.has_eject = 
- 			// Cannot control eject on Chromium.
- 			platform_flavor() != PlatformFlavor::LinuxOnChromium &&
-@@ -468,17 +468,17 @@ RemovableDriveManager::RemovableDrivesSt
- // Update is called from thread_proc() and from most of the public methods on demand.
- void RemovableDriveManager::update()
- {
--	tbb::mutex::scoped_lock inside_update_lock;
-+	std::unique_lock<std::mutex> inside_update_lock(m_inside_update_mutex, std::defer_lock);
- #ifdef _WIN32
- 	// All wake up calls up to now are now consumed when the drive enumeration starts.
- 	m_wakeup = false;
- #endif // _WIN32
--	if (inside_update_lock.try_acquire(m_inside_update_mutex)) {
-+	if (inside_update_lock.try_lock()) {
- 		// Got the lock without waiting. That means, the update was not running.
- 		// Run the update.
- 		std::vector<DriveData> current_drives = this->search_for_removable_drives();
- 		// Post update events.
--		tbb::mutex::scoped_lock lock(m_drives_mutex);
-+		std::scoped_lock<std::mutex> lock(m_drives_mutex);
- 		std::sort(current_drives.begin(), current_drives.end());
- 		if (current_drives != m_current_drives) {
- 			assert(m_callback_evt_handler);
-@@ -489,7 +489,7 @@ void RemovableDriveManager::update()
- 	} else {
- 		// Acquiring the m_iniside_update lock failed, therefore another update is running.
- 		// Just block until the other instance of update() finishes.
--		inside_update_lock.acquire(m_inside_update_mutex);
-+		inside_update_lock.lock();
- 	}
- }
- 
+@@ -187,7 +187,7 @@ namespace search_for_drives_internal 
+ 		//confirms if the file is removable drive and adds it to vector
+ 
+ 		if (
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+ 			// Chromium mounts removable drives in a way that produces the same device ID.
+ 			platform_flavor() == PlatformFlavor::LinuxOnChromium ||
+ #endif
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_RemovableDriveManager.hpp b/prusaslicer/patches/patch-src_slic3r_GUI_RemovableDriveManager.hpp
deleted file mode 100644
index ed5955f1fd..0000000000
--- a/prusaslicer/patches/patch-src_slic3r_GUI_RemovableDriveManager.hpp
+++ /dev/null
@@ -1,28 +0,0 @@
-$NetBSD$
-
-Migrate away from features deprecated in tbb 2021.3.
-Adapted from upstream git commit e13535f822b5efe0e3b471bc366e8d3ea96059d5.
-
---- src/slic3r/GUI/RemovableDriveManager.hpp.orig	2021-07-16 10:14:03.000000000 +0000
-+++ src/slic3r/GUI/RemovableDriveManager.hpp
-@@ -5,7 +5,7 @@
- #include <string>
- 
- #include <boost/thread.hpp>
--#include <tbb/mutex.h>
-+#include <mutex>
- #include <condition_variable>
- 
- // Custom wxWidget events
-@@ -111,9 +111,9 @@ private:
- 	// m_current_drives is guarded by m_drives_mutex
- 	// sorted ascending by path
- 	std::vector<DriveData> 	m_current_drives;
--	mutable tbb::mutex 		m_drives_mutex;
-+	mutable std::mutex 		m_drives_mutex;
- 	// Locking the update() function to avoid that the function is executed multiple times.
--	mutable tbb::mutex 		m_inside_update_mutex;
-+	mutable std::mutex 		m_inside_update_mutex;
- 
- 	// Returns drive path (same as path in DriveData) if exists otherwise empty string.
- 	std::string 			get_removable_drive_from_path(const std::string& path);
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_Tab.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_Tab.cpp
new file mode 100644
index 0000000000..3ee5dfc071
--- /dev/null
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_Tab.cpp
@@ -0,0 +1,51 @@
+$NetBSD$
+
+Treat NetBSD like Linux.
+
+--- src/slic3r/GUI/Tab.cpp.orig	2021-12-17 14:00:02.000000000 +0000
++++ src/slic3r/GUI/Tab.cpp
+@@ -320,7 +320,7 @@ void Tab::create_preset_tab()
+     // This helps to process all the cursor key events on Windows in the tree control,
+     // so that the cursor jumps to the last item.
+     m_treectrl->Bind(wxEVT_TREE_SEL_CHANGED, [this](wxTreeEvent&) {
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+         // Events queue is opposite On Linux. wxEVT_SET_FOCUS invokes after wxEVT_TREE_SEL_CHANGED,
+         // and a result wxEVT_KILL_FOCUS doesn't invoke for the TextCtrls.
+         // see https://github.com/prusa3d/PrusaSlicer/issues/5720
+@@ -1744,7 +1744,7 @@ void TabPrint::update_description_lines(
+     if (m_active_page && m_active_page->title() == "Output options" && m_post_process_explanation) {
+         m_post_process_explanation->SetText(
+             _L("Post processing scripts shall modify G-code file in place."));
+-#ifndef __linux__
++#if !defined(__linux__) && !defined(__NetBSD__)
+         m_post_process_explanation->SetPathEnd("post-processing-scripts_283913");
+ #endif // __linux__
+     }
+@@ -3117,7 +3117,7 @@ void Tab::load_current_preset()
+                         else
+ #endif
+                             wxGetApp().tab_panel()->InsertPage(wxGetApp().tab_panel()->FindPage(this), tab, tab->title());
+-                        #ifdef __linux__ // the tabs apparently need to be explicitly shown on Linux (pull request #1563)
++                        #if defined(__linux__) || defined(__NetBSD__) // the tabs apparently need to be explicitly shown on Linux (pull request #1563)
+                             int page_id = wxGetApp().tab_panel()->FindPage(tab);
+                             wxGetApp().tab_panel()->GetPage(page_id)->Show(true);
+                         #endif // __linux__
+@@ -3491,7 +3491,7 @@ bool Tab::tree_sel_change_delayed()
+     // There is a bug related to Ubuntu overlay scrollbars, see https://github.com/prusa3d/PrusaSlicer/issues/898 and https://github.com/prusa3d/PrusaSlicer/issues/952.
+     // The issue apparently manifests when Show()ing a window with overlay scrollbars while the UI is frozen. For this reason,
+     // we will Thaw the UI prematurely on Linux. This means destroing the no_updates object prematurely.
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+     std::unique_ptr<wxWindowUpdateLocker> no_updates(new wxWindowUpdateLocker(this));
+ #else
+     /* On Windows we use DoubleBuffering during rendering,
+@@ -3537,7 +3537,7 @@ bool Tab::tree_sel_change_delayed()
+         if (wxGetApp().mainframe!=nullptr && wxGetApp().mainframe->is_active_and_shown_tab(this))
+             activate_selected_page(throw_if_canceled);
+ 
+-        #ifdef __linux__
++	#if defined(__linux__) || defined(__NetBSD__)
+             no_updates.reset(nullptr);
+         #endif
+ 
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_UnsavedChangesDialog.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_UnsavedChangesDialog.cpp
new file mode 100644
index 0000000000..141e0c1815
--- /dev/null
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_UnsavedChangesDialog.cpp
@@ -0,0 +1,60 @@
+$NetBSD$
+
+Treat NetBSD like Linux.
+
+--- src/slic3r/GUI/UnsavedChangesDialog.cpp.orig	2021-12-17 14:00:02.000000000 +0000
++++ src/slic3r/GUI/UnsavedChangesDialog.cpp
+@@ -109,7 +109,7 @@ ModelNode::ModelNode(ModelNode* parent, 
+     UpdateIcons();
+ }
+ 
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+ wxIcon ModelNode::get_bitmap(const wxString& color)
+ #else
+ wxBitmap ModelNode::get_bitmap(const wxString& color)
+@@ -127,7 +127,7 @@ wxBitmap ModelNode::get_bitmap(const wxS
+     unsigned char rgb[3];
+     BitmapCache::parse_color(into_u8(color), rgb);
+     // there is no need to scale created solid bitmap
+-#ifndef __linux__
++#if !defined(__linux__) && !defined(__NetBSD__)
+     return bmp_cache.mksolid(icon_width, icon_height, rgb, true);
+ #else
+     wxIcon icon;
+@@ -210,7 +210,7 @@ void ModelNode::UpdateIcons()
+     if (m_icon_name.empty())
+         return;
+ 
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+     m_icon.CopyFromBitmap(create_scaled_bitmap(m_icon_name, m_parent_win, 16, !m_toggle));
+ #else
+     m_icon = create_scaled_bitmap(m_icon_name, m_parent_win, 16, !m_toggle);
+@@ -361,7 +361,7 @@ void DiffModel::GetValue(wxVariant& vari
+     case colToggle:
+         variant = node->m_toggle;
+         break;
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+     case colIconText:
+         variant << wxDataViewIconText(node->m_text, node->m_icon);
+         break;
+@@ -398,7 +398,7 @@ bool DiffModel::SetValue(const wxVariant
+     case colToggle:
+         node->m_toggle = variant.GetBool();
+         return true;
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+     case colIconText: {
+         wxDataViewIconText data;
+         data << variant;
+@@ -603,7 +603,7 @@ DiffViewCtrl::DiffViewCtrl(wxWindow* par
+ void DiffViewCtrl::AppendBmpTextColumn(const wxString& label, unsigned model_column, int width, bool set_expander/* = false*/)
+ {
+     m_columns_width.emplace(this->GetColumnCount(), width);
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+     wxDataViewIconTextRenderer* rd = new wxDataViewIconTextRenderer();
+ #ifdef SUPPORTS_MARKUP
+     rd->EnableMarkup(true);
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_UnsavedChangesDialog.hpp b/prusaslicer/patches/patch-src_slic3r_GUI_UnsavedChangesDialog.hpp
new file mode 100644
index 0000000000..62d4623922
--- /dev/null
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_UnsavedChangesDialog.hpp
@@ -0,0 +1,24 @@
+$NetBSD$
+
+Treat NetBSD like Linux.
+
+--- src/slic3r/GUI/UnsavedChangesDialog.hpp.orig	2021-12-17 14:00:02.000000000 +0000
++++ src/slic3r/GUI/UnsavedChangesDialog.hpp
+@@ -44,7 +44,7 @@ class ModelNode
+     wxString            m_old_color;
+     wxString            m_new_color;
+ 
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+     wxIcon              get_bitmap(const wxString& color);
+ #else
+     wxBitmap            get_bitmap(const wxString& color);
+@@ -53,7 +53,7 @@ class ModelNode
+ public:
+ 
+     bool        m_toggle {true};
+-#ifdef __linux__
++#if defined(__linux__) || defined(__NetBSD__)
+     wxIcon      m_icon;
+     wxIcon      m_old_color_bmp;
+     wxIcon      m_new_color_bmp;
diff --git a/prusaslicer/patches/patch-src_slic3r_GUI_wxExtensions.cpp b/prusaslicer/patches/patch-src_slic3r_GUI_wxExtensions.cpp
new file mode 100644
index 0000000000..08de460d9e
--- /dev/null
+++ b/prusaslicer/patches/patch-src_slic3r_GUI_wxExtensions.cpp
@@ -0,0 +1,27 @@
+$NetBSD$
+
+Treat NetBSD like Linux.
+
+--- src/slic3r/GUI/wxExtensions.cpp.orig	2021-12-17 14:00:02.000000000 +0000
++++ src/slic3r/GUI/wxExtensions.cpp
+@@ -17,7 +17,7 @@
+ #include "../Utils/MacDarkMode.hpp"
+ #include "BitmapComboBox.hpp"
+ 
+-#ifndef __linux__
++#if !defined(__linux__) && !defined(__NetBSD__)
+ // msw_menuitem_bitmaps is used for MSW and OSX
+ static std::map<int, std::string> msw_menuitem_bitmaps;
+ #ifdef __WXMSW__
+@@ -677,9 +677,9 @@ void ModeButton::focus_button(const bool
+     GetParent()->Refresh(); // force redraw a background of the selected mode button
+ #else
+     SetForegroundColour(wxSystemSettings::GetColour(focus ? wxSYS_COLOUR_BTNTEXT : 
+-#if defined (__linux__) && defined (__WXGTK3__)
++#if (defined(__linux__) || defined(__NetBSD__)) && defined (__WXGTK3__)
+         wxSYS_COLOUR_GRAYTEXT
+-#elif defined (__linux__) && defined (__WXGTK2__)
++#elif (defined (__linux__) || defined(__NetBSD__)) && defined (__WXGTK2__)
+         wxSYS_COLOUR_BTNTEXT
+ #else 
+         wxSYS_COLOUR_BTNSHADOW



Home | Main Index | Thread Index | Old Index