Prashant Dubey | 0102195 | 2023-07-19 17:18:03 +0000 | [diff] [blame] | 1 | #!/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 | |
| 17 | set -e |
| 18 | |
| 19 | if [ ! -e 'build/make/core/Makefile' ]; then |
| 20 | echo "Script $0 needs to be run at the root of the android tree" |
| 21 | exit 1 |
| 22 | fi |
| 23 | |
| 24 | vars="$(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. |
| 27 | eval $vars |
| 28 | |
| 29 | HOST_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 Dubey | 1c168a6 | 2023-12-20 17:11:54 +0000 | [diff] [blame] | 36 | ${OUT_DIR}/host/linux-x86/bin/oatdump |
Prashant Dubey | 0102195 | 2023-07-19 17:18:03 +0000 | [diff] [blame] | 37 | ) |
| 38 | |
Prashant Dubey | 1c168a6 | 2023-12-20 17:11:54 +0000 | [diff] [blame] | 39 | # Build statically linked musl binaries for linux-x86 hosts without the |
Prashant Dubey | 0102195 | 2023-07-19 17:18:03 +0000 | [diff] [blame] | 40 | # standard glibc implementation. |
| 41 | build/soong/soong_ui.bash --make-mode USE_HOST_MUSL=true BUILD_HOST_static=true ${HOST_BINARIES[*]} |
Prashant Dubey | 1c168a6 | 2023-12-20 17:11:54 +0000 | [diff] [blame] | 42 | # Zip these binaries in a temporary file |
| 43 | prebuilts/build-tools/linux-x86/bin/soong_zip -o "${DIST_DIR}/temp-host-tools.zip" \ |
Prashant Dubey | 0102195 | 2023-07-19 17:18:03 +0000 | [diff] [blame] | 44 | -j ${HOST_BINARIES[*]/#/-f } |
Prashant Dubey | 1c168a6 | 2023-12-20 17:11:54 +0000 | [diff] [blame] | 45 | |
| 46 | # Build art_release.zip and copy only art jars in a temporary zip |
Prashant Dubey | 29395e8 | 2023-12-22 14:17:01 +0000 | [diff] [blame] | 47 | build/soong/soong_ui.bash --make-mode dist "${DIST_DIR}/art_release.zip" |
| 48 | prebuilts/build-tools/linux-x86/bin/zip2zip -i "${DIST_DIR}/art_release.zip" \ |
Prashant Dubey | 1c168a6 | 2023-12-20 17:11:54 +0000 | [diff] [blame] | 49 | -o "${DIST_DIR}/temp-art-jars.zip" "bootjars/*" |
| 50 | |
| 51 | # Merge both temporary zips into output zip |
| 52 | prebuilts/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 |
| 56 | rm "${DIST_DIR}/temp-host-tools.zip" "${DIST_DIR}/temp-art-jars.zip" |