1{ lib, stdenv, fetchFromGitHub, cmake, ninja, automaticcomponenttoolkit
2, pkg-config, libzip, gtest, openssl, libuuid, libossp_uuid }:
3
4stdenv.mkDerivation rec {
5 pname = "lib3mf";
6 version = "2.2.0";
7
8 src = fetchFromGitHub {
9 owner = "3MFConsortium";
10 repo = pname;
11 rev = "v${version}";
12 sha256 = "sha256-WMTTYYgpCIM86a6Jw8iah/YVXN9T5youzEieWL/d+Bc=";
13 };
14
15 nativeBuildInputs = [ cmake ninja pkg-config ];
16
17 outputs = [ "out" "dev" ];
18
19 cmakeFlags = [
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"
25 ];
26
27 buildInputs = [
28 libzip gtest openssl
29 ] ++ (if stdenv.isDarwin then [ libossp_uuid ] else [ libuuid ]);
30
31 postPatch = ''
32 # fix libdir=''${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
33 sed -i 's,libdir=''${\(exec_\)\?prefix}/,libdir=,' lib3mf.pc.in
34
35
36 # replace bundled binaries
37 for i in AutomaticComponentToolkit/bin/act.*; do
38 ln -sf ${automaticcomponenttoolkit}/bin/act $i
39 done
40 '';
41
42 meta = with lib; {
43 description = "Reference implementation of the 3D Manufacturing Format file standard";
44 homepage = "https://3mf.io/";
45 license = licenses.bsd2;
46 maintainers = with maintainers; [ gebner ];
47 platforms = platforms.all;
48 };
49}