forked from mlocati/docker-php-extension-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-php-extensions
executable file
·1452 lines (1427 loc) · 52.5 KB
/
install-php-extensions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/sh
# This script wraps docker-php-ext-install, properly configuring the system.
#
# Copyright (c) Michele Locati, 2018
#
# Source: https://github.com/mlocati/docker-php-extension-installer
#
# License: MIT - see https://github.com/mlocati/docker-php-extension-installer/blob/master/LICENSE
# Let's set a sane environment
set -o errexit
set -o nounset
# Reset the Internal Field Separator
resetIFS() {
IFS='
'
}
# Set these variables:
# - DISTRO containing distribution name (eg 'alpine', 'debian')
# - DISTO_VERSION containing distribution name and its version(eg 'alpine@3.10', 'debian@9')
setDistro() {
if ! test -r /etc/os-release; then
printf 'The file /etc/os-release is not readable\n' >&2
exit 1
fi
DISTRO="$(cat /etc/os-release | grep -E ^ID= | cut -d = -f 2)"
DISTRO_VERSION="$(printf '%s@%s' $DISTRO $(cat /etc/os-release | grep -E ^VERSION_ID= | cut -d = -f 2 | cut -d '"' -f 2 | cut -d . -f 1,2))"
}
# Set the PHP_MAJMIN_VERSION variable containing the PHP Major-Minor version as an integer value, in format MMmm (example: 506 for PHP 5.6.15)
setPHPMajorMinor() {
PHP_MAJMIN_VERSION=$(php-config --version | awk -F. '{print $1*100+$2}')
}
# Get the normalized list of already installed PHP modules
#
# Output:
# Space-separated list of module handles
getPHPInstalledModules() {
getPHPInstalledModules_result=''
IFS='
'
for getPHPInstalledModules_module in $(php -m); do
getPHPInstalledModules_moduleNormalized=''
case "$getPHPInstalledModules_module" in
\[PHP\ Modules\]) ;;
\[Zend\ Modules\])
break
;;
Core | PDO | PDO_* | Phar | Reflection | SimpleXML | SPL | SQLite | Xdebug)
getPHPInstalledModules_moduleNormalized=$(LC_CTYPE=C printf '%s' "$getPHPInstalledModules_module" | tr '[:upper:]' '[:lower:]')
;;
Zend\ OPcache)
getPHPInstalledModules_moduleNormalized='opcache'
;;
*\ * | *A* | *B* | *C* | *D* | *E* | *F* | *G* | *H* | *I* | *J* | *K* | *L* | *M* | *N* | *O* | *P* | *Q* | *R* | *S* | *T* | *U* | *V* | *W* | *X* | *Y* | *Z*)
printf '### WARNING Unrecognized module name: %s ###\n' "$getPHPInstalledModules_module" >&2
;;
*)
getPHPInstalledModules_moduleNormalized="$getPHPInstalledModules_module"
;;
esac
if test -n "$getPHPInstalledModules_moduleNormalized"; then
if ! stringInList "$getPHPInstalledModules_moduleNormalized" "$getPHPInstalledModules_result"; then
getPHPInstalledModules_result="$getPHPInstalledModules_result $getPHPInstalledModules_moduleNormalized"
fi
fi
done
resetIFS
printf '%s' "${getPHPInstalledModules_result# }"
}
# Get the handles of the modules to be installed
#
# Arguments:
# $@: all module handles
#
# Set:
# PHP_MODULES_TO_INSTALL
#
# Output:
# Nothing
processCommandArguments() {
processCommandArguments_alreadyInstalled="$(getPHPInstalledModules)"
processCommandArguments_endArgs=0
PHP_MODULES_TO_INSTALL=''
while :; do
if test $# -lt 1; then
break
fi
processCommandArguments_skip=0
if test $processCommandArguments_endArgs -eq 0; then
case "$1" in
--cleanup)
printf '### WARNING the %s option is deprecated (we always cleanup everything) ###\n' "$1" >&2
processCommandArguments_skip=1
;;
--)
processCommandArguments_skip=1
processCommandArguments_endArgs=1
;;
-*)
printf 'Unrecognized option: %s\n' "$1" >&2
exit 1
;;
esac
fi
if test $processCommandArguments_skip -eq 0; then
case "$1" in
pecl_http)
processCommandArguments_name='http'
;;
*)
processCommandArguments_name=$1
;;
esac
if stringInList "$processCommandArguments_name" "$PHP_MODULES_TO_INSTALL"; then
printf '### WARNING Duplicated module name specified: %s ###\n' "$processCommandArguments_name" >&2
elif stringInList "$processCommandArguments_name" "$processCommandArguments_alreadyInstalled"; then
printf '### WARNING Module already installed: %s ###\n' "$processCommandArguments_name" >&2
else
PHP_MODULES_TO_INSTALL="$PHP_MODULES_TO_INSTALL $processCommandArguments_name"
fi
fi
shift
done
PHP_MODULES_TO_INSTALL="${PHP_MODULES_TO_INSTALL# }"
}
# Sort the modules to be installed, in order to fix dependencies
#
# Update:
# PHP_MODULES_TO_INSTALL
#
# Output:
# Nothing
sortModulesToInstall() {
if stringInList 'igbinary' "$PHP_MODULES_TO_INSTALL"; then
PHP_MODULES_TO_INSTALL="$(removeStringFromList 'igbinary' "$PHP_MODULES_TO_INSTALL")"
if test -z "$PHP_MODULES_TO_INSTALL"; then
PHP_MODULES_TO_INSTALL='igbinary'
else
PHP_MODULES_TO_INSTALL="igbinary $PHP_MODULES_TO_INSTALL"
fi
fi
if stringInList 'msgpack' "$PHP_MODULES_TO_INSTALL"; then
PHP_MODULES_TO_INSTALL="$(removeStringFromList 'msgpack' "$PHP_MODULES_TO_INSTALL")"
if test -z "$PHP_MODULES_TO_INSTALL"; then
PHP_MODULES_TO_INSTALL='msgpack'
else
PHP_MODULES_TO_INSTALL="msgpack $PHP_MODULES_TO_INSTALL"
fi
fi
if stringInList 'http' "$PHP_MODULES_TO_INSTALL"; then
PHP_MODULES_TO_INSTALL="$(removeStringFromList 'http' "$PHP_MODULES_TO_INSTALL")"
sortModulesToInstall_alreadyInstalled="$(getPHPInstalledModules)"
if ! stringInList 'propro' "$PHP_MODULES_TO_INSTALL" && ! stringInList 'propro' "$sortModulesToInstall_alreadyInstalled"; then
PHP_MODULES_TO_INSTALL="$PHP_MODULES_TO_INSTALL propro"
fi
if ! stringInList 'raphf' "$PHP_MODULES_TO_INSTALL" && ! stringInList 'raphf' "$sortModulesToInstall_alreadyInstalled"; then
PHP_MODULES_TO_INSTALL="$PHP_MODULES_TO_INSTALL raphf"
fi
PHP_MODULES_TO_INSTALL="$PHP_MODULES_TO_INSTALL http"
fi
}
# Get the required APT/APK packages for a specific PHP version and for the list of module handles
#
# Arguments:
# $1: the numeric PHP Major-Minor version
# $@: the PHP module handles
#
# Set:
# PACKAGES_PERSISTENT
# PACKAGES_VOLATILE
# PACKAGES_PREVIOUS
buildRequiredPackageLists() {
buildRequiredPackageLists_persistent=''
buildRequiredPackageLists_volatile=''
buildRequiredPackageLists_phpv=$1
case "$DISTRO" in
alpine)
apk update
;;
esac
case "$DISTRO_VERSION" in
alpine@*)
buildRequiredPackageLists_volatile="$PHPIZE_DEPS"
if test -z "$(apk info 2>/dev/null | grep -E ^libssl)"; then
buildRequiredPackageLists_libssl='libssl1.0'
elif test -z "$(apk info 2>/dev/null | grep -E '^libressl.*-libtls')"; then
buildRequiredPackageLists_libssl=$(apk search -q libressl*-libtls)
else
buildRequiredPackageLists_libssl=''
fi
;;
debian@9)
buildRequiredPackageLists_libssldev='libssl1.0-dev'
;;
debian@*)
buildRequiredPackageLists_libssldev='libssl([0-9]+(\.[0-9]+)*)?-dev$'
;;
esac
while :; do
if test $# -lt 2; then
break
fi
shift
case "$1@$DISTRO" in
amqp@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent rabbitmq-c"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile rabbitmq-c-dev"
;;
amqp@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent librabbitmq[0-9]"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile librabbitmq-dev libssh-dev"
;;
bz2@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libbz2"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile bzip2-dev"
;;
bz2@debian)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libbz2-dev"
;;
cmark@alpine)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile cmake"
;;
cmark@debian)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile cmake"
;;
decimal@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libmpdec2"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libmpdec-dev"
;;
enchant@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent enchant"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile enchant-dev"
;;
enchant@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libenchant1c2a"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libenchant-dev"
;;
ffi@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libffi"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libffi-dev"
;;
ffi@debian)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libffi-dev"
;;
gd@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent freetype libjpeg-turbo libpng libxpm"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile freetype-dev libjpeg-turbo-dev libpng-dev libxpm-dev"
if test $buildRequiredPackageLists_phpv -le 506; then
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libvpx"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libvpx-dev"
else
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libwebp"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libwebp-dev"
fi
;;
gd@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libfreetype6 libjpeg62-turbo libpng[0-9]+-[0-9]+$ libxpm4"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libfreetype6-dev libjpeg62-turbo-dev libpng-dev libxpm-dev"
if test $buildRequiredPackageLists_phpv -le 506; then
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libvpx[0-9]+$"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libvpx-dev"
else
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libwebp[0-9]+$"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libwebp-dev"
fi
;;
gettext@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libintl"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile gettext-dev"
;;
gmagick@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent graphicsmagick"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile graphicsmagick-dev libtool"
;;
gmagick@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libgraphicsmagick(-q16-)?[0-9]*$"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libgraphicsmagick1-dev"
;;
gmp@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent gmp"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile gmp-dev"
;;
gmp@debian)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libgmp-dev"
;;
grpc@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libstdc++"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile zlib-dev linux-headers"
;;
grpc@debian)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile zlib1g-dev"
;;
http@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libevent"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile zlib-dev curl-dev libevent-dev"
if test $buildRequiredPackageLists_phpv -le 506; then
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libidn"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libidn-dev"
else
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent icu-libs libidn"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile icu-dev libidn-dev"
fi
;;
http@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libcurl3-gnutls libevent[0-9\.\-]*$"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile zlib1g-dev libgnutls28-dev libcurl4-gnutls-dev libevent-dev"
if test $buildRequiredPackageLists_phpv -le 506; then
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libidn1[0-9+]-dev$"
else
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libicu[0-9]+$ libidn2-[0-9+]$"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libicu-dev libidn2-[0-9+]-dev$"
fi
;;
imagick@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent imagemagick"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile imagemagick-dev"
;;
imagick@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libmagickwand-6.q16-[0-9]+$"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libmagickwand-dev"
;;
imap@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent c-client $buildRequiredPackageLists_libssl"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile krb5-dev imap-dev libressl-dev"
;;
imap@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libc-client2007e"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libkrb5-dev"
case "$DISTRO_VERSION" in
debian@9)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile $buildRequiredPackageLists_libssldev comerr-dev krb5-multidev libc-client2007e libgssrpc4 libkadm5clnt-mit11 libkadm5srv-mit11 libkdb5-8 libpam0g-dev libssl-doc mlock"
;;
*)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libc-client-dev"
;;
esac
;;
interbase@alpine)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile icu-dev ncurses-dev"
;;
interbase@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libfbclient2"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile firebird-dev libib-util"
;;
intl@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent icu-libs"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile icu-dev"
;;
intl@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libicu[0-9]+$"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libicu-dev"
;;
ldap@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libldap"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile openldap-dev"
;;
ldap@debian)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libldap2-dev"
;;
mcrypt@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libmcrypt"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libmcrypt-dev"
;;
mcrypt@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libmcrypt4"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libmcrypt-dev"
;;
memcache@alpine)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile zlib-dev"
;;
memcache@debian)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile zlib1g-dev"
;;
memcached@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libmemcached-libs"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libmemcached-dev zlib-dev"
;;
memcached@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libmemcachedutil2"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libmemcached-dev zlib1g-dev"
;;
mongo@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libsasl $buildRequiredPackageLists_libssl"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libressl-dev cyrus-sasl-dev"
;;
mongo@debian)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile $buildRequiredPackageLists_libssldev libsasl2-dev"
;;
mongodb@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent icu-libs libsasl $buildRequiredPackageLists_libssl snappy"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile icu-dev cyrus-sasl-dev snappy-dev libressl-dev zlib-dev"
;;
mongodb@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libsnappy[0-9]+(v[0-9]+)?$ libicu[0-9]+$"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libicu-dev libsasl2-dev libsnappy-dev $buildRequiredPackageLists_libssldev zlib1g-dev"
;;
mssql@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent freetds"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile freetds-dev"
;;
mssql@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libsybdb5"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile freetds-dev"
;;
oauth@alpine)
if test $buildRequiredPackageLists_phpv -ge 700; then
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile pcre-dev"
fi
;;
oauth@debian)
if test $buildRequiredPackageLists_phpv -ge 700; then
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libpcre3-dev"
fi
;;
odbc@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent unixodbc"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile unixodbc-dev"
;;
odbc@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libodbc1"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile unixodbc-dev"
;;
pdo_dblib@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent freetds"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile freetds-dev"
;;
pdo_dblib@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libsybdb5"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile freetds-dev"
;;
pdo_firebird@alpine)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile icu-dev ncurses-dev"
;;
pdo_firebird@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libfbclient2"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile firebird-dev libib-util"
;;
pdo_odbc@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent unixodbc"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile unixodbc-dev"
;;
pdo_odbc@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libodbc1"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile unixodbc-dev"
;;
pdo_pgsql@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent postgresql-libs"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile postgresql-dev"
;;
pdo_pgsql@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libpq5"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libpq-dev"
;;
pdo_sqlsrv@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libstdc++ unixodbc"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile unixodbc-dev"
;;
pdo_sqlsrv@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libodbc1 odbcinst"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile unixodbc-dev"
;;
pgsql@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent postgresql-libs"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile postgresql-dev"
;;
pgsql@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libpq5"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libpq-dev"
;;
pspell@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent aspell-libs"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile aspell-dev"
;;
pspell@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libaspell15"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libpspell-dev"
;;
rdkafka@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent librdkafka"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile librdkafka-dev"
;;
rdkafka@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent librdkafka\+*[0-9]*$"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile librdkafka-dev"
;;
recode@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent recode"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile recode-dev"
;;
recode@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent librecode0"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile librecode-dev"
;;
redis@alpine)
if test $buildRequiredPackageLists_phpv -ge 700; then
case "$DISTRO_VERSION" in
alpine@3.7)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent zstd"
;;
*)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent zstd-libs"
;;
esac
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile zstd-dev"
fi
;;
redis@debian)
if test $buildRequiredPackageLists_phpv -ge 700; then
case "$DISTRO_VERSION" in
debian@8)
## There's no APT package for libzstd
;;
debian@9)
## libzstd is too old (available: 1.1.2, required: 1.3.0+)
;;
*)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libzstd[0-9]*$"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libzstd-dev"
;;
esac
fi
;;
snuffleupagus@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent pcre"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile pcre-dev"
;;
snuffleupagus@debian)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libpcre3-dev"
;;
snmp@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent net-snmp-libs"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile net-snmp-dev"
;;
snmp@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent snmp"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libsnmp-dev"
;;
soap@alpine)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libxml2-dev"
;;
soap@debian)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libxml2-dev"
;;
solr@alpine)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile curl-dev libxml2-dev"
;;
solr@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libcurl3-gnutls"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libcurl4-gnutls-dev libxml2-dev"
;;
sqlsrv@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libstdc++ unixodbc"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile unixodbc-dev"
;;
sqlsrv@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent unixodbc"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile unixodbc-dev"
;;
ssh2@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libssh2"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libssh2-dev"
;;
ssh2@debian)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libssh2-1-dev"
;;
sybase_ct@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent freetds"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile freetds-dev"
;;
sybase_ct@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libct4"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile freetds-dev"
;;
tdlib@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libstdc++ $buildRequiredPackageLists_libssl"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile git cmake gperf zlib-dev libressl-dev linux-headers readline-dev"
;;
tdlib@debian)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile git cmake gperf zlib1g-dev $buildRequiredPackageLists_libssldev"
;;
tidy@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent tidyhtml-libs"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile tidyhtml-dev"
;;
tidy@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libtidy5*"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libtidy-dev"
;;
uuid@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libuuid"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile util-linux-dev"
;;
uuid@debian)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile uuid-dev"
;;
wddx@alpine)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libxml2-dev"
;;
wddx@debian)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libxml2-dev"
;;
xmlrpc@alpine)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libxml2-dev"
;;
xmlrpc@debian)
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libxml2-dev"
;;
xsl@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libxslt"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libxslt-dev libgcrypt-dev"
;;
xsl@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libxslt1.1"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libxslt-dev"
;;
yaml@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent yaml"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile yaml-dev"
;;
yaml@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libyaml-0-2"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libyaml-dev"
;;
zip@alpine)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libzip"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile cmake gnutls-dev libzip-dev libressl-dev zlib-dev"
;;
zip@debian)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libzip[0-9]$"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile cmake gnutls-dev $buildRequiredPackageLists_libssldev libzip-dev libbz2-dev zlib1g-dev"
case "$DISTRO_VERSION" in
debian@8)
# Debian Jessie doesn't seem to provide libmbedtls
;;
*)
buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libmbedtls[0-9]*$"
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libmbedtls-dev"
;;
esac
;;
esac
done
PACKAGES_PERSISTENT=''
PACKAGES_VOLATILE=''
PACKAGES_PREVIOUS=''
if test -z "$buildRequiredPackageLists_persistent$buildRequiredPackageLists_volatile"; then
return
fi
case "$DISTRO" in
debian)
DEBIAN_FRONTEND=noninteractive apt-get update -q
;;
esac
if test -n "$buildRequiredPackageLists_persistent"; then
PACKAGES_PERSISTENT="$(expandPackagesToBeInstalled $buildRequiredPackageLists_persistent)"
if test -s "$IPE_ERRFLAG_FILE"; then
exit 1
fi
fi
if test -n "$buildRequiredPackageLists_volatile"; then
buildRequiredPackageLists_packages="$(expandPackagesToBeInstalled $buildRequiredPackageLists_volatile)"
if test -s "$IPE_ERRFLAG_FILE"; then
exit 1
fi
resetIFS
for buildRequiredPackageLists_package in $buildRequiredPackageLists_packages; do
if ! stringInList "$buildRequiredPackageLists_package" "$PACKAGES_PERSISTENT"; then
PACKAGES_VOLATILE="$PACKAGES_VOLATILE $buildRequiredPackageLists_package"
fi
done
PACKAGES_VOLATILE="${PACKAGES_VOLATILE# }"
fi
if test -n "$PACKAGES_PERSISTENT$PACKAGES_VOLATILE"; then
case "$DISTRO" in
debian)
PACKAGES_PREVIOUS="$(dpkg --get-selections | grep -E '\sinstall$' | awk '{ print $1 }')"
;;
esac
fi
}
# Get the full list of APT/APK packages that will be installed, given the required packages
#
# Arguments:
# $1: the list of required APT/APK packages
#
# Output:
# Space-separated list of every APT/APK packages that will be installed
expandPackagesToBeInstalled() {
expandPackagesToBeInstalled_result=''
case "$DISTRO" in
alpine)
expandPackagesToBeInstalled_log="$(apk add --simulate $@ 2>&1 || printf '\nERROR: apk failed\n')"
if test -n "$(printf '%s' "$expandPackagesToBeInstalled_log" | grep -E '^ERROR:')"; then
printf 'FAILED TO LIST THE WHOLE PACKAGE LIST FOR\n' >&2
printf '%s ' "$@" >&2
printf '\n\nCOMMAND OUTPUT:\n%s\n' "$expandPackagesToBeInstalled_log" >&2
echo 'y' >"$IPE_ERRFLAG_FILE"
exit 1
fi
IFS='
'
for expandPackagesToBeInstalled_line in $expandPackagesToBeInstalled_log; do
if test -n "$(printf '%s' "$expandPackagesToBeInstalled_line" | grep -E '^\([0-9]*/[0-9]*) Installing ')"; then
expandPackagesToBeInstalled_result="$expandPackagesToBeInstalled_result $(printf '%s' "$expandPackagesToBeInstalled_line" | cut -d ' ' -f 3)"
fi
done
resetIFS
;;
debian)
expandPackagesToBeInstalled_log="$(DEBIAN_FRONTEND=noninteractive apt-get install -sy $@ 2>&1 || printf '\nE: apt-get failed\n')"
if test -n "$(printf '%s' "$expandPackagesToBeInstalled_log" | grep -E '^E:')"; then
printf 'FAILED TO LIST THE WHOLE PACKAGE LIST FOR\n' >&2
printf '%s ' "$@" >&2
printf '\n\nCOMMAND OUTPUT:\n%s\n' "$expandPackagesToBeInstalled_log" >&2
echo 'y' >"$IPE_ERRFLAG_FILE"
exit 1
fi
expandPackagesToBeInstalled_inNewPackages=0
IFS='
'
for expandPackagesToBeInstalled_line in $expandPackagesToBeInstalled_log; do
if test $expandPackagesToBeInstalled_inNewPackages -eq 0; then
if test "$expandPackagesToBeInstalled_line" = 'The following NEW packages will be installed:'; then
expandPackagesToBeInstalled_inNewPackages=1
fi
elif test "$expandPackagesToBeInstalled_line" = "${expandPackagesToBeInstalled_line# }"; then
break
else
resetIFS
for expandPackagesToBeInstalled_newPackage in $expandPackagesToBeInstalled_line; do
expandPackagesToBeInstalled_result="$expandPackagesToBeInstalled_result $expandPackagesToBeInstalled_newPackage"
done
IFS='
'
fi
done
resetIFS
;;
esac
printf '%s' "${expandPackagesToBeInstalled_result# }"
}
# Install the required APT/APK packages
#
# Arguments:
# $@: the list of APT/APK packages to be installed
installRequiredPackages() {
printf '### INSTALLING REQUIRED PACKAGES ###\n'
printf '# Packages to be kept after installation: %s\n' "$PACKAGES_PERSISTENT"
printf '# Packages to be used only for installation: %s\n' "$PACKAGES_VOLATILE"
case "$DISTRO" in
alpine)
apk add $PACKAGES_PERSISTENT $PACKAGES_VOLATILE
;;
debian)
DEBIAN_FRONTEND=noninteractive apt-get install -qq -y $PACKAGES_PERSISTENT $PACKAGES_VOLATILE
;;
esac
}
# Get the version of an installed APT/APK package
#
# Arguments:
# $1: the name of the installed package
#
# Output:
# The numeric part of the package version, with from 1 to 3 numbers
#
# Example:
# 1
# 1.2
# 1.2.3
getInstalledPackageVersion() {
case "$DISTRO" in
alpine)
apk info "$1" | head -n1 | cut -c $((${#1} + 2))- | grep -o -E '^[0-9]+(\.[0-9]+){0,2}'
;;
debian)
dpkg-query --showformat='${Version}' --show "$1" 2>/dev/null | grep -o -E '^[0-9]+(\.[0-9]+){0,2}'
;;
esac
}
# Compare two versions
#
# Arguments:
# $1: the first version
# $2: the second version
#
# Output
# -1 if $1 is less than $2
# 0 if $1 is the same as $2
# 1 if $1 is greater than $2
compareVersions() {
compareVersions_v1="$1.0.0"
compareVersions_v2="$2.0.0"
compareVersions_vMin="$(printf '%s\n%s' "$compareVersions_v1" "$compareVersions_v2" | sort -t '.' -n -k1,1 -k2,2 -k3,3 | head -n 1)"
if test "$compareVersions_vMin" != "$compareVersions_v1"; then
echo '1'
elif test "$compareVersions_vMin" = "$compareVersions_v2"; then
echo '0'
else
echo '-1'
fi
}
# Install a bundled PHP module given its handle
#
# Arguments:
# $1: the numeric PHP Major-Minor version
# $2: the handle of the PHP module
#
# Set:
# UNNEEDED_PACKAGE_LINKS
#
# Output:
# Nothing
installBundledModule() {
printf '### INSTALLING BUNDLED MODULE %s ###\n' "$2"
case "$2" in
gd)
if test $1 -le 506; then
docker-php-ext-configure gd --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-xpm-dir --with-freetype-dir --enable-gd-native-ttf --with-vpx-dir
elif test $1 -le 701; then
docker-php-ext-configure gd --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-xpm-dir --with-freetype-dir --enable-gd-native-ttf --with-webp-dir
elif test $1 -le 703; then
docker-php-ext-configure gd --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-xpm-dir --with-freetype-dir --with-webp-dir
else
docker-php-ext-configure gd --enable-gd --with-webp --with-jpeg --with-xpm --with-freetype
fi
;;
gmp)
if test $1 -le 506; then
if ! test -f /usr/include/gmp.h; then
ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h
UNNEEDED_PACKAGE_LINKS="$UNNEEDED_PACKAGE_LINKS /usr/include/gmp.h"
fi
fi
;;
imap)
case "$DISTRO_VERSION" in
debian@9)
installBundledModule_tmp="$(pwd)"
cd /tmp
apt-get download libc-client2007e-dev
dpkg -i --ignore-depends=libssl-dev libc-client2007e-dev*
rm libc-client2007e-dev*
cd "$installBundledModule_tmp"
;;
esac
PHP_OPENSSL=yes docker-php-ext-configure imap --with-kerberos --with-imap-ssl
;;
interbase | pdo_firebird)
case "$DISTRO" in
alpine)
if ! test -d /tmp/src/firebird; then
mv "$(getPackageSource https://github.com/FirebirdSQL/firebird/releases/download/R2_5_9/Firebird-2.5.9.27139-0.tar.bz2)" /tmp/src/firebird
cd /tmp/src/firebird
#Patch rwlock.h (this has been fixed in later release of firebird 3.x)
sed -i '194s/.*/#if 0/' src/common/classes/rwlock.h
./configure --with-system-icu
# -j option can't be used: make targets must be compiled sequentially
make -s btyacc_binary gpre_boot libfbstatic libfbclient
cp gen/firebird/lib/libfbclient.so /usr/lib/
ln -s /usr/lib/libfbclient.so /usr/lib/libfbclient.so.2
cd - >/dev/null
fi
CFLAGS='-I/tmp/src/firebird/src/jrd -I/tmp/src/firebird/src/include -I/tmp/src/firebird/src/include/gen' docker-php-ext-configure $2
;;
esac
;;
ldap)
case "$DISTRO" in
debian)
docker-php-ext-configure ldap --with-libdir=lib/$(gcc -dumpmachine)
;;
esac
;;
mssql | pdo_dblib)
if test $1 -le 704; then
if ! test -f /usr/lib/libsybdb.so; then
ln -s /usr/lib/x86_64-linux-gnu/libsybdb.so /usr/lib/libsybdb.so
UNNEEDED_PACKAGE_LINKS="$UNNEEDED_PACKAGE_LINKS /usr/lib/libsybdb.so"
fi
fi
;;
odbc)
if test $1 -le 704; then
docker-php-source extract
cd /usr/src/php/ext/odbc
phpize
sed -ri 's@^ *test +"\$PHP_.*" *= *"no" *&& *PHP_.*=yes *$@#&@g' configure
./configure --with-unixODBC=shared,/usr
cd - >/dev/null
fi
;;
pdo_odbc)
docker-php-ext-configure pdo_odbc --with-pdo-odbc=unixODBC,/usr
;;
snmp)
case "$DISTRO" in
alpine)
mkdir -p -m 0755 /var/lib/net-snmp/mib_indexes
;;
esac
;;
sybase_ct)
docker-php-ext-configure sybase_ct --with-sybase-ct=/usr
;;
tidy)
case "$DISTRO" in
alpine)
if ! test -f /usr/include/buffio.h; then
ln -s /usr/include/tidybuffio.h /usr/include/buffio.h
UNNEEDED_PACKAGE_LINKS="$UNNEEDED_PACKAGE_LINKS /usr/include/buffio.h"
fi
;;
esac
;;
zip)
if test $1 -le 505; then
docker-php-ext-configure zip
elif test $1 -le 703; then
docker-php-ext-configure zip --with-libzip
else
docker-php-ext-configure zip --with-zip
fi
;;
esac
docker-php-ext-install -j$(nproc) "$2"
case "$2" in
imap)
case "$DISTRO_VERSION" in
debian@9)
dpkg -r libc-client2007e-dev
;;
esac
;;
esac
}
# Fetch a tar.gz file, extract it and returns the path of the extracted folder.
#
# Arguments:
# $1: the URL of the file to be downloaded
#
# Output:
# The path of the extracted directory
getPackageSource() {
mkdir -p /tmp/src
getPackageSource_tempFile=$(mktemp -p /tmp/src)
curl -L -s -S -o "$getPackageSource_tempFile" "$1"
getPackageSource_tempDir=$(mktemp -p /tmp/src -d)
cd "$getPackageSource_tempDir"
tar -xzf "$getPackageSource_tempFile" 2>/dev/null || tar -xf "$getPackageSource_tempFile"
cd - >/dev/null
unlink "$getPackageSource_tempFile"
getPackageSource_outDir=''
for getPackageSource_i in $(ls "$getPackageSource_tempDir"); do
if test -n "$getPackageSource_outDir" || test -f "$getPackageSource_tempDir/$getPackageSource_i"; then
getPackageSource_outDir=''
break
fi
getPackageSource_outDir="$getPackageSource_tempDir/$getPackageSource_i"
done
if test -n "$getPackageSource_outDir"; then
printf '%s' "$getPackageSource_outDir"
else
printf '%s' "$getPackageSource_tempDir"
fi
}
# Install a PHP module given its handle from source code
#
# Arguments:
# $1: the handle of the PHP module
# $2: the URL of the module source code
# $3: the options of the configure command
# $4: the value of CFLAGS
installModuleFromSource() {
printf '### INSTALLING MODULE %s FROM SOURCE CODE ###\n' "$1"
installModuleFromSource_dir="$(getPackageSource "$2")"
case "$1" in
snuffleupagus)
cd "$installModuleFromSource_dir/src"
;;
*)
cd "$installModuleFromSource_dir"
;;
esac