-
Notifications
You must be signed in to change notification settings - Fork 761
/
Copy pathGraphicsMagick.sh
64 lines (60 loc) · 2.29 KB
/
GraphicsMagick.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
# Author: yeho <lj2007331 AT gmail.com>
# BLOG: https://linuxeye.com
#
# Notes: LNMP for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
#
Install_GraphicsMagick() {
if [ -d "${gmagick_install_dir}" ]; then
echo "${CWARNING}GraphicsMagick already installed! ${CEND}"
else
pushd ${current_dir}/src > /dev/null
tar xJf GraphicsMagick-${graphicsmagick_ver}.tar.xz
pushd GraphicsMagick-${graphicsmagick_ver} > /dev/null
./configure --prefix=${gmagick_install_dir} --enable-shared --enable-static --enable-symbol-prefix
make -j ${THREAD} && make install
popd > /dev/null
rm -rf GraphicsMagick-${graphicsmagick_ver}
popd > /dev/null
fi
}
Uninstall_GraphicsMagick() {
if [ -d "${gmagick_install_dir}" ]; then
rm -rf ${gmagick_install_dir}
echo; echo "${CMSG}GraphicsMagick uninstall completed${CEND}"
fi
}
Install_pecl_gmagick() {
if [ -e "${php_install_dir}/bin/phpize" ]; then
pushd ${current_dir}/src > /dev/null
phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir`
if [ "`${php_install_dir}/bin/php-config --version | awk -F. '{print $1}'`" == '5' ]; then
tar xzf gmagick-1.1.7RC3.tgz
pushd gmagick-1.1.7RC3 > /dev/null
else
tar xzf gmagick-${gmagick_ver}.tgz
pushd gmagick-${gmagick_ver} > /dev/null
fi
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
${php_install_dir}/bin/phpize
./configure --with-php-config=${php_install_dir}/bin/php-config --with-gmagick=${gmagick_install_dir}
make -j ${THREAD} && make install
popd > /dev/null
if [ -f "${phpExtensionDir}/gmagick.so" ]; then
echo 'extension=gmagick.so' > ${php_install_dir}/etc/php.d/03-gmagick.ini
echo "${CSUCCESS}PHP gmagick module installed successfully! ${CEND}"
rm -rf gmagick-${gmagick_ver} gmagick-1.1.7RC3
else
echo "${CFAILURE}PHP gmagick module install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
fi
popd > /dev/null
fi
}
Uninstall_pecl_gmagick() {
if [ -e "${php_install_dir}/etc/php.d/03-gmagick.ini" ]; then
rm -f ${php_install_dir}/etc/php.d/03-gmagick.ini
echo; echo "${CMSG}PHP gmagick module uninstall completed${CEND}"
else
echo; echo "${CWARNING}PHP gmagick module does not exist! ${CEND}"
fi
}