blob: a34734c2071350dfceb94d1ab49e100909a5b52d [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001DESCRIPTION = "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 "
18
19SRC_URI_append_class-target = " \
20 file://0008-apache2-do-not-use-relative-path-for-gen_test_char.patch \
21 file://init \
22 file://apache2-volatile.conf \
23 file://apache2.service \
24 file://volatiles.04_apache2 \
25 "
26
27LIC_FILES_CHKSUM = "file://LICENSE;md5=d52d0fd0bc788f068e647116c01ddfcd"
Brad Bishop665fd022019-08-26 01:32:28 -040028SRC_URI[md5sum] = "dfc674f8f454e3bc2d4ccd73ad3b5f1e"
29SRC_URI[sha256sum] = "133d48298fe5315ae9366a0ec66282fa4040efa5d566174481077ade7d18ea40"
Brad Bishopc342db32019-05-15 21:57:59 -040030
31S = "${WORKDIR}/httpd-${PV}"
32
33inherit autotools update-rc.d pkgconfig systemd update-alternatives
34
35DEPENDS = "openssl expat pcre apr apr-util apache2-native "
36
37CVE_PRODUCT = "http_server"
38
39SSTATE_SCAN_FILES += "apxs config_vars.mk config.nice"
40
41PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'selinux', d)}"
42PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux,libselinux"
43PACKAGECONFIG[openldap] = "--enable-ldap --enable-authnz-ldap,--disable-ldap --disable-authnz-ldap,openldap"
44PACKAGECONFIG[zlib] = "--enable-deflate,,zlib,zlib"
45
46CFLAGS_append = " -DPATH_MAX=4096"
47
48EXTRA_OECONF_class-target = "\
49 --enable-layout=Debian \
50 --prefix=${base_prefix} \
51 --exec_prefix=${exec_prefix} \
52 --includedir=${includedir}/${BPN} \
53 --sysconfdir=${sysconfdir}/${BPN} \
54 --datadir=${datadir}/${BPN} \
55 --libdir=${libdir} \
Brad Bishopc1d34332019-09-09 14:56:00 -040056 --libexecdir=${libexecdir}/${BPN}/modules \
Brad Bishopc342db32019-05-15 21:57:59 -040057 --localstatedir=${localstatedir} \
58 --enable-ssl \
59 --with-dbm=sdbm \
60 --with-gdbm=no \
61 --with-ndbm=no \
62 --with-berkeley-db=no \
63 --enable-info \
64 --enable-rewrite \
65 --enable-mpms-shared \
66 ap_cv_void_ptr_lt_long=no \
67 ac_cv_have_threadsafe_pollset=no \
68 "
69
70EXTRA_OECONF_class-native = "\
71 --prefix=${prefix} \
72 --includedir=${includedir}/${BPN} \
73 --sysconfdir=${sysconfdir}/${BPN} \
74 --datadir=${datadir}/${BPN} \
75 --libdir=${libdir} \
76 --libexecdir=${libdir}/${BPN}/modules \
77 --localstatedir=${localstatedir} \
78 "
79
80do_configure_prepend() {
Brad Bishopc1d34332019-09-09 14:56:00 -040081 sed -i -e 's:$''{prefix}/usr/lib/cgi-bin:$''{libexecdir}/cgi-bin:g' ${S}/config.layout
Brad Bishopc342db32019-05-15 21:57:59 -040082}
83
84do_install_append_class-target() {
85 install -d ${D}/${sysconfdir}/init.d
86
87 cat ${WORKDIR}/init | \
88 sed -e 's,/usr/sbin/,${sbindir}/,g' \
89 -e 's,/usr/bin/,${bindir}/,g' \
90 -e 's,/usr/lib/,${libdir}/,g' \
91 -e 's,/etc/,${sysconfdir}/,g' \
92 -e 's,/usr/,${prefix}/,g' > ${D}/${sysconfdir}/init.d/${BPN}
93
94 chmod 755 ${D}/${sysconfdir}/init.d/${BPN}
95
96 # Remove the goofy original files...
97 rm -rf ${D}/${sysconfdir}/${BPN}/original
98
99 install -d ${D}${sysconfdir}/${BPN}/conf.d
100 install -d ${D}${sysconfdir}/${BPN}/modules.d
101
102 # Ensure configuration file pulls in conf.d and modules.d
103 printf "\nIncludeOptional ${sysconfdir}/${BPN}/conf.d/*.conf" >> ${D}/${sysconfdir}/${BPN}/httpd.conf
104 printf "\nIncludeOptional ${sysconfdir}/${BPN}/modules.d/*.load" >> ${D}/${sysconfdir}/${BPN}/httpd.conf
105 printf "\nIncludeOptional ${sysconfdir}/${BPN}/modules.d/*.conf\n\n" >> ${D}/${sysconfdir}/${BPN}/httpd.conf
106
107 # Match with that is in init script
108 printf "\nPidFile /run/httpd.pid" >> ${D}/${sysconfdir}/${BPN}/httpd.conf
109
110 # Set 'ServerName' to fix error messages when restart apache service
111 sed -i 's/^#ServerName www.example.com/ServerName localhost/' ${D}/${sysconfdir}/${BPN}/httpd.conf
112
113 sed -i 's/^ServerRoot/#ServerRoot/' ${D}/${sysconfdir}/${BPN}/httpd.conf
114
115 sed -i -e 's,${STAGING_DIR_TARGET},,g' \
116 -e 's,${DEBUG_PREFIX_MAP},,g' \
117 -e 's,-fdebug-prefix-map[^ ]*,,g; s,-fmacro-prefix-map[^ ]*,,g' \
118 -e 's,${HOSTTOOLS_DIR}/,,g' \
119 -e 's,APU_INCLUDEDIR = .*,APU_INCLUDEDIR = ,g' \
120 -e 's,APU_CONFIG = .*,APU_CONFIG = ,g' ${D}${datadir}/apache2/build/config_vars.mk
121
122 sed -i -e 's,--sysroot=${STAGING_DIR_TARGET},,g' \
123 -e 's,${DEBUG_PREFIX_MAP},,g' \
124 -e 's,${RECIPE_SYSROOT},,g' \
125 -e 's,-fdebug-prefix-map[^ ]*,,g; s,-fmacro-prefix-map[^ ]*,,g' \
126 -e 's,APU_INCLUDEDIR = .*,APU_INCLUDEDIR = ,g' \
127 -e 's,".*/configure","configure",g' ${D}${datadir}/apache2/build/config.nice
128
129 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
130 install -d ${D}${sysconfdir}/tmpfiles.d/
131 install -m 0644 ${WORKDIR}/apache2-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
132
133 install -d ${D}${systemd_unitdir}/system
134 install -m 0644 ${WORKDIR}/apache2.service ${D}${systemd_unitdir}/system
135 sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/apache2.service
136 sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' ${D}${systemd_unitdir}/system/apache2.service
137 elif ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
138 install -d ${D}${sysconfdir}/default/volatiles
139 install -m 0644 ${WORKDIR}/volatiles.04_apache2 ${D}${sysconfdir}/default/volatiles/04_apache2
140 fi
141
Brad Bishopc1d34332019-09-09 14:56:00 -0400142 rm -rf ${D}${localstatedir} ${D}${sbindir}/envvars*
Brad Bishopc342db32019-05-15 21:57:59 -0400143 chown -R root:root ${D}
144}
145
146do_install_append_class-native() {
147 install -d ${D}${bindir} ${D}${libdir}
148 install -m 755 server/gen_test_char ${D}${bindir}
149}
150
151SYSROOT_PREPROCESS_FUNCS_append_class-target = " apache_sysroot_preprocess"
152
153apache_sysroot_preprocess() {
154 install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}
155 install -m 755 ${D}${bindir}/apxs ${SYSROOT_DESTDIR}${bindir_crossscripts}
156 install -d ${SYSROOT_DESTDIR}${sbindir}
157 install -m 755 ${D}${sbindir}/apachectl ${SYSROOT_DESTDIR}${sbindir}
158 sed -i 's!my $installbuilddir = .*!my $installbuilddir = "${STAGING_DIR_HOST}/${datadir}/${BPN}/build";!' ${SYSROOT_DESTDIR}${bindir_crossscripts}/apxs
159 sed -i 's!my $libtool = .*!my $libtool = "${STAGING_BINDIR_CROSS}/${HOST_SYS}-libtool";!' ${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
180PACKAGES = "${PN}-scripts ${PN}-doc ${PN}-dev ${PN}-dbg ${PN}"
181
182CONFFILES_${PN} = "${sysconfdir}/${BPN}/httpd.conf \
183 ${sysconfdir}/${BPN}/magic \
Brad Bishop15ae2502019-06-18 21:44:24 -0400184 ${sysconfdir}/${BPN}/mime.types \
185 ${sysconfdir}/${BPN}/extra/*"
Brad Bishopc342db32019-05-15 21:57:59 -0400186
187# We override here rather than append so that .so links are
188# included in the runtime package rather than here (-dev)
189# and to get build, icons, error into the -dev package
190FILES_${PN}-dev = "${datadir}/${BPN}/build \
191 ${datadir}/${BPN}/icons \
192 ${datadir}/${BPN}/error \
193 ${includedir}/${BPN} \
194 ${bindir}/apxs \
195 "
196
197# Add the manual to -doc
198FILES_${PN}-doc += " ${datadir}/${BPN}/manual"
199
200FILES_${PN}-scripts += "${bindir}/dbmmanage"
201
202# Override this too - here is the default, less datadir
203FILES_${PN} = "${bindir} ${sbindir} ${libexecdir} ${libdir} \
204 ${sysconfdir} ${libdir}/${BPN}"
205
206# We want htdocs and cgi-bin to go with the binary
207FILES_${PN} += "${datadir}/${BPN}/ ${libdir}/cgi-bin"
208
209FILES_${PN}-dbg += "${libdir}/${BPN}/modules/.debug"
210
211RDEPENDS_${PN} += "openssl libgcc"
212RDEPENDS_${PN}-scripts += "perl ${PN}"
213RDEPENDS_${PN}-dev = "perl"
214
215BBCLASSEXTEND = "native"