| 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 #@ build/install-build-deps.sh --arm |
| 10 #@ |
| 11 #@ you may also want to: |
| 12 #@ build/install-build-deps.sh |
| 13 #@ build/linux/install-arm-sysroot.py (should already be done by hooks) |
| 14 #@ sudo apt-get install g++-multilib gcc-multilib |
| 15 #@ |
| 16 #@ |
| 17 #@ build chrome with the cross toolchain |
| 18 #@ chrome-setup.sh configure-chrome |
| 19 #@ chrome-setup.sh make-chrome |
| 20 #@ chrome-setup.sh make-nacl (optional) |
| 21 #@ chrome-setup.sh package-chrome |
| 22 #@ now copy the chrome tarball (chrome-arm.tgz) to your are device |
| 23 |
| 24 |
| 25 readonly SYSROOT=$(pwd)/arm-sysroot |
| 26 readonly PARALLELISM=20 |
| 27 readonly GYP_DEFINES="\ |
| 28 target_arch=arm \ |
| 29 " |
| 30 |
| 31 #@ |
| 32 #@ |
| 33 configure-chrome() { |
| 34 [ ! -d ${SYSROOT} ] && exit "arm root not found (run install-build-deps.sh --a
rm)" |
| 35 export CXX=arm-linux-gnueabi-g++ |
| 36 export CC=arm-linux-gnueabi-gcc |
| 37 export AR=arm-linux-gnueabi-ar |
| 38 export AS=arm-linux-gnueabi-as |
| 39 export RANLIB=arm-linux-gnueabi-ranlib |
| 40 export CXX_host=g++ |
| 41 export CC_host=gcc |
| 42 export GYP_DEFINES |
| 43 # note this reads GYP_DEFINES |
| 44 gclient runhooks |
| 45 } |
| 46 |
| 47 |
| 48 build-targets() { |
| 49 [ ! -d ${SYSROOT} ] && exit "arm root not found" |
| 50 # $CXX should have been baked into both the ninja |
| 51 # files and the Makefiles by this time, but due |
| 52 # to several issues/bugs we need to set CXX during |
| 53 # the build too. |
| 54 # Ninja needs it since ld_bfd.py reads this env var |
| 55 # and ninja doesn't export it. |
| 56 # Make seems to need it otherwise it defines the |
| 57 # linker command incorrectly. |
| 58 # TODO(sbc): remove this |
| 59 export CXX=arm-linux-gnueabi-g++ |
| 60 |
| 61 if [ "${GYP_GENERATORS:=}" == "ninja" ]; then |
| 62 set -x |
| 63 ninja -C ${GYP_GENERATOR_OUTPUT:=.}/out/Release $* |
| 64 else |
| 65 set -x |
| 66 make BUILDTYPE=Release -j ${PARALLELISM} $* |
| 67 fi |
| 68 } |
| 69 |
| 70 #@ |
| 71 #@ Make chrome binaries (pass -v, or V=99 in you |
| 72 #@ want verbosity in make/ninja respectively. |
| 73 make-chrome() { |
| 74 build-targets chrome $* |
| 75 } |
| 76 |
| 77 #@ |
| 78 #@ Make nacl binaries (pass -v, or V=99 in you |
| 79 #@ want verbosity in make/ninja respectively. |
| 80 make-nacl() { |
| 81 build-targets nacl_helper nacl_helper_bootstrap $* |
| 82 } |
| 83 |
| 84 |
| 85 package-chrome() { |
| 86 local OUT=${GYP_GENERATOR_OUTPUT:=.}/out/Release |
| 87 rm -rf ${OUT}/chrome-arm |
| 88 mkdir ${OUT}/chrome-arm |
| 89 cp -r ${OUT}/chrome \ |
| 90 ${OUT}/lib*.so \ |
| 91 ${OUT}/nacl_irt_*.nexe \ |
| 92 ${OUT}/nacl_ipc_*.nexe \ |
| 93 ${OUT}/nacl_helper \ |
| 94 ${OUT}/nacl_helper_bootstrap \ |
| 95 ${OUT}/chrome.pak \ |
| 96 ${OUT}/resources.pak \ |
| 97 ${OUT}/chrome_100_percent.pak \ |
| 98 ${OUT}/locales \ |
| 99 ${OUT}/chrome-arm |
| 100 tar cfvz ${OUT}/chrome-arm.tgz -C ${OUT} chrome-arm |
| 101 echo "chrome packaged in chrome-arm.tgz" |
| 102 } |
| 103 |
| 104 ###################################################################### |
| 105 # DISPATCH |
| 106 ###################################################################### |
| 107 Usage() { |
| 108 egrep "^#@" $0 | cut --bytes=3- |
| 109 } |
| 110 |
| 111 |
| 112 if [[ $# -eq 0 ]] ; then |
| 113 echo "you must specify a mode on the commandline:" |
| 114 echo |
| 115 Usage |
| 116 exit -1 |
| 117 elif [[ "$(type -t $1)" != "function" ]]; then |
| 118 echo "ERROR: unknown function '$1'." >&2 |
| 119 echo "For help, try:" |
| 120 echo " $0 help" |
| 121 exit 1 |
| 122 else |
| 123 "$@" |
| 124 fi |
| OLD | NEW |