Sophie

Sophie

distrib > Mandriva > 9.0 > i586 > media > contrib-src > by-pkgid > a11563efe3c7235718579523d94ee1a4 > files > 4

mod_log_mysql-1.15-2mdk.src.rpm

%define name		mod_log_mysql
%define version		1.15
%define release		2mdk
%define apache_version	1.3.26
%define mysql_version	3.23.51
%define apachecontent	/var/www/html
%define apachebase	%{_sysconfdir}/httpd
%define apacheroot	/var/www

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}/
Requires:		apache = %{apache_version}
Requires:		apache-common = %{apache_version}
Requires:		apache-conf = %{apache_version}
Requires:		libmysql10 >= %{mysql_version}
Requires:		MySQL-client >= %{mysql_version}
Requires:		MySQL >= %{mysql_version}
BuildRequires:		apache = %{apache_version}
BuildRequires:		apache-devel = %{apache_version}
BuildRequires:		libmysql10-devel >= %{mysql_version}
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
rm -rf %{buildroot}

%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
mkdir -p %{buildroot}%{_libdir}/apache-extramodules
install -m 755 mod_log_mysql.so %{buildroot}%{_libdir}/apache-extramodules/
mkdir -p %{buildroot}%{apachecontent}/addon-modules

mkdir -p %{buildroot}%{apachebase}/conf
cp %{SOURCE1} %{buildroot}%{apachebase}/conf/

cp %{SOURCE2} %{buildroot}%{apachecontent}/addon-modules/mod_log_mysql.html

%post
if [ $1 = "1" ]; then 
   #We're in Install mode, add module to the config files
   for config in %{apachebase}/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
   if [ -x %{_sbindir}/AESctl ]; then %{_sbindir}/AESctl update;fi 
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 %{apachebase}/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
   if [ -x %{_sbindir}/AESctl ]; then %{_sbindir}/AESctl update; fi
fi

%postun
if [ $1 = "0" ]; then 
   for config in %{apachebase}/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
   if [ -x %{_sbindir}/AESctl ]; then %{_sbindir}/AESctl update;fi 
fi

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc CHANGELOG CONFIGURATION INSTALL README
%doc access_log.sql make_combined_log.pl
%config(noreplace) %{apachebase}/conf/mod_log_mysql.conf
%{_libdir}/apache-extramodules/mod_log_mysql.so

%changelog
* 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.