blob: e4f7e1ceb8ba4c7e72247da2282e604cee0c7b16 [file] [log] [blame]
Andrew Geissler9aee5002022-03-30 16:27:02 +00001DESCRIPTION = "The Apache HTTP Server is a powerful, efficient, and \
2extensible web server."
3SUMMARY = "Apache HTTP Server"
4HOMEPAGE = "http://httpd.apache.org/"
5SECTION = "net"
6LICENSE = "Apache-2.0"
7
8SRC_URI = "${APACHE_MIRROR}/httpd/httpd-${PV}.tar.bz2 \
9 file://0001-configure-use-pkg-config-for-PCRE-detection.patch \
10 file://0002-apache2-bump-up-the-core-size-limit-if-CoreDumpDirec.patch \
11 file://0003-apache2-do-not-export-apr-apr-util-symbols-when-usin.patch \
12 file://0004-apache2-log-the-SELinux-context-at-startup.patch \
13 file://0005-replace-lynx-to-curl-in-apachectl-script.patch \
14 file://0006-apache2-fix-the-race-issue-of-parallel-installation.patch \
15 file://0007-apache2-allow-to-disable-selinux-support.patch \
16 file://0008-Fix-perl-install-directory-to-usr-bin.patch \
17 file://0009-support-apxs.in-force-destdir-to-be-empty-string.patch \
Patrick Williams92b42cb2022-09-03 06:53:57 -050018 file://0001-make_exports.awk-not-expose-the-path.patch \
Andrew Geissler9aee5002022-03-30 16:27:02 +000019 "
20
21SRC_URI:append:class-target = " \
22 file://0010-apache2-do-not-use-relative-path-for-gen_test_char.patch \
23 file://init \
24 file://apache2-volatile.conf \
25 file://apache2.service \
26 file://volatiles.04_apache2 \
27 "
28
29LIC_FILES_CHKSUM = "file://LICENSE;md5=bddeddfac80b2c9a882241d008bb41c3"
Patrick Williamsda295312023-12-05 16:48:56 -060030SRC_URI[sha256sum] = "fa16d72a078210a54c47dd5bef2f8b9b8a01d94909a51453956b3ec6442ea4c5"
Andrew Geissler9aee5002022-03-30 16:27:02 +000031
32S = "${WORKDIR}/httpd-${PV}"
33
34inherit autotools update-rc.d pkgconfig systemd update-alternatives
35
36DEPENDS = "openssl expat pcre apr apr-util apache2-native "
37
Patrick Williamsac13d5f2023-11-24 18:59:46 -060038CVE_PRODUCT = "apache:http_server"
Andrew Geissler9aee5002022-03-30 16:27:02 +000039
40SSTATE_SCAN_FILES += "apxs config_vars.mk config.nice"
41
42PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'selinux', d)}"
43PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux,libselinux"
44PACKAGECONFIG[openldap] = "--enable-ldap --enable-authnz-ldap,--disable-ldap --disable-authnz-ldap,openldap"
45PACKAGECONFIG[zlib] = "--enable-deflate,,zlib,zlib"
46
47CFLAGS:append = " -DPATH_MAX=4096"
48
49EXTRA_OECONF:class-target = "\
50 --enable-layout=Debian \
51 --prefix=${base_prefix} \
52 --exec_prefix=${exec_prefix} \
53 --includedir=${includedir}/${BPN} \
54 --sysconfdir=${sysconfdir}/${BPN} \
55 --datadir=${datadir}/${BPN} \
56 --libdir=${libdir} \
57 --libexecdir=${libexecdir}/${BPN}/modules \
58 --localstatedir=${localstatedir} \
59 --enable-ssl \
60 --with-dbm=sdbm \
61 --with-gdbm=no \
62 --with-ndbm=no \
63 --with-berkeley-db=no \
64 --enable-info \
65 --enable-rewrite \
66 --enable-mpms-shared \
67 ap_cv_void_ptr_lt_long=no \
68 ac_cv_have_threadsafe_pollset=no \
69 "
70
71EXTRA_OECONF:class-native = "\
72 --prefix=${prefix} \
73 --includedir=${includedir}/${BPN} \
74 --sysconfdir=${sysconfdir}/${BPN} \
75 --datadir=${datadir}/${BPN} \
76 --libdir=${libdir} \
77 --libexecdir=${libdir}/${BPN}/modules \
78 --localstatedir=${localstatedir} \
79 "
80
81do_configure:prepend() {
82 sed -i -e 's:$''{prefix}/usr/lib/cgi-bin:$''{libexecdir}/cgi-bin:g' ${S}/config.layout
83}
84
85do_install:append:class-target() {
86 install -d ${D}/${sysconfdir}/init.d
87
88 cat ${WORKDIR}/init | \
89 sed -e 's,/usr/sbin/,${sbindir}/,g' \
90 -e 's,/usr/bin/,${bindir}/,g' \
91 -e 's,/usr/lib/,${libdir}/,g' \
92 -e 's,/etc/,${sysconfdir}/,g' \
93 -e 's,/usr/,${prefix}/,g' > ${D}/${sysconfdir}/init.d/${BPN}
94
95 chmod 755 ${D}/${sysconfdir}/init.d/${BPN}
96
97 # Remove the goofy original files...
98 rm -rf ${D}/${sysconfdir}/${BPN}/original
99
100 install -d ${D}${sysconfdir}/${BPN}/conf.d
101 install -d ${D}${sysconfdir}/${BPN}/modules.d
102
103 # Ensure configuration file pulls in conf.d and modules.d
104 printf "\nIncludeOptional ${sysconfdir}/${BPN}/conf.d/*.conf" >> ${D}/${sysconfdir}/${BPN}/httpd.conf
105 printf "\nIncludeOptional ${sysconfdir}/${BPN}/modules.d/*.load" >> ${D}/${sysconfdir}/${BPN}/httpd.conf
106 printf "\nIncludeOptional ${sysconfdir}/${BPN}/modules.d/*.conf\n\n" >> ${D}/${sysconfdir}/${BPN}/httpd.conf
107
108 # Match with that is in init script
109 printf "\nPidFile /run/httpd.pid" >> ${D}/${sysconfdir}/${BPN}/httpd.conf
110
111 # Set 'ServerName' to fix error messages when restart apache service
112 sed -i 's/^#ServerName www.example.com/ServerName localhost/' ${D}/${sysconfdir}/${BPN}/httpd.conf
113
114 sed -i 's/^ServerRoot/#ServerRoot/' ${D}/${sysconfdir}/${BPN}/httpd.conf
115
116 sed -i -e 's,${STAGING_DIR_TARGET},,g' \
117 -e 's,${DEBUG_PREFIX_MAP},,g' \
118 -e 's,-fdebug-prefix-map[^ ]*,,g; s,-fmacro-prefix-map[^ ]*,,g; s,-ffile-prefix-map[^ ]*,,g' \
119 -e 's,${HOSTTOOLS_DIR}/,,g' \
120 -e 's,APU_INCLUDEDIR = .*,APU_INCLUDEDIR = ,g' \
121 -e 's,APU_CONFIG = .*,APU_CONFIG = ,g' ${D}${datadir}/apache2/build/config_vars.mk
122
123 sed -i -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \
124 -e 's,${DEBUG_PREFIX_MAP},,g' \
125 -e 's,${RECIPE_SYSROOT},,g' \
126 -e 's,-fdebug-prefix-map[^ ]*,,g; s,-fmacro-prefix-map[^ ]*,,g; s,-fmacro-prefix-map[^ ]*,,g' \
127 -e 's,APU_INCLUDEDIR = .*,APU_INCLUDEDIR = ,g' \
128 -e 's,".*/configure","configure",g' ${D}${datadir}/apache2/build/config.nice
129
130 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
131 install -d ${D}${sysconfdir}/tmpfiles.d/
132 install -m 0644 ${WORKDIR}/apache2-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
133
134 install -d ${D}${systemd_unitdir}/system
135 install -m 0644 ${WORKDIR}/apache2.service ${D}${systemd_unitdir}/system
136 sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/apache2.service
137 sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' ${D}${systemd_unitdir}/system/apache2.service
138 elif ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
139 install -d ${D}${sysconfdir}/default/volatiles
140 install -m 0644 ${WORKDIR}/volatiles.04_apache2 ${D}${sysconfdir}/default/volatiles/04_apache2
141 fi
142
143 rm -rf ${D}${localstatedir} ${D}${sbindir}/envvars*
144 chown -R root:root ${D}
145}
146
147do_install:append:class-native() {
148 install -d ${D}${bindir} ${D}${libdir}
149 install -m 755 server/gen_test_char ${D}${bindir}
150}
151
152SYSROOT_PREPROCESS_FUNCS:append:class-target = " apache_sysroot_preprocess"
153
154apache_sysroot_preprocess() {
155 install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}
156 install -m 755 ${D}${bindir}/apxs ${SYSROOT_DESTDIR}${bindir_crossscripts}
157 install -d ${SYSROOT_DESTDIR}${sbindir}
158 install -m 755 ${D}${sbindir}/apachectl ${SYSROOT_DESTDIR}${sbindir}
159 sed -i 's!my $installbuilddir = .*!my $installbuilddir = "${STAGING_DIR_HOST}/${datadir}/${BPN}/build";!' ${SYSROOT_DESTDIR}${bindir_crossscripts}/apxs
160
161 sed -i 's!^APR_CONFIG = .*!APR_CONFIG = ${STAGING_BINDIR_CROSS}/apr-1-config!' ${SYSROOT_DESTDIR}${datadir}/${BPN}/build/config_vars.mk
162 sed -i 's!^APU_CONFIG = .*!APU_CONFIG = ${STAGING_BINDIR_CROSS}/apu-1-config!' ${SYSROOT_DESTDIR}${datadir}/${BPN}/build/config_vars.mk
163 sed -i 's!^includedir = .*!includedir = ${STAGING_INCDIR}/apache2!' ${SYSROOT_DESTDIR}${datadir}/${BPN}/build/config_vars.mk
164 sed -i 's!^CFLAGS = -I[^ ]*!CFLAGS = -I${STAGING_INCDIR}/openssl!' ${SYSROOT_DESTDIR}${datadir}/${BPN}/build/config_vars.mk
165 sed -i 's!^EXTRA_LDFLAGS = .*!EXTRA_LDFLAGS = -L${STAGING_LIBDIR}!' ${SYSROOT_DESTDIR}${datadir}/${BPN}/build/config_vars.mk
166 sed -i 's!^EXTRA_INCLUDES = .*!EXTRA_INCLUDES = -I$(includedir) -I. -I${STAGING_INCDIR}!' ${SYSROOT_DESTDIR}${datadir}/${BPN}/build/config_vars.mk
167 sed -i 's!--sysroot=[^ ]*!--sysroot=${STAGING_DIR_HOST}!' ${SYSROOT_DESTDIR}${datadir}/${BPN}/build/config_vars.mk
168}
169
170# Implications - used by update-rc.d scripts
171INITSCRIPT_NAME = "apache2"
172INITSCRIPT_PARAMS = "defaults 91 20"
173
174SYSTEMD_SERVICE:${PN} = "apache2.service"
175SYSTEMD_AUTO_ENABLE:${PN} = "enable"
176
177ALTERNATIVE:${PN}-doc = "htpasswd.1"
178ALTERNATIVE_LINK_NAME[htpasswd.1] = "${mandir}/man1/htpasswd.1"
179
Andrew Geissler615f2f12022-07-15 14:00:58 -0500180PACKAGES = "${PN}-utils ${PN}-scripts ${PN}-doc ${PN}-dev ${PN}-dbg ${PN}"
Andrew Geissler9aee5002022-03-30 16:27:02 +0000181
182CONFFILES:${PN} = "${sysconfdir}/${BPN}/httpd.conf \
183 ${sysconfdir}/${BPN}/magic \
184 ${sysconfdir}/${BPN}/mime.types \
185 ${sysconfdir}/${BPN}/extra/*"
186
Andrew Geissler615f2f12022-07-15 14:00:58 -0500187FILES:${PN}-utils = "${bindir}/ab \
188 ${bindir}/htdbm \
189 ${bindir}/htdigest \
190 ${bindir}/htpasswd \
191 ${bindir}/logresolve \
192 ${bindir}/httxt2dbm \
193 ${sbindir}/htcacheclean \
194 ${sbindir}/fcgistarter \
195 ${sbindir}/checkgid \
196 ${sbindir}/rotatelogs \
197 "
198
Andrew Geissler9aee5002022-03-30 16:27:02 +0000199# We override here rather than append so that .so links are
200# included in the runtime package rather than here (-dev)
201# and to get build, icons, error into the -dev package
202FILES:${PN}-dev = "${datadir}/${BPN}/build \
203 ${datadir}/${BPN}/icons \
204 ${datadir}/${BPN}/error \
205 ${includedir}/${BPN} \
206 ${bindir}/apxs \
207 "
208
209# Add the manual to -doc
210FILES:${PN}-doc += " ${datadir}/${BPN}/manual"
211
212FILES:${PN}-scripts += "${bindir}/dbmmanage"
213
214# Override this too - here is the default, less datadir
215FILES:${PN} = "${bindir} ${sbindir} ${libexecdir} ${libdir} \
216 ${sysconfdir} ${libdir}/${BPN}"
217
218# We want htdocs and cgi-bin to go with the binary
219FILES:${PN} += "${datadir}/${BPN}/ ${libdir}/cgi-bin"
220
221FILES:${PN}-dbg += "${libdir}/${BPN}/modules/.debug"
222
Andrew Geissler615f2f12022-07-15 14:00:58 -0500223RDEPENDS:${PN} += "openssl libgcc ${PN}-utils"
Andrew Geissler9aee5002022-03-30 16:27:02 +0000224RDEPENDS:${PN}-scripts += "perl ${PN}"
225RDEPENDS:${PN}-dev = "perl"
226
227BBCLASSEXTEND = "native"
228
229pkg_postinst:${PN}() {
230 if [ -z "$D" ]; then
231 if type systemd-tmpfiles >/dev/null; then
232 systemd-tmpfiles --create
233 elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
234 ${sysconfdir}/init.d/populate-volatile.sh update
235 fi
236 fi
237}