#
# Copyright (C) 2004 - 2007 Bojan Smojver, Rexursive
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 2.1 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
# for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see .
#
# Distro release from LSB
%define rcode %(lsb_release -si | tr -cd '[:upper:]')
%define rvers %(lsb_release -sr | cut -f 1 -d '.')
%define dvers %(test -n "%{rcode}%{rvers}" && echo ".%{rcode}%{rvers}" || echo)
# Use %{?dist} if defined, otherwise LSB
%define distro %(test -n "%{?dist}" && echo "%{?dist}" || echo "%{dvers}")
# APR/APU configuration
%define aprconfig %(/usr/sbin/apxs -q APR_CONFIG)
%define apuconfig %(/usr/sbin/apxs -q APU_CONFIG)
# APR version
%define apuver %(%{apuconfig} --version)
Name: @PACKAGE@
Version: @VERSION@
Release: 1%{distro}
Summary: The mod_spin Apache module
Group: System Environment/Daemons
License: LGPLv2+
URL: http://www.rexursive.com/software/modspin/
Source: ftp://ftp.rexursive.com/pub/mod-spin/%{name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: httpd >= 2.2.0
Requires: %{name}-libs = %{version}-%{release}
BuildRequires: httpd-devel >= 2.2.0, apr-util-devel >= 1.2.8, apr-api-docs
BuildRequires: libapreq2-devel >= 2.07
%if "%{apuver}" < "1.3.0"
BuildRequires: sqlite-devel, mysql-devel, postgresql-devel
%endif
BuildRequires: libxml2-devel, automake
BuildRequires: doxygen, tetex-latex
Requires: httpd-mmn = %(cat %{_includedir}/httpd/.mmn || echo missing)
%define _libexecdir %(/usr/sbin/apxs -q LIBEXECDIR)
%define _aclocaldir %(aclocal --print-ac-dir)
%description
mod_spin is an Apache module that provides (in conjunction with some other
modules) a simple template language with data replacement capabilities only,
persistent application and session data tracking, dynamic linking of
applications into Apache as shared libraries, parameters, cookies and
multipart/form data parsing via libapreq2, simple API for (kind of) MVC
controller functionality and simple API for pooled (or not) access to SQL
databases via APR DBD.
%package libs
Summary: Libraries for mod_spin Apache module
Group: System Environment/Libraries
Requires: apr-util >= 1.2.8, libapreq2 >= 2.07
%description libs
Libraries for mod_spin Apache module.
%package devel
Summary: Development files for mod_spin Apache module
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}, httpd-devel >= 2.2.0, pkgconfig
Requires: libapreq2-devel >= 2.06, mysql-devel, postgresql-devel, libxml2-devel
Requires: apr-api-docs
%description devel
Libraries, headers, scripts and documentation required to develop applications
based on mod_spin Apache module.
%prep
%setup -q -n %{name}-%{version}
%build
%configure --disable-static --enable-packager
make %{?_smp_mflags}
%install
rm -rf ${RPM_BUILD_ROOT}
make DESTDIR=${RPM_BUILD_ROOT} install
# remove unneeded stuff
rm -rf ${RPM_BUILD_ROOT}%{_libdir}/debug
rm -f ${RPM_BUILD_ROOT}%{_libexecdir}/mod_spin.a
rm -f ${RPM_BUILD_ROOT}%{_libexecdir}/mod_spin.la
# module configuration, Fedora style
mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/httpd/conf.d
install -m 644 spin.conf ${RPM_BUILD_ROOT}%{_sysconfdir}/httpd/conf.d
# extra documentation and examples
install -m 644 tests/comprehensive.sm ${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}
install -m 644 tests/create-spintest.sql ${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}
install -m 644 create-store.sql ${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}
install -m 644 create-store-mysql.sql ${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}
# Default location for documentation is on the Net
aprdocsurl="http://apr.apache.org/docs/apr/`%{aprconfig} --version | cut -f -2 -d '.'`"
apudocsurl="http://apr.apache.org/docs/apr-util/`%{apuconfig} --version | cut -f -2 -d '.'`"
apreq2docsurl="http://httpd.apache.org/apreq/docs/libapreq2"
# Find local location of APR/APU documentation
p=apr-api-docs
rpm --quiet -q $p
if [ $? -eq 0 ]; then
d="/usr/share/doc/apr-`rpm -q --queryformat '%%{VERSION}' $p`/api-docs"
if [ -d "$d" ]; then
aprdocsurl="$d"
apudocsurl="$d"
fi
fi
# Find local location of libapreq2 documentation
p=libapreq2-devel
rpm --quiet -q $p
if [ $? -eq 0 ]; then
d="/usr/share/doc/`rpm -q --queryformat '%%{NAME}-%%{VERSION}' $p`"
if [ -d "$d" ]; then
apreq2docsurl="$d"
fi
fi
# Fix up doxygen documentation with local paths
cd ${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}/html
./installdox -q -l apr.tag@$aprdocsurl \
-l apu.tag@$apudocsurl \
-l apreq2.tag@$apreq2docsurl
# Whack installdox, we don't have to distribute it
rm -f ${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}/html/installdox
%clean
rm -rf ${RPM_BUILD_ROOT}
%post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
%files
%defattr(-,root,root,-)
%{_libexecdir}/*
%doc %{_docdir}/%{name}-%{version}/*.sm
%doc %{_docdir}/%{name}-%{version}/*.sql
%config(noreplace) %{_sysconfdir}/httpd/conf.d/*.conf
%files libs
%defattr(-,root,root,-)
%{_libdir}/librxv_spin.so.*
%doc %dir %{_docdir}/%{name}-%{version}
%doc %{_docdir}/%{name}-%{version}/[A-Z]*
%files devel
%defattr(-,root,root,-)
%{_includedir}/*
%{_bindir}/*
%{_mandir}/man3/*
%{_libdir}/librxv_spin.la
%{_libdir}/librxv_spin.so
%{_libdir}/pkgconfig/*
%{_aclocaldir}/*
%doc %{_docdir}/%{name}-%{version}/mod_spin.*
%doc %{_docdir}/%{name}-%{version}/html
%changelog
* Fri Sep 28 2007 Bojan Smojver
- move fixup of Doxygen docs to install stage
* Fri Jun 29 2007 Bojan Smojver
- split up -libs subpackage
- add package config
* Mon Jun 25 2007 Bojan Smojver
- drop PostgreSQL and MySQL options to configure, no longer required
* Tue Mar 13 2007 Bojan Smojver
- ship development libraries with -devel package
- execute ldconfig post install/uninstall
- use restorecon to bring back SELinux contexts
* Thu Feb 15 2007 Bojan Smojver
- add create-store-mysql.sql
* Tue Aug 22 2006 Bojan Smojver
- add apr-util and apr-util-devel >= 1.2.8 to dependencies
* Tue Jun 27 2006 Bojan Smojver
- update dependencies to httpd >= 2.2.0
* Mon Jan 23 2006 Bojan Smojver
- add sqlite-devel dependency
* Tue Nov 29 2005 Bojan Smojver
- remove PostgreSQL, MySQL and libxml2 dependencies, will be picked up by rpm
- use %{?dist} if present
- include examples and tests
* Tue Nov 22 2005 Bojan Smojver
- remove flex and bison dependencies, not really needed, as we ship C files
- improve extended release numbering
* Thu Oct 27 2005 Bojan Smojver
- improve SELinux file relabeling
- move docs directory from devel to regular package
* Mon Aug 01 2005 Bojan Smojver
- update the requirements to libapreq2 >= 2.06
- add tetex-latex to build dependencies
- make it more Fedora Extras compliant
- split up the devel package
* Wed Mar 02 2005 Bojan Smojver
- use configure to process the file for PACKAGE and VERSION
- drop redefinition of _datadir
- do explicit make install with DESTDIR
- do versioning with lsb_release
- do explicit chcon
* Fri Jan 28 2005 Bojan Smojver
- bump up to 1.0.8
* Wed Jan 19 2005 Bojan Smojver
- bump up to 1.0.7
- ignore verification of doc files, these can be modified post installation
- restore security contexts, if SELinux present
* Wed Jan 05 2005 Bojan Smojver
- bump up to 1.0.6
* Wed Nov 03 2004 Bojan Smojver
- bump up to 1.0.5
- depend on libapreq2 2.04_dev-4.03
* Tue Oct 12 2004 Bojan Smojver
- bump up to 1.0.4
- include version of FC into the release
* Thu Sep 23 2004 Bojan Smojver
- bump up to 1.0.3
- fix bogus installdox logic
* Tue Aug 24 2004 Bojan Smojver
- bump up to 1.0.2
- put back flex, bison and doxygen as build requirements (duh!)
* Mon Aug 09 2004 Bojan Smojver
- bump up to 1.0.1
- remove flex, bison and doxygen from build requirements
- require Apache at or above 2.0.50
- make sure docs dir gets removed
* Mon Jun 21 2004 Bojan Smojver
- bump up to 1.0.0
- link Doxygen documentation locally if possible
- require doxygen for building
* Thu Jun 11 2004 Bojan Smojver
- bump up to 0.9.13
- require new libapreq2-2.03_04 or better
- include rxv_spin-config script
* Thu Jun 10 2004 Bojan Smojver
- bump up to 0.9.12
- split mod_spin and librxv_spin
- libdir to libexecdir
* Thu May 28 2004 Bojan Smojver
- bump up to 0.9.11
* Thu May 27 2004 Bojan Smojver
- bump up to 0.9.10
* Mon May 24 2004 Bojan Smojver
- bump up to 0.9.9
* Mon May 17 2004 Bojan Smojver
- bump up to 0.9.8
* Thu Apr 15 2004 Bojan Smojver
- bump up to 0.9.7
- fix mod_spin URL
* Thu Apr 08 2004 Bojan Smojver
- bump up to 0.9.6
* Sat Apr 03 2004 Bojan Smojver
- bump up to 0.9.5
- require libapreq2
* Thu Apr 01 2004 Bojan Smojver
- bump up to 0.9.4
* Tue Mar 09 2004 Bojan Smojver
- initial RPM spec for mod_spin 0.9.3