blob: a87e3847f32297dbb8a99d928c549606e1da6b20 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001DESCRIPTION = "The Apache HTTP Server is a powerful, efficient, and \
2extensible web server."
3SUMMARY = "Apache HTTP Server"
4HOMEPAGE = "http://httpd.apache.org/"
5DEPENDS = "libtool-native apache2-native openssl expat pcre apr apr-util"
6SECTION = "net"
7LICENSE = "Apache-2.0"
8
9SRC_URI = "${APACHE_MIRROR}/httpd/httpd-${PV}.tar.bz2 \
10 file://server-makefile.patch \
11 file://httpd-2.4.1-corelimit.patch \
12 file://httpd-2.4.4-export.patch \
13 file://httpd-2.4.1-selinux.patch \
14 file://apache-configure_perlbin.patch \
15 file://replace-lynx-to-curl-in-apachectl-script.patch \
16 file://httpd-2.4.3-fix-race-issue-of-dir-install.patch \
17 file://0001-configure-use-pkg-config-for-PCRE-detection.patch \
18 file://configure-allow-to-disable-selinux-support.patch \
19 file://CVE-2018-11763.patch \
20 file://init \
21 file://apache2-volatile.conf \
22 file://apache2.service \
23 file://volatiles.04_apache2 \
24 "
25
26LIC_FILES_CHKSUM = "file://LICENSE;md5=d52d0fd0bc788f068e647116c01ddfcd"
27SRC_URI[md5sum] = "818adca52f3be187fe45d6822755be95"
28SRC_URI[sha256sum] = "fa53c95631febb08a9de41fd2864cfff815cf62d9306723ab0d4b8d7aa1638f0"
29
30S = "${WORKDIR}/httpd-${PV}"
31
32inherit autotools update-rc.d pkgconfig systemd update-alternatives
33
34ALTERNATIVE_${PN}-doc = "htpasswd.1"
35ALTERNATIVE_LINK_NAME[htpasswd.1] = "${mandir}/man1/htpasswd.1"
36
37SYSTEMD_SERVICE_${PN} = "apache2.service"
38SYSTEMD_AUTO_ENABLE_${PN} = "disable"
39
40SSTATE_SCAN_FILES += "apxs config_vars.mk config.nice"
41
42CFLAGS_append = " -DPATH_MAX=4096"
43CFLAGS_prepend = "-I${STAGING_INCDIR}/openssl "
44EXTRA_OECONF = "--enable-ssl \
45 --with-ssl=${STAGING_LIBDIR}/.. \
46 --with-expat=${STAGING_LIBDIR}/.. \
47 --with-apr=${STAGING_BINDIR_CROSS}/apr-1-config \
48 --with-apr-util=${STAGING_BINDIR_CROSS}/apu-1-config \
49 --enable-info \
50 --enable-rewrite \
51 --with-dbm=sdbm \
52 --with-berkeley-db=no \
53 --localstatedir=/var/${BPN} \
54 --with-gdbm=no \
55 --with-ndbm=no \
56 --includedir=${includedir}/${BPN} \
57 --datadir=${datadir}/${BPN} \
58 --sysconfdir=${sysconfdir}/${BPN} \
59 --libexecdir=${libdir}/${BPN}/modules \
60 ap_cv_void_ptr_lt_long=no \
61 --enable-mpms-shared \
62 ac_cv_have_threadsafe_pollset=no \
63 --enable-layout=Debian \
64 --prefix=${base_prefix}/"
65
66PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'selinux', d)}"
67PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux,libselinux"
68PACKAGECONFIG[openldap] = "--enable-ldap --enable-authnz-ldap,--disable-ldap --disable-authnz-ldap,openldap"
69PACKAGECONFIG[zlib] = "--enable-deflate --with-z=${STAGING_LIBDIR},,zlib,zlib"
70
71do_configure_prepend() {
72 sed -i -e 's:$''{prefix}/usr/lib/cgi-bin:$''{libdir}/cgi-bin:g' ${S}/config.layout
73}
74
75do_install_append() {
76 install -d ${D}/${sysconfdir}/init.d
77 cat ${WORKDIR}/init | \
78 sed -e 's,/usr/sbin/,${sbindir}/,g' \
79 -e 's,/usr/bin/,${bindir}/,g' \
80 -e 's,/usr/lib,${libdir}/,g' \
81 -e 's,/etc/,${sysconfdir}/,g' \
82 -e 's,/usr/,${prefix}/,g' > ${D}/${sysconfdir}/init.d/${BPN}
83 chmod 755 ${D}/${sysconfdir}/init.d/${BPN}
84 # remove the goofy original files...
85 rm -rf ${D}/${sysconfdir}/${BPN}/original
86 # Expat should be found in the staging area via DEPENDS...
87 rm -f ${D}/${libdir}/libexpat.*
88
89 install -d ${D}${sysconfdir}/${BPN}/conf.d
90 install -d ${D}${sysconfdir}/${BPN}/modules.d
91
92 # Ensure configuration file pulls in conf.d and modules.d
93 printf "\nIncludeOptional ${sysconfdir}/${BPN}/conf.d/*.conf" >> ${D}/${sysconfdir}/${BPN}/httpd.conf
94 printf "\nIncludeOptional ${sysconfdir}/${BPN}/modules.d/*.load" >> ${D}/${sysconfdir}/${BPN}/httpd.conf
95 printf "\nIncludeOptional ${sysconfdir}/${BPN}/modules.d/*.conf\n\n" >> ${D}/${sysconfdir}/${BPN}/httpd.conf
96 # match with that is in init script
97 printf "\nPidFile /run/httpd.pid" >> ${D}/${sysconfdir}/${BPN}/httpd.conf
98 # Set 'ServerName' to fix error messages when restart apache service
99 sed -i 's/^#ServerName www.example.com/ServerName localhost/' ${D}/${sysconfdir}/${BPN}/httpd.conf
100
101 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
102 install -d ${D}${sysconfdir}/tmpfiles.d/
103 install -m 0644 ${WORKDIR}/apache2-volatile.conf ${D}${sysconfdir}/tmpfiles.d/
104 elif ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
105 install -d ${D}${sysconfdir}/default/volatiles
106 install -m 0644 ${WORKDIR}/volatiles.04_apache2 ${D}${sysconfdir}/default/volatiles/04_apache2
107 fi
108
109 install -d ${D}${systemd_unitdir}/system
110 install -m 0644 ${WORKDIR}/apache2.service ${D}${systemd_unitdir}/system
111 sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/apache2.service
112 sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' ${D}${systemd_unitdir}/system/apache2.service
113
114 chown -R root:root ${D}
115}
116
117do_install_append_class-target() {
118 sed -i -e 's,${STAGING_DIR_HOST},,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,${STAGING_DIR_HOST},,g' \
123 -e 's,".*/configure","configure",g' ${D}${datadir}/apache2/build/config.nice
124 rm -rf ${D}${localstatedir}/run
125}
126
127SYSROOT_PREPROCESS_FUNCS += "apache_sysroot_preprocess"
128
129apache_sysroot_preprocess () {
130 install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/
131 install -m 755 ${D}${bindir}/apxs ${SYSROOT_DESTDIR}${bindir_crossscripts}/
132 install -d ${SYSROOT_DESTDIR}${sbindir}/
133 install -m 755 ${D}${sbindir}/apachectl ${SYSROOT_DESTDIR}${sbindir}/
134 sed -i 's!my $installbuilddir = .*!my $installbuilddir = "${STAGING_DIR_HOST}/${datadir}/${BPN}/build";!' ${SYSROOT_DESTDIR}${bindir_crossscripts}/apxs
135 sed -i 's!my $libtool = .*!my $libtool = "${STAGING_BINDIR_CROSS}/${HOST_SYS}-libtool";!' ${SYSROOT_DESTDIR}${bindir_crossscripts}/apxs
136
137 sed -i 's!^APR_CONFIG = .*!APR_CONFIG = ${STAGING_BINDIR_CROSS}/apr-1-config!' ${SYSROOT_DESTDIR}${datadir}/${BPN}/build/config_vars.mk
138 sed -i 's!^APU_CONFIG = .*!APU_CONFIG = ${STAGING_BINDIR_CROSS}/apu-1-config!' ${SYSROOT_DESTDIR}${datadir}/${BPN}/build/config_vars.mk
139 sed -i 's!^includedir = .*!includedir = ${STAGING_INCDIR}/apache2!' ${SYSROOT_DESTDIR}${datadir}/${BPN}/build/config_vars.mk
140 sed -i 's!^CFLAGS = -I[^ ]*!CFLAGS = -I${STAGING_INCDIR}/openssl!' ${SYSROOT_DESTDIR}${datadir}/${BPN}/build/config_vars.mk
141 sed -i 's!^EXTRA_LDFLAGS = .*!EXTRA_LDFLAGS = -L${STAGING_LIBDIR}!' ${SYSROOT_DESTDIR}${datadir}/${BPN}/build/config_vars.mk
142 sed -i 's!^EXTRA_INCLUDES = .*!EXTRA_INCLUDES = -I$(includedir) -I. -I${STAGING_INCDIR}!' ${SYSROOT_DESTDIR}${datadir}/${BPN}/build/config_vars.mk
143 sed -i 's!--sysroot=[^ ]*!--sysroot=${STAGING_DIR_HOST}!' ${SYSROOT_DESTDIR}${datadir}/${BPN}/build/config_vars.mk
144}
145
146#
147# implications - used by update-rc.d scripts
148#
149INITSCRIPT_NAME = "apache2"
150INITSCRIPT_PARAMS = "defaults 91 20"
151LEAD_SONAME = "libapr-1.so.0"
152
153PACKAGES = "${PN}-scripts ${PN}-doc ${PN}-dev ${PN}-dbg ${PN}"
154
155CONFFILES_${PN} = "${sysconfdir}/${BPN}/httpd.conf \
156 ${sysconfdir}/${BPN}/magic \
157 ${sysconfdir}/${BPN}/mime.types \
158 ${sysconfdir}/init.d/${BPN} "
159
160# we override here rather than append so that .so links are
161# included in the runtime package rather than here (-dev)
162# and to get build, icons, error into the -dev package
163FILES_${PN}-dev = "${datadir}/${BPN}/build \
164 ${datadir}/${BPN}/icons \
165 ${datadir}/${BPN}/error \
166 ${bindir}/apr-config ${bindir}/apu-config \
167 ${libdir}/apr*.exp \
168 ${includedir}/${BPN} \
169 ${libdir}/*.la \
170 ${libdir}/*.a \
171 ${bindir}/apxs \
172 "
173
174
175# manual to manual
176FILES_${PN}-doc += " ${datadir}/${BPN}/manual"
177
178FILES_${PN}-scripts += "${bindir}/dbmmanage"
179
180#
181# override this too - here is the default, less datadir
182#
183FILES_${PN} = "${bindir} ${sbindir} ${libexecdir} ${libdir}/lib*.so.* ${sysconfdir} \
184 ${sharedstatedir} ${localstatedir} /bin /sbin /lib/*.so* \
185 ${libdir}/${BPN}"
186
187# we want htdocs and cgi-bin to go with the binary
188FILES_${PN} += "${datadir}/${BPN}/htdocs ${datadir}/${BPN}/cgi-bin"
189
190#make sure the lone .so links also get wrapped in the base package
191FILES_${PN} += "${libdir}/lib*.so ${libdir}/pkgconfig/*"
192
193FILES_${PN}-dbg += "${libdir}/${BPN}/modules/.debug"
194
195RDEPENDS_${PN} += "openssl libgcc"
196RDEPENDS_${PN}-scripts += "perl ${PN}"
197RDEPENDS_${PN}-dev = "perl"
198
199FILES_${PN} += "${libdir}/cgi-bin"
200FILES_${PN} += "${datadir}/${BPN}/"