blob: c0483fa97ce39385afd419f556f2b46864d6e280 [file] [log] [blame]
Prashant Dubey01021952023-07-19 17:18:03 +00001 #!/bin/bash
2#
3# Copyright (C) 2023 The Android Open Source Project
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
17set -e
18
19if [ ! -e 'build/make/core/Makefile' ]; then
20 echo "Script $0 needs to be run at the root of the android tree"
21 exit 1
22fi
23
24vars="$(build/soong/soong_ui.bash --dumpvars-mode --vars="OUT_DIR DIST_DIR")"
25# Assign to a variable and eval that, since bash ignores any error status from
26# the command substitution if it's directly on the eval line.
27eval $vars
28
29HOST_BINARIES=(
30 ${OUT_DIR}/host/linux-x86/bin/dex2oat64
31 ${OUT_DIR}/host/linux-x86/bin/dex2oatd64
32 ${OUT_DIR}/host/linux-x86/bin/dex2oat
33 ${OUT_DIR}/host/linux-x86/bin/dex2oatd
34 ${OUT_DIR}/host/linux-x86/bin/deapexer
35 ${OUT_DIR}/host/linux-x86/bin/debugfs_static
Prashant Dubey1c168a62023-12-20 17:11:54 +000036 ${OUT_DIR}/host/linux-x86/bin/oatdump
Prashant Dubey01021952023-07-19 17:18:03 +000037)
38
Prashant Dubey1c168a62023-12-20 17:11:54 +000039# Build statically linked musl binaries for linux-x86 hosts without the
Prashant Dubey01021952023-07-19 17:18:03 +000040# standard glibc implementation.
41build/soong/soong_ui.bash --make-mode USE_HOST_MUSL=true BUILD_HOST_static=true ${HOST_BINARIES[*]}
Prashant Dubey1c168a62023-12-20 17:11:54 +000042# Zip these binaries in a temporary file
43prebuilts/build-tools/linux-x86/bin/soong_zip -o "${DIST_DIR}/temp-host-tools.zip" \
Prashant Dubey01021952023-07-19 17:18:03 +000044 -j ${HOST_BINARIES[*]/#/-f }
Prashant Dubey1c168a62023-12-20 17:11:54 +000045
46# Build art_release.zip and copy only art jars in a temporary zip
Prashant Dubey29395e82023-12-22 14:17:01 +000047build/soong/soong_ui.bash --make-mode dist "${DIST_DIR}/art_release.zip"
48prebuilts/build-tools/linux-x86/bin/zip2zip -i "${DIST_DIR}/art_release.zip" \
Prashant Dubey1c168a62023-12-20 17:11:54 +000049 -o "${DIST_DIR}/temp-art-jars.zip" "bootjars/*"
50
51# Merge both temporary zips into output zip
52prebuilts/build-tools/linux-x86/bin/merge_zips "${DIST_DIR}/art-host-tools-linux-x86.zip" \
53 "${DIST_DIR}/temp-host-tools.zip" "${DIST_DIR}/temp-art-jars.zip"
54
55# Delete temporary zips
56rm "${DIST_DIR}/temp-host-tools.zip" "${DIST_DIR}/temp-art-jars.zip"