blob: 6bbebfca1c7189fec6650932d7292f17af60db62 (
plain)
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
|
#!/bin/bash
#
# Copyright (C) 2005-2013 Team XBMC
# http://xbmc.org
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This Program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with XBMC; see the file COPYING. If not, see
# <http://www.gnu.org/licenses/>.
#
MYDIR=$(cd $(dirname $0); pwd)
cd $MYDIR
FFMPEG_PREFIX=${MYDIR}/ffmpeg-install
BASE_URL=$(grep "BASE_URL=" FFMPEG-VERSION | sed 's/BASE_URL=//g')
VERSION=$(grep "VERSION=" FFMPEG-VERSION | sed 's/VERSION=//g')
ARCHIVE=ffmpeg-$(echo "${VERSION}" | sed 's/\//-/g').tar.gz
function usage {
echo "usage $(basename $0)
[-p | --prefix] ... ffmepg install prefix
[-d | --download] ... no build, download tarfile only
[-r | --release] ... disable debugging symbols
[-j] ... make concurrency level
[--cpu=CPU] ... minimum required CPU
[--arch=ARCH] ... select architecture
[--disable-optimizations]
"
}
while :
do
case $1 in
-h | --help)
usage
exit 0
;;
-p | --prefix)
FFMPEG_PREFIX=$2
shift 2
;;
--prefix=*)
FFMPEG_PREFIX=${1#*=}
shift
;;
-d | --download)
downloadonly=true
shift
;;
-r | --release)
FLAGS="$FLAGS --disable-debug"
shift
;;
--disable-optimizations)
FLAGS="$FLAGS --disable-optimizations"
shift
;;
--cpu=*)
FLAGS="$FLAGS --cpu=${1#*=}"
shift
;;
--arch=*)
FLAGS="$FLAGS --arch=${1#*=}"
shift
;;
--extra-cflags=*)
FLAGS="$FLAGS --extra-cflags=\"${1#*=}\""
shift
;;
--extra-cxxflags=*)
FLAGS="$FLAGS --extra-cxxflags=\"${1#*=}\""
shift
;;
-j)
BUILDTHREADS=$2
shift 2
;;
--)
shift
break
;;
-*)
echo "WARN: Unknown option (ignored): $1" >&2
shift
;;
*)
break
;;
esac
done
BUILDTHREADS=${BUILDTHREADS:-$(grep -c "^processor" /proc/cpuinfo)}
[ ${BUILDTHREADS} -eq 0 ] && BUILDTHREADS=1
[ -z ${VERSION} ] && exit 3
if [ -f ${FFMPEG_PREFIX}/lib/pkgconfig/libavcodec.pc ] && [ -f .ffmpeg-installed ]
then
CURVER=$(cat .ffmpeg-installed)
[ "$VERSION" == "$CURVER" ] && exit 0
fi
[ -f ${ARCHIVE} ] ||
curl -Ls --create-dirs -f -o ${ARCHIVE} ${BASE_URL}/${VERSION}.tar.gz ||
{ echo "error fetching ${BASE_URL}/${VERSION}.tar.gz" ; exit 3; }
[ $downloadonly ] && exit 0
[ -d ffmpeg-${VERSION} ] && rm -rf ffmpeg-${VERSION} && rm .ffmpeg-installed >/dev/null 2>&1
if [ -d ${FFMPEG_PREFIX} ]
then
[ -w ${FFMPEG_PREFIX} ] || SUDO="sudo"
else
[ -w $(dirname ${FFMPEG_PREFIX}) ] || SUDO="sudo"
fi
mkdir -p "ffmpeg-${VERSION}"
cd "ffmpeg-${VERSION}" || exit 2
tar --strip-components=1 -xf $MYDIR/${ARCHIVE}
CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" \
./configure --prefix=$FFMPEG_PREFIX \
--extra-version="kodi-${VERSION}" \
--disable-devices \
--disable-ffplay \
--disable-ffmpeg \
--disable-sdl \
--disable-ffprobe \
--disable-ffserver \
--disable-doc \
--enable-gpl \
--enable-runtime-cpudetect \
--enable-postproc \
--enable-vaapi \
--enable-vdpau \
--enable-bzlib \
--enable-gnutls \
--enable-muxer=spdif \
--enable-muxer=adts \
--enable-muxer=asf \
--enable-muxer=ipod \
--enable-encoder=ac3 \
--enable-encoder=aac \
--enable-encoder=wmav2 \
--enable-protocol=http \
--enable-encoder=png \
--enable-encoder=mjpeg \
--enable-nonfree \
--enable-pthreads \
--enable-pic \
--enable-zlib \
--disable-mipsdsp \
--disable-mipsdspr2 \
${FLAGS}
make -j ${BUILDTHREADS}
if [ $? -eq 0 ]
then
[ ${SUDO} ] && echo "Root privileges are required to install to ${FFMPEG_PREFIX}"
${SUDO} make install && echo "$VERSION" > $MYDIR/.ffmpeg-installed
else
echo "ERROR: Building ffmpeg failed"
exit 1
fi
|