# # spec file for package apache2 # # Copyright (c) 2012 SUSE LINUX Products 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 #Since 2.4.7 the event MPM requires apr 1.5.0 or later. BuildRequires: libapr1-devel >= 1.5.0 # BuildRequires: openldap2-devel BuildRequires: openssl-devel >= 0.9.8a BuildRequires: pcre-devel BuildRequires: xz BuildRequires: zlib-devel BuildRequires: lua-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(systemd) BuildRequires: pkgconfig(libsystemd-daemon) %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 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 access_compat 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 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.1.9-apachectl.dif #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 Url: http://httpd.apache.org/ Icon: Apache.xpm Summary: The Apache Web Server Version 2.4 License: Apache-2.0 Group: Productivity/Networking/Web/Servers Provides: %{apache_mmn} Provides: http_daemon Provides: httpd Provides: suse_help_viewer Provides: %{name}-mod_macro = %{version} 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 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 /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 (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 %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 #%patch65 -p1 %patch66 -p1 %patch67 -p1 %patch68 -p1 #%patch69 %patch70 -p1 #%patch108 -p1 %patch109 -p1 %patch111 -p1 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}-} # # 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-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 \ \ --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 # [ "$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 mkdir -p $RPM_BUILD_ROOT/etc/init.d install -m 744 $RPM_SOURCE_DIR/rc.%{pname} $RPM_BUILD_ROOT/etc/init.d/%{pname} install -m 744 $RPM_SOURCE_DIR/start_apache2 $RPM_BUILD_ROOT/usr/sbin/start_apache2 %if 0%{?suse_version} >= 1210 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 %endif ln -sf ../../etc/init.d/%{pname} $RPM_BUILD_ROOT/%{_sbindir}/rc%{pname} 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 \ 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 default vhost dvh=$(basename %{S:132}) install -m 644 %{S:132} $RPM_BUILD_ROOT/%{sysconfdir}/${dvh##%{name}-} dvhs=$(basename %{S:133}) install -m 644 %{S:133} $RPM_BUILD_ROOT/%{sysconfdir}/${dvhs##%{name}-} # 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}+' \ 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 %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 %config /etc/init.d/%{pname} %if 0%{?suse_version} >= 1210 %{_unitdir}/system/%{pname}.service %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} %{_libdir}/%{pname}/mod_*.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 %{_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 %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 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 #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 %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_and_insserv 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