Jayant Chowdhary | ea86c04 | 2018-01-25 12:07:55 -0800 | [diff] [blame^] | 1 | #!/bin/bash -ex |
| 2 | |
| 3 | if [ -z "${OUT_DIR}" ]; then |
| 4 | echo Must set OUT_DIR |
| 5 | exit 1 |
| 6 | fi |
| 7 | |
| 8 | TOP=$(pwd) |
| 9 | |
| 10 | UNAME="$(uname)" |
| 11 | case "$UNAME" in |
| 12 | Linux) |
| 13 | OS='linux' |
| 14 | ;; |
| 15 | Darwin) |
| 16 | OS='darwin' |
| 17 | ;; |
| 18 | *) |
| 19 | exit 1 |
| 20 | ;; |
| 21 | esac |
| 22 | |
| 23 | # ckati and makeparallel (Soong) |
| 24 | SOONG_OUT=${OUT_DIR}/soong |
| 25 | SOONG_HOST_OUT=${OUT_DIR}/soong/host/${OS}-x86 |
| 26 | rm -rf ${SOONG_OUT} |
| 27 | mkdir -p ${SOONG_OUT} |
| 28 | cat > ${SOONG_OUT}/soong.variables << EOF |
| 29 | { |
| 30 | "Allow_missing_dependencies": true, |
| 31 | "HostArch":"x86_64", |
| 32 | "HostSecondaryArch":"x86" |
| 33 | } |
| 34 | EOF |
| 35 | SOONG_BINARIES=( |
| 36 | header-abi-linker |
| 37 | header-abi-dumper |
| 38 | header-abi-diff |
| 39 | merge-abi-diff |
| 40 | ) |
| 41 | |
| 42 | binaries=$(for i in "${SOONG_BINARIES[@]}"; do echo ${SOONG_HOST_OUT}/bin/${i}; done) |
| 43 | |
| 44 | # Build everything |
| 45 | build/soong/soong_ui.bash --make-mode --skip-make \ |
| 46 | ${binaries} |
| 47 | |
| 48 | # Copy arch-specific binaries |
| 49 | mkdir -p ${SOONG_OUT}/dist/bin |
| 50 | cp ${binaries} ${SOONG_OUT}/dist/bin/ |
| 51 | cp -R ${SOONG_HOST_OUT}/lib* ${SOONG_OUT}/dist/ |
| 52 | |
| 53 | # Package arch-specific prebuilts |
| 54 | ( |
| 55 | cd ${SOONG_OUT}/dist |
| 56 | zip -qryX build-prebuilts.zip * |
| 57 | ) |
| 58 | |
| 59 | if [ -n "${DIST_DIR}" ]; then |
| 60 | mkdir -p ${DIST_DIR} || true |
| 61 | cp ${SOONG_OUT}/dist/build-prebuilts.zip ${DIST_DIR}/ |
| 62 | fi |