Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37044000
en ru br
Репозитории ALT
S:2.4.57-alt2
D:2.2.9-alt11
5.1: 2.2.24-alt2.M51.1
4.1: 2.2.8-alt1
4.0: 2.2.6-alt4
+updates:2.2.6-alt2
3.0: 2.0.55-alt1
+backports:2.0.59-alt0.M30.1
www.altlinux.org/Changes

Другие репозитории
Upstream:2.2.8

Группа :: Система/Серверы
Пакет: apache2

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

%define apache_version 2.2.6

%def_without M24
%def_without M30
%def_without libdb42
%def_without libdb43
%def_without libdb44

%define apache_release_base alt2
%if_with M24
%define apache_release_base alt1.M24.1
%endif
%if_with M30
%define apache_release_base alt1.M30.1
%endif
%define apache_release_libdb %nil
%if_with libdb42
%define apache_release_libdb .libdb4.2
%endif
%if_with libdb43
%define apache_release_libdb .libdb4.3
%endif
%if_with libdb44
%define apache_release_libdb .libdb4.4
%endif
%define apache_release_suff %nil
%define apache_release %apache_release_base%apache_release_suff%apache_release_libdb

%define n_aprver 1.2.8
%define n_apr_release_devel -alt1.1
%define n_aprutil_release_devel -alt1.1
%define n_apr_devel_ver %n_aprver%n_apr_release_devel
%define n_aprutil_devel_ver %n_aprver%n_aprutil_release_devel

%define mmn 20051115
%define n_dbver 4.4
%if_with M30
%define n_dbver 4.3
%endif
%if_with M24
%define n_dbver 4.2
%endif
%if_with libdb42
%define n_dbver 4.2
%endif
%if_with libdb43
%define n_dbver 4.3
%endif
%if_with libdb44
%define n_dbver 4.4
%endif

# do we need to co-exist with apache-ru ?

%def_enable apache_ru_compat
# if we do, what suffix to use ?
%define branch 2
# do we use native apr/apu ?
%def_disable static

# handle initscript style change

%define dist_tag Sisyphus
%if_with M24
%define dist_tag Master
%endif

# name pkg-config pakage

%define n_pkgconfig pkg-config
%if_with M24
%define n_pkgconfig pkgconfig
%endif

%if_enabled apache_ru_compat
%define apache_branch %branch
%else
%define apache_branch %nil
%endif

%define a_name apache%apache_branch
%define a_dname httpd%apache_branch

%define a_bindir %_bindir
%define a_sbindir %_sbindir
%define a_mandir %_mandir
%define a_localstatedir %_var
%define a_logfiledir %_logdir/%a_dname
%define a_includedir %_includedir/%a_name
%define a_runtimedir %_var/run/%a_dname
%define a_proxycachedir %_cachedir/%a_dname
%define a_spooldir %_spooldir/%a_name
%define a_infodir %_infodir
%define a_installbuilddir %a_libdir/build
%define a_apxs %_sbindir/apxs%apache_branch

%define a_libdir %_libdir/%a_name
%define a_libexecdir %a_libdir/modules

%define a_datadir %srv_dir/%a_name
%define a_htdocsdir %a_datadir/html
%define a_cgidir %a_datadir/cgi-bin
%define a_addondocdir %a_datadir/manual-addons
%define a_iconsdir %a_datadir/icons
%define a_manualdir %a_datadir/manual
%define a_errordir %a_datadir/error

%define a_rel_sysconfdir conf
%define a_prefix %_sysconfdir/%a_dname
%define a_exec_prefix %prefix
%define a_sysconfdir %a_prefix/%a_rel_sysconfdir

# Debian`like conf

%define a_mods_available %a_sysconfdir/mods-available
%define a_mods_enabled %a_sysconfdir/mods-enabled
%define a_mods_start %a_sysconfdir/mods-start.d
%define a_ports_available %a_sysconfdir/ports-available
%define a_ports_enabled %a_sysconfdir/ports-enabled
%define a_ports_start %a_sysconfdir/ports-start.d
%define a_sites_available %a_sysconfdir/sites-available
%define a_sites_enabled %a_sysconfdir/sites-enabled
%define a_sites_start %a_sysconfdir/sites-start.d
%define a_extra_available %a_sysconfdir/extra-available
%define a_extra_enabled %a_sysconfdir/extra-enabled
%define a_extra_start %a_sysconfdir/extra-start.d

%define apache_configs_branch 2
%define apache_configs_name %a_name-configs%apache_configs_branch
%define apache_configs_version %apache_configs_branch.1.0
%define apache_config_tool_branch 0
%define apache_config_tool_name %a_name-config-tools
%define apache_config_tool_version %apache_config_tool_branch.1.1

%define apache_user            %a_name
%define apache_group           %a_name
%define apache_webmaster       webmaster
%define suexec_docroot         /home

%define apache_apr_buildreq "libapr1-devel libaprutil1-devel"
%define apache_apr_config %_bindir/apr-1-config
%define apache_apu_config %_bindir/apu-1-config

# Old macros

%define apache_addonconfdir %a_sysconfdir/addon.d


Name:    %a_name
Version: %apache_version
Release: %apache_release
License: Apache Software License
Group: System/Servers
Url: http://httpd.apache.org/
Packager: Aleksey Avdeev <solo at altlinux.ru>

Summary: The most widely used Web server on the Internet
Summary(ru_RU.KOI8-R): Самый популярный веб-сервер Internet
Summary(uk_UA.KOI8-U): Найб╕льш популярний веб-сервер Internet

# SVN URL: http://svn.apache.org/repos/asf/httpd/httpd/tags/2.2.4

Source0: httpd-%version.tar

Source10: apache2.favour
Source11: apache2-alt-configs-0.9.tar
Source12: README.ALT.ru_RU.KOI8-R
Source13: apache2-alt-alternatives-0.2.tar

# initscripts for ALM2.2 and friends and current Sisyphus

Source33: httpd2.init.Master
Source35: httpd2.init.Sisyphus

Patch1: apache2-%version-alt-debian.conf-0.2.patch
Patch2: apache2-%version-alt-configs-0.1.patch
Patch3: apache2-%version-alt-default_https.conf.in-0.1.patch

Provides: webserver %name = %apache_version-%apache_release

%if_disabled apache_ru_compat
Conflicts: apache-common apache apache-mod_perl
%endif

Obsoletes: %name-init
Requires: %apache_configs_name >= %apache_configs_branch
Requires: %apache_config_tool_name >= %apache_config_tool_branch
Requires: %name-mmn = %mmn
Requires: %name-libdb = %n_dbver
Requires: %name-httpd
Requires: vhosts-filesystem

BuildPreReq: libapr1-devel >= %n_apr_devel_ver
BuildPreReq: libaprutil1-devel >= %n_aprutil_devel_ver

# Automatically added by buildreq on Fri Mar 31 2006

BuildRequires: libssl-devel openssl zlib-devel

BuildPreReq: alternatives
BuildPreReq: %n_pkgconfig
BuildPreReq: vhosts-filesystem-devel
%if_enabled static
BuildPreReq: libdb%n_dbver-devel-static
BuildPreReq: libsasl2-devel-static
%endif
BuildPreReq: libdb%n_dbver-devel
BuildPreReq: libgdbm-devel
BuildPreReq: libexpat-devel
BuildPreReq: libpcre-devel
BuildPreReq: openldap libldap-devel
BuildPreReq: libsasl2-devel libsasl2-plugin-gssapi
BuildPreReq: openssl libssl-devel
#following is required by dbmmanage
BuildPreReq: perl-DBM perl-Digest-SHA1 zlib-devel

%description
Apache is a powerful, full-featured, efficient and freely-available
Web server.

%description -l ru_RU.KOI8-R
Apache - мощный, функциональный, высокопроизводительный и
свободно распространяемый веб-сервер.

%package common
Summary: Files common for %name installations
Summary(ru_RU.KOI8-R): Общие файлы для инсталляции %name
Summary(uk_UA.KOI8-U): Сп╕льн╕ файли для ╕нсталяц╕╖ %name
Group: System/Servers
Conflicts: %name < 2.2.4-alt17
Requires: libapr1 >= %n_aprver
Requires: libaprutil1 >= %n_aprver
Requires: perl-DBM perl-Digest-SHA1 zlib
Provides: %name-mmn = %mmn
Provides: %name-libdb = %n_dbver
Provides: %apache_configs_name = %apache_configs_version
Provides: %apache_config_tool_name = %apache_config_tool_version

%description common
This package contains files required for both %name package
installations. Install this if you want to install Apache.

%description -l ru_RU.KOI8-R common
В этом пакете находятся файлы, необходимые для %name.
Установите, если собираетесь устанавливать Apache.

%description -l uk_UA.KOI8-U common
Цей пакунок м╕стить файли, як╕ необх╕дн╕ для %name.
Встанов╕ть його, якщо збира╓тесь використовувати Apache.

%package configs-A1PROXIED
Summary: This is a hack to run proxified Apache2 in case Apache1 is running
Summary(ru_RU.KOI8-R): Хак для поддержки проксирования Apache2 через Apache1, при его запуске
Group: Books/Other
Requires: %apache_configs_name >= %apache_configs_branch
Requires: %apache_config_tool_name >= %apache_config_tool_branch

%description configs-A1PROXIED
This is a hack to run proxified Apache2 in case Apache1 is running.

%description -l ru_RU.KOI8-R configs-A1PROXIED
Хак для поддержки проксирования Apache2 через Apache1, при его запуске.

%package httpd-worker
Summary: High speed threaded model for Apache HTTPD 2.1
Summary(ru_RU.KOI8-R): Высокоскоростная нитевая модель для Apache HTTPD 2.1
Group: System/Servers
PreReq: %name-common
Requires: %name-mmn = %mmn
Requires: %name-libdb = %n_dbver
Provides: %a_sbindir/%a_dname
Provides: %name-httpd = %apache_version-%apache_release

%description httpd-worker
The worker MPM provides a threaded implementation for Apache HTTPD 2.1. It is
considerably faster than the traditional model, and is the recommended MPM.

Worker generally is a good choice for high-traffic servers because it
has a smaller memory footprint than the prefork MPM.

%package httpd-prefork
Summary: Traditional model for Apache HTTPD 2.1
Summary(ru_RU.KOI8-R): Традиционная модель для Apache HTTPD 2.1
Group: System/Servers
PreReq: %name-common
Requires: %name-mmn = %mmn
Requires: %name-libdb = %n_dbver
Provides: %a_sbindir/%a_dname
Provides: %name-httpd = %apache_version-%apache_release

%description httpd-prefork
This Multi-Processing Module (MPM) implements a non-threaded,
pre-forking web server that handles requests in a manner similar to
Apache 1.3. It is appropriate for sites that need to avoid threading for
compatibility with non-thread-safe libraries. It is also the best MPM
for isolating each request, so that a problem with a single request will
not affect any other.

It is not as fast, but is considered to be more stable.

%package httpd-event
Summary: Event driven model for Apache HTTPD 2.1
Summary(ru_RU.KOI8-R): Событийная модель для Apache HTTPD 2.1
Group: System/Servers
PreReq: %name-common
Requires: %name-mmn = %mmn
Requires: %name-libdb = %n_dbver
Provides: %a_sbindir/%a_dname
Provides: %name-httpd = %apache_version-%apache_release

%description httpd-event
The event Multi-Processing Module (MPM) is designed to allow more
requests to be served simultaneously by passing off some processing
work to supporting threads, freeing up the main threads to work on
new requests.

This MPM is especially suitable for sites that see extensive KeepAlive traffic

%package devel
Summary: Module development tools for the Apache web server
Summary(ru_RU.KOI8-R): Средства разработки модулей для веб-сервера Apache
Group: Development/C
Obsoletes: secureweb-devel
PreReq: %name = %apache_version-%apache_release

Obsoletes: %a_name-libapr %a_name-libapr-devel %a_name-libapr-devel %a_name-libaprutil %a_name-libaprutil-devel %a_name-libaprutil-devel
Requires: libapr1-devel >= %n_apr_devel_ver
Requires: libaprutil1-devel >= %n_aprutil_devel_ver

%description devel
The apache-devel package contains the source code for the Apache
Web server you'll need to build Dynamic
Shared Objects (DSOs) for Apache.

If you are installing the Apache Web server and
you want to be able to compile or develop additional modules
for Apache, you'll need to install this package.

%description -l ru_RU.KOI8-R devel
Пакет содержит заголовочные файлы из исходных текстов веб-сервера Apache,
необходимые для сборки динамически подключаемых модулей (DSO).

Если Вы устанавливаете веб-сервер Apache и собираетесь компилировать или
разрабатывать для него дополнительные модули, Вам нужно установить этот пакет.

%package manual
Summary: Apache Manual
Summary(ru_RU.KOI8-R): Документация по Apache
Group: Books/Other
Requires: %name >= 2.2.4-alt12
Requires: %apache_configs_name >= %apache_configs_branch
Requires: %apache_config_tool_name >= %apache_config_tool_branch
PreReq: %name-common
AutoReq: no

%description manual
This package contains the Apache server documentation in HTML format.

%description -l ru_RU.KOI8-R manual
Этот пакет содержит документацию к веб-серверу Apache в формате HTML.

%package mod_ssl
Group: System/Servers
Summary: SSL/TLS module for the Apache HTTP server
Serial: 1
BuildPreReq: libssl-devel
PreReq: openssl
PreReq: %name-common
Requires: %name-mmn = %mmn
Requires: %name-libdb = %n_dbver
Requires: %apache_configs_name >= %apache_configs_branch
Requires: %apache_config_tool_name >= %apache_config_tool_branch

%description mod_ssl
The mod_ssl module provides strong cryptography for the Apache Web
server via the Secure Sockets Layer (SSL) and Transport Layer
Security (TLS) protocols.

%package suexec
Summary: Suexec binary for Apache
Summary(ru_RU.KOI8-R): Программа suexec для Apache
Summary(uk_UA.KOI8-U): Програма suexec для Apache
Group: System/Servers
PreReq: %name-common
Requires: %name-mmn = %mmn
Requires: %name-libdb = %n_dbver
Requires: %apache_configs_name >= %apache_configs_branch
Requires: %apache_config_tool_name >= %apache_config_tool_branch

%description suexec
This package adds suexec to Apache. Suexec provides Apache users the ability
to run CGI and SSI programs under user IDs different from the user ID of the
calling web-server. Normally, when a CGI or SSI program executes, it runs as
the same user who is running the web server.

%description -l ru_RU.KOI8-R suexec
Этот пакет добавляет к Apache suexec. Эта программа позволяет запускать CGI-
и SSI-программы под идентификаторами пользователя, отличными от UID
веб-сервера.

%description -l uk_UA.KOI8-U suexec
Цей пакунок дода╓ до Apache suexec. Ця програма дозволя╓ запускати CGI-
та SSI-програми п╕д ╕дентиф╕каторами користувача, що в╕др╕зняються в╕д
UID веб-серверу.


%add_findprov_lib_path %a_libdir
%define docdir %_docdir/%name-%version

%prep
# We dont need to expand builddir yet

%setup -q -n httpd-%version
%patch1 -p1
%patch2 -p1
%patch3 -p1

# generate ALTLinux Apache layout

echo "
# ALTLinux layout
<Layout ALTLinux>
   prefix: %a_prefix
   exec_prefix: %a_exec_prefix
   bindir: %a_bindir
   sbindir: %a_sbindir
   libdir: %a_libdir
   libexecdir: %a_libexecdir
   mandir: %a_mandir
   sysconfdir: %a_sysconfdir
   datadir: %a_datadir
   iconsdir: %a_iconsdir
   htdocsdir: %a_htdocsdir
   manualdir: %a_manualdir
   cgidir: %a_cgidir
   includedir: %a_includedir
   localstatedir: %a_localstatedir
   runtimedir: %a_runtimedir
   logfiledir: %a_logfiledir
   proxycachedir: %a_proxycachedir
   infodir: %a_infodir
   installbuilddir: %a_installbuilddir
   errordir: %a_errordir
</Layout>
" >> config.layout

# Safety check: prevent build if defined MMN does not equal upstream MMN.

vmmn=`echo MODULE_MAGIC_NUMBER_MAJOR | cpp -include $PWD/include/ap_mmn.h | grep -e '^[0-9]'`
if [ "$vmmn" != "%mmn" ]; then
  : Error: Upstream MMN is now ${vmmn}, packaged MMN is %mmn.
  : Update the mmn macro and rebuild.
  exit 1
fi

%build
function mpmbuild()
{
mpm=$1; shift
mkdir $mpm; pushd $mpm
cat > config.cache <<EOF
ac_cv_func_pthread_mutexattr_setpshared=no
ac_cv_func_sem_open=no
EOF
../configure -C \
--enable-layout=ALTLinux \
--with-pcre=%_usr/bin/pcre-config \
--with-perl=%__perl \
--with-apr=%apache_apr_config \
--with-apr-util=%apache_apu_config \
--enable-suexec --with-suexec \
--with-suexec-caller=%apache_user \
--with-suexec-docroot=%suexec_docroot \
--with-suexec-logfile=%a_logfiledir/suexec.log \
--with-suexec-bin=%a_sbindir/suexec%apache_branch \
--with-suexec-uidmin=500 --with-suexec-gidmin=500 \
--with-suexec-userdir=public_html \
--enable-so \
--with-mpm=$mpm \
       --with-devrandom \
       --with-ldap --enable-ldap --enable-auth-ldap --enable-authnz-ldap \
       --enable-cache --enable-disk-cache --enable-mem-cache \
--enable-ssl --with-ssl \
--enable-deflate --enable-cgid \
--enable-proxy --enable-proxy-connect \
--enable-proxy-http --enable-proxy-ftp \
--enable-charset_lite=shared \
$*

%make_build
popd
}

ln -snf %_datadir/apr-1/build/PrintPath build/PrintPath
libtoolize --ltdl
autoheader
autoconf -I %_datadir/apr-1

# Only bother enabling optional modules for main build.

mpmbuild prefork --enable-mods-shared=all --with-program-name=%a_dname

# To prevent most modules being built statically into httpd.worker,

# easiest way seems to be enable them shared.
mpmbuild worker --enable-mods-shared=all  --with-program-name=%a_dname

mpmbuild event --enable-mods-shared=all  --with-program-name=%a_dname

# Verify that the same modules were built into the two httpd binaries

./prefork/%a_dname -l | grep -v prefork > prefork.mods
./worker/%a_dname -l | grep -v worker > worker.mods
./event/%a_dname -l | grep -v event > event.mods
if ( ! diff -u prefork.mods worker.mods ) || ( ! diff -u prefork.mods event.mods ) ; then
 : Different modules built into httpd binaries, will not proceed
 exit 1
fi

%install
# Install README.ALT
install %SOURCE12 ./

# Generate macros for rpm

mkdir -p %buildroot%_sysconfdir/rpm/macros.d

echo "
%%apache_version %apache_version
%%apache_release %apache_release

# apache version configs

%%apache_configs_name %apache_configs_name
%%apache_configs_branch %apache_configs_branch
%%apache_configs_version %apache_configs_version
%%apache_config_tool_name %apache_config_tool_name
%%apache_config_tool_branch %apache_config_tool_branch
%%apache_config_tool_version %apache_config_tool_version

# apache builds

%%apache_mmn %mmn
%%apache_libdb %n_dbver

# first we define apache-ru compatible macroses

%%apache_basedir %a_prefix
%%apache_confdir %a_sysconfdir
%%apache_addonconfdir %apache_addonconfdir
%%apache_moduledir %a_libexecdir
%%apache_logdir %a_logfiledir
%%apache_addondocdir %a_addondocdir

%%apache_datadir %a_datadir
%%apache_htdocsdir %a_htdocsdir
%%apache_cgibindir %a_cgidir
%%apache_apxs %a_apxs

%%apache_user %apache_user
%%apache_group %apache_group
%%apache_webmaster %apache_webmaster
%%suexec_docroot %suexec_docroot

# This tells apache-based packages what

# APR to require and use
%%apache_apr_buildreq %apache_apr_buildreq
%%apache_apr_config %apache_apr_config
%%apache_apu_config %apache_apu_config

# here goes apache2 specific macroses

# (although not all of them are required
# for building modules)
%%a_rel_sysconfdir %a_rel_sysconfdir
%%a_name %a_name
%%a_dname %a_dname
%%a_prefix %a_prefix
%%a_exec_prefix %a_exec_prefix
%%a_bindir %a_bindir
%%a_sbindir %a_sbindir
%%a_libdir %a_libdir
%%a_libexecdir %a_libexecdir
%%a_mandir %a_mandir
%%a_sysconfdir %a_sysconfdir
%%a_datadir %a_datadir
%%a_iconsdir %a_iconsdir
%%a_htdocsdir %a_htdocsdir
%%a_manualdir %a_manualdir
%%a_addondocdir %a_addondocdir
%%a_cgidir %a_cgidir
%%a_includedir %a_includedir
%%a_localstatedir %a_localstatedir
%%a_runtimedir %a_runtimedir
%%a_logfiledir %a_logfiledir
%%a_proxycachedir %a_proxycachedir
%%a_spooldir %a_spooldir
%%a_infodir %a_infodir
%%a_installbuilddir %a_installbuilddir
%%a_errordir %a_errordir
%%a_apxs %a_apxs

# Debian-like conf

%%a_mods_available %a_mods_available
%%a_mods_enabled %a_mods_enabled
%%a_mods_start %a_mods_start
%%a_ports_available %a_ports_available
%%a_ports_enabled %a_ports_enabled
%%a_ports_start %a_ports_start
%%a_sites_available %a_sites_available
%%a_sites_enabled %a_sites_enabled
%%a_sites_start %a_sites_start
%%a_extra_available %a_extra_available
%%a_extra_enabled %a_extra_enabled
%%a_extra_start %a_extra_start
" > %buildroot%_sysconfdir/rpm/macros.d/%name

# Generate sed script for substitute the real paths in configs

sed -ne '/^[[:space:]]*%%[a-zA-Z0-1_]\+[[:space:]]\+[^[:space:]]\+[[:space:]]*$/s/^[[:space:]]*%%\([a-zA-Z0-1_]\+\)[[:space:]]\+\([^[:space:]]\+\)[[:space:]]*$/s| at \1 at |\2|g/p' \
%buildroot%_sysconfdir/rpm/macros.d/%name \
> SetMacros.sed
echo 's| at name at |%a_dname|g
s| at pidfile at |%a_runtimedir/httpd.pid|g
s| at conffile at |%a_sysconfdir/%a_dname.conf|g
s| at modules at |%a_libexecdir|g
s| at rel_sysconfdir at |%a_rel_sysconfdir|g
s| at vhosts_dir at |%vhosts_dir|g' >> SetMacros.sed

# Classify ab and logresolve as section 1 commands, as they are in /usr/bin

pushd docs/man

mv ab.8 ab%apache_branch.1

%if_enabled apache_ru_compat
MANS="apachectl.8 apxs.8 dbmmanage.1 htdigest.1 htpasswd.1 httpd.8 rotatelogs.8 logresolve.8 suexec.8"
for manpage in $MANS; do
   mv ${manpage} `echo ${manpage}|sed -e "s/\./%apache_branch./"`
done
%endif

mv logresolve%apache_branch.8 logresolve%apache_branch.1
popd

pushd prefork
make DESTDIR=%buildroot install
popd
mv %buildroot%a_sbindir/%a_dname %buildroot%a_sbindir/%a_dname.prefork

# install worker binary

WDIR=worker
install -m 755 $WDIR/%a_dname %buildroot%a_sbindir/%a_dname.worker

# install event binary

WDIR=event
install -m 755 $WDIR/%a_dname %buildroot%a_sbindir/%a_dname.event

#-----------------------------------------------------------------------------------

# Tune up executibles to co-exist with apache-ru
#
pushd %buildroot%a_sbindir
%if_enabled apache_ru_compat
#rename suexec binary to be named that apache is expect it to be
mv suexec suexec%apache_branch
#
# rename tools
# Maybe it's better to push ru-apache-devel before installing devel package
rm envvars-std
for tool in apxs checkgid dbmmanage envvars rotatelogs httxt2dbm; do
   mv ${tool} ${tool}%apache_branch
done
#fix apxs
sed -i -e 's|\(\/envvars\)"|\1%apache_branch"|
s|\(apachectl\)|\1%apache_branch|
' apxs%apache_branch
%endif
# move&rename utilities to /usr/bin
TOOLS="ab htdbm logresolve htpasswd htdigest"
for tool in $TOOLS; do
   mv ${tool} %buildroot%a_bindir/${tool}%apache_branch
done
popd
#
#-----------------------------------------------------------------------------------

pushd %buildroot%a_sysconfdir
tar xvSf %SOURCE11
popd

mkdir -p %buildroot%_altdir
pushd %buildroot%_altdir
tar xvSf %SOURCE13
popd

# mod_ssl bits

for suffix in crl crt csr key prm; do
  mkdir %buildroot%a_sysconfdir/ssl.${suffix}
done

# Makefiles for certificate management

#for ext in crt crl; do
#  install -m 644 ./build/rpm/mod_ssl-Makefile.${ext} \
# $RPM_BUILD_ROOT%_sysconfdir/httpd/conf/ssl.${ext}/Makefile.${ext}
#done
#ln -s ../../../usr/share/ssl/certs/Makefile $RPM_BUILD_ROOT/etc/httpd/conf

# for holding mod_dav lock database

mkdir -p %buildroot%a_localstatedir/lib/dav

# create a prototype session cache

mkdir -p %buildroot%a_proxycachedir/mod_ssl
touch %buildroot%a_proxycachedir/mod_ssl/scache.{dir,pag,sem}

# create spools

install -d %buildroot%a_spooldir/{,tmp,sessions,uploads}

# Make the MMN accessible to module packages

echo %mmn > %buildroot%a_includedir/.mmn

# symlinks for /etc/httpd2

ln -snf $(relative %buildroot%a_logfiledir %buildroot%a_prefix/logs) %buildroot%a_prefix/logs
ln -snf $(relative %buildroot%a_runtimedir %buildroot%a_prefix/run) %buildroot%a_prefix/run
ln -snf $(relative %buildroot%a_libexecdir %buildroot%a_prefix/modules) %buildroot%a_prefix/modules
ln -snf $(relative %buildroot%a_installbuilddir %buildroot%a_prefix/build) %buildroot%a_prefix/build

# create config dirs for additional modules and Virtual hosts

mkdir %buildroot%apache_addonconfdir

#------------------------------------------------------------------------------------

# tune up configuration files

# Install conf/*-start.d/*.conf

for d in mods ports sites extra; do
find docs/conf/$d-start.d/ -maxdepth 1 -name '*.conf' -type f -print0 | \
xargs -r0 install -D -t %buildroot%a_sysconfdir/$d-start.d/
done

pushd %buildroot%a_sysconfdir

find -type f -print0 | \
xargs -r0 sed -i -e 's/^\([[:space:]]*User\)[[:space:]]\+.*/\1 %apache_user/
s/^\([[:space:]]*Group\)[[:space:]]\+.*/\1 %apache_group/
s/^\([[:space:]]*ServerAdmin\)[[:space:]]\+you/\1 %apache_webmaster/
' httpd*.conf
popd

#------------------------------------------------------------------------------------


#install ALT misc documentation and logos


# Move .../conf/original to %%docdir/original

install -d %buildroot%docdir/
mv %buildroot%a_sysconfdir/original original
touch %buildroot%docdir/original
ln -snf $(relative %buildroot%docdir/original %buildroot%a_sysconfdir/original) %buildroot%a_sysconfdir/original

# docroot

#rm -r %buildroot%a_manualdir/style
##rm %buildroot%a_manualdir/*/*.xml
# Move %%a_manualdir to %%docdir/manual
mv %buildroot%a_manualdir manual
install -d %buildroot%_docdir/%a_name-manual-%apache_version/
touch %buildroot%_docdir/%a_name-manual-%apache_version/manual
ln -snf $(relative %buildroot%_docdir/%a_name-manual-%apache_version/manual %buildroot%a_manualdir) %buildroot%a_manualdir

# install the init script

mkdir -p %buildroot%_initdir
%if "%dist_tag" == "Master"
install -m755 %SOURCE33 \
       %buildroot%_initdir/%a_dname
%else
install -m755 %SOURCE35 \
       %buildroot%_initdir/%a_dname
%endif

# generate sysconfig settings file

mkdir -p %buildroot%_sysconfdir/sysconfig
echo "# Set HTTPD=%a_dname.worker to use a server
# with the thread-based "worker" MPM; BE WARNED that some modules may not
# work correctly with a thread-based MPM; notably PHP will refuse to start.
# Dont't forget to create httpd.worker.conf config file. copying existing
# httpd.conf could be a good starting point.
# (!) Warning: Stop httpd2 service BEFORE changing the following line
#HTTPD=%a_dname.worker
# Or use
#HTTPD=%a_dname.prefork
#
# If you want to force proxied (for example by Apache1) mode, which is
# autodetected by default you could add "-DA1PROXIED"
#OPTIONS="-DA1PROXIED"
" > %buildroot%_sysconfdir/sysconfig/%a_dname


# replace the "official" apachectl by a symlink to the init script

rm -f %buildroot%a_sbindir/apachectl*
ln -s -f $(relative %buildroot%_initdir/%a_dname \
       %buildroot%a_sbindir/apachectl%apache_branch) \
%buildroot%a_sbindir/apachectl%apache_branch

# Generate logrotate file

mkdir -p %buildroot%_sysconfdir/logrotate.d
echo '%a_logfiledir/*log {
missingok
notifempty
sharedscripts
create 0644 root %apache_group
delaycompress
postrotate
/sbin/service %a_dname condreload >/dev/null
endscript
}
'>%buildroot%_sysconfdir/logrotate.d/%a_name

# install addon documentation root

mkdir -p %buildroot%a_addondocdir

###

## Install apachkconfig favour description file
#
mkdir -p %buildroot%apachk_favours_dir
install -m 600 %SOURCE10 %buildroot%apachk_favours_dir/

###

## now remove installed files we ain't gonna use
#
rm -f %buildroot%a_installbuilddir/config.nice \
%buildroot%a_libexecdir/httpd.exp \
%buildroot%a_installbuilddir/mkdir.sh \
%buildroot%a_mandir/man8/apachectl* \
%buildroot%a_errordir/README

# Substitute the real paths in configs

find %buildroot%_sysconfdir -type f -print0 | \
xargs -r0 sed -i -f SetMacros.sed

#============ S C R I P T S ==================================================

#
#
%pre
if [ $1 -eq 2 ]; then
if [ -e %a_sysconfdir/%a_dname.conf ] && \
! (grep -qs -m1 '^[[:space:]]*[Ii][Nn][Cc][Ll][Uu][Dd][Ee][[:space:]]\+conf/ports-enabled' %a_sysconfdir/%a_dname.conf && \
grep -qs -m1 '^[[:space:]]*[Ii][Nn][Cc][Ll][Uu][Dd][Ee][[:space:]]\+conf/mods-enabled' %a_sysconfdir/%a_dname.conf && \
grep -qs -m1 '^[[:space:]]*[Ii][Nn][Cc][Ll][Uu][Dd][Ee][[:space:]]\+conf/sites-enabled' %a_sysconfdir/%a_dname.conf && \
grep -qs -m1 '^[[:space:]]*[Ii][Nn][Cc][Ll][Uu][Dd][Ee][[:space:]]\+conf/extra-enabled' %a_sysconfdir/%a_dname.conf) ; then
echo 'Warning: configuration files %a_sysconfdir/%a_dname.conf is old!'
echo '    Renamed old file %a_sysconfdir/%a_dname.conf'
echo '    to %a_sysconfdir/%a_dname.conf.rpmsave'
mv %a_sysconfdir/%a_dname.conf %a_sysconfdir/%a_dname.conf.rpmsave
fi
if [ -e %a_sysconfdir/%a_dname.worker.conf ] && \
[ ! -L %a_sysconfdir/%a_dname.worker.conf ]; then
echo 'Warning: original configuration files %a_sysconfdir/%a_dname.worker.conf'
echo '    saved as %a_sysconfdir/%a_dname.worker.conf.rpmold'
mv %a_sysconfdir/%a_dname.worker.conf %a_sysconfdir/%a_dname.worker.conf.rpmold
fi
fi
exit 0

%preun
if [ $1 = 0 ]; then
   %preun_service %a_dname
fi
exit 0

%post
if [ ! -e %a_sysconfdir/%a_dname.conf ] && \
[ -e %a_sysconfdir/%a_dname.conf.rpmnew ]; then
mv %a_sysconfdir/%a_dname.conf.rpmnew %a_sysconfdir/%a_dname.conf
fi
%_sbindir/a2chkconfig >/dev/null
%post_service %a_dname

%triggerin -- %name-httpd-worker
if [ $1 -eq 2 ] || [ $1 -eq 1 ]; then
%post_service %a_dname
fi
exit 0

%triggerin -- %name-httpd-prefork
if [ $1 -eq 2 ] || [ $1 -eq 1 ]; then
%post_service %a_dname
fi
exit 0

%triggerin -- %name-httpd-event
if [ $1 -eq 2 ] || [ $1 -eq 1 ]; then
%post_service %a_dname
fi
exit 0

%triggerin -- configs-A1PROXIED
%_sbindir/a2chkconfig >/dev/null
%post_service %a_dname
exit 0

%triggerin -- %name-mod_ssl
%_sbindir/a2chkconfig >/dev/null
%post_service %a_dname
exit 0

%triggerin -- %name-suexec
%_sbindir/a2chkconfig >/dev/null
%post_service %a_dname
exit 0

%triggerun -- %name-httpd-worker
if [ $1 -eq 0 ]; then
%preun_service %a_dname
fi
exit 0

%triggerun -- %name-httpd-prefork
if [ $1 -eq 0 ]; then
%preun_service %a_dname
fi
exit 0

%triggerun -- %name-httpd-event
if [ $1 -eq 0 ]; then
%preun_service %a_dname
fi
exit 0

%triggerun -- configs-A1PROXIED
%_sbindir/a2chkconfig >/dev/null
%post_service %a_dname
exit 0

%triggerun -- %name-mod_ssl
%_sbindir/a2chkconfig >/dev/null
%post_service %a_dname
exit 0

%triggerun -- %name-suexec
%_sbindir/a2chkconfig >/dev/null
%post_service %a_dname
exit 0

%triggerpostun -- apache2-manual < 2.2.4-alt12
if [ -e %_docdir/apache2-manual-2.2.4/manual ] && \
[ -L %_docdir/apache2-manual-2.2.4/manual ]; then
echo "Delete old symlink %_docdir/apache2-manual-2.2.4/manual"
rm -f %_docdir/%a_name-%apache_version/manual 2>/dev/null ||:
fi
exit 0

%pre common
# Create user and groups
%_sbindir/groupadd -r -f %apache_group 2>/dev/null ||:
%_sbindir/groupadd -r -f %apache_webmaster 2>/dev/null ||:
%_sbindir/useradd -g %apache_group -c 'Apache2 WWW server' -d %a_datadir -s '/dev/null' \
   -r %apache_user 2>/dev/null ||:
exit 0

%post httpd-worker
%register_alternatives %name-httpd-worker

%triggerpostun httpd-worker -- apache2 < 2.2.4-alt18
%register_alternatives %name-httpd-worker

%postun httpd-worker
%unregister_alternatives %name-httpd-worker

%post httpd-prefork
%register_alternatives %name-httpd-prefork

%triggerpostun httpd-prefork -- apache2 < 2.2.4-alt18
%register_alternatives %name-httpd-prefork

%postun httpd-prefork
%unregister_alternatives %name-httpd-prefork

%post httpd-event
%register_alternatives %name-httpd-event

%triggerpostun httpd-event -- apache2 < 2.2.4-alt18
%register_alternatives %name-httpd-prefork

%postun httpd-event
%unregister_alternatives %name-httpd-event

%pre manual
if [ $1 -eq 2 ] && \
[ -e %a_manualdir ] && \
[ ! -L %a_manualdir ] ; then
echo 'Warning: original %a_manualdir not symlink!'
echo '    Saved as %a_manualdir.rpmold'
mv %a_manualdir %a_manualdir.rpmold
fi
exit 0

%post configs-A1PROXIED
%_sbindir/a2chkconfig >/dev/null
%post_service %a_dname

%post manual
%_sbindir/a2chkconfig >/dev/null
%post_service %a_dname

%postun manual
if [ $1 -eq 0 ] && [ -x %_sbindir/a2chkconfig ] ; then
%_sbindir/a2chkconfig >/dev/null
%post_service %a_dname
fi
exit 0

%post mod_ssl
#%_sbindir/ldconfig ### is this needed?
umask 077

if [ ! -f %a_sysconfdir/ssl.key/server.key ] ; then
%_bindir/openssl genrsa -rand /proc/apm:/proc/cpuinfo:/proc/dma:/proc/filesystems:/proc/interrupts:/proc/ioports:/proc/pci:/proc/rtc:/proc/uptime 1024 > %a_sysconfdir/ssl.key/server.key 2> /dev/null
fi

FQDN=`hostname`
if [ "x${FQDN}" = "x" ]; then
  FQDN=localhost.localdomain
fi

if [ ! -f %a_sysconfdir/ssl.crt/server.crt ] ; then
cat << EOF | %_bindir/openssl req -new -key %a_sysconfdir/ssl.key/server.key -x509 -days 365 -out %a_sysconfdir/ssl.crt/server.crt 2>/dev/null
--
SomeState
SomeCity
SomeOrganization
SomeOrganizationalUnit
${FQDN}
root at ${FQDN}
EOF
fi

%files common
%attr(2770,root,%apache_group) %dir %a_proxycachedir/
%attr(750,root,%apache_group) %dir %a_spooldir/
%attr(2770,root,%apache_group) %dir %a_spooldir/tmp/
%attr(2770,root,%apache_group) %dir %a_spooldir/sessions/
%attr(2770,root,%apache_group) %dir %a_spooldir/uploads/

%dir %a_prefix/
%a_prefix/logs
%a_prefix/run
%a_prefix/modules

%dir %a_sysconfdir/
%dir %a_extra_available/
%dir %a_extra_enabled/
%dir %a_extra_start/
%dir %a_mods_available/
%dir %a_mods_enabled/
%dir %a_mods_start/
%dir %a_ports_available/
%dir %a_ports_enabled/
%dir %a_ports_start/
%dir %a_sites_available/
%dir %a_sites_enabled/
%dir %a_sites_start/

%dir %a_libdir/
%dir %a_libexecdir/
%attr(0750,root,%apache_group) %dir %a_logfiledir/
%dir %a_runtimedir/

%config(noreplace) %a_sysconfdir/magic
%config(noreplace) %a_sysconfdir/mime.types
%config(noreplace) %a_mods_available/*.load
%config(noreplace) %a_mods_available/*.conf
%exclude %a_mods_available/ssl.load
%exclude %a_mods_available/ssl.conf
%exclude %a_mods_available/suexec.load
%a_sbindir/a2*
%a_mandir/man8/a2*

# everything but mod_ssl.so:

%a_libexecdir/mod_*.so
%exclude %a_libexecdir/mod_ssl.so
%exclude %a_libexecdir/mod_suexec.so

%files httpd-worker
%a_sbindir/%a_dname.worker
%_altdir/%name-httpd-worker

%files httpd-prefork
%a_sbindir/%a_dname.prefork
%_altdir/%name-httpd-prefork

%files httpd-event
%a_sbindir/%a_dname.event
%_altdir/%name-httpd-event

%files
%doc ABOUT_APACHE README CHANGES LICENSE README.ALT*
%doc original

%a_sysconfdir/original

%config(noreplace) %a_sysconfdir/httpd2.conf
%config(noreplace) %a_mods_start/*.conf
%exclude %a_mods_start/*-manual*.conf
%config(noreplace) %a_ports_available/*.conf
%config(noreplace) %a_ports_start/*.conf
%exclude %a_ports_available/https.conf
%exclude %a_ports_available/http-A1PROXIED.conf
%exclude %a_ports_start/020-A1PROXIED.conf
%config(noreplace) %a_sites_available/*.conf
%config(noreplace) %a_sites_start/*.conf
%exclude %a_sites_available/default_https.conf
%exclude %a_sites_available/vhosts-A1PROXIED.conf
%exclude %a_sites_start/020-A1PROXIED.conf
%config(noreplace) %a_extra_available/*.conf
%exclude %a_extra_available/httpd-manual*.conf
%config(noreplace) %a_extra_start/*.conf
%exclude %a_extra_start/*-manual*.conf
%dir %apache_addonconfdir/
%config %_initdir/%a_dname
%a_sbindir/apachectl*
%attr(0600,root,root) %config(noreplace) %_sysconfdir/sysconfig/%a_dname

%attr(0644,root,root) %config(noreplace) %_sysconfdir/logrotate.d/%a_name

%apachk_favours_dir/apache2.favour

%a_bindir/ab*
%a_bindir/ht*
%a_bindir/logresolve*
%a_sbindir/rotatelogs*
%a_sbindir/htcacheclean*

%a_sbindir/checkgid*
%a_sbindir/check_forensic*
%a_sbindir/dbmmanage*

%a_sbindir/httxt2dbm*

%dir %a_datadir/
%dir %a_cgidir/
%attr(2775,root,%apache_webmaster) %dir %a_htdocsdir/
%dir %a_iconsdir/
%dir %a_errordir/
%dir %a_errordir/include/
%a_iconsdir/*
%a_htdocsdir/*
%a_cgidir/*

%config(noreplace) %a_errordir/*.var
%config(noreplace) %a_errordir/include/*.html

%attr(0700,%apache_user,%apache_group) %dir %a_localstatedir/lib/dav

%a_mandir/man1/*

%a_mandir/man8/rotatelogs*
%a_mandir/man8/httpd*
%a_mandir/man8/htcacheclean*
%a_mandir/man8/checkgid*
%a_mandir/man8/check_forensic*

%files configs-A1PROXIED
%config(noreplace) %a_ports_available/http-A1PROXIED.conf
%config(noreplace) %a_ports_start/020-A1PROXIED.conf
%config(noreplace) %a_sites_available/vhosts-A1PROXIED.conf
%config(noreplace) %a_sites_start/020-A1PROXIED.conf

%files manual
%doc manual

%a_manualdir
%a_addondocdir
%config(noreplace) %a_mods_start/*-manual*.conf
%config(noreplace) %a_extra_available/httpd-manual*.conf
%config(noreplace) %a_extra_start/*-manual*.conf

%files mod_ssl
%a_libexecdir/mod_ssl.so
%attr(0600,root,root) %config(noreplace) %a_mods_available/ssl.load
%attr(0600,root,root) %config(noreplace) %a_mods_available/ssl.conf
%attr(0600,root,root) %config(noreplace) %a_ports_available/https.conf
%attr(0600,root,root) %config(noreplace) %a_sites_available/default_https.conf
%attr(0700,root,root) %dir %a_sysconfdir/ssl.*
%attr(2770,root,%apache_group) %dir %a_proxycachedir/mod_ssl/
%attr(0600,%apache_user,%apache_group) %ghost %a_proxycachedir/mod_ssl/scache.dir
%attr(0600,%apache_user,%apache_group) %ghost %a_proxycachedir/mod_ssl/scache.pag
%attr(0600,%apache_user,%apache_group) %ghost %a_proxycachedir/mod_ssl/scache.sem

%files devel
%a_prefix/build
%a_includedir/.mmn
%a_includedir/ap_*
%a_includedir/[hmoprsu]*

#%a_libexecdir/httpd.exp

#%a_installbuilddir/config.nice


%a_sbindir/apxs*
%a_mandir/man8/apxs*
%dir %a_installbuilddir
%a_installbuilddir/[clprs]*.mk
%a_installbuilddir/instdso.sh

%a_sbindir/envvars*
%attr(0644,root,root) %_sysconfdir/rpm/macros.d/*

%files suexec
%config(noreplace) %a_mods_available/suexec.load
%a_libexecdir/mod_suexec.so
%attr(4510,root,%apache_group) %a_sbindir/suexec*
%a_mandir/man8/suexec*


%changelog

Полный changelog можно просмотреть здесь

 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin