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

Commit 09cb482

Browse files
author
Antonios Papadakis
committed
Fix Typos and Improve Styling
macOS
1 parent 16ce27c commit 09cb482

File tree

1 file changed

+39
-42
lines changed

1 file changed

+39
-42
lines changed

macos/install.sh

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
2-
2+
set -x
33
# Pre-install setup (install version choice, brew install, decompress files, cd into directory, etc.)
4-
function setup {
4+
function setup() {
55
# Install All Dependencies
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}
@@ -151,36 +151,33 @@ function setup {
151151
echo invalid argument, exiting...
152152
setup
153153
fi
154-
elif [ "$INSTALLCHOICE" = n ] || [ "$INSTALLCHOICE" = N ]; then
155-
echo cancelling installation
156-
setup
157-
else
158-
echo invalid argument, exiting...
159-
setup
160-
fi
161-
elif [ "$PHPINSTALLVERSION" = latest-master ]; then
162-
read -p 'CAREFUL: This is a pre-release version and is in heavy development. Install this only if you want the latest bleeding-edge features. These may not have been tested thoroughly and should not be used in a production environment. Are you sure you want to install?[y/Y/default: n/N] ' INSTALLCHOICE
163-
INSTALLCHOICE=${INSTALLCHOICE:-n}
164-
if [ "$INSTALLCHOICE" = y ] || [ "$INSTALLCHOICE" = Y ]; then
165-
cd ../releases/ || exit
166-
git clone https://github.com/php/php-src.git
167-
cd php-src || exit
168-
elif [ "$INSTALLCHOICE" = n ] || [ "$INSTALLCHOICE" = N ]; then
154+
elif [ "$INSTALLCHOICE" = n ] || [ "$INSTALLCHOICE" = N ]; then
155+
echo cancelling installation
156+
setup
157+
else
158+
echo invalid argument, exiting...
159+
setup
160+
fi
161+
elif [ "$PHPINSTALLVERSION" = latest-master ]; then
162+
read -p 'CAREFUL: This is a pre-release version and is in heavy development. Install this only if you want the latest bleeding-edge features. These may not have been tested thoroughly and should not be used in a production environment. Are you sure you want to install?[y/Y/default: n/N] ' INSTALLCHOICE
163+
INSTALLCHOICE=${INSTALLCHOICE:-n}
164+
if [ "$INSTALLCHOICE" = y ] || [ "$INSTALLCHOICE" = Y ]; then
165+
cd ../releases/ || exit
166+
git clone https://github.com/php/php-src.git
167+
cd php-src || exit
168+
elif [ "$INSTALLCHOICE" = n ] || [ "$INSTALLCHOICE" = N ]; then
169+
echo cancelling installation
170+
git chekout master
171+
setup
172+
else
173+
echo invalid argument, exiting...
174+
git checkout master
175+
setup
176+
fi
177+
elif [ "$PHPINSTALLVERSION" = q ] || [ "$PHPINSTALLVERSION" = quit ]; then
169178
echo cancelling installation
170-
git chekout master
171-
setup
172-
else
173-
echo invalid argument, exiting...
174-
git checkout master
175-
setup
176-
else
177-
echo invalid argument, exiting...
178-
setup
179+
exit 130
179180
fi
180-
elif [ "$PHPINSTALLVERSION" = q ] || [ "$PHPINSTALLVERSION" = quit ]; then
181-
echo cancelling installation
182-
exit 130
183-
fi
184181
fi
185182

186183
# Install dependencies using Homebrew
@@ -214,7 +211,7 @@ function setup {
214211
export CPPFLAGS="-I/usr/local/opt/libxml2/include"
215212

216213
echo 'export PATH="/usr/local/opt/bison/bin:$PATH"' | sudo tee ~/.bash_profile
217-
export LDFLAGS="-L/usr/local/opt/bison/lib"
214+
export LDFLAGS="-L/usr/local/opt/bison/lib"
218215
echo exported PATH variables, compiler flags, and pkg-config variables for dependencies
219216

220217
echo linking dependencies
@@ -225,7 +222,7 @@ function setup {
225222
echo Installed all Dependencies
226223

227224
elif [ "$SHELL" = /bin/zsh ]; then
228-
225+
229226
sudo echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' | sudo tee ~/.profile
230227
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
231228
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
@@ -249,7 +246,7 @@ function setup {
249246
export CPPFLAGS="-I/usr/local/opt/libxml2/include"
250247

251248
echo 'export PATH="/usr/local/opt/bison/bin:$PATH"' | sudo tee ~/.profile
252-
export LDFLAGS="-L/usr/local/opt/bison/lib"
249+
export LDFLAGS="-L/usr/local/opt/bison/lib"
253250

254251
echo linking dependencies
255252
brew link autoconf automake libtool re2c enchant gd freetype2 mhash libsodium libjpeg pcre argon2 tidy-html5 libzip
@@ -274,7 +271,7 @@ function setup {
274271
}
275272

276273
# Configure PHP (./buildconf and ./configure)
277-
function configure {
274+
function configure() {
278275
echo Building configuration script
279276
# Build the configure script
280277
sudo ./buildconf --force || exit
@@ -297,12 +294,12 @@ function configure {
297294
}
298295

299296
# Build PHP (make)
300-
function build {
297+
function build() {
301298
# Set the Job Count for make
302299
echo Setting job count for make
303300
# Set the make job count for the lowest buid time
304301
THREADCOUNT=$(sysctl -n hw.ncpu)
305-
JOBCOUNT=$((THREADCOUNT+1))
302+
JOBCOUNT=$((THREADCOUNT + 1))
306303
echo Set job count for make
307304
# Build PHP
308305
echo Building PHP
@@ -312,7 +309,7 @@ function build {
312309
}
313310

314311
# Test PHP (make test)
315-
function test {
312+
function test() {
316313
echo Testing PHP
317314
# Test PHP per PHP version choice
318315
if [ "$PHPINSTALLVERSION" = latest-8.0 ] || [ "$PHPINSTALLVERSION" = latest-master ] || [ "$PHPINSTALLVERSION" = latest-7.4 ]; then
@@ -323,13 +320,13 @@ function test {
323320
sudo make test -j"$JOBCOUNT"
324321
elif [ "$PHPINSTALLVERSION" = latest-7.1 ]; then
325322
sudo make test -j"$JOBCOUNT"
326-
fi
327-
323+
fi
324+
328325
echo Tested PHP
329326
}
330327

331328
# Install PHP CLI (make install)
332-
function installCLI {
329+
function installCLI() {
333330
# Ask the user if the PHP CLI should be installed or not
334331
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
335332
ERRORRESPONSE=${ERRORRESPONSE:-y}
@@ -347,8 +344,8 @@ function installCLI {
347344
fi
348345
}
349346

350-
brew help
351-
BREWCHECK=$?
347+
brew help
348+
BREWCHECK=$?
352349

353350
if [ "$BREWCHECK" = 0 ]; then
354351
# Install PHP CLI

0 commit comments

Comments
 (0)