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

Commit 312da48

Browse files
authored
Merge pull request #9 from one-and-only/v0.5
v0.5
2 parents 8e21c18 + dae451c commit 312da48

File tree

1 file changed

+25
-23
lines changed

1 file changed

+25
-23
lines changed

macos/install.sh

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

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,18 +151,21 @@ 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
154+
elif [ "$INSTALLCHOICE" = n ] || [ "$INSTALLCHOICE" = N ]; then
155+
echo cancelling installation
156+
setup
157+
else
158+
echo invalid argument, exiting...
159+
setup
160+
fi
160161
fi
161162
elif [ "$PHPINSTALLVERSION" = latest-master ]; then
162163
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
163164
INSTALLCHOICE=${INSTALLCHOICE:-n}
164165
if [ "$INSTALLCHOICE" = y ] || [ "$INSTALLCHOICE" = Y ]; then
165-
git checkout php-src
166+
cd ../ || exit
167+
git clone https://github.com/php/php-src.git
168+
cd php-src || exit
166169
elif [ "$INSTALLCHOICE" = n ] || [ "$INSTALLCHOICE" = N ]; then
167170
echo cancelling installation
168171
git chekout master
@@ -176,13 +179,12 @@ function setup {
176179
echo cancelling installation
177180
exit 130
178181
fi
179-
fi
180182

181183
# Install dependencies using Homebrew
182184
echo Installing Dependencies
183185
brew install flex autoconf automake libtool re2c bison openssl curl enchant gd freetype mhash libiconv libsodium libjpeg pcre libxml2 argon2 tidy-html5 libzip
184186
# Export Packages to the $PATH so They can be Found by the System
185-
SHELL=$(echo ${SHELL})
187+
SHELL=$(echo "${SHELL}")
186188
if [ "$SHELL" = /bin/bash ]; then
187189

188190
echo exporting PATH variables, compiler flags, and pkg-config variables for dependencies
@@ -209,7 +211,7 @@ function setup {
209211
export CPPFLAGS="-I/usr/local/opt/libxml2/include"
210212

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

215217
echo linking dependencies
@@ -220,7 +222,7 @@ function setup {
220222
echo Installed all Dependencies
221223

222224
elif [ "$SHELL" = /bin/zsh ]; then
223-
225+
224226
sudo echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' | sudo tee ~/.profile
225227
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
226228
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
@@ -244,7 +246,7 @@ function setup {
244246
export CPPFLAGS="-I/usr/local/opt/libxml2/include"
245247

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

249251
echo linking dependencies
250252
brew link autoconf automake libtool re2c enchant gd freetype2 mhash libsodium libjpeg pcre argon2 tidy-html5 libzip
@@ -264,12 +266,12 @@ function setup {
264266
elif [ "$PHPINSTALLVERSION" = latest-8.0 ]; then
265267
cd php-src-php-8.0.0beta2/ || exit
266268
elif [ "$PHPINSTALLVERSION" = latest-master ]; then
267-
cd ..
269+
cd .
268270
fi
269271
}
270272

271273
# Configure PHP (./buildconf and ./configure)
272-
function configure {
274+
function configure() {
273275
echo Building configuration script
274276
# Build the configure script
275277
sudo ./buildconf --force || exit
@@ -292,12 +294,12 @@ function configure {
292294
}
293295

294296
# Build PHP (make)
295-
function build {
297+
function build() {
296298
# Set the Job Count for make
297299
echo Setting job count for make
298300
# Set the make job count for the lowest buid time
299301
THREADCOUNT=$(sysctl -n hw.ncpu)
300-
JOBCOUNT=$((THREADCOUNT+1))
302+
JOBCOUNT=$((THREADCOUNT + 1))
301303
echo Set job count for make
302304
# Build PHP
303305
echo Building PHP
@@ -307,7 +309,7 @@ function build {
307309
}
308310

309311
# Test PHP (make test)
310-
function test {
312+
function test() {
311313
echo Testing PHP
312314
# Test PHP per PHP version choice
313315
if [ "$PHPINSTALLVERSION" = latest-8.0 ] || [ "$PHPINSTALLVERSION" = latest-master ] || [ "$PHPINSTALLVERSION" = latest-7.4 ]; then
@@ -318,13 +320,13 @@ function test {
318320
sudo make test -j"$JOBCOUNT"
319321
elif [ "$PHPINSTALLVERSION" = latest-7.1 ]; then
320322
sudo make test -j"$JOBCOUNT"
321-
fi
322-
323+
fi
324+
323325
echo Tested PHP
324326
}
325327

326328
# Install PHP CLI (make install)
327-
function installCLI {
329+
function installCLI() {
328330
# Ask the user if the PHP CLI should be installed or not
329331
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
330332
ERRORRESPONSE=${ERRORRESPONSE:-y}
@@ -342,8 +344,8 @@ function installCLI {
342344
fi
343345
}
344346

345-
brew help
346-
BREWCHECK=$?
347+
brew help
348+
BREWCHECK=$?
347349

348350
if [ "$BREWCHECK" = 0 ]; then
349351
# Install PHP CLI

0 commit comments

Comments
 (0)