Compile libenchant1 from source for PHP 5/7 when not provided by the system

Test: enchant
pull/423/head
Michele Locati 2021-08-24 15:34:31 +02:00
parent edf2c4d40d
commit 51de6aacb2
No known key found for this signature in database
GPG Key ID: 98B7CE2E7234E28B
2 changed files with 51 additions and 7 deletions

View File

@ -1,4 +1,3 @@
enchant !7.2-alpine3.12 !7.3-alpine3.12 !7.3-alpine3.13 !7.4-alpine3.12 !7.4-alpine3.13
parallel zts parallel zts
pdo_sqlsrv !7.0-alpine3.7 !7.1-alpine3.7 !7.1-alpine3.8 !7.2-alpine3.7 !7.2-alpine3.8 !7.3-alpine3.8 pdo_sqlsrv !7.0-alpine3.7 !7.1-alpine3.7 !7.1-alpine3.8 !7.2-alpine3.7 !7.2-alpine3.8 !7.3-alpine3.8
pthreads zts pthreads zts

View File

@ -53,8 +53,10 @@ resetIFS() {
} }
# Set these variables: # Set these variables:
# - DISTRO containing distribution name (eg 'alpine', 'debian') # - DISTRO containing the distribution name (eg 'alpine', 'debian')
# - DISTO_VERSION containing distribution name and its version(eg 'alpine@3.10', 'debian@9') # - DISTRO_VERSION_NUMBER containing the distribution version (eg '3.14' for Alpine, 11 for Debian)
# - DISTRO_VERSION containing the distribution name and its version(eg 'alpine@3.14', 'debian@11')
# - DISTRO_MAJMIN_VERSION always containing a number representing the distribution version (eg 314 for Alpine, 1100 for Debian)
setDistro() { setDistro() {
if ! test -r /etc/os-release; then if ! test -r /etc/os-release; then
printf 'The file /etc/os-release is not readable\n' >&2 printf 'The file /etc/os-release is not readable\n' >&2
@ -492,16 +494,33 @@ buildRequiredPackageLists() {
;; ;;
enchant@alpine) enchant@alpine)
if test $DISTRO_MAJMIN_VERSION -ge 312; then if test $DISTRO_MAJMIN_VERSION -ge 312; then
if test $PHP_MAJMIN_VERSION -ge 800; then
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent enchant2" buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent enchant2"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile enchant2-dev" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile enchant2-dev"
else
# The system provides libenchant2, supported since PHP 8.0: we need to build libenchant1 on our own
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent glib aspell-libs libhunspell"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile glib-dev aspell-dev hunspell-dev"
fi
else else
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent enchant" buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent enchant"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile enchant-dev" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile enchant-dev"
fi fi
;; ;;
enchant@debian) enchant@debian)
if test $DISTRO_VERSION_NUMBER -ge 11; then
if test $PHP_MAJMIN_VERSION -ge 800; then
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libenchant-2-2"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libenchant-2-dev"
else
# The system provides libenchant2, supported since PHP 8.0: we need to build libenchant1 on our own
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent aspell-en libhunspell-1.7-0"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libglib2.0-dev libaspell-dev libhunspell-dev"
fi
else
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libenchant1c2a" buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libenchant1c2a"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libenchant-dev" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libenchant-dev"
fi
;; ;;
event@alpine) event@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libevent $buildRequiredPackageLists_libssl" buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libevent $buildRequiredPackageLists_libssl"
@ -1461,6 +1480,32 @@ EOF
fi fi
docker-php-ext-configure dba --with-db4 docker-php-ext-configure dba --with-db4
;; ;;
enchant)
installBundledModule_tmp=0
if test $PHP_MAJMIN_VERSION -lt 800; then
case "$DISTRO" in
alpine)
if test $DISTRO_MAJMIN_VERSION -ge 312; then
installBundledModule_tmp=1
fi
;;
debian)
if test $DISTRO_VERSION_NUMBER -ge 11; then
installBundledModule_tmp=1
fi
;;
esac
fi
if test $installBundledModule_tmp -eq 1 && ! test -f /usr/lib/libenchant.so && ! test -f /usr/local/lib/libenchant.so; then
# We need to install libenchant1 from source
installBundledModule_src="$(getPackageSource https://github.com/AbiWord/enchant/releases/download/enchant-1-6-1/enchant-1.6.1.tar.gz)"
cd -- "$installBundledModule_src"
./configure
make -j$(getProcessorCount)
make install
cd - >/dev/null
fi
;;
gd) gd)
if test $PHP_MAJMIN_VERSION -le 506; then if test $PHP_MAJMIN_VERSION -le 506; then
docker-php-ext-configure gd --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-xpm-dir --with-freetype-dir --enable-gd-native-ttf --with-vpx-dir docker-php-ext-configure gd --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-xpm-dir --with-freetype-dir --enable-gd-native-ttf --with-vpx-dir