1 # You'll need ipv6 bcond and patch if the module alters IP related structures.
2 %bcond_without ipv6 # disable IPv6 support
4 # Replace MODNAME with real module name (example for mod_example)
5 # Replace VERSION with version since what confdir support was
6 # introduced for the module. only needed for older .specs, not needed
9 %define mod_name MODNAME
10 %define apxs %{_sbindir}/apxs1
11 Summary: Apache HTTPD module: ..
12 Summary(pl.UTF-8): ModuĊ Apache'a: ...
13 Name: apache1-mod_%{mod_name}
16 License: - (enter Apache/GPL/LGPL/BSD/BSD-like/other license name here)
17 Group: Networking/Daemons
22 %{?with_ipv6:BuildRequires: apache1(ipv6)-devel}
23 BuildRequires: apache1-devel >= 1.3.33-2
24 BuildRequires: rpmbuild(macros) >= 1.228
25 %{!?with_ipv6:BuildConflicts: apache1(ipv6)-devel}
26 Requires(triggerpostun): %{apxs}
27 Requires(triggerpostun): grep
28 Requires(triggerpostun): sed >= 4.0
29 Requires: apache1(EAPI)
30 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
32 %define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null)
33 %define _sysconfdir %(%{apxs} -q SYSCONFDIR 2>/dev/null)
36 MODNAME is Apache HTTPD module...
38 %description -l pl.UTF-8
41 %setup -q -n mod_%{mod_name}-%{version}
44 %{apxs} -c mod_%{mod_name}.c -o mod_%{mod_name}.so
47 rm -rf $RPM_BUILD_ROOT
48 install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}/conf.d}
50 install mod_%{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}
52 # module configuration
53 # - should contain LoadModule line
54 # - and directives must be between IfModule (so user could disable the module easily)
55 install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/90_mod_%{mod_name}.conf
57 # or, if no directives needed, put just LoadModule line
58 echo 'LoadModule %{mod_name}_module modules/mod_%{mod_name}.so' > \
59 $RPM_BUILD_ROOT%{_sysconfdir}/conf.d/90_mod_%{mod_name}.conf
62 rm -rf $RPM_BUILD_ROOT
65 %service apache restart
68 if [ "$1" = "0" ]; then
69 %service -q apache restart
72 %if 0 # triggers for upgrading from pre confdir module
73 # if there was "Include modulename.conf"
74 %triggerpostun -- %{name} < VERSION
75 if grep -q '^Include conf\.d/\*\.conf' /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 %service -q apache restart
88 # or, if there was just apxs usage
89 %triggerpostun -- apache1-mod_%{mod_name} < VERSION
90 # check that they're not using old apache.conf
91 if grep -q '^Include conf\.d/\*\.conf' /etc/apache/apache.conf; then
92 %{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 md5 mtime size) %{_sysconfdir}/conf.d/*_mod_%{mod_name}.conf
101 %attr(755,root,root) %{_pkglibdir}/*