GraphicsMagick.sh 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/bash
  2. # Author: yeho <lj2007331 AT gmail.com>
  3. # BLOG: https://linuxeye.com
  4. #
  5. # Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
  6. #
  7. # Project home page:
  8. # https://oneinstack.com
  9. # https://github.com/oneinstack/oneinstack
  10. Install_GraphicsMagick() {
  11. if [ -d "${gmagick_install_dir}" ]; then
  12. echo "${CWARNING}GraphicsMagick already installed! ${CEND}"
  13. else
  14. pushd ${oneinstack_dir}/src > /dev/null
  15. tar xzf GraphicsMagick-${graphicsmagick_ver}.tar.gz
  16. pushd GraphicsMagick-${graphicsmagick_ver} > /dev/null
  17. ./configure --prefix=${gmagick_install_dir} --enable-shared --enable-static --enable-symbol-prefix
  18. make -j ${THREAD} && make install
  19. popd > /dev/null
  20. rm -rf GraphicsMagick-${graphicsmagick_ver}
  21. popd > /dev/null
  22. fi
  23. }
  24. Uninstall_GraphicsMagick() {
  25. if [ -d "${gmagick_install_dir}" ]; then
  26. rm -rf ${gmagick_install_dir}
  27. echo; echo "${CMSG}GraphicsMagick uninstall completed${CEND}"
  28. fi
  29. }
  30. Install_pecl_gmagick() {
  31. if [ -e "${php_install_dir}/bin/phpize" ]; then
  32. pushd ${oneinstack_dir}/src > /dev/null
  33. phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir`
  34. if [ "`${php_install_dir}/bin/php-config --version | awk -F. '{print $1}'`" == '5' ]; then
  35. tar xzf gmagick-${gmagick_oldver}.tgz
  36. pushd gmagick-${gmagick_oldver} > /dev/null
  37. else
  38. tar xzf gmagick-${gmagick_ver}.tgz
  39. pushd gmagick-${gmagick_ver} > /dev/null
  40. fi
  41. export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
  42. ${php_install_dir}/bin/phpize
  43. ./configure --with-php-config=${php_install_dir}/bin/php-config --with-gmagick=${gmagick_install_dir}
  44. make -j ${THREAD} && make install
  45. popd > /dev/null
  46. if [ -f "${phpExtensionDir}/gmagick.so" ]; then
  47. echo 'extension=gmagick.so' > ${php_install_dir}/etc/php.d/03-gmagick.ini
  48. echo "${CSUCCESS}PHP gmagick module installed successfully! ${CEND}"
  49. rm -rf gmagick-${gmagick_ver} gmagick-${gmagick_oldver}
  50. else
  51. 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
  52. fi
  53. popd > /dev/null
  54. fi
  55. }
  56. Uninstall_pecl_gmagick() {
  57. if [ -e "${php_install_dir}/etc/php.d/03-gmagick.ini" ]; then
  58. rm -f ${php_install_dir}/etc/php.d/03-gmagick.ini
  59. echo; echo "${CMSG}PHP gmagick module uninstall completed${CEND}"
  60. else
  61. echo; echo "${CWARNING}PHP gmagick module does not exist! ${CEND}"
  62. fi
  63. }