File apache2.spec of Package apache2.3239

#
# spec file for package apache2
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           apache2
BuildRequires:  automake
BuildRequires:  db-devel
BuildRequires:  ed
BuildRequires:  libapr-util1-devel
BuildRequires:  libapr1-devel >= 1.5.0
BuildRequires:  lua-devel
BuildRequires:  openldap2-devel
# > 0.9.8a anticipated
BuildRequires:  lua-devel
BuildRequires:  openssl-devel
BuildRequires:  pcre-devel
BuildRequires:  xz
BuildRequires:  zlib-devel
#for mod_proxy_html and mod_xml2enc
BuildRequires:  libxml2-devel
%if %{?suse_version:1}0 && 0%{?sles_version} == 9
BuildRequires:  libcap
%else
BuildRequires:  libcap-devel
%endif
%if 0%{?suse_version} >= 1210
BuildRequires:  pkgconfig(libsystemd-daemon)
BuildRequires:  pkgconfig(systemd)
%endif

%if %{?suse_version:1}0
%define httpduser wwwrun
%define httpdgroup www
%else
%define httpduser apache
%define httpdgroup apache
BuildRequires:  expat-devel
%endif
#
%define pname 		apache2
%define vers   		2
%define httpd 		httpd2
%define apache_mmn	%(test -s %{S:0} && { echo -n apache_mmn_; bzcat %{S:0} | awk '/^#define MODULE_MAGIC_NUMBER_MAJOR/ {printf "%d", $3}'; })
%define suse_maintenance_mmn  0
%define	default_mpm	prefork
%{!?prefork:%define prefork 1}
%{!?worker:%define worker 1}
%{!?event:%define event 1}
%{!?itk:%define itk 0}
%define mpms_to_build	%(test %prefork = 1 && printf prefork) %(test %worker = 1 && printf worker) %(test %event = 1 && printf event) %(test %itk = 1 && printf itk)
# dir names
%define datadir		/srv/www
%define htdocsdir	%{datadir}/htdocs
%define manualdir	%{_prefix}/share/%{pname}/manual
%define errordir	%{_prefix}/share/%{pname}/error
%define iconsdir	%{_prefix}/share/%{pname}/icons
%define cgidir		%{datadir}/cgi-bin
%define localstatedir	/var/lib/%{pname}
%define proxycachedir 	/var/cache/%{pname}
%define logfiledir	/var/log/%{pname}
%if %suse_version >= 1220
%define runtimedir /run
%define mods_static unixd systemd
%else
%define runtimedir	/var/run
%define mods_static access_compat unixd
%endif
%define sysconfdir	/etc/%{pname}
%define includedir 	%{_includedir}/%{pname}
%define libexecdir	%_libdir/%{pname}
%define installbuilddir	%{_prefix}/share/%{pname}/build
%define userdir		public_html
%define suexec_safepath	/usr/local/bin:/usr/bin:/bin
%if %suse_version > 1220
%define _unitdir /usr/lib/systemd
%else
%define _unitdir /lib/systemd
%endif

# "Server:" header
%define VENDOR SUSE
%define platform_string	Linux/%VENDOR
%define realver 2.4.10
Version:        2.4.10
Release:        0
#Source0:      http://www.apache.org/dist/httpd-%{version}.tar.bz2
Source0:        httpd-%{realver}.tar.bz2
# Add file to take mtime from it in prep section
Source1:        apache2.changes
Source6:        60C5442D.key
Source10:       SUSE-NOTICE
Source11:       rc.%{pname}
Source13:       sysconfig.%{pname}
Source18:       robots.txt
Source20:       favicon.ico
Source22:       apache2-README
Source23:       apache2-README.QUICKSTART
Source24:       apache2-README.default-vhost
Source25:       gensslcert
Source26:       apache2-README-access_compat.txt
Source27:       %{pname}.logrotate
Source28:       permissions.%{pname}
Source29:       apache-ssl-stuff.tar.bz2
Source40:       load_configuration
Source41:       find_mpm
Source42:       get_module_list
Source43:       get_includes
Source44:       find_httpd2_includes
# sysconf_addword is part of aaa_base.rpm starting with openSUSE 11.0
# we bring our own copy for the cases where it is not available
Source45:       sysconf_addword
Source46:       a2enflag
Source47:       a2enmod
Source48:       apache2.xml
Source49:       apache2.firewall
Source50:       apache2.ssl-firewall
Source100:      apache2-httpd.conf
Source101:      apache2-errors.conf
Source102:      apache2-default-server.conf
Source103:      apache2-listen.conf
Source104:      apache2-manual.conf
Source105:      apache2-mod_autoindex-defaults.conf
Source106:      apache2-mod_info.conf
Source107:      apache2-mod_log_config.conf
Source108:      apache2-mod_mime-defaults.conf
Source109:      apache2-mod_status.conf
Source110:      apache2-mod_userdir.conf
Source111:      apache2-server-tuning.conf
Source113:      apache2-ssl-global.conf
Source114:      apache2-mod_usertrack.conf
Source115:      apache2-mod_reqtimeout.conf
Source116:      apache2-mod_cgid-timeout.conf
Source130:      apache2-vhost.template
Source131:      apache2-vhost-ssl.template
Source140:      apache2-check_forensic
Source141:      apache-20-22-upgrade
Source142:      start_apache2
Source143:      apache2-systemd-ask-pass
Source144:      apache2.service
Patch2:         httpd-2.1.3alpha-layout.dif
Patch23:        httpd-2.1.9-apachectl.dif
Patch66:        httpd-2.0.54-envvars.dif
Patch67:        httpd-2.2.0-apxs-a2enmod.dif
Patch68:        httpd-2.x.x-logresolve.patch
Patch69:        httpd-2.4.9-bnc690734.patch
Patch70:        apache2-implicit-pointer-decl.patch
Patch109:       httpd-2.4.3-mod_systemd.patch
Patch111:       httpd-visibility.patch
Patch124:       httpd-2.4.x-fate317766-config-control-two-protocol-options.diff
# PATCH-FIX-UPSTREAM bnc#871310 kstreitova@suse.com -- Fix the flaw in the way mod_headers handled chunked requests. 
Patch125:       httpd-2.4.x-mod_headers_chunked_requests.patch
# PATCH-FIX-UPSTREAM bnc#899836 kstreitova@suse.com -- avoid a crash when Content-Type has an empty value
Patch126:       httpd-2.4.x-check_null_pointer_dereference.patch
# PATCH-FIX-UPSTREAM bnc#909715 kstreitova@suse.com -- Fix handling of the Require line when a LuaAuthzProvider is used in multiple Require directives with different arguments.
Patch127:       httpd-2.4.x-mod_lua_handling_of_Require_line.patch
# PATCH-FIX-UPSTREAM bnc#918352 kstreitova@suse.com -- fix mod_lua - maliciously crafted websockets PING after a script calls r:wsupgrade() can cause a child process crash
Patch128:       httpd-2.4.x-mod_lua_websocket_DoS.patch
# PATCH-FIX-UPSTREAM bnc#930228 kstreitova@suse.com -- fix LDAP authz failures when using connection pool
Patch129:       httpd-2.4.10-LDAP_authz_failures.patch
# PATCH-FIX-UPSTREAM bnc#869790 kstreitova@suse.com -- Fix split-logfile2 script
Patch130:       httpd-2.4.10-split-logfile2.patch
# PATCH-FIX-UPSTREAM bnc#938723 kstreitova@suse.com -- fix CVE-2015-3185 by replacement of ap_some_auth_required with new ap_some_authn_required and ap_force_authn hook
Patch131:       httpd-2.4.10-ap_some_auth_required_API_unusable.patch
# PATCH-FIX-UPSTREAM bnc#938728 kstreitova@suse.com -- fix CVE-2015-3183 - chunk header parsing defect
Patch132:       httpd-2.4.10-chunk_header_parsing_defect.patch
Patch133:       apache2-cve-2016-5387.patch
Patch134:       httpd-2.4.10-prefork-Ignore-SIGINT-in-child.patch
Patch135:       bnc951692.patch
Patch136:       apache2-CVE-2017-7679.patch
Patch137:       apache2-CVE-2017-3169.patch
Patch138:       apache2-CVE-2017-3167.patch
Patch139:       apache2-CVE-2017-9788.patch
Patch140:       apache2-CVE-2017-9798.patch
Url:            http://httpd.apache.org/
Icon:           Apache.xpm
Summary:        The Apache Web Server Version 2
License:        Apache-2.0
Group:          Productivity/Networking/Web/Servers
Provides:       %{apache_mmn}
Provides:       %{name}-mod_macro = %{version}
Provides:       http_daemon
Provides:       httpd
Provides:       suse_help_viewer
Provides:       suse_maintenance_mmn_%{suse_maintenance_mmn}
Obsoletes:      %{name}-mod_macro <= 1.2.1
Requires:       %{pname}-MPM
Requires:       /etc/mime.types
PreReq:         %{name}-utils
Requires:       logrotate
#for some reason the parser barfs if not conditional
%{?requires_ge:%requires_ge libapr1}
%{?requires_ge:%requires_ge libapr-util1}
%{?systemd_requires}
PreReq:         fileutils textutils grep sed 
%if %{?suse_version:1}0
PreReq:         %insserv_prereq %fillup_prereq permissions pwdutils
%endif
%if 0%{?suse_version} >= 901 && 0%{?sles_version} != 9
Provides:       apache
Obsoletes:      apache < 1.3.29
Obsoletes:      mod_ssl < 2.8.16
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} >= 1110
Recommends:     apache2-%default_mpm
%endif

%description
Apache 2, the successor to Apache 1.

Apache is the most used Web server software worldwide.

Some new features in Apache 2: - hybrid multiprocess, multithreaded
   mode for improved scalability

- multiprotocol support

- stream filtering

- IPv6 support

- new module API

New modules include: - mod_auth_db

- mod_auth_digest

- mod_charset_lite

- mod_dav

- mod_file_cache

Mod_ssl is no longer a separate package, but is now included in the
Apache distribution.

See /usr/share/doc/packages/apache2/, http://httpd.apache.org/, and
http://httpd.apache.org/docs-2.4/upgrading.html.

%if %worker

%package worker
Summary:        Apache 2 worker MPM (Multi-Processing Module)
Group:          Productivity/Networking/Web/Servers
Provides:       %{pname}-MPM
Requires:       %{name} = %{version}
%endif
%if %prefork

%package prefork
Summary:        Apache 2 "prefork" MPM (Multi-Processing Module)
Group:          Productivity/Networking/Web/Servers
Provides:       %{pname}-MPM
%if 0%{?suse_version} >= 901 && 0%{?sles_version} != 9
Provides:       apache:/usr/sbin/httpd
%endif
Requires:       %{name} = %{version}
%endif
%if %event

%package event
Summary:        Apache 2 event MPM (Multi-Processing Module)
Group:          Productivity/Networking/Web/Servers
Provides:       %{pname}-MPM
Requires:       %{name} = %{version}
%endif
%if %itk

%package itk
Summary:        Apache 2 "ITK" MPM (Multi-Processing Module)
Group:          Productivity/Networking/Web/Servers
Provides:       %{pname}-MPM
Requires:       %{name} = %{version}
%endif
%if %worker

%description worker
The worker MPM (multi-Processing Module) implementing a hybrid
multi-threaded multi-process web server.

This combination offers a performance boost and retains some of the
stability of the multi-process model.

%endif
%if %prefork

%description prefork
"prefork" MPM (Multi-Processing Module)

This MPM is basically the one that Apache 1.3.x used. It warrants the
maximum stability because each server runs in its own process. If a
process dies it will not affect other servers.

%endif
%if %event

%description event
The "event" MPM uses a separate thread to handle Keep Alive requests and accepting
connections. Keep Alive requests have traditionally required httpd to
dedicate a worker to handle it. This dedicated worker could not be used
again until the Keep Alive timeout was reached.

This MPM depends on APR's atomic compare-and-swap operations for thread
synchronization.

%endif
%if %itk

%description itk
The "ITK" MPM (Multi-Processing Module) is experimental and NOT officially
endorsed by the Apache Software Foundation, so it may or may not work as 
expected.

Apache2-mpm-itk (just mpm-itk for short) is a MPM for the Apache 2 web server. 
mpm-itk allows you to run each of your vhosts under a separate uid and gid -- 
in short, the scripts and configuration files for one vhost no longer have to 
be readable for all the other vhosts.

See http://mpm-itk.sesse.net/

%endif

%package devel
Summary:        Apache 2 Header and Include Files
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}
Requires:       %{pname}-MPM
Requires:       apache2-prefork
Requires:       gcc
Requires:       libapr-util1-devel
Requires:       libapr1-devel

%description devel
This package contains header files and include files that are needed
for development using the Apache API.



%package doc
Summary:        Additional Package Documentation
Group:          Documentation/Other
%if 0%{?suse_version} >= 901 && 0%{?sles_version} != 9
Provides:       apache-doc
Obsoletes:      apache-doc
%endif
%if 0%{?suse_version} >= 1120
BuildArch:      noarch
%endif

%description doc
This package contains optional documentation provided in addition to
this package's base documentation.



%package example-pages
Summary:        Example Pages for the Apache 2 Web Server
Group:          Productivity/Networking/Web/Servers
%if 0%{?suse_version} >= 901 && 0%{?sles_version} != 9
Provides:       apache-example-pages
Obsoletes:      apache-example-pages
%endif

%description example-pages
Some Example pages for Apache that show information about the installed
server.

%package utils
Summary:        Apache 2 utilities
Group:          Productivity/Networking/Web/Servers

%description utils
Utilities provided by the Apache 2 Web Server project which are useful
to administrators of web servers in general.

%prep
#  
#  O/ ._ .__ ._
#  /O |_)|(/_|_)
#     |      |
#  
%setup -q -n httpd-%{realver}
%patch2 -p1
%patch23 -p1
%patch66 -p1
%patch67 -p1
%patch68 -p1
%patch69
%patch70 -p1
%patch109 -p1
%patch111 -p1
%patch124 -p1
%patch125 -p1
%patch126 -p1
%patch127 -p1
%patch128 -p1
%patch129 -p1
%patch130 -p1
%patch131 -p1
%patch132 -p1
%patch133 -p1
%patch134 -p1
%patch135
%patch136 -p1
%patch137 -p1
%patch138 -p1
%patch139 -p1
%patch140 -p1
#exit 0
cat $RPM_SOURCE_DIR/SUSE-NOTICE >> NOTICE
# install READMEs
a=$(basename %{S:22})
cp %{S:22} ./${a##%{name}-}
b=$(basename %{S:23})
cp %{S:23} ./${b##%{name}-}
c=$(basename %{S:24})
cp %{S:24} ./${c##%{name}-}
d=$(basename %{S:26})
cp %{S:26} ./${d##%{name}-}

#
# replace PLATFORM string that's seen in the "Server:" header
#
sed 's,(" PLATFORM "),(%platform_string),' server/core.c > tmp_file && mv tmp_file server/core.c
sed 's/public_html/%{userdir}/g' docs/conf/extra/httpd-userdir.conf.in > tmp_file && mv tmp_file docs/conf/extra/httpd-userdir.conf.in
# Use mtime of .changes for build time
CHANGES=`stat --format="%y" %SOURCE1`
sed -i -e "s/__DATE__ \" \" __TIME__;/\"$CHANGES\";/" server/buildmark.c 
#
# now configure Apache 
#
%if 0%{?suse_version} > 910
autoreconf -fiv
%else
rm -rf aclocal.m4 autom4te*.cache
autoheader
autoconf
%endif

%build
#
#  O/ |_    o| _|
#  /O |_)|_|||(_|
#
function configure {
	CFLAGS="$RPM_OPT_FLAGS -fPIC -Wall -DLDAP_DEPRECATED" \
	CPPFLAGS="-DSSL_EXPERIMENTAL_ENGINE -DMAX_SERVER_LIMIT=200000 -DLDAP_DEPRECATED -DMAXLINE=4096" \
	./configure \
		--enable-layout=SuSE81%(test "%_lib" = lib64 && echo -n _64) \
		--with-program-name=httpd%{vers}$mpm_suffix \
		--with-apr=%{_bindir}/apr-1-config \
		--with-apr-util=%{_bindir}/apu-1-config \
		--with-mpm=$mpm \
%if "$mpm" == "worker" || "$mpm" == "event"
%ifarch %ix86
%ifnarch i386
		--enable-nonportable-atomics=yes \
%endif
%endif
%endif
		\
		--enable-exception-hook \
		\
%if %{?suse_version:%suse_version}%{?!suse_version:9999} > 930
		--with-pcre \
		--enable-pie \
%endif
		--enable-mods-shared=all \
		--enable-mods-static="%{mods_static}" \
		--enable-access-compat \
		--enable-ssl=shared \
		\
		--disable-isapi \
		--enable-deflate \
		--enable-echo \
		--enable-expires \
		--enable-include \
		--enable-reflector \
		--enable-filter \
		--enable-ext-filter \
		--enable-charset-lite \
		--enable-file-cache \
		--enable-logio \
		--enable-log-forensic \
		--enable-dumpio \
		--enable-bucketeer \
		--enable-case_filter \
		--enable-case_filter_in \
		--enable-imagemap \
		--enable-negotiation \
		\
		--with-ldap \
		--enable-ldap \
		--enable-authnz_ldap \
		\
		--enable-proxy \
		--enable-proxy-connect \
		--enable-proxy-ftp \
		--enable-proxy-http \
		--enable-proxy-html \
		--enable-proxy-express \
		--enable-cache \
		--enable-disk-cache \
		--enable-cache-socache \
		--enable-socache-shmcb \
		--enable-mem-cache \
		--enable-socache-memcache \
		--enable-version \
		--enable-macro \
		--enable-ratelimit \
		--enable-substitute \
		--enable-sed \
		--enable-vhost-alias \
		\
		--enable-dav \
		--enable-dav-lock \
		--enable-authn-alias \
		--enable-authn-dbm \
		--enable-authn-anon \
		--enable-authn-dbd \
		--enable-authn-socache \
		--enable-authz-dbm \
		--enable-authz-owner \
		--enable-authz-dbd \
		--enable-authnz-ldap \
		--enable-authnz-fcgi \
		--enable-optional-hook-export \
		--enable-optional-hook-import \
		--enable-optional-fn-import \
		--enable-optional-fn-export \
		\
		--enable-suexec \
		--with-suexec-bin=%{_sbindir}/suexec%{vers} \
		--with-suexec-caller=%httpduser \
		--with-suexec-docroot=%{datadir} \
		--with-suexec-logfile=%{logfiledir}/suexec.log \
		--with-suexec-userdir=%{userdir} \
		--with-suexec-uidmin=96 \
		--with-suexec-gidmin=96 \
		--with-suexec-safepath=%{suexec_safepath} \
		--disable-heartbeat
}

#	
#	|_    o| _|  | _  _ ._
#	|_)|_|||(_|  |(_)(_)|_)
#	                    |
#
# build the 3 multi-processing modules (MPM) in a loop
#
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT;
for mpm in %{mpms_to_build}; do
	echo $mpm >> .status
	test -s Makefile && make clean >/dev/null
	echo -e "\n\n\n \e[01m***** Building $mpm MPM *****\e[00m\n\n\n"
	export mpm_suffix=-$mpm
	configure 
	sed "s/%{vers}-$mpm//" include/ap_config_auto.h > include/ap_config_auto.h.new
	mv include/ap_config_auto.h.new include/ap_config_auto.h
    sed -i -e "s@/var/run@%{runtimedir}@g" include/ap_config_layout.h

	make CFLAGS="$RPM_OPT_FLAGS -fvisibility=hidden -fPIC \
		-Wall \
		-DDEFAULT_ERRORLOG='\"%{logfiledir}/error_log\"' " \
		%{?jobs:-j%jobs} 

	make DESTDIR=$RPM_BUILD_ROOT install

	#rm -rf $RPM_BUILD_ROOT.$mpm.pre
	#cp -a $RPM_BUILD_ROOT/ $RPM_BUILD_ROOT.$mpm.pre
	# show pathnames in config files
	echo;echo;echo; diff -U1 docs/conf/httpd-std.conf.in docs/conf/httpd-std.conf ||:
	echo;echo;echo; diff -U1 docs/conf/ssl-std.conf.in   docs/conf/ssl-std.conf ||:
	# show compile settings
	pwd
	printf "\n\n\n"; ./%{httpd}$mpm_suffix -V
	printf "\n\n\n"; ./%{httpd}$mpm_suffix -l
	#mv $RPM_BUILD_ROOT/%{sysconfdir}/httpd-std.conf $RPM_BUILD_ROOT/%{sysconfdir}/httpd-std.conf$mpm_suffix
	#mv $RPM_BUILD_ROOT/%{sysconfdir}/httpd2-prefork.conf $RPM_BUILD_ROOT/%{sysconfdir}/httpd-std.conf$mpm_suffix
	# fix up and rename config_vars file: remove references to the RPM build dir;
	# remove references to RPM build root; fix apr/apu includedir
	sed -e "/^EXTRA_INCLUDES/s|-I$RPM_BUILD_DIR[^ ]* ||g" \
	    -e "/^AP._INCLUDEDIR/s|$RPM_BUILD_DIR.*$|%{includedir}$mpm_suffix|" \
	    -e "/abs_srcdir/d" \
	    -e "/AP_LIBS/d" \
	  < $RPM_BUILD_ROOT/%{installbuilddir}/config_vars.mk \
	  > $RPM_BUILD_ROOT/%{installbuilddir}/config_vars.mk$mpm_suffix
	rm $RPM_BUILD_ROOT/%{installbuilddir}/config_vars.mk
	#rm -rf $RPM_BUILD_ROOT.$mpm.post
	#cp -a $RPM_BUILD_ROOT/ $RPM_BUILD_ROOT.$mpm.post
done
mkdir -p $RPM_BUILD_ROOT/%{libexecdir}

# remove references to mpm type in config_vars
sed -e "s^/usr/%_lib/%{pname}-%{default_mpm}^/usr/%_lib/%{pname}^" \
    -e "s/httpd$/%{httpd}-%{default_mpm}/" \
    -e "s/%{pname}-%{default_mpm}/%{pname}/" \
  < $RPM_BUILD_ROOT/%{installbuilddir}/config_vars.mk-%{default_mpm} \
  > $RPM_BUILD_ROOT/%{installbuilddir}/config_vars.mk

# get rid of modules that do not differ between the MPMs (since most of them are the same)
# by putting them in /usr/lib/apache%{vers}
ldir=$RPM_BUILD_ROOT/%{libexecdir}
for i in $(cd $ldir-%{default_mpm}; ls -1 *.so); do
	identical=true
	for mpm in %{mpms_to_build}; do
		if test -f $ldir-$mpm/$i -a -f $ldir-%{default_mpm}/$i; then
			objcopy --strip-debug $ldir-$mpm/$i $ldir-$mpm/$i.tst
			objcopy --strip-debug $ldir-%{default_mpm}/$i $ldir-%{default_mpm}/$i.tst
			ls -l $ldir-{%{default_mpm},$mpm}/$i*
			cmp -s $ldir-{%{default_mpm},$mpm}/$i.tst || identical=false
			rm -f $ldir-{%{default_mpm},$mpm}/$i.tst
		else
			identical=false
		fi
	done
	if $identical; then
		cp -dp $ldir-%{default_mpm}/$i $ldir
		for mpm in %{mpms_to_build}; do
			rm $ldir-$mpm/$i
			ln -s ../%{pname}/$i $ldir-$mpm/$i
		done
	fi
done

# merge the three /usr/include/apache2-* directories
# by putting them in /usr/lib/apache%{vers}
idir=$RPM_BUILD_ROOT/%{includedir}
mkdir -p $idir
for i in $(cd $idir-%{default_mpm}; ls -1); do
	identical=true
	for mpm in %{mpms_to_build}; do
		cmp -s $idir-{%{default_mpm},$mpm}/$i || identical=false
	done
	if $identical; then
		cp -dp $idir-%{default_mpm}/$i $idir
		for mpm in %{mpms_to_build}; do
			rm $idir-$mpm/$i
			ln -s ../%{pname}/$i $idir-$mpm/$i
		done
	fi
done
for i in ap_config_auto.h ap_config_layout.h; do
	if [ ! -f $idir/$i ]; then
		sed 's/-%{default_mpm}//' $idir-%{default_mpm}/$i > $idir/$i
	fi
done

%install
#
#  O/ o._  __|_ _.||
#  /O || |_> |_(_|||
#  
#
# (most installation (to build root) has already been done in %%build)
#
# save MODULE_MAGIC_NUMBER
cat > $RPM_BUILD_ROOT/%{_libdir}/%{pname}_MMN <<-EOF
	#!/bin/sh
	echo %{apache_mmn}
EOF

cp -p $RPM_BUILD_ROOT/%{sysconfdir}/%{httpd}-%{default_mpm}.conf $RPM_BUILD_ROOT/%{sysconfdir}/httpd.conf
cp -p $RPM_BUILD_ROOT/%{sysconfdir}/httpd.conf ./httpd.conf.default
rm $RPM_BUILD_ROOT/%{sysconfdir}/%{httpd}-*.conf
#
# create directories
mkdir -p $RPM_BUILD_ROOT/%{_var}/adm/fillup-templates \
	 $RPM_BUILD_ROOT/%{proxycachedir} \
	 $RPM_BUILD_ROOT/%{localstatedir}
#
# support files
install -m 755 support/log_server_status 	$RPM_BUILD_ROOT/%{_bindir}/log_server_status%{vers}
install -m 755 support/split-logfile 		$RPM_BUILD_ROOT/%{_bindir}/split-logfile%{vers}
install -m 755 support/logresolve.pl 		$RPM_BUILD_ROOT/%{_sbindir}/logresolve.pl%{vers}
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
install -m 644 $RPM_SOURCE_DIR/%{pname}.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/%{pname}
# since 10.0, the permission files are maintained centrally
%if %{?suse_version:%suse_version}%{?!suse_version:9999} < 1000
mkdir -p $RPM_BUILD_ROOT/etc/permissions.d
install -m 644 $RPM_SOURCE_DIR/permissions.%{pname} $RPM_BUILD_ROOT/etc/permissions.d/%{pname}
%endif
install -m 755 $RPM_SOURCE_DIR/apache2-check_forensic $RPM_BUILD_ROOT/%{_bindir}/check_forensic%{vers}
#
# xml stuff
install -d $RPM_BUILD_ROOT%{_datadir}/omc/svcinfo.d/
install -m 644 %{S:48} $RPM_BUILD_ROOT%{_datadir}/omc/svcinfo.d/
#
# ssl stuff
install -m 755 %{S:25} $RPM_BUILD_ROOT/%{_bindir}/
tar xjf %{SOURCE29} -C $RPM_BUILD_ROOT/%{sysconfdir}
#
# init script and friends

%if 0%{?suse_version} >= 1210
install -m 744 $RPM_SOURCE_DIR/start_apache2 $RPM_BUILD_ROOT/usr/sbin/start_apache2
mkdir -p $RPM_BUILD_ROOT%{_unitdir}/system/
install -m 744 $RPM_SOURCE_DIR/apache2-systemd-ask-pass $RPM_BUILD_ROOT/usr/sbin/apache2-systemd-ask-pass
install -m 644 $RPM_SOURCE_DIR/apache2.service $RPM_BUILD_ROOT%{_unitdir}/system/apache2.service
%else
mkdir -p $RPM_BUILD_ROOT/etc/init.d
install -m 744 $RPM_SOURCE_DIR/rc.%{pname} $RPM_BUILD_ROOT/etc/init.d/%{pname}
ln -sf ../../etc/init.d/%{pname} $RPM_BUILD_ROOT/%{_sbindir}/rc%{pname}
%endif
%%if 0%{?suse_version} >= 1310
# override rcapache2 symlink:
ln -fs service $RPM_BUILD_ROOT/%{_sbindir}/rc%{pname}
%endif

install -m 755 $RPM_SOURCE_DIR/load_configuration $RPM_BUILD_ROOT/%{_prefix}/share/%{pname}/
install -m 755 $RPM_SOURCE_DIR/find_mpm           $RPM_BUILD_ROOT/%{_prefix}/share/%{pname}/
install -m 755 $RPM_SOURCE_DIR/get_includes       $RPM_BUILD_ROOT/%{_prefix}/share/%{pname}/
install -m 755 $RPM_SOURCE_DIR/find_httpd2_includes $RPM_BUILD_ROOT/%{_prefix}/share/%{pname}/
install -m 755 $RPM_SOURCE_DIR/apache-20-22-upgrade $RPM_BUILD_ROOT/%{_prefix}/share/%{pname}/
sed 's+/usr/lib+/usr/%_lib+' $RPM_SOURCE_DIR/get_module_list \
	> $RPM_BUILD_ROOT/%{_prefix}/share/%{pname}/get_module_list
chmod 755 $RPM_BUILD_ROOT/%{_prefix}/share/%{pname}/get_module_list
install -m 755 $RPM_SOURCE_DIR/sysconf_addword $RPM_BUILD_ROOT/%{_prefix}/share/%{pname}/
install -m 755 $RPM_SOURCE_DIR/a2enflag $RPM_BUILD_ROOT/%{_sbindir}
ln -s a2enflag $RPM_BUILD_ROOT/%{_sbindir}/a2disflag
install -m 755 $RPM_SOURCE_DIR/a2enmod $RPM_BUILD_ROOT/%{_sbindir}
ln -s a2enmod $RPM_BUILD_ROOT/%{_sbindir}/a2dismod
#
# directories for files from other packages and other configuration
for i in vhosts.d sysconfig.d; do
	mkdir -p $RPM_BUILD_ROOT/%{sysconfdir}/$i
done
#
# make list of all modules, and install sysconfig template
for i in $(find $RPM_BUILD_ROOT/%{libexecdir}-%{default_mpm} -name "*.so" | sort); do
	modname=${i#*mod_}; modname=${modname%.so}
	modname=${modname##*lib}
	all_modules="$all_modules $modname"
done
all_modules=$(echo $all_modules | fmt | sed 's/\(.*\)/#    \1\\/')
sed "s+@@all_modules@@+$all_modules +" $RPM_SOURCE_DIR/sysconfig.%{pname} \
	> $RPM_BUILD_ROOT/%{_var}/adm/fillup-templates/sysconfig.%{pname}
#
# install configuration files:
mkdir -p $RPM_BUILD_ROOT/%{runtimedir}
touch $RPM_BUILD_ROOT/%{sysconfdir}/sysconfig.d/include.conf
mkdir -p $RPM_BUILD_ROOT/%{sysconfdir}/conf.d
for i in default-server.conf \
	 errors.conf \
	 httpd.conf \
	 listen.conf \
	 mod_autoindex-defaults.conf \
	 mod_info.conf \
	 mod_log_config.conf \
	 mod_mime-defaults.conf \
	 mod_status.conf \
	 mod_userdir.conf \
	 mod_usertrack.conf \
	 server-tuning.conf \
	 mod_reqtimeout.conf \
	 ssl-global.conf
do
	install -m 644 $RPM_SOURCE_DIR/apache2-$i $RPM_BUILD_ROOT/%{sysconfdir}/$i
done
cat > $RPM_BUILD_ROOT/%{sysconfdir}/uid.conf <<-EOF
	User %httpduser
	Group %httpdgroup
EOF

# remove configuration for mpms which have not been built
mpm_confs="$(awk '/IfModule .*\.c/ {print $2}' $RPM_BUILD_ROOT/%{sysconfdir}/server-tuning.conf | cut -d. -f1 | tr '\n' ' ')"
for mpm_conf in $mpm_confs; do
	case "%{mpms_to_build}" in
	*$mpm_conf*) ;;
	*) sed "/^# $mpm_conf/, /^$/ d" $RPM_BUILD_ROOT/%{sysconfdir}/server-tuning.conf > t
	   #diff -u $RPM_BUILD_ROOT/%{sysconfdir}/server-tuning.conf t ||:
	   mv t $RPM_BUILD_ROOT/%{sysconfdir}/server-tuning.conf
	   ;;
	esac
done
install -m 644 %{S:130} $RPM_BUILD_ROOT/%{sysconfdir}/vhosts.d/vhost.template
install -m 644 %{S:131} $RPM_BUILD_ROOT/%{sysconfdir}/vhosts.d/vhost-ssl.template
install -m 644 %{S:104} $RPM_BUILD_ROOT/%{sysconfdir}/conf.d/manual.conf
install -m 644 %{S:116} $RPM_BUILD_ROOT/%{sysconfdir}/conf.d/mod_cgid-timeout.conf
# for mod_auth_ldap
install -m 644 docs/conf/charset.conv $RPM_BUILD_ROOT/%{sysconfdir}/

cp -p $RPM_SOURCE_DIR/robots.txt .
cp -p $RPM_SOURCE_DIR/favicon.ico		$RPM_BUILD_ROOT/%{htdocsdir}/
cat > $RPM_BUILD_ROOT/%{htdocsdir}/robots.txt <<-EOF
	User-Agent: *
	Disallow: /
EOF

#
# use official mime.types (more complete)
#
ln -sf ../mime.types $RPM_BUILD_ROOT/%{sysconfdir}/mime.types

mv $RPM_BUILD_ROOT/%{cgidir}/printenv* .
mv $RPM_BUILD_ROOT/%{cgidir}/test-cgi .
pushd $RPM_BUILD_ROOT/%{_mandir}
	for i in $(find . -type f); do
		mv $i ${i%.*}%{vers}.${i#*.*.} || true
	done
popd

pushd $RPM_BUILD_ROOT/%{_bindir}
for i in ab dbmmanage htdbm htdigest htpasswd logresolve;do 
mv $i ${i}%{vers} || true
done
popd

pushd $RPM_BUILD_ROOT/%{_sbindir}
	for i in rotatelogs suexec; do
		mv $i ${i}%{vers} || true
	done
	mv apachectl apachectl.tmp; mv apachectl.tmp apache%{vers}ctl
popd
# fix up apxs
pushd $RPM_BUILD_ROOT/%{_bindir}
	for mpm in %{mpms_to_build}; do
		cat <<-EOT_ED | ed -s apxs
			H
			,s/^\(.*\)config_vars.mk\(.*\)$/\1config_vars.mk\$mpm_suffix\2/
			/config_vars.mk
			-
			i
			my \$mpm_suffix = "-$mpm";
			.
			wq apxs%{vers}-$mpm
		EOT_ED
		chmod 755 apxs%{vers}-$mpm
	done
	cat <<-EOT_ED | ed -s apxs
		H
		/config_vars
		a
		my \$mpm_suffix = "";
		.
		wq
	EOT_ED
	mv apxs apxs%{vers}
popd

# install firewall information file 
install -d $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/
install -m 644 %{S:49} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/%{name}
install -m 644 %{S:50} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/%{name}-ssl
ln -sf %{_bindir}/apxs%{vers} %{buildroot}%{_sbindir}
#
# filelists
#
>filelist; >filelist-devel
for mpm in %{mpms_to_build}; do 
	echo %dir %{_libdir}/%{pname}-$mpm >> filelist
	(
	echo %dir %{includedir}-$mpm 
	echo %{_bindir}/apxs%{vers}-$mpm
	) >> filelist-devel
done
find $RPM_BUILD_ROOT/%{includedir}/.. -type f -o -type l \
 | sed "s#$RPM_BUILD_ROOT##" \
 >> filelist-devel
find $RPM_BUILD_ROOT/%{installbuilddir} -type f \
 | sed "s#$RPM_BUILD_ROOT##" \
 >> filelist-devel

# remove files from the build root that we won't package
rm -f $RPM_BUILD_ROOT/%{_libdir}/%{pname}-*/*.exp	# needed only on AIX
rm -f $RPM_BUILD_ROOT/%{_libdir}/%{pname}/*.exp		# needed only on AIX
rm -f $RPM_BUILD_ROOT/%{_sbindir}/checkgid		# needed only for user installations from tarball
rm -r $RPM_BUILD_ROOT/%{sysconfdir}/extra 		# it is already in the documentation directory

#
#  O/ _|_ _  __|_ 
#  /O  |_(/__> |_ 
#                 
#
# now check wether httpd binary runs properly 
# and validate httpd.conf file 
#
pushd $RPM_BUILD_ROOT/%{sysconfdir}
for i in *.conf; do cp $i $i.test; done
%if %{?suse_version:%suse_version}%{?!suse_version:9999} < 810
	echo -e "User %httpduser \nGroup nogroup" > uid.conf.test
	sed 's+/srv/www+/usr/local/httpd+' default-server.conf > t
	mv t default-server.conf
	mkdir -p /usr/local/httpd/htdocs
%endif
# for Fedora
%if %{?suse_version:0}%{!?suse_version:1}
	echo -e "User nobody \nGroup nobody" > uid.conf.test
	mkdir -p $RPM_BUILD_ROOT/%{htdocsdir}
%endif
sed -e 's+/usr/%_lib+'$RPM_BUILD_ROOT'/usr/%_lib+' \
    -e 's+/var/run+'$RPM_BUILD_ROOT'/var/run+' \
    -e 's+%{sysconfdir}+'$RPM_BUILD_ROOT'%{sysconfdir}+' \
    -e 's+%{datadir}+'$RPM_BUILD_ROOT'%{datadir}+' \
    -e 's+\.conf$+&.test+' \
    -e 's+/var/log+'$RPM_BUILD_ROOT'/var/log+' \
		httpd.conf > httpd.conf.test
sed -e 's+%{sysconfdir}+'$RPM_BUILD_ROOT'%{sysconfdir}+' \
    -e 's+/srv/www+'$RPM_BUILD_ROOT'/srv/www+' \
		default-server.conf > default-server.conf.test
touch sysconfig.d/global.conf.test
touch sysconfig.d/include.conf.test
popd
pushd $RPM_BUILD_ROOT
for i in $(export LC_ALL=C; find .%{libexecdir}-%{default_mpm} -name "*.so" | sort); do
	mod_id=${i#*mod_}; mod_id=${mod_id%.so}_module
	mod_path=
	echo LoadModule $mod_id $RPM_BUILD_ROOT/${i#.} >> .%{sysconfdir}/sysconfig.d/loadmodule.conf.test
done
# auth_ldap_module needs to be loaded after ldap_module
echo -e "/authnz_ldap\n+\n-m/ldap\nwq" | ed -s ./%{sysconfdir}/sysconfig.d/loadmodule.conf.test
popd

%if %{?suse_version:1}%{!?suse_version:0}
LD_LIBRARY_PATH=${RPM_BUILD_ROOT}%{_libdir} \
$RPM_BUILD_ROOT/%{_sbindir}/httpd%{vers}-%{default_mpm} \
	-e debug -t -f $RPM_BUILD_ROOT/%{sysconfdir}/httpd.conf.test || exit 1
%else
LD_LIBRARY_PATH=${RPM_BUILD_ROOT}%{_libdir} \
$RPM_BUILD_ROOT/%{_sbindir}/httpd%{vers}-%{default_mpm} \
	-e debug -t -f $RPM_BUILD_ROOT/%{sysconfdir}/httpd.conf.test || :
%endif
rm $RPM_BUILD_ROOT/%{sysconfdir}/*.test
rm $RPM_BUILD_ROOT/%{sysconfdir}/sysconfig.d/*
mv $RPM_BUILD_ROOT/%{sysconfdir}/original .

%files -f filelist
#       _
#  O/ _|_o| _  _
#  /O  | ||(/__>
#  
%defattr(-,root,root)
%doc INSTALL READM* LICENSE ABOUT_APACHE CHANGES
%doc support/SHA1
%doc %{_mandir}/man?/apachectl%{vers}.?.*
%doc %{_mandir}/man?/htcacheclean%{vers}.?.*
%doc %{_mandir}/man?/%{httpd}.?.*
%doc %{_mandir}/man?/apxs%{vers}.?.*
%doc robots.txt
%doc printenv
%doc test-cgi
#%doc httpd-std.conf-*
#%doc ssl-std.conf
%doc httpd.conf.default
%doc original
%attr(750,root,root) %dir %{logfiledir}
%attr(750,%httpduser,root) %dir   %{proxycachedir}
%attr(750,%httpduser,root) %dir   %{localstatedir}
%dir %{sysconfdir}
%config %{sysconfdir}/magic
%config %{sysconfdir}/mime.types
%config (noreplace) %{sysconfdir}/*.conf
%config (noreplace) %{sysconfdir}/charset.conv
%{sysconfdir}/vhosts.d/*.template
%dir %{sysconfdir}/ssl.crl
%dir %{sysconfdir}/ssl.crt
%dir %{sysconfdir}/ssl.csr
%dir %attr(700,root,root) %{sysconfdir}/ssl.key
%dir %{sysconfdir}/ssl.prm
%{sysconfdir}/ssl.*/README*
%dir %{sysconfdir}/conf.d
%config (noreplace) %{sysconfdir}/conf.d/mod_cgid-timeout.conf
%dir %{sysconfdir}/vhosts.d
%dir %{sysconfdir}/sysconfig.d
%config(noreplace) /etc/logrotate.d/%{pname}
%{_datadir}/omc/svcinfo.d/apache2.xml
%if %{?suse_version:%suse_version}%{?!suse_version:9999} < 1000
%config(noreplace) /etc/permissions.d/%{pname}
%endif
%if 0%{?suse_version} >= 1210
%{_unitdir}/system/%{pname}.service
%else
%config /etc/init.d/%{pname}
%endif
#
%{_sbindir}/rc%{pname}
%{_sbindir}/apache%{vers}ctl
%{_sbindir}/envvars
%{_sbindir}/envvars-std
%{_sbindir}/htcacheclean
%{_sbindir}/a2enflag
%{_sbindir}/a2enmod
%{_sbindir}/a2disflag
%{_sbindir}/a2dismod
%{_sbindir}/start_apache2
%if 0%{?suse_version} >= 1210
%{_sbindir}/apache2-systemd-ask-pass
%endif
%{_bindir}/log_server_status%{vers}
%{iconsdir}
%{errordir}
%{_var}/adm/fillup-templates/sysconfig.%{pname}
%attr(755,root,root) %{_libdir}/%{pname}_MMN
%dir %{_libdir}/%{pname}
# hardcoded list so we do not lose mods by accident
%{_libdir}/%{pname}/mod_access_compat.so
%{_libdir}/%{pname}/mod_actions.so
%{_libdir}/%{pname}/mod_alias.so
%{_libdir}/%{pname}/mod_allowmethods.so
%{_libdir}/%{pname}/mod_asis.so
%{_libdir}/%{pname}/mod_auth_basic.so
%{_libdir}/%{pname}/mod_auth_digest.so
%{_libdir}/%{pname}/mod_auth_form.so
%{_libdir}/%{pname}/mod_authn_anon.so
%{_libdir}/%{pname}/mod_authn_core.so
%{_libdir}/%{pname}/mod_authn_dbd.so
%{_libdir}/%{pname}/mod_authn_dbm.so
%{_libdir}/%{pname}/mod_authn_file.so
%{_libdir}/%{pname}/mod_authn_socache.so
%{_libdir}/%{pname}/mod_authnz_fcgi.so
%{_libdir}/%{pname}/mod_authnz_ldap.so
%{_libdir}/%{pname}/mod_authz_core.so
%{_libdir}/%{pname}/mod_authz_dbd.so
%{_libdir}/%{pname}/mod_authz_dbm.so
%{_libdir}/%{pname}/mod_authz_groupfile.so
%{_libdir}/%{pname}/mod_authz_host.so
%{_libdir}/%{pname}/mod_authz_owner.so
%{_libdir}/%{pname}/mod_authz_user.so
%{_libdir}/%{pname}/mod_autoindex.so
%{_libdir}/%{pname}/mod_bucketeer.so
%{_libdir}/%{pname}/mod_buffer.so
%{_libdir}/%{pname}/mod_cache.so
%{_libdir}/%{pname}/mod_cache_disk.so
%{_libdir}/%{pname}/mod_cache_socache.so
%{_libdir}/%{pname}/mod_case_filter.so
%{_libdir}/%{pname}/mod_case_filter_in.so
%{_libdir}/%{pname}/mod_charset_lite.so
%{_libdir}/%{pname}/mod_data.so
%{_libdir}/%{pname}/mod_dav.so
%{_libdir}/%{pname}/mod_dav_fs.so
%{_libdir}/%{pname}/mod_dav_lock.so
%{_libdir}/%{pname}/mod_dbd.so
%{_libdir}/%{pname}/mod_deflate.so
%{_libdir}/%{pname}/mod_dialup.so
%{_libdir}/%{pname}/mod_dir.so
%{_libdir}/%{pname}/mod_dumpio.so
%{_libdir}/%{pname}/mod_echo.so
%{_libdir}/%{pname}/mod_env.so
%{_libdir}/%{pname}/mod_expires.so
%{_libdir}/%{pname}/mod_ext_filter.so
%{_libdir}/%{pname}/mod_file_cache.so
%{_libdir}/%{pname}/mod_filter.so
%{_libdir}/%{pname}/mod_headers.so
%{_libdir}/%{pname}/mod_heartmonitor.so
%{_libdir}/%{pname}/mod_imagemap.so
%{_libdir}/%{pname}/mod_include.so
%{_libdir}/%{pname}/mod_info.so
%{_libdir}/%{pname}/mod_lbmethod_bybusyness.so
%{_libdir}/%{pname}/mod_lbmethod_byrequests.so
%{_libdir}/%{pname}/mod_lbmethod_bytraffic.so
%{_libdir}/%{pname}/mod_lbmethod_heartbeat.so
%{_libdir}/%{pname}/mod_ldap.so
%{_libdir}/%{pname}/mod_log_config.so
%{_libdir}/%{pname}/mod_log_debug.so
%{_libdir}/%{pname}/mod_log_forensic.so
%{_libdir}/%{pname}/mod_logio.so
%{_libdir}/%{pname}/mod_lua.so
%{_libdir}/%{pname}/mod_macro.so
%{_libdir}/%{pname}/mod_mime.so
%{_libdir}/%{pname}/mod_mime_magic.so
%{_libdir}/%{pname}/mod_negotiation.so
%{_libdir}/%{pname}/mod_optional_fn_export.so
%{_libdir}/%{pname}/mod_optional_fn_import.so
%{_libdir}/%{pname}/mod_optional_hook_export.so
%{_libdir}/%{pname}/mod_optional_hook_import.so
%{_libdir}/%{pname}/mod_proxy.so
%{_libdir}/%{pname}/mod_proxy_ajp.so
%{_libdir}/%{pname}/mod_proxy_balancer.so
%{_libdir}/%{pname}/mod_proxy_connect.so
%{_libdir}/%{pname}/mod_proxy_express.so
%{_libdir}/%{pname}/mod_proxy_fcgi.so
%{_libdir}/%{pname}/mod_proxy_fdpass.so
%{_libdir}/%{pname}/mod_proxy_ftp.so
%{_libdir}/%{pname}/mod_proxy_html.so
%{_libdir}/%{pname}/mod_proxy_http.so
%{_libdir}/%{pname}/mod_proxy_scgi.so
%{_libdir}/%{pname}/mod_proxy_wstunnel.so
%{_libdir}/%{pname}/mod_ratelimit.so
%{_libdir}/%{pname}/mod_reflector.so
%{_libdir}/%{pname}/mod_remoteip.so
%{_libdir}/%{pname}/mod_reqtimeout.so
%{_libdir}/%{pname}/mod_request.so
%{_libdir}/%{pname}/mod_rewrite.so
%{_libdir}/%{pname}/mod_sed.so
%{_libdir}/%{pname}/mod_session.so
%{_libdir}/%{pname}/mod_session_cookie.so
%{_libdir}/%{pname}/mod_session_crypto.so
%{_libdir}/%{pname}/mod_session_dbd.so
%{_libdir}/%{pname}/mod_setenvif.so
%{_libdir}/%{pname}/mod_slotmem_plain.so
%{_libdir}/%{pname}/mod_slotmem_shm.so
%{_libdir}/%{pname}/mod_socache_dbm.so
%{_libdir}/%{pname}/mod_socache_memcache.so
%{_libdir}/%{pname}/mod_socache_shmcb.so
%{_libdir}/%{pname}/mod_speling.so
%{_libdir}/%{pname}/mod_ssl.so
%{_libdir}/%{pname}/mod_status.so
%{_libdir}/%{pname}/mod_substitute.so
%{_libdir}/%{pname}/mod_suexec.so
%{_libdir}/%{pname}/mod_unique_id.so
%{_libdir}/%{pname}/mod_userdir.so
%{_libdir}/%{pname}/mod_usertrack.so
%{_libdir}/%{pname}/mod_version.so
%{_libdir}/%{pname}/mod_vhost_alias.so
%{_libdir}/%{pname}/mod_watchdog.so
%{_libdir}/%{pname}/mod_xml2enc.so
%dir %{installbuilddir}
%dir %{_prefix}/share/%{pname}
%{_prefix}/share/%{pname}/apache-20-22-upgrade
%{_prefix}/share/%{pname}/get_module_list
%{_prefix}/share/%{pname}/get_includes
%{_prefix}/share/%{pname}/find_httpd2_includes
%{_prefix}/share/%{pname}/find_mpm
%{_prefix}/share/%{pname}/load_configuration
%{_prefix}/share/%{pname}/sysconf_addword
%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/%{name}
%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/%{name}-ssl

%if %prefork

%files prefork
%defattr(-,root,root)
%{_sbindir}/%{httpd}-prefork
%dir %{_libdir}/%{pname}-prefork
# hardcoded list so we do not lose mods by accident
%{_libdir}/%{pname}-prefork/mod_access_compat.so
%{_libdir}/%{pname}-prefork/mod_actions.so
%{_libdir}/%{pname}-prefork/mod_alias.so
%{_libdir}/%{pname}-prefork/mod_allowmethods.so
%{_libdir}/%{pname}-prefork/mod_asis.so
%{_libdir}/%{pname}-prefork/mod_auth_basic.so
%{_libdir}/%{pname}-prefork/mod_auth_digest.so
%{_libdir}/%{pname}-prefork/mod_auth_form.so
%{_libdir}/%{pname}-prefork/mod_authn_anon.so
%{_libdir}/%{pname}-prefork/mod_authn_core.so
%{_libdir}/%{pname}-prefork/mod_authn_dbd.so
%{_libdir}/%{pname}-prefork/mod_authn_dbm.so
%{_libdir}/%{pname}-prefork/mod_authn_file.so
%{_libdir}/%{pname}-prefork/mod_authn_socache.so
%{_libdir}/%{pname}-prefork/mod_authnz_fcgi.so
%{_libdir}/%{pname}-prefork/mod_authnz_ldap.so
%{_libdir}/%{pname}-prefork/mod_authz_core.so
%{_libdir}/%{pname}-prefork/mod_authz_dbd.so
%{_libdir}/%{pname}-prefork/mod_authz_dbm.so
%{_libdir}/%{pname}-prefork/mod_authz_groupfile.so
%{_libdir}/%{pname}-prefork/mod_authz_host.so
%{_libdir}/%{pname}-prefork/mod_authz_owner.so
%{_libdir}/%{pname}-prefork/mod_authz_user.so
%{_libdir}/%{pname}-prefork/mod_autoindex.so
%{_libdir}/%{pname}-prefork/mod_bucketeer.so
%{_libdir}/%{pname}-prefork/mod_buffer.so
%{_libdir}/%{pname}-prefork/mod_cache.so
%{_libdir}/%{pname}-prefork/mod_cache_disk.so
%{_libdir}/%{pname}-prefork/mod_cache_socache.so
%{_libdir}/%{pname}-prefork/mod_case_filter.so
%{_libdir}/%{pname}-prefork/mod_case_filter_in.so
%{_libdir}/%{pname}-prefork/mod_cgi.so
%{_libdir}/%{pname}-prefork/mod_charset_lite.so
%{_libdir}/%{pname}-prefork/mod_data.so
%{_libdir}/%{pname}-prefork/mod_dav.so
%{_libdir}/%{pname}-prefork/mod_dav_fs.so
%{_libdir}/%{pname}-prefork/mod_dav_lock.so
%{_libdir}/%{pname}-prefork/mod_dbd.so
%{_libdir}/%{pname}-prefork/mod_deflate.so
%{_libdir}/%{pname}-prefork/mod_dialup.so
%{_libdir}/%{pname}-prefork/mod_dir.so
%{_libdir}/%{pname}-prefork/mod_dumpio.so
%{_libdir}/%{pname}-prefork/mod_echo.so
%{_libdir}/%{pname}-prefork/mod_env.so
%{_libdir}/%{pname}-prefork/mod_expires.so
%{_libdir}/%{pname}-prefork/mod_ext_filter.so
%{_libdir}/%{pname}-prefork/mod_file_cache.so
%{_libdir}/%{pname}-prefork/mod_filter.so
%{_libdir}/%{pname}-prefork/mod_headers.so
%{_libdir}/%{pname}-prefork/mod_heartmonitor.so
%{_libdir}/%{pname}-prefork/mod_imagemap.so
%{_libdir}/%{pname}-prefork/mod_include.so
%{_libdir}/%{pname}-prefork/mod_info.so
%{_libdir}/%{pname}-prefork/mod_lbmethod_bybusyness.so
%{_libdir}/%{pname}-prefork/mod_lbmethod_byrequests.so
%{_libdir}/%{pname}-prefork/mod_lbmethod_bytraffic.so
%{_libdir}/%{pname}-prefork/mod_lbmethod_heartbeat.so
%{_libdir}/%{pname}-prefork/mod_ldap.so
%{_libdir}/%{pname}-prefork/mod_log_config.so
%{_libdir}/%{pname}-prefork/mod_log_debug.so
%{_libdir}/%{pname}-prefork/mod_log_forensic.so
%{_libdir}/%{pname}-prefork/mod_logio.so
%{_libdir}/%{pname}-prefork/mod_lua.so
%{_libdir}/%{pname}-prefork/mod_macro.so
%{_libdir}/%{pname}-prefork/mod_mime.so
%{_libdir}/%{pname}-prefork/mod_mime_magic.so
%{_libdir}/%{pname}-prefork/mod_negotiation.so
%{_libdir}/%{pname}-prefork/mod_optional_fn_export.so
%{_libdir}/%{pname}-prefork/mod_optional_fn_import.so
%{_libdir}/%{pname}-prefork/mod_optional_hook_export.so
%{_libdir}/%{pname}-prefork/mod_optional_hook_import.so
%{_libdir}/%{pname}-prefork/mod_proxy.so
%{_libdir}/%{pname}-prefork/mod_proxy_ajp.so
%{_libdir}/%{pname}-prefork/mod_proxy_balancer.so
%{_libdir}/%{pname}-prefork/mod_proxy_connect.so
%{_libdir}/%{pname}-prefork/mod_proxy_express.so
%{_libdir}/%{pname}-prefork/mod_proxy_fcgi.so
%{_libdir}/%{pname}-prefork/mod_proxy_fdpass.so
%{_libdir}/%{pname}-prefork/mod_proxy_ftp.so
%{_libdir}/%{pname}-prefork/mod_proxy_html.so
%{_libdir}/%{pname}-prefork/mod_proxy_http.so
%{_libdir}/%{pname}-prefork/mod_proxy_scgi.so
%{_libdir}/%{pname}-prefork/mod_proxy_wstunnel.so
%{_libdir}/%{pname}-prefork/mod_ratelimit.so
%{_libdir}/%{pname}-prefork/mod_reflector.so
%{_libdir}/%{pname}-prefork/mod_remoteip.so
%{_libdir}/%{pname}-prefork/mod_reqtimeout.so
%{_libdir}/%{pname}-prefork/mod_request.so
%{_libdir}/%{pname}-prefork/mod_rewrite.so
%{_libdir}/%{pname}-prefork/mod_sed.so
%{_libdir}/%{pname}-prefork/mod_session.so
%{_libdir}/%{pname}-prefork/mod_session_cookie.so
%{_libdir}/%{pname}-prefork/mod_session_crypto.so
%{_libdir}/%{pname}-prefork/mod_session_dbd.so
%{_libdir}/%{pname}-prefork/mod_setenvif.so
%{_libdir}/%{pname}-prefork/mod_slotmem_plain.so
%{_libdir}/%{pname}-prefork/mod_slotmem_shm.so
%{_libdir}/%{pname}-prefork/mod_socache_dbm.so
%{_libdir}/%{pname}-prefork/mod_socache_memcache.so
%{_libdir}/%{pname}-prefork/mod_socache_shmcb.so
%{_libdir}/%{pname}-prefork/mod_speling.so
%{_libdir}/%{pname}-prefork/mod_ssl.so
%{_libdir}/%{pname}-prefork/mod_status.so
%{_libdir}/%{pname}-prefork/mod_substitute.so
%{_libdir}/%{pname}-prefork/mod_suexec.so
%{_libdir}/%{pname}-prefork/mod_unique_id.so
%{_libdir}/%{pname}-prefork/mod_userdir.so
%{_libdir}/%{pname}-prefork/mod_usertrack.so
%{_libdir}/%{pname}-prefork/mod_version.so
%{_libdir}/%{pname}-prefork/mod_vhost_alias.so
%{_libdir}/%{pname}-prefork/mod_watchdog.so
%{_libdir}/%{pname}-prefork/mod_xml2enc.so
%endif
%if %worker

%files worker
%defattr(-,root,root)
%{_sbindir}/%{httpd}-worker
%dir %{_libdir}/%{pname}-worker
# hardcoded list so we do not lose mods by accident
%{_libdir}/%{pname}-worker/mod_access_compat.so
%{_libdir}/%{pname}-worker/mod_actions.so
%{_libdir}/%{pname}-worker/mod_alias.so
%{_libdir}/%{pname}-worker/mod_allowmethods.so
%{_libdir}/%{pname}-worker/mod_asis.so
%{_libdir}/%{pname}-worker/mod_auth_basic.so
%{_libdir}/%{pname}-worker/mod_auth_digest.so
%{_libdir}/%{pname}-worker/mod_auth_form.so
%{_libdir}/%{pname}-worker/mod_authn_anon.so
%{_libdir}/%{pname}-worker/mod_authn_core.so
%{_libdir}/%{pname}-worker/mod_authn_dbd.so
%{_libdir}/%{pname}-worker/mod_authn_dbm.so
%{_libdir}/%{pname}-worker/mod_authn_file.so
%{_libdir}/%{pname}-worker/mod_authn_socache.so
%{_libdir}/%{pname}-worker/mod_authnz_fcgi.so
%{_libdir}/%{pname}-worker/mod_authnz_ldap.so
%{_libdir}/%{pname}-worker/mod_authz_core.so
%{_libdir}/%{pname}-worker/mod_authz_dbd.so
%{_libdir}/%{pname}-worker/mod_authz_dbm.so
%{_libdir}/%{pname}-worker/mod_authz_groupfile.so
%{_libdir}/%{pname}-worker/mod_authz_host.so
%{_libdir}/%{pname}-worker/mod_authz_owner.so
%{_libdir}/%{pname}-worker/mod_authz_user.so
%{_libdir}/%{pname}-worker/mod_autoindex.so
%{_libdir}/%{pname}-worker/mod_bucketeer.so
%{_libdir}/%{pname}-worker/mod_buffer.so
%{_libdir}/%{pname}-worker/mod_cache.so
%{_libdir}/%{pname}-worker/mod_cache_disk.so
%{_libdir}/%{pname}-worker/mod_cache_socache.so
%{_libdir}/%{pname}-worker/mod_case_filter.so
%{_libdir}/%{pname}-worker/mod_case_filter_in.so
%{_libdir}/%{pname}-worker/mod_cgid.so
%{_libdir}/%{pname}-worker/mod_charset_lite.so
%{_libdir}/%{pname}-worker/mod_data.so
%{_libdir}/%{pname}-worker/mod_dav.so
%{_libdir}/%{pname}-worker/mod_dav_fs.so
%{_libdir}/%{pname}-worker/mod_dav_lock.so
%{_libdir}/%{pname}-worker/mod_dbd.so
%{_libdir}/%{pname}-worker/mod_deflate.so
%{_libdir}/%{pname}-worker/mod_dialup.so
%{_libdir}/%{pname}-worker/mod_dir.so
%{_libdir}/%{pname}-worker/mod_dumpio.so
%{_libdir}/%{pname}-worker/mod_echo.so
%{_libdir}/%{pname}-worker/mod_env.so
%{_libdir}/%{pname}-worker/mod_expires.so
%{_libdir}/%{pname}-worker/mod_ext_filter.so
%{_libdir}/%{pname}-worker/mod_file_cache.so
%{_libdir}/%{pname}-worker/mod_filter.so
%{_libdir}/%{pname}-worker/mod_headers.so
%{_libdir}/%{pname}-worker/mod_heartmonitor.so
%{_libdir}/%{pname}-worker/mod_imagemap.so
%{_libdir}/%{pname}-worker/mod_include.so
%{_libdir}/%{pname}-worker/mod_info.so
%{_libdir}/%{pname}-worker/mod_lbmethod_bybusyness.so
%{_libdir}/%{pname}-worker/mod_lbmethod_byrequests.so
%{_libdir}/%{pname}-worker/mod_lbmethod_bytraffic.so
%{_libdir}/%{pname}-worker/mod_lbmethod_heartbeat.so
%{_libdir}/%{pname}-worker/mod_ldap.so
%{_libdir}/%{pname}-worker/mod_log_config.so
%{_libdir}/%{pname}-worker/mod_log_debug.so
%{_libdir}/%{pname}-worker/mod_log_forensic.so
%{_libdir}/%{pname}-worker/mod_logio.so
%{_libdir}/%{pname}-worker/mod_lua.so
%{_libdir}/%{pname}-worker/mod_macro.so
%{_libdir}/%{pname}-worker/mod_mime.so
%{_libdir}/%{pname}-worker/mod_mime_magic.so
%{_libdir}/%{pname}-worker/mod_negotiation.so
%{_libdir}/%{pname}-worker/mod_optional_fn_export.so
%{_libdir}/%{pname}-worker/mod_optional_fn_import.so
%{_libdir}/%{pname}-worker/mod_optional_hook_export.so
%{_libdir}/%{pname}-worker/mod_optional_hook_import.so
%{_libdir}/%{pname}-worker/mod_proxy.so
%{_libdir}/%{pname}-worker/mod_proxy_ajp.so
%{_libdir}/%{pname}-worker/mod_proxy_balancer.so
%{_libdir}/%{pname}-worker/mod_proxy_connect.so
%{_libdir}/%{pname}-worker/mod_proxy_express.so
%{_libdir}/%{pname}-worker/mod_proxy_fcgi.so
%{_libdir}/%{pname}-worker/mod_proxy_fdpass.so
%{_libdir}/%{pname}-worker/mod_proxy_ftp.so
%{_libdir}/%{pname}-worker/mod_proxy_html.so
%{_libdir}/%{pname}-worker/mod_proxy_http.so
%{_libdir}/%{pname}-worker/mod_proxy_scgi.so
%{_libdir}/%{pname}-worker/mod_proxy_wstunnel.so
%{_libdir}/%{pname}-worker/mod_ratelimit.so
%{_libdir}/%{pname}-worker/mod_reflector.so
%{_libdir}/%{pname}-worker/mod_remoteip.so
%{_libdir}/%{pname}-worker/mod_reqtimeout.so
%{_libdir}/%{pname}-worker/mod_request.so
%{_libdir}/%{pname}-worker/mod_rewrite.so
%{_libdir}/%{pname}-worker/mod_sed.so
%{_libdir}/%{pname}-worker/mod_session.so
%{_libdir}/%{pname}-worker/mod_session_cookie.so
%{_libdir}/%{pname}-worker/mod_session_crypto.so
%{_libdir}/%{pname}-worker/mod_session_dbd.so
%{_libdir}/%{pname}-worker/mod_setenvif.so
%{_libdir}/%{pname}-worker/mod_slotmem_plain.so
%{_libdir}/%{pname}-worker/mod_slotmem_shm.so
%{_libdir}/%{pname}-worker/mod_socache_dbm.so
%{_libdir}/%{pname}-worker/mod_socache_memcache.so
%{_libdir}/%{pname}-worker/mod_socache_shmcb.so
%{_libdir}/%{pname}-worker/mod_speling.so
%{_libdir}/%{pname}-worker/mod_ssl.so
%{_libdir}/%{pname}-worker/mod_status.so
%{_libdir}/%{pname}-worker/mod_substitute.so
%{_libdir}/%{pname}-worker/mod_suexec.so
%{_libdir}/%{pname}-worker/mod_unique_id.so
%{_libdir}/%{pname}-worker/mod_userdir.so
%{_libdir}/%{pname}-worker/mod_usertrack.so
%{_libdir}/%{pname}-worker/mod_version.so
%{_libdir}/%{pname}-worker/mod_vhost_alias.so
%{_libdir}/%{pname}-worker/mod_watchdog.so
%{_libdir}/%{pname}-worker/mod_xml2enc.so
%endif
%if %event

%files event
%defattr(-,root,root)
%{_sbindir}/%{httpd}-event
%dir %{_libdir}/%{pname}-event
# hardcoded list so we do not lose mods by accident
%{_libdir}/%{pname}-event/mod_access_compat.so
%{_libdir}/%{pname}-event/mod_actions.so
%{_libdir}/%{pname}-event/mod_alias.so
%{_libdir}/%{pname}-event/mod_allowmethods.so
%{_libdir}/%{pname}-event/mod_asis.so
%{_libdir}/%{pname}-event/mod_auth_basic.so
%{_libdir}/%{pname}-event/mod_auth_digest.so
%{_libdir}/%{pname}-event/mod_auth_form.so
%{_libdir}/%{pname}-event/mod_authn_anon.so
%{_libdir}/%{pname}-event/mod_authn_core.so
%{_libdir}/%{pname}-event/mod_authn_dbd.so
%{_libdir}/%{pname}-event/mod_authn_dbm.so
%{_libdir}/%{pname}-event/mod_authn_file.so
%{_libdir}/%{pname}-event/mod_authn_socache.so
%{_libdir}/%{pname}-event/mod_authnz_fcgi.so
%{_libdir}/%{pname}-event/mod_authnz_ldap.so
%{_libdir}/%{pname}-event/mod_authz_core.so
%{_libdir}/%{pname}-event/mod_authz_dbd.so
%{_libdir}/%{pname}-event/mod_authz_dbm.so
%{_libdir}/%{pname}-event/mod_authz_groupfile.so
%{_libdir}/%{pname}-event/mod_authz_host.so
%{_libdir}/%{pname}-event/mod_authz_owner.so
%{_libdir}/%{pname}-event/mod_authz_user.so
%{_libdir}/%{pname}-event/mod_autoindex.so
%{_libdir}/%{pname}-event/mod_bucketeer.so
%{_libdir}/%{pname}-event/mod_buffer.so
%{_libdir}/%{pname}-event/mod_cache.so
%{_libdir}/%{pname}-event/mod_cache_disk.so
%{_libdir}/%{pname}-event/mod_cache_socache.so
%{_libdir}/%{pname}-event/mod_case_filter.so
%{_libdir}/%{pname}-event/mod_case_filter_in.so
%{_libdir}/%{pname}-event/mod_cgid.so
%{_libdir}/%{pname}-event/mod_charset_lite.so
%{_libdir}/%{pname}-event/mod_data.so
%{_libdir}/%{pname}-event/mod_dav.so
%{_libdir}/%{pname}-event/mod_dav_fs.so
%{_libdir}/%{pname}-event/mod_dav_lock.so
%{_libdir}/%{pname}-event/mod_dbd.so
%{_libdir}/%{pname}-event/mod_deflate.so
%{_libdir}/%{pname}-event/mod_dialup.so
%{_libdir}/%{pname}-event/mod_dir.so
%{_libdir}/%{pname}-event/mod_dumpio.so
%{_libdir}/%{pname}-event/mod_echo.so
%{_libdir}/%{pname}-event/mod_env.so
%{_libdir}/%{pname}-event/mod_expires.so
%{_libdir}/%{pname}-event/mod_ext_filter.so
%{_libdir}/%{pname}-event/mod_file_cache.so
%{_libdir}/%{pname}-event/mod_filter.so
%{_libdir}/%{pname}-event/mod_headers.so
%{_libdir}/%{pname}-event/mod_heartmonitor.so
%{_libdir}/%{pname}-event/mod_imagemap.so
%{_libdir}/%{pname}-event/mod_include.so
%{_libdir}/%{pname}-event/mod_info.so
%{_libdir}/%{pname}-event/mod_lbmethod_bybusyness.so
%{_libdir}/%{pname}-event/mod_lbmethod_byrequests.so
%{_libdir}/%{pname}-event/mod_lbmethod_bytraffic.so
%{_libdir}/%{pname}-event/mod_lbmethod_heartbeat.so
%{_libdir}/%{pname}-event/mod_ldap.so
%{_libdir}/%{pname}-event/mod_log_config.so
%{_libdir}/%{pname}-event/mod_log_debug.so
%{_libdir}/%{pname}-event/mod_log_forensic.so
%{_libdir}/%{pname}-event/mod_logio.so
%{_libdir}/%{pname}-event/mod_lua.so
%{_libdir}/%{pname}-event/mod_macro.so
%{_libdir}/%{pname}-event/mod_mime.so
%{_libdir}/%{pname}-event/mod_mime_magic.so
%{_libdir}/%{pname}-event/mod_negotiation.so
%{_libdir}/%{pname}-event/mod_optional_fn_export.so
%{_libdir}/%{pname}-event/mod_optional_fn_import.so
%{_libdir}/%{pname}-event/mod_optional_hook_export.so
%{_libdir}/%{pname}-event/mod_optional_hook_import.so
%{_libdir}/%{pname}-event/mod_proxy.so
%{_libdir}/%{pname}-event/mod_proxy_ajp.so
%{_libdir}/%{pname}-event/mod_proxy_balancer.so
%{_libdir}/%{pname}-event/mod_proxy_connect.so
%{_libdir}/%{pname}-event/mod_proxy_express.so
%{_libdir}/%{pname}-event/mod_proxy_fcgi.so
%{_libdir}/%{pname}-event/mod_proxy_fdpass.so
%{_libdir}/%{pname}-event/mod_proxy_ftp.so
%{_libdir}/%{pname}-event/mod_proxy_html.so
%{_libdir}/%{pname}-event/mod_proxy_http.so
%{_libdir}/%{pname}-event/mod_proxy_scgi.so
%{_libdir}/%{pname}-event/mod_proxy_wstunnel.so
%{_libdir}/%{pname}-event/mod_ratelimit.so
%{_libdir}/%{pname}-event/mod_reflector.so
%{_libdir}/%{pname}-event/mod_remoteip.so
%{_libdir}/%{pname}-event/mod_reqtimeout.so
%{_libdir}/%{pname}-event/mod_request.so
%{_libdir}/%{pname}-event/mod_rewrite.so
%{_libdir}/%{pname}-event/mod_sed.so
%{_libdir}/%{pname}-event/mod_session.so
%{_libdir}/%{pname}-event/mod_session_cookie.so
%{_libdir}/%{pname}-event/mod_session_crypto.so
%{_libdir}/%{pname}-event/mod_session_dbd.so
%{_libdir}/%{pname}-event/mod_setenvif.so
%{_libdir}/%{pname}-event/mod_slotmem_plain.so
%{_libdir}/%{pname}-event/mod_slotmem_shm.so
%{_libdir}/%{pname}-event/mod_socache_dbm.so
%{_libdir}/%{pname}-event/mod_socache_memcache.so
%{_libdir}/%{pname}-event/mod_socache_shmcb.so
%{_libdir}/%{pname}-event/mod_speling.so
%{_libdir}/%{pname}-event/mod_ssl.so
%{_libdir}/%{pname}-event/mod_status.so
%{_libdir}/%{pname}-event/mod_substitute.so
%{_libdir}/%{pname}-event/mod_suexec.so
%{_libdir}/%{pname}-event/mod_unique_id.so
%{_libdir}/%{pname}-event/mod_userdir.so
%{_libdir}/%{pname}-event/mod_usertrack.so
%{_libdir}/%{pname}-event/mod_version.so
%{_libdir}/%{pname}-event/mod_vhost_alias.so
%{_libdir}/%{pname}-event/mod_watchdog.so
%{_libdir}/%{pname}-event/mod_xml2enc.so
%endif
%if %itk

%files itk
%defattr(-,root,root)
%{_sbindir}/%{httpd}-itk
%dir %{_libdir}/%{pname}-itk
%{_libdir}/%{pname}-itk/mod_*.so
%endif

%files devel -f filelist-devel
%defattr(-,root,root)
%dir %{_prefix}/share/%{pname}
%dir %{installbuilddir}
%dir %{includedir}
%{_bindir}/apxs%{vers}
%{_sbindir}/apxs%{vers}

%files doc
%defattr(-,root,root)
%doc %{manualdir}
%dir %{sysconfdir}
%dir %{sysconfdir}/conf.d
%config %{sysconfdir}/conf.d/manual.conf

%files example-pages
%defattr(-,root,root)
%config(noreplace) %{htdocsdir}/index.htm*
%config(noreplace) %{htdocsdir}/favicon.ico
%config(noreplace) %{htdocsdir}/robots.txt

%files utils
%defattr(-,root,root)
%doc %{_mandir}/man?/ab%{vers}.?.*
%doc %{_mandir}/man?/dbmmanage%{vers}.?.*
%doc %{_mandir}/man?/htdbm%{vers}.?.*
%doc %{_mandir}/man?/htdigest%{vers}.?.*
%doc %{_mandir}/man?/htpasswd%{vers}.?.*
%doc %{_mandir}/man?/httxt2dbm%{vers}.?.*
%doc %{_mandir}/man?/logresolve%{vers}.?.*
%doc %{_mandir}/man?/rotatelogs%{vers}.?.*
%doc %{_mandir}/man?/suexec%{vers}.?.*
%{_sbindir}/fcgistarter
%{_mandir}/man8/fcgistarter2.8.*
%{_bindir}/check_forensic%{vers}
%{_bindir}/dbmmanage%{vers}
%{_bindir}/gensslcert
%{_bindir}/htdbm%{vers}
%{_bindir}/htdigest%{vers}
%{_bindir}/htpasswd%{vers}
%{_bindir}/split-logfile%{vers}
%{_bindir}/ab%{vers}
%{_bindir}/httxt2dbm
%{_sbindir}/logresolve.pl%{vers}
%{_bindir}/logresolve%{vers}
%{_sbindir}/rotatelogs%{vers}
%verify(not mode) %attr(0755,root,root) %_sbindir/suexec2
%if %prefork

%post prefork
/usr/share/%{pname}/get_module_list &>/dev/null
exit 0
%endif
%if %worker

%post worker
/usr/share/%{pname}/get_module_list &>/dev/null
exit 0
%endif
%if %event

%post event
/usr/share/%{pname}/get_module_list &>/dev/null
exit 0
%endif
%if %itk

%post itk
/usr/share/%{pname}/get_module_list &>/dev/null
exit 0
%endif

#  
#  O/ ._ .__    / ._  _  __|_
#  /O |_)|(/_  /  |_)(_)_> |_
#     |           |
#  

%pre
%if %{?suse_version:0}%{!?suse_version:1}
# on Fedora, add the "apache" user
if ! /usr/bin/getent passwd %httpduser &>/dev/null; then
  echo "Creating %httpduser user"
  /usr/sbin/useradd -c "Apache" -u 48 \
        -s /sbin/nologin -r -d %{localstatedir} %httpduser 2> /dev/null || :
fi
%endif
%if 0%{?suse_version} >= 1210
%service_add_pre apache2.service
%endif

%preun
%if 0%{?suse_version} >= 1210
%service_del_preun apache2.service
%endif
# removing the symlink in case of uninstall (not upgrade) [bsc#1041830]
if [ $1 -eq 0 ]; then
  for i in %{_sbindir}/%{httpd} \
	 %{installbuilddir}/config_vars.mk
  do
	test -L $i && rm $i
  done
fi
exit 0

%postun
%if 0%{?suse_version} >= 1210
%service_del_postun apache2.service
%endif
#if %suse_version > 810
#restart_on_update %{pname}
#endif
%insserv_cleanup

%post
%if 0%{?suse_version} <= 1130
%run_permissions
%else
%set_permissions /usr/sbin/suexec2 || echo "Please check /etc/permissions.local for settings of /usr/sbin/suexec2 ."
%endif
%if 0%{?suse_version}
# a group wwwadmin has existed in the distant past, and it was renamed to www
if grep -q "^wwwadmin:" /etc/group; then
	groupmod -n www wwwadmin 2>/dev/null ||:
	usermod -g %httpdgroup %httpduser 2>/dev/null ||:
	usermod -s /bin/false %httpduser 2>/dev/null ||:
fi
%endif
tmpdir=$(mktemp -d etc/%{pname}/%{pname}-post.XXXXXX); test $? = 0 || { echo >&2 Could not create tmpdir. Exiting; exit 1; }
tmpfile=$tmpdir/tmpfile
if test -s etc/sysconfig/%{pname} && grep -q "^LOADMODULES" etc/sysconfig/%{pname}; then 
	sed "s/LOADMODULES/APACHE_MODULES/" etc/sysconfig/%{pname} >| $tmpfile \
		&& cp $tmpfile etc/sysconfig/%{pname}
fi
%{fillup_only apache2}
# Update ?
if [ ${FIRST_ARG:-0} -gt 1 ]; then
	# update from package with the old near-monolithic conf file?
	if [ -s ./%{sysconfdir}/httpd.conf.default -a -s ./%{sysconfdir}/httpd.conf.rpmnew ]; then 
		diff -u .%{sysconfdir}/httpd.conf.default .%{sysconfdir}/httpd.conf \
		  > $tmpdir/httpd.conf.dif ||:
		cp -p $tmpdir/httpd.conf.dif ./%{sysconfdir}/httpd.conf var/adm/backup/
		archive_conf=$(old var/adm/backup/httpd.conf     2>/dev/null); archive_conf=${archive_conf##*/}
		 archive_dif=$(old var/adm/backup/httpd.conf.dif 2>/dev/null);  archive_dif=${archive_dif##*/}
	fi
	#
	sed "
		# generated files were renamed from suse_* to sysconfig.d/*
		s|\(^Include /etc/apache2\)/suse_\(\(include\|loadmodule\|global\).conf\)|\1/sysconfig.d/\2|

		# the access_log configuration is now configurable
		s|^CustomLog /var/log/apache2/access_log.*|# &|

		# group of wwwrun has changed
		s|^Group nogroup|Group www|

	" < ./%{sysconfdir}/httpd.conf > $tmpfile
	chmod --reference=./%{sysconfdir}/httpd.conf $tmpfile
	chown --reference=./%{sysconfdir}/httpd.conf $tmpfile
	cmp -s $tmpfile ./%{sysconfdir}/httpd.conf || cp -p $tmpfile ./%{sysconfdir}/httpd.conf
fi

rm -rf $tmpdir
/usr/share/%{pname}/apache-20-22-upgrade
/usr/share/%{pname}/get_module_list &>/dev/null
%if 0%{?suse_version} >= 1210
%service_add_post apache2.service
%endif
exit 0

%verifyscript
%verify_permissions -e %{_sbindir}/suexec2

%clean
if ! test -f /.buildenv; then
	rm -rf $RPM_BUILD_ROOT
fi

%changelog