easytier: 2.1.1 -> 2.1.2 (#376259)
[NixPkgs.git] / pkgs / by-name / li / lib3mf / package.nix
blobc332654c2b15e28ac9d94a36177d02ce2c75505e
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   cmake,
6   ninja,
7   automaticcomponenttoolkit,
8   pkg-config,
9   fast-float,
10   libzip,
11   gtest,
12   openssl,
13   libuuid,
14   zlib,
17 stdenv.mkDerivation rec {
18   pname = "lib3mf";
19   version = "2.3.2";
21   src = fetchFromGitHub {
22     owner = "3MFConsortium";
23     repo = pname;
24     tag = "v${version}";
25     hash = "sha256-XEwrJINiNpI2+1wXxczirci8VJsUVs5iDUAMS6jWuNk=";
26   };
28   nativeBuildInputs = [
29     cmake
30     ninja
31     pkg-config
32   ];
34   outputs = [
35     "out"
36     "dev"
37   ];
39   cmakeFlags = [
40     "-DCMAKE_INSTALL_INCLUDEDIR=include/lib3mf"
41     "-DUSE_INCLUDED_ZLIB=OFF"
42     "-DUSE_INCLUDED_LIBZIP=OFF"
43     "-DUSE_INCLUDED_GTEST=OFF"
44     "-DUSE_INCLUDED_SSL=OFF"
45   ];
47   buildInputs = [
48     libzip
49     gtest
50     openssl
51     zlib
52   ] ++ lib.optional (!stdenv.hostPlatform.isDarwin) libuuid;
54   postPatch = ''
55     # fix libdir=''${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
56     sed -i 's,libdir=''${\(exec_\)\?prefix}/,libdir=,' lib3mf.pc.in
58     # replace bundled binaries
59     rm -r AutomaticComponentToolkit
60     ln -s ${automaticcomponenttoolkit}/bin AutomaticComponentToolkit
62     # unvendor Libraries
63     rm -r Libraries/{fast_float,googletest,libressl,libzip,zlib}
65     cat <<"EOF" >> Tests/CPP_Bindings/CMakeLists.txt
66     find_package(GTest REQUIRED)
67     target_link_libraries(''${TESTNAME} PRIVATE GTest::gtest)
68     EOF
70     mkdir Libraries/fast_float
71     ln -s ${lib.getInclude fast-float}/include/fast_float Libraries/fast_float/Include
73     # functions are no longer in openssl, remove them from test cleanup function
74     substituteInPlace Tests/CPP_Bindings/Source/UnitTest_EncryptionUtils.cpp \
75       --replace-warn "RAND_cleanup();" "" \
76       --replace-warn "EVP_cleanup();" "" \
77       --replace-warn "CRYPTO_cleanup_all_ex_data();" ""
78   '';
80   doCheck = true;
82   meta = with lib; {
83     description = "Reference implementation of the 3D Manufacturing Format file standard";
84     homepage = "https://3mf.io/";
85     license = licenses.bsd2;
86     maintainers = with maintainers; [ gebner ];
87     platforms = platforms.all;
88   };