Skip to content

Commit a38834c

Browse files
committed
modify scripts
1 parent 9060a3f commit a38834c

File tree

3 files changed

+150
-175
lines changed

3 files changed

+150
-175
lines changed

build_ios.sh

Lines changed: 150 additions & 175 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ set -e
33

44
PLATFORM=OS
55
VERBOSE=no
6-
SDK_VERSION=7.0
7-
SDK_MIN=5.1
6+
SDK_VERSION=8.1
7+
SDK_MIN=5.1.1
88
ARCH=armv7
99

1010
usage()
@@ -36,193 +36,168 @@ info()
3636
echo "[${blue}info${normal}] $1"
3737
}
3838

39-
info "Hello World"
40-
41-
# while getopts "hvsk:a:" OPTION
42-
# do
43-
# case $OPTION in
44-
# h)
45-
# usage
46-
# exit 1
47-
# ;;
48-
# v)
49-
# VERBOSE=yes
50-
# ;;
51-
# s)
52-
# PLATFORM=Simulator
53-
# ;;
54-
# k)
55-
# SDK_VERSION=$OPTARG
56-
# ;;
57-
# a)
58-
# ARCH=$OPTARG
59-
# ;;
60-
# ?)
61-
# usage
62-
# exit 1
63-
# ;;
64-
# esac
65-
# done
66-
# shift $(($OPTIND - 1))
67-
68-
# if [ "x$1" != "x" ]; then
69-
# usage
70-
# exit 1
71-
# fi
72-
73-
# out="/dev/null"
74-
# if [ "$VERBOSE" = "yes" ]; then
75-
# out="/dev/stdout"
76-
# fi
77-
78-
# info "Building libvlc for iOS"
79-
80-
# if [ "$PLATFORM" = "Simulator" ]; then
81-
# TARGET="${ARCH}-apple-darwin11"
82-
# OPTIM="-O3 -g"
83-
# else
84-
# TARGET="arm-apple-darwin11"
85-
# OPTIM="-O3 -g"
86-
# fi
87-
88-
# info "Using ${ARCH} with SDK version ${SDK_VERSION}"
8939

90-
# THIS_SCRIPT_PATH=`pwd`/$0
40+
while getopts "hvsk:a:" OPTION
41+
do
42+
case $OPTION in
43+
h)
44+
usage
45+
exit 1
46+
;;
47+
v)
48+
VERBOSE=yes
49+
;;
50+
s)
51+
PLATFORM=Simulator
52+
;;
53+
k)
54+
SDK_VERSION=$OPTARG
55+
;;
56+
a)
57+
ARCH=$OPTARG
58+
;;
59+
?)
60+
usage
61+
exit 1
62+
;;
63+
esac
64+
done
65+
66+
shift $(($OPTIND - 1))
67+
68+
69+
if [ "x$1" != "x" ]; then
70+
usage
71+
exit 1
72+
fi
73+
74+
75+
out="/dev/null"
76+
if [ "$VERBOSE" = "yes" ]; then
77+
out="/dev/stdout"
78+
fi
79+
80+
info "Building cocos2d-x third party libraries for iOS"
81+
82+
if [ "$PLATFORM" = "Simulator" ]; then
83+
TARGET="${ARCH}-apple-darwin14"
84+
OPTIM="-O3 -g"
85+
else
86+
TARGET="arm-apple-darwin14"
87+
OPTIM="-O3 -g"
88+
fi
89+
90+
info "Using ${ARCH} with SDK version ${SDK_VERSION}"
91+
92+
THIS_SCRIPT_PATH=`pwd`/$0
9193

9294
# spushd `dirname ${THIS_SCRIPT_PATH}`/../../..
93-
# VLCROOT=`pwd` # Let's make sure VLCROOT is an absolute path
95+
COCOSROOT=`pwd` # Let's make sure COCOSROOT is an absolute path
9496
# spopd
9597

96-
# if test -z "$SDKROOT"
97-
# then
98-
# SDKROOT=`xcode-select -print-path`/Platforms/iPhone${PLATFORM}.platform/Developer/SDKs/iPhone${PLATFORM}${SDK_VERSION}.sdk
99-
# echo "SDKROOT not specified, assuming $SDKROOT"
100-
# fi
98+
if test -z "$SDKROOT"
99+
then
100+
SDKROOT=`xcode-select -print-path`/Platforms/iPhone${PLATFORM}.platform/Developer/SDKs/iPhone${PLATFORM}${SDK_VERSION}.sdk
101+
echo "SDKROOT not specified, assuming $SDKROOT"
102+
fi
101103

102-
# if [ ! -d "${SDKROOT}" ]
103-
# then
104-
# echo "*** ${SDKROOT} does not exist, please install required SDK, or set SDKROOT manually. ***"
105-
# exit 1
106-
# fi
104+
if [ ! -d "${SDKROOT}" ]
105+
then
106+
echo "*** ${SDKROOT} does not exist, please install required SDK, or set SDKROOT manually. ***"
107+
exit 1
108+
fi
107109

108-
# BUILDDIR="${VLCROOT}/build-ios-${PLATFORM}/${ARCH}"
110+
BUILDDIR="${COCOSROOT}/build-ios-${PLATFORM}/${ARCH}"
109111

110-
# PREFIX="${VLCROOT}/install-ios-${PLATFORM}/${ARCH}"
112+
PREFIX="${COCOSROOT}/install-ios-${PLATFORM}/${ARCH}"
111113

112-
# export PATH="${VLCROOT}/extras/tools/build/bin:${VLCROOT}/contrib/${TARGET}/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
114+
export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
113115

114116
# info "Building tools"
115-
# spushd "${VLCROOT}/extras/tools"
117+
# spushd "${COCOSROOT}/contrib/ios"
116118
# ./bootstrap
117-
# make && make .gas
119+
# make
118120
# spopd
119121

120-
# info "Building contrib for iOS in '${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}'"
121-
122-
# # The contrib will read the following
123-
# export AR="xcrun ar"
124-
125-
# export RANLIB="xcrun ranlib"
126-
# export CC="xcrun clang"
127-
# export OBJC="xcrun clang"
128-
# export CXX="xcrun clang++"
129-
# export LD="xcrun ld"
130-
# export STRIP="xcrun strip"
131-
132-
# export PLATFORM=$PLATFORM
133-
# export SDK_VERSION=$SDK_VERSION
134-
135-
# if [ "$PLATFORM" = "OS" ]; then
136-
# export CFLAGS="-isysroot ${SDKROOT} -arch ${ARCH} -miphoneos-version-min=${SDK_MIN} ${OPTIM}"
137-
# if [ "$ARCH" != "arm64" ]; then
138-
# export CFLAGS="${CFLAGS} -mcpu=cortex-a8"
139-
# fi
140-
# else
141-
# export CFLAGS="-isysroot ${SDKROOT} -arch ${ARCH} -miphoneos-version-min=${SDK_MIN} ${OPTIM}"
142-
# fi
143-
144-
# export CPP="xcrun cc -E"
145-
# export CXXCPP="xcrun c++ -E"
146-
147-
# export BUILDFORIOS="yes"
148-
149-
# if [ "$PLATFORM" = "Simulator" ]; then
150-
# # Use the new ABI on simulator, else we can't build
151-
# export OBJCFLAGS="-fobjc-abi-version=2 -fobjc-legacy-dispatch ${OBJCFLAGS}"
152-
# fi
153-
154-
# export LDFLAGS="-L${SDKROOT}/usr/lib -arch ${ARCH} -isysroot ${SDKROOT} -miphoneos-version-min=${SDK_MIN}"
155-
156-
# if [ "$PLATFORM" = "OS" ]; then
157-
# EXTRA_CFLAGS="-arch ${ARCH}"
158-
# if [ "$ARCH" != "arm64" ]; then
159-
# EXTRA_CFLAGS+=" -mcpu=cortex-a8"
160-
# fi
161-
# EXTRA_LDFLAGS="-arch ${ARCH}"
162-
# else
163-
# EXTRA_CFLAGS="-arch ${ARCH}"
164-
# EXTRA_LDFLAGS="-arch ${ARCH}"
165-
# fi
166-
167-
# EXTRA_CFLAGS+=" -miphoneos-version-min=${SDK_MIN}"
168-
# EXTRA_LDFLAGS+=" -miphoneos-version-min=${SDK_MIN}"
169-
170-
# info "LD FLAGS SELECTED = '${LDFLAGS}'"
171-
172-
# spushd ${VLCROOT}/contrib
173-
174-
# echo ${VLCROOT}
175-
# mkdir -p "${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}"
176-
# cd "${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}"
177-
178-
# if [ "$PLATFORM" = "OS" ]; then
179-
# export AS="gas-preprocessor.pl ${CC}"
180-
# export ASCPP="gas-preprocessor.pl ${CC}"
181-
# export CCAS="gas-preprocessor.pl ${CC}"
182-
# if [ "$ARCH" = "arm64" ]; then
183-
# export GASPP_FIX_XCODE5=1
184-
# fi
185-
# else
186-
# export ASCPP="xcrun as"
187-
# fi
188-
189-
# ../bootstrap --build=x86_64-apple-darwin11 --host=${TARGET} --prefix=${VLCROOT}/contrib/${TARGET}-${ARCH} --disable-gpl \
190-
# --disable-disc --disable-sout \
191-
# --disable-sdl \
192-
# --disable-SDL_image \
193-
# --disable-iconv \
194-
# --enable-zvbi \
195-
# --disable-kate \
196-
# --disable-caca \
197-
# --disable-gettext \
198-
# --disable-mpcdec \
199-
# --disable-upnp \
200-
# --disable-gme \
201-
# --disable-tremor \
202-
# --enable-vorbis \
203-
# --disable-sidplay2 \
204-
# --disable-samplerate \
205-
# --disable-goom \
206-
# --disable-vncserver \
207-
# --disable-orc \
208-
# --disable-schroedinger \
209-
# --disable-libmpeg2 \
210-
# --disable-chromaprint \
211-
# --disable-mad \
212-
# --enable-fribidi \
213-
# --enable-libxml2 \
214-
# --enable-freetype2 \
215-
# --enable-ass \
216-
# --disable-fontconfig \
217-
# --disable-gpg-error \
218-
# --disable-lua \
219-
# --enable-taglib > ${out}
220-
221-
# echo "EXTRA_CFLAGS += ${EXTRA_CFLAGS}" >> config.mak
222-
# echo "EXTRA_LDFLAGS += ${EXTRA_LDFLAGS}" >> config.mak
223-
# make fetch
224-
# make
225-
# spopd
122+
info "Building contrib for iOS in '${COCOSROOT}/contrib/iPhone${PLATFORM}-${ARCH}'"
123+
124+
# The contrib will read the following
125+
export AR="xcrun ar"
126+
127+
export RANLIB="xcrun ranlib"
128+
export CC="xcrun clang"
129+
export OBJC="xcrun clang"
130+
export CXX="xcrun clang++"
131+
export LD="xcrun ld"
132+
export STRIP="xcrun strip"
133+
134+
export PLATFORM=$PLATFORM
135+
export SDK_VERSION=$SDK_VERSION
136+
137+
if [ "$PLATFORM" = "OS" ]; then
138+
export CFLAGS="-isysroot ${SDKROOT} -arch ${ARCH} -miphoneos-version-min=${SDK_MIN} ${OPTIM}"
139+
if [ "$ARCH" != "arm64" ]; then
140+
export CFLAGS="${CFLAGS} -mcpu=cortex-a8"
141+
fi
142+
else
143+
export CFLAGS="-isysroot ${SDKROOT} -arch ${ARCH} -miphoneos-version-min=${SDK_MIN} ${OPTIM}"
144+
fi
145+
146+
export CPP="xcrun cc -E"
147+
export CXXCPP="xcrun c++ -E"
148+
149+
export BUILDFORIOS="yes"
150+
151+
if [ "$PLATFORM" = "Simulator" ]; then
152+
# Use the new ABI on simulator, else we can't build
153+
export OBJCFLAGS="-fobjc-abi-version=2 -fobjc-legacy-dispatch ${OBJCFLAGS}"
154+
fi
155+
156+
export LDFLAGS="-L${SDKROOT}/usr/lib -arch ${ARCH} -isysroot ${SDKROOT} -miphoneos-version-min=${SDK_MIN}"
157+
158+
if [ "$PLATFORM" = "OS" ]; then
159+
EXTRA_CFLAGS="-arch ${ARCH}"
160+
if [ "$ARCH" != "arm64" ]; then
161+
EXTRA_CFLAGS+=" -mcpu=cortex-a8"
162+
fi
163+
EXTRA_LDFLAGS="-arch ${ARCH}"
164+
else
165+
EXTRA_CFLAGS="-arch ${ARCH}"
166+
EXTRA_LDFLAGS="-arch ${ARCH}"
167+
fi
168+
169+
EXTRA_CFLAGS+=" -miphoneos-version-min=${SDK_MIN}"
170+
EXTRA_LDFLAGS+=" -miphoneos-version-min=${SDK_MIN}"
171+
172+
info "LD FLAGS SELECTED = '${LDFLAGS}'"
173+
174+
spushd ${COCOSROOT}
175+
176+
echo ${COCOSROOT}
177+
mkdir -p "${COCOSROOT}/contrib/iPhone${PLATFORM}-${ARCH}"
178+
cd "${COCOSROOT}/contrib/iPhone${PLATFORM}-${ARCH}"
179+
180+
## FIXME: do we need to replace Apple's gas?
181+
if [ "$PLATFORM" = "OS" ]; then
182+
# export AS="gas-preprocessor.pl ${CC}"
183+
# export ASCPP="gas-preprocessor.pl ${CC}"
184+
# export CCAS="gas-preprocessor.pl ${CC}"
185+
if [ "$ARCH" = "arm64" ]; then
186+
export GASPP_FIX_XCODE5=1
187+
fi
188+
else
189+
export ASCPP="xcrun as"
190+
fi
191+
192+
../bootstrap --build=x86_64-apple-darwin14 --host=${TARGET} --prefix=${COCOSROOT}/contrib/${TARGET}-${ARCH} \
193+
--disable-lua \
194+
--enable-png > ${out}
195+
196+
echo "EXTRA_CFLAGS += ${EXTRA_CFLAGS}" >> config.mak
197+
echo "EXTRA_LDFLAGS += ${EXTRA_LDFLAGS}" >> config.mak
198+
make fetch
199+
make
200+
spopd
226201

227202
# info "Bootstraping vlc"
228203
# pwd

contrib/src/change_prefix.sh

100644100755
File mode changed.

contrib/src/pkg-static.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)