44ARG IMAGE_VERSION_SUFFIX
55
66# https://www.php.net/downloads
7- ARG VERSION_PHP=8.5.0alpha4
7+ ARG VERSION_PHP=8.5.0beta1
88
99
1010# Lambda uses a custom AMI named Amazon Linux 2
@@ -133,10 +133,42 @@ RUN make -j1 install_sw install_ssldirs
133133RUN mkdir -p ${INSTALL_DIR}/bref/ssl && curl -Lk -o ${CA_BUNDLE} ${CA_BUNDLE_SOURCE}
134134
135135
136+ # ##############################################################################
137+ # ICU
138+ # We need to compile ICU from source because Amazon Linux 2 only has ICU 50.2
139+ # but PHP 8.5 requires ICU 57.1 or higher
140+ # https://github.com/unicode-org/icu/releases
141+ # Uses:
142+ # - None
143+ # Needed by:
144+ # - libxml2
145+ # - php intl extension
146+ ENV VERSION_ICU=77.1
147+ ENV ICU_BUILD_DIR=${BUILD_DIR}/icu
148+ RUN set -xe; \
149+ mkdir -p ${ICU_BUILD_DIR}; \
150+ curl -Ls https://github.com/unicode-org/icu/releases/download/release-${VERSION_ICU//./-}/icu4c-${VERSION_ICU//./_}-src.tgz \
151+ | tar xzC ${ICU_BUILD_DIR} --strip-components=1
152+ WORKDIR ${ICU_BUILD_DIR}/source
153+ RUN CFLAGS="" \
154+ CPPFLAGS="-I${INSTALL_DIR}/include -I/usr/include" \
155+ LDFLAGS="-L${INSTALL_DIR}/lib64 -L${INSTALL_DIR}/lib -Wl,-rpath,${INSTALL_DIR}/lib" \
156+ ./configure \
157+ --prefix=${INSTALL_DIR} \
158+ --enable-shared \
159+ --disable-static \
160+ --disable-samples \
161+ --disable-tests \
162+ --disable-extras \
163+ --disable-layoutex
164+ RUN make && make install
165+
166+
136167# ##############################################################################
137168# LIBXML2
138169# https://gitlab.gnome.org/GNOME/libxml2/-/releases
139170# Uses:
171+ # - icu
140172# - zlib
141173# Needed by:
142174# - php
@@ -151,6 +183,9 @@ WORKDIR ${XML2_BUILD_DIR}/
151183RUN CFLAGS="" \
152184 CPPFLAGS="-I${INSTALL_DIR}/include -I/usr/include" \
153185 LDFLAGS="-L${INSTALL_DIR}/lib64 -L${INSTALL_DIR}/lib" \
186+ PATH="${INSTALL_DIR}/bin:${PATH}" \
187+ ICU_CFLAGS="-I${INSTALL_DIR}/include" \
188+ ICU_LIBS="-L${INSTALL_DIR}/lib -licui18n -licuuc -licudata" \
154189 ./configure \
155190 --prefix=${INSTALL_DIR} \
156191 --with-sysroot=${INSTALL_DIR} \
@@ -402,10 +437,9 @@ RUN make && make install
402437# Install some dev files for using old libraries already on the system
403438# readline-devel : needed for the readline extension
404439# gettext-devel : needed for the --with-gettext flag
405- # libicu-devel : needed for intl
406440# libxslt-devel : needed for the XSL extension
407441# libffi-devel : needed for the FFI extension
408- RUN LD_LIBRARY_PATH= yum install -y readline-devel gettext-devel libicu-devel libxslt-devel libffi-devel
442+ RUN LD_LIBRARY_PATH= yum install -y readline-devel gettext-devel libxslt-devel libffi-devel
409443
410444
411445# Note: this variable is used when building extra/custom extensions, do not remove
@@ -427,7 +461,7 @@ WORKDIR ${PHP_BUILD_DIR}
427461# --silent will hide the progress, but also the errors: we restore error messages with --show-error
428462# --fail makes sure that curl returns an error instead of fetching the 404 page
429463ARG VERSION_PHP
430- RUN curl --location --silent --show-error --fail https://downloads.php.net/~daniels /php-${VERSION_PHP}.tar.gz \
464+ RUN curl --location --silent --show-error --fail https://downloads.php.net/~edorian /php-${VERSION_PHP}.tar.gz \
431465 | tar xzC . --strip-components=1
432466
433467# Configure the build
@@ -444,6 +478,7 @@ RUN ./buildconf --force
444478RUN CFLAGS="-fstack-protector-strong -fpic -fpie -O3 -I${INSTALL_DIR}/include -I/usr/include -ffunction-sections -fdata-sections" \
445479 CPPFLAGS="-fstack-protector-strong -fpic -fpie -O3 -I${INSTALL_DIR}/include -I/usr/include -ffunction-sections -fdata-sections" \
446480 LDFLAGS="-L${INSTALL_DIR}/lib64 -L${INSTALL_DIR}/lib -Wl,-O1 -Wl,--strip-all -Wl,--hash-style=both -pie" \
481+ PKG_CONFIG_PATH="${INSTALL_DIR}/lib/pkgconfig:${INSTALL_DIR}/lib64/pkgconfig" \
447482 ./configure \
448483 --prefix=${INSTALL_DIR} \
449484 --enable-option-checking=fatal \
@@ -513,7 +548,6 @@ COPY --link utils/lib-copy /bref/lib-copy
513548RUN php /bref/lib-copy/copy-dependencies.php /bref-layer/bin/php /bref-layer/lib
514549RUN php /bref/lib-copy/copy-dependencies.php /bref-layer/bref/extensions/apcu.so /bref-layer/lib
515550RUN php /bref/lib-copy/copy-dependencies.php /bref-layer/bref/extensions/intl.so /bref-layer/lib
516- RUN php /bref/lib-copy/copy-dependencies.php /bref-layer/bref/extensions/opcache.so /bref-layer/lib
517551RUN php /bref/lib-copy/copy-dependencies.php /bref-layer/bref/extensions/pdo_mysql.so /bref-layer/lib
518552RUN php /bref/lib-copy/copy-dependencies.php /bref-layer/bref/extensions/pdo_pgsql.so /bref-layer/lib
519553
0 commit comments