-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinst2.sh
1328 lines (1135 loc) · 48.1 KB
/
inst2.sh
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/bash
### Setup Logging
LOGFILE=Install.log
RETAIN_NUM_LINES=10
function logsetup {
TMP=$(tail -n $RETAIN_NUM_LINES $LOGFILE 2>/dev/null) && echo "${TMP}" > $LOGFILE
exec > >(tee -a $LOGFILE)
exec 2>&1
}
function log {
echo "[$(date)]: $*"
}
logsetup
### Logging started
# Yellow
function show_progress ()
{
echo $(tput setaf 3)$@$(tput sgr0)
}
# Torquise
function show_progress_info ()
{
echo $(tput setaf 6)$@$(tput sgr0)
}
# Red color
function show_progress_error ()
{
echo $(tput setaf 1)$@$(tput sgr0)
}
# Red Background color
function show_progress_error2 ()
{
echo $(tput setb 4)$@$(tput sgr0)
}
# Loader
function show_progress_loader ()
{
echo $(tput setb 4)$(tput setaf 1)$@$(tput sgr0)
}
# Checking permissions
if [[ $EUID -ne 0 ]]; then
show_progress_error "You need root permissions to run the script."
exit 1
fi
# Check lsb_release
if [ ! -x $prf_dir/bin/lsb_release ]; then
show_progress "Installing lsb-release."
apt-get -y install lsb-release &>> /dev/null
fi
readonly LINUX_DISTRO=$(lsb_release -i |awk '{print $3}')
readonly DEBIAN_VERSION=$(lsb_release -sc)
LINUX_ARCH=$(uname -m)
# Check Linux distro
if [ "$LINUX_DISTRO" != "Ubuntu" ] && [ "$LINUX_DISTRO" != "Debian" ] && [ "$LINUX_DISTRO" != "LinuxMint" ]; then
show_progress_error "Sorry, only Debian 7 and Ubuntu 14.04 is supported as of now"
exit 1
fi
# Check Linux distro
if [ "$DEBIAN_VERSION" == "xenial" ]; then
APTCMD=('apt-get -y'); else
APTCMD=('apt-get -y --force-yes')
fi
# Get the number of cpu cores in the system
CORES=$(grep -c ^processor /proc/cpuinfo)
### Set output directories
ff_dir=/tmp/src-build/src-ffmpeg
ngx_dir=/tmp/src-build/src-nginx
mgk_dir=/tmp/src-build/src-magick
ff_bld_dir=$HOME/openresty-build/ffmpeg
ngx_bld_dir=$HOME/openresty-build/nginx
mgk_bld_dir=$HOME/openresty-build/magick
prf_dir=/usr
export ff_dir=/tmp/src-build/src-ffmpeg
export ngx_dir=/tmp/src-build/src-nginx
export mgk_dir=/tmp/src-build/src-magick
export ff_bld_dir=$HOME/openresty-build/ffmpeg
export ngx_bld_dir=$HOME/openresty-build/nginx
export mgk_bld_dir=$HOME/openresty-build/magick
export prf_dir=/usr
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ###
## ##
## ##
## Down below, it's a mess... ##
## Now it'll try to do it's best ##
## ##
## ##
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ###
# A bit of cleanup first, just in case there're old stuff
if [ -f "/tmp/OpenRestyInstall.log" ]; then rm -rf /tmp/OpenRestyInstall.log ; fi
if [ -f "/tmp/Time.Vars" ]; then rm -rf /tmp/Time.Vars ; fi
if [ -d "$ngx_dir" ]; then rm -rf $ngx_dir ; fi
if [ -d "$ff_dir" ]; then rm -rf $ff_dir ; fi
if [ -d "$mgk_dir" ]; then rm -rf $mgk_dir ; fi
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ###
show_progress "The script will terminate if any error to happen."
set -e
# Some systems problems with locales. So lets try to add them just to run smoother.
show_progress "Setting system locales. If they are erroneous MariaDB install just might fail"
dpkg-reconfigure locales
LANGUAGE=en_US.UTF-8
LANG=en_US.UTF-8
LC_ALL=en_US.UTF-8
LC_COLLATE=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LC_COLLATE=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
export LC_MESSAGES=en_US.UTF-8
locale-gen en_US.UTF-8
update-locale en_US.UTF-8
. /etc/default/locale
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### ### ###
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### ### ###
removepackage=(ffmpeg x264 libx264-dev libx265-dev libffms2 ffmsindex libav-tools libvpx-dev yasm libssl-dev libfdk-aac-dev
libxpm-dev libzimg-dev libxt-dev libmfx libmfx-dev libwebp-dev libmp3lame libmp3lame-dev libogg libxvidcore libfribidi
libexpat libvpx libutvideo libvstab libass libass-dev)
installpackage=(autoconf automake binutils build-essential bzip2 ccache checkinstall clang cmake devscripts frei0r-plugins-dev g++ git gnutls-dev
graphicsmagick-imagemagick-compat graphicsmagick-libmagick-dev-compat libavcodec-dev libavformat-dev libavutil-dev libbluray-dev libbz2-dev libc6-dev libcaca-dev libcdio-cdda1 libcdio-dev
libcdio-paranoia1 libcdio13 libcrypto++-dev libdc1394-22-dev libexif-dev libnuma-dev libjemalloc-dev
libfontconfig1-dev libfreetype6-dev libgd2-xpm-dev libgeoip-dev libgeoip1 libgif-dev libglib2.0-dev libgpac-dev libgsm1-dev
libjack-jackd2-dev libjpeg-dev libjpeg-progs libncurses5-dev libogg-dev libopenal-dev libopencore-amrnb-dev
libopencore-amrwb-dev libopenjpeg-dev libpam0g-dev libpcre3 libpcre3-dev libperl-dev libpng-dev
libpng12-0 libpng12-dev libpulse-dev libreadline-dev librtmp-dev libsctp-dev libschroedinger-dev libsdl1.2-dev
libsox-dev libspeex-dev libssl1.0.0 libtheora-dev libtiff-dev libtool libtwolame-dev libv4l-dev libva-dev libgcrypt-dev
libvdpau-dev libssl-dev libvo-aacenc-dev libvo-amrwbenc-dev libvorbis-dev libxml2-dev libxslt-dev libxslt1.1 libzvbi-dev libswscale-dev
make nasm openssl perl pkg-config python-software-properties rtmpdump software-properties-common tar texi2html texinfo unzip zip zlibc zlib1g-dev)
#libswscale-dev
echo "You need non-free enabled for apt"
# Remove any existing packages:
show_progress "Doing a system upgrade and removing ffmpeg files if there any."
$APTCMD -f install >> /dev/null
$APTCMD upgrade >> /dev/null
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ###
# Function for Install necessary packages
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ###
function run_install(){
echo "installing ${installpackage[@]}" 2>&1 >> /dev/null;
$APTCMD install ${installpackage[@]} >> /dev/null;
}
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ###
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ###
# Function for Remove conflicting packages
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ###
function isinstalled { if dpkg -s "$@" 2>&1 > /dev/null; then echo "Uninstalling $@"&& $APTCMD remove $@ >> /dev/null ; else false ; fi }
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ###
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ###
# Remove conflicting packages
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ###
$APTCMD autoremove
for package in ${removepackage[@]}; do if isinstalled "$package"; then echo "$package package found. will be removed" 2>&1 > /dev/null; else echo "$package package not found, skipping" 2>&1 > /dev/null; fi done
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ###
### Install necessary packages
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ###
## Run the run_install function if any of the libraries are missing
dpkg -s "${installpackage[@]}" 2>&1 > /dev/null || run_install
if [ "$DEBIAN_VERSION" == "wheezy" ]; then
echo "deb http://www.deb-multimedia.org wheezy main" >> /etc/apt/sources.list;
$APTCMD install deb-multimedia-keyring;
apt-get update;
$APTCMD install gnutls-dev libfaac-dev libsoxr-dev libcrypto++9 libpcrecpp0 libpostproc52;
fi
if [ "$DEBIAN_VERSION" == "jessie" ]; then
$APTCMD install gnutls-dev libfaac-dev libsoxr-dev libcrypto++9 libpcrecpp0 libpostproc52;
fi
if [ "$DEBIAN_VERSION" == "trusty" ]; then
$APTCMD install libgnutls-dev libfaac-dev libsoxr-dev libcrypto++9 libpcrecpp0 libpostproc52;
fi
if [ "$DEBIAN_VERSION" == "xenial" ]; then
$APTCMD install gnutls-dev libcrypto++9v5 libpcrecpp0v5 libpostproc-dev libfaac-dev libsoxr-dev;
fi
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ###
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### ### ###
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### ### ###
#Lets calculate how much time is spent
# We don't need this apt-get dist-upgrade process to be counted. So, the timer starts here.
START=$(date +%s)
echo $START > /tmp/Time.Vars
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ###
show_progress "Creating directories"
mkdir -p $ff_dir
mkdir -p $ngx_dir
mkdir -p $ff_bld_dir
mkdir -p $ngx_bld_dir
mkdir -p $mgk_bld_dir
mkdir -p $mgk_dir
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* START FFPMEG
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*
show_progress "Start FFMpeg Installation"
show_progress "Depending on your CPU this might take a long while"
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### First, install yasm
show_progress "Installing yasm"
cd $ff_dir
if [ -d "$ff_dir/yasm" ]; then rm -rf $ff_dir/yasm/ ; fi
git clone git://github.com/yasm/yasm.git
cd yasm
./autogen.sh x86_64 i386 amd64
# ./configure x86_64 i386 amd64
make -j$CORES
checkinstall --pkgname=yasm --pkgversion="1.3.0" --backup=no --deldoc=yes --fstrans=no --default --pakdir=$ff_bld_dir
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### OpenSSL
show_progress "Installing OpenSSL"
cd $ff_dir/
if [ -d "$ff_dir/openssl" ]; then rm -rf $ff_dir/openssl/ ; fi
#git clone https://github.com/openssl/openssl.git
wget --no-check-certificate https://github.com/openssl/openssl/archive/OpenSSL_1_0_2h.tar.gz -O openssl.tar.gz
tar xvfz openssl.tar.gz
mv openssl-OpenSSL* openssl
cd openssl
config_ssl(){
# Get GCC version.
gccver=$(gcc -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/.\1/g' -e 's/^[0-9]\{3,4\}$/&00/')
#CC="ccache gcc-4.9 -Wl,-Bsymbolic -fPic"
# Enable enable-ec_nistp_64_gcc_128 if gcc supports it.
if strings /usr/lib/gcc/x86_64-linux-gnu/$gccver/cc1 | grep -q "__uint128_t" ; then
./config --prefix="$prf_dir" --openssldir=/etc/ssl --libdir=lib shared \
zlib-dynamic zlib sctp enable-camellia enable-seed enable-tlsext \
enable-rfc3779 enable-cms enable-md2 no-mdc2 no-rc5 no-idea \
enable-ec_nistp_64_gcc_128 -fPIC ;
show_progress "Enabled enable-ec_nistp_64_gcc_128 for OpenSSL" ;
else
./config --prefix="$prf_dir" --openssldir=/etc/ssl --libdir=lib no-shared \
zlib-dynamic zlib sctp enable-camellia enable-seed enable-tlsext \
enable-rfc3779 enable-cms enable-md2 no-mdc2 no-rc5 no-idea ;
fi
}
config_ssl
make depend &&
make -j$CORES &&
make install &&
checkinstall --pkgname="openssl" --pkgversion="1.0.2h" --backup=no \
--deldoc=no --fstrans=no --default --install=no --pakdir=$ff_bld_dir
#dpkg -i --force-all $ff_bld_dir/openssl_*.deb
#ln -s $prf_dir/lib/x86_64-linux-gnu/libssl.so.1.0.0 $prf_dir/lib/x86_64-linux-gnu/libssl.so
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### libx264
show_progress "Installing libx264"
# They have git but I had connectivity errors with them so..
# git clone --depth 1 git://git.videolan.org/x264
cd $ff_dir
git clone --depth 1 git://git.videolan.org/x264.git x264
cd x264
./configure --prefix="$prf_dir" --bindir="$prf_dir/bin" --bit-depth=10 --disable-static --enable-shared --enable-strip --disable-lavf
make -j$CORES
make install
checkinstall --pkgname=libx264 --pkgversion="3:$(./version.sh | \
awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes \
--fstrans=no --default --pakdir=$ff_bld_dir --install=no
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### libx265
show_progress "Installing libx265"
cd $ff_dir
#wget --no-check-certificate https://bitbucket.org/multicoreware/x265/downloads/x265_1.9.tar.gz
#tar xvfz x265_1.9.tar.gz
git clone https://github.com/videolan/x265.git
cd x265*
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$prf_dir" -DENABLE_SHARED:bool=off -DENABLE_SHARED=ON -DENABLE_STATIC=OFF -DHIGH_BIT_DEPTH:BOOL=ON source
make -j$CORES
checkinstall --pkgname=libx265-dev --pkgversion=1.9 --backup=no --deldoc=yes \
--fstrans=no --default --pakdir=$ff_bld_dir
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### libfdk-aac-dev
show_progress " Installing libfdk-aac"
cd $ff_dir
if [ -d "$ff_dir/fdk-aac" ]; then
rm -rf $ff_dir/fdk-aac/
fi
git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git
cd fdk-aac
./autogen.sh
autoreconf -fiv
./configure --prefix="$prf_dir" --enable-shared
make
checkinstall --pkgname=libfdk-aac-dev --pkgversion="$(date +%Y%m%d%H%M)-git" --backup=no \
--deldoc=yes --fstrans=no --default --pakdir=$ff_bld_dir
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### libopus
show_progress "Installing libopus"
cd $ff_dir
if [ -d "$ff_dir/opus" ]; then rm -rf $ff_dir/opus/ ; fi
git clone --depth 1 https://github.com/xiph/opus.git
cd opus
./autogen.sh
./configure --prefix="$prf_dir" --enable-shared
make
checkinstall --pkgname=libopus --pkgversion="$(date +%Y%m%d%H%M)-git" --backup=no \
--deldoc=yes --fstrans=no --default --pakdir=$ff_bld_dir
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### libmp3lame
show_progress "Installing libmp3lame"
# doesn't install in ubuntu, ends up with an error
cd $ff_dir
#wget --no-check-certificate http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
#tar xzvf lame-3.99.5.tar.gz
wget --no-check-certificate https://raw.githubusercontent.com/nomadturk/openresty-install/master/lame-3.99.5.tar.gz
tar xzvf lame-3.99.5.tar.gz
cd lame*
./configure --prefix="$prf_dir" --enable-nasm --enable-shared --enable-mp3x --enable-mp3rtp
make -j$CORES
make install
checkinstall --fstrans=no --backup=no --default --deldoc=yes --pkgversion="3.99.5" --pkgname=libmp3lame \
--pakdir=$ff_bld_dir --install=no
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### libogg
#show_progress "Installing libogg"
# cd $ff_dir
# wget --no-check-certificate http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz
# tar xzvf libogg-1.3.2.tar.gz
# cd libogg*
# ./configure --prefix="$prf_dir" --enable-shared
# make
# make install
# checkinstall --fstrans=no --backup=no --default --deldoc=yes --pkgversion="1.3.2" --pkgname=libogg --pakdir=$ff_bld_dir --install=no
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### libxvidcore
show_progress "Installing libxvidcore"
# $APTCMD install libxvidcore-dev libxvidcore4
cd $ff_dir
wget --no-check-certificate http://downloads.xvid.org/downloads/xvidcore-1.3.4.tar.gz
tar xzvf xvidcore-1.3.4.tar.gz
cd xvidcore*
cd build/generic
sed -i 's/^LN_S=@LN_S@/& -f -v/' platform.inc.in
./configure --prefix="$prf_dir" --disable-assembly
make -j$CORES
sed -i '/libdir.*STATIC_LIB/ s/^/#/' Makefile
#rm -rf /usr/lib/libxvidcore*
make install
checkinstall --fstrans=no --backup=no --default --deldoc=yes --pkgversion="2:1.3.4" --pkgname="libxvidcore-dev" --pakdir=$ff_bld_dir --install=no
#dpkg -r libxvidcore4
#rm -rf /usr/lib/libxvidcore* #--purge libxvidcore4
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### libfribidi
show_progress "Installing libfribidi"
cd $ff_dir
wget --no-check-certificate http://fribidi.org/download/fribidi-0.19.7.tar.bz2
tar xjvf fribidi-0.19.7.tar.bz2
cd fribidi*
./configure --prefix="$prf_dir" --enable-shared #--enable-static
make -j$CORES
make install
checkinstall --fstrans=no --backup=no --default --deldoc=yes --pkgversion="0.19.7" --pkgname="libfribidi" --pakdir=$ff_bld_dir --install=no
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### libexpat
show_progress "Installing libexpat"
cd $ff_dir
wget --no-check-certificate 'https://raw.githubusercontent.com/nomadturk/openresty-install/master/expat-2.1.1.tar.bz2' -O expat.tar.bz2
tar xjf expat.tar.bz2
cd expat*
./configure --prefix="$prf_dir" --enable-shared #--enable-static
make -j$CORES
make install
checkinstall --fstrans=no --backup=no --default --deldoc=yes --pkgversion="2.1.0" --pkgname="libexpat" --pakdir=$ff_bld_dir --install=no
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### librtmp
show_progress "Installing librtmp"
# Let's install what's needed...
# cd $ff_dir
# if [ -d "$ff_dir/rtmpdump" ]; then
# rm -rf $ff_dir/rtmpdump/
# fi
# git clone git://git.ffmpeg.org/rtmpdump
# cd rtmpdump
# make SYS=posix
# checkinstall --pkgname=rtmpdump --pkgversion="2:$(date +%Y%m%d%H%M)-git" --backup=no \
# --deldoc=yes --fstrans=no --default --pakdir=$ff_bld_dir
# export LD_LIBRARY_PATH=$prf_dir/local/lib/
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### libvpx
show_progress "Installing libvpx"
$APTCMD install libvpx-dev
# cd $ff_dir
# if [ -d "$ff_dir/libvpx" ]; then rm -rf $ff_dir/libvpx/ ; fi
# git clone https://chromium.googlesource.com/webm/libvpx
# cd libvpx
# #wget --no-check-certificate http://storage.googleapis.com/downloads.webmproject.org/releases/webm/libvpx-1.4.0.tar.bz2
# #tar xjf libvpx-1.4.0.tar.bz2
# #cd libvpx-1.4.0
# sed -i 's/cp -p/cp/' build/make/Makefile &&
# mkdir libvpx-build &&
# cd libvpx-build
# ../configure --prefix="$prf_dir" \
# --enable-shared \
# --disable-static \
# --disable-examples \
# --disable-unit-tests \
# --enable-vp8 \
# --enable-vp9 \
# --enable-webm-io \
# --enable-pic
# make -j$CORES
# make install
# checkinstall --pkgname=libvpx-dev --pkgversion="1.4.0" --backup=no \
# --deldoc=yes --fstrans=no --default --pakdir=$ff_bld_dir --install=yes
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### libzimg-dev
show_progress "Installing libzimg-dev"
cd $ff_dir
git clone https://github.com/sekrit-twc/zimg.git
cd zimg
./autogen.sh
autoconf
./configure --prefix="$prf_dir"
make -j$CORES
checkinstall --fstrans=no --backup=no --default --deldoc=no --pkgversion="2.0.4" --pkgname="libzimg-dev" --pakdir=$ff_bld_dir
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### libmfx-dev
show_progress "Installing libmfx-dev"
#$APTCMD install libva-dev
cd $ff_dir
git clone https://github.com/lu-zero/mfx_dispatch.git
cd mfx_dispatch
autoreconf -i
./configure --prefix="$prf_dir" --with-pic ldflags="-fPIC"
make -j$CORES
checkinstall --fstrans=no --backup=no --default --deldoc=no --pkgname="libmfx-dev" --pakdir=$ff_bld_dir
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### libwebp-dev
show_progress "Installing libwebp-dev"
cd $ff_dir
#wget --no-check-certificate http://downloads.webmproject.org/releases/webp/libwebp-0.4.2.tar.gz
#tar -xvzf libwebp-0.4.2.tar.gz
git clone https://github.com/webmproject/libwebp.git
cd libwebp
./autogen.sh
./configure --prefix="$prf_dir"
make -j$CORES
checkinstall --fstrans=no --backup=no --default --deldoc=no --pkgname="libwebp-dev" --pkgversion="0.5.0" --pakdir=$ff_bld_dir
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### libutvideo
show_progress "Installing libutvideo"
cd $ff_dir
git clone https://github.com/qyot27/libutvideo.git
cd libutvideo
./configure --prefix="$prf_dir" --enable-shared --disable-static --enable-pic
make -j$CORES
checkinstall --pkgname=libutvideo --pkgversion="3:$(./version.sh | \awk -F'[" ]' '/POINT/{print $4"+git"$5}')" \
--backup=no --deldoc=yes --fstrans=no --default --pakdir=$ff_bld_dir
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### libvstab
show_progress "Installing libvstab"
cd $ff_dir
git clone https://github.com/georgmartius/vid.stab.git
cd vid.stab/
cmake .
make -j$CORES
make install
checkinstall --fstrans=no --backup=no --default --deldoc=no --pkgname="libvidstab" --pkgversion="1.0" --pakdir=$ff_bld_dir --install=no
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### libass
show_progress "Installing libass"
cd $ff_dir
git clone https://github.com/libass/libass.git
cd libass
./autogen.sh
./configure --prefix="$prf_dir" --disable-static --enable-shared ldflags="-fPIC -shared"
make -j$CORES
checkinstall --fstrans=no --backup=no --default --deldoc=no --pkgname="libass" --pkgversion="0.13.2" --pakdir=$ff_bld_dir
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### libbluray
### show_progress "Installing libbluray"
### $APTCMD install ant
### cd $ff_dir
### git clone --depth 1 git://git.videolan.org/libbluray.git libbluray
### cd libbluray
### ./bootstrap
### ./configure --prefix="$prf_dir"
### make -j$CORES
### make install
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### makemkv
###show_progress "Installing makemkv"
### $APTCMD install libgl1-mesa-dev libqt4-dev
### cd $ff_dir
### wget --no-check-certificate http://www.makemkv.com/download/makemkv-oss-1.9.10.tar.gz
### wget --no-check-certificate http://www.makemkv.com/download/makemkv-bin-1.9.10.tar.gz
### tar -xzf makemkv-oss-1.9.10.tar.gz
### tar -xzf makemkv-bin-1.9.10.tar.gz
### cd makemkv-oss-1.9.10
### ./configure --disable-gui
### make -j$CORES
### make install
###
### cd $ff_dir/makemkv-bin-1.9.10
### mkdir tmp
### echo 'accepted' > tmp/eula_accepted
### make
### make install
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### libwavpack
show_progress "Installing libwavpack"
cd $ff_dir
wget --no-check-certificate http://www.wavpack.com/wavpack-4.80.0.tar.bz2
tar xvf wavpack-4.80.0.tar.bz2
cd wavpack-4.80.0/
./configure --disable-asm --prefix="$prf_dir" --enable-man --enable-tests
make -j$CORES
make install
checkinstall --fstrans=no --backup=no --default --deldoc=no --pkgname="libwavpack" --pkgversion="4.80.0" --pakdir=$ff_bld_dir --install=no
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### libkvazaar
show_progress "Installing libkvazaar"
cd $ff_dir
git clone https://github.com/ultravideo/kvazaar.git
cd kvazaar/
./autogen.sh
./configure --disable-werror --disable-asm --prefix="$prf_dir"
make -j$CORES
make install
checkinstall --fstrans=no --backup=no --default --deldoc=no --pkgname="libkvazaar" --pkgversion="0.8.3" --pakdir=$ff_bld_dir --install=no
#dpkg -r --force-depends libavformat-dev libavfilter-dev libavresample-dev libavutil-dev libavcodec-dev
#apt-get remove libswscale-dev libavutil-dev libavresample-dev
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### libav
show_progress "Installing libav"
cd $ff_dir
# Git release tends to cause problems with nginx upstream fair module.
# git clone --depth 1 git://git.libav.org/libav.git libav
wget --no-check-certificate https://libav.org/releases/libav-11.6.tar.gz
tar xvfz libav-11.6.tar.gz
mv libav-11.6 libav
cd libav
ldconfig
# We need this patch to due to a bug in compiling. #4956 libvpx has removed reference/entropy controls and ffmpeg won't build.
#wget --no-check-certificate https://raw.githubusercontent.com/nomadturk/openresty-install/master/libvpx-1.5.0.patch
#patch libavcodec/libvpxenc.c libvpx-1.5.0.patch
./configure \
--cc="ccache gcc" \
--extra-cflags="-DLIBTWOLAME_STATIC -g -O2 -Wl,-z,relro -fPIC -Wformat -Werror=format-security -I/usr/include"\
--enable-shared \
--disable-debug \
--disable-encoder=libschroedinger \
--enable-avfilter \
--enable-avresample \
--enable-bzlib \
--enable-decoder=vp9 \
--enable-filter=movie \
--enable-frei0r \
--enable-gpl \
--enable-gray \
--enable-libdc1394 \
--enable-libfaac \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libgsm \
--enable-libmp3lame \
--enable-libopencore-amrnb \
--enable-libopencore-amrwb \
--enable-libopenjpeg \
--enable-libopus \
--enable-libpulse \
--enable-libschroedinger \
--enable-libspeex \
--enable-libtheora \
--enable-libtwolame \
--enable-libvo-amrwbenc \
--enable-libvorbis \
--enable-libvpx \
--enable-libwebp \
--enable-libx264 \
--enable-libx265 \
--enable-libxvid \
--enable-nonfree \
--enable-gnutls \
--enable-pic \
--enable-protocol=file \
--enable-pthreads \
--enable-runtime-cpudetect \
--enable-swscale \
--enable-vaapi \
--enable-version3 \
--enable-x11grab \
--enable-zlib \
--enable-librtmp \
--enable-openssl \
--enable-libvo-aacenc \
--extra-libs="-lstdc++ -llzma -lvpx -lbz2 -lc -ldl -lz -lxvidcore -lx264 -logg -lfdk-aac -lwebp -lopus -lfreetype -lrtmp -lfaac -lgsm -lopenjpeg -lmp3lame" \
--extra-ldflags="-Wall -L/usr/lib" \
--prefix="$prf_dir" \
--enable-openssl \
--enable-libwavpack
#--enable-libmfx \
#--enable-libkvazaar
make -j$CORES
make install
#checkinstall --fstrans=no --backup=no --default --deldoc=no --pkgname="libav" \
# --pkgversion="11.$(./version.sh)" --pakdir=$ff_bld_dir --install=no
#echo "$prf_dir/local/bin"> /etc/ld.so.conf.d/libav.conf
#ldconfig
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### Rebuild x264 with libav
cd $ff_dir/x264
./configure --prefix="$prf_dir" --bindir="$prf_dir/bin" --bit-depth=10 --enable-pic --enable-shared --enable-strip
make -j$CORES
make install
checkinstall --pkgname=libx264-dev --pkgversion="3:$(./version.sh | \
awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes \
--fstrans=no --default --pakdir=$ff_bld_dir
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### libffms2
show_progress "Installing libffms2"
cd $ff_dir
git clone https://github.com/FFMS/ffms2.git
cd ffms2
./autogen.sh
./configure --prefix="$prf_dir" --disable-static
make -j$CORES
make install
checkinstall --fstrans=no --backup=no --default --deldoc=no --pkgname="libffms2" --pkgversion="2:$(./version.sh)" --pakdir=$ff_bld_dir --install=no
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### Finally, ffmpeg
show_progress "Now... Using all above, compiling FFMpeg"
cd $ff_dir
if [ -d "$ff_dir/FFmpeg" ]; then rm -rf $ff_dir/FFmpeg/ ; fi
git clone https://github.com/FFmpeg/FFmpeg.git
cd FFmpeg
sed -i 's/-lflite" /-lflite -lasound" /' configure
./configure \
--cc="ccache gcc" \
--prefix=/usr \
--bindir=/usr/bin \
--libdir=/usr/lib/x86_64-linux-gnu \
--shlibdir=/usr/lib/x86_64-linux-gnu \
--docdir=/usr/share/doc/ffmpeg \
--extra-libs="-lstdc++ -llzma -lvpx -lbz2 -lc -ldl -lz -lxvidcore -lx264 -logg -lfdk-aac -lwebp -lopus -lfreetype -lrtmp -lfaac -lgsm -lopenjpeg -lmp3lame -lffms2 -lkvazaar" \
--extra-ldflags="-Wall" \
--extra-cflags="-DLIBTWOLAME_STATIC -g -O2 -Wl,-z,relro -Wformat -Werror=format-security" \
--enable-shared \
--enable-avfilter \
--enable-avresample \
--enable-bzlib \
--enable-decoder=vp9 \
--enable-ffplay \
--enable-ffserver \
--enable-filter=movie \
--enable-fontconfig \
--enable-frei0r \
--enable-gpl \
--enable-gray \
--enable-libass \
--enable-libbluray \
--enable-libcaca \
--enable-libdc1394 \
--enable-libfaac \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libfribidi \
--enable-libgsm \
--enable-libmfx \
--enable-libmp3lame \
--enable-libopencore-amrnb \
--enable-libopencore-amrwb \
--enable-libopenjpeg \
--enable-libopus \
--enable-libpulse \
--enable-libschroedinger \
--enable-libsoxr \
--enable-libspeex \
--enable-libtheora \
--enable-libtwolame \
--enable-libutvideo \
--enable-libv4l2 \
--enable-libvidstab \
--enable-libvo-amrwbenc \
--enable-libvorbis \
--enable-libvpx \
--enable-libwebp \
--enable-libx264 \
--enable-libx265 \
--enable-libxvid \
--enable-libzimg \
--enable-libzvbi \
--enable-nonfree \
--enable-openal \
--enable-gnutls \
--enable-pic \
--enable-postproc \
--enable-protocol=file \
--enable-pthreads \
--enable-runtime-cpudetect \
--enable-swscale \
--enable-vaapi \
--enable-version3 \
--enable-x11grab \
--enable-zlib \
--enable-librtmp \
--enable-openssl \
--enable-libwavpack \
--enable-libkvazaar \
--disable-debug \
--disable-encoder=libschroedinger \
--disable-altivec \
--disable-podpages \
--disable-htmlpages \
--disable-mipsdspr2 \
--disable-mips32r2 \
--disable-vda
make -j$CORES
gcc tools/qt-faststart.c -o tools/qt-faststart
checkinstall --pkgname=ffmpeg --pkgversion="7:$(date +%Y%m%d%H%M)-git" --backup=no \
--deldoc=yes --fstrans=no --default --pakdir=$ff_bld_dir
hash -r
### Building FFmpeg Test Suite
## https://ffmpeg.org/fate.html
# make fate-rsync SAMPLES=fate-suite/
# make fate SAMPLES=fate-suite/
# ./configure --samples=fate-suite/
# make fate-rsync
# make fate
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### END OF FFPMEG
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ###
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ###
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### IMAGEMAGICK
show_progress "Installing ImageMagick"
#show_progress "Installing jpegsrc"
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### JPEGSRC
#cd $mgk_dir
#wget --no-check-certificate http://www.ijg.org/files/jpegsrc.v9a.tar.gz
#tar -xzvf jpegsrc.v9a.tar.gz
#cd jpeg-9a/
#./configure --enable-shared
#make
#make install
# checkinstall --fstrans=no --backup=no --default --deldoc=no --pkgname="jpegsrc --pkgversion="9a" --pakdir=$mgk_bld_dir
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### END OF JPEGSRC
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### LINUNWIND & GPERFTOOLS
show_progress "Installing libunwind"
mkdir -p $mgk_dir/gperftools
cd $mgk_dir/gperftools
#wget -c http://ftp.twaren.net/Unix/NonGNU/libunwind/libunwind-1.1.tar.gz
#tar zxvf libunwind-1.1.tar.gz
if [ -d "$mgk_dir/gperftools/libunwind" ]; then rm -rf $mgk_dir/gperftools/libunwind/ ; fi
git clone http://git.savannah.gnu.org/r/libunwind.git
cd libunwind
./autogen.sh
./configure CFLAGS=-U_FORTIFY_SOURCE
make -j$CORES
#make install
checkinstall --fstrans=no --backup=no --default --deldoc=no --pkgname="libunwind" --pkgversion="1.1" --pakdir=$mgk_bld_dir
####################
show_progress "Installing gperftools"
cd $mgk_dir/gperftools
#git clone https://code.google.com/p/gperftools-git/
git clone https://github.com/gperftools/gperftools.git
cd gperftools
./autogen.sh
./configure --prefix=$prf_dir/local/gperftools --enable-shared --enable-frame-pointers
make -j$CORES
make install
cp -r $prf_dir/local/gperftools/lib/* $prf_dir/local/lib/
if [ ! -d "/tmp/tcmalloc" ]; then
mkdir /tmp/tcmalloc
chmod 0777 /tmp/tcmalloc/
chown -R www-data:www-data /tmp/tcmalloc
else
chmod 0777 /tmp/tcmalloc/
chown -R www-data:www-data /tmp/tcmalloc
fi
show_progress "Installing apt-get additions for gperftools"
$APTCMD install google-perftools libgoogle-perftools-dev
export PPROF_PATH=$prf_dir/local/bin/pprof
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ###
show_progress "Compile ImageMagick, shall we?"
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### ImageMagick
cd $mgk_dir/
wget -c http://www.imagemagick.org/download/ImageMagick.tar.gz
tar -zxvf ImageMagick.tar.gz
cd ImageMagick*
./configure --prefix=$prf_dir/local/ImageMagick \
--sysconfdir=/etc \
--with-modules \
--with-gslib \
--with-wmf \
--with-webp \
--with-gslib \
--with-perl=$prf_dir/bin/perl \
--disable-static
make -j$CORES
checkinstall --fstrans=no --install=no -y --pakdir=$mgk_bld_dir
make install
#cd $mgk_dir/
#rm -rf ImageMagick-*
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ###
show_progress "Now, let's start Nginx installation"
show_progress "Installing pcre"
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### pcre
cd $ngx_dir
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
tar -xvf pcre-8.38.tar.gz
mv pcre-8.38 pcre
show_progress "Installing ngx_pagespeed"
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### ngx_pagespeed
cd $ngx_dir/
NPS_VERSION=1.11.33.2
wget --no-check-certificate https://github.com/pagespeed/ngx_pagespeed/archive/release-${NPS_VERSION}-beta.zip -O release-${NPS_VERSION}-beta.zip
unzip release-${NPS_VERSION}-beta.zip
cd ngx_pagespeed-release-${NPS_VERSION}-beta/
show_progress "Installing psol for ngx_pagespeed"
# Can change it with the https one. But it is slower.
wget --no-check-certificate https://dl.google.com/dl/page-speed/psol/${NPS_VERSION}.tar.gz
tar -xzvf ${NPS_VERSION}.tar.gz # extracts to psol/
# Timer reminder
DIFFX=$(( $(date +%s) - $START ))
echo Up till now it took $(($DIFFX / 60 )) minutes and $(($DIFFX % 60 )) seconds... > /tmp/time.tmp
show_progress_error2 "$(cat /tmp/time.tmp)"
### ++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++*++* ### Necessary modules from GitHub
show_progress "Git cloning modules"
cd $ngx_dir/
git clone https://github.com/nbs-system/naxsi.git
cd $ngx_dir/
git clone https://github.com/arut/nginx-dav-ext-module.git
cd $ngx_dir/
git clone https://github.com/slact/nginx_http_push_module.git
cd $ngx_dir/
git clone https://github.com/arut/nginx-rtmp-module.git
cd $ngx_dir/
git clone https://github.com/arut/nginx-dlna-module.git
cd $ngx_dir/
git clone https://github.com/tg123/websockify-nginx-module.git
cd $ngx_dir/
git clone https://github.com/masterzen/nginx-upload-progress-module.git
cd $ngx_dir/
git clone https://github.com/gnosek/nginx-upstream-fair.git
cd $ngx_dir/
git clone https://github.com/wandenberg/nginx-video-thumbextractor-module.git
cd $ngx_dir/
git clone https://github.com/FRiCKLE/ngx_cache_purge.git
cd $ngx_dir/
git clone https://github.com/aperezdc/ngx-fancyindex.git
git clone git://github.com/bpaquet/ngx_http_enhanced_memcached_module.git
git clone https://github.com/alibaba/nginx-http-concat.git
git clone git://github.com/flavioribeiro/nginx-audio-track-for-hls-module.git
git clone https://github.com/bagder/libbrotli
cd libbrotli
./autogen.sh
./configure
make
make install
cd $ngx_dir/
git clone https://github.com/google/ngx_brotli.git
show_progress "Last... Getting, compiling nginx, doing some tweaks etc. Be patient, will you!"
cd $ngx_dir/
if [ "$LINUX_ARCH" != "x86_64" ] && [ "$LINUX_ARCH" != "i386" ] && [ "$LINUX_ARCH" != "i486" ] && [ "$LINUX_ARCH" != "amd64" ] && [ "$LINUX_ARCH" != "x86" ]; then
#Ubuntu
show_progress_error "Warning, Openresty can not be compiled with pcre-jit module on PowerPC, replacing it with Nginx!"
show_progress_error "Also ngx_pagespeed won't compile on ppc architecture either. So skipping it..."
#the following headers-more and echo modules doesn't compile with openresty
git clone https://github.com/openresty/headers-more-nginx-module.git
git clone https://github.com/openresty/echo-nginx-module.git
wget --no-check-certificate http://nginx.org/download/nginx-1.9.7.tar.gz
tar -xvzf nginx-1.9.7.tar.gz
cd nginx-1.9.7
./configure \
--prefix=$prf_dir/local/nginx \
--sbin-path=$prf_dir/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/lock/nginx.lock \