diff --git a/gdal-1.9.0-java.patch b/gdal-1.9.0-java.patch new file mode 100644 index 0000000000000000000000000000000000000000..204fac403ccd22453ec00106d77001dcdb9f8ec6 --- /dev/null +++ b/gdal-1.9.0-java.patch @@ -0,0 +1,12 @@ +diff --git a/gdal/swig/java/java.opt b/gdal/swig/java/java.opt +index 6aba3e6..4b88fc6 100644 +--- a/gdal/swig/java/java.opt ++++ b/gdal/swig/java/java.opt +@@ -7,6 +7,6 @@ JAVADOC=$(JAVA_HOME)/bin/javadoc + JAVAC=$(JAVA_HOME)/bin/javac + JAVA=$(JAVA_HOME)/bin/java + JAR=$(JAVA_HOME)/bin/jar +-JAVA_INCLUDE=-I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux ++JAVA_INCLUDE=-I/usr/lib/jvm/java/include/ -I/usr/lib/jvm/java/include/linux + + diff --git a/gdal-2.3.0-zlib.patch b/gdal-2.3.0-zlib.patch new file mode 100644 index 0000000000000000000000000000000000000000..71131004565b7163ba2838daceb9ee49d2ad7837 --- /dev/null +++ b/gdal-2.3.0-zlib.patch @@ -0,0 +1,13 @@ +diff --git a/gdal/frmts/mrf/mrf_band.cpp b/gdal/frmts/mrf/mrf_band.cpp +index 95caf6e..2cdb730 100644 +--- a/gdal/frmts/mrf/mrf_band.cpp ++++ b/gdal/frmts/mrf/mrf_band.cpp +@@ -49,7 +49,7 @@ + + #include + #include +-#include "../zlib/zlib.h" ++#include + + CPL_CVSID("$Id$") + diff --git a/gdal-2.3.1-perl-build.patch b/gdal-2.3.1-perl-build.patch new file mode 100644 index 0000000000000000000000000000000000000000..036ec11e09f29e752c75d24d4783e85b5c2d22b0 --- /dev/null +++ b/gdal-2.3.1-perl-build.patch @@ -0,0 +1,29 @@ +diff --git a/gdal/swig/perl/GNUmakefile b/gdal/swig/perl/GNUmakefile +index 68d389d..2dfd533 100644 +--- a/gdal/swig/perl/GNUmakefile ++++ b/gdal/swig/perl/GNUmakefile +@@ -20,16 +20,14 @@ generate: ${WRAPPERS} + if [ -f OSR.pm ]; then mv OSR.pm lib/Geo; fi + if [ -f GNM.pm ]; then mv GNM.pm lib/Geo; fi + +-build: gdal_wrap.cc Makefile_Geo__GDAL ++build: Makefile_Geo__GDAL + $(MAKE) -f Makefile_Geo__GDAL + $(MAKE) -f Makefile_Geo__GDAL__Const + $(MAKE) -f Makefile_Geo__OSR + if [ -f Makefile_Geo__OGR ]; then $(MAKE) -f Makefile_Geo__OGR; fi + if [ -f Makefile_Geo__GNM ]; then $(MAKE) -f Makefile_Geo__GNM; fi + +-gdal_wrap.cc: generate +- +-Makefile_Geo__GDAL: gdal_wrap.cc ++Makefile_Geo__GDAL: Makefile.PL + perl Makefile.PL INSTALL_BASE=$(INST_PREFIX) + + test: build +@@ -66,3 +64,5 @@ doc: .FORCE + + .FORCE: + perl parse-for-doxygen.pl > all.pm; doxygen; rm -f all.pm ++ ++.PHONY: generate diff --git a/gdal-2.3.1.tar.gz b/gdal-2.3.1.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..42b03010628bf1d770baf1d0c915ff696258e2ed Binary files /dev/null and b/gdal-2.3.1.tar.gz differ diff --git a/gdal-cleaner.sh b/gdal-cleaner.sh new file mode 100644 index 0000000000000000000000000000000000000000..f14e0e3a8fca404403b859f3bc688b0ce1eb3f52 --- /dev/null +++ b/gdal-cleaner.sh @@ -0,0 +1,22 @@ +#!/bin/bash +VERSION="2.3.1" + +tar xvf gdal-"${VERSION}".tar.xz + +mv gdal-"${VERSION}"{,-fedora} && pushd gdal-"${VERSION}"-fedora + +rm data/cubewerx_extra.wkt +rm data/esri_extra.wkt +rm data/esri_Wisconsin_extra.wkt +rm data/esri_StatePlane_extra.wkt +rm data/ecw_cs.wkt + +#Really necessary? +rm -r swig/php + +popd + + +#TODO: Insert Provenance file + +tar cvfJ gdal-"${VERSION}"-fedora.tar.xz gdal-"${VERSION}"-fedora diff --git a/gdal-completion.patch b/gdal-completion.patch new file mode 100644 index 0000000000000000000000000000000000000000..b335ff09ba79badd51d2bd861f4038831be56ea8 --- /dev/null +++ b/gdal-completion.patch @@ -0,0 +1,13 @@ +diff --git a/gdal/scripts/GNUmakefile b/gdal/scripts/GNUmakefile +index 8f039e4..fd1115a 100644 +--- a/gdal/scripts/GNUmakefile ++++ b/gdal/scripts/GNUmakefile +@@ -5,6 +5,6 @@ completion: + + install: + if test "x`pkg-config --version 2>/dev/null`" != "x" -a "x`pkg-config --variable=compatdir bash-completion`" != "x"; then \ +- $(INSTALL_DIR) $(DESTDIR)${prefix}`pkg-config --variable=compatdir bash-completion` ; \ +- cp gdal-bash-completion.sh $(DESTDIR)${prefix}`pkg-config --variable=compatdir bash-completion`; \ ++ $(INSTALL_DIR) $(DESTDIR)`pkg-config --variable=compatdir bash-completion` ; \ ++ $(INSTALL_DATA) gdal-bash-completion.sh $(DESTDIR)`pkg-config --variable=compatdir bash-completion`/gdal; \ + fi diff --git a/gdal.pom b/gdal.pom new file mode 100644 index 0000000000000000000000000000000000000000..95bf86f7f1312f9498af3fac1a7f6ddb5386e8fa --- /dev/null +++ b/gdal.pom @@ -0,0 +1,6 @@ + + 4.0.0 + org.gdal + gdal-java-bindings + + diff --git a/gdal.spec b/gdal.spec new file mode 100644 index 0000000000000000000000000000000000000000..000ccd9226a027a5f2d8c75a2f8b63d9148e6aba --- /dev/null +++ b/gdal.spec @@ -0,0 +1,883 @@ +#TODO: g2clib and grib (said to be modified) +#TODO: Python 3 modules should be possible since 1.7 +#TODO: Create script to make clean tarball +#TODO: msg needs to have PublicDecompWT.zip from EUMETSAT, which is not free; +# Building without msg therefore +#TODO: e00compr bundled? +#TODO: There are tests for bindings -- at least for Perl +#TODO: Java has a directory with test data and a build target called test +# It uses %%{JAVA_RUN}; make test seems to work in the build directory +#TODO: e00compr source is the same in the package and bundled in GDAL +#TODO: Consider doxy patch from Suse, setting EXTRACT_LOCAL_CLASSES = NO + +# Soname should be bumped on API/ABI break +# http://trac.osgeo.org/gdal/ticket/4543 + +# Conditionals and structures for EL 5 are there +# to make life easier for downstream ELGIS. + +# He also suggest to use --with-static-proj4 to actually link to proj, instead of dlopen()ing it. + +# Major digit of the proj so version +%global proj_somaj 12 + +# Tests can be of a different version +%global testversion 2.3.1 +%global run_tests 0 + +%global bashcompletiondir %(pkg-config --variable=compatdir bash-completion) + +%if 0%{?bootstrap} +%global build_refman 0 +%global with_mysql 0 +%global mysql --without-mysql +%global with_poppler 0 +%global poppler --without-poppler +%global with_spatialite 0 +%global spatialite --without-spatialite +%else +# Enable/disable generating refmans +# texlive currently broken deps and FTBFS in rawhide +%global build_refman 1 +# https://bugzilla.redhat.com/show_bug.cgi?id=1490492 +%global with_mysql 1 +%global mysql --with-mysql +# https://bugzilla.redhat.com/show_bug.cgi?id=1490492 +%global with_poppler 1 +%global poppler --with-poppler +%global with_spatialite 1 +%global spatialite "--with-spatialite" +%endif +%global with_python2 0 + +# No ppc64 build for spatialite in EL6 +# https://bugzilla.redhat.com/show_bug.cgi?id=663938 +%if 0%{?rhel} == 6 +%ifnarch ppc64 +%global with_spatialite 0 +%global spatialite --without-spatialite +%endif +%endif + +Name: gdal +Version: 2.3.1 +Release: 1 +Summary: GIS file format library +Group: System Environment/Libraries +License: MIT +URL: http://www.gdal.org + +Source0: https://github.com/OSGeo/gdal/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +Source1: %{name}.pom + +# Cleaner script for the tarball +Source2: %{name}-cleaner.sh + + +# Patch to use system g2clib +# Patch for JNI library location +# Fix bash-completion install dir +Patch0: %{name}-completion.patch + +# Alternatives for Java +Patch1: %{name}-1.9.0-java.patch +Patch2: %{name}-2.3.0-zlib.patch + +# https://github.com/OSGeo/gdal/pull/876 +Patch3: %{name}-2.3.1-perl-build.patch + + +BuildRequires: gcc gcc-c++ +BuildRequires: ant +# No armadillo in EL5 +BuildRequires: armadillo-devel +BuildRequires: bash-completion +BuildRequires: cfitsio-devel +# No CharLS in EL5 +#BuildRequires: CharLS-devel +BuildRequires: chrpath +BuildRequires: curl-devel +BuildRequires: doxygen +BuildRequires: expat-devel +BuildRequires: fontconfig-devel +# No freexl in EL5 +BuildRequires: freexl-devel +BuildRequires: g2clib-static +BuildRequires: geos-devel +BuildRequires: ghostscript +BuildRequires: hdf-devel +BuildRequires: hdf-static +BuildRequires: hdf5-devel +BuildRequires: java-devel >= 1:1.6.0 +BuildRequires: jasper-devel +BuildRequires: jpackage-utils +# add_maven_depmap macro moved into this package in F27, it seems like +BuildRequires: javapackages-local +BuildRequires: json-c-devel +BuildRequires: libgeotiff-devel +# No libgta in EL5 +BuildRequires: libgta-devel + +BuildRequires: libjpeg-devel +BuildRequires: libpng-devel + +%if %{with_spatialite} +BuildRequires: libspatialite-devel +%endif + +BuildRequires: libtiff-devel +# No libwebp in EL 5 and 6 +BuildRequires: libwebp-devel +BuildRequires: libtool +BuildRequires: giflib-devel +BuildRequires: netcdf-devel +BuildRequires: libdap-devel +%if 0%{?with_mysql} +BuildRequires: mariadb-connector-c-devel +%endif +#BuildRequires: numpy +BuildRequires: python3-numpy +BuildRequires: pcre-devel +BuildRequires: ogdi-devel +BuildRequires: perl-devel +BuildRequires: perl-generators +BuildRequires: openjpeg2-devel +BuildRequires: perl(ExtUtils::MakeMaker) +BuildRequires: %{_bindir}/pkg-config +%if 0%{?with_poppler} +BuildRequires: poppler-devel +%endif +BuildRequires: postgresql-devel +BuildRequires: proj-devel +%if %{?with_python2} +BuildRequires: python2-devel +%endif +BuildRequires: python3-devel +BuildRequires: sqlite-devel +BuildRequires: swig +%if %{build_refman} +BuildRequires: texlive-latex +BuildRequires: texlive-collection-fontsrecommended +%if 0%{?fedora} +BuildRequires: texlive-collection-langcyrillic +BuildRequires: texlive-collection-langportuguese +%endif +BuildRequires: texlive-collection-latex +BuildRequires: texlive-epstopdf +BuildRequires: tex(multirow.sty) +BuildRequires: tex(sectsty.sty) +BuildRequires: tex(tabu.sty) +BuildRequires: tex(tocloft.sty) +BuildRequires: tex(xtab.sty) +%endif +BuildRequires: unixODBC-devel +BuildRequires: xerces-c-devel +BuildRequires: xz-devel +BuildRequires: zlib-devel +BuildRequires: libtirpc-devel +BuildRequires: texlive-newunicodechar + +# Run time dependency for gpsbabel driver +Requires: gpsbabel + +# proj DL-opened in ogrct.cpp, see also fix in %%prep +%if 0%{?__isa_bits} == 64 +Requires: libproj.so.%{proj_somaj}()(64bit) +%else +Requires: libproj.so.%{proj_somaj} +%endif + +Requires: %{name}-libs%{?_isa} = %{version}-%{release} + +# We have multilib triage +%if "%{_lib}" == "lib" + %global cpuarch 32 +%else + %global cpuarch 64 +%endif + +%if ! (0%{?fedora} || 0%{?rhel} > 5) +%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} +%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} +%endif + +#TODO: Description on the lib? +%description +Geospatial Data Abstraction Library (GDAL/OGR) is a cross platform +C++ translator library for raster and vector geospatial data formats. +As a library, it presents a single abstract data model to the calling +application for all supported formats. It also comes with a variety of +useful commandline utilities for data translation and processing. + +It provides the primary data access engine for many applications. +GDAL/OGR is the most widely used geospatial data access library. + + +%package devel +Summary: Development files for the GDAL file format library +Group: Development/Libraries + +# Old rpm didn't figure out +%if 0%{?rhel} < 6 +Requires: pkgconfig +%endif + +Requires: %{name}-libs%{?_isa} = %{version}-%{release} +Obsoletes: %{name}-static < 1.9.0-1 + +%description devel +This package contains development files for GDAL. + + +%package libs +Summary: GDAL file format library +Group: System Environment/Libraries +# https://trac.osgeo.org/gdal/ticket/3978#comment:5 +Obsoletes: %{name}-ruby < 1.11.0-1 + +%description libs +This package contains the GDAL file format library. + + +%package java +Summary: Java modules for the GDAL file format library +Group: Development/Libraries +Requires: jpackage-utils +Requires: %{name}-libs%{?_isa} = %{version}-%{release} + +%description java +The GDAL Java modules provide support to handle multiple GIS file formats. + + +%package javadoc +Summary: Javadocs for %{name} +Group: Documentation +Requires: jpackage-utils +BuildArch: noarch + +%description javadoc +This package contains the API documentation for %{name}. + + +%package perl +Summary: Perl modules for the GDAL file format library +Group: Development/Libraries +Requires: %{name}-libs%{?_isa} = %{version}-%{release} +Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) + +%description perl +The GDAL Perl modules provide support to handle multiple GIS file formats. + +%if %{?with_python2} +%package -n python2-gdal +%{?python_provide:%python_provide python2-gdal} +# Remove before F30 +Provides: %{name}-python = %{version}-%{release} +Provides: %{name}-python%{?_isa} = %{version}-%{release} +Obsoletes: %{name}-python < %{version}-%{release} +Summary: Python modules for the GDAL file format library +Group: Development/Libraries +Requires: numpy +Requires: %{name}-libs%{?_isa} = %{version}-%{release} + +%description -n python2-gdal +The GDAL Python modules provide support to handle multiple GIS file formats. +The package also includes a couple of useful utilities in Python. +%endif + +%package -n python3-gdal +%{?python_provide:%python_provide python3-gdal} +Summary: Python modules for the GDAL file format library +Group: Development/Libraries +Requires: python3-numpy +Requires: %{name}-libs%{?_isa} = %{version}-%{release} +Obsoletes: gdal-python3 < 2.3.1 +Provides: gdal-python3 + +%description -n python3-gdal +The GDAL Python 3 modules provide support to handle multiple GIS file formats. + + +%package doc +Summary: Documentation for GDAL +Group: Documentation +BuildArch: noarch + +%description doc +This package contains HTML and PDF documentation for GDAL. + +# We don't want to provide private Python extension libs +%global __provides_exclude_from ^(%{python2_sitearch}|%{python3_sitearch})/.*\.so$ + +%prep +%setup -q -n %{name}-%{version} + +# Delete bundled libraries +rm -rf frmts/zlib +rm -rf frmts/png/libpng +rm -rf frmts/gif/giflib +rm -rf frmts/jpeg/libjpeg \ + frmts/jpeg/libjpeg12 +rm -rf frmts/gtiff/libgeotiff \ + frmts/gtiff/libtiff +#rm -r frmts/grib/degrib/g2clib + +%patch0 -p1 -b .completion~ +%patch1 -p1 -b .java~ +%patch2 -p1 -b .zlib~ +%patch3 -p1 -b .perl-build~ + +# Sanitize linebreaks and encoding +#TODO: Don't touch data directory! +# /frmts/grib/degrib18/degrib/metaname.cpp +# and geoconcept.c are potentially dangerous to change +set +x +for f in `find . -type f` ; do + if file $f | grep -q ISO-8859 ; then + set -x + iconv -f ISO-8859-1 -t UTF-8 $f > ${f}.tmp && \ + mv -f ${f}.tmp $f + set +x + fi + if file $f | grep -q CRLF ; then + set -x + sed -i -e 's|\r||g' $f + set +x + fi +done +set -x + +for f in gdal/apps; do +pushd $f + chmod 644 *.cpp +popd +done + +# Replace hard-coded library- and include paths +sed -i 's|-L\$with_cfitsio -L\$with_cfitsio/lib -lcfitsio|-lcfitsio|g' gdal/configure +sed -i 's|-I\$with_cfitsio -I\$with_cfitsio/include|-I\$with_cfitsio/include/cfitsio|g' gdal/configure +sed -i 's|-L\$with_netcdf -L\$with_netcdf/lib -lnetcdf|-lnetcdf|g' gdal/configure +sed -i 's|-L\$DODS_LIB -ldap++|-ldap++|g' gdal/configure +sed -i 's|-L\$with_ogdi -L\$with_ogdi/lib -logdi|-logdi|g' gdal/configure +sed -i 's|-L\$with_jpeg -L\$with_jpeg/lib -ljpeg|-ljpeg|g' gdal/configure +sed -i 's|-L\$with_libtiff\/lib -ltiff|-ltiff|g' gdal/configure +sed -i 's|-lgeotiff -L$with_geotiff $LIBS|-lgeotiff $LIBS|g' gdal/configure +sed -i 's|-L\$with_geotiff\/lib -lgeotiff $LIBS|-lgeotiff $LIBS|g' gdal/configure + +# libproj is dlopened; upstream sources point to .so, which is usually not present +# http://trac.osgeo.org/gdal/ticket/3602 +sed -i 's|libproj.so|libproj.so.%{proj_somaj}|g' gdal/ogr/ogrct.cpp + +# Fix Python samples to depend on correct interpreter +mkdir -p gdal/swig/python3/samples +pushd gdal/swig/python/samples +for f in `find . -name '*.py'`; do + sed 's|^#!.\+python$|#!/usr/bin/python3|' $f > ../../python3/samples/$f + chmod --reference=$f ../../python3/samples/$f + sed -i 's|^#!.\+python$|#!/usr/bin/python2|' $f +done +popd + +# Adjust check for LibDAP version +# http://trac.osgeo.org/gdal/ticket/4545 +%if %cpuarch == 64 + sed -i 's|with_dods_root/lib|with_dods_root/lib64|' gdal/configure +%endif + +# Fix mandir +sed -i "s|^mandir=.*|mandir='\${prefix}/share/man'|" gdal/configure + +# Add our custom cflags when trying to find geos +# https://bugzilla.redhat.com/show_bug.cgi?id=1284714 +sed -i 's|CFLAGS=\"${GEOS_CFLAGS}\"|CFLAGS=\"${CFLAGS} ${GEOS_CFLAGS}\"|g' gdal/configure + +%build +#TODO: Couldn't I have modified that in the prep section? +%ifarch sparcv9 sparc64 s390 s390x +export CFLAGS="$RPM_OPT_FLAGS -fPIC" +%else +export CFLAGS="$RPM_OPT_FLAGS -fpic" +%endif +export CXXFLAGS="$CFLAGS -I%{_includedir}/libgeotiff -I%{_includedir}/tirpc" +export CPPFLAGS="$CPPFLAGS -I%{_includedir}/libgeotiff -I%{_includedir}/tirpc" + +# For future reference: +# epsilon: Stalled review -- https://bugzilla.redhat.com/show_bug.cgi?id=660024 +# Building without pgeo driver, because it drags in Java + +%if 0%{?fedora} >= 27 || 0%{?rhel} > 7 +%global g2clib g2c_v1.6.0 +%else +%global g2clib grib2c +%endif + +pushd ./gdal +%configure \ + LIBS="-ltirpc" \ + --with-autoload=%{_libdir}/%{name}plugins \ + --datadir=%{_datadir}/%{name}/ \ + --includedir=%{_includedir}/%{name}/ \ + --prefix=%{_prefix} \ + --with-armadillo \ + --with-curl \ + --with-cfitsio=%{_prefix} \ + --with-dods-root=%{_prefix} \ + --with-expat \ + --with-freexl \ + --with-geos \ + --with-geotiff=external \ + --with-gif \ + --with-gta \ + --with-hdf4 \ + --with-hdf5 \ + --with-jasper \ + --with-java \ + --with-jpeg \ + --with-libjson-c \ + --without-jpeg12 \ + --with-liblzma \ + --with-libtiff=external \ + --with-libz \ + --without-mdb \ + %{mysql} \ + --with-netcdf \ + --with-odbc \ + --with-ogdi \ + --without-msg \ + --with-openjpeg \ + --with-pcraster \ + --with-pg \ + --with-png \ + %{poppler} \ + %{spatialite} \ + --with-sqlite3 \ + --with-threads \ + --with-webp \ + --with-xerces \ + --enable-shared \ + --with-libkml + +sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool +sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool + +# {?_smp_mflags} doesn't work; Or it does -- who knows! +# NOTE: running autoconf seems to break build: +# fitsdataset.cpp:37:10: fatal error: fitsio.h: No such file or directory +# #include + +POPPLER_OPTS="POPPLER_0_20_OR_LATER=yes POPPLER_0_23_OR_LATER=yes POPPLER_BASE_STREAM_HAS_TWO_ARGS=yes" +%if 0%{?fedora} > 26 || 0%{?rhel} > 7 +POPPLER_OPTS="$POPPLER_OPTS POPPLER_0_58_OR_LATER=yes" +%endif + +make %{?_smp_mflags} $POPPLER_OPTS + +make man +make docs +popd + + +# Build some utilities, as requested in BZ #1271906 +pushd gdal/ogr/ogrsf_frmts/s57/ + make all +popd + +pushd gdal/frmts/iso8211/ + make all +popd + +# Make Java module and documentation +pushd gdal/swig/java + make + ./make_doc.sh +popd + +# Make Python modules +pushd gdal/swig/python + %py3_build +%if %{?with_python2} + %py2_build +%endif +popd + +# Make Python modules +pushd gdal/swig/perl + make generate + #perl Makefile.PL INSTALLDIRS=%%{perl_vendorarch} + perl Makefile.PL INSTALLDIRS=vendor + %make_build +popd + +# --------- Documentation ---------- + +# No useful documentation in swig +%global docdirs gdal/apps gdal/doc gdal/doc/br gdal/doc/ru gdal/ogr gdal/ogr/ogrsf_frmts gdal/frmts/gxf gdal/frmts/iso8211 gdal/frmts/pcidsk gdal/frmts/sdts gdal/frmts/vrt gdal/ogr/ogrsf_frmts/dgn/ +for docdir in %{docdirs}; do + # CreateHTML and PDF documentation, if specified + pushd $docdir + if [ ! -f Doxyfile ]; then + doxygen -g + else + doxygen -u + fi + sed -i -e 's|^GENERATE_LATEX|GENERATE_LATEX = YES\n#GENERATE_LATEX |' Doxyfile + sed -i -e 's|^GENERATE_HTML|GENERATE_HTML = YES\n#GENERATE_HTML |' Doxyfile + sed -i -e 's|^USE_PDFLATEX|USE_PDFLATEX = YES\n#USE_PDFLATEX |' Doxyfile + + if [ $docdir == "doc/ru" ]; then + sed -i -e 's|^OUTPUT_LANGUAGE|OUTPUT_LANGUAGE = Russian\n#OUTPUT_LANGUAGE |' Doxyfile + fi + rm -rf latex html + doxygen + + %if %{build_refman} + pushd latex + sed -i -e '/rfoot\[/d' -e '/lfoot\[/d' doxygen.sty + sed -i -e '/small/d' -e '/large/d' refman.tex + sed -i -e 's|pdflatex|pdflatex -interaction nonstopmode |g' Makefile + make refman.pdf || true + popd + %endif + popd +done + + +%install +rm -rf %{buildroot} + +pushd gdal/swig/python + %py3_install +%if %{?with_python2} + %py2_install +%endif +popd + +pushd gdal/swig/perl + %make_install +popd + + +pushd ./gdal +make DESTDIR=%{buildroot} \ + install \ + install-man +popd + +install -pm 755 gdal/ogr/ogrsf_frmts/s57/s57dump %{buildroot}%{_bindir} +install -pm 755 gdal/frmts/iso8211/8211createfromxml %{buildroot}%{_bindir} +install -pm 755 gdal/frmts/iso8211/8211dump %{buildroot}%{_bindir} +install -pm 755 gdal/frmts/iso8211/8211view %{buildroot}%{_bindir} + +# Directory for auto-loading plugins +mkdir -p %{buildroot}%{_libdir}/%{name}plugins + +#TODO: Don't do that? +##find %%{buildroot}%%{perl_vendorarch} -name "*.dox" -exec rm -rf '{}' \; +##rm %%{buildroot}%%{perl_archlib}/perllocal.pod +find %{buildroot} -name "*.dox" -exec rm -rf '{}' \; +find %{buildroot} -name "perllocal.pod" -exec rm -rf '{}' \; + +# Correct permissions +#TODO and potential ticket: Why are the permissions not correct? +##find %%{buildroot}%%{perl_vendorarch} -name "*.so" -exec chmod 755 '{}' \; +##find %%{buildroot}%%{perl_vendorarch} -name "*.pm" -exec chmod 644 '{}' \; +find %{buildroot} -name "*.so" -exec chmod 755 '{}' \; +find %{buildroot} -name "*.pm" -exec chmod 644 '{}' \; + +#TODO: JAR files that require JNI shared objects MUST be installed in %%{_libdir}/%%{name}. The JNI shared objects themselves must also be installed in %%{_libdir}/%%{name}. +#Java programs that wish to make calls into native libraries do so via the Java Native Interface (JNI). A Java package uses JNI if it contains a .so +#If the JNI-using code calls System.loadLibrary you'll have to patch it to use System.load, passing it the full path to the dynamic shared object. If the package installs a wrapper script you'll need to manually add %%{_libdir}/%%{name}/ to CLASSPATH. If you are depending on a JNI-using JAR file, you'll need to add it manually -- build-classpath will not find it. +touch -r gdal/NEWS gdal/swig/java/gdal.jar +mkdir -p %{buildroot}%{_javadir} +cp -p gdal/swig/java/gdal.jar \ + %{buildroot}%{_javadir}/%{name}.jar + +# Install Maven pom and update version number +install -dm 755 %{buildroot}%{_mavenpomdir} +install -pm 644 %{SOURCE1} %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom +sed -i 's||%{version}|' %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom + +# Create depmap fragment +%add_maven_depmap JPP-%{name}.pom %{name}.jar + +# 775 on the .so? +# copy JNI libraries and links, non versioned link needed by JNI +# What is linked here? +mkdir -p %{buildroot}%{_jnidir}/%{name} +cp -pl gdal/swig/java/.libs/*.so* \ + %{buildroot}%{_jnidir}/%{name}/ +chrpath --delete %{buildroot}%{_jnidir}/%{name}/*jni.so* + +# Install Java API documentation in the designated place +mkdir -p %{buildroot}%{_javadocdir}/%{name} +cp -pr gdal/swig/java/java/org %{buildroot}%{_javadocdir}/%{name} + +# Install refmans +for docdir in %{docdirs}; do + pushd $docdir + path=%{_builddir}/%{name}-%{version}/refman + mkdir -p $path/html/$docdir + cp -r html $path/html/$docdir + + # Install all Refmans + %if %{build_refman} + if [ -f latex/refman.pdf ]; then + mkdir -p $path/pdf/$docdir + cp latex/refman.pdf $path/pdf/$docdir + fi + %endif + popd +done + +# Install formats documentation +for dir in gdal/gdal_frmts gdal/ogrsf_frmts; do + mkdir -p $dir + find gdal/frmts -name "*.html" -exec install -p -m 644 '{}' $dir \; +done + +#TODO: Header date lost during installation +# Install multilib cpl_config.h bz#430894 +install -p -D -m 644 gdal/port/cpl_config.h %{buildroot}%{_includedir}/%{name}/cpl_config-%{cpuarch}.h +# Create universal multilib cpl_config.h bz#341231 +# The problem is still there in 1.9. +#TODO: Ticket? + +#>>>>>>>>>>>>> +cat > %{buildroot}%{_includedir}/%{name}/cpl_config.h < + +#if __WORDSIZE == 32 +#include "gdal/cpl_config-32.h" +#else +#if __WORDSIZE == 64 +#include "gdal/cpl_config-64.h" +#else +#error "Unknown word size" +#endif +#endif +EOF +#<<<<<<<<<<<<< +touch -r gdal/NEWS gdal/port/cpl_config.h + +# Create and install pkgconfig file +#TODO: Why does that exist? Does Grass really use it? I don't think so. +# http://trac.osgeo.org/gdal/ticket/3470 +#>>>>>>>>>>>>> +cat > %{name}.pc <>>>>>>>>>>>> +cat > %{buildroot}%{_bindir}/%{name}-config < - 2.3.1-1 +- Init package