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

cura: 4.12.1 -> 5.1.0 #189042

Closed
wants to merge 5 commits into from
Closed
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
34 changes: 23 additions & 11 deletions pkgs/applications/misc/cura/default.nix
Original file line number Diff line number Diff line change
@@ -1,41 +1,49 @@
{ mkDerivation, lib, fetchFromGitHub, cmake, python3, qtbase,
qtquickcontrols2, qtgraphicaleffects, curaengine, plugins ? [] }:
{ stdenv, lib, fetchFromGitHub, cmake, python3, qtbase,
qtdeclarative, curaengine, plugins ? [], wrapQtAppsHook }:

mkDerivation rec {
stdenv.mkDerivation rec {
pname = "cura";
version = "4.13.1";
version = "5.1.0";

src = fetchFromGitHub {
owner = "Ultimaker";
repo = "Cura";
rev = version;
sha256 = "sha256-R88SdAxx3tkQCDInrFTKad1tPSDTSYaVAPUVmdk94Xk=";
sha256 = "sha256-Mt9fLJVD39QSjnUakfeCmwKfJZQSd2O9OzAiyGB2jpQ=";
};

materials = fetchFromGitHub {
owner = "Ultimaker";
repo = "fdm_materials";
rev = "4.13.2";
sha256 = "sha256-7y4OcbeQHv+loJ4cMgPU0e818Zsv90EwARdztNWS8zM=";
rev = version;
sha256 = "sha256-BZHPyKZePBGqd8loiknE0qUoLJCUy6cxBII598Eilg4";
};

buildInputs = [ qtbase qtquickcontrols2 qtgraphicaleffects ];
buildInputs = [ qtbase qtdeclarative ];
propagatedBuildInputs = with python3.pkgs; [
libsavitar numpy-stl pyserial requests uranium zeroconf pynest2d
sentry-sdk trimesh keyring
sentry-sdk trimesh keyring pyqt6 pyclipper
] ++ plugins;
nativeBuildInputs = [ cmake python3.pkgs.wrapPython ];
nativeBuildInputs = [ cmake python3.pkgs.wrapPython wrapQtAppsHook ];

cmakeFlags = [
"-DURANIUM_DIR=${python3.pkgs.uranium.src}"
"-DCURA_VERSION=${version}"
"-DPython_SITELIB_LOCAL=${python3.sitePackages}"
];

makeWrapperArgs = [
# hacky workaround for https://github.com/NixOS/nixpkgs/issues/59901
"--set OMP_NUM_THREADS 1"
];

prePatch = ''
substituteInPlace CMakeLists.txt --replace cura/CuraVersion.py.in CuraVersion.py.jinja
substituteInPlace CuraVersion.py.jinja \
--replace '{{ cura_debug_mode }}' False \
--replace '{{ cura_version }}' '${version}'
'';

postPatch = ''
sed -i 's,/python''${PYTHON_VERSION_MAJOR}/dist-packages,/python''${PYTHON_VERSION_MAJOR}.''${PYTHON_VERSION_MINOR}/site-packages,g' CMakeLists.txt
sed -i 's, executable_name = .*, executable_name = "${curaengine}/bin/CuraEngine",' plugins/CuraEngineBackend/CuraEngineBackend.py
Expand All @@ -51,8 +59,12 @@ mkDerivation rec {
'';

postFixup = ''
ls $out
ls $out/bin
ls $out/lib
wrapPythonPrograms
wrapQtApp $out/bin/cura
wrapQtApp $out/bin/cura_app.py
ln -s $out/bin/cura_app.py $out/bin/cura
'';

meta = with lib; {
Expand Down
55 changes: 48 additions & 7 deletions pkgs/applications/misc/curaengine/default.nix
Original file line number Diff line number Diff line change
@@ -1,26 +1,67 @@
{ lib, stdenv, fetchFromGitHub, cmake, libarcus, stb, protobuf }:
{ lib, stdenv, fetchFromGitHub, cmake, libarcus, pkg-config, stb, protobuf, zlib, clipper, rapidjson, boost, conan }:

let withConanCMakeDeps = conan.withConanCMakeDepsFile;
arcus =
(withConanCMakeDeps {package = libarcus; pkg_name = "arcus"; aliases = ["arcus::libarcus"];lib_search="Arcus";}); in
stdenv.mkDerivation rec {
pname = "curaengine";
version = "4.13.1";
version = "5.1.0";

src = fetchFromGitHub {
owner = "Ultimaker";
repo = "CuraEngine";
rev = version;
sha256 = "sha256-dx0Q6cuA66lG4nwR7quW5Tvs9sdxjdV4gtpxXirI4nY=";
sha256 = "sha256-DCYJDcFwfMegiro/H925MZLFyWXzvXWyEQFHCQukQQI=";
};

nativeBuildInputs = [ cmake ];
buildInputs = [ libarcus stb protobuf ];
nativeBuildInputs = [ pkg-config cmake ];

cmakeFlags = [ "-DCURA_ENGINE_VERSION=${version}" ];
buildInputs = [
(withConanCMakeDeps {package = clipper; pkg_name = "clipper"; lib_search="polyclipping";})
arcus
(withConanCMakeDeps {package = stb; version = "99999999999"; extra_includes="include/stb/"; })
protobuf
(withConanCMakeDeps {package = rapidjson;})
(withConanCMakeDeps {package = boost.dev;pkg_name = "Boost";})
zlib
];

cmakeFlags = [
"-DCURA_ENGINE_VERSION=${version}"
"-DUSE_SYSTEM_LIBS=true"
"-Dprotobuf_MODULE_COMPATIBLE=on"
"-DCMAKE_DEBUG_TARGET_PROPERTIES=INTERFACE_INCLUDE_DIRECTORIES"
"-DCMAKE_BUILD_TYPE=Release"
"-DBUILD_SHARED_LIBS=ON"
# "--debug-output"
# "--check-system-vars"
# "--trace-expand"
];

# NIX_CFLAGS_COMPILE="-I${stb}/include -I${}";
# NIX_LDFLAGS="-L${lib.getLib clipper}/lib -L${lib.getLib stb}/lib";

postPatch = ''
echo arcus = ${arcus}
echo $CMAKE_PREFIX_PATH
# echo ${builtins.concatStringsSep " " buildInputs}
# exit 1
# sed -i '2i include(CMakePackageConfigHelpers)' CMakeLists.txt
# sed -i '2i find_package(PkgConfig)' CMakeLists.txt
#sed -i 's|::libarcus|::arcus|' CMakeLists.txt
# sed -i 's|find_package(protobuf REQUIRED)|find_package(Protobuf 3.17.1 REQUIRED)|' CMakeLists.txt
# sed -i 's|find_package(clipper 6.4.2 REQUIRED)|find_library(clipper 6.4.2 REQUIRED NAMES polyclipping libpolyclipping)|g' CMakeLists.txt
# sed -i 's|find_package(rapidjson 1.1.0 REQUIRED)|find_package(rapidjson 1.1.0 REQUIRED NAMES RapidJSON rapidjson)|g' CMakeLists.txt
# sed -i 's|find_package(stb 20200203 REQUIRED)|find_library(stb REQUIRED NAMES stb)|g' CMakeLists.txt

grep -ri protobuf CMakeLists.txt
'';

meta = with lib; {
description = "A powerful, fast and robust engine for processing 3D models into 3D printing instruction";
homepage = "https://github.com/Ultimaker/CuraEngine";
license = licenses.agpl3Only;
platforms = platforms.linux;
maintainers = with maintainers; [ abbradar gebner ];
maintainers = with maintainers; [ abbradar gebner LunNova ];
};
}
4 changes: 2 additions & 2 deletions pkgs/development/libraries/clipper/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, cmake, ninja, unzip }:
{ lib, stdenv, fetchurl, cmake, ninja, unzip, pkg-config }:

stdenv.mkDerivation rec {
version = "6.4.2";
Expand All @@ -12,7 +12,7 @@ stdenv.mkDerivation rec {

buildInputs = [ ];

nativeBuildInputs = [ cmake ninja unzip ];
nativeBuildInputs = [ cmake ninja unzip pkg-config ];

meta = with lib; {
description = "A polygon and line clipping and offsetting library (C++, C#, Delphi)";
Expand Down
46 changes: 40 additions & 6 deletions pkgs/development/libraries/libnest2d/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{ lib, stdenv, fetchFromGitHub, cmake, clipper, nlopt, boost, python3 }:
{ lib, stdenv, fetchFromGitHub, cmake, clipper, nlopt, boost, conan }:

let withConanCMakeDeps = conan.withConanCMakeDepsFile;
in
stdenv.mkDerivation rec {
version = "4.12.0";
version = "5.1.0";
pname = "libnest2d";

# This revision is waiting to be merged upstream
Expand All @@ -10,15 +12,47 @@ stdenv.mkDerivation rec {
src = fetchFromGitHub {
owner = "Ultimaker";
repo = "libnest2d";
rev = "31391fd173249ad9b906390058e13b09238fadc8";
sha256 = "1hzqi4z55x76rss3xk7hfqhy9hcaq2jaav5jqxa1aqmbvarr2gla";
rev = version;
hash = "sha256-m/ekKwkf4886tqOVIcNnUeBQtWreGFO/nx25usbAnDk=";
};

propagatedBuildInputs = [ clipper nlopt boost ];
cmakeFlags = [
"-DBUILD_SHARED_LIBS=ON"
"-DLIBNEST2D_HEADER_ONLY=OFF"
];

propagatedBuildInputs = [
(withConanCMakeDeps {package = clipper; pkg_name = "clipper"; lib_search="polyclipping";})
nlopt boost
];
nativeBuildInputs = [ cmake ];

CLIPPER_PATH = "${clipper.out}";
cmakeFlags = [ "-DLIBNEST2D_HEADER_ONLY=OFF" ];

postPatch = ''
echo '
install(TARGETS libnest2d libnest2d_headeronly ''${LIBNAME}
EXPORT ''${PROJECT_NAME}Targets
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
INCLUDES DESTINATION include)
' >> CMakeLists.txt;
'';

postInstall = ''
cp -r ../include/ $out/
mkdir -p $out/include/libnest2d/
exists() {
[ -e "$1" ]
}
ls -R .
for dir in . ..; do
if exists $dir/src/*.{h,hpp}; then
cp $dir/src/*.{h,hpp} $out/include/libnest2d/
fi
done
'';

meta = with lib; {
description =
Expand Down
91 changes: 75 additions & 16 deletions pkgs/development/python-modules/libarcus/default.nix
Original file line number Diff line number Diff line change
@@ -1,36 +1,95 @@
{ lib, buildPythonPackage, python, fetchFromGitHub
, fetchpatch
, cmake, sip_4, protobuf, pythonOlder }:
, cmake, sip, protobuf, setuptools,
pythonOlder, symlinkJoin, pkg-config, j2cli }:

buildPythonPackage rec {
pname = "libarcus";
version = "4.12.0";
version = "5.1.0";
format = "other";

src = fetchFromGitHub {
owner = "Ultimaker";
repo = "libArcus";
rev = version;
sha256 = "sha256-X33ptwYj9YkVWqUDPP+Ic+hoIb+rwsLdQXvHLA9z+3w=";
sha256 = "sha256-aGuNE7K5We/8QT8Gl/vBfFn7CXdpqbmiQZLc2JvO6pk=";
};

patches = [
# Fix build against protobuf 3.18+
# https://github.com/Ultimaker/libArcus/issues/121
(fetchpatch {
url = "https://raw.githubusercontent.com/coryan/vcpkg/f69b85aa403b04e7d442c90db3418d484e44024f/ports/arcus/0001-fix-protobuf-deprecated.patch";
sha256 = "0bqj7pxzpwsamknd6gadj419x6mwx8wnlfzg4zqn6cax3cmasjb2";
})
];

disabled = pythonOlder "3.4";

propagatedBuildInputs = [ sip_4 ];
nativeBuildInputs = [ cmake ];
buildInputs = [ protobuf ];
propagatedBuildInputs = [ sip setuptools ];
nativeBuildInputs = [ cmake python pkg-config ];
buildInputs = [ protobuf python ];

cmakeFlags = [
"-DPython_SITELIB_LOCAL=${python.sitePackages}"
"-DARCUS_VERSION=${version}"
"-DBUILD_SHARED_LIBS=ON"
];

postPatch = ''
sed -i 's#''${Python3_SITEARCH}#${placeholder "out"}/${python.sitePackages}#' cmake/SIPMacros.cmake
sed -i '2i include(CMakePackageConfigHelpers)' CMakeLists.txt
sed -i '2i find_package(PkgConfig)' CMakeLists.txt
sed -i '2i include(GenerateExportHeader)' CMakeLists.txt

sed -i 's|find_package(cpython REQUIRED)|pkg_check_modules(python REQUIRED IMPORTED_TARGET python)|' CMakeLists.txt
sed -i 's|cpython::cpython|PkgConfig::python|g' CMakeLists.txt
cat CMakeLists.txt

mkdir -p build/pyArcus/
module_name=pyArcus sip_dir=$(pwd)/python sip_include_dirs=$(pwd)/python build_dir=$(pwd)/build/pyArcus/ \
${j2cli}/bin/j2 pyproject.toml.jinja -o pyproject.toml
ln -s cmake/CMakeBuilder.py CMakeBuilder.py
${sip}/bin/sip-build --pep484-pyi --no-protected-is-public # -y pyArcus.pyi

echo '
generate_export_header(Arcus
EXPORT_FILE_NAME src/ArcusExport.h
)
include_directories(''${CMAKE_BINARY_DIR}/src)

install(TARGETS Arcus
EXPORT Arcus-targets
RUNTIME DESTINATION ''${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ''${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ''${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ''${CMAKE_INSTALL_INCLUDEDIR}/Arcus
)

install(EXPORT Arcus-targets
DESTINATION ''${CMAKE_INSTALL_LIBDIR}/cmake/Arcus
)' >> CMakeLists.txt
# echo '
# install(TARGETS Arcus
# EXPORT Arcus-targets
# RUNTIME DESTINATION ''${CMAKE_INSTALL_BINDIR}
# LIBRARY DESTINATION ''${CMAKE_INSTALL_LIBDIR}
# ARCHIVE DESTINATION ''${CMAKE_INSTALL_LIBDIR}
# PUBLIC_HEADER DESTINATION ''${CMAKE_INSTALL_INCLUDEDIR}/Arcus
# )

# install(EXPORT Arcus-targets
# DESTINATION ''${CMAKE_INSTALL_LIBDIR}/cmake/Arcus
# )
# configure_package_config_file(ArcusConfig.cmake.in ''${CMAKE_BINARY_DIR}/arcusConfig.cmake INSTALL_DESTINATION ''${CMAKE_INSTALL_LIBDIR}/cmake/Arcus)
# write_basic_package_version_file(''${CMAKE_BINARY_DIR}/arcusConfigVersion.cmake VERSION ''${ARCUS_VERSION} COMPATIBILITY SameMajorVersion)

# install(FILES
# ''${CMAKE_BINARY_DIR}/arcusConfig.cmake
# ''${CMAKE_BINARY_DIR}/arcusConfigVersion.cmake
# DESTINATION ''${CMAKE_INSTALL_LIBDIR}/cmake/arcus
# )' >> CMakeLists.txt
'';

postInstall = ''
mkdir -p $out/include/Arcus/
for dir in . ..; do
cp $dir/src/*.h $out/include/Arcus/
done
cp -r ../arcus_include/Arcus/* $out/include/Arcus/
ls -R $out
ls -R .
#die
'';

meta = with lib; {
Expand Down
36 changes: 31 additions & 5 deletions pkgs/development/python-modules/pynest2d/default.nix
Original file line number Diff line number Diff line change
@@ -1,25 +1,51 @@
{ lib, buildPythonPackage, fetchFromGitHub, python, cmake
, libnest2d, sip_4, clipper }:
, libnest2d, sip, clipper, conan, pkg-config, j2cli }:


let withConanCMakeDeps = conan.withConanCMakeDepsFile;
in
buildPythonPackage rec {
version = "4.12.0";
version = "5.1.0";
pname = "pynest2d";
format = "other";

src = fetchFromGitHub {
owner = "Ultimaker";
repo = "pynest2d";
rev = version;
sha256 = "sha256-QQdTDhO4i9NVhegGTmdEQSNv3gooaZzTX/Rv86h3GEo=";
sha256 = "sha256-ye5SJUt0WCI2z/kYt7kOQSeqlsaDz/L0Tq4DTAiUPuo=";
};

propagatedBuildInputs = [ libnest2d sip_4 clipper ];
nativeBuildInputs = [ cmake ];
propagatedBuildInputs = [
(withConanCMakeDeps {package = libnest2d; lib_search="nest2d_clipper_nlopt";})
sip
(withConanCMakeDeps {package = clipper; pkg_name = "clipper"; lib_search="polyclipping";})
];
nativeBuildInputs = [ cmake pkg-config sip j2cli ];

cmakeFlags = [
"-DPython_SITELIB_LOCAL=${python.sitePackages}"
#"-DPython_SITEARCH=${placeholder "out"}/${python.sitePackages}"
"-DBUILD_SHARED_LIBS=ON"
"-DLIBNEST2D_HEADER_ONLY=OFF"
];

CLIPPER_PATH = "${clipper.out}";

postPatch = ''
sed -i '2i include(CMakePackageConfigHelpers)' CMakeLists.txt
sed -i '2i find_package(PkgConfig)' CMakeLists.txt
sed -i '2i include(GenerateExportHeader)' CMakeLists.txt
sed -i 's|find_package(cpython ''${Python_VERSION} REQUIRED)|pkg_check_modules(python REQUIRED IMPORTED_TARGET python)|' CMakeLists.txt
sed -i 's|cpython::cpython|PkgConfig::python|g' CMakeLists.txt
sed -i 's#''${Python3_SITEARCH}#${placeholder "out"}/${python.sitePackages}#' cmake/SIPMacros.cmake


mkdir -p build/pynest2d/
module_name=pynest2d sip_dir=$(pwd)/src sip_include_dirs=$(pwd)/src build_dir=$(pwd)/build/pynest2d/ \
j2 pyproject.toml.jinja -o pyproject.toml
ln -s cmake/CMakeBuilder.py CMakeBuilder.py
sip-build --pep484-pyi --no-protected-is-public
'';

meta = with lib; {
Expand Down
Loading