Subject: Packaging PostGIS for F23 / PG95

From: Oskari Saarenmaa <[email-masked]>
Date: Thu, 26 Nov 2015 10:24:55 +0200

Hi,

I noticed PostGIS wasn't available for F23 / PG95 in yum.postgresql.org 
and looked into the issues.  Apparently SFCGAL 1.2.0 didn't build on F23 
due to a change in CGAL, upstream fixed this in release 1.2.2 so I just 
downloaded the latest tag from github and updated the spec to match, 
attached.

After fixing that I ran into issues building PostGIS on F23 wrt linking 
to GDAL.  That required adding a -fPIC flag to configure when linking 
with GDAL as well as removing the LD_LIBRARY_PATH setting in .spec. 
Attached patches for .spec and for PostGIS's configure.

Cheers,
Oskari
--- 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 <[email-masked]> 2.2.0-2.aiven1
+- use -fPIC with gdal
+
 * Fri Oct 30 2015 Devrim GÜNDÜZ <[email-masked]> - 2.2.0-2
 - Build with SFCGAL support.
 
--- configure	2015-10-07 21:39:56.000000000 +0300
+++ configure	2015-11-19 11:44:15.402542910 +0200
@@ -17119,7 +17119,7 @@
 				LIBGDAL_CFLAGS=`$GDAL_CONFIG --cflags`
 
 		CPPFLAGS_SAVE="$CPPFLAGS"
-		CPPFLAGS="$LIBGDAL_CFLAGS"
+		CPPFLAGS="$LIBGDAL_CFLAGS -fPIC"
 		CFLAGS_SAVE="$CFLAGS"
 		CFLAGS=""
 		LIBS_SAVE="$LIBS"
--- sfcgal.spec	2015-11-03 21:48:57.000000000 +0200
+++ sfcgal.spec	2015-11-19 11:26:41.600141480 +0200
@@ -1,10 +1,10 @@
 Summary:	C++ wrapper library around CGAL for PostGIS
 Name:		SFCGAL
-Version:	1.2.0
+Version:	1.2.2
 Release:	1%{?dist}
 License:	GLPLv2
 Group:		System Environment/Libraries
-Source:		https://github.com/Oslandia/%{name}/archive/v%{version}.tar.gz
+Source:		https://github.com/Oslandia/%{name}/archive/%{name}-%{version}.zip
 URL:		http://sfcgal.org/
 BuildRequires:	cmake, CGAL-devel
 BuildRequires:	boost-thread, boost-system, boost-date-time, boost-serialization
@@ -67,5 +67,8 @@
 /usr/lib/libSFCGAL.la
 
 %changelog
+* Thu Nov 19 2015 Oskari Saarenmaa <[email-masked]> 1.2.2-1
+- Upgrade to 1.2.2 to support newer CGAL versions
+
 * Fri Oct 30 2015 Devrim GUNDUZ <[email-masked]> 1.2.0-1
 - Initial build for PostgreSQL YUM Repository.

-- 
Sent via pgsql-pkg-yum mailing list ([email-masked])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-pkg-yum

---

From: Devrim GÜNDÜZ <[email-masked]>
Date: Fri, 27 Nov 2015 18:49:46 +0200

Hi,

Thanks for the patch! I applied these, and I'm working on the builds
right now.

Regards, Devrim

-- 
Devrim GÜNDÜZ
Principal Systems Engineer @ EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR