Skip to content

Commit

Permalink
orca-slicer: fix gcc14
Browse files Browse the repository at this point in the history
  • Loading branch information
liberodark committed Jan 1, 2025
1 parent 9c4c97a commit 8b7ae03
Showing 1 changed file with 181 additions and 47 deletions.
228 changes: 181 additions & 47 deletions pkgs/by-name/or/orca-slicer/package.nix
Original file line number Diff line number Diff line change
@@ -1,52 +1,186 @@
{
stdenv,
lib,
binutils,
fetchFromGitHub,
bambu-studio,
cmake,
pkg-config,
wrapGAppsHook3,
boost180,
cereal,
cgal,
curl,
dbus,
eigen,
expat,
ffmpeg,
gcc-unwrapped,
glew,
glfw,
glib,
glib-networking,
gmp,
gst_all_1,
gtest,
gtk3,
hicolor-icon-theme,
ilmbase,
libpng,
mesa,
mpfr,
nlopt,
opencascade-occt_7_6,
openvdb,
opencv,
pcre,
systemd,
tbb_2021_11,
webkitgtk_4_0,
wxGTK31,
xorg,
withSystemd ? stdenv.hostPlatform.isLinux,
}:
bambu-studio.overrideAttrs (
finalAttrs: previousAttrs: {
version = "2.2.0";
pname = "orca-slicer";

src = fetchFromGitHub {
owner = "SoftFever";
repo = "OrcaSlicer";
rev = "v${finalAttrs.version}";
hash = "sha256-h+cHWhrp894KEbb3ic2N4fNTn13WlOSYoMsaof0RvRI=";
};

patches = [
# Fix for webkitgtk linking
./patches/0001-not-for-upstream-CMakeLists-Link-against-webkit2gtk-.patch
./patches/dont-link-opencv-world-orca.patch
];
let
wxGTK' =
(wxGTK31.override {
withCurl = true;
withPrivateFonts = true;
withWebKit = true;
}).overrideAttrs
(old: {
configureFlags = old.configureFlags ++ [
# Disable noisy debug dialogs
"--enable-debug=no"
];
});
in
stdenv.mkDerivation rec {
pname = "orca-slicer";
version = "v2.2.0";

src = fetchFromGitHub {
owner = "SoftFever";
repo = "OrcaSlicer";
tag = version;
hash = "sha256-h+cHWhrp894KEbb3ic2N4fNTn13WlOSYoMsaof0RvRI=";
};

nativeBuildInputs = [
cmake
pkg-config
wrapGAppsHook3
];

buildInputs =
[
binutils
boost180
cereal
cgal
curl
dbus
eigen
expat
ffmpeg
gcc-unwrapped
glew
glfw
glib
glib-networking
gmp
gst_all_1.gstreamer
gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-bad
gst_all_1.gst-plugins-good
gtk3
hicolor-icon-theme
ilmbase
libpng
mesa
mpfr
nlopt
opencascade-occt_7_6
openvdb
pcre
tbb_2021_11
webkitgtk_4_0
wxGTK'
xorg.libX11
opencv
]
++ lib.optionals withSystemd [ systemd ]
++ checkInputs;

patches = [
# Fix for webkitgtk linking
./patches/0001-not-for-upstream-CMakeLists-Link-against-webkit2gtk-.patch
./patches/dont-link-opencv-world-orca.patch
];

doCheck = true;
checkInputs = [ gtest ];

separateDebugInfo = true;

preFixup = ''
gappsWrapperArgs+=(
# Fixes blackscreen dialogs
--set WEBKIT_DISABLE_COMPOSITING_MODE 1
)
'';

cmakeFlags = lib.remove "-DFLATPAK=1" previousAttrs.cmakeFlags or [ ];

# needed to prevent collisions between the LICENSE.txt files of
# bambu-studio and orca-slicer.
postInstall = ''
mv $out/LICENSE.txt $out/share/OrcaSlicer/LICENSE.txt
'';

meta = with lib; {
description = "G-code generator for 3D printers (Bambu, Prusa, Voron, VzBot, RatRig, Creality, etc.)";
homepage = "https://github.com/SoftFever/OrcaSlicer";
license = licenses.agpl3Only;
maintainers = with maintainers; [
zhaofengli
ovlach
pinpox
];
mainProgram = "orca-slicer";
platforms = platforms.linux;
};
}
)
NLOPT = nlopt;

NIX_CFLAGS_COMPILE = toString [
"-Wno-ignored-attributes"
"-I${opencv.out}/include/opencv4"
"-Wno-error=template-id-cdtor"
"-Wno-error=incompatible-pointer-types"
"-Wno-template-id-cdtor"
"-Wno-uninitialized"
"-Wno-unused-result"
"-Wno-deprecated-declarations"
"-DBOOST_ALLOW_DEPRECATED_HEADERS"
"-DBOOST_MATH_DISABLE_STD_FPCLASSIFY"
"-DBOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS"
"-DBOOST_MATH_DISABLE_FLOAT128"
"-DBOOST_MATH_NO_QUAD_SUPPORT"
"-DBOOST_MATH_MAX_FLOAT128_DIGITS=0"
"-DBOOST_CSTDFLOAT_NO_LIBQUADMATH_SUPPORT"
"-DBOOST_MATH_DISABLE_FLOAT128_BUILTIN_FPCLASSIFY"
];

NIX_LDFLAGS = lib.optionalString withSystemd "-ludev";

prePatch = ''
sed -i 's|nlopt_cxx|nlopt|g' cmake/modules/FindNLopt.cmake
'';

cmakeFlags = [
"-DSLIC3R_STATIC=0"
"-DSLIC3R_FHS=1"
"-DSLIC3R_GTK=3"
"-DBBL_RELEASE_TO_PUBLIC=1"
"-DBBL_INTERNAL_TESTING=0"
"-DDEP_WX_GTK3=ON"
"-DSLIC3R_BUILD_TESTS=0"
"-DCMAKE_CXX_FLAGS=-DBOOST_LOG_DYN_LINK"
"-DCMAKE_CXX_FLAGS=-DGL_SILENCE_DEPRECATION"
"-DCMAKE_EXE_LINKER_FLAGS=-Wl,--no-as-needed"
];

preFixup = ''
gappsWrapperArgs+=(
--prefix LD_LIBRARY_PATH : "$out/lib"
--prefix LD_PRELOAD : "${glew.out}/lib/libGLEW.so"
--set WEBKIT_DISABLE_COMPOSITING_MODE 1
)
'';

meta = with lib; {
description = "G-code generator for 3D printers (Bambu, Prusa, Voron, VzBot, RatRig, Creality, etc.)";
homepage = "https://github.com/SoftFever/OrcaSlicer";
license = licenses.agpl3Only;
maintainers = with maintainers; [
zhaofengli
ovlach
pinpox
liberodark
];
mainProgram = "orca-slicer";
platforms = platforms.linux;
};
}

0 comments on commit 8b7ae03

Please sign in to comment.