Skip to content

Commit 6f9958a

Browse files
committed
add luajit compile scripts
1 parent f34860f commit 6f9958a

File tree

5 files changed

+224
-4
lines changed

5 files changed

+224
-4
lines changed

build/ios/build_luajit.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
current_dir=`pwd`
2+
library_name=luajit
3+
./build_without_config.sh -l $library_name
4+
top_dir=$current_dir/../..
5+
6+
cd $current_dir
7+
mkdir -p $library_name/prebuilt/
8+
mkdir -p $library_name/include/
9+
10+
cp $top_dir/contrib/arm-linux-gnueabi-armv7a/lib/lib${library_name}.a $library_name/prebuilt/tizen/arm/
11+
cp $top_dir/contrib/arm-linux-gnueabi-armv7a/include/$library_name*.h $library_name/include/tizen/
12+
13+
echo "cleaning up"
14+
rm -rf $top_dir/contrib/arm-linux-gnueabi-armv7a/
15+
rm -rf $top_dir/contrib/tizen-armv7-a

build/ios/build_png.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
current_dir=`pwd`
2+
library_name=png
3+
./build.sh -l $library_name
4+
top_dir=$current_dir/../..
5+
6+
cd $current_dir
7+
mkdir -p $library_name/prebuilt/
8+
mkdir -p $library_name/include/
9+
10+
cp $top_dir/contrib/arm-linux-gnueabi-armv7a/lib/lib${library_name}.a $library_name/prebuilt/tizen/arm/
11+
cp $top_dir/contrib/arm-linux-gnueabi-armv7a/include/$library_name*.h $library_name/include/tizen/
12+
13+
echo "cleaning up"
14+
rm -rf $top_dir/contrib/arm-linux-gnueabi-armv7a/
15+
rm -rf $top_dir/contrib/tizen-armv7-a

build/ios/build_without_config.sh

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
#!/bin/sh
2+
set -e
3+
set -x
4+
5+
PLATFORM=OS
6+
VERBOSE=no
7+
SDK_VERSION=$(xcodebuild -showsdks | grep iphoneos | sort | tail -n 1 | awk '{print substr($NF,9)}')
8+
# FIXME: why min deploy target can't use 5.1.1
9+
SDK_MIN=6.0
10+
ARCH=armv7
11+
12+
# TODO: configure to compile speficy 3rd party libraries
13+
OPTIONS=""
14+
15+
16+
usage()
17+
{
18+
cat << EOF
19+
usage: $0 [-s] [-k sdk] [-a arch] [-l libname]
20+
21+
OPTIONS
22+
-k <sdk version> Specify which sdk to use ('xcodebuild -showsdks', current: ${SDK_VERSION})
23+
-s Build for simulator
24+
-a <arch> Specify which arch to use (current: ${ARCH})
25+
-l <libname> Specify which static library to build
26+
EOF
27+
}
28+
29+
spushd()
30+
{
31+
pushd "$1" 2>&1> /dev/null
32+
}
33+
34+
spopd()
35+
{
36+
popd 2>&1> /dev/null
37+
}
38+
39+
info()
40+
{
41+
local blue="\033[1;34m"
42+
local normal="\033[0m"
43+
echo "[${blue}info${normal}] $1"
44+
}
45+
46+
47+
while getopts "hvsk:a:l:" OPTION
48+
do
49+
case $OPTION in
50+
h)
51+
usage
52+
exit 1
53+
;;
54+
v)
55+
VERBOSE=yes
56+
;;
57+
s)
58+
PLATFORM=Simulator
59+
;;
60+
k)
61+
SDK_VERSION=$OPTARG
62+
;;
63+
a)
64+
ARCH=$OPTARG
65+
;;
66+
l)
67+
OPTIONS=--enable-$OPTARG
68+
;;
69+
?)
70+
usage
71+
exit 1
72+
;;
73+
esac
74+
done
75+
76+
if test -z "$OPTIONS"
77+
then
78+
echo "You must specify a OPTIONS parameter."
79+
usage
80+
exit 1
81+
fi
82+
83+
shift $(($OPTIND - 1))
84+
85+
86+
if [ "x$1" != "x" ]; then
87+
usage
88+
exit 1
89+
fi
90+
91+
92+
out="/dev/null"
93+
if [ "$VERBOSE" = "yes" ]; then
94+
out="/dev/stdout"
95+
fi
96+
97+
info "Building cocos2d-x third party libraries for iOS"
98+
99+
if [ "$PLATFORM" = "Simulator" ]; then
100+
TARGET="${ARCH}-apple-darwin"
101+
OPTIM="-O3 -g"
102+
else
103+
TARGET="arm-apple-darwin"
104+
OPTIM="-O3 -g"
105+
fi
106+
107+
info "Using ${ARCH} with SDK version ${SDK_VERSION}"
108+
109+
THIS_SCRIPT_PATH=`pwd`
110+
111+
COCOSROOT=`pwd`/../..
112+
113+
if test -z "$SDKROOT"
114+
then
115+
SDKROOT=`xcode-select -print-path`/Platforms/iPhone${PLATFORM}.platform/Developer/SDKs/iPhone${PLATFORM}${SDK_VERSION}.sdk
116+
echo "SDKROOT not specified, assuming $SDKROOT"
117+
fi
118+
119+
if [ ! -d "${SDKROOT}" ]
120+
then
121+
echo "*** ${SDKROOT} does not exist, please install required SDK, or set SDKROOT manually. ***"
122+
exit 1
123+
fi
124+
125+
BUILDDIR="${COCOSROOT}/build-ios-${PLATFORM}/${ARCH}"
126+
127+
PREFIX="${COCOSROOT}/contrib/install-ios-${PLATFORM}/${ARCH}"
128+
129+
export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
130+
131+
132+
info "Building contrib for iOS in '${COCOSROOT}/contrib/iPhone${PLATFORM}-${ARCH}'"
133+
134+
export PLATFORM=$PLATFORM
135+
export SDK_VERSION=$SDK_VERSION
136+
137+
138+
export BUILDFORIOS="yes"
139+
140+
141+
spushd ${COCOSROOT}
142+
143+
echo ${COCOSROOT}
144+
mkdir -p "${COCOSROOT}/contrib/iPhone${PLATFORM}-${ARCH}"
145+
spushd "${COCOSROOT}/contrib/iPhone${PLATFORM}-${ARCH}"
146+
147+
## FIXME: do we need to replace Apple's gas?
148+
if [ "$PLATFORM" = "OS" ]; then
149+
export AS="gas-preprocessor.pl ${CC}"
150+
export ASCPP="gas-preprocessor.pl ${CC}"
151+
export CCAS="gas-preprocessor.pl ${CC}"
152+
if [ "$ARCH" = "arm64" ]; then
153+
export GASPP_FIX_XCODE5=1
154+
fi
155+
else
156+
export ASCPP="xcrun as"
157+
fi
158+
159+
160+
../bootstrap ${OPTIONS} \
161+
--build=x86_64-apple-darwin14 \
162+
--host=${TARGET} \
163+
--prefix=${PREFIX} > ${out}
164+
165+
echo "EXTRA_CFLAGS += ${EXTRA_CFLAGS}" >> config.mak
166+
echo "EXTRA_LDFLAGS += ${EXTRA_LDFLAGS}" >> config.mak
167+
echo "IOS_ARCH := ${ARCH}" >> config.mak
168+
make fetch
169+
make list
170+
make
171+
spopd

contrib/bootstrap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ check_ios_sdk()
143143
exit 1
144144
fi
145145
add_make "IOS_SDK=${SDKROOT}"
146+
add_make "IOS_TOOLCHAIN=${SDKROOT}/../../usr/bin/"
146147
}
147148

148149
check_macosx_sdk()

contrib/src/luajit/rules.mak

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,31 @@ luajit: luajit-$(LUAJIT_VERSION).tar.gz .sum-luajit
1212
$(UNPACK)
1313
$(MOVE)
1414

15+
ifeq ($(IOS_ARCH),armv7)
16+
LUAJIT_TARGET_FLAGS="-arch armv7 -isysroot $(IOS_SDK)"
17+
LUAJIT_HOST_CC="gcc -m32 -arch i386"
18+
endif
1519

16-
ifdef HAVE_MACOSX
17-
config_var="gcc -m64 -O3 -DNDEBUG -arch x86_64"
20+
ifeq ($(IOS_ARCH),armv7s)
21+
LUAJIT_TARGET_FLAGS="-arch armv7s -isysroot $(IOS_SDK)"
22+
LUAJIT_HOST_CC="gcc -m32 -arch i386"
1823
endif
1924

25+
2026
.luajit: luajit
21-
cd $< && perl -i -pe "s|/usr/local|$(PREFIX)|g" Makefile
27+
ifdef HAVE_MACOSX
2228
cd $< && $(MAKE) HOST_CC="$(CC)" HOST_CFLAGS="$(CFLAGS)"
23-
cd $< && $(MAKE) install
29+
endif
30+
ifdef HAVE_IOS
31+
ifeq ($(IOS_ARCH),armv7)
32+
cd $< && make HOST_CC=$(LUAJIT_HOST_CC) TARGET_FLAGS=$(LUAJIT_TARGET_FLAGS) TARGET=arm TARGET_SYS=iOS
33+
endif
34+
ifeq ($(IOS_ARCH),armv7s)
35+
cd $< && make HOST_CC=$(LUAJIT_HOST_CC) TARGET_FLAGS=$(LUAJIT_TARGET_FLAGS) TARGET=arm TARGET_SYS=iOS
36+
endif
37+
ifeq ($(IOS_ARCH),i386)
38+
cd $< && make CC="gcc -m32 -arch i386"
39+
endif
40+
endif
41+
cd $< && make install PREFIX=$(PREFIX)
2442
touch $@

0 commit comments

Comments
 (0)