forked from mean00/avidemux2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreateDebFromSourceUbuntu.bash
111 lines (111 loc) · 3.28 KB
/
createDebFromSourceUbuntu.bash
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
#!/bin/bash
install_packages=1
default_install_prefix="/usr"
install_prefix="$default_install_prefix"
rebuild=""
#
usage()
{
echo "Usage: $0 [Options]"
echo "***********************"
echo " --help or -h : Print usage"
echo " --deps-only : Just install build dependencies and exit"
echo " --prefix=DIR : Install to directory DIR (default: $default_install_prefix)"
echo " --no-install : Don't install generated debian avidemux packages"
echo " --rebuild : Preserve existing build directories"
}
#
install_deps()
{
echo "This will install all the packages necessary to build avidemux"
echo "You will be asked to enter your password because installing build dependencies requires root permissions"
# gcc, g++ and make get installed as dependencies of build-essential
sudo apt-get update && sudo apt-get install build-essential cmake pkg-config yasm \
libsqlite3-dev libfontconfig1-dev libfribidi-dev libxv-dev libvdpau-dev libva-dev libasound2-dev libpulse-dev \
qttools5-dev-tools qtbase5-dev \
libpng-dev libaften-dev libmp3lame-dev libx264-dev libxvidcore-dev libfaad-dev libfaac-dev libopus-dev libvorbis-dev libogg-dev libdca-dev \
|| { echo "The installation at least of some of the build dependencies failed. Aborting." && exit 2; }
sudo apt-get install libx265-dev \
|| echo "Warning: libx265-dev cannot be installed using package management. Avidemux won't be able to encode in h265 unless the library and the headers have been installed manually. Continuing anyway." # there are no official libx265 packages for Ubuntu Trusty
}
#
install_avidemux()
{
echo "Installing avidemux..."
cd debs && sudo dpkg -i *
}
#
option_value()
{
echo $(echo $* | cut -d '=' -f 2-)
}
#
option_name()
{
echo $(echo $* | cut -d '=' -f 1 | cut -b 3-)
}
#
dir_check()
{
op_name="$1"
dir_path="$2"
if [ "x$dir_path" != "x" ]; then
if [[ "$dir_path" != /* ]]; then
>&2 echo "Expected an absolute path for --$op_name=$dir_path, aborting."
exit 1
fi
else
>&2 echo "Empty path provided for --$op_name, aborting."
exit 1
fi
case "$dir_path" in
*/)
echo $(expr "x$dir_path" : 'x\(.*[^/]\)') # strip trailing slashes
;;
*)
echo "$dir_path"
;;
esac
}
#
while [ $# != 0 ]; do
config_option="$1"
case "$config_option" in
-h|--help)
usage
exit 0
;;
--deps-only)
install_deps
exit 0
;;
--prefix=*)
install_prefix=$(dir_check $(option_name "$config_option") $(option_value "$config_option")) || exit 1
;;
--no-install)
install_packages=0
;;
--rebuild)
rebuild="$config_option"
;;
*)
echo "unknown parameter $config_option"
usage
exit 1
;;
esac
shift
done
#
install_deps
#
echo "Compiling avidemux, it will take 20 minutes or so"
bash bootStrap.bash --deb --prefix=$install_prefix $rebuild 2>&1 | tee log-bootstrap-$(date +%F_%T).log \
|| { echo "Build failed. Cancelling installation." && exit 3; }
#
if [ $install_packages -eq 1 ]; then
install_avidemux
exit
fi
#
exit 0