Skip to content

Commit 06a2ed6

Browse files
Build ICU from source
1 parent 3412d10 commit 06a2ed6

File tree

1 file changed

+35
-3
lines changed

1 file changed

+35
-3
lines changed

php-85/Dockerfile

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,42 @@ RUN make -j1 install_sw install_ssldirs
133133
RUN 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,7 @@ WORKDIR ${XML2_BUILD_DIR}/
151183
RUN CFLAGS="" \
152184
CPPFLAGS="-I${INSTALL_DIR}/include -I/usr/include" \
153185
LDFLAGS="-L${INSTALL_DIR}/lib64 -L${INSTALL_DIR}/lib" \
186+
ICU_CONFIG="${INSTALL_DIR}/bin/icu-config" \
154187
./configure \
155188
--prefix=${INSTALL_DIR} \
156189
--with-sysroot=${INSTALL_DIR} \
@@ -159,7 +192,7 @@ RUN CFLAGS="" \
159192
--with-html \
160193
--with-history \
161194
--enable-ipv6=no \
162-
--with-icu \
195+
--with-icu=${INSTALL_DIR} \
163196
--with-zlib \
164197
--without-python
165198
RUN make install \
@@ -402,10 +435,9 @@ RUN make && make install
402435
# Install some dev files for using old libraries already on the system
403436
# readline-devel : needed for the readline extension
404437
# gettext-devel : needed for the --with-gettext flag
405-
# libicu-devel : needed for intl
406438
# libxslt-devel : needed for the XSL extension
407439
# 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
440+
RUN LD_LIBRARY_PATH= yum install -y readline-devel gettext-devel libxslt-devel libffi-devel
409441

410442

411443
# Note: this variable is used when building extra/custom extensions, do not remove

0 commit comments

Comments
 (0)