Define TARGET_TRIPLET

Test: ldap,oci8,redis
pull/221/head
Michele Locati 2020-12-14 16:43:43 +01:00
parent 8d2171c115
commit 35feca8b12
No known key found for this signature in database
GPG Key ID: 98B7CE2E7234E28B
1 changed files with 13 additions and 16 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"
@ -1110,7 +1107,7 @@ 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
;; ;;
@ -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"