--- postgis22.spec	2015-11-03 21:48:55.000000000 +0200
+++ postgis22.spec	2015-11-19 11:52:27.506554156 +0200
@@ -10,13 +10,14 @@
 Summary:	Geographic Information Systems Extensions to PostgreSQL
 Name:		%{sname}2_%{pgmajorversion}
 Version:	2.2.0
-Release:	2%{?dist}
+Release:	2.aiven1%{?dist}
 License:	GPLv2+
 Group:		Applications/Databases
 Source0:	http://download.osgeo.org/%{sname}/source/%{sname}-%{version}.tar.gz
 Source1:	http://download.osgeo.org/%{sname}/source/%{sname}-%{postgisprevversion}.tar.gz
 Source2:	http://download.osgeo.org/%{sname}/docs/%{sname}-%{version}.pdf
 Source4:	filter-requires-perl-Pg.sh
+Patch1:		postgis-2.2.0-gdalfpic.patch
 
 URL:		http://www.postgis.net/
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -87,9 +88,9 @@
 # Copy .pdf file to top directory before installing.
 cp -p %{SOURCE2} .
 
+%patch1 -p0
+
 %build
-# We need the below for GDAL:
-export LD_LIBRARY_PATH=%{pginstdir}/lib
 
 %configure --with-pgconfig=%{pginstdir}/bin/pg_config \
 %if !%raster
@@ -146,7 +148,7 @@
 %files
 %defattr(-,root,root)
 %doc COPYING CREDITS NEWS TODO README.%{sname} doc/html loader/README.* doc/%{sname}.xml doc/ZMSgeoms.txt
-%{_docdir}/pgsql/extension/README.address_standardizer
+%{pginstdir}/doc/extension/README.address_standardizer
 %{pginstdir}/share/contrib/%{sname}-%{postgismajorversion}/postgis.sql
 %{pginstdir}/share/contrib/%{sname}-%{postgismajorversion}/postgis_comments.sql
 %{pginstdir}/share/contrib/%{sname}-%{postgismajorversion}/postgis_upgrade*.sql
@@ -202,6 +204,9 @@
 %doc %{sname}-%{version}.pdf
 
 %changelog
+* Thu Nov 19 2015 Oskari Saarenmaa <os@ohmu.fi> 2.2.0-2.aiven1
+- use -fPIC with gdal
+
 * Fri Oct 30 2015 Devrim GÜNDÜZ <devrim@gunduz.org> - 2.2.0-2
 - Build with SFCGAL support.
 
