blob: 1ac4fcbf2671d32e2699c5ca3c5527f61979312d [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001DESCRIPTION = "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://apache-configure_perlbin.patch \
17 file://0001-support-apxs.in-force-destdir-to-be-empty-string.patch \
18 "
19
Patrick Williams213cb262021-08-07 19:21:33 -050020SRC_URI:append:class-target = " \
Andrew Geissler82c905d2020-04-13 13:39:40 -050021 file://0008-apache2-do-not-use-relative-path-for-gen_test_char.patch \
22 file://init \
23 file://apache2-volatile.conf \
24 file://apache2.service \
25 file://volatiles.04_apache2 \
26 "
27
28LIC_FILES_CHKSUM = "file://LICENSE;md5=bddeddfac80b2c9a882241d008bb41c3"
Patrick Williams213cb262021-08-07 19:21:33 -050029SRC_URI[md5sum] = "a7088cec171b0d00bf43394ce64d3909"
30SRC_URI[sha256sum] = "1bc826e7b2e88108c7e4bf43c026636f77a41d849cfb667aa7b5c0b86dbf966c"
Andrew Geissler82c905d2020-04-13 13:39:40 -050031
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
38CVE_PRODUCT = "http_server"
39
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
Patrick Williams213cb262021-08-07 19:21:33 -050047CFLAGS:append = " -DPATH_MAX=4096"
Andrew Geissler82c905d2020-04-13 13:39:40 -050048
Patrick Williams213cb262021-08-07 19:21:33 -050049EXTRA_OECONF:class-target = "\
Andrew Geissler82c905d2020-04-13 13:39:40 -050050 --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
Patrick Williams213cb262021-08-07 19:21:33 -050071EXTRA_OECONF:class-native = "\
Andrew Geissler82c905d2020-04-13 13:39:40 -050072 --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
Patrick Williams213cb262021-08-07 19:21:33 -050081do_configure:prepend() {
Andrew Geissler82c905d2020-04-13 13:39:40 -050082 sed -i -e 's:$''{prefix}/usr/lib/cgi-bin:$''{libexecdir}/cgi-bin:g' ${S}/config.layout
83}
84
Patrick Williams213cb262021-08-07 19:21:33 -050085do_install:append:class-target() {
Andrew Geissler82c905d2020-04-13 13:39:40 -050086 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' \
Andrew Geisslerf103a7f2021-05-07 16:09:40 -0500118 -e 's,-fdebug-prefix-map[^ ]*,,g; s,-fmacro-prefix-map[^ ]*,,g; s,-ffile-prefix-map[^ ]*,,g' \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500119 -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' \
Andrew Geisslerf103a7f2021-05-07 16:09:40 -0500126 -e 's,-fdebug-prefix-map[^ ]*,,g; s,-fmacro-prefix-map[^ ]*,,g; s,-fmacro-prefix-map[^ ]*,,g' \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500127 -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
Patrick Williams213cb262021-08-07 19:21:33 -0500147do_install:append:class-native() {
Andrew Geissler82c905d2020-04-13 13:39:40 -0500148 install -d ${D}${bindir} ${D}${libdir}
149 install -m 755 server/gen_test_char ${D}${bindir}
150}
151
Patrick Williams213cb262021-08-07 19:21:33 -0500152SYSROOT_PREPROCESS_FUNCS:append:class-target = " apache_sysroot_preprocess"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500153
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 sed -i 's!my $libtool = .*!my $libtool = "${STAGING_BINDIR_CROSS}/${HOST_SYS}-libtool";!' ${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
Patrick Williams213cb262021-08-07 19:21:33 -0500175SYSTEMD_SERVICE:${PN} = "apache2.service"
176SYSTEMD_AUTO_ENABLE:${PN} = "enable"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500177
Patrick Williams213cb262021-08-07 19:21:33 -0500178ALTERNATIVE:${PN}-doc = "htpasswd.1"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500179ALTERNATIVE_LINK_NAME[htpasswd.1] = "${mandir}/man1/htpasswd.1"
180
181PACKAGES = "${PN}-scripts ${PN}-doc ${PN}-dev ${PN}-dbg ${PN}"
182
Patrick Williams213cb262021-08-07 19:21:33 -0500183CONFFILES:${PN} = "${sysconfdir}/${BPN}/httpd.conf \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500184 ${sysconfdir}/${BPN}/magic \
185 ${sysconfdir}/${BPN}/mime.types \
186 ${sysconfdir}/${BPN}/extra/*"
187
188# We override here rather than append so that .so links are
189# included in the runtime package rather than here (-dev)
190# and to get build, icons, error into the -dev package
Patrick Williams213cb262021-08-07 19:21:33 -0500191FILES:${PN}-dev = "${datadir}/${BPN}/build \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500192 ${datadir}/${BPN}/icons \
193 ${datadir}/${BPN}/error \
194 ${includedir}/${BPN} \
195 ${bindir}/apxs \
196 "
197
198# Add the manual to -doc
Patrick Williams213cb262021-08-07 19:21:33 -0500199FILES:${PN}-doc += " ${datadir}/${BPN}/manual"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500200
Patrick Williams213cb262021-08-07 19:21:33 -0500201FILES:${PN}-scripts += "${bindir}/dbmmanage"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500202
203# Override this too - here is the default, less datadir
Patrick Williams213cb262021-08-07 19:21:33 -0500204FILES:${PN} = "${bindir} ${sbindir} ${libexecdir} ${libdir} \
Andrew Geissler82c905d2020-04-13 13:39:40 -0500205 ${sysconfdir} ${libdir}/${BPN}"
206
207# We want htdocs and cgi-bin to go with the binary
Patrick Williams213cb262021-08-07 19:21:33 -0500208FILES:${PN} += "${datadir}/${BPN}/ ${libdir}/cgi-bin"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500209
Patrick Williams213cb262021-08-07 19:21:33 -0500210FILES:${PN}-dbg += "${libdir}/${BPN}/modules/.debug"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500211
Patrick Williams213cb262021-08-07 19:21:33 -0500212RDEPENDS:${PN} += "openssl libgcc"
213RDEPENDS:${PN}-scripts += "perl ${PN}"
214RDEPENDS:${PN}-dev = "perl"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500215
216BBCLASSEXTEND = "native"
Andrew Geissler2ee498a2020-05-29 15:52:06 -0500217
Patrick Williams213cb262021-08-07 19:21:33 -0500218pkg_postinst:${PN}() {
Andrew Geissler2ee498a2020-05-29 15:52:06 -0500219 if [ -z "$D" ]; then
220 if type systemd-tmpfiles >/dev/null; then
221 systemd-tmpfiles --create
222 elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
223 ${sysconfdir}/init.d/populate-volatile.sh update
224 fi
225 fi
226}