-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathconfigure
executable file
·967 lines (792 loc) · 23.3 KB
/
configure
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
#!/bin/bash
die(){
echo -en "
\E[1;33;44m$1, aborting...\E[0m
"
exit 1
}
die_unknown(){
echo -en "
\E[1;33;44mUnknown option \"$1\".\E[0m
"
./configure --help
exit 1
}
confirmno(){
# call with a prompt string or use a default
read -r -p "${1:-Are you sure? [y/N]} " response
case $response in
[yY][eE][sS]|[yY])
true
;;
*)
false
;;
esac
}
confirmyes(){
# call with a prompt string or use a default
read -r -p "${1:-Are you sure? [Y/n]} " response
case $response in
[yY][eE][sS]|[yY])
true
;;
[nN][oO]|[nN])
false
;;
*)
true
;;
esac
}
optimizer(){
echo -en "
\E[1;33;44m
Fatal error(s) encoutered during optimization tests.
Aborting...
\E[0m
"
exit 1
}
show_help(){
echo " Usage: ./configure --opt1=<opt> --opt2=<opt>"
echo " "
echo " Options: [default], if any, in brackets after option."
echo " "
echo " --help Print this message"
echo " "
echo " --compiletype=<opt> [release] Specify compile type: release or debug."
echo " "
echo " --dvb_dir=<path> Use <path> for DVB headers. It is mandatory if you"
echo " compiled v4l (based) drivers."
echo " If you did not, don't use this option!"
echo " Use like --dvb_dir=/usr/src/media_build/linux"
echo " Info: www.lursen.org/wiki/V4l_and_ffdecsawrapper"
echo " "
echo " --optimize=<opt> [yes] Perform FFDecsa optimization auto-detection"
echo " for all mmx and sse types optimizations"
echo " with both -O2 and -O3 levels"
echo " long: Try all known optimizations"
echo " no: Don't do any optimizations"
echo " Option is disabled by --ffdecsa_mode option"
echo " "
echo " --tsbuffer=<opt> [32] Change default TS buffer size (in MB)."
echo " Use like --tsbuffer=64"
echo " "
echo " --ffdecsa_mode=<opt> Test single <opt> optimization mode"
echo " with both -O2 and -O3 level"
echo " Use like --ffdecsa_mode=PARALLEL_128_SSE"
echo " Option disables --optimize option"
echo " "
echo " --ffdecsa_flags=<opt> Use <opt> ffdecsa compiler flags."
echo " Don't use this option unless you"
echo " exactly know what you are doing."
echo " "
echo " --cxx=<opt> [g++] Define C++ and CC version to use"
echo " Use like --cxx=4.7"
echo " "
echo " --update=<opt> [yes] no: don't clean local clone and"
echo " don't pull in any updates."
echo " "
echo " --binary=<opt> [yes] no: don't compile ffdecsawrapper binary"
echo " "
echo " --module=<opt> [yes] no: don't compile dvbloopback kernel module"
echo " "
exit 0
}
ffdecsa_opt="yes"
compiletype_opt="release"
v4l_opt="no"
update_opt="yes"
binary_opt="yes"
module_opt="yes"
for opt do
optval="${opt#*=}"
case "$opt" in
--dvb_dir=*) dvb_path=`eval echo $optval`
;;
--cxx=*) CXX="g++-$optval"; CC="gcc-$optval"
;;
--ffdecsa_mode=*) ffdecsa_opt="defined"; MAX_MODE="$optval"
;;
--ffdecsa_flags=*) ffdecsa_flags="$optval"
;;
--tsbuffer=*) tsbuffer="$optval"
;;
--optimize=*) ffdecsa_opt="$optval"
;;
--compiletype=*) compiletype_opt="$optval"
;;
--v4l=*) v4l_opt="$optval"
;;
--update=*) update_opt="$optval"
;;
--binary=*) binary_opt="$optval"
;;
--module=*) module_opt="$optval"
;;
--help) show_help
;;
*)
die_unknown $opt
;;
esac
done
# Get kernel version numbers
SHORT_KERNEL=$( echo `uname -r` | grep -o '[[:digit:]]\+\.[[:digit:]]\+' )
FIRST_DIGIT=$( echo `uname -r` | grep -o '[[:digit:]]\+' | head -n1 )
SECOND_DIGIT=$( echo `uname -r` | grep -o '[[:digit:]]\+' | awk 'NR==2' )
DEBIANABIVERS=$( echo `uname -r` | grep -o '[[:digit:]]\+' | awk 'NR==4' )
# Abort if running kernel is < 3.x
if [ "$FIRST_DIGIT" -lt 3 ]; then
echo -en "
\E[1;33;44m
The kernel you are running is not supported anymore.
Minimum supported version is 3.x
\E[0m
Aborting...
"
exit 1
fi
# Check for proper use of --module flag
if ! [ "x$module_opt" = "xyes" -o "x$module_opt" = "xno" ]; then
echo "
Bad option to \"--module=\". Should be \"yes\" or \"no\".
Aborting...
"
exit 1
fi
# Check git status
if [ "x$update_opt" = "xyes" ]; then
git clean -xfd > /dev/null
git reset --hard HEAD > /dev/null
git remote update > /dev/null 2>&1
if ! [ "$?" -eq 0 ]; then
echo -en "
\E[1;33;44m
###################################
Error(s) encountered while updating
the status from remote git repo.
Aborting...
####################################
\E[0m
"
exit 1
fi
LOCAL=$(git rev-parse @{0})
REMOTE=$(git rev-parse @{u})
BASE=$(git merge-base @{0} @{u})
if [ $LOCAL = $REMOTE ]; then
GITSTATUS="0" # "Up-to-date"
elif [ $LOCAL = $BASE ]; then
GITSTATUS="1" # "Need to pull"
elif [ $REMOTE = $BASE ]; then
GITSTATUS="2" # "Need to push"
else
GITSTATUS="3" # "Diverged"
fi
if [ "$GITSTATUS" -eq "0" ]; then
echo "
Your local clone is clean and up-to-date
"
sleep 3
elif [ "$GITSTATUS" -eq "1" ]; then
echo "
Going to sync your local clone with updated remote repo.
"
sleep 3
git pull > /dev/null
if ! [ "$?" -eq 0 ]; then
echo -en "
\E[1;33;44m
###################################
Error(s) encountered while syncing
local with remote git repo
Aborting...
####################################
\E[0m
"
exit 1
else
echo -en "
######################################################
Synced with remote repo successfully! Please rerun
./configure to complete installation of FFdecsawrapper
and dvbloopback drivers.
Arrow up and enter will get you there.
######################################################
"
exit 0
fi
elif [ "$GITSTATUS" -eq "2" -o "$GITSTATUS" -eq "3" ]; then
echo -en "
\E[1;33;44m
#####################################
Your local clone cannot be synced
with remote repo due to local changes
Aborting...
######################################
\E[0m
"
exit 1
fi
fi
if ! [ -f "/etc/arch-release" ] > /dev/null 2>&1; then
# Detect previous installed dvbloopback module
if [ "x$module_opt" = "xyes" ]; then
MODULE=$(find /lib/modules/`uname -r`/ -type f -name "dvbloopback.ko")
if ! [ "$MODULE" = "" ]; then
echo "
Existing $MODULE detected.
Do you want to recompile it?
"
confirmno "Recompile dvbloopback module [N/y]"
if [ "$?" -eq 1 ]; then
module_opt="no"
else
if ! [ -d /lib/modules/`uname -r`/updates/ffdecsawrapper ]; then
mkdir -p /lib/modules/`uname -r`/updates/ffdecsawrapper
fi
fi
fi
fi
# Detect previous installed ffdecswrapper binary
if [ -e /usr/bin/ffdecsawrapper ]; then
echo "
Existing ffdecsawrapper binary detected.
Do you want to recompile it?
"
confirmno "Recompile ffdecsawrapper binary [N/y]"
if [ "$?" -eq 1 ]; then
binary_opt="no"
if [ "x$module_opt" = "xno" ]; then
echo "
Nothing to do,
Exit.
"
exit 0
fi
fi
fi
fi
echo "# Automatically generated by configure - do not modify" > config.mak
# Check for use of v4l drivers
if [ "x$module_opt" = "xyes" ]; then
if [ "x$dvb_path" != "x" ]; then
if [ "x$v4l_opt" = "xno" ]; then
if ! [ -f "/etc/arch-release" ] > /dev/null 2>&1; then
echo -en "
\E[1;33;44m
! ATTENTION !
\E[0m
You have set the --dvb_dir= option, indicating that you compiled
and installed newest dvb drivers from v4l.This should mean that
you patched the v4l sources with the apropriate dvb-mutex patch
and commented out CONFIG_MEDIA_CONTROLLER_DVB
If you are not sure, you probably did not.
In that case answer no to the question and first have a look at:
http://www.lursen.org/wiki/V4l_and_ffdecsawrapper
"
confirmyes "Proceed?[Y/n]"
if [ "$?" -eq 1 ]; then
echo "
You have chosen not to proceed.
Aborting...
"
exit 0
fi
fi
fi
fi
fi
#
# Begin Debian Section
#
# First get some info on what we are running
if [ -f /usr/bin/lsb_release ]; then
OS=$( lsb_release -si )
RELEASE=$( lsb_release -sc )
fi
# The rest of the Debian section
# depends on the outcome of next line
if [ "$OS" = Debian -o "$OS" = Ubuntu ] ; then
# Make sure that we are running as root
if ! echo "$(whoami)" | grep "root" > /dev/null 2>&1; then
if [ "$OS" = Debian ]; then
echo -en "
\E[1;33;44m
You should run as root.
Aborting...
\E[0m
"
exit 0
else
echo -en "
\E[1;33;44m
You should run as root.
Do \"sudo su\" and run me again.
Aborting...
\E[0m
"
exit 0
fi
fi
# Check if FFdecsawrapper is running
# If it is, offer to stop it
if ps -C ffdecsawrapper > /dev/null 2>&1; then
echo "
It seems that FFdecsawrapper is running.
It should be stopped before proceeding.
"
confirmyes "Do you want to stop FFdecsawrapper now? [Y/n]"
if [ "$?" -eq 0 ]; then
if [ -e /etc/init.d/ffdecsawrapper ]; then
/etc/init.d/ffdecsawrapper stop
sleep 3
rmmod dvbloopback > /dev/null 2>&1
else
killall -9 ffdecsawrapper
sleep 3
rmmod dvbloopback > /dev/null 2>&1
fi
fi
fi
# Install build dependencies for FFdecsawrapper
if ! dpkg-query -l gettext | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency gettext, marking for installation.
"
apt-get install gettext -y || die "Error installing dependency gettext"
fi
if ! dpkg-query -l libv4l-dev | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency libv4l-dev, marking for installation.
"
apt-get install libv4l-dev -y || die "Error installing dependency libv4l-dev"
fi
if ! dpkg-query -l libproc-processtable-perl | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency libproc-processtable-perl, marking for installation.
"
apt-get install libproc-processtable-perl -y || die "Error installing dependency libproc-processtable-perl"
fi
if ! dpkg-query -l libssl-dev | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency libssl-dev, marking for installation.
"
apt-get install libssl-dev -y || die "Error installing dependency libssl-dev"
fi
if ! dpkg-query -l build-essential | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency build-essential, marking for installation.
"
apt-get install build-essential -y || die "Error installing dependency build-essential"
fi
# If we are running a Debian kernel
# we need the headers installed.
# But don't install headers if we are running
# a vanilla kernel
# uname -a does not return Debian
# when we are running a vannila kernel
if [ "x$module_opt" = "xyes" ]; then
if uname -a | egrep 'Debian|Ubuntu' > /dev/null 2>&1; then
if ! dpkg-query -l linux-headers-`uname -r` | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency linux-headers-`uname -r`, marking for installation.
"
apt-get install linux-headers-`uname -r` -y || die "Error installing dependency linux-headers-`uname -r`"
fi
fi
# Compare system default g++ (major) version with the
# g++ (major) version the kernel was built with
# If they differ, choose the version the kernel was built with
# and install any missing packages, unless we defined
# a specific version using --cxx= option on command line
if [ "x$CXX" != "x" ]; then
if ! dpkg-query -l $CXX | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency $CXX, marking for installation.
"
apt-get install $CXX -y || die "Error installing dependency $CXX"
fi
fi
CCSYSTEM=$( g++ -v 2>&1 | grep -i "gcc version" | awk '{ print $3 }' | cut -d'.' -f1,2 )
CCKERNEL=$( cat /proc/version | awk '{ print $7 }' | cut -d'.' -f1,2 )
if ! [ "$CCSYSTEM" = "$CCKERNEL" ] ; then
if [ "x$CXX" = "x" ]; then
CXX=g++-$CCKERNEL
CC=gcc-$CCKERNEL
fi
if ! dpkg-query -l g++-$CCKERNEL | grep "ii" > /dev/null 2>&1; then
echo "
Missing dependency g++-$CCKERNEL, marking for installation.
"
apt-get install g++-$CCKERNEL -y || die "Error installing dependency g++-$CCKERNEL"
fi
fi
fi
fi
#
# Fix disapearing headers declarations in newer kernels
#
if ! cat /usr/include/linux/dvb/dmx.h | grep DMX_KERNEL_CLIENT > /dev/null 2>&1; then
patch -d/ -p0 < dmx.patch
fi
#
# End Debian Section
#
FIRST_DIGIT=$(echo `uname -r` | awk -F/ '{print $NF}' | grep -o '[[:digit:]]\+' | head -n1 | awk 'NR==1')
SECOND_DIGIT=$(echo `uname -r` | awk -F/ '{print $NF}' | grep -o '[[:digit:]]\+' | head -n2 | awk 'NR==2')
EXTRA_DIGIT="0"
VERSION="$FIRST_DIGIT$SECOND_DIGIT"
chars=`echo -n $SECOND_DIGIT | wc -c`
if ! [ "$chars" -eq 2 ]; then
VERSION="$FIRST_DIGIT$EXTRA_DIGIT$SECOND_DIGIT"
fi
# Get the right dvbdev.h in place
# If --dvb_dir= is set, use supplied header
if [ "x$module_opt" = "xyes" ]; then
if [ "x$dvb_path" != "x" ]; then
if [ -f $dvb_path/drivers/media/dvb-core/dvbdev.h ]; then
cp -f $dvb_path/drivers/media/dvb-core/dvbdev.h dvbloopback/module/dvbdev.h
elif [ -f $dvb_path/include/media/dvbdev.h ]; then
cp -f $dvb_path/include/media/dvbdev.h dvbloopback/module/dvbdev.h
elif [ -f $dvb_path/drivers/media/dvb/dvb-core/dvbdev.h ]; then
cp -f $dvb_path/drivers/media/dvb/dvb-core/dvbdev.h dvbloopback/module/dvbdev.h
else echo -en "
\E[1;33;44m
ERROR!!!
Could not locate any of the following:
$dvb_path/drivers/media/dvb-core/dvbdev.h
$dvb_path/drivers/media/dvb/dvb-core/dvbdev.h
$dvb_path/include/media/dvbdev.h
Aborting...
\E[0m
"
make clean > /dev/null 2>&1
exit 0
fi
else
if uname -r | grep "rc" > /dev/null 2>&1; then
RC=$(uname -r | cut -d'-' -f2)
wget https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/include/media/dvbdev.h?id=refs/tags/v$SHORT_KERNEL-$RC -Odvbloopback/module/dvbdev.h
elif [ "$VERSION" -gt 415 ]; then
wget https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/plain/include/media/dvbdev.h?id=refs/tags/v$SHORT_KERNEL -Odvbloopback/module/dvbdev.h
else
wget https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/plain/drivers/media/dvb-core/dvbdev.h?id=refs/tags/v$SHORT_KERNEL -Odvbloopback/module/dvbdev.h
fi
fi
fi
# Get the right Module.symvers in place
# Abort when it is not found
if [ "x$module_opt" = "xyes" ]; then
if [ "x$dvb_path" = "x" ]; then
if [ -f /lib/modules/`uname -r`/build/Module.symvers ]; then
cp -f /lib/modules/`uname -r`/build/Module.symvers dvbloopback/module/Module.symvers
else echo -en "
\E[1;33;44m
ERROR!!!
could not locate /lib/modules/`uname -r`/build/Module.symvers
Aborting...
\E[0m
"
make clean > /dev/null 2>&1
exit 0
fi
else
if [ -f $dvb_path/../v4l/Module.symvers ]; then
cp -f $dvb_path/../v4l/Module.symvers dvbloopback/module/Module.symvers
else echo -en "
\E[1;33;44m
ERROR!!!
could not locate $dvb_path/../v4l/Module.symvers
Aborting...
\E[0m
"
make clean > /dev/null 2>&1
exit 0
fi
fi
fi
# Set compiler version,
# if not done allready
if [ "x$CXX" = "x" ]; then
CXX=g++
CC=gcc
fi
# Define what optimization tests we want
if [ "x$ffdecsa_flags" = "x" ]; then
CCC=$CXX
export CCC
if [ "x$ffdecsa_opt" = "xyes" ]; then
./FFdecsa_optimizer
if ! [ "$?" -eq 0 ]; then
optimizer
fi
elif [ "x$ffdecsa_opt" = "xlong" ]; then
./FFdecsa_optimizer -e
if ! [ "$?" -eq 0 ]; then
optimizer
fi
elif [ "x$ffdecsa_opt" = "xdefined" ]; then
./FFdecsa_optimizer -P $MAX_MODE
if ! [ "$?" -eq 0 ]; then
optimizer
fi
elif [ "x$ffdecsa_opt" = "xno" ]; then
echo "FFDECSA_OPTS = \"FLAGS=-O3 -march=native -fexpensive-optimizations -fomit-frame-pointer -funroll-loops\" PARALLEL_MODE=PARALLEL_128_SSE2 COMPILER=g++" >> config.mak
elif [ "x$ffdecsa_opt" != "xno" ]; then
echo "
Bad option to --optimize '$ffdecsa_opt'. Should be 'yes, long, no'
"
exit 1
fi
fi
# Set TsBufferSize
if [ "x$tsbuffer" != "x" ]; then
sed -i "s/DeCsaTsBuffSize=32/DeCsaTsBuffSize=$tsbuffer/" sc/PLUGINS/src/sc.c
fi
# If set, use user defined FFdecsa flags
if [ "x$ffdecsa_flags" != "x" ]; then
echo $ffdecsa_flags >> config.mak
fi
# Set compiletype
if [ "x$compiletype_opt" = "xrelease" ]; then
echo "RELEASE=1" >> config.mak
elif [ "x$compiletype_opt" = "xdebug" ]; then
echo "RELEASE=0" >> config.mak
else
echo "
Bad option to --compiletype '$compiletype_opt' Should be 'release, debug'
"
exit 1
fi
echo "
`uname -r` kernel detected.
Using C++ compiler: $CXX"
if [ "x$compiletype_opt" = "xrelease" ]; then
echo "Using compile type: release
"
elif [ "x$compiletype_opt" = "xdebug" ]; then
echo "
Using compile type: debug
"
fi
# Set wrapper compiler options
if [ "x$compiletype_opt" = "xrelease" ]; then
echo "SC_FLAGS = \"-O2 -fPIC -Wall -Woverloaded-virtual -fno-strict-aliasing\"" >> config.mak
elif [ "x$compiletype_opt" = "xdebug" ]; then
echo "SC_FLAGS = \"-O2 -g -fPIC -Wall -Woverloaded-virtual -fno-strict-aliasing\"" >> config.mak
fi
echo "CXX=$CXX" >> config.mak
echo "CC=$CC" >> config.mak
# Compile and, if running Debian/Ubuntu or CentOS 7,
# finish by installing the lot.
if [ "$OS" = "CentOS" ]; then
CENTOSVERSION=$(lsb_release -rs | grep -o '[[:digit:]]\+' | head -n1)
if [ "$CENTOSVERSION" -eq "7" ]; then
echo "
Everything looks ok!
Just hit 'enter' to proceed
"
confirmyes "Start compiling now? [Y/n]"
if ! [ "$?" -eq 0 ]; then
echo "
NOT starting compilation
"
exit 0
else
if [ "x$binary_opt" = "xyes" ]; then
make
fi
if ! [ "$?" -eq 0 ]; then
echo -en "
\E[1;33;44m
###################################################
Error(s) encountered while compiling ffdecsawrapper
####################################################
\E[0m
"
exit 1
fi
if [ "x$module_opt" = "xyes" ]; then
make module
fi
if ! [ "$?" -eq 0 ]; then
echo -en "
\E[1;33;44m
##############################################################
Error(s) encountered while compiling dvbloopback kernel module.
###############################################################
\E[0m
"
exit 1
fi
echo "
Do you want to install ffdecsawrapper binary and/or dvbloopback kernel module?
Binary's location: /usr/bin/ffdecsawrapper
dvbloopback module: /usr/lib/modules/`uname -r`/updates/ffdecsawrapper/dvbloopback.ko
"
confirmyes "Yes, install now! [Y/n]"
if ! [ "$?" -eq 0 ]; then
exit 0
else
if [ "x$binary_opt" = "xyes" ]; then
if [ -e /usr/bin/ffdecsawrapper ]; then
rm -f /usr/bin/ffdecsawrapper
fi
cp -f ffdecsawrapper /usr/bin
fi
fi
if [ "x$module_opt" = "xyes" ]; then
if [ -e /usr/lib/modules/`uname -r`/updates/ffdecsawrapper/dvbloopback.ko ]; then
rm -f /usr/lib/modules/`uname -r`/updates/ffdecsawrapper/dvbloopback.ko
fi
/usr/bin/install dvbloopback.ko /usr/lib/modules/`uname -r`/updates/ffdecsawrapper
depmod -a
fi
fi
fi
elif ! [ "$OS" = Debian -o "$OS" = Ubuntu ] ; then
if ! [ -f "/etc/arch-release" ] > /dev/null 2>&1; then
echo "
Everything looks ok!
Just hit 'enter' to proceed
"
confirmyes "Start compiling now? [Y/n]"
if [ "$?" -eq 0 ]; then
if [ "x$binary_opt" = "xyes" ]; then
make
fi
if [ "x$module_opt" = "xyes" ]; then
make module
fi
else
echo "
NOT starting compilation
"
exit 0
fi
else
# Archlinux section
if [ "x$binary_opt" = "xyes" ]; then
make
fi
if ! [ "$?" -eq 0 ]; then
echo -en "
\E[1;33;44m
###########################################################
Error(s) encountered while compiling ffdecsawrapper binary.
############################################################
\E[0m
"
exit 1
fi
if [ "x$module_opt" = "xyes" ]; then
make module
fi
if ! [ "$?" -eq 0 ]; then
echo -en "
\E[1;33;44m
###############################################################
Error(s) encountered while compiling dvbloopback kernel module.
################################################################
\E[0m
"
exit 1
fi
fi
# End Archlinux section
else
echo "
Everything looks ok!
Just hit 'enter' to proceed
"
confirmyes "Start compiling now? [Y/n]"
if ! [ "$?" -eq 0 ]; then
echo "
NOT starting compilation
"
exit 0
else
if [ "x$binary_opt" = "xyes" ]; then
make
fi
if ! [ "$?" -eq 0 ]; then
echo -en "
\E[1;33;44m
###########################################################
Error(s) encountered while compiling ffdecsawrapper binary.
############################################################
\E[0m
"
exit 1
fi
if [ "x$module_opt" = "xyes" ]; then
make module
fi
if ! [ "$?" -eq 0 ]; then
echo -en "
\E[1;33;44m
###############################################################
Error(s) encountered while compiling dvbloopback kernel module.
################################################################
\E[0m
"
exit 1
fi
echo "
Do you want to install ffdecsawrapper binary and/or dvbloopback kernel module?
Binary's location: /usr/bin/ffdecsawrapper
dvbloopback module: /lib/modules/`uname -r`/updates/ffdecsawrapper/dvbloopback.ko
If you hit Y and your kernel needs to be patched, that will be done too.
"
confirmyes "Yes, install now![Y/n]"
if ! [ "$?" -eq 0 ]; then
exit 0
else
if [ "x$binary_opt" = "xyes" ]; then
if [ -e /usr/bin/ffdecsawrapper ]; then
rm -f /usr/bin/ffdecsawrapper
fi
cp -f ffdecsawrapper /usr/bin
fi
if [ "x$module_opt" = "xyes" ]; then
if [ -e /lib/modules/`uname -r`/updates/ffdecsawrapper/dvbloopback.ko ]; then
rm -f /lib/modules/`uname -r`/updates/ffdecsawrapper/dvbloopback.ko
fi
mkdir -p /lib/modules/`uname -r`/updates/ffdecsawrapper > /dev/null 2>&1
/usr/bin/install dvbloopback.ko /lib/modules/`uname -r`/updates/ffdecsawrapper
depmod -a
fi
# The kernel needs to be patched if we don't
# use newest v4l drivers, but don't offer
# to do so if it allready has been done.
if [ "x$dvb_path" = "x" ]; then
if ! find /lib/modules/`uname -r`/updates -name dvb-core.ko -print | grep "dvb-core.ko" > /dev/null 2>&1; then
if uname -a | egrep 'Debian|Ubuntu' > /dev/null 2>&1; then
if [ "$OS" = Debian ]; then
./kernelpatch
elif [ "$OS" = Ubuntu ] ; then
./kernelpatch_ubuntu
fi
else
echo -en "
##########################
\E[1;33;44mKernelpatch not needed, or\E[0m
\E[1;33;44mnon stock kernel detected.\E[0m
##########################
"
exit 0
fi
else
echo -en "
###############################
\E[1;33;44mExisting kernel patch detected.\E[0m
###############################
"
fi
fi
fi
fi
fi