2727# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828
2929if [ ${#@ } -lt 4 ] ; then
30- echo " Error: $0 needs 4 arguments."
30+ echo " $0 : Error: needs 4 arguments."
3131 exit 1
3232fi
3333
@@ -42,8 +42,11 @@ case "${host_os}" in
4242 " linux" )
4343 toolchain_dir=" linux-x86"
4444 ;;
45+ " mac" )
46+ toolchain_dir=" darwin-x86"
47+ ;;
4548 * )
46- echo " Host platform ${host_os} is not supported" >& 2
49+ echo " $0 : Host platform ${host_os} is not supported" >& 2
4750 exit 1
4851esac
4952
@@ -58,23 +61,27 @@ case "${ARCH}" in
5861 toolchain_arch=" x86-4.4.3"
5962 ;;
6063 * )
61- echo " Architecture: ${ARCH} is not supported." >& 2
62- echo " Current supported architectures: arm|ia32 ." >& 2
64+ echo " $0 : Target architecture ${ARCH} is not supported." >& 2
65+ echo " $0 : Current supported architectures: android_arm|android_ia32 ." >& 2
6366 exit 1
6467esac
6568
6669toolchain_path=" ${ANDROID_NDK_ROOT} /toolchains/${toolchain_arch} /prebuilt/"
6770ANDROID_TOOLCHAIN=" ${toolchain_path} /${toolchain_dir} /bin"
6871if [ ! -d " ${ANDROID_TOOLCHAIN} " ]; then
69- echo " Cannot find Android toolchain in ${ANDROID_TOOLCHAIN} ." >& 2
70- echo " The NDK version might be wrong." >& 2
72+ echo " $0 : Cannot find Android toolchain in ${ANDROID_TOOLCHAIN} ." >& 2
73+ echo " $0 : The NDK version might be wrong." >& 2
7174 exit 1
7275fi
7376
74- # The set of GYP_DEFINES to pass to gyp.
77+ # For mksnapshot host generation.
78+ DEFINES+=" host_os=${host_os} "
79+
80+ # The set of GYP_DEFINES to pass to gyp.
7581export GYP_DEFINES=" ${DEFINES} "
7682
77- export GYP_GENERATORS=make
83+ # Use the "android" flavor of the Makefile generator for both Linux and OS X.
84+ export GYP_GENERATORS=make-android
7885export CC=${ANDROID_TOOLCHAIN} /* -gcc
7986export CXX=${ANDROID_TOOLCHAIN} /* -g++
8087build/gyp/gyp --generator-output=" ${OUTDIR} " build/all.gyp \
@@ -85,6 +92,6 @@ export AR=${ANDROID_TOOLCHAIN}/*-ar
8592export RANLIB=${ANDROID_TOOLCHAIN} /* -ranlib
8693export LD=${ANDROID_TOOLCHAIN} /* -ld
8794export LINK=${ANDROID_TOOLCHAIN} /* -g++
88- export BUILDTYPE=${MODE[@]^}
89- export builddir=$( readlink -f $ {PWD}) /${OUTDIR} /${ARCH} .${MODE}
95+ export BUILDTYPE=$( echo $ {MODE} | python -c " print raw_input().capitalize() " )
96+ export builddir=${PWD} /${OUTDIR} /${ARCH} .${MODE}
9097make -C " ${OUTDIR} " -f Makefile.${ARCH}
0 commit comments