1 %bcond_without ipv6 # disable IPv6 support
3 # Replace MODNAME with real module name.
4 # Replace VERSION with version since what confdir support was introduced for the module.
6 %define mod_name MODNAME
7 %define apxs %{_sbindir}/apxs1
8 Summary: Apache module: ...
9 Summary(pl): Modu³ Apache'a: ...
10 Name: apache1-mod_%{mod_name}
13 License: - (enter Apache/GPL/LGPL/BSD/BSD-like/other license name here)
14 Group: Networking/Daemons
19 BuildRequires: apache1-devel >= 1.3.33-2
20 %{?with_ipv6:BuildRequires: apache1(ipv6)-devel}
21 Requires(triggerpostun): %{apxs}
22 Requires(triggerpostun): grep
23 Requires(triggerpostun): sed >= 4.0
24 Requires: apache1 >= 1.3.33-2
25 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
27 %define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null)
28 %define _sysconfdir %(%{apxs} -q SYSCONFDIR 2>/dev/null)
31 MODNAME is Apache module...
36 %setup -q -n mod_%{mod_name}-%{version}
39 %{apxs} -c mod_%{mod_name}.c -o mod_%{mod_name}.so
42 rm -rf $RPM_BUILD_ROOT
43 install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}/conf.d}
45 install mod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}
47 # module configuration
48 # - should contain LoadModule line
49 # - and directives must be between IfModule (so user could disable the module easily)
50 install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/90_mod_%{mod_name}.conf
52 # or, if no directives needed, put just LoadModule line
53 echo 'LoadModule %{mod_name}_module modules/mod_%{mod_name}.so' > \
54 $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/90_mod_%{mod_name}.conf
57 rm -rf $RPM_BUILD_ROOT
60 if [ -f /var/lock/subsys/apache ]; then
61 /etc/rc.d/init.d/apache restart 1>&2
65 if [ "$1" = "0" ]; then
66 if [ -f /var/lock/subsys/apache ]; then
67 /etc/rc.d/init.d/apache restart 1>&2
71 # trigger for upgrading from pre confdir module
73 # if they had Include modulename.conf
74 %triggerpostun -- %{name} < VERSION
75 if grep -q '^Include conf\.d' /etc/apache/apache.conf; then
76 %{apxs} -e -A -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2
78 /^Include.*mod_%{mod_name}\.conf/d
79 ' /etc/apache/apache.conf
81 # they're still using old apache.conf
83 s,^Include.*mod_%{mod_name}\.conf,Include %{_sysconfdir}/conf.d/*_mod_%{mod_name}.conf,
84 ' /etc/apache/apache.conf
86 if [ -f /var/lock/subsys/apache ]; then
87 /etc/rc.d/init.d/apache restart 1>&2
91 %triggerpostun -- apache1-mod_%{mod_name} < VERSION
92 # check that they're not using old apache.conf
93 if grep -q '^Include conf\.d' /etc/apache/apache.conf; then
94 %{apxs} -e -A -n %{mod_name} %{_pkglibdir}/mod_%{mod_name}.so 1>&2
98 %defattr(644,root,root,755)
100 %attr(640,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/conf.d/*_mod_%{mod_name}.conf
101 %attr(755,root,root) %{_pkglibdir}/*