forked from andoma/movian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·253 lines (208 loc) · 5.19 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
#!/bin/bash
#
# HTS configure script
#
# Copyright (c) 2005-2009 Andreas Öman
#
# Based on FFmpeg's configure script:
#
# Copyright (c) 2000-2002 Fabrice Bellard
# Copyright (c) 2005-2008 Diego Biurrun
# Copyright (c) 2005-2008 Mans Rullgard
#
PLATFORM=`uname`.`uname -m`
source configure.inc
CPU=generic
ARCH=`uname -m`
RELEASE=no
PREFIX=/usr/local
DONT_SKIP_MISSING=0
EMBEDDED_THEME=none
show_help(){
echo "Usage: configure [options]"
echo "Options: [defaults in brackets after descriptions]"
echo
echo "Standard options:"
echo " --help print this message"
echo " --prefix=PREFIX install in PREFIX [$PREFIX]"
echo " --arch=arch Build for this architecture [$ARCH]"
echo " --cpu=cpu Build and optimize for specific CPU"
echo " --cc=CC Build using the given compiler"
echo " --release Stage for release"
echo " --embedded-theme Embed theme in showtime [none]"
exit 1
}
die() {
rm -rf $TMPDIR
exit
}
for opt do
optval="${opt#*=}"
case "$opt" in
--prefix=*) PREFIX="$optval"
;;
--cpu=*) CPU="$optval"
;;
--help) show_help
;;
--release) RELEASE=yes;
;;
--cc=*) CC="$optval"
;;
--embedded-theme=*)
EMBEDDED_THEME_PATH=`cd $optval && pwd`;
enable embedded_theme
;;
esac
done
setup_env
enable libpthread
enable zlib
enable posix_networking
#enable dvdnav
#
# pkgconfig
#
which >/dev/null pkg-config
if [ $? -ne 0 ]; then
echo "pkg-config not found. Can not configure."
die
fi
#
# c compiler
#
checkcc() {
cat >$TMPDIR/1.c <<EOF
int main() {
return 0;
}
EOF
$CC 2>/dev/null $TMPDIR/1.c -o $TMPDIR/1.bin
}
if [ "x$CC" != "x" ]; then
echo >${CONFIG_MAK} "CC=$CC"
CC_FFMPEG="--cc=$CC"
else
CC=cc
fi
if checkcc; then
echo "Using C compiler: $CC"
else
echo "C compiler ($CC) is not working"
die
fi
echo >>${CONFIG_MAK} $CC_CONFIG_MAK
#
# configure ffmpeg
#
echo
echo Configuring external lib: ffmpeg
(mkdir -p ${BUILDDIR}/ffmpeg && cd ${BUILDDIR}/ffmpeg && ${TOPDIR}/../ext/ffmpeg/configure \
$CC_FFMPEG \
--enable-gpl \
--cpu=${CPU} \
--disable-encoders \
--disable-muxers \
--disable-devices \
--disable-protocols \
--disable-stripping \
--disable-static \
--disable-shared \
--enable-static \
--enable-pthreads \
--prefix=${DESTDIR} \
--disable-ffserver \
)
cd ${TOPDIR}
#
# libfreetype2
#
if pkg-config freetype2; then
enable libfreetype
echo >>${CONFIG_MAK} "LDFLAGS_EXT += " `pkg-config --libs freetype2`
echo >>${CONFIG_MAK} "CFLAGS_EXT += " `pkg-config --cflags freetype2`
elif test $DONT_SKIP_MISSING -eq 0; then
echo "FreeType 2 not found."
die
fi
#
# opengl for GLW (depends on freetype)
#
checkglx() {
cat >$TMPDIR/1.c <<EOF
#include <GL/glx.h>
int main() {
return 0;
}
EOF
$CC 2>/dev/null $TMPDIR/1.c -o $TMPDIR/1.bin -lGLU -lGL
}
if enabled libfreetype && checkglx; then
enable glw
enable glw_frontend_x11
enable glw_backend_opengl
echo >>${CONFIG_MAK} "LDFLAGS_EXT += -lGLU -lGL"
elif test $DONT_SKIP_MISSING -eq 0; then
echo "OpenGL development files not available. Can not build test program."
die
fi
#
# libasound (alsa)
#
if pkg-config alsa; then
enable libasound
echo >>${CONFIG_MAK} "CFLAGS_EXT += " `pkg-config --cflags alsa`
echo >>${CONFIG_MAK} "LDFLAGS_EXT += " `pkg-config --libs alsa`
elif test $DONT_SKIP_MISSING -eq 0; then
echo "libasound (ALSA) development files not found."
die
fi
#
# libexif, JPEG exif
#
if pkg-config libexif; then
enable libexif
echo >>${CONFIG_MAK} "CFLAGS_EXT += " `pkg-config --cflags libexif`
echo >>${CONFIG_MAK} "LDFLAGS_EXT += " `pkg-config --libs libexif`
elif test $DONT_SKIP_MISSING -eq 0; then
echo "libexif (JPEG library) development files not found."
die
fi
#
# configure local components
#
echo Local libs are built ${LIB_BUILD_MODE}
if [ ${RELEASE} = yes ]; then
echo Release build: ${RELEASENAME}
echo
echo The generated binaries will contained compild-in paths to
echo ${PREFIX}/share/hts where parts of the sw will be installed.
echo You must '"make install"' for HTS to function properly.
else
echo Development build.
echo
echo The generated binaries will contained compild-in paths to
echo the current build tree. If you plan to install the binaries,
echo please reconfigure with '--release'.
fi
if [ ${RELEASE} = yes ]; then
echo >>${CONFIG_H} "#define HTS_RELEASE_TAG \"${RELEASENAME}\""
echo >>${CONFIG_H} "#define HTS_INSTALL_PREFIX \"${PREFIX}\""
fi
if enabled embedded_theme; then
THEMEPATH="zip://embedded://theme|"
elif [ ${RELEASE} = yes ]; then
THEMEPATH="file://${PREFIX}/share/hts/themes/${DEFAULT_THEME}"
else
THEMEPATH="file://${TOPDIR}/showtime/themes/${DEFAULT_THEME}"
fi
echo >>${CONFIG_H} "#define SHOWTIME_DEFAULT_THEME_PATH \"${THEMEPATH}\""
cat >> ${CONFIG_MAK} << EOF
INSTALLPREFIX=$PREFIX
ARCHITECTURE=posix
CFLAGS_EXT += -I${BUILDDIR}/destdir/include
LDFLAGS_EXT += -L${BUILDDIR}/destdir/lib -lswscale -lavformat -lavcodec -lavutil
LDFLAGS_EXT += -lm -lz -lpthread
EOF
print_config CONFIG_ ${CONFIG_H} ${CONFIG_MAK} $CONFIG_LIST
die