Created
November 17, 2014 18:32
-
-
Save cmawhorter/073194bc8028c272cd50 to your computer and use it in GitHub Desktop.
Configure a cordova environment to use Crosswalk and be capable of building either ARM or x86 binaries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# Expects this dir structure: | |
# libs (tip: symlink these) | |
# crosswalk_x86 | |
# crosswalk_arm | |
# src | |
# client | |
# ... | |
# hooks | |
# platforms | |
# plugins | |
# www | |
# package.json | |
# config.xml | |
# init-dev.sh (this script) | |
# bin | |
# android | |
# debug | |
# release | |
BASEDIR=$( cd $(dirname $0) ; pwd -P ) | |
CROSSWALKDIRX86=$BASEDIR/../../libs/crosswalk_x86 | |
CROSSWALKDIRARM=$BASEDIR/../../libs/crosswalk_arm | |
PLATFORMSDIR=$BASEDIR/platforms | |
PLUGINSDIR=$BASEDIR/plugins | |
TASKSDIR=$BASEDIR/tasks | |
# replace webview with crosswalk | |
# if [ ! -d "$CROSSWALKDIR" ]; then | |
# # Control will enter here if $DIRECTORY doesn't exist. | |
# echo "Please add 'crosswalk' directory to libs at: $CROSSWALKDIR" | |
# exit 1; | |
# fi | |
npm install | |
bower install | |
# cleanup existing | |
rm -fr $PLATFORMSDIR | |
rm -fr $PLUGINSDIR | |
# set up platforms | |
node $TASKSDIR/platforms.js | |
mkdir platforms/android-noarch | |
cp -a platforms/android/* platforms/android-noarch/ | |
cp -f config/android/AndroidManifest.xml platforms/android-noarch/AndroidManifest.xml | |
rm -Rf platforms/android/CordovaLib/* | |
mkdir platforms/android-arm | |
cp -a platforms/android/* platforms/android-arm/ | |
cp -a $CROSSWALKDIRARM/framework/* platforms/android-arm/CordovaLib/ | |
cp -a $CROSSWALKDIRARM/VERSION platforms/android-arm/ | |
cd platforms/android-arm/CordovaLib/ | |
android update project --subprojects --path . --target "android-19" | |
ant debug | |
cd ../../.. | |
cp -f config/android/AndroidManifest.xml platforms/android-arm/AndroidManifest.xml | |
mkdir platforms/android-x86 | |
cp -a platforms/android/* platforms/android-x86/ | |
cp -a $CROSSWALKDIRX86/framework/* platforms/android-arm/CordovaLib/ | |
cp -a $CROSSWALKDIRX86/VERSION platforms/android-arm/ | |
cd platforms/android-x86/CordovaLib/ | |
android update project --subprojects --path . --target "android-19" | |
ant debug | |
cd ../../.. | |
cp -f config/android/AndroidManifest.xml platforms/android-x86/AndroidManifest.xml | |
rm -fr platforms/android | |
ln -s $PLATFORMSDIR/android-arm/ ./platforms/android | |
# grab plugins first | |
node $TASKSDIR/plugins.js | |
echo "Done." | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment