nixpkgs/pkgs/development/libraries/lib3mf/default.nix
Alexey Lebedeff ac7b8b85ab lib3mf: fix include paths in pkg-config file
Multi-output `includedir` magic for `pkg-config` was not working, as not
only `libdir` was affected by `postPatch` script. And absolute path to
include directory is not compatibe with this magic either. So the
pkg-config file contained a path to non-existing directory (`include`,
but in the main `out` output).

The only package to use this library is openscad, but it's currently
not picking it - will fix it in a separate PR.
2023-02-02 21:36:29 +01:00

50 lines
1.3 KiB
Nix

{ lib, stdenv, fetchFromGitHub, cmake, ninja, automaticcomponenttoolkit
, pkg-config, libzip, gtest, openssl, libuuid, libossp_uuid }:
stdenv.mkDerivation rec {
pname = "lib3mf";
version = "2.2.0";
src = fetchFromGitHub {
owner = "3MFConsortium";
repo = pname;
rev = "v${version}";
sha256 = "sha256-WMTTYYgpCIM86a6Jw8iah/YVXN9T5youzEieWL/d+Bc=";
};
nativeBuildInputs = [ cmake ninja pkg-config ];
outputs = [ "out" "dev" ];
cmakeFlags = [
"-DCMAKE_INSTALL_INCLUDEDIR=include/lib3mf"
"-DUSE_INCLUDED_ZLIB=OFF"
"-DUSE_INCLUDED_LIBZIP=OFF"
"-DUSE_INCLUDED_GTEST=OFF"
"-DUSE_INCLUDED_SSL=OFF"
];
buildInputs = [
libzip gtest openssl
] ++ (if stdenv.isDarwin then [ libossp_uuid ] else [ libuuid ]);
postPatch = ''
# 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
'';
meta = with lib; {
description = "Reference implementation of the 3D Manufacturing Format file standard";
homepage = "https://3mf.io/";
license = licenses.bsd2;
maintainers = with maintainers; [ gebner ];
platforms = platforms.all;
};
}