| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 # This script builds out/pnacl_multicrx_<rev>.zip for upload to the Chrome | 6 # This script builds out/pnacl_multicrx_<rev>.zip for upload to the Chrome |
| 7 # Web Store. It runs gyp + ninja once for each architecture and assembles | 7 # Web Store. It runs GN + ninja once for each architecture and assembles |
| 8 # the results along with a manifest file. | 8 # the results along with a manifest file. |
| 9 | 9 |
| 10 # TODO(sbc): rewrite this in python | 10 # TODO(sbc): rewrite this in python |
| 11 | 11 |
| 12 set -o errexit | 12 set -o errexit |
| 13 set -o nounset | 13 set -o nounset |
| 14 | 14 |
| 15 SCRIPT_DIR="$(cd $(dirname $0) && pwd)" | 15 SCRIPT_DIR="$(cd $(dirname $0) && pwd)" |
| 16 CHROME_SRC=$(dirname $(dirname $(dirname ${SCRIPT_DIR}))) | 16 CHROME_SRC=$(dirname $(dirname $(dirname ${SCRIPT_DIR}))) |
| 17 cd ${CHROME_SRC} | 17 cd ${CHROME_SRC} |
| 18 | 18 |
| 19 run_gyp() { | 19 run_gn() { |
| 20 # The original version of the script ran 'gclient runhooks' which run turn | 20 local arch=$1 |
| 21 # runs gyp_chromium. However its a lot faster and quieter to just run the | 21 gn gen out_pnacl/$arch --args="target_cpu=\"$arch\" is_debug=false" |
| 22 # gyp file containing the target we need. | 22 } |
| 23 gyp_dir=ppapi/native_client/src/untrusted/pnacl_support_extension | 23 |
| 24 build/gyp_chromium --depth=. $gyp_dir/pnacl_support_extension.gyp | 24 cpu_package() { |
| 25 local arch=$1 |
| 26 local alt_arch=$2 |
| 27 local base_out_dir=out |
| 28 |
| 29 rm -rf out_pnacl/$arch |
| 30 run_gn $arch |
| 31 ninja -C out_pnacl/$arch pnacl_support_extension |
| 32 local target_dir=${base_out_dir}/pnacl_${alt_arch} |
| 33 mkdir -p ${target_dir} |
| 34 cp out_pnacl/$arch/pnacl/* ${target_dir}/. |
| 25 } | 35 } |
| 26 | 36 |
| 27 individual_packages() { | 37 individual_packages() { |
| 28 export GYP_GENERATOR_FLAGS="output_dir=out_pnacl" | 38 cpu_package x64 x86_64 |
| 29 local base_out_dir=out | 39 cpu_package arm arm |
| 30 | 40 cpu_package x86 x86_32 |
| 31 # arm | |
| 32 rm -rf out_pnacl/ | |
| 33 GYP_DEFINES="target_arch=arm" run_gyp | |
| 34 ninja -C out_pnacl/Release/ pnacl_support_extension | |
| 35 local target_dir=${base_out_dir}/pnacl_arm | |
| 36 mkdir -p ${target_dir} | |
| 37 cp out_pnacl/Release/pnacl/* ${target_dir}/. | |
| 38 | |
| 39 # ia32 | |
| 40 rm -rf out_pnacl/ | |
| 41 GYP_DEFINES="target_arch=ia32" run_gyp | |
| 42 ninja -C out_pnacl/Release/ pnacl_support_extension | |
| 43 target_dir=${base_out_dir}/pnacl_x86_32 | |
| 44 mkdir -p ${target_dir} | |
| 45 cp out_pnacl/Release/pnacl/* ${target_dir}/. | |
| 46 | |
| 47 # x64 | |
| 48 rm -rf out_pnacl/ | |
| 49 GYP_DEFINES="target_arch=x64" run_gyp | |
| 50 ninja -C out_pnacl/Release/ pnacl_support_extension | |
| 51 target_dir=${base_out_dir}/pnacl_x86_64 | |
| 52 mkdir -p ${target_dir} | |
| 53 cp out_pnacl/Release/pnacl/* ${target_dir}/. | |
| 54 } | 41 } |
| 55 | 42 |
| 56 multi_crx() { | 43 multi_crx() { |
| 57 local outfile=$1 | 44 local outfile=$1 |
| 58 local version=$2 | 45 local version=$2 |
| 59 local base_out_dir=out | 46 local base_out_dir=out |
| 60 local target_dir=${base_out_dir}/pnacl_multicrx | 47 local target_dir=${base_out_dir}/pnacl_multicrx |
| 61 mkdir -p ${target_dir} | 48 mkdir -p ${target_dir} |
| 62 cat > ${target_dir}/manifest.json <<EOF | 49 cat > ${target_dir}/manifest.json <<EOF |
| 63 { | 50 { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 if [ $# != 2 ]; then | 84 if [ $# != 2 ]; then |
| 98 echo "Usage: $0 <outfile> <rev_number>" | 85 echo "Usage: $0 <outfile> <rev_number>" |
| 99 exit 1 | 86 exit 1 |
| 100 fi | 87 fi |
| 101 | 88 |
| 102 outfile="$1" | 89 outfile="$1" |
| 103 version="$2" | 90 version="$2" |
| 104 echo "Building file ${outfile} version=${version}" | 91 echo "Building file ${outfile} version=${version}" |
| 105 individual_packages | 92 individual_packages |
| 106 multi_crx ${outfile} ${version} | 93 multi_crx ${outfile} ${version} |
| OLD | NEW |