Merge pull request #221 from mlocati/triplet-variable

Avoid using hard-coded x86_64-linux-gnu target triplet
pull/222/head 1.1.13
Michele Locati 2020-12-14 17:17:37 +01:00 committed by GitHub
commit fa904a9f51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 18 deletions

View File

@ -891,15 +891,13 @@ getProcessorCount() {
fi fi
} }
# Get the build target tripled # Set these variables:
# Output: # - TARGET_TRIPLET the build target tripled (eg 'x86_64-linux-gnu', 'x86_64-alpine-linux-musl')
# The target triplet (eg x86_64-linux-gnu, i686-linux-gnu, i386-linux-gnu, ...) setTargetTriplet() {
getTargetTriplet() { TARGET_TRIPLET="$(gcc -print-multiarch 2>/dev/null || true)"
getTargetTriplet_tmp="$(gcc -print-multiarch 2>/dev/null || true)" if test -z "$TARGET_TRIPLET"; then
if test -z "$getTargetTriplet_tmp"; then TARGET_TRIPLET="$(gcc -dumpmachine)"
getTargetTriplet_tmp="$(gcc -dumpmachine 2>/dev/null || true)"
fi fi
printf '%s' "$getTargetTriplet_tmp"
} }
# Retrieve the number of processors to be used when compiling an extension # Retrieve the number of processors to be used when compiling an extension
@ -1017,8 +1015,7 @@ installOracleInstantClient() {
if ! test -e /usr/lib/libresolv.so.2 && test -e /lib/libc.so.6; then if ! test -e /usr/lib/libresolv.so.2 && test -e /lib/libc.so.6; then
ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2
fi fi
installOracleInstantClient_arch=$(getTargetTriplet) installOracleInstantClient_ldconf=/etc/ld-musl-${TARGET_TRIPLET%-alpine-linux-musl}.path
installOracleInstantClient_ldconf=/etc/ld-musl-${installOracleInstantClient_arch%-alpine-linux-musl}.path
if test -e "$installOracleInstantClient_ldconf"; then if test -e "$installOracleInstantClient_ldconf"; then
if ! cat "$installOracleInstantClient_ldconf" | grep -q "/usr/lib/oracle/$installOracleInstantClient_version/$installOracleInstantClient_client/lib"; then if ! cat "$installOracleInstantClient_ldconf" | grep -q "/usr/lib/oracle/$installOracleInstantClient_version/$installOracleInstantClient_client/lib"; then
cat "/usr/lib/oracle/$installOracleInstantClient_version/$installOracleInstantClient_client/lib" | awk -v suffix=":/usr/lib/oracle/$installOracleInstantClient_version/$installOracleInstantClient_client/lib" '{print NR==1 ? $0suffix : $0}' >"/usr/lib/oracle/$installOracleInstantClient_version/$installOracleInstantClient_client/lib" cat "/usr/lib/oracle/$installOracleInstantClient_version/$installOracleInstantClient_client/lib" | awk -v suffix=":/usr/lib/oracle/$installOracleInstantClient_version/$installOracleInstantClient_client/lib" '{print NR==1 ? $0suffix : $0}' >"/usr/lib/oracle/$installOracleInstantClient_version/$installOracleInstantClient_client/lib"
@ -1070,7 +1067,7 @@ installBundledModule() {
gmp) gmp)
if test $PHP_MAJMIN_VERSION -le 506; then if test $PHP_MAJMIN_VERSION -le 506; then
if ! test -f /usr/include/gmp.h; then if ! test -f /usr/include/gmp.h; then
ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h ln -s /usr/include/$TARGET_TRIPLET/gmp.h /usr/include/gmp.h
UNNEEDED_PACKAGE_LINKS="$UNNEEDED_PACKAGE_LINKS /usr/include/gmp.h" UNNEEDED_PACKAGE_LINKS="$UNNEEDED_PACKAGE_LINKS /usr/include/gmp.h"
fi fi
fi fi
@ -1110,13 +1107,13 @@ installBundledModule() {
ldap) ldap)
case "$DISTRO" in case "$DISTRO" in
debian) debian)
docker-php-ext-configure ldap --with-libdir=lib/$(getTargetTriplet) docker-php-ext-configure ldap --with-libdir=lib/$TARGET_TRIPLET
;; ;;
esac esac
;; ;;
mssql | pdo_dblib) mssql | pdo_dblib)
if ! test -f /usr/lib/libsybdb.so; then if ! test -f /usr/lib/libsybdb.so; then
ln -s /usr/lib/x86_64-linux-gnu/libsybdb.so /usr/lib/libsybdb.so ln -s /usr/lib/$TARGET_TRIPLET/libsybdb.so /usr/lib/libsybdb.so
UNNEEDED_PACKAGE_LINKS="$UNNEEDED_PACKAGE_LINKS /usr/lib/libsybdb.so" UNNEEDED_PACKAGE_LINKS="$UNNEEDED_PACKAGE_LINKS /usr/lib/libsybdb.so"
fi fi
;; ;;
@ -1537,17 +1534,16 @@ installPECLModule() {
# Enable lzf compression support? # Enable lzf compression support?
addConfigureOption 'enable-redis-lzf' 'yes' addConfigureOption 'enable-redis-lzf' 'yes'
if test -z "$installPECLModule_version" || test $(compareVersions "$installPECLModule_version" '5.0.0') -ge 0; then if test -z "$installPECLModule_version" || test $(compareVersions "$installPECLModule_version" '5.0.0') -ge 0; then
installPECLModule_machine=$(getTargetTriplet) if ! test -e /usr/include/zstd.h || ! test -e /usr/lib/libzstd.so -o -e "/usr/lib/$TARGET_TRIPLET/libzstd.so"; then
if ! test -e /usr/include/zstd.h || ! test -e /usr/lib/libzstd.so -o -e "/usr/lib/$installPECLModule_machine/libzstd.so"; then
installPECLModule_zstdVersion=1.4.4 installPECLModule_zstdVersion=1.4.4
installPECLModule_zstdVersionMajor=$(echo $installPECLModule_zstdVersion | cut -d. -f1) installPECLModule_zstdVersionMajor=$(echo $installPECLModule_zstdVersion | cut -d. -f1)
rm -rf /tmp/src/zstd rm -rf /tmp/src/zstd
mv "$(getPackageSource https://github.com/facebook/zstd/releases/download/v1.4.4/zstd-$installPECLModule_zstdVersion.tar.gz)" /tmp/src/zstd mv "$(getPackageSource https://github.com/facebook/zstd/releases/download/v1.4.4/zstd-$installPECLModule_zstdVersion.tar.gz)" /tmp/src/zstd
cd /tmp/src/zstd cd /tmp/src/zstd
make V=0 -j$(getProcessorCount) lib make V=0 -j$(getProcessorCount) lib
cp -f lib/libzstd.so "/usr/lib/$installPECLModule_machine/libzstd.so.$installPECLModule_zstdVersion" cp -f lib/libzstd.so "/usr/lib/$TARGET_TRIPLET/libzstd.so.$installPECLModule_zstdVersion"
ln -sf "/usr/lib/$installPECLModule_machine/libzstd.so.$installPECLModule_zstdVersion" "/usr/lib/$installPECLModule_machine/libzstd.so.$installPECLModule_zstdVersionMajor" ln -sf "/usr/lib/$TARGET_TRIPLET/libzstd.so.$installPECLModule_zstdVersion" "/usr/lib/$TARGET_TRIPLET/libzstd.so.$installPECLModule_zstdVersionMajor"
ln -sf "/usr/lib/$installPECLModule_machine/libzstd.so.$installPECLModule_zstdVersion" "/usr/lib/$installPECLModule_machine/libzstd.so" ln -sf "/usr/lib/$TARGET_TRIPLET/libzstd.so.$installPECLModule_zstdVersion" "/usr/lib/$TARGET_TRIPLET/libzstd.so"
ln -sf /tmp/src/zstd/lib/zstd.h /usr/include/zstd.h ln -sf /tmp/src/zstd/lib/zstd.h /usr/include/zstd.h
UNNEEDED_PACKAGE_LINKS="$UNNEEDED_PACKAGE_LINKS /usr/include/zstd.h" UNNEEDED_PACKAGE_LINKS="$UNNEEDED_PACKAGE_LINKS /usr/include/zstd.h"
cd - >/dev/null cd - >/dev/null
@ -1898,6 +1894,7 @@ buildRequiredPackageLists $PHP_MODULES_TO_INSTALL
if test -n "$PACKAGES_PERSISTENT$PACKAGES_VOLATILE"; then if test -n "$PACKAGES_PERSISTENT$PACKAGES_VOLATILE"; then
installRequiredPackages installRequiredPackages
fi fi
setTargetTriplet
for PHP_MODULE_TO_INSTALL in $PHP_MODULES_TO_INSTALL; do for PHP_MODULE_TO_INSTALL in $PHP_MODULES_TO_INSTALL; do
if stringInList "$PHP_MODULE_TO_INSTALL" "$BUNDLED_MODULES"; then if stringInList "$PHP_MODULE_TO_INSTALL" "$BUNDLED_MODULES"; then
installBundledModule "$PHP_MODULE_TO_INSTALL" installBundledModule "$PHP_MODULE_TO_INSTALL"