forked from wader/showtime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.osx
executable file
·332 lines (292 loc) · 7.71 KB
/
configure.osx
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
#!/bin/bash
#
# HTS configure script for Mac OS X
#
# Copyright (c) 2009-2010 Mattias Wadman
#
# 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="osx"
OSENV="posix"
DEFAULT_UI="glw"
source support/configure.inc
CPU=generic
ARCH=`uname -m`
PKGCONFIG="/opt/local/bin/pkg-config"
PKGCONFIGDIR="/opt/local/lib/pkgconfig"
MACOSXTARGET=""
MACOSXSDK=""
APPDIR=${BUILDDIR}/Showtime.app
show_help(){
common_help
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 " --macosxsdk=PATH Mac OS X SDK path [$MACOSXSDK]"
echo " --pkg-config=PATH pkg-config path [$PKGCONFIG]"
echo " --pkg-config-dir=PATH pkg-config config dir[$PKGCONFIGDIR]"
echo " --enable-spotify=keyfile Compile support for Spotify (R) Core"
echo " --spotify-framework=PATH Path to libspotify.framework"
exit 1
}
# figure out what archives to link with by modifying output from pkg-config
# this is done because gcc (on at least osx) cant be forced to mix
# dynamic and static libraries using -static and -l
pkg_config_static() {
# assume all packages use the same libdir
libdir=`$PKGCONFIG --variable=libdir $1`
args=""
for arg in `$PKGCONFIG --static --libs $*` ; do
if [ "${arg:0:2}" != "-l" -o -e "/usr/lib/lib${arg:2}.dylib" ] ; then
# pass along non -l or existing dynamic standard libraries
args+="$arg "
else
# pass full path to static archive
args+="${arg/-l/$libdir/lib}.a "
fi
done
echo $args
}
enable libfreetype
enable glw
enable glw_frontend_cocoa
enable glw_backend_opengl
enable coreaudio
enable appleremote
enable bonjour
enable spotlight
enable spidermonkey
enable stdin
enable httpserver
enable timegm
enable realpath
enable polarssl
enable librtmp
enable font_liberation
for opt do
optval="${opt#*=}"
case "$opt" in
--prefix=*) PREFIX="$optval"
;;
--cpu=*) CPU="$optval"
;;
--help) show_help
;;
--release)
enable release
enable embedded_resources
;;
--cc=*) CC="$optval"
;;
--arch=*) ARCH="$optval"
;;
--macosx-sdk=*) MACOSXSDK="$optval"
;;
--pkg-config=*) PKGCONFIG="$optval"
;;
--pkg-config-dir=*) PKGCONFIGDIR="$optval"
;;
--enable-spotify=*) SPOTIFY_KEYFILE="$optval"
;;
--spotify-framework=*) SPOTIFY_FRAMEWORK="$optval"
;;
*)
common_opt $opt $optval
esac
done
if [ "$SPOTIFY_KEYFILE" != "" ] ; then
if [ ! -f "$SPOTIFY_KEYFILE" ] ; then
echo "$SPOTIFY_KEYFILE does not exist"
die
fi
if [ "$SPOTIFY_FRAMEWORK" = "" ] ; then
echo "You must specify where the libspotify.framework directory can be found."
echo "Use the --spotify-framework argument"
die
fi
if [ ! -d "$SPOTIFY_FRAMEWORK" ] ; then
echo "$SPOTIFY_FRAMEWORK does not exist"
die
fi
fi
setup_env "$@"
enable libpthread
enable zlib
enable posix_networking
enable dvd
#
# Application bundle
# Override PROG to put binary inside app bundle
#
echo >>${CONFIG_MAK} "APPDIR=${APPDIR}"
PROG="${APPDIR}/Contents/MacOS/showtime"
#
# 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="$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
#
# Check SDK path and set target version
#
if [ "x$MACOSXSDK" != "x" ] ; then
if [ -d "$MACOSXSDK" ] ; then
SDKSETTINGS="$MACOSXSDK/SDKSettings"
if [ ! -e "$SDKSETTINGS.plist" ] ; then
echo "Could not find $SDKSETTINGS.plist"
die
fi
MACOSXTARGET=`defaults read $SDKSETTINGS Version`
echo "Mac OS X SDK: $MACOSXSDK"
echo "Mac OS X target: $MACOSXTARGET"
else
echo "Mac OS X SDK directory $MACOSXSDK does not exist"
die
fi
MACOSXSDK_CFLAGS="-mmacosx-version-min=$MACOSXTARGET -isysroot $MACOSXSDK"
MACOSXSDK_LDFLAGS="$MACOSXSDK_CFLAGS"
echo >>${CONFIG_MAK} "LDFLAGS_cfg += $MACOSXSDK_LDFLAGS"
echo >>${CONFIG_MAK} "CFLAGS_cfg += $MACOSXSDK_CFLAGS"
else
echo "Mac OS X SDK: default"
echo "Mac OS X target: default (`sw_vers -productVersion`)"
fi
#
# Standard Mac OS X frameworks
#
echo >>${CONFIG_MAK} "LDFLAGS_cfg += -framework Foundation"
echo >>${CONFIG_MAK} "LDFLAGS_cfg += -framework CoreFoundation"
echo >>${CONFIG_MAK} "LDFLAGS_cfg += -framework Cocoa"
# IOKit for dvd
echo >>${CONFIG_MAK} "LDFLAGS_cfg += -framework IOKit"
echo >>${CONFIG_MAK} "LDFLAGS_cfg += -framework OpenGL"
# CoreAudio
if enabled coreaudio; then
echo >>${CONFIG_MAK} "LDFLAGS_cfg += -framework CoreAudio"
fi
# Carbon, Remote Control Wrapper uses it
if enabled appleremote; then
echo >>${CONFIG_MAK} "LDFLAGS_cfg += -framework Carbon"
fi
#
# pkg-config, set LIBDIR to makes pkg-config only search that path
#
if [ ! -x "$PKGCONFIG" ] ; then
echo "$PKGCONFIG does not exist or is not executable, make sure it is installed"
echo "You can also specify another path with --pkg-config"
die
fi
if [ ! -d "$PKGCONFIGDIR" ] ; then
echo "$PKGCONFIGDIR does not exist, make sure pkg-config is installed"
echo "You can also specify another directory with --pkg-config-dir"
die
fi
export PKG_CONFIG_LIBDIR=$PKGCONFIGDIR
PKGS=""
#
# libavformat
#
if pkg-config --atleast-version 53.0.0 libavformat; then
PKGS+="libavformat "
echo "Using libavformat: `pkg-config --modversion libavformat`"
else
echo "libavformat 53.0.0 or newer not found."
die
fi
#
# libavcodec
#
if pkg-config --atleast-version 53.0.0 libavcodec; then
PKGS+="libavcodec "
echo "Using libavcodec: `pkg-config --modversion libavcodec`"
else
echo "libavcodec 53.0.0 or newer not found."
die
fi
#
# libavutil
#
if pkg-config --atleast-version 51.0.0 libavutil; then
PKGS+="libavutil "
echo "Using libavutil: `pkg-config --modversion libavutil`"
else
echo "libavutil 51.0.0 or newer not found."
die
fi
#
# libswscale
#
if pkg-config --atleast-version 0.11.0 libswscale; then
PKGS+="libswscale "
echo "Using libswscale: `pkg-config --modversion libswscale`"
else
echo "libswscale 0.11.0 or newer not found."
die
fi
#
# libfreetype2
#
if $PKGCONFIG freetype2; then
PKGS+="freetype2 "
echo "Using Freetype2: `$PKGCONFIG --modversion freetype2`"
else
echo "FreeType 2 not found"
die
fi
echo >>${CONFIG_MAK} "LDFLAGS_cfg += " `pkg_config_static $PKGS`
echo >>${CONFIG_MAK} "CFLAGS_cfg +=" `$PKGCONFIG --cflags $PKGS`
#
# Configure paths, etc
#
if disabled release; then
echo Development build.
echo The generated binary will contain compiled-in paths to
echo the current build tree. If you plan to install the binary,
echo please reconfigure with '--release'.
fi
#
# Some compatibility defines
#
cat >> ${CONFIG_H} << EOF
/* Darwin is default 64 bit */
#define off64_t off_t
#define lseek64 lseek
/* Different name on darwin */
#define MAP_ANONYMOUS MAP_ANON
/* dvdcss, not defined on darwin is default large file and binary */
#define O_LARGEFILE 0
#define O_BINARY 0
EOF
if [ "$SPOTIFY_FRAMEWORK" != "" ] ; then
echo >>${CONFIG_MAK} "SPOTIFY_FRAMEWORK = ${SPOTIFY_FRAMEWORK}"
echo >>${CONFIG_MAK} "LDFLAGS_cfg += -F\$(shell dirname \$(SPOTIFY_FRAMEWORK)) -framework libspotify"
fi
#
# Finalize
#
echo >>${CONFIG_MAK} LDFLAGS_cfg += -lpthread
finalize