diff --git a/php-83/Dockerfile b/php-83/Dockerfile index 5d552622..8228048c 100644 --- a/php-83/Dockerfile +++ b/php-83/Dockerfile @@ -133,10 +133,42 @@ RUN make -j1 install_sw install_ssldirs RUN mkdir -p ${INSTALL_DIR}/bref/ssl && curl -Lk -o ${CA_BUNDLE} ${CA_BUNDLE_SOURCE} +############################################################################### +# ICU +# We need to compile ICU from source because Amazon Linux 2 only has ICU 50.2 +# which is cripplingly old and we want to support newer Unicode standards +# https://github.com/unicode-org/icu/releases +# Uses: +# - None +# Needed by: +# - libxml2 +# - php intl extension +ENV VERSION_ICU=77.1 +ENV ICU_BUILD_DIR=${BUILD_DIR}/icu +RUN set -xe; \ + mkdir -p ${ICU_BUILD_DIR}; \ + curl -Ls https://github.com/unicode-org/icu/releases/download/release-${VERSION_ICU//./-}/icu4c-${VERSION_ICU//./_}-src.tgz \ + | tar xzC ${ICU_BUILD_DIR} --strip-components=1 +WORKDIR ${ICU_BUILD_DIR}/source +RUN CFLAGS="" \ + CPPFLAGS="-I${INSTALL_DIR}/include -I/usr/include" \ + LDFLAGS="-L${INSTALL_DIR}/lib64 -L${INSTALL_DIR}/lib -Wl,-rpath,${INSTALL_DIR}/lib" \ + ./configure \ + --prefix=${INSTALL_DIR} \ + --enable-shared \ + --disable-static \ + --disable-samples \ + --disable-tests \ + --disable-extras \ + --disable-layoutex +RUN make && make install + + ############################################################################### # LIBXML2 # https://gitlab.gnome.org/GNOME/libxml2/-/releases # Uses: +# - icu # - zlib # Needed by: # - php @@ -151,6 +183,9 @@ WORKDIR ${XML2_BUILD_DIR}/ RUN CFLAGS="" \ CPPFLAGS="-I${INSTALL_DIR}/include -I/usr/include" \ LDFLAGS="-L${INSTALL_DIR}/lib64 -L${INSTALL_DIR}/lib" \ + PATH="${INSTALL_DIR}/bin:${PATH}" \ + ICU_CFLAGS="-I${INSTALL_DIR}/include" \ + ICU_LIBS="-L${INSTALL_DIR}/lib -licui18n -licuuc -licudata" \ ./configure \ --prefix=${INSTALL_DIR} \ --with-sysroot=${INSTALL_DIR} \ @@ -399,10 +434,9 @@ RUN make && make install # Install some dev files for using old libraries already on the system # readline-devel : needed for the readline extension # gettext-devel : needed for the --with-gettext flag -# libicu-devel : needed for intl # libxslt-devel : needed for the XSL extension # libffi-devel : needed for the FFI extension -RUN LD_LIBRARY_PATH= yum install -y readline-devel gettext-devel libicu-devel libxslt-devel libffi-devel +RUN LD_LIBRARY_PATH= yum install -y readline-devel gettext-devel libxslt-devel libffi-devel # Note: this variable is used when building extra/custom extensions, do not remove @@ -442,6 +476,7 @@ RUN ./buildconf --force RUN CFLAGS="-fstack-protector-strong -fpic -fpie -O3 -I${INSTALL_DIR}/include -I/usr/include -ffunction-sections -fdata-sections" \ CPPFLAGS="-fstack-protector-strong -fpic -fpie -O3 -I${INSTALL_DIR}/include -I/usr/include -ffunction-sections -fdata-sections" \ LDFLAGS="-L${INSTALL_DIR}/lib64 -L${INSTALL_DIR}/lib -Wl,-O1 -Wl,--strip-all -Wl,--hash-style=both -pie" \ + PKG_CONFIG_PATH="${INSTALL_DIR}/lib/pkgconfig:${INSTALL_DIR}/lib64/pkgconfig" \ ./configure \ --prefix=${INSTALL_DIR} \ --enable-option-checking=fatal \ diff --git a/php-84/Dockerfile b/php-84/Dockerfile index a62eb86f..f875da9d 100644 --- a/php-84/Dockerfile +++ b/php-84/Dockerfile @@ -133,10 +133,42 @@ RUN make -j1 install_sw install_ssldirs RUN mkdir -p ${INSTALL_DIR}/bref/ssl && curl -Lk -o ${CA_BUNDLE} ${CA_BUNDLE_SOURCE} +############################################################################### +# ICU +# We need to compile ICU from source because Amazon Linux 2 only has ICU 50.2 +# which is cripplingly old and we want to support newer Unicode standards +# https://github.com/unicode-org/icu/releases +# Uses: +# - None +# Needed by: +# - libxml2 +# - php intl extension +ENV VERSION_ICU=77.1 +ENV ICU_BUILD_DIR=${BUILD_DIR}/icu +RUN set -xe; \ + mkdir -p ${ICU_BUILD_DIR}; \ + curl -Ls https://github.com/unicode-org/icu/releases/download/release-${VERSION_ICU//./-}/icu4c-${VERSION_ICU//./_}-src.tgz \ + | tar xzC ${ICU_BUILD_DIR} --strip-components=1 +WORKDIR ${ICU_BUILD_DIR}/source +RUN CFLAGS="" \ + CPPFLAGS="-I${INSTALL_DIR}/include -I/usr/include" \ + LDFLAGS="-L${INSTALL_DIR}/lib64 -L${INSTALL_DIR}/lib -Wl,-rpath,${INSTALL_DIR}/lib" \ + ./configure \ + --prefix=${INSTALL_DIR} \ + --enable-shared \ + --disable-static \ + --disable-samples \ + --disable-tests \ + --disable-extras \ + --disable-layoutex +RUN make && make install + + ############################################################################### # LIBXML2 # https://gitlab.gnome.org/GNOME/libxml2/-/releases # Uses: +# - icu # - zlib # Needed by: # - php @@ -151,6 +183,9 @@ WORKDIR ${XML2_BUILD_DIR}/ RUN CFLAGS="" \ CPPFLAGS="-I${INSTALL_DIR}/include -I/usr/include" \ LDFLAGS="-L${INSTALL_DIR}/lib64 -L${INSTALL_DIR}/lib" \ + PATH="${INSTALL_DIR}/bin:${PATH}" \ + ICU_CFLAGS="-I${INSTALL_DIR}/include" \ + ICU_LIBS="-L${INSTALL_DIR}/lib -licui18n -licuuc -licudata" \ ./configure \ --prefix=${INSTALL_DIR} \ --with-sysroot=${INSTALL_DIR} \ @@ -402,10 +437,9 @@ RUN make && make install # Install some dev files for using old libraries already on the system # readline-devel : needed for the readline extension # gettext-devel : needed for the --with-gettext flag -# libicu-devel : needed for intl # libxslt-devel : needed for the XSL extension # libffi-devel : needed for the FFI extension -RUN LD_LIBRARY_PATH= yum install -y readline-devel gettext-devel libicu-devel libxslt-devel libffi-devel +RUN LD_LIBRARY_PATH= yum install -y readline-devel gettext-devel libxslt-devel libffi-devel # Note: this variable is used when building extra/custom extensions, do not remove @@ -444,6 +478,7 @@ RUN ./buildconf --force RUN CFLAGS="-fstack-protector-strong -fpic -fpie -O3 -I${INSTALL_DIR}/include -I/usr/include -ffunction-sections -fdata-sections" \ CPPFLAGS="-fstack-protector-strong -fpic -fpie -O3 -I${INSTALL_DIR}/include -I/usr/include -ffunction-sections -fdata-sections" \ LDFLAGS="-L${INSTALL_DIR}/lib64 -L${INSTALL_DIR}/lib -Wl,-O1 -Wl,--strip-all -Wl,--hash-style=both -pie" \ + PKG_CONFIG_PATH="${INSTALL_DIR}/lib/pkgconfig:${INSTALL_DIR}/lib64/pkgconfig" \ ./configure \ --prefix=${INSTALL_DIR} \ --enable-option-checking=fatal \