Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / libLAS / default.nix
blob7f2c12a9dea2b23bfb7355f27810d296f17f0d85
1 { lib, stdenv, fetchurl, fetchpatch, boost, cmake, libgeotiff, libtiff, LASzip2, fixDarwinDylibNames }:
3 stdenv.mkDerivation rec {
4   pname = "libLAS";
5   version = "1.8.1";
7   src = fetchurl {
8     url = "https://download.osgeo.org/liblas/libLAS-${version}.tar.bz2";
9     sha256 = "0xjfxb3ydvr2258ji3spzyf81g9caap19ql2pk91wiivqsc4mnws";
10   };
12   patches = [
13     (fetchpatch {
14       name = "aarch64-darwin.patch";
15       url = "https://github.com/libLAS/libLAS/commit/ded463732db1f9baf461be6f3fe5b8bb683c41cd.patch";
16       sha256 = "sha256-aWMpazeefDHE9OzuLR3FJ8+oXeGhEsk1igEm6j2DUnw=";
17     })
18     (fetchpatch {
19       name = "fix-build-with-boost-1.73-1.patch";
20       url = "https://github.com/libLAS/libLAS/commit/af431abce95076b59f4eb7c6ef0930ca57c8a063.patch";
21       hash = "sha256-2lr028t5hq3oOLZFXnvIJXCUsoVHbG/Mus93OZvi5ZU=";
22     })
23     (fetchpatch {
24       name = "fix-build-with-boost-1.73-2.patch";
25       url = "https://github.com/libLAS/libLAS/commit/0d3b8d75f371a6b7c605bbe5293091cb64a7e2d3.patch";
26       hash = "sha256-gtNIazR+l1h+Xef+4qQc7EVi+Nlht3F8CrwkINothtA=";
27     })
28   ];
30   nativeBuildInputs = [ cmake ] ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
31   buildInputs = [ boost libgeotiff libtiff LASzip2 ];
33   cmakeFlags = [
34     "-DWITH_LASZIP=ON"
35     # libLAS is currently not compatible with LASzip 3,
36     # see https://github.com/libLAS/libLAS/issues/144.
37     "-DLASZIP_INCLUDE_DIR=${LASzip2}/include"
38     "-DCMAKE_EXE_LINKER_FLAGS=-pthread"
39   ];
41   postFixup = lib.optionalString stdenv.isDarwin ''
42     install_name_tool -change "@rpath/liblas.3.dylib" "$out/lib/liblas.3.dylib" $out/lib/liblas_c.dylib
43   '';
45   meta = {
46     description = "LAS 1.0/1.1/1.2 ASPRS LiDAR data translation toolset";
47     homepage = "https://liblas.org";
48     license = lib.licenses.bsd3;
49     platforms = lib.platforms.unix;
50     maintainers = [ lib.maintainers.michelk ];
51   };