%global python_sitelib %(%{__python} -c 'from distutils import sysconfig; print sysconfig.get_python_lib()')
%global python_sitearch %(%{__python} -c 'from distutils import sysconfig; print sysconfig.get_python_lib(1)')
%global php_zendabiver %((echo 0; php -i 2>/dev/null | sed -n 's/^PHP Extension => //p') | tail -1)
%global php_extdir %(php-config --extension-dir 2>/dev/null || echo "undefined")
Summary: Persistent SQL database connection library and daemon
Name: squale
Version: 0.1.12
Release: 1%{?dist}
License: GPLv2+
Group: System Environment/Daemons
URL: http://sourceforge.net/projects/squale/
Source0: http://downloads.sf.net/squale/squale-%{version}.tar.gz
Source1: squale_check.py
Patch0: squale-0.1.10-defaultoff.patch
Patch1: squale-0.1.10-sockpath.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
Requires(pre): /usr/sbin/useradd
Requires(post): /sbin/ldconfig, /sbin/chkconfig
Requires(preun): /sbin/chkconfig, /sbin/service
Requires(postun): /sbin/ldconfig, /sbin/service
# Version this one since lib requirements can be met but problems will arise
# at runtime and make squale crash
Requires: glib2 >= 2.2.0
BuildRequires: glib2-devel >= 2.2.0
BuildRequires: libxml2-devel
BuildRequires: pkgconfig
BuildRequires: gettext
BuildRequires: perl(XML::Parser)
BuildRequires: popt-devel
%{?_with_oracle:BuildRequires: libsqlora8-devel >= 2.3.1}
%{!?_without_mysql:BuildRequires: mysql-devel}
%{!?_without_postgresql:BuildRequires: postgresql-devel}
%description
SQuaLe, persistent SQL database connection library and daemon.
Available rpmbuild rebuild options :
--with : oracle
--without : mysql postgresql python php
%package devel
Summary: Development headers and library for SQuaLe
Group: Development/Libraries
Requires: %{name} = %{version}
Requires: glib2-devel
Requires: libxml2-devel
Requires: pkgconfig
%description devel
Development headers and library for SQuaLe.
%package -n python-squale
Summary: Python bindings for SQuaLe
Group: Development/Languages
Requires: %{name} = %{version}
%{!?_without_python:BuildRequires: Pyrex, python-devel}
%description -n python-squale
Python module which provides bindings to the SQuaLe persistent SQL database
connection library.
%package -n php-squale
Summary: Module for PHP applications that use SQuaLe
Group: Development/Languages
Requires: %{name} = %{version}
Requires: php(zend-abi) = %{php_zendabiver}
%{!?_without_php:BuildRequires: php-devel}
# Required by phpize
%{!?_without_php:BuildRequires: automake, autoconf, libtool}
# Required to remove the wrong RPATH
#{!?_without_php:BuildRequires: chrpath}
%description -n php-squale
PHP module which provides bindings to the SQuaLe persistent SQL database
connection library.
%prep
%setup -q
%patch0 -p1 -b .defaultoff
%patch1 -p1 -b .sockpath
%build
%configure --disable-static
%{__make} %{?_smp_mflags}
# Build the PHP module
%if %{!?_without_php:1}0
pushd contrib/php
test -x configure || phpize
# Hacks to detect the lib from the squale we just built
%{__ln_s} -f ../../lib include
export LDFLAGS="-L../../lib/.libs"
%configure --with-squale=.
%{__make} %{?_smp_mflags}
# Remove RPATH, otherwide the path from LDFLAGS above will be in the module
# FIXME!
#chrpath --delete .libs/squale.so
popd
%endif
%install
%{__rm} -rf %{buildroot}
%{__make} install \
DESTDIR=%{buildroot} \
INSTALL_ROOT=%{buildroot}
%find_lang %{name}
# Change the default log file
%{__perl} -pi -e 's|"/.*log"|"%{_var}/log/squale/squale.log"|g' \
%{buildroot}%{_sysconfdir}/squale.xml
%{__mkdir_p} %{buildroot}%{_var}/log/squale
# Create directory for the default listening socket
%{__mkdir_p} %{buildroot}%{_var}/run/squale
# Install the init script
%{__install} -D -p -m 0755 contrib/squale.init \
%{buildroot}/etc/rc.d/init.d/squale
# Install the logrotate entry
%{__install} -D -p -m 0644 contrib/squale.logrotate \
%{buildroot}%{_sysconfdir}/logrotate.d/squale
# Install the monitoring check script
%{__install} -D -p -m 0755 %{SOURCE1} \
%{buildroot}%{_bindir}/squale_check
# Install the PHP module
%if %{!?_without_php:1}0
%{__mkdir_p} %{buildroot}%{_sysconfdir}/php.d
%{__cat} > %{buildroot}%{_sysconfdir}/php.d/squale.ini << 'EOF'
; Enable squale extension module
extension=squale.so
EOF
%endif
%clean
%{__rm} -rf %{buildroot}
%pre
# Create system account
/usr/sbin/useradd -c "SQuaLe" -r -M -d / -s '' squale &>/dev/null || :
%post
/sbin/ldconfig
/sbin/chkconfig --add squale
%preun
if [ $1 -eq 0 ]; then
# Last removal, stop service and remove it
/sbin/service squale stop &>/dev/null || :
/sbin/chkconfig --del squale
fi
%postun
/sbin/ldconfig
if [ $1 -ge 1 ]; then
/sbin/service squale condrestart &>/dev/null || :
fi
%files -f %{name}.lang
%defattr(-,root,root,-)
%doc AUTHORS COPYING ChangeLog README TODO
%doc conf/squale.xml
# This file contains cleartext passwords, we don't want it to be world readable
%attr(0640,root,squale) %config(noreplace) %{_sysconfdir}/squale.xml
%config(noreplace) %{_sysconfdir}/logrotate.d/squale
/etc/rc.d/init.d/squale
%{_bindir}/*
%{_libdir}/*.so.*
%{_mandir}/man?/*
# This directory might contain database queries in files, so keep everyone out
%attr(0770,root,squale) %{_var}/log/squale/
# This directory will have the mode 0660 squale:squale socket
%attr(0770,root,squale) %{_var}/run/squale/
%files devel
%defattr(-,root,root,-)
%{_includedir}/squaleclient.h
%exclude %{_libdir}/*.la
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%if %{!?_without_python:1}0
%files -n python-squale
%defattr(-,root,root,-)
%exclude %{python_sitearch}/squale.la
%{python_sitearch}/squale.so
%{python_sitelib}/SQuaLe.py*
%endif
%if %{!?_without_php:1}0
%files -n php-squale
%defattr(-,root,root,-)
%doc contrib/php/squale.php
%config(noreplace) %{_sysconfdir}/php.d/squale.ini
%{php_extdir}/squale.so
%endif
%changelog
* Fri Feb 27 2009 Matthias Saou 0.1.12-1
- Update to 0.1.12.
* Tue Sep 30 2008 Matthias Saou 0.1.11-1
- Update to 0.1.11.
* Mon Jun 18 2007 Matthias Saou 0.1.10-0.6
- Add patch to change default socket path from /tmp to /var/run/squale.
- Update popt build requirement ro popt-devel.
- Update license field to GPLv2+.
* Mon Jun 18 2007 Matthias Saou 0.1.10-0.5
- Merge PHP module back into the main package, both change very little now.
- Don't remove user/group upon uninstall.
- Include patch to default service to off.
- Try to remove rpath from the PHP module... no luck (yet).
* Mon May 21 2007 Matthias Saou 0.1.10-0.4
- Rebuild against latest libsqlora8 and oracle-instantclient packages.
* Wed Oct 4 2006 Matthias Saou 0.1.10-0.3
- Update to 0.1.10 pre-version.
* Tue Sep 26 2006 Matthias Saou 0.1.9-1
- Update to 0.1.9.
- Add new SQuaLe.py* files to the python sub-package.
* Tue Mar 14 2006 Matthias Saou 0.1.6-1
- Update to 0.1.6 final.
* Mon Jan 23 2006 Matthias Saou 0.1.6-0
- Update to 0.1.6 pre-release (fix for client timeouts).
* Mon Nov 14 2005 Matthias Saou 0.1.5-2
- Split off the python bindings.
- Remove redundant CFLAGS export.
- Minor spec file cleanups.
* Thu Jun 23 2005 Matthias Saou 0.1.5-1
- Update to 0.1.5.
* Fri Apr 15 2005 Matthias Saou 0.1.4-2
- Remove -fPIC forcing, as tests show it now works as expected (the shared lib
is built with -fPIC, the rest isn't).
* Thu Apr 14 2005 Matthias Saou 0.1.4-1
- Update to 0.1.4 (fixes NLS_LANG problem & reconnection problems).
* Tue Apr 12 2005 Matthias Saou 0.1.3-2
- Added glib2-devel to devel package requirements.
- Build with -fPIC to fix x86_64 build.
* Wed Jan 12 2005 Matthias Saou 0.1.3-1
- Update to 0.1.3.
* Tue Jan 4 2005 Matthias Saou 0.1.2-1
- Update to 0.1.2.
* Tue Nov 30 2004 Matthias Saou 0.1.1-1
- Changed python to be conditional, and disable on rh7.
* Thu Nov 25 2004 Matthias Saou 0.1.1-1
- Update to 0.1.1.
* Fri Nov 19 2004 Matthias Saou 0.1.0-1
- Update to 0.1.0.
* Thu Nov 4 2004 Matthias Saou 0.0.9-1
- Update to 0.0.9.
- Included python bindings.
* Fri Oct 29 2004 Matthias Saou 0.0.8-1
- Update to 0.0.8.
* Thu Oct 14 2004 Matthias Saou 0.0.7-1
- Update to 0.0.7.
* Fri Oct 1 2004 Matthias Saou 0.0.6-1
- Update to 0.0.6.
* Tue Sep 28 2004 Matthias Saou 0.0.5-1
- Update to 0.0.5.
* Thu Sep 2 2004 Matthias Saou 0.0.4-5
- Recompile against Oracle 9i libs (was 8i previously).
* Thu May 27 2004 Matthias Saou 0.0.4-2
- Decided to finally include the monitoring check in the package directly.
* Tue May 18 2004 Matthias Saou 0.0.4-1
- Update to 0.0.4.
* Tue Apr 27 2004 Matthias Saou 0.0.2-1
- Update to 0.0.2.
* Fri Mar 26 2004 Matthias Saou 0.0.1-1
- Initial RPM release.