[mod_proxy_html] more httpd 2.4 macros and split conf

Remi Collet remi at fedoraproject.org
Sat Mar 31 10:18:11 UTC 2012


commit 465c698d3aad4402c97f455ab1cb8489776cf2ea
Author: remi <fedora at famillecollet.com>
Date:   Sat Mar 31 12:17:03 2012 +0200

    more httpd 2.4 macros and split conf

 mod_proxy_html.spec |   56 +++++++++++++++++++++++++++++++++++---------------
 1 files changed, 39 insertions(+), 17 deletions(-)
---
diff --git a/mod_proxy_html.spec b/mod_proxy_html.spec
index eacfcec..8b205ef 100644
--- a/mod_proxy_html.spec
+++ b/mod_proxy_html.spec
@@ -1,14 +1,20 @@
+%{!?_httpd_apxs: %{expand: %%global _httpd_apxs %%{_sbindir}/apxs}}
+%{!?_httpd_mmn: %{expand: %%global _httpd_mmn %%(cat %{_includedir}/httpd/.mmn || echo missing-httpd-devel)}}
+%{!?_httpd_confdir:    %{expand: %%global _httpd_confdir    %%{_sysconfdir}/httpd/conf.d}}
+%{!?_httpd_modconfdir: %{expand: %%global _httpd_modconfdir %%{_sysconfdir}/httpd/conf.d}}
+%{!?_httpd_moddir: %{expand: %%global _httpd_moddir %%{_libdir}/httpd/modules}}
+
 Summary: Output filter to rewrite HTML links in a proxy situation
 Name: mod_proxy_html
 Version: 3.1.2
-Release: 9%{?dist}
+Release: 10%{?dist}
 License: GPLv2
 Group: System Environment/Libraries
 URL: http://apache.webthing.com/mod_proxy_html/
 Source: http://apache.webthing.com/mod_proxy_html/mod_proxy_html-%{version}.tar.bz2
 Source1: README.selinux
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
-Requires: httpd-mmn = %(cat %{_includedir}/httpd/.mmn || echo missing)
+Requires: httpd-mmn = %{_httpd_mmn}
 BuildRequires: libxml2-devel httpd-devel
 
 %description
@@ -17,24 +23,25 @@ to ensure that links work for users outside the proxy. It serves the same
 purpose as Apache's ProxyPassReverse directive does for HTTP headers, and is
 an essential component of a reverse proxy.
 
-%define modulesdir %{_libdir}/httpd/modules
-%define confdir %{_sysconfdir}/httpd/conf
 
 %prep
 %setup -q -n %{name}
 
+cp %{SOURCE1} README.selinux
 
 %build
-%{_sbindir}/apxs -c -I . -I %{_includedir}/libxml2 -lxml2 mod_proxy_html.c
-%{_sbindir}/apxs -c -I . -I %{_includedir}/libxml2 -lxml2 mod_xml2enc.c
+%{_httpd_apxs} -c -I . -I %{_includedir}/libxml2 -lxml2 mod_proxy_html.c
+%{_httpd_apxs} -c -I . -I %{_includedir}/libxml2 -lxml2 mod_xml2enc.c
 
 
 %install
 %{__rm} -rf %{buildroot}
-%{__mkdir_p} %{buildroot}/%{modulesdir} %{buildroot}/%{_docdir}/%{name}-%{version}
-%{_sbindir}/apxs -i -S LIBEXECDIR=%{buildroot}/%{modulesdir} -n mod_proxy_html mod_proxy_html.la
-%{_sbindir}/apxs -i -S LIBEXECDIR=%{buildroot}/%{modulesdir} -n mod_xml2enc mod_xml2enc.la
-install -m 644 -D proxy_html.conf %{buildroot}/%{confdir}.d/proxy_html.conf
+%{__mkdir_p} %{buildroot}%{_httpd_moddir} %{buildroot}/%{_docdir}/%{name}-%{version}
+%{_httpd_apxs} -i -S LIBEXECDIR=%{buildroot}%{_httpd_moddir} -n mod_proxy_html mod_proxy_html.la
+%{_httpd_apxs} -i -S LIBEXECDIR=%{buildroot}%{_httpd_moddir} -n mod_xml2enc mod_xml2enc.la
+install -m 644 -D proxy_html.conf %{buildroot}%{_httpd_confdir}/proxy_html.conf
+%if "%{_httpd_modconfdir}" == "%{_httpd_confdir}"
+# apache < 2.4
 %{__sed} -i \
 	-e '/^# LoadFile	\/usr\/lib\/libxml2\.so/d' \
 	-e '1,/Windows/s@^# \(LoadModule		*proxy_html_module		*modules/mod_proxy_html\.so\)$@\1@' \
@@ -42,9 +49,19 @@ install -m 644 -D proxy_html.conf %{buildroot}/%{confdir}.d/proxy_html.conf
 %ifarch x86_64
 	-e 's@/usr/lib/@%{_libdir}/@' \
 %endif
-	%{buildroot}/%{confdir}.d/proxy_html.conf
+	%{buildroot}%{_httpd_confdir}/proxy_html.conf
+%else
+# apache > 2.4
+%{__sed} -i \
+	-e '1,/HTML/d' \
+	%{buildroot}%{_httpd_confdir}/proxy_html.conf
+cat >modconf <<EOF
+LoadModule      proxy_html_module       modules/mod_proxy_html.so
+LoadModule      xml2enc_module          modules/mod_xml2enc.so
+EOF
+install -m 644 -D modconf %{buildroot}%{_httpd_modconfdir}/10-proxy_html.conf
 
-install -m 444 -D %{SOURCE1} %{buildroot}/%{_docdir}/%{name}-%{version}/
+%endif
 
 
 %clean
@@ -53,14 +70,19 @@ install -m 444 -D %{SOURCE1} %{buildroot}/%{_docdir}/%{name}-%{version}/
 
 %files
 %defattr(-,root,root)
-%{modulesdir}/mod_proxy_html.so
-%{modulesdir}/mod_xml2enc.so
-%config(noreplace) %lang(en) %{confdir}.d/proxy_html.conf
-%doc COPYING README
-%doc %{_docdir}/%{name}-%{version}/README.selinux
+%{_httpd_moddir}/mod_proxy_html.so
+%{_httpd_moddir}/mod_xml2enc.so
+%if "%{_httpd_modconfdir}" != "%{_httpd_confdir}"
+%config(noreplace) %{_httpd_modconfdir}/10-proxy_html.conf
+%endif
+%config(noreplace) %{_httpd_confdir}/proxy_html.conf
+%doc COPYING README README.selinux
 
 
 %changelog
+* Sat Mar 31 2012 Remi Collet <remi at fedoraproject.org> - 3.1.2-10
+- more httpd macros and split conf
+
 * Sat Jan 28 2012 Philip Prindeville <philipp at fedoraproject.org> - 3.1.2-9
 - Add README about settings required for running under selinux.
 


More information about the scm-commits mailing list