blob: 52001115202c946c2a187eb119b260f777ee9cdf [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
20SRC_URI_append_class-target = " \
21 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"
29SRC_URI[md5sum] = "791c986b1e70fe61eb44060aacc89a64"
30SRC_URI[sha256sum] = "a497652ab3fc81318cdc2a203090a999150d86461acff97c1065dc910fe10f43"
31
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
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' \
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' \
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 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
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
181PACKAGES = "${PN}-scripts ${PN}-doc ${PN}-dev ${PN}-dbg ${PN}"
182
183CONFFILES_${PN} = "${sysconfdir}/${BPN}/httpd.conf \
184 ${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
191FILES_${PN}-dev = "${datadir}/${BPN}/build \
192 ${datadir}/${BPN}/icons \
193 ${datadir}/${BPN}/error \
194 ${includedir}/${BPN} \
195 ${bindir}/apxs \
196 "
197
198# Add the manual to -doc
199FILES_${PN}-doc += " ${datadir}/${BPN}/manual"
200
201FILES_${PN}-scripts += "${bindir}/dbmmanage"
202
203# Override this too - here is the default, less datadir
204FILES_${PN} = "${bindir} ${sbindir} ${libexecdir} ${libdir} \
205 ${sysconfdir} ${libdir}/${BPN}"
206
207# We want htdocs and cgi-bin to go with the binary
208FILES_${PN} += "${datadir}/${BPN}/ ${libdir}/cgi-bin"
209
210FILES_${PN}-dbg += "${libdir}/${BPN}/modules/.debug"
211
212RDEPENDS_${PN} += "openssl libgcc"
213RDEPENDS_${PN}-scripts += "perl ${PN}"
214RDEPENDS_${PN}-dev = "perl"
215
216BBCLASSEXTEND = "native"