| OLD | NEW |
| (Empty) | |
| 1 #!/bin/bash |
| 2 set -o nounset |
| 3 set -o errexit |
| 4 |
| 5 #@ The typical usage for this tool is: |
| 6 #@ |
| 7 #@ Install cross toolchain (do this only once per system) |
| 8 #@ |
| 9 #@ chrome-setup.sh install-cross-toolchain-base |
| 10 #@ chrome-setup.sh install-cross-toolchain-jail |
| 11 #@ |
| 12 #@ build chrome with the cross toolchain |
| 13 #@ chrome-setup.sh configure-chrome |
| 14 #@ chrome-setup.sh make-chrome |
| 15 #@ chrome-setup.sh make-nacl |
| 16 #@ chrome-setup.sh package-chrome |
| 17 #@ now copy the chrome tarball (chrome-arm.tgz) to your are device |
| 18 |
| 19 |
| 20 readonly SYSROOT=$(pwd)/arm_jail |
| 21 |
| 22 readonly TC_URL_PREFIX=https://commondatastorage.googleapis.com/nativeclient-arc
hive2/toolchain |
| 23 readonly TC_REV=8000 |
| 24 |
| 25 |
| 26 # Packages for the host system |
| 27 # NOTE: at one point we should get rid of the 4.5 packages |
| 28 readonly CROSS_ARM_TC_PACKAGES="\ |
| 29 libc6-armel-cross \ |
| 30 libc6-dev-armel-cross \ |
| 31 libgcc1-armel-cross \ |
| 32 libgomp1-armel-cross \ |
| 33 linux-libc-dev-armel-cross \ |
| 34 libgcc1-dbg-armel-cross \ |
| 35 libgomp1-dbg-armel-cross \ |
| 36 binutils-arm-linux-gnueabi \ |
| 37 cpp-arm-linux-gnueabi \ |
| 38 gcc-arm-linux-gnueabi \ |
| 39 g++-arm-linux-gnueabi \ |
| 40 cpp-4.5-arm-linux-gnueabi \ |
| 41 gcc-4.5-arm-linux-gnueabi \ |
| 42 g++-4.5-arm-linux-gnueabi \ |
| 43 libmudflap0-dbg-armel-cross |
| 44 " |
| 45 |
| 46 readonly GYP_DEFINES="\ |
| 47 sysroot=${SYSROOT} \ |
| 48 target_arch=arm \ |
| 49 armv7=1 \ |
| 50 arm_thumb=0 \ |
| 51 arm_neon=1 \ |
| 52 linux_breakpad=0 \ |
| 53 linux_use_tcmalloc=0 |
| 54 linux_use_gold_binary=1 |
| 55 linux_use_gold_flags=1 |
| 56 " |
| 57 |
| 58 ###################################################################### |
| 59 export CXX=arm-linux-gnueabi-g++ |
| 60 export CC=arm-linux-gnueabi-gcc |
| 61 export AR=arm-linux-gnueabi-ar |
| 62 export AS=arm-linux-gnueabi-as |
| 63 export RANLIB=arm-linux-gnueabi-ranlib |
| 64 |
| 65 export GYP_DEFINES |
| 66 export SYSROOT |
| 67 |
| 68 ###################################################################### |
| 69 |
| 70 |
| 71 #@ run this once on your system to install necessary crosstoolchain |
| 72 #@ binaries - NOTE: sudo required |
| 73 #@ |
| 74 install-cross-toolchain-base() { |
| 75 sudo apt-get install ${CROSS_ARM_TC_PACKAGES} |
| 76 } |
| 77 |
| 78 |
| 79 #@ run this once for each chrome checkout inside src/ |
| 80 #@ (this could be shared across chrome checkouts as well) |
| 81 #@ |
| 82 install-cross-toolchain-jail() { |
| 83 local tarball=$(pwd)/jail.tgz |
| 84 |
| 85 curl -L \ |
| 86 ${TC_URL_PREFIX}/${TC_REV}/naclsdk_linux_arm-trusted.tgz \ |
| 87 -o ${tarball} |
| 88 |
| 89 |
| 90 rm -rf ${SYSROOT} |
| 91 mkdir -p ${SYSROOT} |
| 92 tar zxf ${tarball} -C ${SYSROOT} |
| 93 } |
| 94 |
| 95 |
| 96 #@ |
| 97 #@ |
| 98 configure-chrome() { |
| 99 # note this reads GYP_DEFINES |
| 100 gclient runhooks |
| 101 } |
| 102 |
| 103 |
| 104 #@ |
| 105 #@ |
| 106 make-chrome() { |
| 107 make V=99 BUILDTYPE=Release -j 16 chrome \ |
| 108 "CC.host=gcc -m32 -I/usr/lib/glib-2.0/include "\ |
| 109 "CXX.host= g++ -m32 -I/usr/lib/glib-2.0/include " |
| 110 } |
| 111 |
| 112 make-nacl() { |
| 113 make V=99 BUILDTYPE=Release -j 16 nacl_helper nacl_helper_bootstrap \ |
| 114 "CC.host=gcc -m32 -I/usr/lib/glib-2.0/include "\ |
| 115 "CXX.host= g++ -m32 -I/usr/lib/glib-2.0/include " |
| 116 } |
| 117 |
| 118 package-chrome() { |
| 119 tar cfvz chrome-arm.tgz out/Release/chrome \ |
| 120 out/Release/lib*.so \ |
| 121 out/Release/nacl* \ |
| 122 out/Release/chrome.pak \ |
| 123 out/Release/resources.pak \ |
| 124 out/Release/locales |
| 125 } |
| 126 |
| 127 ###################################################################### |
| 128 # DISPATCH |
| 129 ###################################################################### |
| 130 Usage() { |
| 131 egrep "^#@" $0 | cut --bytes=3- |
| 132 } |
| 133 |
| 134 |
| 135 if [[ $# -eq 0 ]] ; then |
| 136 echo "you must specify a mode on the commandline:" |
| 137 echo |
| 138 Usage |
| 139 exit -1 |
| 140 elif [[ "$(type -t $1)" != "function" ]]; then |
| 141 echo "ERROR: unknown function '$1'." >&2 |
| 142 echo "For help, try:" |
| 143 echo " $0 help" |
| 144 exit 1 |
| 145 else |
| 146 "$@" |
| 147 fi |
| OLD | NEW |