forked from mean00/avidemux2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-libaom.bash
executable file
·124 lines (108 loc) · 3.27 KB
/
install-libaom.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
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/bash
# This is a convenience script to automate installation of libaom in MXE
failMsg()
{
echo "** $1 **"
exit 1
}
process()
{
case "$1" in
32)
CROSS_PREFIX="i686-w64-mingw32.shared"
TOOLCHAIN="x86-mingw-gcc.cmake"
;;
64)
CROSS_PREFIX="x86_64-w64-mingw32.shared"
TOOLCHAIN="x86_64-mingw-gcc.cmake"
;;
*)
echo "Unsupported option \"$1\""
exit 1
;;
esac
if [ -d "build-aom$1" ]; then
rm -rf "build-aom$1" || failMsg "Cannot remove old ${AOM_HOME}/build-aom$1 directory"
fi
mkdir "build-aom$1" || failMsg "Cannot create ${AOM_HOME}/build-aom$1 directory"
cd "build-aom$1"
cmake ../aom/ \
-DCROSS="${CROSS_PREFIX}-" \
-DCMAKE_TOOLCHAIN_FILE="../aom/build/cmake/toolchains/${TOOLCHAIN}" \
-DENABLE_DOCS=0 \
-DENABLE_EXAMPLES=0 \
-DENABLE_TOOLS=0 \
-DBUILD_SHARED_LIBS=1 \
-DCONFIG_AV1_ENCODER=0 \
-DCONFIG_ANALYZER=0 \
-DFORCE_HIGHBITDEPTH_DECODING=0 \
-DCMAKE_INSTALL_PREFIX=${MXE_ROOT}/usr/${CROSS_PREFIX} || failMsg "Failed at cmake"
make -j $(nproc) || failMsg "Failed at make"
make install || failMsg "Failed at make install"
DLL="${MXE_ROOT}/usr/${CROSS_PREFIX}/lib/libaom.dll"
mv -v "${DLL}" "${MXE_ROOT}/usr/${CROSS_PREFIX}/bin/" || failMsg "Failed moving ${DLL} to ${MXE_ROOT}/usr/${CROSS_PREFIX}/bin/"
}
#AOM_HOME=/home/eumagga/adm
#MXE_ROOT=${AOM_HOME}/mxe
MXE_ROOT="$1"
if [ "x${MXE_ROOT}" = "x" ]; then
echo "Usage: $0 /path/to/MXE/root/directory"
exit 1
fi
if ! [ -d "${MXE_ROOT}" ]; then
failMsg "${MXE_ROOT} does not exist or is not a directory"
fi
if ! [ -f "${MXE_ROOT}/mxe.github.mk" ]; then
failMsg "${MXE_ROOT} does look like a MXE root directory"
fi
BUILD_32_BITS=0
BUILD_64_BITS=0
if [ -d "${MXE_ROOT}/usr/i686-w64-mingw32.shared" ]; then
BUILD_32_BITS=1
fi
if [ -d "${MXE_ROOT}/usr/x86_64-w64-mingw32.shared" ]; then
BUILD_64_BITS=1
fi
if [ ${BUILD_32_BITS} -eq 0 ] && [ ${BUILD_64_BITS} -eq 0 ]; then
failMsg "No supported build targets found"
fi
if [ "x${AOM_HOME}" = "x" ]; then
export AOM_HOME="$(pwd)"
fi
if ! [ -d "${AOM_HOME}" ]; then
failMsg "${AOM_HOME} does not exist or is not a directory"
fi
cd "${AOM_HOME}"
if [ -d "${AOM_HOME}/aom" ] && ! [ -d "${AOM_HOME}/aom/.git" ]; then
echo "${AOM_HOME}/aom is not a git repository, will try to remove it"
rm -rf "${AOM_HOME}/aom" || failMsg "Cannot remove ${AOM_HOME}/aom"
fi
FRESH=0
if ! [ -d "${AOM_HOME}/aom" ]; then
echo "Will clone aom source in ${AOM_HOME} directory"
git clone https://aomedia.googlesource.com/aom || failMsg "Failed cloning aom source"
FRESH=1
fi
cd "${AOM_HOME}/aom"
if [ "x${AOM_TAG}" = "x" ]; then
AOM_TAG="v2.0.2"
fi
if [ "x${FRESH}" = "x0" ]; then
git fetch || failMsg "Cannot fetch changes"
fi
git checkout tags/${AOM_TAG} || failMsg "Cannot checkout ${AOM_TAG}"
export PATH="${PATH}:${MXE_ROOT}/usr/bin"
RESULT=0
cd "${AOM_HOME}"
if [ ${BUILD_32_BITS} -eq 1 ]; then
process 32 || ( echo "32-bit build failed"; RESULT=1 )
fi
cd "${AOM_HOME}"
if [ ${BUILD_64_BITS} -eq 1 ]; then
process 64 || ( echo "64-bit build failed"; RESULT=1 )
fi
if [ $RESULT -eq 1 ]; then
failMsg "Some builds failed"
fi
echo "All done"
exit 0