apache2/apache2.spec

979 lines
32 KiB
RPMSpec
Raw Normal View History

#
# spec file for package apache2
#
# Copyright (c) 2015 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/
#
%define pname apache2
%define vers 2
%define httpd httpd2
%define apache_mmn %(test -s %{SOURCE0} && { echo -n apache_mmn_; bzcat %{SOURCE0} | awk '/^#define MODULE_MAGIC_NUMBER_MAJOR/ {printf "%d", $3}'; })
%define default_mpm prefork
%{!?prefork:%define prefork 1}
%{!?worker:%define worker 1}
%{!?event:%define event 1}
%define mpms_to_build %(test %{prefork} = 1 && printf prefork) %(test %{worker} = 1 && printf worker) %(test %{event} = 1 && printf event)
# dir names
%define datadir /srv/www
%define htdocsdir %{datadir}/htdocs
%define manualdir %{_datadir}/%{pname}/manual
%define errordir %{_datadir}/%{pname}/error
%define iconsdir %{_datadir}/%{pname}/icons
%define cgidir %{datadir}/cgi-bin
%define localstatedir %{_localstatedir}/lib/%{pname}
%define proxycachedir %{_localstatedir}/cache/%{pname}
%define logfiledir %{_localstatedir}/log/%{pname}
%define sysconfdir %{_sysconfdir}/%{pname}
%define includedir %{_includedir}/%{pname}
%define libexecdir %{_libdir}/%{pname}
%define installbuilddir %{_datadir}/%{pname}/build
%define userdir public_html
%define suexec_safepath %{_prefix}/local/bin:%{_prefix}/bin:/bin
%define VENDOR SUSE
%define platform_string Linux/%{VENDOR}
%define realver 2.4.11
%define httpduser wwwrun
%define httpdgroup www
%if 0%{?suse_version} >= 1220
%define runtimedir /run
%define mods_static access_compat unixd systemd
%else
%define runtimedir %{_localstatedir}/run
%define mods_static access_compat unixd
%endif
Name: apache2
Accepting request 281475 from home:elvigia:branches:Apache - remove obsolete patches * httpd-2.4.10-check_null_pointer_dereference.patch * httpd-event-deadlock.patch * httpd-2.4.x-bnc871310-CVE-2013-5704-mod_headers_chunked_requests.patch * httpd-2.4.x-bnc909715-CVE-2014-8109-mod_lua_handling_of_Require_line.patch - Apache 2.4.11 *) SECURITY: CVE-2014-3583 (cve.mitre.org) mod_proxy_fcgi: Fix a potential crash due to buffer over-read, with response headers' size above 8K. [Yann Ylavic, Jeff Trawick] *) SECURITY: CVE-2014-3581 (cve.mitre.org) mod_cache: Avoid a crash when Content-Type has an empty value. PR 56924. [Mark Montague <mark catseye.org>, Jan Kaluza] *) SECURITY: CVE-2014-8109 (cve.mitre.org) mod_lua: Fix handling of the Require line when a LuaAuthzProvider is used in multiple Require directives with different arguments. PR57204 [Edward Lu <Chaosed0 gmail.com>] *) SECURITY: CVE-2013-5704 (cve.mitre.org) core: HTTP trailers could be used to replace HTTP headers late during request processing, potentially undoing or otherwise confusing modules that examined or modified request headers earlier. Adds "MergeTrailers" directive to restore legacy behavior. [Edward Lu, Yann Ylavic, Joe Orton, Eric Covener] *) mod_ssl: New directive SSLSessionTickets (On|Off). The directive controls the use of TLS session tickets (RFC 5077), default value is "On" (unchanged behavior). Session ticket creation uses a random key created during web server startup and recreated during restarts. No other key recreation mechanism is available currently. Therefore using session tickets without restarting the web server with an appropriate frequency OBS-URL: https://build.opensuse.org/request/show/281475 OBS-URL: https://build.opensuse.org/package/show/Apache/apache2?expand=0&rev=429
2015-01-16 16:52:19 +01:00
Version: 2.4.11
Release: 0
Summary: The Apache Web Server Version 2.4
License: Apache-2.0
Group: Productivity/Networking/Web/Servers
Url: http://httpd.apache.org/
Source0: http://www.apache.org/dist/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
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
Source130: apache2-vhost.template
Source131: apache2-vhost-ssl.template
Source132: apache2-default-vhost.conf
Source133: apache2-default-vhost-ssl.conf
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.4.10-apachectl.patch
#Patch65: httpd-2.0.49-log_server_status.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.2.x-bnc690734.patch
Patch70: apache2-implicit-pointer-decl.patch
# PATCH-FEATURE-UPSTREAM apache2-mod_ssl_npn.patch dimstar@opensuse.org -- Add npn support to mod_ssl (needed for spdy)
#Patch108: apache2-mod_ssl_npn.patch
#Provides: apache2(mod_ssl+npn)
# PATCH-FEATURE-UPSTREAM httpd-2.4.3-mod_systemd.patch crrodriguez@opensuse.org simple module provides systemd integration.
Patch109: httpd-2.4.3-mod_systemd.patch
Patch111: httpd-visibility.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
Patch112: httpd-2.4.x-mod_lua_websocket_DoS.patch
BuildRequires: automake
BuildRequires: db-devel
BuildRequires: ed
BuildRequires: libapr-util1-devel
#Since 2.4.7 the event MPM requires apr 1.5.0 or later.
BuildRequires: libapr1-devel >= 1.5.0
BuildRequires: libcap-devel
#for mod_proxy_html and mod_xml2enc
BuildRequires: libxml2-devel
BuildRequires: lua-devel
BuildRequires: openldap2-devel
BuildRequires: openssl-devel >= 0.9.8a
BuildRequires: pcre-devel
BuildRequires: xz
BuildRequires: zlib-devel
Requires: %{_sysconfdir}/mime.types
Requires: %{pname}-MPM
Requires: logrotate
Requires(post): %insserv_prereq %fillup_prereq permissions pwdutils
Requires(post): %{name}-utils
Requires(post): fileutils
Requires(post): grep
Requires(post): sed
Requires(post): textutils
Recommends: apache2-%{default_mpm}
Provides: %{apache_mmn}
Provides: http_daemon
Provides: httpd
Provides: suse_help_viewer
Provides: %{name}-mod_macro = %{version}
Obsoletes: %{name}-mod_macro <= 1.2.1
Provides: apache = %{version}
Obsoletes: apache < 1.3.29
Obsoletes: mod_ssl < 2.8.16
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#for some reason the parser barfs if not conditional
%{?requires_ge:%requires_ge libapr1}
%{?requires_ge:%requires_ge libapr-util1}
%{?systemd_requires}
%if 0%{?suse_version} >= 1210
BuildRequires: pkgconfig
BuildRequires: pkgconfig(libsystemd-daemon)
BuildRequires: pkgconfig(systemd)
%endif
%description
This version of httpd is a major release of the 2.4 stable branch,
and represents the best available version of Apache HTTP Server.
New features include Loadable MPMs, major improvements to OCSP support,
mod_lua, Dynamic Reverse Proxy configuration, Improved Authentication/
Authorization, FastCGI Proxy, New Expression Parser, and a Small Object
Caching API.
See %{_docdir}/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
Requires: %{name} = %{version}
Provides: %{pname}-MPM
%endif
%if %prefork
%package prefork
Summary: Apache 2 "prefork" MPM (Multi-Processing Module)
Group: Productivity/Networking/Web/Servers
Requires: %{name} = %{version}
Provides: %{pname}-MPM
Provides: apache:%{_sbindir}/httpd
%endif
%if %event
%package event
Summary: Apache 2 event MPM (Multi-Processing Module)
Group: Productivity/Networking/Web/Servers
Requires: %{name} = %{version}
Provides: %{pname}-MPM
%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 (multi-Processing Module) is experimental, so it may or
may not work as expected.
It 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
%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
# Remove after 13.2 is out of support scope
Provides: apache-doc = %{version}
Obsoletes: apache-doc < %{version}
%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
# Remove after 13.2 is out of support scope
Provides: apache-example-pages
Obsoletes: apache-example-pages
%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
%setup -q -n httpd-%{realver}
%patch2 -p1
%patch23 -p1
#%patch65 -p1
%patch66 -p1
%patch67 -p1
%patch68 -p1
#%patch69
%patch70 -p1
#%patch108 -p1
%patch109 -p1
%patch111 -p1
%patch112 -p1
cat $RPM_SOURCE_DIR/SUSE-NOTICE >> NOTICE
# install READMEs
a=$(basename %{SOURCE22})
cp %{SOURCE22} ./${a##%{name}-}
b=$(basename %{SOURCE23})
cp %{SOURCE23} ./${b##%{name}-}
c=$(basename %{SOURCE24})
cp %{SOURCE24} ./${c##%{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
#
autoreconf -fiv
%build
function configure {
CFLAGS="%{optflags} -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 \
--with-pcre \
--enable-pie \
--enable-mods-shared=all \
--enable-mods-static="%{mods_static}" \
--enable-ssl=shared \
--disable-isapi \
--enable-deflate \
--enable-echo \
--enable-filter \
--enable-ext-filter \
--enable-charset-lite \
--enable-file-cache \
--enable-logio \
--enable-dumpio \
--enable-bucketeer \
--enable-case_filter \
--enable-case_filter_in \
--enable-imagemap \
--with-ldap \
--enable-ldap \
--enable-authnz_ldap \
--enable-proxy \
--enable-proxy-connect \
--enable-proxy-ftp \
--enable-proxy-http \
--enable-cache \
--enable-disk-cache \
--enable-mem-cache \
--enable-version \
--enable-dav-lock \
--enable-authn-alias \
--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
#
[ %{buildroot} != "/" ] && [ -d %{buildroot} ] && rm -rf %{buildroot};
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@%{_localstatedir}/run@%{runtimedir}@g" include/ap_config_layout.h
make CFLAGS="%{optflags} -fvisibility=hidden -fPIC \
-Wall \
-DDEFAULT_ERRORLOG='\"%{logfiledir}/error_log\"' " \
%{?_smp_mflags}
make DESTDIR=%{buildroot} install
#rm -rf %{buildroot}.$mpm.pre
#cp -a %{buildroot}/ %{buildroot}.$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 %{buildroot}/%{sysconfdir}/httpd-std.conf %{buildroot}/%{sysconfdir}/httpd-std.conf$mpm_suffix
#mv %{buildroot}/%{sysconfdir}/httpd2-prefork.conf %{buildroot}/%{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" \
< %{buildroot}/%{installbuilddir}/config_vars.mk \
> %{buildroot}/%{installbuilddir}/config_vars.mk$mpm_suffix
rm %{buildroot}/%{installbuilddir}/config_vars.mk
#rm -rf %{buildroot}.$mpm.post
#cp -a %{buildroot}/ %{buildroot}.$mpm.post
done
mkdir -p %{buildroot}/%{libexecdir}
# remove references to mpm type in config_vars
sed -e "s^%{_libdir}/%{pname}-%{default_mpm}^%{_libdir}/%{pname}^" \
-e "s/httpd$/%{httpd}-%{default_mpm}/" \
-e "s/%{pname}-%{default_mpm}/%{pname}/" \
< %{buildroot}/%{installbuilddir}/config_vars.mk-%{default_mpm} \
> %{buildroot}/%{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=%{buildroot}/%{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=%{buildroot}/%{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
# (most installation (to build root) has already been done in %%build)
#
# save MODULE_MAGIC_NUMBER
cat > %{buildroot}/%{_libdir}/%{pname}_MMN <<-EOF
#!/bin/sh
echo %{apache_mmn}
EOF
cp -p %{buildroot}/%{sysconfdir}/%{httpd}-%{default_mpm}.conf %{buildroot}/%{sysconfdir}/httpd.conf
cp -p %{buildroot}/%{sysconfdir}/httpd.conf ./httpd.conf.default
rm %{buildroot}/%{sysconfdir}/%{httpd}-*.conf
#
# create directories
mkdir -p %{buildroot}/%{_var}/adm/fillup-templates \
%{buildroot}/%{proxycachedir} \
%{buildroot}/%{localstatedir}
#
# support files
install -m 755 support/log_server_status %{buildroot}/%{_bindir}/log_server_status%{vers}
install -m 755 support/split-logfile %{buildroot}/%{_bindir}/split-logfile%{vers}
install -m 755 support/logresolve.pl %{buildroot}/%{_sbindir}/logresolve.pl%{vers}
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
install -m 644 $RPM_SOURCE_DIR/%{pname}.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/%{pname}
install -m 755 $RPM_SOURCE_DIR/apache2-check_forensic %{buildroot}/%{_bindir}/check_forensic%{vers}
#
# xml stuff
install -d %{buildroot}%{_datadir}/omc/svcinfo.d/
install -m 644 %{SOURCE48} %{buildroot}%{_datadir}/omc/svcinfo.d/
#
# ssl stuff
install -m 755 %{SOURCE25} %{buildroot}/%{_bindir}/
tar xjf %{SOURCE29} -C %{buildroot}/%{sysconfdir}
#
# init script and friends
mkdir -p %{buildroot}%{_sysconfdir}/init.d
install -m 744 $RPM_SOURCE_DIR/rc.%{pname} %{buildroot}%{_initddir}/%{pname}
install -m 700 $RPM_SOURCE_DIR/start_apache2 %{buildroot}%{_sbindir}/start_apache2
%if 0%{?suse_version} >= 1210
mkdir -p %{buildroot}%{_unitdir}/
install -m 700 $RPM_SOURCE_DIR/apache2-systemd-ask-pass %{buildroot}%{_sbindir}/apache2-systemd-ask-pass
install -m 644 $RPM_SOURCE_DIR/apache2.service %{buildroot}%{_unitdir}/apache2.service
%endif
ln -sf ../..%{_initddir}/%{pname} %{buildroot}/%{_sbindir}/rc%{pname}
install -m 755 $RPM_SOURCE_DIR/load_configuration %{buildroot}/%{_datadir}/%{pname}/
install -m 755 $RPM_SOURCE_DIR/find_mpm %{buildroot}/%{_datadir}/%{pname}/
install -m 755 $RPM_SOURCE_DIR/get_includes %{buildroot}/%{_datadir}/%{pname}/
install -m 755 $RPM_SOURCE_DIR/find_httpd2_includes %{buildroot}/%{_datadir}/%{pname}/
install -m 755 $RPM_SOURCE_DIR/apache-20-22-upgrade %{buildroot}/%{_datadir}/%{pname}/
sed 's+%{_prefix}/lib+%{_libdir}+' $RPM_SOURCE_DIR/get_module_list \
> %{buildroot}/%{_datadir}/%{pname}/get_module_list
chmod 755 %{buildroot}/%{_datadir}/%{pname}/get_module_list
install -m 755 $RPM_SOURCE_DIR/sysconf_addword %{buildroot}/%{_datadir}/%{pname}/
install -m 755 $RPM_SOURCE_DIR/a2enflag %{buildroot}/%{_sbindir}
ln -s a2enflag %{buildroot}/%{_sbindir}/a2disflag
install -m 755 $RPM_SOURCE_DIR/a2enmod %{buildroot}/%{_sbindir}
ln -s a2enmod %{buildroot}/%{_sbindir}/a2dismod
#
# directories for files from other packages and other configuration
for i in vhosts.d sysconfig.d; do
mkdir -p %{buildroot}/%{sysconfdir}/$i
done
#
# make list of all modules, and install sysconfig template
for i in $(find %{buildroot}/%{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} \
> %{buildroot}/%{_var}/adm/fillup-templates/sysconfig.%{pname}
#
# install configuration files:
mkdir -p %{buildroot}/%{runtimedir}
touch %{buildroot}/%{sysconfdir}/sysconfig.d/include.conf
mkdir -p %{buildroot}/%{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 \
ssl-global.conf
do
install -m 644 $RPM_SOURCE_DIR/apache2-$i %{buildroot}/%{sysconfdir}/$i
done
cat > %{buildroot}/%{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}' %{buildroot}/%{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" %{buildroot}/%{sysconfdir}/server-tuning.conf > t
#diff -u %{buildroot}/%{sysconfdir}/server-tuning.conf t ||:
mv t %{buildroot}/%{sysconfdir}/server-tuning.conf
;;
esac
done
install -m 644 %{SOURCE130} %{buildroot}/%{sysconfdir}/vhosts.d/vhost.template
install -m 644 %{SOURCE131} %{buildroot}/%{sysconfdir}/vhosts.d/vhost-ssl.template
install -m 644 %{SOURCE104} %{buildroot}/%{sysconfdir}/conf.d/manual.conf
# install default vhost
dvh=$(basename %{SOURCE132})
install -m 644 %{SOURCE132} %{buildroot}/%{sysconfdir}/${dvh##%{name}-}
dvhs=$(basename %{SOURCE133})
install -m 644 %{SOURCE133} %{buildroot}/%{sysconfdir}/${dvhs##%{name}-}
# for mod_auth_ldap
install -m 644 docs/conf/charset.conv %{buildroot}/%{sysconfdir}/
cp -p $RPM_SOURCE_DIR/robots.txt .
cp -p $RPM_SOURCE_DIR/favicon.ico %{buildroot}/%{htdocsdir}/
cat > %{buildroot}/%{htdocsdir}/robots.txt <<-EOF
User-Agent: *
Disallow: /
EOF
#
# use official mime.types (more complete)
#
ln -sf ../mime.types %{buildroot}/%{sysconfdir}/mime.types
mv %{buildroot}/%{cgidir}/printenv* .
mv %{buildroot}/%{cgidir}/test-cgi .
pushd %{buildroot}/%{_mandir}
for i in $(find . -type f); do
mv $i ${i%.*}%{vers}.${i#*.*.} || true
done
popd
pushd %{buildroot}/%{_bindir}
for i in ab dbmmanage htdbm htdigest htpasswd logresolve; do
mv $i ${i}%{vers} || true
done
popd
pushd %{buildroot}/%{_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 %{buildroot}/%{_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 %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/
install -m 644 %{SOURCE49} %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/%{name}
install -m 644 %{SOURCE50} %{buildroot}%{_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 %{buildroot}/%{includedir}/.. -type f -o -type l \
| sed "s#%{buildroot}##" \
>> filelist-devel
find %{buildroot}/%{installbuilddir} -type f \
| sed "s#%{buildroot}##" \
>> filelist-devel
# remove files from the build root that we won't package
rm -f %{buildroot}/%{_libdir}/%{pname}-*/*.exp # needed only on AIX
rm -f %{buildroot}/%{_libdir}/%{pname}/*.exp # needed only on AIX
rm -f %{buildroot}/%{_sbindir}/checkgid # needed only for user installations from tarball
rm -r %{buildroot}/%{sysconfdir}/extra # it is already in the documentation directory
%check
# now check wether httpd binary runs properly
# and validate httpd.conf file
#
pushd %{buildroot}/%{sysconfdir}
for i in *.conf; do cp $i $i.test; done
sed -e 's+%{_libdir}+'%{buildroot}'%{_libdir}+' \
-e 's+%{_localstatedir}/run+'%{buildroot}'%{_localstatedir}/run+' \
-e 's+%{sysconfdir}+'%{buildroot}'%{sysconfdir}+' \
-e 's+%{datadir}+'%{buildroot}'%{datadir}+' \
-e 's+\.conf$+&.test+' \
-e 's+%{_localstatedir}/log+'%{buildroot}'%{_localstatedir}/log+' \
httpd.conf > httpd.conf.test
sed -e 's+%{sysconfdir}+'%{buildroot}'%{sysconfdir}+' \
default-server.conf > default-server.conf.test
touch sysconfig.d/global.conf.test
touch sysconfig.d/include.conf.test
popd
pushd %{buildroot}
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 %{buildroot}/${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
LD_LIBRARY_PATH=%{buildroot}%{_libdir} \
%{buildroot}/%{_sbindir}/httpd%{vers}-%{default_mpm} \
-e debug -t -f %{buildroot}/%{sysconfdir}/httpd.conf.test || exit 1
rm %{buildroot}/%{sysconfdir}/*.test
rm %{buildroot}/%{sysconfdir}/sysconfig.d/*
mv %{buildroot}/%{sysconfdir}/original .
%files -f filelist
%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
%dir %{sysconfdir}/vhosts.d
%dir %{sysconfdir}/sysconfig.d
%config(noreplace) %{_sysconfdir}/logrotate.d/%{pname}
%{_datadir}/omc/svcinfo.d/apache2.xml
%{_initddir}/%{pname}
%if 0%{?suse_version} >= 1210
%{_unitdir}/%{pname}.service
%{_sbindir}/apache2-systemd-ask-pass
%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
%{_bindir}/log_server_status%{vers}
%{iconsdir}
%{errordir}
%{_var}/adm/fillup-templates/sysconfig.%{pname}
%attr(755,root,root) %{_libdir}/%{pname}_MMN
%dir %{_libdir}/%{pname}
%{_libdir}/%{pname}/mod_*.so
%dir %{installbuilddir}
%dir %{_datadir}/%{pname}
%{_datadir}/%{pname}/apache-20-22-upgrade
%{_datadir}/%{pname}/get_module_list
%{_datadir}/%{pname}/get_includes
%{_datadir}/%{pname}/find_httpd2_includes
%{_datadir}/%{pname}/find_mpm
%{_datadir}/%{pname}/load_configuration
%{_datadir}/%{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
%{_libdir}/%{pname}-prefork/mod_*.so
%endif
%if %{worker}
%files worker
%defattr(-,root,root)
%{_sbindir}/%{httpd}-worker
%dir %{_libdir}/%{pname}-worker
%{_libdir}/%{pname}-worker/mod_*.so
%endif
%if %{event}
%files event
%defattr(-,root,root)
%{_sbindir}/%{httpd}-event
%dir %{_libdir}/%{pname}-event
%{_libdir}/%{pname}-event/mod_*.so
%endif
%files devel -f filelist-devel
%defattr(-,root,root)
%dir %{_datadir}/%{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
%{_datadir}/%{pname}/get_module_list >/dev/null 2>&1
exit 0
%endif
%if %{worker}
%post worker
%{_datadir}/%{pname}/get_module_list >/dev/null 2>&1
exit 0
%endif
%if %{event}
%post event
%{_datadir}/%{pname}/get_module_list >/dev/null 2>&1
exit 0
%endif
%pre
%if 0%{?suse_version} >= 1210
%service_add_pre apache2.service
%endif
%preun
%if 0%{?suse_version} >= 1210
%service_del_preun apache2.service
%endif
for i in %{_sbindir}/%{httpd} \
%{installbuilddir}/config_vars.mk
do
test -L $i && rm $i
done
exit 0
%postun
%if 0%{?suse_version} >= 1210
%service_del_postun apache2.service
%endif
%insserv_cleanup
%post
%if 0%{?suse_version} <= 1130
%run_permissions
%else
%set_permissions %{_sbindir}/suexec2
%endif
# wwwadmin group existed in past remove after openSUSE-13.2 out of support scope
if grep -q "^wwwadmin:" %{_sysconfdir}/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
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
%if 0%{?suse_version} >= 1210
%service_add_post apache2.service
%endif
%{fillup_and_insserv apache2}
# Update ?
if [ $1 -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 %{_sysconfdir}/apache2\)/suse_\(\(include\|loadmodule\|global\).conf\)|\1/sysconfig.d/\2|
# the access_log configuration is now configurable
s|^CustomLog %{_localstatedir}/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
%{_datadir}/%{pname}/apache-20-22-upgrade
%{_datadir}/%{pname}/get_module_list >/dev/null 2>&1
exit 0
%verifyscript
%verify_permissions -e %{_sbindir}/suexec2
%changelog