sci-geosciences/liblas: fix >=GDAL-2.5.0, USE debug, missing return val
[gentoo.git] / sci-geosciences / liblas / liblas-1.8.1-r3.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit cmake
7
8 DESCRIPTION="C/C++ library for manipulating the LAS LiDAR format common in GIS"
9 HOMEPAGE="https://github.com/libLAS/libLAS/"
10 SRC_URI="https://github.com/libLAS/libLAS/archive/${PV}.tar.gz -> ${P}.tar.gz"
11
12 SLOT="0"
13 LICENSE="BSD"
14 KEYWORDS="~amd64 ~ia64 ~ppc ~ppc64 ~x86"
15 IUSE="gdal"
16
17 DEPEND="
18         dev-libs/boost:=
19         sci-geosciences/laszip
20         sci-libs/libgeotiff:=
21         gdal? ( sci-libs/gdal:= )
22 "
23 RDEPEND="${DEPEND}"
24
25 # tests known to fail due to LD_LIBRARY_PATH issue
26 RESTRICT="test"
27
28 S="${WORKDIR}/libLAS-${PV}"
29
30 PATCHES=(
31         "${FILESDIR}"/${PN}-1.8.0_remove-std-c++98.patch
32         "${FILESDIR}"/${P}-fix-overload-call.patch # bug 661654
33         "${FILESDIR}"/${P}-CVE-2018-20540.patch # bug 678482
34         "${FILESDIR}"/${P}-CVE-2018-20540-fixup.patch # bug 698846
35         "${FILESDIR}"/${P}-fix-debug.patch # bug 668778
36 )
37
38 src_prepare() {
39         use gdal && has_version ">=sci-libs/gdal-2.5.0" && PATCHES+=(
40                 "${FILESDIR}"/${P}-gdal-2.5.0.patch # bug 707706
41         )
42         cmake_src_prepare
43
44         # add missing linkage
45         sed -e 's:${LAS2COL} ${LIBLAS_C_LIB_NAME}:& ${CMAKE_THREAD_LIBS_INIT}:' \
46                 -i "${S}/apps/CMakeLists.txt" || die
47 }
48
49 src_configure() {
50         local mycmakeargs=(
51                 -DLIBLAS_LIB_SUBDIR=$(get_libdir)
52                 -DWITH_GDAL=$(usex gdal)
53         )
54         cmake_src_configure
55 }