Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bambu-studio: init at 01.06.02.04 #206495

Merged
merged 6 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
From 7eed499898226222a949a792e0400ec10db4a1c9 Mon Sep 17 00:00:00 2001
From: Zhaofeng Li <hello@zhaofeng.li>
Date: Tue, 22 Nov 2022 13:00:39 -0700
Subject: [PATCH] [not for upstream] CMakeLists: Link against webkit2gtk in
libslic3r_gui

WebView.cpp uses symbols from webkitgtk directly. Upstream setup
links wxGTK statically so webkitgtk is already pulled in.

> /nix/store/039g378vc3pc3dvi9dzdlrd0i4q93qwf-binutils-2.39/bin/ld: slic3r/liblibslic3r_gui.a(WebView.cpp.o): undefined reference to symbol 'webkit_web_view_run_javascript_finish'
> /nix/store/039g378vc3pc3dvi9dzdlrd0i4q93qwf-binutils-2.39/bin/ld: /nix/store/8yvy428jy2nwq4dhmrcs7gj5r27a2pv6-webkitgtk-2.38.2+abi=4.0/lib/libwebkit2gtk-4.0.so.37: error adding symbols: DSO missing from command line
---
src/CMakeLists.txt | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9c5cb96..e92a0e3 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -175,6 +175,11 @@ if (WIN32)
target_link_libraries(BambuStudio_app_gui PRIVATE boost_headeronly)
endif ()

+# We link against webkit2gtk symbols in src/slic3r/GUI/Widgets/WebView.cpp
+if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ target_link_libraries(libslic3r_gui "-lwebkit2gtk-4.0")
+endif ()
+
# Link the resources dir to where Slic3r GUI expects it
set(output_dlls_Release "")
set(output_dlls_Debug "")
--
2.38.1

172 changes: 172 additions & 0 deletions pkgs/applications/misc/bambu-studio/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
{ stdenv
, lib
, openexr
, jemalloc
, c-blosc
, binutils
, fetchFromGitHub
, cmake
, pkg-config
, wrapGAppsHook
, boost179
, cereal
, cgal_5
, curl
, dbus
, eigen
, expat
, gcc-unwrapped
, glew
, glfw
, glib
, glib-networking
, gmp
, gstreamer
, gst-plugins-base
, gst-plugins-bad
, gtest
, gtk3
, hicolor-icon-theme
, ilmbase
, libpng
, mesa
, mpfr
, nlopt
, opencascade-occt
, openvdb
, pcre
, qhull
, systemd
, tbb_2021_8
, webkitgtk
, wxGTK31
, xorg
, fetchpatch
, withSystemd ? stdenv.isLinux
}:
let
wxGTK31' = wxGTK31.overrideAttrs (old: {
configureFlags = old.configureFlags ++ [
# Disable noisy debug dialogs
"--enable-debug=no"
];
});
openvdb_tbb_2021_8 = openvdb.overrideAttrs (old: rec {
buildInputs = [ openexr boost179 tbb_2021_8 jemalloc c-blosc ilmbase ];
});
in
stdenv.mkDerivation rec {
pname = "bambu-studio";
version = "01.08.00.62";

src = fetchFromGitHub {
owner = "bambulab";
repo = "BambuStudio";
rev = "v${version}";
hash = "sha256-Rb8YNf+ZQ8+9jAP/ZLze0PfY/liE7Rr2bJX33AENsbg=";
};

nativeBuildInputs = [
cmake
pkg-config
wrapGAppsHook
];

buildInputs = [
binutils
boost179
cereal
cgal_5
curl
dbus
eigen
expat
gcc-unwrapped
glew
glfw
glib
glib-networking
gmp
gstreamer
gst-plugins-base
gst-plugins-bad
gtk3
hicolor-icon-theme
ilmbase
libpng
mesa.osmesa
mpfr
nlopt
opencascade-occt
openvdb_tbb_2021_8
pcre
tbb_2021_8
webkitgtk
wxGTK31'
xorg.libX11
] ++ lib.optionals withSystemd [
systemd
] ++ checkInputs;

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

doCheck = true;
checkInputs = [ gtest ];

separateDebugInfo = true;

# The build system uses custom logic - defined in
# cmake/modules/FindNLopt.cmake in the package source - for finding the nlopt
# library, which doesn't pick up the package in the nix store. We
# additionally need to set the path via the NLOPT environment variable.
NLOPT = nlopt;

# Disable compiler warnings that clutter the build log.
# It seems to be a known issue for Eigen:
# http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1221
NIX_CFLAGS_COMPILE = "-Wno-ignored-attributes";

# prusa-slicer uses dlopen on `libudev.so` at runtime
NIX_LDFLAGS = lib.optionalString withSystemd "-ludev";

# TODO: macOS
prePatch = ''
# Since version 2.5.0 of nlopt we need to link to libnlopt, as libnlopt_cxx
# now seems to be integrated into the main lib.
sed -i 's|nlopt_cxx|nlopt|g' cmake/modules/FindNLopt.cmake
'';

cmakeFlags = [
"-DSLIC3R_STATIC=0"
"-DSLIC3R_FHS=1"
"-DSLIC3R_GTK=3"

# BambuStudio-specific
"-DBBL_RELEASE_TO_PUBLIC=1"
"-DBBL_INTERNAL_TESTING=0"
"-DDEP_WX_GTK3=ON"
"-DSLIC3R_BUILD_TESTS=0"
"-DCMAKE_CXX_FLAGS=-DBOOST_LOG_DYN_LINK"
];

preFixup = ''
gappsWrapperArgs+=(
--prefix LD_LIBRARY_PATH : "$out/lib"

# Fixes intermittent crash
# The upstream setup links in glew statically
--prefix LD_PRELOAD : "${glew.out}/lib/libGLEW.so"
)
'';

meta = with lib; {
description = "PC Software for BambuLab's 3D printers";
homepage = "https://github.com/bambulab/BambuStudio";
license = licenses.agpl3;
maintainers = with maintainers; [ zhaofengli ];
mainProgram = "bambu-studio";
};
}
6 changes: 6 additions & 0 deletions pkgs/development/libraries/wxwidgets/wxGTK31.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ lib
, stdenv
, fetchFromGitHub
, curl
, gst_all_1
, gtk3
, libGL
Expand All @@ -14,6 +15,8 @@
, compat28 ? false
, compat30 ? true
, unicode ? true
, withCurl ? false
, withPrivateFonts ? false
, withEGL ? true
, withMesa ? !stdenv.isDarwin
, withWebKit ? stdenv.isDarwin
Expand Down Expand Up @@ -59,6 +62,7 @@ stdenv.mkDerivation rec {
libXxf86vm
xorgproto
]
++ lib.optional withCurl curl
++ lib.optional withMesa libGLU
++ lib.optional (withWebKit && !stdenv.isDarwin) webkitgtk
++ lib.optional (withWebKit && stdenv.isDarwin) WebKit
Expand All @@ -85,6 +89,8 @@ stdenv.mkDerivation rec {
]
++ lib.optional (!withEGL) "--disable-glcanvasegl"
++ lib.optional unicode "--enable-unicode"
++ lib.optional withCurl "--enable-webrequest"
++ lib.optional withPrivateFonts "--enable-privatefonts"
++ lib.optional withMesa "--with-opengl"
++ lib.optionals stdenv.isDarwin [
"--with-osx_cocoa"
Expand Down
12 changes: 12 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35484,6 +35484,18 @@ with pkgs;

super-slicer-latest = super-slicer.latest;

bambu-studio = callPackage ../applications/misc/bambu-studio {
inherit (gst_all_1) gstreamer gst-plugins-base gst-plugins-bad;

glew = glew-egl;

wxGTK31 = wxGTK31.override {
withCurl = true;
withPrivateFonts = true;
withWebKit = true;
};
};

snapmaker-luban = callPackage ../applications/misc/snapmaker-luban { };

robustirc-bridge = callPackage ../servers/irc/robustirc-bridge { };
Expand Down