1 { lib, stdenv, fetchFromGitHub, cmake, ninja, automaticcomponenttoolkit
2 , pkg-config, libzip, gtest, openssl, libuuid, libossp_uuid }:
4 stdenv.mkDerivation rec {
8 src = fetchFromGitHub {
9 owner = "3MFConsortium";
12 sha256 = "sha256-WMTTYYgpCIM86a6Jw8iah/YVXN9T5youzEieWL/d+Bc=";
15 nativeBuildInputs = [ cmake ninja pkg-config ];
17 outputs = [ "out" "dev" ];
20 "-DCMAKE_INSTALL_INCLUDEDIR=include/lib3mf"
21 "-DUSE_INCLUDED_ZLIB=OFF"
22 "-DUSE_INCLUDED_LIBZIP=OFF"
23 "-DUSE_INCLUDED_GTEST=OFF"
24 "-DUSE_INCLUDED_SSL=OFF"
29 ] ++ (if stdenv.isDarwin then [ libossp_uuid ] else [ libuuid ]);
32 # This lets us build the tests properly on aarch64-darwin.
33 substituteInPlace CMakeLists.txt \
34 --replace 'SET(CMAKE_OSX_ARCHITECTURES "x86_64")' ""
36 # fix libdir=''${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
37 sed -i 's,libdir=''${\(exec_\)\?prefix}/,libdir=,' lib3mf.pc.in
39 # replace bundled binaries
40 for i in AutomaticComponentToolkit/bin/act.*; do
41 ln -sf ${automaticcomponenttoolkit}/bin/act $i
46 description = "Reference implementation of the 3D Manufacturing Format file standard";
47 homepage = "https://3mf.io/";
48 license = licenses.bsd2;
49 maintainers = with maintainers; [ gebner ];
50 platforms = platforms.all;