Skip to content

Commit

Permalink
lib3mf: 2.2.0 -> 2.3.2; openscad: unpin cgal_4; fix darwin (#369588)
Browse files Browse the repository at this point in the history
  • Loading branch information
7c6f434c authored Dec 31, 2024
2 parents be1bd4b + c34b198 commit ffd125e
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 34 deletions.
25 changes: 23 additions & 2 deletions pkgs/applications/graphics/openscad/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
libGL,
glew,
opencsg,
cgal_4,
cgal,
mpfr,
gmp,
glib,
Expand Down Expand Up @@ -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 = [
Expand All @@ -84,7 +105,7 @@ mkDerivation rec {
boost
glew
opencsg
cgal_4
cgal
mpfr
gmp
glib
Expand Down
42 changes: 28 additions & 14 deletions pkgs/by-name/li/lib3mf/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/";
Expand Down
18 changes: 0 additions & 18 deletions pkgs/by-name/li/lib3mf/upgrade-to-cpp-14.patch

This file was deleted.

0 comments on commit ffd125e

Please sign in to comment.