blob: 283d630f634e42f8daded0d58fd68bf8b75df451 [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001SUMMARY = "A server-side, HTML-embedded scripting language"
2HOMEPAGE = "http://www.php.net"
3SECTION = "console/network"
4
5LICENSE = "PHP-3.0"
6
7BBCLASSEXTEND = "native"
8DEPENDS = "zlib bzip2 libxml2 virtual/libiconv php-native lemon-native \
9 openssl libmcrypt"
10DEPENDS_class-native = "zlib-native libxml2-native"
11
Brad Bishop6e60e8b2018-02-01 10:27:11 -050012PHP_MAJOR_VERSION = "${@d.getVar('PV', True).split('.')[0]}"
13
Patrick Williamsb48b7b42016-08-17 15:04:38 -050014SRC_URI = "http://php.net/distributions/php-${PV}.tar.bz2 \
15 file://acinclude-xml2-config.patch \
16 file://0001-php-don-t-use-broken-wrapper-for-mkdir.patch \
17 file://0001-acinclude-use-pkgconfig-for-libxml2-config.patch \
18 "
19
Patrick Williamsddad1a12017-02-23 20:36:32 -060020SRC_URI_append_class-target = " \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050021 file://iconv.patch \
22 file://imap-fix-autofoo.patch \
23 file://pear-makefile.patch \
24 file://phar-makefile.patch \
25 file://php_exec_native.patch \
26 file://php-fpm.conf \
27 file://php-fpm-apache.conf \
28 file://configure.patch \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050029 file://70_mod_php${PHP_MAJOR_VERSION}.conf \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050030 file://php-fpm.service \
31 "
32S = "${WORKDIR}/php-${PV}"
33
34inherit autotools pkgconfig pythonnative gettext
35
36# phpize is not scanned for absolute paths by default (but php-config is).
37#
38SSTATE_SCAN_FILES += "phpize"
39SSTATE_SCAN_FILES += "build-defs.h"
40
Brad Bishop6e60e8b2018-02-01 10:27:11 -050041PHP_LIBDIR = "${libdir}/php${PHP_MAJOR_VERSION}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050042
43# Common EXTRA_OECONF
44COMMON_EXTRA_OECONF = "--enable-sockets \
45 --enable-pcntl \
46 --enable-shared \
47 --disable-opcache \
48 --disable-rpath \
49 --with-pic \
50 --libdir=${PHP_LIBDIR} \
51"
52EXTRA_OECONF = "--enable-mbstring \
53 --enable-wddx \
54 --enable-fpm \
55 --enable-zip \
56 --with-libdir=${baselib} \
57 --with-gettext=${STAGING_LIBDIR}/.. \
58 --with-zlib=${STAGING_LIBDIR}/.. \
59 --with-iconv=${STAGING_LIBDIR}/.. \
60 --with-mcrypt=${STAGING_DIR_TARGET}${exec_prefix} \
61 --with-bz2=${STAGING_DIR_TARGET}${exec_prefix} \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050062 --with-config-file-path=${sysconfdir}/php/apache2-php${PHP_MAJOR_VERSION} \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050063 ${@base_conditional('SITEINFO_ENDIANNESS', 'le', 'ac_cv_c_bigendian_php=no', 'ac_cv_c_bigendian_php=yes', d)} \
64 ${@bb.utils.contains('PACKAGECONFIG', 'pam', '', 'ac_cv_lib_pam_pam_start=no', d)} \
65 ${COMMON_EXTRA_OECONF} \
66"
67EXTRA_OECONF_class-native = " \
68 --with-zlib=${STAGING_LIBDIR_NATIVE}/.. \
69 --without-iconv \
70 ${COMMON_EXTRA_OECONF} \
71"
72
73PACKAGECONFIG ??= "mysql sqlite3 imap \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050074 ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6 pam', d)} \
Patrick Williamsddad1a12017-02-23 20:36:32 -060075"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050076PACKAGECONFIG_class-native = ""
77
78PACKAGECONFIG[mysql] = "--with-mysql=${STAGING_DIR_TARGET}${prefix} \
79 --with-mysqli=${STAGING_BINDIR_CROSS}/mysql_config \
80 --with-pdo-mysql=${STAGING_BINDIR_CROSS}/mysql_config \
81 ,--without-mysql --without-mysqli --without-pdo-mysql \
82 ,mysql5"
83
84PACKAGECONFIG[sqlite3] = "--with-sqlite3=${STAGING_LIBDIR}/.. \
85 --with-pdo-sqlite=${STAGING_LIBDIR}/.. \
86 , \
87 ,sqlite3"
88PACKAGECONFIG[pgsql] = "--with-pgsql=${STAGING_DIR_TARGET}${exec_prefix},--without-pgsql,postgresql"
89PACKAGECONFIG[soap] = "--enable-libxml --enable-soap, --disable-soap, libxml2"
90PACKAGECONFIG[apache2] = "--with-apxs2=${STAGING_BINDIR_CROSS}/apxs,,apache2-native apache2"
91PACKAGECONFIG[pam] = ",,libpam"
92PACKAGECONFIG[imap] = "--with-imap=${STAGING_DIR_HOST} \
93 --with-imap-ssl=${STAGING_DIR_HOST} \
94 ,--without-imap --without-imap-ssl \
95 ,uw-imap"
Patrick Williamsddad1a12017-02-23 20:36:32 -060096PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050097
98
99export PHP_NATIVE_DIR = "${STAGING_BINDIR_NATIVE}"
100export PHP_PEAR_PHP_BIN = "${STAGING_BINDIR_NATIVE}/php"
101CFLAGS += " -D_GNU_SOURCE -g -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -I${STAGING_INCDIR}/apache2"
102CFLAGS_append_aarch64 = " -O2"
103
104EXTRA_OEMAKE = "INSTALL_ROOT=${D}"
105
106acpaths = ""
107
108do_configure_prepend () {
109 rm -f ${S}/build/libtool.m4 ${S}/ltmain.sh ${S}/aclocal.m4
110 find ${S} -name config.m4 | xargs -n1 sed -i 's!APXS_HTTPD=.*!APXS_HTTPD=${STAGING_BINDIR_NATIVE}/httpd!'
111}
112
113do_configure_append() {
114 # No, libtool, we really don't want rpath set...
115 sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' ${HOST_SYS}-libtool
116 sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' ${HOST_SYS}-libtool
117}
118
119do_install_append_class-native() {
120 rm -rf ${D}/${PHP_LIBDIR}/php/.registry
121 rm -rf ${D}/${PHP_LIBDIR}/php/.channels
122 rm -rf ${D}/${PHP_LIBDIR}/php/.[a-z]*
123}
124
125do_install_prepend() {
Patrick Williamsddad1a12017-02-23 20:36:32 -0600126 cat ${ACLOCALDIR}/libtool.m4 ${ACLOCALDIR}/lt~obsolete.m4 ${ACLOCALDIR}/ltoptions.m4 \
127 ${ACLOCALDIR}/ltsugar.m4 ${ACLOCALDIR}/ltversion.m4 > ${S}/build/libtool.m4
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500128}
129
130do_install_prepend_class-target() {
131 if ${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'true', 'false', d)}; then
132 # Install dummy config file so apxs doesn't fail
133 install -d ${D}${sysconfdir}/apache2
134 printf "\nLoadModule dummy_module modules/mod_dummy.so\n" > ${D}${sysconfdir}/apache2/httpd.conf
135 fi
136}
137
138# fixme
139do_install_append_class-target() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500140 install -d ${D}${sysconfdir}/
141 if [ -d ${RECIPE_SYSROOT_NATIVE}${sysconfdir} ];then
142 install -m 0644 ${RECIPE_SYSROOT_NATIVE}${sysconfdir}/pear.conf ${D}${sysconfdir}/
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500143 fi
144 rm -rf ${D}/${TMPDIR}
145 rm -rf ${D}/.registry
146 rm -rf ${D}/.channels
147 rm -rf ${D}/.[a-z]*
148 rm -rf ${D}/var
149 rm -f ${D}/${sysconfdir}/php-fpm.conf.default
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500150 sed -i 's:${STAGING_DIR_NATIVE}::g' ${D}${sysconfdir}/pear.conf
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500151 install -m 0644 ${WORKDIR}/php-fpm.conf ${D}/${sysconfdir}/php-fpm.conf
152 install -d ${D}/${sysconfdir}/apache2/conf.d
153 install -m 0644 ${WORKDIR}/php-fpm-apache.conf ${D}/${sysconfdir}/apache2/conf.d/php-fpm.conf
154 install -d ${D}${sysconfdir}/init.d
155 sed -i 's:=/usr/sbin:=${sbindir}:g' ${B}/sapi/fpm/init.d.php-fpm
156 sed -i 's:=/etc:=${sysconfdir}:g' ${B}/sapi/fpm/init.d.php-fpm
157 sed -i 's:=/var:=${localstatedir}:g' ${B}/sapi/fpm/init.d.php-fpm
158 install -m 0755 ${B}/sapi/fpm/init.d.php-fpm ${D}${sysconfdir}/init.d/php-fpm
159 install -m 0644 ${WORKDIR}/php-fpm-apache.conf ${D}/${sysconfdir}/apache2/conf.d/php-fpm.conf
160
161 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)};then
162 install -d ${D}${systemd_unitdir}/system
163 install -m 0644 ${WORKDIR}/php-fpm.service ${D}${systemd_unitdir}/system/
164 sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' \
165 -e 's,@LOCALSTATEDIR@,${localstatedir},g' \
166 ${D}${systemd_unitdir}/system/php-fpm.service
167 fi
168
169 TMP=`dirname ${D}/${TMPDIR}`
170 while test ${TMP} != ${D}; do
171 if [ -d ${TMP} ]; then
172 rmdir ${TMP}
173 fi
174 TMP=`dirname ${TMP}`;
175 done
176
177 if ${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'true', 'false', d)}; then
178 install -d ${D}${libdir}/apache2/modules
179 install -d ${D}${sysconfdir}/apache2/modules.d
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500180 install -d ${D}${sysconfdir}/php/apache2-php${PHP_MAJOR_VERSION}
181 install -m 755 libs/libphp${PHP_MAJOR_VERSION}.so ${D}${libdir}/apache2/modules
182 install -m 644 ${WORKDIR}/70_mod_php${PHP_MAJOR_VERSION}.conf ${D}${sysconfdir}/apache2/modules.d
183 sed -i s,lib/,${libdir}/, ${D}${sysconfdir}/apache2/modules.d/70_mod_php${PHP_MAJOR_VERSION}.conf
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500184 cat ${S}/php.ini-production | \
185 sed -e 's,extension_dir = \"\./\",extension_dir = \"/usr/lib/extensions\",' \
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500186 > ${D}${sysconfdir}/php/apache2-php${PHP_MAJOR_VERSION}/php.ini
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500187 rm -f ${D}${sysconfdir}/apache2/httpd.conf*
188 fi
189}
190
191SYSROOT_PREPROCESS_FUNCS += "php_sysroot_preprocess"
192
193php_sysroot_preprocess () {
194 install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/
195 install -m 755 ${D}${bindir}/phpize ${SYSROOT_DESTDIR}${bindir_crossscripts}/
196 install -m 755 ${D}${bindir}/php-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/
197
198 sed -i 's!eval echo /!eval echo ${STAGING_DIR_HOST}/!' ${SYSROOT_DESTDIR}${bindir_crossscripts}/phpize
199 sed -i 's!^include_dir=.*!include_dir=${STAGING_INCDIR}/php!' ${SYSROOT_DESTDIR}${bindir_crossscripts}/php-config
200}
201
202MODPHP_PACKAGE = "${@bb.utils.contains('PACKAGECONFIG', 'apache2', '${PN}-modphp', '', d)}"
203
204PACKAGES = "${PN}-dbg ${PN}-cli ${PN}-cgi ${PN}-fpm ${PN}-fpm-apache2 ${PN}-pear ${PN}-phar ${MODPHP_PACKAGE} ${PN}-dev ${PN}-staticdev ${PN}-doc ${PN}"
205
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500206RDEPENDS_${PN} += "libgcc"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500207RDEPENDS_${PN}-pear = "${PN}"
208RDEPENDS_${PN}-phar = "${PN}-cli"
209RDEPENDS_${PN}-cli = "${PN}"
210RDEPENDS_${PN}-modphp = "${PN} apache2"
211RDEPENDS_${PN}-dev = "${PN}"
212
213INITSCRIPT_PACKAGES = "${PN}-fpm"
214inherit update-rc.d
215
216FILES_${PN}-dbg =+ "${bindir}/.debug \
217 ${libdir}/apache2/modules/.debug"
218FILES_${PN}-doc += "${PHP_LIBDIR}/php/doc"
219FILES_${PN}-cli = "${bindir}/php"
220FILES_${PN}-phar = "${bindir}/phar*"
221FILES_${PN}-cgi = "${bindir}/php-cgi"
222FILES_${PN}-fpm = "${sbindir}/php-fpm ${sysconfdir}/php-fpm.conf ${datadir}/fpm ${sysconfdir}/init.d/php-fpm ${systemd_unitdir}/system/php-fpm.service"
223FILES_${PN}-fpm-apache2 = "${sysconfdir}/apache2/conf.d/php-fpm.conf"
224CONFFILES_${PN}-fpm = "${sysconfdir}/php-fpm.conf"
225CONFFILES_${PN}-fpm-apache2 = "${sysconfdir}/apache2/conf.d/php-fpm.conf"
226INITSCRIPT_NAME_${PN}-fpm = "php-fpm"
227INITSCRIPT_PARAMS_${PN}-fpm = "defaults 60"
228FILES_${PN}-pear = "${bindir}/pear* ${bindir}/pecl ${PHP_LIBDIR}/php/PEAR \
229 ${PHP_LIBDIR}/php/PEAR*.php ${PHP_LIBDIR}/php/System.php \
230 ${PHP_LIBDIR}/php/peclcmd.php ${PHP_LIBDIR}/php/pearcmd.php \
231 ${PHP_LIBDIR}/php/.channels ${PHP_LIBDIR}/php/.channels/.alias \
232 ${PHP_LIBDIR}/php/.registry ${PHP_LIBDIR}/php/Archive/Tar.php \
233 ${PHP_LIBDIR}/php/Console/Getopt.php ${PHP_LIBDIR}/php/OS/Guess.php \
234 ${PHP_LIBDIR}/php/data/PEAR \
235 ${sysconfdir}/pear.conf"
236FILES_${PN}-dev = "${includedir}/php ${PHP_LIBDIR}/build ${bindir}/phpize \
237 ${bindir}/php-config ${PHP_LIBDIR}/php/.depdb \
238 ${PHP_LIBDIR}/php/.depdblock ${PHP_LIBDIR}/php/.filemap \
239 ${PHP_LIBDIR}/php/.lock ${PHP_LIBDIR}/php/test"
240FILES_${PN} = "${PHP_LIBDIR}/php"
241FILES_${PN} += "${bindir}"
242
243SUMMARY_${PN}-modphp = "PHP module for the Apache HTTP server"
244FILES_${PN}-modphp = "${libdir}/apache2 ${sysconfdir}"
245
246MODPHP_OLDPACKAGE = "${@bb.utils.contains('PACKAGECONFIG', 'apache2', 'modphp', '', d)}"
247RPROVIDES_${PN}-modphp = "${MODPHP_OLDPACKAGE}"
248RREPLACES_${PN}-modphp = "${MODPHP_OLDPACKAGE}"
249RCONFLICTS_${PN}-modphp = "${MODPHP_OLDPACKAGE}"
250
251do_install_append_class-native() {
252 create_wrapper ${D}${bindir}/php \
253 PHP_PEAR_SYSCONF_DIR=${sysconfdir}/
254}
255
256SSTATEPOSTINSTFUNCS_append_class-native = " php_sstate_postinst "
257
258php_sstate_postinst() {
259 if [ "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]
260 then
261 head -n1 ${sysconfdir}/pear.conf > ${sysconfdir}/pear.tmp.conf
262 for p in `tail -n1 ${sysconfdir}/pear.conf | sed -s 's/;/ /g'`; do
263 echo $p | awk -F: 'BEGIN {OFS = ":"; ORS = ";"}{if(NF==3){print $1, length($3)-2*match($3, /^"/), $3} else {print $0}}';
264 done >> ${sysconfdir}/pear.tmp.conf
265 mv -f ${sysconfdir}/pear.tmp.conf ${sysconfdir}/pear.conf
266 fi
267}
268
269# Fails to build with thumb-1 (qemuarm)
270# | {standard input}: Assembler messages:
271# | {standard input}:3719: Error: selected processor does not support Thumb mode `smull r0,r2,r9,r3'
272# | {standard input}:3720: Error: unshifted register required -- `sub r2,r2,r0,asr#31'
273# | {standard input}:3796: Error: selected processor does not support Thumb mode `smull r0,r2,r3,r3'
274# | {standard input}:3797: Error: unshifted register required -- `sub r2,r2,r0,asr#31'
275# | make: *** [ext/standard/math.lo] Error 1
276ARM_INSTRUCTION_SET = "arm"