GraphicsMagick.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash
  2. # Author: yeho <lj2007331 AT gmail.com>
  3. # BLOG: https://blog.linuxeye.com
  4. #
  5. # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
  6. #
  7. # Project home page:
  8. # https://oneinstack.com
  9. # https://github.com/lj2007331/oneinstack
  10. Install_GraphicsMagick() {
  11. cd $oneinstack_dir/src
  12. tar xzf GraphicsMagick-$GraphicsMagick_version.tar.gz
  13. cd GraphicsMagick-$GraphicsMagick_version
  14. ./configure --prefix=/usr/local/graphicsmagick --enable-shared --enable-static
  15. make -j ${THREAD} && make install
  16. cd ..
  17. rm -rf GraphicsMagick-$GraphicsMagick_version
  18. cd ..
  19. }
  20. Install_php-gmagick() {
  21. cd $oneinstack_dir/src
  22. if [ -e "$php_install_dir/bin/phpize" ];then
  23. if [ "`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1}'`" == '7' ];then
  24. tar xzf gmagick-2.0.4RC1.tgz
  25. cd gmagick-2.0.4RC1
  26. else
  27. tar xzf gmagick-$gmagick_version.tgz
  28. cd gmagick-$gmagick_version
  29. fi
  30. make clean
  31. export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
  32. $php_install_dir/bin/phpize
  33. ./configure --with-php-config=$php_install_dir/bin/php-config --with-gmagick=/usr/local/graphicsmagick
  34. make -j ${THREAD} && make install
  35. cd ..
  36. rm -rf gmagick-$gmagick_version
  37. if [ -f "`$php_install_dir/bin/php-config --extension-dir`/gmagick.so" ];then
  38. cat > $php_install_dir/etc/php.d/ext-gmagick.ini << EOF
  39. [gmagick]
  40. extension=gmagick.so
  41. EOF
  42. [ "$Apache_version" != '1' -a "$Apache_version" != '2' ] && service php-fpm restart || service httpd restart
  43. else
  44. echo "${CFAILURE}PHP gmagick module install failed, Please contact the author! ${CEND}"
  45. fi
  46. fi
  47. cd ..
  48. }