Skip to content

Commit feba73c

Browse files
Merge pull request #4 from martell/master
Initial Import of scripts to build depends for all platforms
2 parents 9d61094 + e35a3e6 commit feba73c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+3427
-0
lines changed

contrib/bootstrap

Lines changed: 302 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,302 @@
1+
#! /bin/sh
2+
# Copyright (C) 2003-2011 the VideoLAN team
3+
#
4+
# This program is free software; you can redistribute it and/or modify
5+
# it under the terms of the GNU General Public License as published by
6+
# the Free Software Foundation; either version 2 of the License, or
7+
# (at your option) any later version.
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program; if not, write to the Free Software
16+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
17+
18+
#
19+
# Command line handling
20+
#
21+
usage()
22+
{
23+
echo "Usage: $0 [--build=BUILD] [--host=HOST] [--prefix=PREFIX]"
24+
echo " --build=BUILD configure for building on BUILD"
25+
echo " --host=HOST cross-compile to build to run on HOST"
26+
echo " --prefix=PREFIX install files in PREFIX"
27+
echo " --disable-FOO configure to not build package FOO"
28+
echo " --enable-FOO configure to build package FOO"
29+
echo " --disable-disc configure to not build optical discs packages"
30+
echo " --disable-net configure to not build networking packages"
31+
echo " --disable-sout configure to not build stream output packages"
32+
echo " --enable-small optimize libraries for size with slight speed decrease [DANGEROUS]"
33+
echo " --disable-gpl configure to not build viral GPL code"
34+
}
35+
36+
BUILD=
37+
HOST=
38+
PREFIX=
39+
PKGS_ENABLE=
40+
PKGS_DISABLE=
41+
BUILD_ENCODERS="1"
42+
BUILD_NETWORK="1"
43+
BUILD_DISCS="1"
44+
GPL="1"
45+
46+
if test ! -f "../../contrib/src/main.mak"
47+
then
48+
echo "$0 must be run from a subdirectory"
49+
exit 1
50+
fi
51+
52+
while test -n "$1"
53+
do
54+
case "$1" in
55+
--build=*)
56+
BUILD="${1#--build=}"
57+
;;
58+
--help|-h)
59+
usage
60+
exit 0
61+
;;
62+
--host=*)
63+
HOST="${1#--host=}"
64+
;;
65+
--prefix=*)
66+
PREFIX="${1#--prefix=}"
67+
;;
68+
--disable-disc)
69+
BUILD_DISCS=
70+
;;
71+
--disable-net)
72+
BUILD_NETWORK=
73+
;;
74+
--disable-sout)
75+
BUILD_ENCODERS=
76+
;;
77+
--enable-small)
78+
ENABLE_SMALL=1
79+
;;
80+
--disable-gpl)
81+
GPL=
82+
;;
83+
--disable-*)
84+
PKGS_DISABLE="${PKGS_DISABLE} ${1#--disable-}"
85+
;;
86+
--enable-*)
87+
PKGS_ENABLE="${PKGS_ENABLE} ${1#--enable-}"
88+
;;
89+
*)
90+
echo "Unrecognized options $1"
91+
usage
92+
exit 1
93+
;;
94+
esac
95+
shift
96+
done
97+
98+
if test -z "$BUILD"
99+
then
100+
echo -n "Guessing build system... "
101+
BUILD="`${CC:-cc} -dumpmachine`"
102+
if test -z "$BUILD"; then
103+
echo "FAIL!"
104+
exit 1
105+
fi
106+
echo "$BUILD"
107+
fi
108+
109+
if test -z "$HOST"
110+
then
111+
echo -n "Guessing host system... "
112+
HOST="$BUILD"
113+
echo "$HOST"
114+
fi
115+
116+
if test "$PREFIX"
117+
then
118+
# strip trailing slash
119+
PREFIX="${PREFIX%/}"
120+
fi
121+
122+
#
123+
# Prepare files
124+
#
125+
echo "Creating configuration file... config.mak"
126+
exec 3>config.mak || exit $?
127+
cat >&3 << EOF
128+
# This file was automatically generated.
129+
# Any change will be overwritten if ../bootstrap is run again.
130+
BUILD := $BUILD
131+
HOST := $HOST
132+
PKGS_DISABLE := $PKGS_DISABLE
133+
PKGS_ENABLE := $PKGS_ENABLE
134+
EOF
135+
136+
add_make()
137+
{
138+
while test -n "$1"
139+
do
140+
echo "$1" >&3
141+
shift
142+
done
143+
}
144+
145+
add_make_enabled()
146+
{
147+
while test -n "$1"
148+
do
149+
add_make "$1 := 1"
150+
shift
151+
done
152+
}
153+
154+
check_ios_sdk()
155+
{
156+
if test -z "$SDKROOT"
157+
then
158+
SDKROOT=`xcode-select -print-path`/Platforms/iPhone${PLATFORM}.platform/Developer/SDKs/iPhone${PLATFORM}${SDK_VERSION}.sdk
159+
echo "SDKROOT not specified, assuming $SDKROOT"
160+
else
161+
SDKROOT="$SDKROOT"
162+
fi
163+
164+
if [ ! -d "${SDKROOT}" ]
165+
then
166+
echo "*** ${SDKROOT} does not exist, please install required SDK, or set SDKROOT manually. ***"
167+
exit 1
168+
fi
169+
add_make "IOS_SDK=${SDKROOT}"
170+
}
171+
172+
check_macosx_sdk()
173+
{
174+
if [ -z "${OSX_VERSION}" ]
175+
then
176+
OSX_VERSION=`xcrun --show-sdk-version`
177+
echo "OSX_VERSION not specified, assuming $OSX_VERSION"
178+
fi
179+
if test -z "$SDKROOT"
180+
then
181+
SDKROOT=`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$OSX_VERSION.sdk
182+
echo "SDKROOT not specified, assuming $SDKROOT"
183+
fi
184+
185+
if [ ! -d "${SDKROOT}" ]
186+
then
187+
SDKROOT_NOT_FOUND=`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$OSX_VERSION.sdk
188+
SDKROOT=`xcode-select -print-path`/SDKs/MacOSX$OSX_VERSION.sdk
189+
echo "SDKROOT not found at $SDKROOT_NOT_FOUND, trying $SDKROOT"
190+
fi
191+
if [ ! -d "${SDKROOT}" ]
192+
then
193+
SDKROOT_NOT_FOUND="$SDKROOT"
194+
SDKROOT=`xcrun --show-sdk-path`
195+
echo "SDKROOT not found at $SDKROOT_NOT_FOUND, trying $SDKROOT"
196+
fi
197+
198+
if [ ! -d "${SDKROOT}" ]
199+
then
200+
echo "*** ${SDKROOT} does not exist, please install required SDK, or set SDKROOT manually. ***"
201+
exit 1
202+
fi
203+
204+
add_make "MACOSX_SDK=${SDKROOT}"
205+
add_make "OSX_VERSION ?= ${OSX_VERSION}"
206+
}
207+
208+
check_android_sdk()
209+
{
210+
[ -z "${ANDROID_NDK}" ] && echo "You must set ANDROID_NDK environment variable" && exit 1
211+
add_make "ANDROID_NDK := ${ANDROID_NDK}"
212+
[ -z "${ANDROID_ABI}" ] && echo "You must set ANDROID_ABI environment variable" && exit 1
213+
add_make "ANDROID_ABI := ${ANDROID_ABI}"
214+
[ -z "${ANDROID_API}" ] && echo "You should set ANDROID_API environment variable (using default android-9)" && ANDROID_API := android-9
215+
add_make "ANDROID_API := ${ANDROID_API}"
216+
[ ${ANDROID_ABI} = "armeabi-v7a" ] && add_make_enabled "HAVE_NEON"
217+
[ ${ANDROID_ABI} = "armeabi-v7a" ] && add_make_enabled "HAVE_ARMV7A"
218+
[ ${ANDROID_ABI} = "arm64-v8a" ] && add_make_enabled "HAVE_NEON"
219+
[ ${ANDROID_ABI} = "arm64-v8a" ] && add_make_enabled "HAVE_ARMV8A"
220+
[ ${ANDROID_ABI} = "armeabi" -a -z "${NO_ARMV6}" ] && add_make_enabled "HAVE_ARMV6"
221+
}
222+
223+
test -z "$PREFIX" || add_make "PREFIX := $PREFIX"
224+
test -z "$BUILD_DISCS" || add_make_enabled "BUILD_DISCS"
225+
test -z "$BUILD_ENCODERS" || add_make_enabled "BUILD_ENCODERS"
226+
test -z "$BUILD_NETWORK" || add_make_enabled "BUILD_NETWORK"
227+
test -z "$ENABLE_SMALL" || add_make_enabled "ENABLE_SMALL"
228+
test -z "$GPL" || add_make_enabled "GPL"
229+
230+
#
231+
# Checks
232+
#
233+
OS="${HOST#*-}" # strip architecture
234+
case "${OS}" in
235+
apple-darwin*)
236+
if test -z "$BUILDFORIOS"
237+
then
238+
check_macosx_sdk
239+
add_make_enabled "HAVE_MACOSX" "HAVE_DARWIN_OS" "HAVE_BSD"
240+
else
241+
check_ios_sdk
242+
add_make_enabled "HAVE_IOS" "HAVE_DARWIN_OS" "HAVE_BSD" "HAVE_NEON" "HAVE_ARMV7A"
243+
fi
244+
;;
245+
*bsd*)
246+
add_make_enabled "HAVE_BSD"
247+
;;
248+
*android*)
249+
check_android_sdk
250+
add_make_enabled "HAVE_LINUX" "HAVE_ANDROID"
251+
case "${HOST}" in
252+
*arm*)
253+
add_make "PLATFORM_SHORT_ARCH := arm"
254+
;;
255+
*arm64*)
256+
add_make "PLATFORM_SHORT_ARCH := arm64"
257+
;;
258+
*i686*)
259+
add_make "PLATFORM_SHORT_ARCH := x86"
260+
;;
261+
*x86_64*)
262+
add_make "PLATFORM_SHORT_ARCH := x86_64"
263+
;;
264+
*mipsel*)
265+
add_make "PLATFORM_SHORT_ARCH := mips"
266+
;;
267+
esac
268+
;;
269+
*linux*)
270+
add_make_enabled "HAVE_LINUX"
271+
;;
272+
*mingw*)
273+
add_make_enabled "HAVE_WIN32"
274+
;;
275+
*solaris*)
276+
add_make_enabled "HAVE_SOLARIS"
277+
;;
278+
esac
279+
280+
#
281+
# Results output
282+
#
283+
test -e Makefile && unlink Makefile
284+
ln -sf ../../contrib/src/main.mak Makefile || exit $?
285+
cat << EOF
286+
Bootstrap completed.
287+
288+
Run "make" to start compilation.
289+
290+
Other targets:
291+
* make install same as "make"
292+
* make prebuilt fetch and install prebuilt binaries
293+
* make list list packages
294+
* make fetch fetch required source tarballs
295+
* make fetch-all fetch all source tarballs
296+
* make distclean clean everything and undo bootstrap
297+
* make mostlyclean clean everything except source tarballs
298+
* make clean clean everything
299+
* make package prepare prebuilt packages
300+
EOF
301+
302+
mkdir -p ../../contrib/tarballs || exit $?

0 commit comments

Comments
 (0)