Jayant Chowdhary | ea86c04 | 2018-01-25 12:07:55 -0800 | [diff] [blame] | 1 | #!/bin/bash -ex |
| 2 | |
Logan Chien | ee95419 | 2018-10-04 10:52:41 +0800 | [diff] [blame^] | 3 | # Copyright 2018 Google Inc. All rights reserved. |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
Jayant Chowdhary | ea86c04 | 2018-01-25 12:07:55 -0800 | [diff] [blame] | 17 | if [ -z "${OUT_DIR}" ]; then |
| 18 | echo Must set OUT_DIR |
| 19 | exit 1 |
| 20 | fi |
| 21 | |
| 22 | TOP=$(pwd) |
| 23 | |
| 24 | UNAME="$(uname)" |
| 25 | case "$UNAME" in |
| 26 | Linux) |
| 27 | OS='linux' |
| 28 | ;; |
| 29 | Darwin) |
| 30 | OS='darwin' |
| 31 | ;; |
| 32 | *) |
| 33 | exit 1 |
| 34 | ;; |
| 35 | esac |
| 36 | |
| 37 | # ckati and makeparallel (Soong) |
| 38 | SOONG_OUT=${OUT_DIR}/soong |
| 39 | SOONG_HOST_OUT=${OUT_DIR}/soong/host/${OS}-x86 |
| 40 | rm -rf ${SOONG_OUT} |
| 41 | mkdir -p ${SOONG_OUT} |
| 42 | cat > ${SOONG_OUT}/soong.variables << EOF |
| 43 | { |
| 44 | "Allow_missing_dependencies": true, |
Dan Willemsen | 1051691 | 2018-08-28 20:16:29 -0700 | [diff] [blame] | 45 | "HostArch":"x86_64" |
Jayant Chowdhary | ea86c04 | 2018-01-25 12:07:55 -0800 | [diff] [blame] | 46 | } |
| 47 | EOF |
| 48 | SOONG_BINARIES=( |
| 49 | header-abi-linker |
| 50 | header-abi-dumper |
| 51 | header-abi-diff |
| 52 | merge-abi-diff |
| 53 | ) |
| 54 | |
| 55 | binaries=$(for i in "${SOONG_BINARIES[@]}"; do echo ${SOONG_HOST_OUT}/bin/${i}; done) |
| 56 | |
| 57 | # Build everything |
| 58 | build/soong/soong_ui.bash --make-mode --skip-make \ |
| 59 | ${binaries} |
| 60 | |
| 61 | # Copy arch-specific binaries |
| 62 | mkdir -p ${SOONG_OUT}/dist/bin |
| 63 | cp ${binaries} ${SOONG_OUT}/dist/bin/ |
| 64 | cp -R ${SOONG_HOST_OUT}/lib* ${SOONG_OUT}/dist/ |
| 65 | |
| 66 | # Package arch-specific prebuilts |
| 67 | ( |
| 68 | cd ${SOONG_OUT}/dist |
| 69 | zip -qryX build-prebuilts.zip * |
| 70 | ) |
| 71 | |
| 72 | if [ -n "${DIST_DIR}" ]; then |
| 73 | mkdir -p ${DIST_DIR} || true |
| 74 | cp ${SOONG_OUT}/dist/build-prebuilts.zip ${DIST_DIR}/ |
| 75 | fi |