Revision: 12172
Author:   [email protected]
Date:     Mon Jul 23 05:02:46 2012
Log:      Enable building V8 for Android on Mac

Review URL: https://chromiumcodereview.appspot.com/10795045
Patch from Haitao Feng <[email protected]>.
http://code.google.com/p/v8/source/detail?r=12172

Modified:
 /branches/bleeding_edge/Makefile
 /branches/bleeding_edge/build/common.gypi
 /branches/bleeding_edge/tools/android-build.sh

=======================================
--- /branches/bleeding_edge/Makefile    Wed Jul 18 04:43:44 2012
+++ /branches/bleeding_edge/Makefile    Mon Jul 23 05:02:46 2012
@@ -175,7 +175,7 @@
                 CXX="$(CXX)" LINK="$(LINK)" BUILDTYPE=Release \
                 builddir="$(shell pwd)/$(OUTDIR)/$@"

-$(ANDROID_ARCHES): $(addprefix $$@.,$(MODE))
+$(ANDROID_ARCHES): $(addprefix $$@.,$(MODES))

 $(ANDROID_BUILDS): $(GYPFILES) $(ENVFILE) build/android.gypi \
                    must-set-ANDROID_NDK_ROOT
=======================================
--- /branches/bleeding_edge/build/common.gypi   Thu Jul 19 03:36:19 2012
+++ /branches/bleeding_edge/build/common.gypi   Mon Jul 23 05:02:46 2012
@@ -279,7 +279,7 @@
         'target_conditions': [
           ['_toolset=="host"', {
             'variables': {
- 'm32flag': '<!((echo | $(echo ${CXX_host:-$(which g++)}) -m32 -E - > /dev/null 2>&1) && echo -n "-m32" || true)', + 'm32flag': '<!((echo | $(echo ${CXX_host:-$(which g++)}) -m32 -E - > /dev/null 2>&1) && echo "-m32" || true)',
             },
             'cflags': [ '<(m32flag)' ],
             'ldflags': [ '<(m32flag)' ],
@@ -289,7 +289,7 @@
           }],
           ['_toolset=="target"', {
             'variables': {
- 'm32flag': '<!((echo | $(echo ${CXX_target:-${CXX:-$(which g++)}}) -m32 -E - > /dev/null 2>&1) && echo -n "-m32" || true)', + 'm32flag': '<!((echo | $(echo ${CXX_target:-${CXX:-$(which g++)}}) -m32 -E - > /dev/null 2>&1) && echo "-m32" || true)',
             },
             'cflags': [ '<(m32flag)' ],
             'ldflags': [ '<(m32flag)' ],
=======================================
--- /branches/bleeding_edge/tools/android-build.sh      Mon Jul 23 02:59:17 2012
+++ /branches/bleeding_edge/tools/android-build.sh      Mon Jul 23 05:02:46 2012
@@ -27,7 +27,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 if [ ${#@} -lt 4 ] ; then
-  echo "Error: $0 needs 4 arguments."
+  echo "$0: Error: needs 4 arguments."
   exit 1
 fi

@@ -42,8 +42,11 @@
   "linux")
     toolchain_dir="linux-x86"
     ;;
+  "mac")
+    toolchain_dir="darwin-x86"
+    ;;
   *)
-    echo "Host platform ${host_os} is not supported" >& 2
+    echo "$0: Host platform ${host_os} is not supported" >& 2
     exit 1
 esac

@@ -58,23 +61,27 @@
     toolchain_arch="x86-4.4.3"
     ;;
   *)
-    echo "Architecture: ${ARCH} is not supported." >& 2
-    echo "Current supported architectures: arm|ia32." >& 2
+    echo "$0: Target architecture ${ARCH} is not supported." >& 2
+ echo "$0: Current supported architectures: android_arm|android_ia32."
& 2
     exit 1
 esac

 toolchain_path="${ANDROID_NDK_ROOT}/toolchains/${toolchain_arch}/prebuilt/"
 ANDROID_TOOLCHAIN="${toolchain_path}/${toolchain_dir}/bin"
 if [ ! -d "${ANDROID_TOOLCHAIN}" ]; then
-  echo "Cannot find Android toolchain in ${ANDROID_TOOLCHAIN}." >& 2
-  echo "The NDK version might be wrong." >& 2
+  echo "$0: Cannot find Android toolchain in ${ANDROID_TOOLCHAIN}." >& 2
+  echo "$0: The NDK version might be wrong." >& 2
   exit 1
 fi

-# The set of GYP_DEFINES to pass to gyp.
+# For mksnapshot host generation.
+DEFINES+=" host_os=${host_os}"
+
+# The set of GYP_DEFINES to pass to gyp.
 export GYP_DEFINES="${DEFINES}"

-export GYP_GENERATORS=make
+# Use the "android" flavor of the Makefile generator for both Linux and OS X.
+export GYP_GENERATORS=make-android
 export CC=${ANDROID_TOOLCHAIN}/*-gcc
 export CXX=${ANDROID_TOOLCHAIN}/*-g++
 build/gyp/gyp --generator-output="${OUTDIR}" build/all.gyp \
@@ -85,6 +92,6 @@
 export RANLIB=${ANDROID_TOOLCHAIN}/*-ranlib
 export LD=${ANDROID_TOOLCHAIN}/*-ld
 export LINK=${ANDROID_TOOLCHAIN}/*-g++
-export BUILDTYPE=${MODE[@]^}
-export builddir=$(readlink -f ${PWD})/${OUTDIR}/${ARCH}.${MODE}
+export BUILDTYPE=$(echo ${MODE} | python -c "print raw_input().capitalize()")
+export builddir=${PWD}/${OUTDIR}/${ARCH}.${MODE}
 make -C "${OUTDIR}" -f Makefile.${ARCH}

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to