From 3f4a120170dcaefc501aa78c8388958c19d82d36 Mon Sep 17 00:00:00 2001 From: midoks Date: Tue, 28 Jun 2022 22:20:46 +0800 Subject: [PATCH] =?UTF-8?q?php74=E4=B9=8B=E5=90=8E=EF=BC=8Cgd=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E7=9B=B4=E6=8E=A5=E5=AE=89=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/php/versions/74/gd.sh | 102 +++++++++++++++++++++++++++++ plugins/php/versions/74/install.sh | 5 -- plugins/php/versions/80/gd.sh | 102 +++++++++++++++++++++++++++++ plugins/php/versions/80/install.sh | 4 -- plugins/php/versions/81/gd.sh | 102 +++++++++++++++++++++++++++++ plugins/php/versions/81/install.sh | 4 -- plugins/php/versions/phplib.conf | 12 ++++ 7 files changed, 318 insertions(+), 13 deletions(-) create mode 100755 plugins/php/versions/74/gd.sh create mode 100755 plugins/php/versions/80/gd.sh create mode 100755 plugins/php/versions/81/gd.sh diff --git a/plugins/php/versions/74/gd.sh b/plugins/php/versions/74/gd.sh new file mode 100755 index 000000000..5b407628e --- /dev/null +++ b/plugins/php/versions/74/gd.sh @@ -0,0 +1,102 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH + +curPath=`pwd` + +rootPath=$(dirname "$curPath") +rootPath=$(dirname "$rootPath") +rootPath=$(dirname "$rootPath") +rootPath=$(dirname "$rootPath") +serverPath=$(dirname "$rootPath") +sourcePath=${serverPath}/source/php + +actionType=$1 +version=$2 + +LIBNAME=gd +LIBV=0 + +NON_ZTS_FILENAME=`ls $serverPath/php/${version}/lib/php/extensions | grep no-debug-non-zts` +extFile=$serverPath/php/${version}/lib/php/extensions/${NON_ZTS_FILENAME}/${LIBNAME}.so + +sysName=`uname` +if [ "$sysName" == "Darwin" ];then + BAK='_bak' +else + BAK='' +fi + +Install_lib() +{ + + isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"` + if [ "${isInstall}" != "" ];then + echo "php-$version 已安装${LIBNAME},请选择其它版本!" + return + fi + + if [ ! -f "$extFile" ];then + + if [ ! -d $sourcePath/php${version}/ext ];then + cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version} + fi + + cd $sourcePath/php${version}/ext/${LIBNAME} + + $serverPath/php/$version/bin/phpize + ./configure --with-php-config=$serverPath/php/$version/bin/php-config \ + --enable-gd \ + --with-webp \ + --with-xpm \ + --with-freetype \ + --enable-gd-jis-conv + + make clean && make && make install && make clean + + fi + + if [ ! -f "$extFile" ];then + echo "ERROR!" + return + fi + + echo "" >> $serverPath/php/$version/etc/php.ini + echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini + echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini + + $serverPath/php/init.d/php$version reload + echo '===========================================================' + echo 'successful!' +} + + +Uninstall_lib() +{ + if [ ! -f "$serverPath/php/$version/bin/php-config" ];then + echo "php-$version 未安装,请选择其它版本!" + return + fi + + if [ ! -f "$extFile" ];then + echo "php-$version 未安装${LIBNAME},请选择其它版本!" + return + fi + + echo $serverPath/php/$version/etc/php.ini + sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini + sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini + + rm -f $extFile + $serverPath/php/init.d/php$version reload + echo '===============================================' + echo 'successful!' +} + + + +if [ "$actionType" == 'install' ];then + Install_lib +elif [ "$actionType" == 'uninstall' ];then + Uninstall_lib +fi \ No newline at end of file diff --git a/plugins/php/versions/74/install.sh b/plugins/php/versions/74/install.sh index 8fd8fa592..7629e4f74 100755 --- a/plugins/php/versions/74/install.sh +++ b/plugins/php/versions/74/install.sh @@ -49,11 +49,6 @@ if [ $sysName == 'Darwin' ]; then export LDFLAGS="-L/usr/local/opt/libxml2/lib" else OPTIONS="--with-iconv=${serverPath}/lib/libiconv" - OPTIONS="${OPTIONS} --enable-gd" - OPTIONS="${OPTIONS} --enable-gd-jis-conv" - - OPTIONS="${OPTIONS} --with-webp --with-webp-dir=/usr/lib" - OPTIONS="${OPTIONS} --with-jpeg --with-jpeg-dir=/usr/lib" OPTIONS="${OPTIONS} --with-curl" fi diff --git a/plugins/php/versions/80/gd.sh b/plugins/php/versions/80/gd.sh new file mode 100755 index 000000000..5b407628e --- /dev/null +++ b/plugins/php/versions/80/gd.sh @@ -0,0 +1,102 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH + +curPath=`pwd` + +rootPath=$(dirname "$curPath") +rootPath=$(dirname "$rootPath") +rootPath=$(dirname "$rootPath") +rootPath=$(dirname "$rootPath") +serverPath=$(dirname "$rootPath") +sourcePath=${serverPath}/source/php + +actionType=$1 +version=$2 + +LIBNAME=gd +LIBV=0 + +NON_ZTS_FILENAME=`ls $serverPath/php/${version}/lib/php/extensions | grep no-debug-non-zts` +extFile=$serverPath/php/${version}/lib/php/extensions/${NON_ZTS_FILENAME}/${LIBNAME}.so + +sysName=`uname` +if [ "$sysName" == "Darwin" ];then + BAK='_bak' +else + BAK='' +fi + +Install_lib() +{ + + isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"` + if [ "${isInstall}" != "" ];then + echo "php-$version 已安装${LIBNAME},请选择其它版本!" + return + fi + + if [ ! -f "$extFile" ];then + + if [ ! -d $sourcePath/php${version}/ext ];then + cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version} + fi + + cd $sourcePath/php${version}/ext/${LIBNAME} + + $serverPath/php/$version/bin/phpize + ./configure --with-php-config=$serverPath/php/$version/bin/php-config \ + --enable-gd \ + --with-webp \ + --with-xpm \ + --with-freetype \ + --enable-gd-jis-conv + + make clean && make && make install && make clean + + fi + + if [ ! -f "$extFile" ];then + echo "ERROR!" + return + fi + + echo "" >> $serverPath/php/$version/etc/php.ini + echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini + echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini + + $serverPath/php/init.d/php$version reload + echo '===========================================================' + echo 'successful!' +} + + +Uninstall_lib() +{ + if [ ! -f "$serverPath/php/$version/bin/php-config" ];then + echo "php-$version 未安装,请选择其它版本!" + return + fi + + if [ ! -f "$extFile" ];then + echo "php-$version 未安装${LIBNAME},请选择其它版本!" + return + fi + + echo $serverPath/php/$version/etc/php.ini + sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini + sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini + + rm -f $extFile + $serverPath/php/init.d/php$version reload + echo '===============================================' + echo 'successful!' +} + + + +if [ "$actionType" == 'install' ];then + Install_lib +elif [ "$actionType" == 'uninstall' ];then + Uninstall_lib +fi \ No newline at end of file diff --git a/plugins/php/versions/80/install.sh b/plugins/php/versions/80/install.sh index 0111883db..5e7b859ed 100755 --- a/plugins/php/versions/80/install.sh +++ b/plugins/php/versions/80/install.sh @@ -49,10 +49,6 @@ if [ $sysName == 'Darwin' ]; then export LDFLAGS="-L/usr/local/opt/libxml2/lib" else OPTIONS="--with-iconv=${serverPath}/lib/libiconv" - OPTIONS="${OPTIONS} --enable-gd" - OPTIONS="${OPTIONS} --enable-gd-jis-conv" - OPTIONS="${OPTIONS} --with-webp --with-webp-dir=/usr/lib" - OPTIONS="${OPTIONS} --with-jpeg --with-jpeg-dir=/usr/lib" OPTIONS="${OPTIONS} --with-curl" fi diff --git a/plugins/php/versions/81/gd.sh b/plugins/php/versions/81/gd.sh new file mode 100755 index 000000000..5b407628e --- /dev/null +++ b/plugins/php/versions/81/gd.sh @@ -0,0 +1,102 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH + +curPath=`pwd` + +rootPath=$(dirname "$curPath") +rootPath=$(dirname "$rootPath") +rootPath=$(dirname "$rootPath") +rootPath=$(dirname "$rootPath") +serverPath=$(dirname "$rootPath") +sourcePath=${serverPath}/source/php + +actionType=$1 +version=$2 + +LIBNAME=gd +LIBV=0 + +NON_ZTS_FILENAME=`ls $serverPath/php/${version}/lib/php/extensions | grep no-debug-non-zts` +extFile=$serverPath/php/${version}/lib/php/extensions/${NON_ZTS_FILENAME}/${LIBNAME}.so + +sysName=`uname` +if [ "$sysName" == "Darwin" ];then + BAK='_bak' +else + BAK='' +fi + +Install_lib() +{ + + isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"` + if [ "${isInstall}" != "" ];then + echo "php-$version 已安装${LIBNAME},请选择其它版本!" + return + fi + + if [ ! -f "$extFile" ];then + + if [ ! -d $sourcePath/php${version}/ext ];then + cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version} + fi + + cd $sourcePath/php${version}/ext/${LIBNAME} + + $serverPath/php/$version/bin/phpize + ./configure --with-php-config=$serverPath/php/$version/bin/php-config \ + --enable-gd \ + --with-webp \ + --with-xpm \ + --with-freetype \ + --enable-gd-jis-conv + + make clean && make && make install && make clean + + fi + + if [ ! -f "$extFile" ];then + echo "ERROR!" + return + fi + + echo "" >> $serverPath/php/$version/etc/php.ini + echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini + echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini + + $serverPath/php/init.d/php$version reload + echo '===========================================================' + echo 'successful!' +} + + +Uninstall_lib() +{ + if [ ! -f "$serverPath/php/$version/bin/php-config" ];then + echo "php-$version 未安装,请选择其它版本!" + return + fi + + if [ ! -f "$extFile" ];then + echo "php-$version 未安装${LIBNAME},请选择其它版本!" + return + fi + + echo $serverPath/php/$version/etc/php.ini + sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini + sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini + + rm -f $extFile + $serverPath/php/init.d/php$version reload + echo '===============================================' + echo 'successful!' +} + + + +if [ "$actionType" == 'install' ];then + Install_lib +elif [ "$actionType" == 'uninstall' ];then + Uninstall_lib +fi \ No newline at end of file diff --git a/plugins/php/versions/81/install.sh b/plugins/php/versions/81/install.sh index 83a9dd075..177ae1d1f 100755 --- a/plugins/php/versions/81/install.sh +++ b/plugins/php/versions/81/install.sh @@ -51,10 +51,6 @@ if [ $sysName == 'Darwin' ]; then else OPTIONS="--with-iconv=${serverPath}/lib/libiconv" OPTIONS="${OPTIONS} --with-freetype-dir=${serverPath}/lib/freetype" - OPTIONS="${OPTIONS} --enable-gd" - OPTIONS="${OPTIONS} --enable-gd-jis-conv" - OPTIONS="${OPTIONS} --with-webp --with-webp-dir=/usr/lib" - OPTIONS="${OPTIONS} --with-jpeg --with-jpeg-dir=/usr/lib" OPTIONS="${OPTIONS} --with-curl" OPTIONS="${OPTIONS} --with-libzip=${serverPath}/lib/libzip" fi diff --git a/plugins/php/versions/phplib.conf b/plugins/php/versions/phplib.conf index d8544effc..2f68212ce 100755 --- a/plugins/php/versions/phplib.conf +++ b/plugins/php/versions/phplib.conf @@ -140,6 +140,18 @@ "shell": "exif.sh", "check": "exif.so" }, + { + "name": "gd", + "versions": [ + "74", + "80", + "81" + ], + "type": "通用扩展", + "msg": "通用GD库!", + "shell": "gd.sh", + "check": "gd.so" + }, { "name": "intl", "versions": [