11cb0ef41Sopenharmony_ci#!/bin/bash
21cb0ef41Sopenharmony_ci# Run this script ONLY inside an Android build system
31cb0ef41Sopenharmony_ci# and after you ran lunch command!
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ciif [ -z "$ANDROID_BUILD_TOP" ]; then
61cb0ef41Sopenharmony_ci    echo "Run lunch before running this script!"
71cb0ef41Sopenharmony_ci    exit 1
81cb0ef41Sopenharmony_cifi
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_ciif [ -z "$1" ]; then
111cb0ef41Sopenharmony_ci    ARCH="arm"
121cb0ef41Sopenharmony_cielse
131cb0ef41Sopenharmony_ci    ARCH="$1"
141cb0ef41Sopenharmony_cifi
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ciif [ $ARCH = "x86" ]; then
171cb0ef41Sopenharmony_ci    TARGET_ARCH="ia32"
181cb0ef41Sopenharmony_cielse
191cb0ef41Sopenharmony_ci    TARGET_ARCH="$ARCH"
201cb0ef41Sopenharmony_cifi
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_cicd $(dirname $0)/..
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_ci./configure \
251cb0ef41Sopenharmony_ci    --without-snapshot \
261cb0ef41Sopenharmony_ci    --openssl-no-asm \
271cb0ef41Sopenharmony_ci    --dest-cpu=$TARGET_ARCH \
281cb0ef41Sopenharmony_ci    --dest-os=android
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ciexport GYP_GENERATORS="android"
311cb0ef41Sopenharmony_ciexport GYP_GENERATOR_FLAGS="limit_to_target_all=true"
321cb0ef41Sopenharmony_ciGYP_DEFINES="target_arch=$TARGET_ARCH"
331cb0ef41Sopenharmony_ciGYP_DEFINES+=" v8_target_arch=$TARGET_ARCH"
341cb0ef41Sopenharmony_ciGYP_DEFINES+=" android_target_arch=$ARCH"
351cb0ef41Sopenharmony_ciGYP_DEFINES+=" host_os=linux OS=android"
361cb0ef41Sopenharmony_ciexport GYP_DEFINES
371cb0ef41Sopenharmony_ci
381cb0ef41Sopenharmony_ci./deps/npm/node_modules/node-gyp/gyp/gyp \
391cb0ef41Sopenharmony_ci    -Icommon.gypi \
401cb0ef41Sopenharmony_ci    -Iconfig.gypi \
411cb0ef41Sopenharmony_ci    --depth=. \
421cb0ef41Sopenharmony_ci    -Dcomponent=static_library \
431cb0ef41Sopenharmony_ci    -Dlibrary=static_library \
441cb0ef41Sopenharmony_ci    node.gyp
451cb0ef41Sopenharmony_ci
461cb0ef41Sopenharmony_ciecho -e "LOCAL_PATH := \$(call my-dir)\n\ninclude \$(LOCAL_PATH)/GypAndroid.mk" > Android.mk
47