blob: a2bbdc7b331b559d7be540ddbc9bf6de5b846f3b [file] [log] [blame]
Jayant Chowdharyea86c042018-01-25 12:07:55 -08001#!/bin/bash -ex
2
Logan Chienee954192018-10-04 10:52:41 +08003# 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 Chowdharyea86c042018-01-25 12:07:55 -080017if [ -z "${OUT_DIR}" ]; then
18 echo Must set OUT_DIR
19 exit 1
20fi
21
22TOP=$(pwd)
23
24UNAME="$(uname)"
25case "$UNAME" in
26Linux)
27 OS='linux'
28 ;;
29Darwin)
30 OS='darwin'
31 ;;
32*)
33 exit 1
34 ;;
35esac
36
37# ckati and makeparallel (Soong)
38SOONG_OUT=${OUT_DIR}/soong
39SOONG_HOST_OUT=${OUT_DIR}/soong/host/${OS}-x86
40rm -rf ${SOONG_OUT}
41mkdir -p ${SOONG_OUT}
42cat > ${SOONG_OUT}/soong.variables << EOF
43{
44 "Allow_missing_dependencies": true,
Dan Willemsen10516912018-08-28 20:16:29 -070045 "HostArch":"x86_64"
Jayant Chowdharyea86c042018-01-25 12:07:55 -080046}
47EOF
48SOONG_BINARIES=(
49 header-abi-linker
50 header-abi-dumper
51 header-abi-diff
52 merge-abi-diff
53)
54
55binaries=$(for i in "${SOONG_BINARIES[@]}"; do echo ${SOONG_HOST_OUT}/bin/${i}; done)
56
57# Build everything
58build/soong/soong_ui.bash --make-mode --skip-make \
59 ${binaries}
60
61# Copy arch-specific binaries
62mkdir -p ${SOONG_OUT}/dist/bin
63cp ${binaries} ${SOONG_OUT}/dist/bin/
64cp -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
72if [ -n "${DIST_DIR}" ]; then
73 mkdir -p ${DIST_DIR} || true
74 cp ${SOONG_OUT}/dist/build-prebuilts.zip ${DIST_DIR}/
75fi