1#!/bin/bash 2 3set -e 4 5if [ ! -f meson_options.txt ]; then 6 echo "Run this script from the repo root" 7 exit 1 8fi 9 10BIN_DIR=$(dirname "$0") 11ROOT_DIR=$BIN_DIR/../../.. 12PYTHON_BUILD=generate_fuchsia_build.py 13 14function unwrap_zlib { 15 rm -rf fuchsia-build/third_party/download fuchsia-build/third_party/zlib-* 16 SOURCE_URL=`grep -Eo 'http://[^ ]+zlib[0-9\.-]+\.tar\.gz' subprojects/zlib.wrap` 17 wget -P fuchsia-build/third_party/download $SOURCE_URL 18 tar -C fuchsia-build/third_party -xf fuchsia-build/third_party/download/zlib-* 19 20 PATCH_URL=`grep -Eo 'https://[^ ]+get_patch' subprojects/zlib.wrap` 21 wget -P fuchsia-build/third_party/download $PATCH_URL 22 # get_patch is a zip file 23 unzip -d fuchsia-build/third_party fuchsia-build/third_party/download/get_patch 24 25 pushd fuchsia-build/third_party/zlib-* 26 # Create an empty workspace 27 touch WORKSPACE.bazel 28 ln -s ../../../meson_to_hermetic meson_to_hermetic 29 python3 meson_to_hermetic/generate_python_build.py --target fuchsia 30 PYTHONPATH=$PWD/meson_to_hermetic python3 generate_fuchsia_build.py --config=meson_to_hermetic/fuchsia.toml 31 popd 32} 33 34REGEN=0 35if [ "$1" == "-regen" ]; then 36 REGEN=1 37fi 38if [ ! -f $PYTHON_BUILD ]; then 39 REGEN=1 40fi 41if [ ! -d fuchsia-build/third_party/zlib-* ]; then 42 REGEN=1 43fi 44 45if [ "$REGEN" == "1" ]; then 46 unwrap_zlib 47 time python3 $BIN_DIR/generate_python_build.py --target fuchsia 48else 49 echo "Python build found; use -regen to regenerate it" 50fi 51 52# Always generate Android.bp because it's fast 53PYTHONPATH=$BIN_DIR python3 generate_fuchsia_build.py --config=meson_to_hermetic/fuchsia.toml 54 55$BIN_DIR/../tools/bazel --bazelrc=fuchsia-build/third_party/fuchsia-infra-bazel-rules/config/common_config.bazelrc \ 56 build --config=fuchsia_arm64 --platforms=@fuchsia_sdk//fuchsia/constraints/platforms:fuchsia_arm64 \ 57 //:vulkan_freedreno 58