#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 # EPEL-specific naming to avoid conflicts with RHEL gdal package %global pkgname gdal %global libsuffix -epel # Tests can be of a different version %global testversion 3.4.3 %global run_tests 1 %if 0%{?bootstrap} %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 # 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 %bcond_without java %bcond_without python3 # 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: epel-gdal Version: 3.4.3 Release: 1%{?dist} Summary: GIS file format library (EPEL version with full features) License: MIT URL: http://www.gdal.org # Source0: http://download.osgeo.org/gdal/%%{version}/gdal-%%{version}.tar.xz # See PROVENANCE.TXT-fedora and the cleaner script for details! Source0: %{pkgname}-%{version}-fedora.tar.xz Source1: http://download.osgeo.org/%{pkgname}/%{testversion}/%{pkgname}autotest-%{testversion}.tar.gz # Cleaner script for the tarball Source3: %{pkgname}-cleaner.sh Source4: PROVENANCE.TXT-fedora # Java build fixes Patch2: gdal_java.patch # Ensure rpc/types.h is found by dods driver (indirectly required by libdap/XDRUtils.h) Patch3: gdal_tirpcinc.patch # Use libtool to create libiso8211.a, otherwise broken static lib is created since object files are compiled through libtool Patch4: gdal_iso8211.patch # Don't pass -W to sphinx, it causes it to error out on warnings # Don't do parallel build, currently fails with "Sphinx parallel build error: NotImplementedError" Patch5: gdal_sphinx.patch # Fix makefiles installing libtool wrappers instead of actual executables Patch6: gdal_installapps.patch # Don't refer to PDF manual which is not built Patch7: gdal_nopdf.patch # Fix issues caught by gcc-11 Patch8: %{pkgname}-gcc11.patch # Drop -diag-disable compile flag Patch9: gdal_no-diag-disable.patch # Fix build with autoconf 2.70 Patch10: gdal_autoconf270.patch BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: libtool BuildRequires: automake BuildRequires: autoconf BuildRequires: ant BuildRequires: armadillo-devel BuildRequires: cfitsio-devel #BuildRequires: CharLS-devel BuildRequires: chrpath BuildRequires: curl-devel BuildRequires: doxygen BuildRequires: expat-devel BuildRequires: fontconfig-devel BuildRequires: freexl-devel BuildRequires: geos-devel >= 3.7.1 BuildRequires: ghostscript BuildRequires: hdf-devel BuildRequires: hdf-static BuildRequires: hdf5-devel BuildRequires: jasper-devel BuildRequires: jpackage-utils BuildRequires: json-c-devel BuildRequires: libgeotiff-devel BuildRequires: libgta-devel BuildRequires: libjpeg-devel BuildRequires: libpng-devel BuildRequires: libkml-devel %if %{with_spatialite} BuildRequires: libspatialite-devel %endif BuildRequires: libtiff-devel BuildRequires: libwebp-devel BuildRequires: libtool BuildRequires: giflib-devel BuildRequires: netcdf-devel BuildRequires: libdap-devel BuildRequires: librx-devel %if 0%{?with_mysql} BuildRequires: mariadb-connector-c-devel %endif 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: libpq-devel BuildRequires: proj-devel >= 5.2.0 %if %{with python3} BuildRequires: python3-devel BuildRequires: python3-numpy BuildRequires: python3-setuptools BuildRequires: python3dist(pytest) >= 3.6 BuildRequires: python3dist(lxml) >= 4.5.1 %endif BuildRequires: sqlite-devel BuildRequires: swig BuildRequires: unixODBC-devel BuildRequires: xerces-c-devel BuildRequires: xz-devel BuildRequires: zlib-devel BuildRequires: libtirpc-devel BuildRequires: python3-sphinx BuildRequires: python3-sphinx_rtd_theme BuildRequires: python3-breathe BuildRequires: make # Run time dependency for gpsbabel driver Requires: gpsbabel Requires: %{name}-libs%{?_isa} = %{version}-%{release} # We have multilib triage %if "%{_lib}" == "lib" %global cpuarch 32 %else %global cpuarch 64 %endif %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. This is the EPEL version with full features, renamed to avoid conflicts with the stripped-down RHEL version. %package devel Summary: Development files for the GDAL file format library (EPEL version) Requires: %{name}-libs%{?_isa} = %{version}-%{release} %description devel This package contains development files for GDAL (EPEL version). %package libs Summary: GDAL file format library (EPEL version) # See frmts/grib/degrib/README.TXT Provides: bundled(g2lib) = 1.6.0 Provides: bundled(degrib) = 2.14 %description libs This package contains the GDAL file format library (EPEL version). %if %{with java} %package java Summary: Java modules for the GDAL file format library (EPEL version) BuildRequires: java-devel >= 1:1.6.0 # For 'mvn_artifact' and 'mvn_install' BuildRequires: javapackages-local Requires: jpackage-utils Requires: %{name}-libs%{?_isa} = %{version}-%{release} %description java The GDAL Java modules provide support to handle multiple GIS file formats. This is the EPEL version. %package javadoc Summary: Javadocs for %{name} Requires: jpackage-utils BuildArch: noarch %description javadoc This package contains the API documentation for %{name}. %endif %package perl Summary: Perl modules for the GDAL file format library (EPEL version) 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. This is the EPEL version. %if %{with python3} %package -n python3-epel-gdal %{?python_provide:%python_provide python3-epel-gdal} Summary: Python modules for the GDAL file format library (EPEL version) Requires: python3-numpy Requires: %{name}-libs%{?_isa} = %{version}-%{release} %description -n python3-epel-gdal The GDAL Python 3 modules provide support to handle multiple GIS file formats. This is the EPEL version. %endif %if %{with python3} %package python-tools Summary: Python tools for the GDAL file format library (EPEL version) Requires: python3-epel-gdal %description python-tools The GDAL Python package provides number of tools for programming and manipulating GDAL file format library. This is the EPEL version. %endif %package doc Summary: Documentation for GDAL (EPEL version) BuildArch: noarch %description doc This package contains documentation for GDAL (EPEL version). # We don't want to provide private Python extension libs %if %{with_python3} %global __provides_exclude_from ^%{python3_sitearch}/.*\.so$ %endif %prep %autosetup -p1 -n %{pkgname}-%{version}-fedora -a 1 # Delete bundled libraries rm -rf frmts/zlib rm -rf frmts/png/libpng rm -rf frmts/gif/giflib rm -rf frmts/jpeg/libjpeg rm -rf frmts/jpeg/libjpeg12 rm -rf frmts/gtiff/libgeotiff rm -rf frmts/gtiff/libtiff # Copy in PROVENANCE.TXT-fedora cp -p %SOURCE4 . # 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|' configure.ac %endif # Rename library from libgdal to libgdal-epel in source files # This ensures the library is built with correct SONAME and all bindings link correctly # ============================================================ # CRITICAL: gdal-config.in is the KEY file! # Python/Perl/Java bindings call: gdal-config --libs # This must return -lgdal-epel instead of -lgdal # ============================================================ # Fix apps/gdal-config.in template - THIS IS THE MOST IMPORTANT ONE # The --libs output contains -lgdal which must become -lgdal-epel sed -i 's/-lgdal$/-lgdal%{libsuffix}/' apps/gdal-config.in sed -i 's/-lgdal /-lgdal%{libsuffix} /g' apps/gdal-config.in sed -i 's/-lgdal"/-lgdal%{libsuffix}"/g' apps/gdal-config.in # Main library name in GDALmake.opt.in template sed -i 's/GDAL_SLIB_LINK = -lgdal/GDAL_SLIB_LINK = -lgdal%{libsuffix}/' GDALmake.opt.in sed -i 's/GDAL_SLIB_SONAME = libgdal/GDAL_SLIB_SONAME = libgdal%{libsuffix}/' GDALmake.opt.in sed -i 's/GDAL_SLIB = \$(GDAL_ROOT)\/libgdal/GDAL_SLIB = $(GDAL_ROOT)\/libgdal%{libsuffix}/' GDALmake.opt.in # Fix library name patterns in GDALmake.opt.in sed -i 's/libgdal\.la/libgdal%{libsuffix}.la/g' GDALmake.opt.in sed -i 's/libgdal\.so/libgdal%{libsuffix}.so/g' GDALmake.opt.in # Fix in configure.ac where SONAME and library name is generated sed -i 's/libgdal\.\${GDAL_VERSION_MAJOR}/libgdal%{libsuffix}.${GDAL_VERSION_MAJOR}/g' configure.ac sed -i 's/libgdal\.so/libgdal%{libsuffix}.so/g' configure.ac sed -i 's/libgdal\.la/libgdal%{libsuffix}.la/g' configure.ac sed -i 's/-lgdal"/-lgdal%{libsuffix}"/g' configure.ac sed -i "s/-lgdal'/-lgdal%{libsuffix}'/g" configure.ac sed -i 's/-lgdal /-lgdal%{libsuffix} /g' configure.ac # Fix swig Makefiles (these may also have hardcoded -lgdal) find swig -name "GNUmakefile" -o -name "Makefile*" -o -name "*.opt*" | \ xargs sed -i 's/-lgdal\b/-lgdal%{libsuffix}/g' 2>/dev/null || true # Fix Python setup.py if it has hardcoded library name sed -i "s/'gdal'/'gdal%{libsuffix}'/g" swig/python/setup.py 2>/dev/null || true sed -i 's/"gdal"/"gdal%{libsuffix}"/g' swig/python/setup.py 2>/dev/null || true # Fix Perl Makefile.PL sed -i "s/'gdal'/'gdal%{libsuffix}'/g" swig/perl/Makefile.PL 2>/dev/null || true # Fix Java build files sed -i 's/-lgdal\b/-lgdal%{libsuffix}/g' swig/java/java.opt.in 2>/dev/null || true %build # For future reference: # epsilon: Stalled review -- https://bugzilla.redhat.com/show_bug.cgi?id=660024 # Building without pgeo driver, because it drags in Java autoreconf -ifv %configure \ --with-autoload=%{_libdir}/%{name}plugins \ --includedir=%{_includedir}/%{name}/ \ --prefix=%{_prefix} \ --with-armadillo \ --with-curl \ --with-cfitsio \ --with-dods-root=%{_prefix} \ --with-expat \ --with-freexl \ --with-geos \ --with-geotiff \ --with-gif \ --with-gta \ --with-hdf4 \ --with-hdf5 \ --with-jasper \ %if %{with java} --with-java \ %endif --with-jpeg \ --with-libjson-c \ --without-jpeg12 \ --with-liblzma \ --with-libtiff \ --with-libz \ --without-mdb \ --without-msg \ %{mysql} \ --with-netcdf \ --with-odbc \ --with-ogdi \ --with-openjpeg \ --with-pcraster \ --with-pg \ --with-png \ %{poppler} \ --with-proj \ %{spatialite} \ --with-sqlite3 \ --with-threads \ --with-webp \ --with-xerces \ --enable-shared \ --with-libkml # Build with standard library name, rename during install %make_build # Build some utilities, as requested in BZ #1271906 make -C ogr/ogrsf_frmts/s57 all make -C frmts/iso8211 all # Documentation make man make docs %if %{with java} # Make Java module and documentation pushd swig/java make ANT_OPTS="-Dfile.encoding=utf-8" ant maven popd %mvn_artifact swig/java/build/maven/%{pkgname}-%version.pom swig/java/build/maven/%{pkgname}-%version.jar %endif # Make Python modules pushd swig/python %{?with_python3:%py3_build} popd # Make Perl modules pushd swig/perl perl Makefile.PL INSTALLDIRS=vendor %make_build popd %install pushd swig/python %{?with_python3:%py3_install} popd %make_install -C swig/perl %make_install install-man # Library should already be built as libgdal-epel.so due to source modifications in %prep # Verify and create proper symlinks pushd %{buildroot}%{_libdir} # List what was installed for debugging ls -la libgdal* 2>/dev/null || true # Ensure symlinks are correct if [ -f libgdal%{libsuffix}.so.30.* ] || [ -L libgdal%{libsuffix}.so.30 ]; then rm -f libgdal%{libsuffix}.so ln -sf libgdal%{libsuffix}.so.30 libgdal%{libsuffix}.so fi popd # Drop gdal.pdf symlink, as we don't build the pdf documentation rm -f doc/build/html/gdal.pdf install -pm 755 ogr/ogrsf_frmts/s57/s57dump %{buildroot}%{_bindir}/epel-s57dump install -pm 755 frmts/iso8211/8211createfromxml %{buildroot}%{_bindir}/epel-8211createfromxml install -pm 755 frmts/iso8211/8211dump %{buildroot}%{_bindir}/epel-8211dump install -pm 755 frmts/iso8211/8211view %{buildroot}%{_bindir}/epel-8211view # Rename for %%files doc below mv frmts/iso8211/html frmts/iso8211/iso8211_html # Rename all binaries with epel- prefix for binary in gdallocationinfo gdal_contour gdal_create gdal_rasterize gdal_translate \ gdaladdo gdalinfo gdaldem gdalbuildvrt gdaltindex gdalwarp gdal_grid \ gdalenhance gdalmanage gdalsrsinfo gdaltransform nearblack gdal_viewshed \ gdalmdiminfo gdalmdimtranslate gnmanalyse gnmmanage; do if [ -f %{buildroot}%{_bindir}/${binary} ]; then mv %{buildroot}%{_bindir}/${binary} %{buildroot}%{_bindir}/epel-${binary} fi done # Rename ogr* binaries for binary in %{buildroot}%{_bindir}/ogr*; do if [ -f "$binary" ]; then basename=$(basename "$binary") mv "$binary" %{buildroot}%{_bindir}/epel-${basename} fi done # Directory for auto-loading plugins mkdir -p %{buildroot}%{_libdir}/%{name}plugins #TODO: Don't do that? rm -f %{buildroot}%{perl_archlib}/perllocal.pod %if %{without python3} rm -f %buildroot%_mandir/man1/{pct2rgb,rgb2pct}.1 %endif # 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 '{}' \; %if %{with java} # install Java plugin %mvn_install -J swig/java/java # 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 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 swig/java/java/org %{buildroot}%{_javadocdir}/%{name} %endif #TODO: Header date lost during installation # Install multilib cpl_config.h bz#430894 install -p -D -m 644 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 "epel-gdal/cpl_config-32.h" #else #if __WORDSIZE == 64 #include "epel-gdal/cpl_config-64.h" #else #error "Unknown word size" #endif #endif EOF #<<<<<<<<<<<<< touch -r NEWS.md port/cpl_config.h # Multilib gdal-config # Rename the original script to epel-gdal-config-$arch (stores arch-specific information) # and create a script to call one or the other -- depending on detected architecture # TODO: The extra script will direct you to 64 bit libs on # 64 bit systems -- whether you like that or not mv %{buildroot}%{_bindir}/%{pkgname}-config %{buildroot}%{_bindir}/%{name}-config-%{cpuarch} #>>>>>>>>>>>>> cat > %{buildroot}%{_bindir}/%{name}-config < - 3.4.3-1 - Initial EPEL version with alternate naming to avoid conflicts with RHEL gdal - Renamed package from gdal to epel-gdal - Renamed library from libgdal.so to libgdal-epel.so - Renamed all binaries with epel- prefix - Added Conflicts with RHEL gdal packages