1*795d594fSAndroid Build Coastguard Worker #!/bin/bash 2*795d594fSAndroid Build Coastguard Worker# 3*795d594fSAndroid Build Coastguard Worker# Copyright (C) 2023 The Android Open Source Project 4*795d594fSAndroid Build Coastguard Worker# 5*795d594fSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License"); 6*795d594fSAndroid Build Coastguard Worker# you may not use this file except in compliance with the License. 7*795d594fSAndroid Build Coastguard Worker# You may obtain a copy of the License at 8*795d594fSAndroid Build Coastguard Worker# 9*795d594fSAndroid Build Coastguard Worker# http://www.apache.org/licenses/LICENSE-2.0 10*795d594fSAndroid Build Coastguard Worker# 11*795d594fSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software 12*795d594fSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS, 13*795d594fSAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14*795d594fSAndroid Build Coastguard Worker# See the License for the specific language governing permissions and 15*795d594fSAndroid Build Coastguard Worker# limitations under the License. 16*795d594fSAndroid Build Coastguard Worker 17*795d594fSAndroid Build Coastguard Workerset -e 18*795d594fSAndroid Build Coastguard Worker 19*795d594fSAndroid Build Coastguard Workerif [ ! -e 'build/make/core/Makefile' ]; then 20*795d594fSAndroid Build Coastguard Worker echo "Script $0 needs to be run at the root of the android tree" 21*795d594fSAndroid Build Coastguard Worker exit 1 22*795d594fSAndroid Build Coastguard Workerfi 23*795d594fSAndroid Build Coastguard Worker 24*795d594fSAndroid Build Coastguard Workervars="$(build/soong/soong_ui.bash --dumpvars-mode --vars="OUT_DIR DIST_DIR")" 25*795d594fSAndroid Build Coastguard Worker# Assign to a variable and eval that, since bash ignores any error status from 26*795d594fSAndroid Build Coastguard Worker# the command substitution if it's directly on the eval line. 27*795d594fSAndroid Build Coastguard Workereval $vars 28*795d594fSAndroid Build Coastguard Worker 29*795d594fSAndroid Build Coastguard WorkerHOST_BINARIES=( 30*795d594fSAndroid Build Coastguard Worker ${OUT_DIR}/host/linux-x86/bin/dex2oat64 31*795d594fSAndroid Build Coastguard Worker ${OUT_DIR}/host/linux-x86/bin/dex2oatd64 32*795d594fSAndroid Build Coastguard Worker ${OUT_DIR}/host/linux-x86/bin/dex2oat 33*795d594fSAndroid Build Coastguard Worker ${OUT_DIR}/host/linux-x86/bin/dex2oatd 34*795d594fSAndroid Build Coastguard Worker ${OUT_DIR}/host/linux-x86/bin/deapexer 35*795d594fSAndroid Build Coastguard Worker ${OUT_DIR}/host/linux-x86/bin/debugfs_static 36*795d594fSAndroid Build Coastguard Worker ${OUT_DIR}/host/linux-x86/bin/oatdump 37*795d594fSAndroid Build Coastguard Worker) 38*795d594fSAndroid Build Coastguard Worker 39*795d594fSAndroid Build Coastguard Worker# Build statically linked musl binaries for linux-x86 hosts without the 40*795d594fSAndroid Build Coastguard Worker# standard glibc implementation. 41*795d594fSAndroid Build Coastguard Workerbuild/soong/soong_ui.bash --make-mode USE_HOST_MUSL=true BUILD_HOST_static=true ${HOST_BINARIES[*]} 42*795d594fSAndroid Build Coastguard Worker# Zip these binaries in a temporary file 43*795d594fSAndroid Build Coastguard Workerprebuilts/build-tools/linux-x86/bin/soong_zip -o "${DIST_DIR}/temp-host-tools.zip" \ 44*795d594fSAndroid Build Coastguard Worker -j ${HOST_BINARIES[*]/#/-f } 45*795d594fSAndroid Build Coastguard Worker 46*795d594fSAndroid Build Coastguard Worker# Build art_release.zip and copy only art jars in a temporary zip 47*795d594fSAndroid Build Coastguard Workerbuild/soong/soong_ui.bash --make-mode dist "${DIST_DIR}/art_release.zip" 48*795d594fSAndroid Build Coastguard Workerprebuilts/build-tools/linux-x86/bin/zip2zip -i "${DIST_DIR}/art_release.zip" \ 49*795d594fSAndroid Build Coastguard Worker -o "${DIST_DIR}/temp-art-jars.zip" "bootjars/*" 50*795d594fSAndroid Build Coastguard Worker 51*795d594fSAndroid Build Coastguard Worker# Merge both temporary zips into output zip 52*795d594fSAndroid Build Coastguard Workerprebuilts/build-tools/linux-x86/bin/merge_zips "${DIST_DIR}/art-host-tools-linux-x86.zip" \ 53*795d594fSAndroid Build Coastguard Worker "${DIST_DIR}/temp-host-tools.zip" "${DIST_DIR}/temp-art-jars.zip" 54*795d594fSAndroid Build Coastguard Worker 55*795d594fSAndroid Build Coastguard Worker# Delete temporary zips 56*795d594fSAndroid Build Coastguard Workerrm "${DIST_DIR}/temp-host-tools.zip" "${DIST_DIR}/temp-art-jars.zip" 57