1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
9 GENTOO_DEPEND_ON_PERL="no"
10 PYTHON_COMPAT=( python2_7 python3_{3,4} )
13 inherit autotools eutils libtool perl-module distutils-r1 python-r1 toolchain-funcs java-pkg-opt-2
15 DESCRIPTION="Translator library for raster geospatial data formats (includes OGR support)"
16 HOMEPAGE="http://www.gdal.org/"
17 SRC_URI="http://download.osgeo.org/${PN}/${PV}/${P}.tar.gz"
21 KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos"
22 IUSE="armadillo +aux_xml curl debug doc fits geos gif gml hdf5 java jpeg jpeg2k mdb mysql netcdf odbc ogdi opencl pdf perl png postgres python spatialite sqlite threads xls"
31 sys-libs/zlib[minizip(+)]
32 armadillo? ( sci-libs/armadillo[lapack] )
33 curl? ( net-misc/curl )
34 fits? ( sci-libs/cfitsio )
35 geos? ( >=sci-libs/geos-2.2.1 )
36 gif? ( media-libs/giflib )
37 gml? ( >=dev-libs/xerces-c-3 )
38 hdf5? ( >=sci-libs/hdf5-1.6.4[szip] )
39 java? ( >=virtual/jre-1.6:* )
40 jpeg? ( virtual/jpeg:0= )
41 jpeg2k? ( media-libs/jasper )
42 mysql? ( virtual/mysql )
43 netcdf? ( sci-libs/netcdf )
44 odbc? ( dev-db/unixODBC )
45 ogdi? ( sci-libs/ogdi )
46 opencl? ( virtual/opencl )
47 pdf? ( >=app-text/poppler-0.24.3:= )
48 perl? ( dev-lang/perl:= )
49 png? ( media-libs/libpng:0= )
50 postgres? ( >=dev-db/postgresql-8.4:= )
53 dev-python/setuptools[${PYTHON_USEDEP}]
54 dev-python/numpy[${PYTHON_USEDEP}]
56 sqlite? ( dev-db/sqlite:3 )
57 spatialite? ( dev-db/spatialite )
58 xls? ( dev-libs/freexl )
61 SWIG_DEP=">=dev-lang/swig-2.0.2 <=dev-lang/swig-3.0.4"
63 doc? ( app-doc/doxygen )
64 java? ( >=virtual/jdk-1.6 )
66 python? ( ${SWIG_DEP} )"
72 spatialite? ( sqlite )
77 java-pkg-opt-2_pkg_setup
81 java-pkg-opt-2_src_prepare
83 epatch "${FILESDIR}"/${P}-glibc-2.22-backport.patch
85 # fix datadir and docdir placement
87 -e "s:@datadir@:@datadir@/gdal:" \
88 -e "s:@exec_prefix@/doc:@exec_prefix@/share/doc/${PF}/html:g" \
89 "${S}"/GDALmake.opt.in || die
91 # the second sed expression should fix bug 371075
93 -e "s:setup.py install:setup.py install --root=\$(DESTDIR):" \
94 -e "s:--prefix=\$(DESTDIR):--prefix=:" \
95 "${S}"/swig/python/GNUmakefile || die
97 # -soname is only accepted by GNU ld/ELF
98 [[ ${CHOST} == *-darwin* ]] \
99 && epatch "${FILESDIR}"/${PN}-1.5.0-install_name.patch \
100 || epatch "${FILESDIR}"/${PN}-1.5.0-soname.patch
102 # Fix spatialite/sqlite include issue
104 -e 's:spatialite/sqlite3.h:sqlite3.h:g' \
105 ogr/ogrsf_frmts/sqlite/ogr_sqlite.h || die
107 # Fix freexl configure check
109 -e 's:FREEXL_LIBS=missing):FREEXL_LIBS=missing,-lm):g' \
113 -e "s: /usr/: \"${EPREFIX}\"/usr/:g" \
114 -i configure.in || die
118 -i ogr/ogrsf_frmts/sdts/install-libs.sh || die
125 mkdir -p "${BUILD_DIR}" || die
126 find "${S}" -type d -maxdepth 1 -exec ln -s {} "${BUILD_DIR}"/ \; ||die
127 find "${S}" -type f -maxdepth 1 -exec cp --target="${BUILD_DIR}"/ {} + ||die
128 # mkdir -p "${BUILD_DIR}"/swig/python || die
129 # mkdir -p "${BUILD_DIR}"/apps || die
130 # cp -dpR --target="${BUILD_DIR}"/swig/ \
131 # "${S}"/swig/{python,SWIGmake.base,GNUmakefile} || die
132 # ln -s "${S}"/swig/include "${BUILD_DIR}"/swig/ || die
133 # ln -s "${S}"/apps/gdal-config "${BUILD_DIR}"/apps/ || die
134 # ln -s "${S}"/port "${BUILD_DIR}"/ || die
137 python_foreach_impl prepare_python
141 gdal_src_configure() {
146 --with-java=$(java-config --jdk-home 2>/dev/null)
149 myopts+=" --without-java --without-mdb"
150 use mdb && ewarn "mdb requires java use enabled. disabling"
154 myopts+=" LIBS=-lsqlite3"
157 # pcidsk is internal, because there is no such library yet released
158 # also that thing is developed by the gdal people
159 # kakadu, mrsid jp2mrsid - another jpeg2k stuff, ignore
161 # oracle - disabled, i dont have and can't test
162 # ingres - same story as oracle oci
163 # podofo - we use poppler instead they are exclusive for each other
165 ECONF_SOURCE="${S}" econf \
166 --includedir="${EPREFIX}/usr/include/${PN}" \
173 --with-libz="${EPREFIX}/usr/" \
176 --without-dods-root \
177 --without-dwgdirect \
193 $(use_enable debug) \
194 $(use_with armadillo) \
195 $(use_with aux_xml pam) \
198 $(use_with fits cfitsio) \
201 $(use_with gml xerces) \
203 $(use_with jpeg pcidsk) \
205 $(use_with jpeg2k jasper) \
206 $(use_with mysql mysql "${EPREFIX}"/usr/bin/mysql_config) \
209 $(use_with ogdi ogdi "${EPREFIX}"/usr) \
211 $(use_with pdf poppler) \
214 $(use_with postgres pg) \
216 $(use_with spatialite) \
217 $(use_with sqlite sqlite3 "${EPREFIX}"/usr) \
218 $(use_with threads) \
219 $(use_with xls freexl) \
222 # mysql-config puts this in (and boy is it a PITA to get it out)
225 -e "s: -rdynamic : :" \
226 GDALmake.opt || die "sed LIBS failed"
229 if [[ -n $use_python ]]; then
230 # updated for newer swig (must specify the path to input files)
232 -e "s: gdal_array.i: ../include/gdal_array.i:" \
233 -e "s:\$(DESTDIR)\$(prefix):\$(DESTDIR)\$(INST_PREFIX):g" \
234 swig/python/GNUmakefile || die "sed python makefile failed"
236 -e "s:library_dirs = :library_dirs = /usr/$(get_libdir):g" \
237 swig/python/setup.cfg || die "sed python setup.cfg failed"
238 # -e "s:gdal_config=.*$:gdal_config=../../../apps/gdal-config:g" \
249 python_foreach_impl run_in_build_dir gdal_src_configure
255 rm "${S}"/swig/perl/*_wrap.cpp
256 emake -C "${S}"/swig/perl generate
262 pushd "${S}"/swig/perl > /dev/null
263 perl-module_src_configure
264 perl-module_src_compile
268 use doc && emake docs
271 rm -f swig/python/*_wrap.cpp
272 emake -C swig/python generate
273 emake -C swig/python build
276 python_foreach_impl run_in_build_dir compile_python
282 pushd "${S}"/swig/perl > /dev/null
283 perl-module_src_install
285 sed -e 's:BINDINGS = \(.*\) perl:BINDINGS = \1:g' \
286 -i GDALmake.opt || die
291 use perl && perl_delete_localpod
293 dodoc Doxyfile HOWTO-RELEASE NEWS
295 use doc && dohtml html/*
298 emake -C swig/python DESTDIR="${D}" install
301 python_foreach_impl run_in_build_dir install_python
302 newdoc swig/python/README.txt README-python.txt
303 insinto /usr/share/${PN}/samples
304 doins swig/python/samples/*
305 python_replicate_script "${ED}"/usr/bin/*py
308 pushd man/man1 > /dev/null
316 elog "Check available image and data formats after building with"
317 elog "gdalinfo and ogrinfo (using the --formats switch)."