SHA256
1
0
forked from pool/gdal

Accepting request 728592 from home:StefanBruens:branches:Application:Geo

Fix building with Swig 4.0

OBS-URL: https://build.opensuse.org/request/show/728592
OBS-URL: https://build.opensuse.org/package/show/Application:Geo/gdal?expand=0&rev=99
This commit is contained in:
Bruno Friedmann 2019-09-06 06:26:49 +00:00 committed by Git OBS Bridge
parent 7113c01531
commit f11d46f281
3 changed files with 72 additions and 50 deletions

View File

@ -0,0 +1,50 @@
From 10289fbed9db3f803571607e09ce93ee5e183e3d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Thu, 5 Sep 2019 20:54:32 +0200
Subject: [PATCH] Replace SWIG Python obj0/swig_obj[0] with version agnostic
$self
"obj0" was only meant as a porting helper and should not be used, even
with swig 3.0, see swig/swig@cd8fc0a.
Use the correct "$self" notation, which is expanded to the correct
code regardless of swig version and options.
---
gdal/swig/include/gdal_array.i | 6 +++---
gdal/swig/include/python/typemaps_python.i | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/swig/include/gdal_array.i b/swig/include/gdal_array.i
index ff7bcde6c7..5dd3679cb2 100644
--- a/swig/include/gdal_array.i
+++ b/swig/include/gdal_array.i
@@ -878,11 +878,11 @@ retStringAndCPLFree* GetArrayFilename(PyArrayObject *psArray)
/* Keep a reference to the VirtualMem object */
%#if NPY_API_VERSION >= 0x00000007
- PyArray_SetBaseObject(ar, obj0);
+ PyArray_SetBaseObject(ar, $self);
%#else
- PyArray_BASE(ar) = obj0;
+ PyArray_BASE(ar) = $self;
%#endif
- Py_INCREF(obj0);
+ Py_INCREF($self);
Py_DECREF($result);
$result = (PyObject*) ar;
}
diff --git a/swig/include/python/typemaps_python.i b/swig/include/python/typemaps_python.i
index 104b214ac1..9517c72ebd 100644
--- a/swig/include/python/typemaps_python.i
+++ b/swig/include/python/typemaps_python.i
@@ -1911,7 +1911,7 @@ DecomposeSequenceOfCoordinates( PyObject *seq, int nCount, double *x, double *y,
%#if PY_VERSION_HEX >= 0x02070000
/* %typemap(argout) (void** pptr, size_t* pnsize, GDALDataType* pdatatype, int* preadonly)*/
Py_buffer *buf=(Py_buffer*)malloc(sizeof(Py_buffer));
- if (PyBuffer_FillInfo(buf, obj0, *($1), *($2), *($4), PyBUF_ND)) {
+ if (PyBuffer_FillInfo(buf, $self, *($1), *($2), *($4), PyBUF_ND)) {
// error, handle
}
if( *($3) == GDT_Byte )
--
2.23.0

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Sep 5 18:50:20 UTC 2019 - Stefan Brüns <stefan.bruens@rwth-aachen.de>
- Fix build with Swig 4.0, add
0001-Replace-SWIG-Python-obj0-swig_obj-0-with-version-agn.patch
- Spec file cleanup, remove conditionals for Leap 42.x and older
-------------------------------------------------------------------
Mon Jul 8 13:34:52 UTC 2019 - Dirk Stoecker <opensuse@dstoecker.de>

View File

@ -37,7 +37,11 @@ Source1: http://download.osgeo.org/%{name}/%{version}/%{sourcename}-%{ver
Patch0: gdal-perl.patch
# Fix occasional parallel build failure
Patch1: GDALmake.opt.in.patch
# PATCH-FIX-UPSTREAM -- https://github.com/OSGeo/gdal/pull/1819
Patch3: 0001-Replace-SWIG-Python-obj0-swig_obj-0-with-version-agn.patch
BuildRequires: KEALib-devel
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: blas-devel
BuildRequires: chrpath
BuildRequires: curl-devel
@ -47,13 +51,12 @@ BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: geos-devel >= 3
BuildRequires: giflib-devel
BuildRequires: hdf5-devel
BuildRequires: lapack-devel
# No more please we have openjpeg2
# BuildRequires: libjasper-devel
# Using jasper create build error on arm, powerpc, s390
BuildRequires: libtool
BuildRequires: mysql-devel
BuildRequires: opencl-headers
BuildRequires: perl-ExtUtils-MakeMaker
BuildRequires: perl-macros
BuildRequires: pkgconfig
BuildRequires: python-numpy-devel
@ -62,6 +65,10 @@ BuildRequires: python3-numpy-devel
BuildRequires: python3-setuptools
BuildRequires: swig
BuildRequires: unixODBC-devel
BuildRequires: pkgconfig(OpenCL)
BuildRequires: pkgconfig(freexl)
BuildRequires: pkgconfig(json)
BuildRequires: pkgconfig(json-c)
BuildRequires: pkgconfig(expat) >= 1.95.0
BuildRequires: pkgconfig(libgeotiff) >= 1.2.1
BuildRequires: pkgconfig(libjpeg)
@ -70,8 +77,13 @@ BuildRequires: pkgconfig(libopenjp2)
BuildRequires: pkgconfig(libpng)
BuildRequires: pkgconfig(libpq)
BuildRequires: pkgconfig(libtiff-4) >= 3.6.0
BuildRequires: pkgconfig(libwebp)
BuildRequires: pkgconfig(libwebpdecoder)
BuildRequires: pkgconfig(libwebpdemux)
BuildRequires: pkgconfig(libwebpmux)
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(netcdf)
BuildRequires: pkgconfig(ocl-icd)
BuildRequires: pkgconfig(poppler)
BuildRequires: pkgconfig(proj)
BuildRequires: pkgconfig(spatialite)
@ -88,26 +100,6 @@ BuildRequires: ERDAS-ECW_JPEG_2000_SDK-devel
BuildRequires: libecwj2-devel
%endif
%endif
%if 0%{?suse_version} >= 1310
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: hdf5-devel
BuildRequires: pkgconfig(freexl)
BuildRequires: pkgconfig(libwebp)
BuildRequires: pkgconfig(libwebpdecoder)
BuildRequires: pkgconfig(libwebpdemux)
BuildRequires: pkgconfig(libwebpmux)
%endif
%if 0%{?suse_version} > 1320
BuildRequires: opencl-headers
BuildRequires: perl-ExtUtils-MakeMaker
BuildRequires: pkgconfig(OpenCL)
BuildRequires: pkgconfig(json)
BuildRequires: pkgconfig(json-c)
BuildRequires: pkgconfig(ocl-icd)
%else
BuildRequires: hdf-devel >= 4.0
%endif
%description
GDAL is a translator library for raster geospatial data formats that
@ -141,11 +133,7 @@ application for all supported formats.
Summary: Perl bindings for GDAL
Group: Development/Languages/Perl
Requires: %{name} = %{version}-%{release}
%if 0%{?suse_version} < 1140
Requires: perl = %{perl_version}
%else
%{perl_requires}
%endif
%description -n perl-%{name}
Perl bindings for GDAL - Geo::GDAL, Geo::OGR and Geo::OSR modules.
@ -262,16 +250,10 @@ autoreconf -fi
--with-proj5-api=no \
CPPFLAGS="$CPPFLAGS -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H" \
%endif
%if 0%{?suse_version} > 1320
--with-opencl \
%endif
%if 0%{?suse_version} > 1310
--without-hdf4 \
--with-hdf5 \
--with-webp \
%else
--with-hdf4 \
%endif
--disable-rpath
# regenerate where needed
@ -319,16 +301,6 @@ chrpath --delete %{buildroot}%{perl_vendorarch}/auto/Geo/GNM/GNM.so
chrpath --delete %{buildroot}%{perl_vendorarch}/auto/Geo/OGR/OGR.so
chrpath --delete %{buildroot}%{perl_vendorarch}/auto/Geo/OSR/OSR.so
%if 0%{?suse_version} <= 1315
# perl bs 0 length files cleanup
find %{buildroot}%{perl_vendorarch} -iname "*.bs" -exec rm -fv {} \;
# Those are deleted.
#%%{perl_vendorarch}/auto/Geo/OSR/OSR.bs
#%%{perl_vendorarch}/auto/Geo/OGR/OGR.bs
#%%{perl_vendorarch}/auto/Geo/GDAL/GDAL.bs
#%%{perl_vendorarch}/auto/Geo/GDAL/Const/Const.bs
%endif
# do not ship these
rm -rf %{buildroot}%{_mandir}/man1/_*
rm -rf %{buildroot}%{_libdir}/libgdal.la
@ -346,16 +318,13 @@ sed -i 's,\(#define PACKAGE_.*\),/* \1 */,' %{buildroot}%{_includedir}/gdal/cpl_
%postun -n lib%{name}%{soversion} -p /sbin/ldconfig
%files -n lib%{name}%{soversion}
%defattr(644,root,root,755)
%license LICENSE.TXT
%{_libdir}/*.so.%{soversion}.*
%{_libdir}/*.so.%{soversion}
%files
%defattr(644,root,root,755)
%license LICENSE.TXT
%doc NEWS PROVENANCE.TXT
%defattr(755,root,root,755)
%{_bindir}/epsg_tr.py
%{_bindir}/esri2wkt.py
%{_bindir}/gcps2vec.py
@ -405,7 +374,6 @@ sed -i 's,\(#define PACKAGE_.*\),/* \1 */,' %{buildroot}%{_includedir}/gdal/cpl_
%{_bindir}/pct2rgb.py
%{_bindir}/rgb2pct.py
%{_bindir}/testepsg
%defattr(644,root,root,755)
%{_datadir}/gdal
%{_mandir}/man1/gdal2tiles.1%{?ext_man}
%{_mandir}/man1/gdal_calc.1%{?ext_man}
@ -450,7 +418,6 @@ sed -i 's,\(#define PACKAGE_.*\),/* \1 */,' %{buildroot}%{_includedir}/gdal/cpl_
%files devel
%license LICENSE.TXT
%doc NEWS PROVENANCE.TXT
%defattr(644,root,root,755)
%doc html
%attr(755,root,root) %{_bindir}/gdal-config
%{_libdir}/libgdal.so
@ -483,13 +450,11 @@ sed -i 's,\(#define PACKAGE_.*\),/* \1 */,' %{buildroot}%{_includedir}/gdal/cpl_
%{_mandir}/man3/Geo::GDAL.3pm%{?ext_man}
%files -n python2-%{pypi_package_name}
%defattr(644,root,root,755)
%license LICENSE.TXT
%doc NEWS PROVENANCE.TXT
%{python_sitearch}/*
%files -n python3-%{pypi_package_name}
%defattr(644,root,root,755)
%license LICENSE.TXT
%doc NEWS PROVENANCE.TXT
%{python3_sitearch}/*