diff --git a/mod_php_install.sh b/mod_php_install.sh index 38bffe3..eddf65c 100755 --- a/mod_php_install.sh +++ b/mod_php_install.sh @@ -4,6 +4,8 @@ # _VERSION= +_FREETYPE_VERSION="2.9.1" + #WITHOUT_APACHE_MOD_PHP=true _APACHE_MOD_PHP=no @@ -192,7 +194,8 @@ _required_base_packages="$_required_base_packages liblua5.1-0 liblua5.1-0-dev libsctp-dev libcrypto++-dev - libzip-dev" + libzip-dev + libharfbuzz-dev" # - Package libgraphicsmagick++3 is not available at ubunru 18.04" # - @@ -830,6 +833,44 @@ else fi +_install_freetype=false +if ([[ "$PHP_MAJOR_VERSION" -eq 7 ]] && [[ "$PHP_MINOR_VERSION" -lt 4 ]]) \ + || [[ "$PHP_MAJOR_VERSION" -lt 7 ]] ; then + + if [[ "$os_dist" = "debian" ]] && [[ $os_version -eq 10 ]] ; then + echo "" + echo "" + echo -e "\033[32m--\033[m" + echo "" + echo -e "We need to install a version of freety, which supports" + echo -e "service 'freetype-config'. The development library libfreetype6" + echo -e "of this distribution doesn't." + echo -e "" + echo -e "Which version of freetype should be installed?" + echo "" + echo "" + FREETYPE_VERSION= + if [[ -n "$_FREETYPE_VERSION" ]]; then + echononl "Freetype Version [${_FREETYPE_VERSION}]: " + read FREETYPE_VERSION + if [[ "X$FREETYPE_VERSION" = "X" ]] ; then + FREETYPE_VERSION="$_FREETYPE_VERSION" + fi + else + echononl "Freetype Version: " + read FREETYPE_VERSION + while [[ "X$FREETYPE_VERSION" = "X" ]]; do + echo -e "\n \033[33m\033[1Freetype Version must not be empty!\033[m\n" + echononl "Freetype Version : " + read FREETYPE_VERSION + done + fi + + _install_freetype=true + fi + +fi + if [[ $PHP_MAJOR_VERSION -ge 7 ]] ; then echo "" @@ -958,12 +999,12 @@ if $WITH_PHP_FPM_SUPPORT ; then fi if [[ $PHP_MAJOR_VERSION -ge 7 ]]; then echo "" - echo "Support legacy SQL functions..: $LEGACY_SQL_FUNCTION_SUPPORT" + echo "Support legacy SQL functions.....: $LEGACY_SQL_FUNCTION_SUPPORT" fi echo "" -echo "Install with systemd Support..: $SYSTEMD_EXISTS" +echo "Install with systemd Support.....: $SYSTEMD_EXISTS" echo "" -echo "Install with (apache) mod_php.: $WITH_MOD_PHP" +echo "Install with (apache) mod_php....: $WITH_MOD_PHP" if $WITH_MOD_PHP ; then echo " Apache Version.............: $APACHE_VERSION" fi @@ -978,10 +1019,16 @@ if $SYMLINK_PHP_MAIN_VERSION -o $SYMLINK_PHP ; then fi fi echo "" -echo "Skip 'updatedb'...............: $SKIP_UPDATE_DB" +echo "" +echo "Install extern freetype .........: $_install_freetype" +if $_install_freetype ; then + echo " freetype version .............: $_FREETYPE_VERSION" +fi +echo "" +echo "Skip 'updatedb'..................: $SKIP_UPDATE_DB" echo "" echo "" -echo "Vserver Guest System..........: $VSERVER_GUEST" +echo "Vserver Guest System.............: $VSERVER_GUEST" echo "" echononl "Start with that configuration? [yes/no]: " @@ -1080,6 +1127,215 @@ else info "Up-to-date.." fi +if $_install_freetype && [[ ! -d /usr/local/freetype-$FREETYPE_VERSION ]]; then + + ## - Install freetype with support for 'freetype-config' + ## - + echo "" + echo "" + echo -e "\t---" + echo -e "\t--- Install freetype with support for 'freetype-config'" + echo -e "\t---" + echo "" + + freetype_archive="freetype-${FREETYPE_VERSION}.tar.gz" + + _src_dir_freetype="/usr/local/src/freetype" + _build_dir_freetype="${_src_dir_freetype}/freetype-${FREETYPE_VERSION}" + + echononl "\tCreate source directory '$_src_dir_freetype'.." + if [[ ! -d "$_src_dir_freetype" ]]; then + mkdir "$freetype_archive" >> ${_logdir}/main.log 2>&1 + if [[ $? -eq 0 ]]; then + echo_ok + else + echo_failed + error "Cannot create directory '$_src_dir_freetype'" + + echononl "continue anyway [yes/no]: " + read OK + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Interupted by user" + fi + else + echo_skipped + fi + + cd "$_src_dir_freetype" + + echononl "\tGet source $freetype_archive .." + if [[ ! -f ${_src_dir_freetype}/$freetype_archive ]]; then + wget -O "${_src_dir_freetype}/$freetype_archive" \ + https://sourceforge.net/projects/freetype/files/freetype2/${FREETYPE_VERSION}/${freetype_archive}/download \ + >> ${_logdir}/main.log 2>&1 + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + error "Cannot Download '$freetype_archive'" + + echononl "continue anyway [yes/no]: " + read OK + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Interupted by user" + fi + else + echo_skipped + fi + + _backup_dir="$_build_dir_freetype" + echononl "\tBackup existing directory '${_backup_dir}'.." + if [[ -d "${_backup_dir}" ]]; then + mv "${_backup_dir}" "${_backup_dir}.$(date +%Y%m%d-%H%M)" > /dev/null 2> $tmp_err_msg + if [[ $? -eq 0 ]] ; then + echo_ok + else + echo_failed + error "$(cat $tmp_err_msg)" + + echononl "continue anyway [yes/no]: " + read OK + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Interupted by user" + fi + else + echo_skipped + fi + + echononl "\tUnpack archive \"$freetype_archive\".." + gunzip < "${freetype_archive}" | tar -xf - 2> $tmp_err_msg + if [[ $? -eq 0 ]]; then + echo_ok + else + echo_failed + error "$(cat $tmp_err_msg)" + + echononl "continue anyway [yes/no]: " + read OK + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Interupted by user" + fi + + cd "$_build_dir_freetype" + + config_params="--enable-freetype-config --prefix=/usr/local/freetype-$FREETYPE_VERSION" + echononl "\tGoing to configure freetype-$FREETYPE_VERSION .." + ./configure $config_params >> ${_logdir}/freetype-configure.log 2>&1 + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + error "Configuring freetype failed!\n\t see ${_logdir}/freetype-configure.log-configure.log for more details" + + echononl "continue anyway [yes/no]: " + read OK + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Interupted by user" + fi + + echononl "\tGoing to compile freetype-$FREETYPE_VERSION .." + make > ${_logdir}/freetype-make.log 2>&1 + if [ "$?" = "0" ]; then + echo_ok + else + echo_failed + error "Compiling freetype failed!\n\t see ${_logdir}/freetype-make.log for more details" + + echononl "continue anyway [yes/no]: " + read OK + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Interupted by user" + fi + + _backup_dir="/usr/local/freetype-${FREETYPE_VERSION}" + echononl "\tBackup existing directory '${_backup_dir}'.." + if [[ -d "${_backup_dir}" ]]; then + mv "${_backup_dir}" "${_backup_dir}.$(date +%Y%m%d-%H%M)" > /dev/null 2> $tmp_err_msg + if [[ $? -eq 0 ]] ; then + echo_ok + else + echo_failed + error "$(cat $tmp_err_msg)" + + echononl "continue anyway [yes/no]: " + read OK + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Interupted by user" + fi + else + echo_skipped + fi + + echononl "\tGoing to install freetype-$FREETYPE_VERSION.." + make install > ${_logdir}/freetype-make_install.log 2>&1 + if [[ $? -eq 0 ]]; then + echo_ok + else + echo_failed + error "Installing freetype failed!\n\t see ${_logdir}/freetype-make_install.log for more details" + + echononl "continue anyway [yes/no]: " + read OK + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Interupted by user" + fi + + echononl "\tSet symlink /usr/local/freetype -> /usr/local/freetype-$FREETYPE_VERSION .." + if [ -L /usr/local/freetype ];then + rm -f /usr/local/freetype + fi + + ln -s freetype-$FREETYPE_VERSION /usr/local/freetype > $tmp_err_msg 2>&1 + if [[ $? -eq 0 ]]; then + echo_ok + else + echo_failed + error "$(cat $tmp_err_msg)" + + echononl "continue anyway [yes/no]: " + read OK + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Interupted by user" + fi + +fi + ## - Set Symlink ## - /usr/include/x86_64-linux-gnu/gmp.h -> /usr/include/gmp.h ## - if not exists @@ -1306,14 +1562,22 @@ config_params=" # Use '-enable-freetype', which relies on pkg-config instead of # '--with-freetype-dir_DIR', which relies on freetype-config. # -if [[ "$os_dist" = "debian" ]] && [[ $os_version -lt 10 ]] ; then - config_params="$config_params \ - --with-freetype-dir" -else - config_params="$config_params \ +if ([[ "$PHP_MAJOR_VERSION" -eq 7 ]] && [[ "$PHP_MINOR_VERSION" -gt 3 ]]) \ + || [[ "$PHP_MAJOR_VERSION" -gt 7 ]] ; then + config_params="$config_params \ --enable-freetype" +else + if [[ "$os_dist" = "debian" ]] && [[ $os_version -lt 10 ]] ; then + config_params="$config_params \ + --with-freetype-dir" + else + config_params="$config_params \ + --with-freetype-dir=/usr/local/freetype" + fi fi + + # --with-fpm-systemd \ if $SYSTEMD_EXISTS ; then config_params="$config_params \