storj-uplink: 1.119.15 -> 1.120.4 (#375732)
[NixPkgs.git] / pkgs / by-name / li / libLAS / package.nix
blob79c067673f5f2a774d630b38d51840c922c2ff99
2   lib,
3   stdenv,
4   fetchurl,
5   fetchpatch,
6   boost,
7   cmake,
8   libgeotiff,
9   libtiff,
10   laszip_2,
11   fixDarwinDylibNames,
14 stdenv.mkDerivation rec {
15   pname = "libLAS";
16   version = "1.8.1";
18   src = fetchurl {
19     url = "https://download.osgeo.org/liblas/libLAS-${version}.tar.bz2";
20     sha256 = "0xjfxb3ydvr2258ji3spzyf81g9caap19ql2pk91wiivqsc4mnws";
21   };
23   patches = [
24     (fetchpatch {
25       name = "aarch64-darwin.patch";
26       url = "https://github.com/libLAS/libLAS/commit/ded463732db1f9baf461be6f3fe5b8bb683c41cd.patch";
27       sha256 = "sha256-aWMpazeefDHE9OzuLR3FJ8+oXeGhEsk1igEm6j2DUnw=";
28     })
29     (fetchpatch {
30       name = "fix-build-with-boost-1.73-1.patch";
31       url = "https://github.com/libLAS/libLAS/commit/af431abce95076b59f4eb7c6ef0930ca57c8a063.patch";
32       hash = "sha256-2lr028t5hq3oOLZFXnvIJXCUsoVHbG/Mus93OZvi5ZU=";
33     })
34     (fetchpatch {
35       name = "fix-build-with-boost-1.73-2.patch";
36       url = "https://github.com/libLAS/libLAS/commit/0d3b8d75f371a6b7c605bbe5293091cb64a7e2d3.patch";
37       hash = "sha256-gtNIazR+l1h+Xef+4qQc7EVi+Nlht3F8CrwkINothtA=";
38     })
39     # remove on update. fix compile error in apps/las2col.c
40     # https://github.com/libLAS/libLAS/pull/151
41     (fetchpatch {
42       name = "fflush-x2-is-not-an-fsync.patch";
43       url = "https://github.com/libLAS/libLAS/commit/e789d43df4500da0c12d2f6d3ac1d031ed835493.patch";
44       hash = "sha256-0zI0NvOt9C5BPrfAbgU1N1kj3rZFB7rf0KRj7yemyWI=";
45     })
46   ];
48   # Disable setting of C++98 standard which was dropped in boost 1.84.0
49   postPatch = ''
50     substituteInPlace CMakeLists.txt \
51       --replace-fail 'set(CMAKE_CXX_FLAGS "''${CMAKE_CXX_FLAGS} -std=c++98 -ansi")' '#'
52   '';
54   nativeBuildInputs = [ cmake ] ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
55   buildInputs = [
56     boost
57     libgeotiff
58     libtiff
59     laszip_2
60   ];
62   cmakeFlags = [
63     "-DWITH_LASZIP=ON"
64     # libLAS is currently not compatible with LASzip 3,
65     # see https://github.com/libLAS/libLAS/issues/144.
66     "-DLASZIP_INCLUDE_DIR=${laszip_2}/include"
67     "-DCMAKE_EXE_LINKER_FLAGS=-pthread"
68   ];
70   postFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
71     install_name_tool -change "@rpath/liblas.3.dylib" "$out/lib/liblas.3.dylib" $out/lib/liblas_c.dylib
72   '';
74   meta = with lib; {
75     description = "LAS 1.0/1.1/1.2 ASPRS LiDAR data translation toolset";
76     homepage = "https://liblas.org";
77     license = licenses.bsd3;
78     platforms = platforms.unix;
79     maintainers = with maintainers; teams.geospatial.members ++ [ lib.maintainers.michelk ];
80   };