nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, stdenv, fetchurl, 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 nativeBuildInputs = [ cmake ] ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
13 buildInputs = [ boost gdal libgeotiff libtiff LASzip2 ];
14
15 cmakeFlags = [
16 "-DGDAL_CONFIG=${gdal}/bin/gdal-config"
17 "-DWITH_LASZIP=ON"
18 # libLAS is currently not compatible with LASzip 3,
19 # see https://github.com/libLAS/libLAS/issues/144.
20 "-DLASZIP_INCLUDE_DIR=${LASzip2}/include"
21 "-DCMAKE_EXE_LINKER_FLAGS=-pthread"
22 ];
23
24 postFixup = lib.optionalString stdenv.isDarwin ''
25 install_name_tool -change "@rpath/liblas.3.dylib" "$out/lib/liblas.3.dylib" $out/lib/liblas_c.dylib
26 '';
27
28 meta = {
29 description = "LAS 1.0/1.1/1.2 ASPRS LiDAR data translation toolset";
30 homepage = "https://liblas.org";
31 license = lib.licenses.bsd3;
32 platforms = lib.platforms.unix;
33 maintainers = [ lib.maintainers.michelk ];
34 };
35}