File dba-apache-2458.spec of Package dba-apache-2458

%define version		2.4.58
%define vers		2458
%define prefix		/DBA/apache24/WWW/%{version}
%define dbassh2		1
%define with_lua	1
%define with_brotli	1
%define with_gssapi	0
%define with_http2	1
%define with_md		1
%define with_dbapcre	0

Name:           	dba-apache-%{vers}
Summary:        	The Apache Web Server Version %{version}
Vendor: openSUSE Build Service
License:        	Apache-2.0
Group:          	Productivity/Networking/Web/Servers
Url:            	http://httpd.apache.org/
Version:        	%{version}
Release:        	1
Source0:        	http://httpd.apache.org/dev/dist/httpd-%{version}.tar.bz2
Source1:        	dba-apache-rpmlintrc
Source2:        	http://www.apache.org/apr/apr-1.6.3.tar.bz2
Source3:        	http://www.apache.org/apr/apr-util-1.6.1.tar.bz2
Source4:		filter-provides-apa24.sh
Source5:		filter-requires-apa24.sh
Source6:                set_apache_2.4.latest.sh
Source9:                http://httpd.apache.org/dev/dist/httpd-%{version}.tar.bz2.md5
AutoReqProv:    	on
BuildRoot:      	%{_tmppath}/%{name}-%{version}-build

%define _use_internal_dependency_generator 0
%define __find_provides %{SOURCE4}
%define __find_requires %{SOURCE5}

# "Server:" header
%define VENDOR DBA
%define platform_string	Linux/%VENDOR

BuildRequires:  ed pcre-devel zlib-devel
BuildRequires:  dba-openssl-313-static
%define ssldir /DBA/openssl/3.1.3
BuildRequires:  libxml2-devel autoconf

#!BuildIgnore:  dba-openssl-098o dba-openssl-098r dba-openssl-098x dba-openssl-101c dba-openssl-101e
#!BuildIgnore:  openssl-devel dba-libxml2-290
#!BuildIgnore:  nspr dba-geoip-148 dba-geoip-160 dba-git-2191

# error: 'PCRE_DUPNAMES' undeclared
%if 0%{?rhel_version} == 406 || 0%{?centos_version} == 505 || 0%{?rhel_version} == 505 || 0%{?sles_version} == 10
%define with_dbapcre	1
%define with_gssapi	1
%endif

%if %{with_gssapi}
BuildRequires:  libgssapi-devel libgssapi
%endif

%if 0%{?sles_version} == 11
%define with_brotli	0
%define with_md		0
%endif

%if 0%{?rhel_version} == 700 || 0%{?centos_version} == 700 || 0%{?suse_version} >= 1300
%define with_brotli	0
%endif

%if %{with_md}
%if 0%{?centos_version} >= 900 
BuildRequires:  dba-jansson-214-static
%define jandir  /DBA/jansson/2.14
%else
BuildRequires:  dba-jansson-27-static
%define jandir  /DBA/jansson/2.7
%endif
%endif

%if %{with_lua}
BuildRequires:  dba-lua-515-static
%endif

%if %{with_http2}
%if 0%{?fedora_version}
BuildRequires:  dba-nghttp2-134-static
%define ngh_dir	/DBA/nghttp2/1.3.4
%else
%if 0%{?suse_version} >= 1500 || 0%{?centos_version} >= 800 || 0%{?rhel_version} >= 800
BuildRequires: dba-nghttp2-1570-static
%define ngh_dir /DBA/nghttp2/1.57.0
%else
BuildRequires:  dba-nghttp2-1570-static
%define ngh_dir	/DBA/nghttp2/1.57.0
%endif
%endif
%endif

%if %{with_dbapcre}
BuildRequires:  dba-pcre-833-static
%define pcrepath /DBA/pcre/8.33
%endif

%if %{with_brotli}
BuildRequires:  dba-brotli-105-static
%define brotlidir /DBA/brotli/1.0.5
%endif

%if 0%{?centos_version} >= 800 || 0%{?rhel_version} >= 800
%if 0%{?centos_version} >= 900 
BuildRequires:  curl-devel
%else
BuildRequires:  dba-curl-840-static
%endif
%else
BuildRequires:  dba-curl-840-static 
# BuildRequires:  curl-devel
%endif

%if %{dbassh2}
%if 0%{?suse_version} >= 1500 || 0%{?centos_version} >= 800 || 0%{?rhel_version} >= 800
BuildRequires: dba-libssh2-190-static
%define ssh2dir /DBA/libssh2/1.9.0
%else
BuildRequires:  dba-libssh2-143-static
%define ssh2dir /DBA/libssh2/1.4.3
%endif
%else
BuildRequires:  libssh2-devel
%endif

%if %{?suse_version:1}0
%define httpduser wwwrun
%define httpdgroup www
%else
%define httpduser apache
%define httpdgroup apache
%endif

%if 0%{?suse_version}
BuildRequires:  libexpat-devel
%else
BuildRequires:  expat-devel
%endif

%if %{?suse_version:1}0
PreReq:         permissions
BuildRequires:  db-devel openldap2 openldap2-devel
%else
BuildRequires:  openldap openldap-devel
%if 0%{?rhel_version} >= 700 || 0%{?centos_version} >= 700
BuildRequires:  libdb
%else
BuildRequires:  db4-devel
%endif
%endif

%if 0%{?suse_version} >= 1200
BuildRequires:  automake
%endif

%if 0%{?suse_version} >= 1100
BuildRequires:          -post-build-checks
%endif


%description
Apache 2, the successor to Apache 1.

Apache is the most used Web server software worldwide.

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

Authors:
--------
    Too many to list here -- see /usr/share/doc/packages/apache2/ABOUT_APACHE


%prep
#  
#  O/ ._ .__ ._
#  /O |_)|(/_|_)
#     |      |
#  
md5sum %{SOURCE0} | awk '{print $1;}' | cmp - %{SOURCE9}

%setup -q -n httpd-%{version} -a 2 -a 3

%{__chmod} +x %{SOURCE4}
%{__chmod} +x %{SOURCE5}

# cat $RPM_SOURCE_DIR/SUSE-NOTICE >> NOTICE
#
# 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 option --with-included-apr
#
rm -rf srclib/apr*
mv apr-util* srclib/apr-util
mv apr-* srclib/apr
#
# now configure Apache 
#
%if 0%{?suse_version} > 910
aclocal
autoreconf --force --install
%else
rm -rf aclocal.m4 autom4te*.cache
autoheader
autoconf
%endif


%build
#
#  O/ |_    o| _|
#  /O |_)|_|||(_|
#
CFLAGS="$RPM_OPT_FLAGS -fPIC -Wall -fno-strict-aliasing -DLDAP_DEPRECATED" \
CPPFLAGS="-DSSL_EXPERIMENTAL_ENGINE -DMAX_SERVER_LIMIT=200000 -DLDAP_DEPRECATED -DMAXLINE=4096 -DHAVE_EXPAT_CONFIG_H" \
LDFLAGS=" -lm -ldl"
export CFLAGS LDFLAGS CPPFLAGS

CFLAGS="$CFLAGS -I%{ssldir}/include"
LDFLAGS="$LDFLAGS -L%{ssldir}/lib64 -ldl"
export PKG_CONFIG_PATH="%{ssldir}/lib64/pkgconfig:$PKG_CONFIG_PATH"

%if %{dbassh2}
export CFLAGS="$CFLAGS -I%{ssh2dir}/include"
export LDFLAGS="$LDFLAGS -L/%{ssh2dir}/lib"
%endif

# ./configure --prefix=%{prefix} --with-mpm=worker 
# %{__make} CFLAGS="$RPM_OPT_FLAGS -fPIC -fno-strict-aliasing -Wall " %{?jobs:-j%jobs}
# %{__mkdir_p} %{buildroot}%{prefix}/bin
# %{__mkdir_p} %{buildroot}%{prefix}/modules
# %{__install} -D -m 0755 .libs/httpd %{buildroot}%{prefix}/bin/httpd-worker
# %{__install} -D -m 0755 server/mpm/worker/.libs/mod_mpm_worker.so %{buildroot}%{prefix}/modules/mod_mpm_worker.so.x

# ./configure --prefix=%{prefix} --with-mpm=event 
# %{__make} CFLAGS="$RPM_OPT_FLAGS -fPIC -fno-strict-aliasing -Wall " %{?jobs:-j%jobs}
# %{__mkdir_p} %{buildroot}%{prefix}/bin
# %{__mkdir_p} %{buildroot}%{prefix}/modules
# %{__install} -D -m 0755 .libs/httpd %{buildroot}%{prefix}/bin/httpd-event
# %{__install} -D -m 0755 server/mpm/event/.libs/mod_mpm_event.so %{buildroot}%{prefix}/modules/mod_mpm_event.so.x
 
%{__mkdir_p} %{buildroot}%{prefix}/bin

# for MPM in event worker prefork
for MPM in prefork
do

# if [ "$MPM" = "worker" ] || [ "$MPM" = "prefork" ]; then
# %{__make} clean
# fi
#		--with-mpm=$MPM \

./configure \
		--prefix=%{prefix} \
		--enable-mpms-shared=all \
		\
		--enable-exception-hook \
		\
%if %{?suse_version:%suse_version}%{?!suse_version:9999} > 930
		--enable-pie \
%endif
%if %{with_dbapcre}
		--with-pcre=%{pcrepath} \
%else
		--with-pcre \
%endif
		--enable-mods-shared=reallyall \
		--with-included-apr \
                --with-ssl=%{ssldir} \
                --enable-ssl=shared \
                --enable-tlsext \
		--disable-isapi \
%if %{with_lua}
                --enable-lua=shared \
                --with-lua=/DBA/lua/5.1.5 \
%endif
%if %{with_http2}
		--enable-http2 \
		--with-nghttp2=%{ngh_dir} \
%endif
%if %{with_brotli}
		--enable-brotli \
		--with-brotli=%{brotlidir} \
%endif
		--with-crypto \
		--enable-session-crypto \
		--with-openssl=%{ssldir} \
		--enable-deflate \
		--enable-echo \
%if %{with_md}
		--enable-md \
		--with-jansson=%{jandir} \
%endif
		--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-proxy-html \
		--enable-xml2enc \
		\
		--enable-dav-lock \
		--enable-authn-alias \
		--enable-optional-hook-export \
		--enable-optional-hook-import \
		--enable-optional-fn-import \
		--enable-optional-fn-export \
		--disable-rotatelogs \
		\
		--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}

make CFLAGS="$RPM_OPT_FLAGS -fPIC \
		-fno-strict-aliasing \
		-Wall " \
		%{?jobs:-j%jobs} 

# %{__install} -D -m 0755 .libs/httpd ./httpd-$MPM
# %{__install} -D -m 0755 server/mpm/$MPM/.libs/mod_mpm_$MPM.so ./mod_mpm_$MPM.so

done

 
%install
#
#  O/ o._  __|_ _.||
#  /O || |_> |_(_|||
#  
#
# (most installation (to build root) has already been done in %%build)
#
# prevent rpath problem on suse
export NO_BRP_CHECK_RPATH=true

make DESTDIR=$RPM_BUILD_ROOT install

%{__install} -m 0755 %{SOURCE6} %{buildroot}%{prefix}/bin/set_apache_2.4.latest.sh
# for MPM in event worker prefork
# do
# %{__install} -D -m 0755 ./httpd-$MPM %{buildroot}%{prefix}/bin/httpd-$MPM
# %{__install} -D -m 0755 ./mod_mpm_$MPM.so %{buildroot}%{prefix}/modules/mod_mpm_$MPM.so
# done

find %{buildroot}%{prefix} -name "*.a" -o -name "*.la" |xargs -i rm -f {}

%{__mkdir_p} %{buildroot}%{prefix}/logs
%{__sed} -i -e 's|#LoadModule session_module|LoadModule session_module|g' %{buildroot}%{prefix}/conf/httpd.conf


%post
cd %{prefix}/..
%{prefix}/bin/set_apache_2.4.latest.sh


%files
#       _
#  O/ _|_o| _  _
#  /O  | ||(/__>
#  
%defattr(-,root,root)
%dir %{prefix} 
%{prefix}/bin
%{prefix}/build
%{prefix}/conf
%{prefix}/cgi-bin
%{prefix}/error
%{prefix}/htdocs
%{prefix}/icons
%{prefix}/include
%{prefix}/lib
%{prefix}/logs
%{prefix}/man
%{prefix}/manual
%{prefix}/modules


%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}


%changelog
* Thu Oct 19 2023 Sebastian Roth <sebastian.roth@bertelsmann.de>
- inital version
openSUSE Build Service is sponsored by