From 538546aae46196aca3f79b241643dd8ccbc3a82d Mon Sep 17 00:00:00 2001 From: ZiyangZhang Date: Mon, 17 Apr 2023 14:46:10 +0800 Subject: [PATCH] Optimize spec file Signed-off-by: ZiyangZhang --- httpd.spec | 583 +++++++++++++++++++++++++---------------------------- 1 file changed, 273 insertions(+), 310 deletions(-) diff --git a/httpd.spec b/httpd.spec index 66380cf..3388661 100644 --- a/httpd.spec +++ b/httpd.spec @@ -1,5 +1,5 @@ -%define anolis_release 1 -%define contentdir %{_datadir}/httpd +%define anolis_release 2 +%define contentdir %{_datadir}/%{name} %define docroot /var/www %define suexec_caller apache %define mmn 20120211 @@ -16,17 +16,18 @@ Summary: Apache HTTP Server Name: httpd Version: 2.4.57 Release: %{anolis_release}%{?dist} +License: ASL 2.0 URL: https://httpd.apache.org/ -Source0: https://www.apache.org/dist/httpd/httpd-%{version}.tar.bz2 -Source3: httpd.logrotate +Source0: ${url}/dist/%{name}/%{name}-%{version}.tar.bz2 +Source3: %{name}.logrotate Source4: instance.conf -Source5: httpd-ssl-pass-dialog -Source6: httpd.tmpfiles -Source7: httpd.service +Source5: %{name}-ssl-pass-dialog +Source6: %{name}.tmpfiles +Source7: %{name}.service Source8: action-graceful.sh Source9: action-configtest.sh Source10: server-status.conf -Source11: httpd.conf +Source11: %{name}.conf Source12: 00-base.conf Source13: 00-mpm.conf Source14: 00-lua.conf @@ -43,86 +44,94 @@ Source24: manual.conf Source25: 00-systemd.conf Source26: 01-session.conf Source27: 10-listen443.conf -Source28: httpd.socket +Source28: %{name}.socket Source29: 00-optional.conf Source30: README.confd Source31: README.confmod -Source32: httpd.service.xml +Source32: %{name}.service.xml Source33: htcacheclean.service.xml -Source34: httpd.conf.xml +Source34: %{name}.conf.xml Source35: 00-brotli.conf Source40: htcacheclean.service Source41: htcacheclean.sysconf -Source42: httpd-init.service -Source43: httpd-ssl-gencerts -Source44: httpd@.service +Source42: %{name}-init.service +Source43: %{name}-ssl-gencerts +Source44: %{name}@.service Source45: config.layout Source46: apachectl.sh Source47: apachectl.xml Source48: apache-poweredby.png -# build/scripts patches -Patch2: httpd-2.4.43-apxs.patch -Patch3: httpd-2.4.43-deplibs.patch -# Needed for socket activation and mod_systemd patch -Patch19: httpd-2.4.53-detect-systemd.patch -# Features/functional changes -Patch21: httpd-2.4.48-r1842929+.patch -Patch22: httpd-2.4.43-mod_systemd.patch -Patch23: httpd-2.4.53-export.patch -Patch24: httpd-2.4.43-corelimit.patch -Patch25: httpd-2.4.54-selinux.patch -Patch26: httpd-2.4.43-gettid.patch -Patch27: httpd-2.4.54-icons.patch -Patch30: httpd-2.4.43-cachehardmax.patch -Patch34: httpd-2.4.43-socket-activation.patch -Patch38: httpd-2.4.43-sslciphdefault.patch -Patch39: httpd-2.4.43-sslprotdefault.patch -Patch41: httpd-2.4.43-r1861793+.patch -Patch42: httpd-2.4.48-r1828172+.patch -Patch45: httpd-2.4.43-logjournal.patch -Patch46: httpd-2.4.53-separate-systemd-fns.patch - -# Bug fixes -Patch60: httpd-2.4.43-enable-sslv3.patch -Patch61: httpd-2.4.48-r1878890.patch -Patch63: httpd-2.4.46-htcacheclean-dont-break.patch -Patch65: httpd-2.4.51-r1894152.patch - -# Security fixes +Patch0001: httpd-2.4.43-apxs.patch +Patch0002: httpd-2.4.43-deplibs.patch +Patch0003: httpd-2.4.53-detect-systemd.patch +Patch0004: httpd-2.4.48-r1842929+.patch +Patch0005: httpd-2.4.43-mod_systemd.patch +Patch0006: httpd-2.4.53-export.patch +Patch0007: httpd-2.4.43-corelimit.patch +Patch0008: httpd-2.4.54-selinux.patch +Patch0009: httpd-2.4.43-gettid.patch +Patch0010: httpd-2.4.54-icons.patch +Patch0011: httpd-2.4.43-cachehardmax.patch +Patch0012: httpd-2.4.43-socket-activation.patch +Patch0013: httpd-2.4.43-sslciphdefault.patch +Patch0014: httpd-2.4.43-sslprotdefault.patch +Patch0015: httpd-2.4.43-r1861793+.patch +Patch0016: httpd-2.4.48-r1828172+.patch +Patch0017: httpd-2.4.43-logjournal.patch +Patch0018: httpd-2.4.53-separate-systemd-fns.patch +Patch0019: httpd-2.4.43-enable-sslv3.patch +Patch0020: httpd-2.4.48-r1878890.patch +Patch0021: httpd-2.4.46-htcacheclean-dont-break.patch +Patch0022: httpd-2.4.51-r1894152.patch # modify for anolis Patch1000: 1000-httpd-anolis-rebrand.patch -License: ASL 2.0 -BuildRequires: gcc, autoconf, pkgconfig, findutils, xmlto -BuildRequires: perl-interpreter, perl-generators, systemd-devel, systemd-rpm-macros -BuildRequires: zlib-devel, libselinux-devel, lua-devel, brotli-devel -BuildRequires: apr-devel >= 1.5.0, apr-util-devel >= 1.5.0 +BuildRequires: gcc > 12.0 +BuildRequires: autoconf +BuildRequires: pkgconfig +BuildRequires: findutils +BuildRequires: xmlto +BuildRequires: gnupg2 +BuildRequires: perl-interpreter, perl-generators +BuildRequires: systemd-devel, systemd-rpm-macros +BuildRequires: zlib-devel +BuildRequires: libselinux-devel +BuildRequires: lua-devel +BuildRequires: brotli-devel +BuildRequires: apr-devel >= 1.5.0 +BuildRequires: apr-util-devel >= 1.5.0 %if %{with pcre2} BuildRequires: pcre2-devel %endif %if %{with pcre} BuildRequires: pcre-devel > 5.0 %endif -BuildRequires: gnupg2 -BuildRequires: chrpath Requires: system-logos(httpd-logo-ng) Provides: webserver -Requires: httpd-core = 0:%{version}-%{release} -Recommends: mod_http2, mod_lua -Requires(preun): systemd-units -Requires(postun): systemd-units -Requires(post): systemd-units +Requires: %{name}-core = 0:%{version}-%{release} +Recommends: mod_http2 +Recommends: mod_lua +%{?systemd_requires} %description -The Apache HTTP Server is a powerful, efficient, and extensible -web server. +The Apache HTTP Server Project is a collaborative software development effort +aimed at creating a robust, commercial-grade, featureful, and freely-available +source code implementation of an HTTP (Web) server. The project is jointly +managed by a group of volunteers located around the world, using the Internet +and the Web to communicate, plan, and develop the server and its related +documentation. This project is part of the Apache Software Foundation. In +addition, hundreds of users have contributed ideas, code, and documentation to +the project. This file is intended to briefly describe the history of the Apache +HTTP Server and recognize the many contributors. %package core -Summary: httpd minimal core -Provides: mod_dav = %{version}-%{release}, httpd-suexec = %{version}-%{release} -Provides: httpd-mmn = %{mmn}, httpd-mmn = %{mmnisa} +Summary: %{name} minimal core +Provides: mod_dav = %{version}-%{release} +Provides: httpd-suexec = %{version}-%{release} +Provides: httpd-mmn = %{mmn} +Provides: httpd-mmn = %{mmnisa} Provides: mod_proxy_uwsgi = %{version}-%{release} Requires: /etc/mime.types Requires: httpd-tools = %{version}-%{release} @@ -134,37 +143,13 @@ Obsoletes: mod_proxy_uwsgi < 2.0.17.1-2 %description core The httpd-core package contains essential httpd binaries. -%package devel -Summary: Development interfaces for the Apache HTTP Server -Requires: apr-devel, apr-util-devel, pkgconfig, libtool -Requires: httpd = %{version}-%{release} - -%description devel -The httpd-devel package contains the APXS binary and other files -that you need to build Dynamic Shared Objects (DSOs) for the -Apache HTTP Server. - -If you are installing the Apache HTTP Server and you want to be -able to compile or develop additional modules for Apache, you need -to install this package. - -%package manual -Summary: Documentation for the Apache HTTP Server -Requires: httpd = %{version}-%{release} -BuildArch: noarch - -%description manual -The httpd-manual package contains the complete manual and -reference guide for the Apache HTTP Server. The information can -also be found at https://httpd.apache.org/docs/2.4/. - %package filesystem Summary: The basic directory layout for the Apache HTTP Server BuildArch: noarch Requires(pre): /usr/sbin/useradd %description filesystem -The httpd-filesystem package contains the basic directory layout +The %{name}-filesystem package contains the basic directory layout for the Apache HTTP Server including the correct permissions for the directories. @@ -172,19 +157,18 @@ for the directories. Summary: Tools for use with the Apache HTTP Server %description tools -The httpd-tools package contains tools which can be used with +The %{name}-tools package contains tools which can be used with the Apache HTTP Server. %package -n mod_ssl Summary: SSL/TLS module for the Apache HTTP Server Epoch: 1 BuildRequires: openssl-devel -Requires(pre): httpd-filesystem -Requires: httpd = 0:%{version}-%{release}, httpd-mmn = %{mmnisa} +Requires(pre): %{name}-filesystem +Requires: %{name} = 0:%{version}-%{release} +Requires: %{name}-mmn = %{mmnisa} Requires: sscg >= 2.2.0, /usr/bin/hostname -# Require an OpenSSL which supports PROFILE=SYSTEM Conflicts: openssl-libs < 1:1.0.1h -# mod_ssl/mod_nss cannot both be loaded simultaneously Conflicts: mod_nss %description -n mod_ssl @@ -194,10 +178,11 @@ Security (TLS) protocols. %package -n mod_proxy_html Summary: HTML and XML content filters for the Apache HTTP Server -Requires: httpd = 0:%{version}-%{release}, httpd-mmn = %{mmnisa} +Epoch: 1 +Requires: %{name} = 0:%{version}-%{release} +Requires: %{name}-mmn = %{mmnisa} BuildRequires: libxml2-devel BuildRequires: make -Epoch: 1 Obsoletes: mod_proxy_html < 1:2.4.1 %description -n mod_proxy_html @@ -206,7 +191,8 @@ transform and modify HTML and XML content. %package -n mod_ldap Summary: LDAP authentication modules for the Apache HTTP Server -Requires: httpd = 0:%{version}-%{release}, httpd-mmn = %{mmnisa} +Requires: %{name} = %{version}-%{release} +Requires: %{name}-mmn = %{mmnisa} Requires: apr-util-ldap %description -n mod_ldap @@ -215,7 +201,8 @@ authentication to the Apache HTTP Server. %package -n mod_session Summary: Session interface for the Apache HTTP Server -Requires: httpd = 0:%{version}-%{release}, httpd-mmn = %{mmnisa} +Requires: %{name} = 0:%{version}-%{release} +Requires: %{name}-mmn = %{mmnisa} %description -n mod_session The mod_session module and associated backends provide an abstract @@ -223,33 +210,57 @@ interface for storing and accessing per-user session data. %package -n mod_lua Summary: Lua scripting support for the Apache HTTP Server -Requires: httpd = 0:%{version}-%{release}, httpd-mmn = %{mmnisa} +Requires: %{name} = 0:%{version}-%{release} +Requires: %{name}-mmn = %{mmnisa} %description -n mod_lua The mod_lua module allows the server to be extended with scripts written in the Lua programming language. +%package devel +Summary: Development interfaces for the Apache HTTP Server +Requires: apr-devel +Requires: apr-util-devel +Requires: pkgconfig, libtool +Requires: %{name} = %{version}-%{release} + +%description devel +The %{name}-devel package contains the header and library files +for developing with %{name}. + +%package manual +Summary: Documentation for the Apache HTTP Server +Requires: %{name} = %{version}-%{release} +BuildArch: noarch + +%description manual +The %{name}-manual package contains the complete manual and +reference guide for the Apache HTTP Server. The information can +also be found at %{url}/docs/2.4/. + +%package doc +Summary: Documentation files for %{name} +Requires: %{name} = %{version}-%{release} +BuildArch: noarch + +%description doc +The %{name}-doc package contains documentation files for %{name}. + %prep %autosetup -p1 -# Patch in the vendor string sed -i '/^#define PLATFORM/s/Unix/%{vstring}/' os/unix/os.h - -# Prevent use of setcap in "install-suexec-caps" target. sed -i '/suexec/s,setcap ,echo Skipping setcap for ,' Makefile.in -# Example conf for instances -cp $RPM_SOURCE_DIR/instance.conf . -sed < $RPM_SOURCE_DIR/httpd.conf >> instance.conf ' +cp %{_sourcedir}/instance.conf . +sed < %{_sourcedir}/httpd.conf >> instance.conf ' 0,/^ServerRoot/d; -/# Supplemental configuration/,$d /^ *CustomLog .logs/s,logs/,logs/${HTTPD_INSTANCE}_, /^ *ErrorLog .logs/s,logs/,logs/${HTTPD_INSTANCE}_, ' -touch -r $RPM_SOURCE_DIR/instance.conf instance.conf -cp -p $RPM_SOURCE_DIR/server-status.conf server-status.conf +touch -r %{_sourcedir}/instance.conf instance.conf +cp -p %{_sourcedir}/server-status.conf server-status.conf -# Safety check: prevent build if defined MMN does not equal upstream MMN. vmmn=`echo MODULE_MAGIC_NUMBER_MAJOR | cpp -include include/ap_mmn.h | sed -n '/^2/p'` if test "x${vmmn}" != "x%{mmn}"; then : Error: Upstream MMN is now ${vmmn}, packaged MMN is %{mmn} @@ -257,47 +268,37 @@ if test "x${vmmn}" != "x%{mmn}"; then exit 1 fi -# A new logo which comes together with a new test page -cp %{SOURCE48} ./docs/icons/apache_pb3.png - -# Provide default layout -cp $RPM_SOURCE_DIR/config.layout . +cp %{_sourcedir}/apache-poweredby.png ./docs/icons/apache_pb3.png +cp %{_sourcedir}/config.layout . sed ' s,@MPM@,%{mpm},g s,@DOCROOT@,%{docroot},g s,@LOGDIR@,%{_localstatedir}/log/httpd,g -' < $RPM_SOURCE_DIR/httpd.conf.xml \ +' < %{_sourcedir}/httpd.conf.xml \ > httpd.conf.xml xmlto man ./httpd.conf.xml -xmlto man $RPM_SOURCE_DIR/htcacheclean.service.xml -xmlto man $RPM_SOURCE_DIR/httpd.service.xml +xmlto man %{_sourcedir}/htcacheclean.service.xml +xmlto man %{_sourcedir}/httpd.service.xml -# apachectl.xml => apachectl.8 -xmlto man %{SOURCE47} +xmlto man %{_sourcedir}/apachectl.xml : Building with MMN %{mmn}, MMN-ISA %{mmnisa} : Default MPM is %{mpm}, vendor string is '%{vstring}' : Regex Engine: PCRE=%{with pcre} PCRE2=%{with pcre2} %build -# forcibly prevent use of bundled apr, apr-util, pcre rm -rf srclib/{apr,apr-util,pcre} -# regenerate configure scripts autoheader && autoconf || exit 1 -# Before configure; fix location of build dir in generated apxs -%{__perl} -pi -e "s:\@exp_installbuilddir\@:%{_libdir}/httpd/build:g" \ - support/apxs.in +%{__perl} -pi -e "s:\@exp_installbuilddir\@:%{_libdir}/httpd/build:g" support/apxs.in %set_build_flags -# Hard-code path to links to avoid unnecessary builddep export LYNX_PATH=/usr/bin/links -# Build the daemon ./configure \ --prefix=%{_sysconfdir}/httpd \ --exec-prefix=%{_prefix} \ @@ -346,100 +347,92 @@ export LYNX_PATH=/usr/bin/links %make_build %install -rm -rf $RPM_BUILD_ROOT +rm -rf %{buildroot} %make_install -# Install systemd service files -mkdir -p $RPM_BUILD_ROOT%{_unitdir} -for s in httpd.service htcacheclean.service httpd.socket \ - httpd@.service httpd-init.service; do - install -p -m 644 $RPM_SOURCE_DIR/${s} \ - $RPM_BUILD_ROOT%{_unitdir}/${s} -done +mkdir -p %{buildroot}%{_unitdir} +mkdir %{buildroot}%{_unitdir}/httpd.service.d +mkdir %{buildroot}%{_unitdir}/httpd.socket.d +mkdir %{buildroot}%{_sysconfdir}/httpd/conf.d %{buildroot}%{_sysconfdir}/httpd/conf.modules.d + + +install -p -m 644 %{_sourcedir}/httpd.service %{buildroot}%{_unitdir}/httpd.service +install -p -m 644 %{_sourcedir}/htcacheclean.service %{buildroot}%{_unitdir}/htcacheclean.service +install -p -m 644 %{_sourcedir}/httpd.socket %{buildroot}%{_unitdir}/httpd.socket +install -p -m 644 %{_sourcedir}/httpd@.service %{buildroot}%{_unitdir}/httpd@.service +install -p -m 644 %{_sourcedir}/httpd-init.service %{buildroot}%{_unitdir}/httpd-init.service + + + +install -D -m 644 %{_sourcedir}/README.confd %{buildroot}%{_sysconfdir}/httpd/conf.d/README +install -D -m 644 %{_sourcedir}/README.confmod %{buildroot}%{_sysconfdir}/httpd/conf.modules.d/README + -# install conf file/directory -mkdir $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d \ - $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.modules.d -install -m 644 $RPM_SOURCE_DIR/README.confd \ - $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/README -install -m 644 $RPM_SOURCE_DIR/README.confmod \ - $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.modules.d/README for f in 00-base.conf 00-mpm.conf 00-lua.conf 01-cgi.conf 00-dav.conf \ 00-proxy.conf 00-ssl.conf 01-ldap.conf 00-proxyhtml.conf \ 01-ldap.conf 00-systemd.conf 01-session.conf 00-optional.conf \ 00-brotli.conf; do - install -m 644 -p $RPM_SOURCE_DIR/$f \ - $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.modules.d/$f + install -m 0644 -p %{_sourcedir}/$f \ + %{buildroot}%{_sysconfdir}/httpd/conf.modules.d/$f done sed -i '/^#LoadModule mpm_%{mpm}_module /s/^#//' \ - $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.modules.d/00-mpm.conf -touch -r $RPM_SOURCE_DIR/00-mpm.conf \ - $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.modules.d/00-mpm.conf - -# install systemd override drop directory -# Web application packages can drop snippets into this location if -# they need ExecStart[pre|post]. -mkdir $RPM_BUILD_ROOT%{_unitdir}/httpd.service.d -mkdir $RPM_BUILD_ROOT%{_unitdir}/httpd.socket.d - -install -m 644 -p $RPM_SOURCE_DIR/10-listen443.conf \ - $RPM_BUILD_ROOT%{_unitdir}/httpd.socket.d/10-listen443.conf - -for f in welcome.conf ssl.conf manual.conf userdir.conf; do - install -m 644 -p $RPM_SOURCE_DIR/$f \ - $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/$f -done + %{buildroot}%{_sysconfdir}/httpd/conf.modules.d/00-mpm.conf +touch -r %{_sourcedir}/00-mpm.conf \ + %{buildroot}%{_sysconfdir}/httpd/conf.modules.d/00-mpm.conf -# Split-out extra config shipped as default in conf.d: -for f in autoindex; do - install -m 644 docs/conf/extra/httpd-${f}.conf \ - $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/${f}.conf -done -# Extra config trimmed: +install -m 0644 -p %{_sourcedir}/10-listen443.conf \ + %{buildroot}%{_unitdir}/httpd.socket.d/10-listen443.conf + +install -m 0644 -p %{_sourcedir}/welcome.conf \ + %{buildroot}%{_sysconfdir}/httpd/conf.d/welcome.conf +install -m 0644 -p %{_sourcedir}/ssl.conf \ + %{buildroot}%{_sysconfdir}/httpd/conf.d/ssl.conf +install -m 0644 -p %{_sourcedir}/manual.conf \ + %{buildroot}%{_sysconfdir}/httpd/conf.d/manual.conf +install -m 0644 -p %{_sourcedir}/userdir.conf \ + %{buildroot}%{_sysconfdir}/httpd/conf.d/userdir.conf + + +install -m 0644 docs/conf/extra/httpd-autoindex.conf \ + %{buildroot}%{_sysconfdir}/httpd/conf.d/autoindex.conf + rm -v docs/conf/extra/httpd-{ssl,userdir}.conf -rm $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf/*.conf -install -m 644 -p $RPM_SOURCE_DIR/httpd.conf \ - $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf/httpd.conf - -mkdir $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig -install -m 644 -p $RPM_SOURCE_DIR/htcacheclean.sysconf \ - $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/htcacheclean - -# tmpfiles.d configuration -mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/tmpfiles.d -install -m 644 -p $RPM_SOURCE_DIR/httpd.tmpfiles \ - $RPM_BUILD_ROOT%{_prefix}/lib/tmpfiles.d/httpd.conf - -# Other directories -mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/httpd \ - $RPM_BUILD_ROOT/run/httpd/htcacheclean - -# Substitute in defaults which are usually done (badly) by "make install" -sed -i \ - "/^DavLockDB/d; - s,@@ServerRoot@@/user.passwd,/etc/httpd/conf/user.passwd,; - s,@@ServerRoot@@/docs,%{docroot},; - s,@@ServerRoot@@,%{docroot},; - s,@@Port@@,80,;" \ - docs/conf/extra/*.conf - -# Set correct path for httpd binary in apachectl script -sed 's,@HTTPDBIN@,%{_sbindir}/httpd,g' $RPM_SOURCE_DIR/apachectl.sh \ +rm %{buildroot}%{_sysconfdir}/httpd/conf/*.conf +install -m 0644 -p %{_sourcedir}/httpd.conf \ + %{buildroot}%{_sysconfdir}/httpd/conf/httpd.conf + +mkdir %{buildroot}%{_sysconfdir}/sysconfig +install -m 0644 -p %{_sourcedir}/htcacheclean.sysconf \ + %{buildroot}%{_sysconfdir}/sysconfig/htcacheclean + +mkdir -p %{buildroot}%{_prefix}/lib/tmpfiles.d +install -m 0644 -p %{_sourcedir}/httpd.tmpfiles \ + %{buildroot}%{_prefix}/lib/tmpfiles.d/httpd.conf + +mkdir -p %{buildroot}%{_localstatedir}/lib/httpd \ + %{buildroot}/run/httpd/htcacheclean + +sed -i '/^DavLockDB/d' docs/conf/extra/*.conf +sed -i 's,@@ServerRoot@@/user.passwd,/etc/httpd/conf/user.passwd,' docs/conf/extra/*.conf +sed -i 's,@@ServerRoot@@/docs,%{docroot},' docs/conf/extra/*.conf +sed -i 's,@@ServerRoot@@,%{docroot},' docs/conf/extra/*.conf +sed -i 's,@@Port@@,80,' docs/conf/extra/*.conf + +sed 's,@HTTPDBIN@,%{_sbindir}/httpd,g' %{_sourcedir}/apachectl.sh \ > apachectl.sh -# Create cache directory -mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/cache/httpd \ - $RPM_BUILD_ROOT%{_localstatedir}/cache/httpd/proxy \ - $RPM_BUILD_ROOT%{_localstatedir}/cache/httpd/ssl +mkdir -p %{buildroot}%{_localstatedir}/cache/httpd +mkdir -p %{buildroot}%{_localstatedir}/cache/httpd/proxy +mkdir -p %{buildroot}%{_localstatedir}/cache/httpd/ssl -# Make the MMN accessible to module packages -echo %{mmnisa} > $RPM_BUILD_ROOT%{_includedir}/httpd/.mmn -mkdir -p $RPM_BUILD_ROOT%{_rpmconfigdir}/macros.d -cat > $RPM_BUILD_ROOT%{_rpmconfigdir}/macros.d/macros.httpd < %{buildroot}%{_includedir}/httpd/.mmn +mkdir -p %{buildroot}%{_rpmconfigdir}/macros.d + +cat > %{buildroot}%{_rpmconfigdir}/macros.d/macros.httpd < $RPM_BUILD_ROOT%{_rpmconfigdir}/macros.d/macros.httpd < $RPM_BUILD_ROOT%{_mandir}/man8/httpd.8 + > %{buildroot}%{_mandir}/man8/httpd.8 -# Make ap_config_layout.h libdir-agnostic sed -i '/.*DEFAULT_..._LIBEXECDIR/d;/DEFAULT_..._INSTALLBUILDDIR/d' \ - $RPM_BUILD_ROOT%{_includedir}/httpd/ap_config_layout.h + %{buildroot}%{_includedir}/httpd/ap_config_layout.h -# Fix path to instdso in special.mk sed -i '/instdso/s,top_srcdir,top_builddir,' \ - $RPM_BUILD_ROOT%{_libdir}/httpd/build/special.mk + %{buildroot}%{_libdir}/httpd/build/special.mk -# vendor-apxs uses an unsanitized config_vars.mk which may -# have dependencies on system-rpm-config. apxs uses the -# config_vars.mk with a sanitized config_vars.mk -cp -p $RPM_BUILD_ROOT%{_libdir}/httpd/build/config_vars.mk \ - $RPM_BUILD_ROOT%{_libdir}/httpd/build/vendor_config_vars.mk +cp -p %{buildroot}%{_libdir}/httpd/build/config_vars.mk \ + %{buildroot}%{_libdir}/httpd/build/vendor_config_vars.mk -# Sanitize CFLAGS & LIBTOOL in standard config_vars.mk sed -e '/^CFLAGS/s,=.*$,= -O2 -g -Wall,' \ -e '/^LIBTOOL/s,/.*/libtool,%{_bindir}/libtool,' \ - -i $RPM_BUILD_ROOT%{_libdir}/httpd/build/config_vars.mk -diff -u $RPM_BUILD_ROOT%{_libdir}/httpd/build/vendor_config_vars.mk \ - $RPM_BUILD_ROOT%{_libdir}/httpd/build/config_vars.mk || true + -i %{buildroot}%{_libdir}/httpd/build/config_vars.mk +diff -u %{buildroot}%{_libdir}/httpd/build/vendor_config_vars.mk \ + %{buildroot}%{_libdir}/httpd/build/config_vars.mk || true sed 's/config_vars.mk/vendor_config_vars.mk/' \ - $RPM_BUILD_ROOT%{_bindir}/apxs \ - > $RPM_BUILD_ROOT%{_libdir}/httpd/build/vendor-apxs -touch -r $RPM_BUILD_ROOT%{_bindir}/apxs \ - $RPM_BUILD_ROOT%{_libdir}/httpd/build/vendor-apxs -chmod 755 $RPM_BUILD_ROOT%{_libdir}/httpd/build/vendor-apxs + %{buildroot}%{_bindir}/apxs \ + > %{buildroot}%{_libdir}/httpd/build/vendor-apxs +touch -r %{buildroot}%{_bindir}/apxs \ + %{buildroot}%{_libdir}/httpd/build/vendor-apxs +chmod 755 %{buildroot}%{_libdir}/httpd/build/vendor-apxs -# Remove unpackaged files rm -vf \ - $RPM_BUILD_ROOT%{_libdir}/*.exp \ - $RPM_BUILD_ROOT/etc/httpd/conf/mime.types \ - $RPM_BUILD_ROOT%{_libdir}/httpd/modules/*.exp \ - $RPM_BUILD_ROOT%{_libdir}/httpd/build/config.nice \ - $RPM_BUILD_ROOT%{_bindir}/{ap?-config,dbmmanage} \ - $RPM_BUILD_ROOT%{_sbindir}/{checkgid,envvars*} \ - $RPM_BUILD_ROOT%{contentdir}/htdocs/* \ - $RPM_BUILD_ROOT%{_mandir}/man1/dbmmanage.* \ - $RPM_BUILD_ROOT%{contentdir}/cgi-bin/* + %{buildroot}%{_libdir}/*.exp \ + %{buildroot}/etc/httpd/conf/mime.types \ + %{buildroot}%{_libdir}/httpd/modules/*.exp \ + %{buildroot}%{_libdir}/httpd/build/config.nice \ + %{buildroot}%{_bindir}/{ap?-config,dbmmanage} \ + %{buildroot}%{_sbindir}/{checkgid,envvars*} \ + %{buildroot}%{contentdir}/htdocs/* \ + %{buildroot}%{_mandir}/man1/dbmmanage.* \ + %{buildroot}%{contentdir}/cgi-bin/* -rm -rf $RPM_BUILD_ROOT/etc/httpd/conf/{original,extra} +rm -rf %{buildroot}/etc/httpd/conf/{original,extra} -# remove lib rpath -chrpath --delete $RPM_BUILD_ROOT%{_libdir}/httpd/modules/mod_brotli.so %pre filesystem getent group apache >/dev/null || groupadd -g 48 -r apache @@ -614,27 +577,24 @@ nm --defined-only server/exports.o | \ if [ $rv -eq 0 ]; then echo PASS: Symbol export list verified. fi -# Check the built modules are all PIC -if readelf -d $RPM_BUILD_ROOT%{_libdir}/httpd/modules/*.so | grep TEXTREL; then +if readelf -d %{buildroot}%{_libdir}/httpd/modules/*.so | grep TEXTREL; then echo FAIL: Modules contain non-relocatable code rv=1 else echo PASS: No non-relocatable code in module builds fi -# Ensure every mod_* that's built is loaded. -for f in $RPM_BUILD_ROOT%{_libdir}/httpd/modules/*.so; do +for f in %{buildroot}%{_libdir}/httpd/modules/*.so; do m=${f##*/} - if ! grep -q $m $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.modules.d/*.conf; then + if ! grep -q $m %{buildroot}%{_sysconfdir}/httpd/conf.modules.d/*.conf; then echo FAIL: Module $m not configured. Disable it, or load it. rv=1 else echo PASS: Module $m is configured and loaded. fi done -# Ensure every loaded mod_* is actually built -mods=`grep -h ^LoadModule $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.modules.d/*.conf | sed 's,.*modules/,,'` +mods=`grep -h ^LoadModule %{buildroot}%{_sysconfdir}/httpd/conf.modules.d/*.conf | sed 's,.*modules/,,'` for m in $mods; do - f=$RPM_BUILD_ROOT%{_libdir}/httpd/modules/${m} + f=%{buildroot}%{_libdir}/httpd/modules/${m} if ! test -x $f; then echo FAIL: Module $m is configured but not built. rv=1 @@ -646,10 +606,6 @@ set -x exit $rv %files -%{_mandir}/man8/* -%{_mandir}/man5/* -%exclude %{_mandir}/man8/httpd-init.* - %config(noreplace) %{_sysconfdir}/httpd/conf.modules.d/00-brotli.conf %config(noreplace) %{_sysconfdir}/httpd/conf.modules.d/00-systemd.conf %{_libdir}/httpd/modules/mod_brotli.so @@ -660,29 +616,29 @@ exit $rv %{_unitdir}/htcacheclean.service %{_unitdir}/*.socket +%{_mandir}/man8/* +%{_mandir}/man5/* +%exclude %{_mandir}/man8/httpd-init.* + %files core -%doc ABOUT_APACHE README CHANGES LICENSE VERSIONING NOTICE +%license LICENSE %doc docs/conf/extra/*.conf %doc instance.conf server-status.conf - %{_sysconfdir}/httpd/modules %{_sysconfdir}/httpd/logs %{_sysconfdir}/httpd/state %{_sysconfdir}/httpd/run -%dir %{_sysconfdir}/httpd/conf +%dir %{_sysconfdir}/httpd/conf %config(noreplace) %{_sysconfdir}/httpd/conf/httpd.conf %config(noreplace) %{_sysconfdir}/httpd/conf/magic - %config(noreplace) %{_sysconfdir}/logrotate.d/httpd - %config(noreplace) %{_sysconfdir}/httpd/conf.d/*.conf %exclude %{_sysconfdir}/httpd/conf.d/ssl.conf %exclude %{_sysconfdir}/httpd/conf.d/manual.conf %dir %{_sysconfdir}/httpd/conf.modules.d %{_sysconfdir}/httpd/conf.modules.d/README - %config(noreplace) %{_sysconfdir}/httpd/conf.modules.d/*.conf %exclude %{_sysconfdir}/httpd/conf.modules.d/00-brotli.conf %exclude %{_sysconfdir}/httpd/conf.modules.d/00-systemd.conf @@ -751,14 +707,9 @@ exit $rv %files tools %{_bindir}/* %{_mandir}/man1/* -%doc LICENSE NOTICE %exclude %{_bindir}/apxs %exclude %{_mandir}/man1/apxs.1* -%files manual -%{contentdir}/manual -%config(noreplace) %{_sysconfdir}/httpd/conf.d/manual.conf - %files -n mod_ssl %{_libdir}/httpd/modules/mod_ssl.so %config(noreplace) %{_sysconfdir}/httpd/conf.modules.d/00-ssl.conf @@ -791,14 +742,26 @@ exit $rv %files devel %{_includedir}/httpd %{_bindir}/apxs -%{_mandir}/man1/apxs.1* %dir %{_libdir}/httpd/build %{_libdir}/httpd/build/*.mk %{_libdir}/httpd/build/*.sh %{_libdir}/httpd/build/vendor-apxs %{_rpmconfigdir}/macros.d/macros.httpd +%{_mandir}/man1/apxs.1* + + +%files manual +%{contentdir}/manual +%config(noreplace) %{_sysconfdir}/httpd/conf.d/manual.conf + +%files doc +%doc ABOUT_APACHE README CHANGES VERSIONING NOTICE + %changelog +* Tue Apr 11 2023 Ziyang Zhang -2.4.57-2 +- Optimize spec file + * Fri Apr 7 2023 Funda Wang - 2.4.57-1 - New version 2.4.57 -- Gitee