Skip to content

Commit f3291bc

Browse files
author
minggo
committed
Merge pull request #8 from andyque/testScripts
More improvement to the existing scripts
2 parents e95fa6b + a4d5626 commit f3291bc

File tree

9 files changed

+85
-23
lines changed

9 files changed

+85
-23
lines changed

build/android/build.sh

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/sh
22
set -e
3+
set -x
34

45
info()
56
{
@@ -17,10 +18,10 @@ ANDROID_ARCH=arm
1718

1819
# TODO: configure to compile specify 3rd party libraries
1920
OPTIONS="
20-
--disable-lua
21-
--disable-freetype2
21+
--enable-lua
22+
--enable-freetype2
2223
--enable-png
23-
--disable-zlib
24+
--enable-zlib
2425
"
2526

2627
usage()
@@ -34,6 +35,7 @@ OPTIONS:
3435
-k <sdk> Use the specified Android API level (default: $ANDROID_API)
3536
-a <arch> Use the specified arch (default: $ANDROID_ABI)
3637
-n <version> Use the gcc version(default: $ANDROID_GCC_VERSION)
38+
-l <libname> Use the specified library name
3739
EOF
3840
}
3941

@@ -47,7 +49,7 @@ spopd()
4749
popd > /dev/null
4850
}
4951

50-
while getopts "hvk:a:" OPTION
52+
while getopts "hvk:a:l:" OPTION
5153
do
5254
case $OPTION in
5355
h)
@@ -57,16 +59,19 @@ do
5759
q)
5860
set +x
5961
QUIET="yes"
60-
;;
62+
;;
6163
a)
6264
ANDROID_ABI=$OPTARG
63-
;;
65+
;;
6466
k)
6567
ANDROID_API=$OPTARG
66-
;;
68+
;;
6769
n)
6870
ANDROID_GCC_VERSION=$OPTARG
69-
;;
71+
;;
72+
l)
73+
OPTIONS=--enable-$OPTARG
74+
;;
7075
esac
7176
done
7277

@@ -106,20 +111,34 @@ cocos_root=`pwd`/../..
106111

107112
export ANDROID_ABI
108113
export ANDROID_API
109-
export LDFLAGS="-L${ANDROID_NDK}/platforms/${ANDROID_API}/arch-${ANDROID_ARCH}/usr/lib"
110-
info "LD FLAGS SELECTED = '${LDFLAGS}'"
114+
# export LDFLAGS="-L${ANDROID_NDK}/platforms/${ANDROID_API}/arch-${ANDROID_ARCH}/usr/lib"
115+
# info "LD FLAGS SELECTED = '${LDFLAGS}'"
111116

112117
export PATH="${toolchain_bin}:${cocos_root}/extras/tools/bin:$PATH"
118+
if [ "$ANDROID_ABI" = "armeabi-v7a" ]; then
119+
export CFLAGS="-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -DANDROID -Wa,--noexecstack -Wformat -Werror=format-security "
120+
elif [ "$ANDROID_ABI" = "armeabi" ]; then
121+
export CFLAGS="-ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv5te -mtune=xscale -msoft-float -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -DANDROID -Wa,--noexecstack -Wformat -Werror=format-security"
122+
else
123+
export CFLAGS="-ffunction-sections -funwind-tables -fstack-protector -fPIC -no-canonical-prefixes -O2 -g -DNDEBUG -fomit-frame-pointer -fstrict-aliasing -DANDROID -Wa,--noexecstack -Wformat -Werror=format-security"
124+
fi
125+
126+
info "CFLAGS is ${CFLAGS}"
127+
113128
#
114129
# build 3rd party libraries
115130
#
116131
info "Building static libraries"
117132
spushd "${cocos_root}/contrib"
118133
mkdir -p "Android-${ANDROID_ABI}" && cd "Android-${ANDROID_ABI}"
119134

135+
120136
../bootstrap ${OPTIONS} \
121137
--host=${TARGET} \
122138
--prefix=${cocos_root}/contrib/${TARGET}-${ANDROID_ABI}> $out
139+
140+
echo "ANDROID_ARCH := ${CFLAGS}" >> config.mak
141+
123142
#
124143
# make
125144
#

build/ios/build.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ fi
121121

122122
BUILDDIR="${COCOSROOT}/build-ios-${PLATFORM}/${ARCH}"
123123

124-
PREFIX="${COCOSROOT}/install-ios-${PLATFORM}/${ARCH}"
124+
PREFIX="${COCOSROOT}/contrib/install-ios-${PLATFORM}/${ARCH}"
125125

126126
export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
127127

@@ -196,13 +196,16 @@ else
196196
export ASCPP="xcrun as"
197197
fi
198198

199+
200+
199201
../bootstrap ${OPTIONS} \
200202
--build=x86_64-apple-darwin14 \
201203
--host=${TARGET} \
202-
--prefix=${COCOSROOT}/contrib/${TARGET}-${ARCH} > ${out}
204+
--prefix=${PREFIX} > ${out}
203205

204206
echo "EXTRA_CFLAGS += ${EXTRA_CFLAGS}" >> config.mak
205207
echo "EXTRA_LDFLAGS += ${EXTRA_LDFLAGS}" >> config.mak
208+
echo "IOS_ARCH := ${ARCH}" >> config.mak
206209
make fetch
207210
make list
208211
make

build/tizen/build.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,8 @@ info $toolchain_bin
8383
export PATH="${toolchain_bin}:${cocos_root}/extras/tools/bin:$PATH"
8484
TARGET="arm-linux-gnueabi"
8585

86-
# FIXME: If the Tizen sdk is changeing, the version number might need also be changed
87-
export LDFLAGS="-L${TIZEN_SDK}/platforms/mobile-2.3/rootstraps/mobile-2.3-device.core/usr/lib"
88-
info "LD FLAGS SELECTED = '${LDFLAGS}'"
86+
# export LDFLAGS="-L${TIZEN_SDK}/platforms/mobile-2.3/rootstraps/mobile-2.3-device.core/usr/lib"
87+
# info "LD FLAGS SELECTED = '${LDFLAGS}'"
8988

9089
#
9190
# build 3rd party libraries

contrib/src/curl/rules.mak

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ curl: curl-$(CURL_VERSION).tar.gz .sum-curl
1313
$(UPDATE_AUTOCONFIG)
1414
$(MOVE)
1515

16+
DEPS_curl = zlib $(DEPS_zlib)
1617

17-
.curl: curl
18+
DEPS_curl = openssl $(DEPS_openssl)
19+
20+
.curl: curl .zlib .openssl
1821
cd $< && $(HOSTVARS) ./configure $(HOSTCONF) \
1922
--with-ssl \
2023
--with-zlib \

contrib/src/main.mak

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,7 @@ ifdef HAVE_CROSS_COMPILE
408408
ifdef HAVE_ANDROID
409409
# cmake will overwrite our --sysroot with a native (host) one on Darwin
410410
# Set it to "" right away to short-circuit this behaviour
411+
echo "set(CMAKE_SYSTEM_NAME Linux)" >> $@
411412
echo "set(CMAKE_CXX_SYSROOT_FLAG \"\")" >> $@
412413
echo "set(CMAKE_C_SYSROOT_FLAG \"\")" >> $@
413414
endif

contrib/src/openssl/rules.mak

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ ifdef HAVE_ANDROID
2222
OPENSSL_COMPILER=os/compiler:$(HOST)
2323
endif
2424

25+
ifeq ($(IOS_ARCH),armv7)
26+
OPENSSL_CONFIG_VARS="BSD-generic32"
27+
endif
28+
29+
ifeq ($(IOS_ARCH),i386)
30+
OPENSSL_CONFIG_VARS="BSD-generic32"
31+
endif
32+
33+
ifeq ($(IOS_ARCH),arm64)
34+
OPENSSL_CONFIG_VARS="BSD-generic64"
35+
endif
36+
2537
$(TARBALLS)/openssl-$(OPENSSL_VERSION).tar.gz:
2638
$(call download,$(OPENSSL_URL))
2739

@@ -36,5 +48,13 @@ endif
3648

3749
.openssl: openssl
3850
cd $< && $(HOSTVARS) ./Configure $(OPENSSL_CONFIG_VARS) --prefix=$(PREFIX) $(OPENSSL_COMPILER)
51+
ifdef HAVE_IOS
52+
# cd $< && perl -i -pe 's|static volatile sig_atomic_t intr_signal|static volatile int intr_signal|' crypto/ui/ui_openssl.c
53+
cd $< && perl -i -pe "s|^CC= xcrun clang|CC= xcrun cc -arch ${IOS_ARCH} -miphoneos-version-min=6.0 |g" Makefile
54+
cd $< && perl -i -pe "s|^CFLAG= (.*)|CFLAG= -isysroot ${IOS_SDK} |g" Makefile
55+
endif
56+
ifdef HAVE_ANDROID
57+
cd $< && perl -i -pe "s|^CFLAG= (.*)|CFLAG= ${ANDROID_ARCH} |g" Makefile
58+
endif
3959
cd $< && $(MAKE) install
4060
touch $@

contrib/src/png/rules.mak

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ png: libpng-$(PNG_VERSION).tar.xz .sum-png
1818
$(UNPACK)
1919
$(MOVE)
2020

21-
ifndef HAVE_ANDROID
2221
DEPS_png = zlib $(DEPS_zlib)
23-
endif
2422

2523
.png: png
2624
$(RECONF)

contrib/src/websockets/rules.mak

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,23 @@ $(TARBALLS)/libwebsockets-1.3-chrome37-firefox30.zip:
1010

1111
websockets: libwebsockets-1.3-chrome37-firefox30.zip .sum-websockets
1212
$(UNPACK)
13+
ifdef HAVE_ANDROID
14+
$(APPLY) $(SRC)/websockets/websocket_android.patch
15+
endif
1316
$(MOVE)
1417

1518
ifdef HAVE_TIZEN
1619
EX_ECFLAGS = -fPIC
1720
endif
1821

19-
DEPS_websockets = zlib $(DEPS_zlib)
22+
#FIXME: we need to pass __ANDROID__ to cflags
23+
# ifdef HAVE_ANDROID
24+
# EX_ECFLAGS = -D__ANDROID__
25+
# endif
2026

21-
DEPS_websockets = openssl $(DEPS_openssl)
27+
DEPS_websockets = zlib $(DEPS_zlib)
2228

23-
.websockets: websockets .zlib .openssl toolchain.cmake
24-
cd $< && $(HOSTVARS) CFLAGS="$(CFLAGS) $(EX_ECFLAGS)" $(CMAKE) -DCMAKE_BUILD_TYPE=Release
25-
cd $< && $(MAKE) install
29+
.websockets: websockets .zlib toolchain.cmake
30+
cd $< && $(HOSTVARS) CFLAGS="$(CFLAGS) $(EX_ECFLAGS)" $(CMAKE) -DCMAKE_BUILD_TYPE=Release -DLWS_WITH_SSL=0 -DLWS_WITHOUT_TEST_PING=1
31+
cd $< && $(MAKE) VERBOSE=1 install
2632
touch $@
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h
2+
index 6fae889..97c0d0e 100755
3+
--- a/lib/private-libwebsockets.h
4+
+++ b/lib/private-libwebsockets.h
5+
@@ -105,7 +105,7 @@
6+
#else
7+
#include <ifaddrs.h>
8+
#endif
9+
-#include <sys/syslog.h>
10+
+#include <syslog.h>
11+
#include <sys/un.h>
12+
#include <sys/socket.h>
13+
#include <netdb.h>

0 commit comments

Comments
 (0)