Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchurl, fetchpatch, boost, cmake, gdal, libgeotiff, libtiff, LASzip2, fixDarwinDylibNames }:
2
3stdenv.mkDerivation rec {
4 pname = "libLAS";
5 version = "1.8.1";
6
7 src = fetchurl {
8 url = "https://download.osgeo.org/liblas/libLAS-${version}.tar.bz2";
9 sha256 = "0xjfxb3ydvr2258ji3spzyf81g9caap19ql2pk91wiivqsc4mnws";
10 };
11
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 ];
19
20 nativeBuildInputs = [ cmake ] ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
21 buildInputs = [ boost gdal libgeotiff libtiff LASzip2 ];
22
23 cmakeFlags = [
24 "-DGDAL_CONFIG=${gdal}/bin/gdal-config"
25 "-DWITH_LASZIP=ON"
26 # libLAS is currently not compatible with LASzip 3,
27 # see https://github.com/libLAS/libLAS/issues/144.
28 "-DLASZIP_INCLUDE_DIR=${LASzip2}/include"
29 "-DCMAKE_EXE_LINKER_FLAGS=-pthread"
30 ];
31
32 postFixup = lib.optionalString stdenv.isDarwin ''
33 install_name_tool -change "@rpath/liblas.3.dylib" "$out/lib/liblas.3.dylib" $out/lib/liblas_c.dylib
34 '';
35
36 meta = {
37 description = "LAS 1.0/1.1/1.2 ASPRS LiDAR data translation toolset";
38 homepage = "https://liblas.org";
39 license = lib.licenses.bsd3;
40 platforms = lib.platforms.unix;
41 maintainers = [ lib.maintainers.michelk ];
42 };
43}