@@ -8,71 +8,101 @@ function setup {
88
99 # Setup Correct files depending on PHP installation version choice
1010 if [ " $PHPINSTALLVERSION " = latest-7.1 ]; then
11- cd ../releases/ || exit
12- ls latest-7.1
13- ISFOLDERPRESENT=$?
14- if [ " $ISFOLDERPRESENT " = 1 ]; then
15- unzip php-src-php-7.1.32.zip -d latest-7.1
16- cd latest-7.1 || exit
17- elif [ " $ISFOLDERPRESENT " = 0 ]; then
18- read -p ' There already is a folder with this version of PHP. Would you like to remove it?[default: n/N/y/Y] ' FOLDERCHOICE
19- FOLDERCHOICE=${FOLDERCHOICE:- n}
20- if [ " $FOLDERCHOICE " = y ] || [ " $FOLDERCHOICE " = Y ]; then
21- sudo rm -r latest-7.1
11+ read -p ' latest-7.1 is outdated and has been superseded by latest-7.2. Would you like to continue installation?[y/Y/default: n/N] ' OUTDATEDCHOICE
12+ OUTDATEDCHOICE=${OUTDATEDCHOICE:- n}
13+ if [ " $OUTDATEDCHOICE " = y ] || [ " $OUTDATEDCHOICE " = Y ]; then
14+ cd ../releases/ || exit
15+ ls latest-7.1
16+ ISFOLDERPRESENT=$?
17+ if [ " $ISFOLDERPRESENT " = 1 ]; then
2218 unzip php-src-php-7.1.32.zip -d latest-7.1
2319 cd latest-7.1 || exit
24- elif [ " $FOLDERCHOICE " = n ] || [ " $FOLDERCHOICE " = N ]; then
25- echo cancelling installation
26- setup
27- else
28- echo invalid argument, exiting...
29- setup
20+ elif [ " $ISFOLDERPRESENT " = 0 ]; then
21+ read -p ' There already is a folder with this version of PHP. Would you like to remove it?[default: n/N/y/Y] ' FOLDERCHOICE
22+ FOLDERCHOICE=${FOLDERCHOICE:- n}
23+ if [ " $FOLDERCHOICE " = y ] || [ " $FOLDERCHOICE " = Y ]; then
24+ sudo rm -r latest-7.1
25+ unzip php-src-php-7.1.32.zip -d latest-7.1
26+ cd latest-7.1 || exit
27+ elif [ " $FOLDERCHOICE " = n ] || [ " $FOLDERCHOICE " = N ]; then
28+ echo cancelling installation
29+ setup
30+ else
31+ echo invalid argument, exiting...
32+ setup
33+ fi
3034 fi
35+ elif [ " $OUTDATEDCHOICE " = n ] || [ " $OUTDATEDCHOICE " = N ]; then
36+ echo cancelling installation
37+ setup
38+ else
39+ echo invalid argument, exiting...
40+ setup
3141 fi
32-
42+
3343 elif [ " $PHPINSTALLVERSION " = latest-7.2 ]; then
34- cd ../releases/ || exit
35- ls latest-7.2
36- ISFOLDERPRESENT=$?
37- if [ " $ISFOLDERPRESENT " = 1 ]; then
38- unzip php-src-php-7.2.33.zip -d latest-7.2
39- cd latest-7.2 || exit
40- elif [ " $ISFOLDERPRESENT " = 0 ]; then
41- read -p ' There already is a folder with this version of PHP. Would you like to remove it?[default: n/N/y/Y] ' FOLDERCHOICE
42- FOLDERCHOICE=${FOLDERCHOICE:- n}
43- if [ " $FOLDERCHOICE " = y ] || [ " $FOLDERCHOICE " = Y ]; then
44- sudo rm -r latest-7.2
44+ read -p ' latest-7.2 is outdated and has been superseded by latest-7.3. Would you like to continue installation?[y/Y/default: n/N] ' OUTDATEDCHOICE
45+ OUTDATEDCHOICE=${OUTDATEDCHOICE:- n}
46+ if [ " $OUTDATEDCHOICE " = y ] || [ " $OUTDATEDCHOICE " = Y ]; then
47+ cd ../releases/ || exit
48+ ls latest-7.2
49+ ISFOLDERPRESENT=$?
50+ if [ " $ISFOLDERPRESENT " = 1 ]; then
4551 unzip php-src-php-7.2.33.zip -d latest-7.2
4652 cd latest-7.2 || exit
47- elif [ " $FOLDERCHOICE " = n ] || [ " $FOLDERCHOICE " = N ]; then
48- echo cancelling installation
49- setup
50- else
51- echo invalid argument, exiting...
52- setup
53+ elif [ " $ISFOLDERPRESENT " = 0 ]; then
54+ read -p ' There already is a folder with this version of PHP. Would you like to remove it?[default: n/N/y/Y] ' FOLDERCHOICE
55+ FOLDERCHOICE=${FOLDERCHOICE:- n}
56+ if [ " $FOLDERCHOICE " = y ] || [ " $FOLDERCHOICE " = Y ]; then
57+ sudo rm -r latest-7.2
58+ unzip php-src-php-7.2.33.zip -d latest-7.2
59+ cd latest-7.2 || exit
60+ elif [ " $FOLDERCHOICE " = n ] || [ " $FOLDERCHOICE " = N ]; then
61+ echo cancelling installation
62+ setup
63+ else
64+ echo invalid argument, exiting...
65+ setup
66+ fi
5367 fi
68+ elif [ " $OUTDATEDCHOICE " = n ] || [ " $OUTDATEDCHOICE " = N ]; then
69+ echo cancelling installation
70+ setup
71+ else
72+ echo invalid argument, exiting...
73+ setup
5474 fi
5575 elif [ " $PHPINSTALLVERSION " = latest-7.3 ]; then
56- cd ../releases/ || exit
57- ls latest-7.3
58- ISFOLDERPRESENT=$?
59- if [ " $ISFOLDERPRESENT " = 1 ]; then
60- unzip php-src-php-7.3.22RC1.zip -d latest-7.3
61- cd latest-7.3 || exit
62- elif [ " $ISFOLDERPRESENT " = 0 ]; then
63- read -p ' There already is a folder with this version of PHP. Would you like to remove it?[default: n/N/y/Y] ' FOLDERCHOICE
64- FOLDERCHOICE=${FOLDERCHOICE:- n}
65- if [ " $FOLDERCHOICE " = y ] || [ " $FOLDERCHOICE " = Y ]; then
66- sudo rm -r latest-7.3
76+ read -p ' latest-7.3 is outdated and has been superseded by latest-7.4. Would you like to continue installation?[y/Y/default: n/N] ' OUTDATEDCHOICE
77+ OUTDATEDCHOICE=${OUTDATEDCHOICE:- n}
78+ if [ " $OUTDATEDCHOICE " = y ] || [ " $OUTDATEDCHOICE " = Y ]; then
79+ cd ../releases/ || exit
80+ ls latest-7.3
81+ ISFOLDERPRESENT=$?
82+ if [ " $ISFOLDERPRESENT " = 1 ]; then
6783 unzip php-src-php-7.3.22RC1.zip -d latest-7.3
6884 cd latest-7.3 || exit
69- elif [ " $FOLDERCHOICE " = n ] || [ " $FOLDERCHOICE " = N ]; then
70- echo cancelling installation
71- setup
72- else
73- echo invalid argument, exiting...
74- setup
85+ elif [ " $ISFOLDERPRESENT " = 0 ]; then
86+ read -p ' There already is a folder with this version of PHP. Would you like to remove it?[default: n/N/y/Y] ' FOLDERCHOICE
87+ FOLDERCHOICE=${FOLDERCHOICE:- n}
88+ if [ " $FOLDERCHOICE " = y ] || [ " $FOLDERCHOICE " = Y ]; then
89+ sudo rm -r latest-7.3
90+ unzip php-src-php-7.3.22RC1.zip -d latest-7.3
91+ cd latest-7.3 || exit
92+ elif [ " $FOLDERCHOICE " = n ] || [ " $FOLDERCHOICE " = N ]; then
93+ echo cancelling installation
94+ setup
95+ else
96+ echo invalid argument, exiting...
97+ setup
98+ fi
7599 fi
100+ elif [ " $OUTDATEDCHOICE " = n ] || [ " $OUTDATEDCHOICE " = N ]; then
101+ echo cancelling installation
102+ setup
103+ else
104+ echo invalid argument, exiting...
105+ setup
76106 fi
77107 elif [ " $PHPINSTALLVERSION " = latest-7.4 ]; then
78108 cd ../releases/ || exit
@@ -152,10 +182,76 @@ function setup {
152182 echo Installing Dependencies
153183 brew install flex autoconf automake libtool re2c bison openssl curl enchant gd freetype mhash libiconv libsodium libjpeg pcre libxml2 argon2 tidy-html5 libzip
154184 # Export Packages to the $PATH so They can be Found by the System
155- sudo echo ' export PATH="/usr/local/opt/openssl/bin:$PATH"' | sudo tee ~ /.bash_profile
156- source ~ /.bash_profile
157- echo Installed all Dependencies
185+ SHELL=$( echo ${SHELL} )
186+ if [ " $SHELL " = /bin/bash ]; then
187+
188+ echo exporting PATH variables, compiler flags, and pkg-config variables for dependencies
189+ sudo echo ' export PATH="/usr/local/opt/openssl/bin:$PATH"' | sudo tee ~ /.bash_profile
190+ export LDFLAGS=" -L/usr/local/opt/openssl@1.1/lib"
191+ export CPPFLAGS=" -I/usr/local/opt/openssl@1.1/include"
192+ export PKG_CONFIG_PATH=" /usr/local/opt/openssl@1.1/lib/pkgconfig"
193+
194+ echo ' export PATH="/usr/local/opt/curl/bin:$PATH"' | sudo tee ~ /.bash_profile
195+ export LDFLAGS=" -L/usr/local/opt/curl/lib"
196+ export CPPFLAGS=" -I/usr/local/opt/curl/include"
197+ export PKG_CONFIG_PATH=" /usr/local/opt/curl/lib/pkgconfig"
158198
199+ echo ' export PATH="/usr/local/opt/flex/bin:$PATH"' | sudo tee ~ /.bash_profile
200+ export LDFLAGS=" -L/usr/local/opt/flex/lib"
201+ export CPPFLAGS=" -I/usr/local/opt/flex/include"
202+
203+ echo ' export PATH="/usr/local/opt/libiconv/bin:$PATH"' | sudo tee ~ /.bash_profile
204+ export LDFLAGS=" -L/usr/local/opt/libiconv/lib"
205+ export CPPFLAGS=" -I/usr/local/opt/libiconv/include"
206+
207+ echo ' export PATH="/usr/local/opt/libxml2/bin:$PATH"' | sudo tee ~ /.bash_profile
208+ export LDFLAGS=" -L/usr/local/opt/libxml2/lib"
209+ export CPPFLAGS=" -I/usr/local/opt/libxml2/include"
210+
211+ echo ' export PATH="/usr/local/opt/bison/bin:$PATH"' | sudo tee ~ /.bash_profile
212+ export LDFLAGS=" -L/usr/local/opt/bison/lib"
213+ echo exported PATH variables, compiler flags, and pkg-config variables for dependencies
214+
215+ echo linking dependencies
216+ brew link autoconf automake libtool re2c enchant gd freetype mhash libsodium libjpeg pcre argon2 tidy-html5 libzip
217+ echo linked dependencies
218+
219+ source ~ /.bash_profile
220+ echo Installed all Dependencies
221+
222+ elif [ " $SHELL " = /bin/zsh ]; then
223+
224+ sudo echo ' export PATH="/usr/local/opt/openssl/bin:$PATH"' | sudo tee ~ /.profile
225+ export LDFLAGS=" -L/usr/local/opt/openssl@1.1/lib"
226+ export CPPFLAGS=" -I/usr/local/opt/openssl@1.1/include"
227+ export PKG_CONFIG_PATH=" /usr/local/opt/openssl@1.1/lib/pkgconfig"
228+
229+ echo ' export PATH="/usr/local/opt/curl/bin:$PATH"' | sudo tee ~ /.profile
230+ export LDFLAGS=" -L/usr/local/opt/curl/lib"
231+ export CPPFLAGS=" -I/usr/local/opt/curl/include"
232+ export PKG_CONFIG_PATH=" /usr/local/opt/curl/lib/pkgconfig"
233+
234+ echo ' export PATH="/usr/local/opt/flex/bin:$PATH"' | sudo tee ~ /.profile
235+ export LDFLAGS=" -L/usr/local/opt/flex/lib"
236+ export CPPFLAGS=" -I/usr/local/opt/flex/include"
237+
238+ echo ' export PATH="/usr/local/opt/libiconv/bin:$PATH"' | sudo tee ~ /.profile
239+ export LDFLAGS=" -L/usr/local/opt/libiconv/lib"
240+ export CPPFLAGS=" -I/usr/local/opt/libiconv/include"
241+
242+ echo ' export PATH="/usr/local/opt/libxml2/bin:$PATH"' | sudo tee ~ /.profile
243+ export LDFLAGS=" -L/usr/local/opt/libxml2/lib"
244+ export CPPFLAGS=" -I/usr/local/opt/libxml2/include"
245+
246+ echo ' export PATH="/usr/local/opt/bison/bin:$PATH"' | sudo tee ~ /.profile
247+ export LDFLAGS=" -L/usr/local/opt/bison/lib"
248+
249+ echo linking dependencies
250+ brew link autoconf automake libtool re2c enchant gd freetype2 mhash libsodium libjpeg pcre argon2 tidy-html5 libzip
251+ echo linked dependencies
252+ source ~ /.profile
253+ echo Installed all Dependencies
254+ fi
159255 # Go into the right directory depending on PHP installation version
160256 if [ " $PHPINSTALLVERSION " = latest-7.1 ]; then
161257 cd php-src-php-7.1.32/ || exit
0 commit comments