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