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