a628dc6
%{!?javabuild:%define	javabuild 1}
a628dc6
%{!?utils:%define	utils 1}
a628dc6
%{!?gcj_support:%define	gcj_support 1}
a628dc6
a628dc6
Summary:	Geographic Information Systems Extensions to PostgreSQL
a628dc6
Name:		postgis
7c4834e
Version:	1.2.1
5c2a481
Release:	2%{?dist}
a628dc6
License:	GPL
a628dc6
Group:		Applications/Databases
a628dc6
Source0:	http://postgis.refractions.net/download/%{name}-%{version}.tar.gz
a628dc6
Source4:	filter-requires-perl-Pg.sh
5c2a481
Patch1:		postgis-gnumakefile.patch
5c2a481
Patch2:		postgis-jdbcmakefile.patch
a628dc6
URL:		http://postgis.refractions.net/
a628dc6
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
a628dc6
a628dc6
BuildRequires:	postgresql-devel, proj-devel, geos-devel, byacc, proj-devel, flex, postgresql-jdbc
a628dc6
Requires:	postgresql, geos, proj
a628dc6
a628dc6
%description
a628dc6
PostGIS adds support for geographic objects to the PostgreSQL object-relational
a628dc6
database. In effect, PostGIS "spatially enables" the PostgreSQL server,
a628dc6
allowing it to be used as a backend spatial database for geographic information
a628dc6
systems (GIS), much like ESRI's SDE or Oracle's Spatial extension. PostGIS 
a628dc6
follows the OpenGIS "Simple Features Specification for SQL" and has been 
a628dc6
certified as compliant with the "Types and Functions" profile.
a628dc6
a628dc6
%if %javabuild
a628dc6
%package jdbc
a628dc6
Summary:	The JDBC driver for PostGIS
a628dc6
Group:		Applications/Databases
a628dc6
License:	LGPL
7c4834e
Requires:	%{name} = %{version}-%{release}, postgresql-jdbc
a628dc6
BuildRequires:  ant >= 0:1.6.2, junit >= 0:3.7
a628dc6
a628dc6
%if %{gcj_support}
a628dc6
BuildRequires:		gcc-java
a628dc6
Requires(post):		java-1.4.2-gcj-compat
a628dc6
Requires(postun):	java-1.4.2-gcj-compat
a628dc6
%endif
a628dc6
a628dc6
%description jdbc
a628dc6
The postgis-jdbc package provides the essential jdbc driver for PostGIS.
a628dc6
%endif
a628dc6
a628dc6
%if %utils
a628dc6
%package utils
a628dc6
Summary:	The utils for PostGIS
a628dc6
Group:		Applications/Databases
a628dc6
Requires:	%{name} = %{version}-%{release}, perl-DBD-Pg
a628dc6
a628dc6
%description utils
a628dc6
The postgis-utils package provides the utilities for PostGIS.
a628dc6
%endif
a628dc6
a628dc6
%define __perl_requires %{SOURCE4}
a628dc6
a628dc6
%prep
a628dc6
%setup -q
a628dc6
%patch1 -p0
5c2a481
# To be removed in 1.2.2
a628dc6
%patch2 -p0
a628dc6
a628dc6
%build
a628dc6
%configure 
a628dc6
make %{?_smp_mflags} LPATH=`pg_config --pkglibdir` shlib="%{name}.so"
a628dc6
a628dc6
%if %javabuild
a628dc6
export MAKEFILE_DIR=%{_builddir}/%{name}-%{version}/java/jdbc
ecf93b6
JDBC_VERSION_RPM=`rpm -ql postgresql-jdbc| grep 'jdbc2.jar$'|awk -F '/' '{print $5}'`
a628dc6
sed 's/postgresql.jar/'${JDBC_VERSION_RPM}'/g' $MAKEFILE_DIR/Makefile > $MAKEFILE_DIR/Makefile.new
a628dc6
mv -f $MAKEFILE_DIR/Makefile.new $MAKEFILE_DIR/Makefile
a628dc6
make -C java/jdbc
a628dc6
%endif
a628dc6
a628dc6
%if %utils
a628dc6
 make -C utils
a628dc6
%endif
a628dc6
a628dc6
%install
a628dc6
rm -rf %{buildroot}
a628dc6
make install DESTDIR=%{buildroot}
a628dc6
install -d %{buildroot}%{_libdir}/pgsql/
a628dc6
install lwgeom/liblwgeom.so* %{buildroot}%{_libdir}/pgsql/
ecf93b6
install lwgeom/postgis.so* %{buildroot}%{_libdir}/pgsql/
a628dc6
install -d  %{buildroot}%{_datadir}/pgsql/contrib/
a628dc6
install -m 644 *.sql %{buildroot}%{_datadir}/pgsql/contrib/
a628dc6
rm -f  %{buildroot}%{_libdir}/liblwgeom.so*
a628dc6
rm -f  %{buildroot}%{_datadir}/*.sql
a628dc6
a628dc6
%if %javabuild
a628dc6
install -d %{buildroot}%{_javadir}
a628dc6
install -m 755 java/jdbc/%{name}_%{version}.jar %{buildroot}%{_javadir}
a628dc6
%if %{gcj_support}
a628dc6
aot-compile-rpm
a628dc6
%endif
a628dc6
strip %{buildroot}/%{_libdir}/gcj/%{name}/*.jar.so
7c4834e
%endif
a628dc6
a628dc6
%if %utils
a628dc6
install -d %{buildroot}%{_datadir}/%{name}
a628dc6
install -m 644 utils/*.pl %{buildroot}%{_datadir}/%{name}
a628dc6
%endif
a628dc6
a628dc6
%clean
a628dc6
rm -rf %{buildroot}
a628dc6
7c4834e
%if %javabuild
7c4834e
%if %gcj_support
a628dc6
%post -p %{_bindir}/rebuild-gcj-db
a628dc6
%postun -p %{_bindir}/rebuild-gcj-db
7c4834e
%endif
7c4834e
%endif
a628dc6
a628dc6
%files
a628dc6
%defattr(-,root,root)
5c2a481
%doc COPYING CREDITS NEWS TODO README.%{name} doc/html loader/README.* doc/%{name}.xml  doc/ZMSgeoms.txt 
a628dc6
%attr(755,root,root) %{_bindir}/*
ecf93b6
%attr(755,root,root) %{_libdir}/pgsql/postgis.so*
a628dc6
%attr(755,root,root) %{_libdir}/pgsql/liblwgeom.so*
a628dc6
%{_datadir}/pgsql/contrib/*.sql
a628dc6
a628dc6
%if %javabuild
a628dc6
%files jdbc
a628dc6
%defattr(-,root,root)
a628dc6
%doc java/jdbc/COPYING_LGPL java/jdbc/README
a628dc6
%attr(755,root,root) %{_javadir}/%{name}_%{version}.jar
a628dc6
%if %{gcj_support}
a628dc6
%dir %{_libdir}/gcj/%{name}
a628dc6
%{_libdir}/gcj/%{name}/*.jar.so
a628dc6
%{_libdir}/gcj/%{name}/*.jar.db
a628dc6
%endif
a628dc6
%endif
a628dc6
a628dc6
%if %utils
a628dc6
%files utils
a628dc6
%defattr(-,root,root)
a628dc6
%doc utils/README
a628dc6
%attr(755,root,root) %{_datadir}/%{name}/test_estimation.pl
a628dc6
%attr(755,root,root) %{_datadir}/%{name}/profile_intersects.pl
a628dc6
%attr(755,root,root) %{_datadir}/%{name}/test_joinestimation.pl
a628dc6
%attr(644,root,root) %{_datadir}/%{name}/create_undef.pl
a628dc6
%attr(644,root,root) %{_datadir}/%{name}/%{name}_proc_upgrade.pl
a628dc6
%attr(644,root,root) %{_datadir}/%{name}/%{name}_restore.pl
a628dc6
%endif
a628dc6
a628dc6
%changelog
5c2a481
* Mon Jul 2 2007 - Devrim GUNDUZ <devrim@commandprompt.com> 1.2.1-2
c59502b
- Fix build problems (removed template_gis, per discussion with upstream).
5c2a481
7c4834e
* Mon Feb 19 2007 - Devrim GUNDUZ <devrim@commandprompt.com> 1.2.1-1
7c4834e
- Update to 1.2.1
7c4834e
- Removed configure patch (it is in the upstream now)
5c2a481
- Added postgresql-jdbc as as dependency to -jdbc package, per Guillaume
7c4834e
- move strip to correct place, per Guillaume
7c4834e
- Fix long-standing post/postun problem, per Guillaume
7c4834e
ecf93b6
* Wed Jan 3 2007 - Devrim GUNDUZ <devrim@commandprompt.com> 1.2.0-4
ecf93b6
- Added postgis.so among installed files, per Jon Burgess.
ecf93b6
- Fix jdbc jar dedection problem
ecf93b6
a628dc6
* Wed Dec 27 2006 - Devrim GUNDUZ <devrim@commandprompt.com> 1.2.0-3
a628dc6
- Fix Requires for subpackages per bugzilla review #220743
a628dc6
a628dc6
* Mon Dec 26 2006 - Devrim GUNDUZ <devrim@commandprompt.com> 1.2.0-2
a628dc6
- More spec file fixes per bugzilla review #220743
a628dc6
a628dc6
* Mon Dec 25 2006 - Devrim GUNDUZ <devrim@commandprompt.com> 1.2.0-1
a628dc6
- Initial submission for Fedora Core Extras
a628dc6
- Spec file changes and fixes per FC Extras packaging guidelines
a628dc6
a628dc6
* Fri Jun 23 2006 - Devrim GUNDUZ <devrim@commandprompt.com> 1.1.2-2
a628dc6
- Update to 1.1.2
a628dc6
a628dc6
* Tue Dec 22 2005 - Devrim GUNDUZ <devrim@commandprompt.com> 1.1.0-2
a628dc6
- Final fixes for 1.1.0
a628dc6
a628dc6
* Tue Dec 06 2005 - Devrim GUNDUZ <devrim@gunduz.org>
a628dc6
- Update to 1.1.0
a628dc6
a628dc6
* Mon Oct 03 2005 - Devrim GUNDUZ <devrim@gunduz.org>
a628dc6
- Make PostGIS build against pgxs so that we don't need PostgreSQL sources.
a628dc6
- Fixed all build errors except jdbc (so, defaulted to 0)
a628dc6
- Added new files under %%utils
a628dc6
- Removed postgis-jdbc2-makefile.patch (applied to -head)
a628dc6
                                                                                                    
a628dc6
* Tue Sep 27 2005 - Devrim GUNDUZ <devrim@gunduz.org>
a628dc6
- Update to 1.0.4
a628dc6
a628dc6
* Sun Apr 20 2005 - Devrim GUNDUZ <devrim@gunduz.org>
a628dc6
- 1.0.0 Gold
a628dc6
a628dc6
* Sun Apr 17 2005 - Devrim GUNDUZ <devrim@gunduz.org>
a628dc6
- Modified the spec file so that we can build JDBC2 RPMs...
a628dc6
- Added -utils RPM to package list.
a628dc6
a628dc6
* Fri Apr 15 2005 - Devrim GUNDUZ <devrim@gunduz.org>
a628dc6
- Added preun and postun scripts.
a628dc6
a628dc6
* Sat Apr 09 2005 - Devrim GUNDUZ <devrim@gunduz.org>
a628dc6
- Initial RPM build
a628dc6
- Fixed libdir so that PostgreSQL installations will not complain about it.
a628dc6
- Enabled --with-geos and modified the old spec.