diff --git a/pkgs/applications/graphics/openscad/default.nix b/pkgs/applications/graphics/openscad/default.nix index a3f11641ed4d0..008b83ecd0996 100644 --- a/pkgs/applications/graphics/openscad/default.nix +++ b/pkgs/applications/graphics/openscad/default.nix @@ -14,7 +14,7 @@ libGL, glew, opencsg, - cgal_4, + cgal, mpfr, gmp, glib, @@ -62,11 +62,32 @@ mkDerivation rec { url = "https://github.com/openscad/openscad/commit/84addf3c1efbd51d8ff424b7da276400bbfa1a4b.patch"; sha256 = "sha256-KNEVu10E2d4G2x+FJcuHo2tjD8ygMRuhUcW9NbN98bM="; }) + (fetchpatch { + # needed for cgal_5 + name = "cgalutils-tess.cc-cgal-5.patch"; + url = "https://github.com/openscad/openscad/commit/3a81c1fb9b663ebbedd6eb044e7276357b1f30a1.patch"; + hash = "sha256-JdBznXkewx5ybY92Ss0h7UnMZ7d3IQbFRaDCDjb1bRA="; + }) + (fetchpatch { + # needed for cgal_5 + name = "cgalutils-tess.cc-cgal-5_4.patch"; + url = "https://github.com/openscad/openscad/commit/71f2831c0484c3f35cbf44e1d1dc2c857384100b.patch"; + hash = "sha256-Fu8dnjNIwZKCI6ukOeHYK8NiJwoA0XtqT8dg8sVevG8="; + }) + (fetchpatch { + # needed for cgal_5. Removes dead code + name = "cgalutils-polyhedron.cc-cgal-5_3.patch"; + url = "https://github.com/openscad/openscad/commit/cc49ad8dac24309f5452d5dea9abd406615a52d9.patch"; + hash = "sha256-B3i+o6lR5osRcVXTimDZUFQmm12JhmbFgG9UwOPebF4="; + }) ]; postPatch = '' substituteInPlace src/FileModule.cc \ --replace-fail 'fs::is_regular' 'fs::is_regular_file' + + substituteInPlace src/openscad.cc \ + --replace-fail 'boost::join' 'boost::algorithm::join' ''; nativeBuildInputs = [ @@ -84,7 +105,7 @@ mkDerivation rec { boost glew opencsg - cgal_4 + cgal mpfr gmp glib diff --git a/pkgs/by-name/li/lib3mf/package.nix b/pkgs/by-name/li/lib3mf/package.nix index c61a747bec0ee..c332654c2b15e 100644 --- a/pkgs/by-name/li/lib3mf/package.nix +++ b/pkgs/by-name/li/lib3mf/package.nix @@ -6,26 +6,25 @@ ninja, automaticcomponenttoolkit, pkg-config, + fast-float, libzip, gtest, openssl, libuuid, - libossp_uuid, + zlib, }: stdenv.mkDerivation rec { pname = "lib3mf"; - version = "2.2.0"; + version = "2.3.2"; src = fetchFromGitHub { owner = "3MFConsortium"; repo = pname; - rev = "v${version}"; - sha256 = "sha256-WMTTYYgpCIM86a6Jw8iah/YVXN9T5youzEieWL/d+Bc="; + tag = "v${version}"; + hash = "sha256-XEwrJINiNpI2+1wXxczirci8VJsUVs5iDUAMS6jWuNk="; }; - patches = [ ./upgrade-to-cpp-14.patch ]; - nativeBuildInputs = [ cmake ninja @@ -49,22 +48,37 @@ stdenv.mkDerivation rec { libzip gtest openssl - ] ++ (if stdenv.hostPlatform.isDarwin then [ libossp_uuid ] else [ libuuid ]); + zlib + ] ++ lib.optional (!stdenv.hostPlatform.isDarwin) libuuid; postPatch = '' - # This lets us build the tests properly on aarch64-darwin. - substituteInPlace CMakeLists.txt \ - --replace 'SET(CMAKE_OSX_ARCHITECTURES "x86_64")' "" - # fix libdir=''${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ sed -i 's,libdir=''${\(exec_\)\?prefix}/,libdir=,' lib3mf.pc.in # replace bundled binaries - for i in AutomaticComponentToolkit/bin/act.*; do - ln -sf ${automaticcomponenttoolkit}/bin/act $i - done + rm -r AutomaticComponentToolkit + ln -s ${automaticcomponenttoolkit}/bin AutomaticComponentToolkit + + # unvendor Libraries + rm -r Libraries/{fast_float,googletest,libressl,libzip,zlib} + + cat <<"EOF" >> Tests/CPP_Bindings/CMakeLists.txt + find_package(GTest REQUIRED) + target_link_libraries(''${TESTNAME} PRIVATE GTest::gtest) + EOF + + mkdir Libraries/fast_float + ln -s ${lib.getInclude fast-float}/include/fast_float Libraries/fast_float/Include + + # functions are no longer in openssl, remove them from test cleanup function + substituteInPlace Tests/CPP_Bindings/Source/UnitTest_EncryptionUtils.cpp \ + --replace-warn "RAND_cleanup();" "" \ + --replace-warn "EVP_cleanup();" "" \ + --replace-warn "CRYPTO_cleanup_all_ex_data();" "" ''; + doCheck = true; + meta = with lib; { description = "Reference implementation of the 3D Manufacturing Format file standard"; homepage = "https://3mf.io/"; diff --git a/pkgs/by-name/li/lib3mf/upgrade-to-cpp-14.patch b/pkgs/by-name/li/lib3mf/upgrade-to-cpp-14.patch deleted file mode 100644 index a453571838d0e..0000000000000 --- a/pkgs/by-name/li/lib3mf/upgrade-to-cpp-14.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 9f719beb7..a20f84eb8 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -34,12 +34,12 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - # using GCC - add_definitions(-DBUILD_DLL) - add_compile_options(-Wall) -- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2") -+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -O2") - elseif ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") - # using GCC - add_definitions(-DBUILD_DLL) - add_compile_options(-Wall) -- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O2") -+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -O2") - set(CMAKE_MACOSX_RPATH ON) - endif()