Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit f08f28d

Browse files
author
Antonios Papadakis
committed
Add Comments Where Necessary
macOS
1 parent dd72fd0 commit f08f28d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

macos/install.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ function setup {
66
read -p 'Which PHP version would you like to install?[latest-7.1/latest-7.2/latest-7.3/default: latest-7.4/latest-8.0/latest-master/q (quit)] ' PHPINSTALLVERSION
77
PHPINSTALLVERSION=${PHPINSTALLVERSION:-latest-7.4}
88

9+
# Setup Correct files depending on PHP installation version choice
910
if [ "$PHPINSTALLVERSION" = latest-7.1 ]; then
1011
cd ../releases/ || exit
1112
unzip php-src-php-7.1.32.zip -d latest-7.1
@@ -56,13 +57,15 @@ function setup {
5657
exit 130
5758
fi
5859

60+
# Install dependencies using Homebrew
5961
echo Installing Dependencies
6062
brew install flex autoconf automake libtool re2c bison openssl curl enchant gd freetype mhash libiconv libsodium libjpeg pcre libxml2 argon2 tidy-html5 libzip
6163
# Export Packages to the $PATH so They can be Found by the System
6264
sudo echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' | sudo tee ~/.bash_profile
6365
source ~/.bash_profile
6466
echo Installed all Dependencies
6567

68+
# Go into the right directory depending on PHP installation version
6669
if [ "$PHPINSTALLVERSION" = latest-7.1 ]; then
6770
cd php-src-php-7.1.32/ || exit
6871
elif [ "$PHPINSTALLVERSION" = latest-7.2 ]; then
@@ -81,10 +84,12 @@ function setup {
8184
# Configure PHP (./buildconf and ./configure)
8285
function configure {
8386
echo Building configuration script
87+
# Build the configure script
8488
sudo ./buildconf --force || exit
8589
echo Built Configuration Script
8690
# Configure PHP Installation
8791
echo Configuring PHP
92+
# Configure PHP per install version choice
8893
if [ "$PHPINSTALLVERSION" = latest-8.0 ] || [ "$PHPINSTALLVERSION" = latest-master ]; then
8994
sudo ./configure --with-openssl --enable-bcmath --enable-calendar --with-curl --with-enchant --enable-ftp --enable-gd --with-webp --with-jpeg --with-freetype --with-mhash --with-iconv=/usr/local/Cellar/libiconv/1.16 --with-imap-ssl --enable-mbstring --enable-pdo --with-pdo-mysql=mysqlnd --enable-shmop --enable-soap --enable-sockets --with-sodium --with-password-argon2 --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-tidy --with-zip || exit
9095
elif [ "$PHPINSTALLVERSION" = latest-7.4 ]; then
@@ -103,18 +108,21 @@ function configure {
103108
function build {
104109
# Set the Job Count for make
105110
echo Setting job count for make
111+
# Set the make job count for the lowest buid time
106112
THREADCOUNT=$(sysctl -n hw.ncpu)
107113
JOBCOUNT=$((THREADCOUNT+1))
108114
echo Set job count for make
109115
# Build PHP
110116
echo Building PHP
117+
# Build PHP using make
111118
sudo make -j"$JOBCOUNT" || exit
112119
echo Built PHP
113120
}
114121

115122
# Test PHP (make test)
116123
function test {
117124
echo Testing PHP
125+
# Test PHP per PHP version choice
118126
if [ "$PHPINSTALLVERSION" = latest-8.0 ] || [ "$PHPINSTALLVERSION" = latest-master ] || [ "$PHPINSTALLVERSION" = latest-7.4 ]; then
119127
sudo make TEST_PHP_ARGS=-j"$JOBCOUNT" test
120128
elif [ "$PHPINSTALLVERSION" = latest-7.3 ]; then
@@ -130,14 +138,17 @@ function test {
130138

131139
# Install PHP CLI (make install)
132140
function installCLI {
141+
# Ask the user if the PHP CLI should be installed or not
133142
read -p 'The tests have been completed and you may or may not have had failures on some of them. This can sometimes be ignored with the latest builds, or may need extra attention. Would you like to continue with installation?[default: y/Y/n/N] ' ERRORRESPONSE
134143
ERRORRESPONSE=${ERRORRESPONSE:-y}
135144
if [ "$ERRORRESPONSE" = y ] || [ "$ERRORRESPONSE" = Y ]; then
145+
# Install PHP CLI
136146
echo Installing PHP-CLI
137147
sudo make install || exit
138148
echo Installed PHP-CLI
139149
exit 0
140150
elif [ "$ERRORRESPONSE" = n ] || [ "$ERRORRESPONSE" = N ]; then
151+
# Cancel install, go back to setup
141152
echo cancelled installation
142153
git checkout master
143154
setup
@@ -148,6 +159,7 @@ function installCLI {
148159
BREWCHECK=$?
149160

150161
if [ "$BREWCHECK" = 0 ]; then
162+
# Install PHP CLI
151163
setup
152164
configure
153165
build
@@ -158,15 +170,19 @@ elif [ "$BREWCHECK" = 127 ]; then
158170
echo installing Homebrew
159171
sudo /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
160172
echo Homebrew has been installed
173+
# Install PHP CLI
161174
setup
162175
configure
163176
build
164177
test
165178
installCLI
166179
else
180+
# Error Out
167181
echo There was an error checking for Homebrew support.
168182
git checkout master
169183
exit 1
170184
fi
185+
186+
# Reset to previous state
171187
git checkout master
172188
exit 0

0 commit comments

Comments
 (0)