#New ADVX macros %define ADVXdir %{_datadir}/ADVX %{expand:%(cat %{ADVXdir}/ADVX-build)} %{expand:%%define apache_version %(rpm -q apache-devel|sed 's/apache-devel-\([0-9].*\)-.*$/\1/')} %{expand:%%define apache_release %(rpm -q apache-devel|sed 's/apache-devel-[0-9].*-\(.*\)$/\1/')} %{expand:%%define mm_major %(mm-config --version|sed 's/MM \([0-9]\)\.\([0-9.].*\) \(.*\)$/\1/')} %{expand:%%define mm_minor %(mm-config --version|sed 's/MM \([0-9]\)\.\([0-9.].*\) \(.*\)$/\2/')} %define mm_version %{mm_major}.%{mm_minor} %define name mod_log_mysql %define version 1.15 %define release 8mdk %define mysql_version 4.0.10 Summary: Logs to MySQL Name: %{name} Version: %{version} Release: %{release} Group: System/Servers Source0: %{name}-%{version}.tar.bz2 Source1: %{name}.conf Source2: directives.html License: Apache License Url: http://www.grubbybaby.com/%{name}/ Prereq: apache = %{apache_version} Prereq: apache-common >= %{apache_version} Prereq: apache-conf >= %{apache_version} Prereq: mm = %{mm_major}.%{mm_minor} Requires: libmysql12 >= %{mysql_version} Requires: MySQL-client >= %{mysql_version} Requires: MySQL >= %{mysql_version} BuildRequires: ADVX-build >= 1.2 BuildRequires: libmysql12-devel >= %{mysql_version} BuildRequires: apache-devel Provides: ADVXpackage Provides: AP13package BuildRoot: %{_tmppath}/%{name}-root %description mod_log_mysql offers Apache administrators the ability to log accesses to a MySQL database. This capability can replace or coexist with Apache's regular text-file logging mechanisms. mod_log_mysql is production-ready and is known to work with high volume webservers and webserver clusters supporting over 100,000 hits per day. %prep %setup -q -n %{name} %build CFLAGS="%{optflags} -fpic -DWANT_SSL_LOGGING" %{_sbindir}/apxs -I%{_includedir} \ -L%{_libdir} -I%{_includedir}/ssl -I%{_includedir}/db1 -lmysqlclient \ -DMYSQLSOCKET='\"/var/lib/mysql/mysql.sock\"' \ -lmysqlclient_r -lz -c mod_log_mysql.c %install [ "%{buildroot}" != "/" ] && rm -rf %{buildroot} mkdir -p %{buildroot}%{_libdir}/apache-extramodules install -m 755 mod_log_mysql.so %{buildroot}%{_libdir}/apache-extramodules/ mkdir -p %{buildroot}%{ap_webdoc} mkdir -p %{buildroot}%{ap_base}/conf cp %{SOURCE1} %{buildroot}%{ap_base}/conf/ cp %{SOURCE2} %{buildroot}%{ap_webdoc}/mod_log_mysql.html %pre #Check config file sanity %AP13pre %post if [ $1 = "1" ]; then #We're in Install mode, add module to the config files for config in %{ap_base}/conf/{httpd,httpd-perl}.conf; do if [ -x %{_sbindir}/advxaddmod -a -e $config ]; then %{_sbindir}/advxaddmod $config \ extramodules/mod_log_mysql.so mod_log_mysql.c log_mysql_module \ define=HAVE_LOGMYSQL addconf=conf/mod_log_mysql.conf fi done %ADVXpost fi if [ $1 -gt 1 ]; then #We're in *upgrade mode*. Since we can't be sure the configuration files #are sane, remove module from the conf files to clean them, re-add again #in a way that the older module we're replacing won't try to erase (the #post scripts were broken on some packages), and finally clean the module #specific config file so it's compatible with the upgrade. for config in %{ap_base}/conf/{httpd,httpd-perl}.conf; do if [ -x %{_sbindir}/advxdelmod -a -e $config ]; then %{_sbindir}/advxdelmod $config \ extramodules/mod_log_mysql.so mod_log_mysql.c log_mysql_module \ define=HAVE_LOGMYSQL addconf=conf/mod_log_mysql.conf $config fi if [ -x %{_sbindir}/advxaddmod -a -e $config ]; then %{_sbindir}/advxaddmod $config \ extramodules/mod_log_mysql.so mod_log_mysql.c log_mysql_module \ define=HAVE_LOGMYSQL addconf=conf/mod_log_mysql.conf fi done %ADVXpost fi %postun if [ $1 = "0" ]; then for config in %{ap_base}/conf/{httpd,httpd-perl}.conf; do if [ -x %{_sbindir}/advxdelmod -a -e $config ]; then %{_sbindir}/advxdelmod $config \ extramodules/mod_log_mysql.so mod_log_mysql.c log_mysql_module \ define=HAVE_LOGMYSQL addconf=conf/mod_log_mysql.conf fi done %ADVXpost fi %clean [ "%{buildroot}" != "/" ] && rm -rf %{buildroot} %files %defattr(-,root,root) %doc CHANGELOG CONFIGURATION INSTALL README %doc access_log.sql make_combined_log.pl %config(noreplace) %{ap_base}/conf/mod_log_mysql.conf %{_libdir}/apache-extramodules/mod_log_mysql.so %{ap_webdoc}/* %changelog * Sun Nov 09 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.15-8mdk - built for apache 1.3.29 * Tue Sep 16 2003 Jean-Michel Dault <jmdault@mandrakesoft.com> 1.15-7mdk - rebuild with apache 1.3.28 * Thu Feb 13 2003 Jean-Michel Dault <jmdault@mandrakesoft.com> 1.15-6mdk - Link with MySQL 4.0.10 - new macros from ADVX-build * Sat Jan 18 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.15-5mdk - rebuilt against rebuilt buildrequires - follow spec file design as in main - added missing mod_log_mysql.html file * Fri Nov 8 2002 Jean-Michel Dault <jmdault@mandrakesoft.com> 1.15-4mdk - Rebuild for Cooker * Mon Oct 28 2002 Jean-Michel Dault <jmdault@mandrakesoft.com> 1.15-3mdk - Rebuild with new apache * Wed Jun 26 2002 Christian Belisle <cbelisle@mandrakesoft.com> 1.15-2mdk - Apache 1.3.26. - MySQL 3.23.51. * Mon Apr 15 2002 Christian Belisle <cbelisle@mandrakesoft.com> 1.15-1mdk - New version (1.15). - Apache 1.3.24. - MySQL 3.23.49. * Fri Apr 5 2002 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.14-1mdk - new version - spec file fix * Mon Feb 04 2002 Christian Belisle <cbelisle@mandrakesoft.com> 1.12-2mdk - Rebuild against latest apache. * Mon Dec 17 2001 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.12-1mdk - update to 1.12 - fix requires * Mon Dec 3 2001 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.11-1mdk - initial cooker contrib. - used the mod_gzip spec file as template.