From 38cb8b924df854ef91a6ddf7971eedd1c14ea3d1 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Sat, 29 Feb 2020 01:10:18 +0530 Subject: [PATCH] Use shivammathur/php5-darwin for PHP5 on darwin --- .github/workflows/experimental-workflow.yml | 2 +- .github/workflows/workflow.yml | 2 +- README.md | 3 ++- src/scripts/darwin.sh | 27 ++------------------- 4 files changed, 6 insertions(+), 28 deletions(-) diff --git a/.github/workflows/experimental-workflow.yml b/.github/workflows/experimental-workflow.yml index 62c5cc5f..61479ac5 100644 --- a/.github/workflows/experimental-workflow.yml +++ b/.github/workflows/experimental-workflow.yml @@ -58,7 +58,7 @@ jobs: - name: Setup cache environment id: cache-env - uses: shivammathur/cache-extensions@v1 + uses: shivammathur/cache-extensions@develop with: php-version: ${{ matrix.php-versions }} extensions: ${{ env.extensions }} diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index b9a5ee79..9ff255da 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -56,7 +56,7 @@ jobs: - name: Setup cache environment id: cache-env - uses: shivammathur/cache-extensions@v1 + uses: shivammathur/cache-extensions@develop with: php-version: ${{ matrix.php-versions }} extensions: ${{ env.extensions }} diff --git a/README.md b/README.md index 3f4b3346..aaf18c39 100644 --- a/README.md +++ b/README.md @@ -521,7 +521,8 @@ If this action helped you. - [shivammathur/cache-extensions](https://github.com/shivammathur/cache-extensions "GitHub action to help with caching PHP extensions") - [shivammathur/homebrew-php](https://github.com/shivammathur/homebrew-php "Tap for PHP builds for MacOS") - [shivammathur/php-builder](https://github.com/shivammathur/php-builder "Nightly PHP package") -- [shivammathur/php5-ubuntu](https://github.com/shivammathur/php5-ubuntu "Scripts to setup PHP5 versions") +- [shivammathur/php5-ubuntu](https://github.com/shivammathur/php5-ubuntu "Scripts to setup PHP5 versions on ubuntu") +- [shivammathur/php5-darwin](https://github.com/shivammathur/php5-ubuntu "Scripts to setup PHP5 versions on darwin") ## :bookmark_tabs: Further Reading diff --git a/src/scripts/darwin.sh b/src/scripts/darwin.sh index 33c368f7..925d5f28 100644 --- a/src/scripts/darwin.sh +++ b/src/scripts/darwin.sh @@ -158,29 +158,6 @@ add_pecl() { add_log "$tick" "PECL" "Added" } -# Function to get api version for PHP 5.3, 5.4 and 5.5 -get_old_apiv() { - case $version in - 5.3) echo "20090626" ;; - 5.4) echo "20100525" ;; - 5.5) echo "20121212" ;; - esac -} - -# Function to setup PHP 5.3, 5.4 and 5.5 -setup_php_old() { - ext_dir_parent="$php5"/lib/php/extensions - ext_dir_name=no-debug-non-zts-$(get_old_apiv) - ext_dir="$ext_dir_parent/$ext_dir_name" - sudo mv "$ext_dir" /tmp >/dev/null 2>&1 && sudo rm -rf "$php5" - sudo curl -s https://php-osx.liip.ch/install.sh | bash -s "$version" >/dev/null 2>&1 - sudo rsync -a /tmp/"$ext_dir_name"/ "$ext_dir" >/dev/null 2>&1 - sudo rm -rf "$php5"/php.d/*developer.ini "$php5"/php.d/*xdebug.ini /tmp/"$ext_dir_name" - for tool in pear peardev pecl php php-config phpize; do - sudo ln -sf "$php5"/bin/"$tool" /usr/local/bin/"$tool" - done -} - # Function to setup PHP >=5.6 setup_php() { action=$1 @@ -195,7 +172,6 @@ tick="✓" cross="✗" version=$1 old_versions="5.[3-5]" -php5="/usr/local/php5" tool_path_dir="/usr/local/bin" existing_version=$(php-config --version | cut -c 1-3) [[ -z "${update}" ]] && update='false' || update="${update}" @@ -203,7 +179,8 @@ existing_version=$(php-config --version | cut -c 1-3) # Setup PHP step_log "Setup PHP" if [[ "$version" =~ $old_versions ]]; then - setup_php_old + script="https://github.com/shivammathur/php5-darwin/releases/latest/download/install.sh" + curl -sSL "$script" | bash -s "$version" >/dev/null 2>&1 && status="Installed" elif [ "$existing_version" != "$version" ]; then setup_php "install"