Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | DESCRIPTION = "The Apache HTTP Server is a powerful, efficient, and \ |
| 2 | extensible web server." |
| 3 | SUMMARY = "Apache HTTP Server" |
| 4 | HOMEPAGE = "http://httpd.apache.org/" |
| 5 | SECTION = "net" |
| 6 | LICENSE = "Apache-2.0" |
| 7 | |
| 8 | SRC_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 | |
| 20 | SRC_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 | |
| 28 | LIC_FILES_CHKSUM = "file://LICENSE;md5=bddeddfac80b2c9a882241d008bb41c3" |
Andrew Geissler | d688a01 | 2020-09-18 13:36:00 -0500 | [diff] [blame] | 29 | SRC_URI[md5sum] = "7d661ea5e736dac5e2761d9f49fe8361" |
| 30 | SRC_URI[sha256sum] = "740eddf6e1c641992b22359cabc66e6325868c3c5e2e3f98faf349b61ecf41ea" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 31 | |
| 32 | S = "${WORKDIR}/httpd-${PV}" |
| 33 | |
| 34 | inherit autotools update-rc.d pkgconfig systemd update-alternatives |
| 35 | |
| 36 | DEPENDS = "openssl expat pcre apr apr-util apache2-native " |
| 37 | |
| 38 | CVE_PRODUCT = "http_server" |
| 39 | |
| 40 | SSTATE_SCAN_FILES += "apxs config_vars.mk config.nice" |
| 41 | |
| 42 | PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'selinux', d)}" |
| 43 | PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux,libselinux" |
| 44 | PACKAGECONFIG[openldap] = "--enable-ldap --enable-authnz-ldap,--disable-ldap --disable-authnz-ldap,openldap" |
| 45 | PACKAGECONFIG[zlib] = "--enable-deflate,,zlib,zlib" |
| 46 | |
| 47 | CFLAGS_append = " -DPATH_MAX=4096" |
| 48 | |
| 49 | EXTRA_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 | |
| 71 | EXTRA_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 | |
| 81 | do_configure_prepend() { |
| 82 | sed -i -e 's:$''{prefix}/usr/lib/cgi-bin:$''{libexecdir}/cgi-bin:g' ${S}/config.layout |
| 83 | } |
| 84 | |
| 85 | do_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' \ |
Andrew Geissler | f103a7f | 2021-05-07 16:09:40 -0500 | [diff] [blame] | 118 | -e 's,-fdebug-prefix-map[^ ]*,,g; s,-fmacro-prefix-map[^ ]*,,g; s,-ffile-prefix-map[^ ]*,,g' \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 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' \ |
Andrew Geissler | f103a7f | 2021-05-07 16:09:40 -0500 | [diff] [blame] | 126 | -e 's,-fdebug-prefix-map[^ ]*,,g; s,-fmacro-prefix-map[^ ]*,,g; s,-fmacro-prefix-map[^ ]*,,g' \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 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 | |
| 147 | do_install_append_class-native() { |
| 148 | install -d ${D}${bindir} ${D}${libdir} |
| 149 | install -m 755 server/gen_test_char ${D}${bindir} |
| 150 | } |
| 151 | |
| 152 | SYSROOT_PREPROCESS_FUNCS_append_class-target = " apache_sysroot_preprocess" |
| 153 | |
| 154 | apache_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 |
| 172 | INITSCRIPT_NAME = "apache2" |
| 173 | INITSCRIPT_PARAMS = "defaults 91 20" |
| 174 | |
| 175 | SYSTEMD_SERVICE_${PN} = "apache2.service" |
| 176 | SYSTEMD_AUTO_ENABLE_${PN} = "enable" |
| 177 | |
| 178 | ALTERNATIVE_${PN}-doc = "htpasswd.1" |
| 179 | ALTERNATIVE_LINK_NAME[htpasswd.1] = "${mandir}/man1/htpasswd.1" |
| 180 | |
| 181 | PACKAGES = "${PN}-scripts ${PN}-doc ${PN}-dev ${PN}-dbg ${PN}" |
| 182 | |
| 183 | CONFFILES_${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 |
| 191 | FILES_${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 |
| 199 | FILES_${PN}-doc += " ${datadir}/${BPN}/manual" |
| 200 | |
| 201 | FILES_${PN}-scripts += "${bindir}/dbmmanage" |
| 202 | |
| 203 | # Override this too - here is the default, less datadir |
| 204 | FILES_${PN} = "${bindir} ${sbindir} ${libexecdir} ${libdir} \ |
| 205 | ${sysconfdir} ${libdir}/${BPN}" |
| 206 | |
| 207 | # We want htdocs and cgi-bin to go with the binary |
| 208 | FILES_${PN} += "${datadir}/${BPN}/ ${libdir}/cgi-bin" |
| 209 | |
| 210 | FILES_${PN}-dbg += "${libdir}/${BPN}/modules/.debug" |
| 211 | |
| 212 | RDEPENDS_${PN} += "openssl libgcc" |
| 213 | RDEPENDS_${PN}-scripts += "perl ${PN}" |
| 214 | RDEPENDS_${PN}-dev = "perl" |
| 215 | |
| 216 | BBCLASSEXTEND = "native" |
Andrew Geissler | 2ee498a | 2020-05-29 15:52:06 -0500 | [diff] [blame] | 217 | |
| 218 | pkg_postinst_${PN}() { |
| 219 | 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 | } |