• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 ../../../python-build python-build
29    python3 python-build/generate_python_build.py --target fuchsia
30    PYTHONPATH=$PWD/python-build python3 generate_fuchsia_build.py
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 \
54    -Dplatforms=none \
55    -Dgallium-drivers= \
56    -Dvulkan-drivers=freedreno \
57    -Dfreedreno-kmds=magma \
58    -Dplatform-sdk-version=33 \
59    -Dshader-cache=disabled
60
61$BIN_DIR/../tools/bazel --bazelrc=fuchsia-build/third_party/fuchsia-infra-bazel-rules/config/common_config.bazelrc \
62    build --config=fuchsia_arm64 --platforms=@fuchsia_sdk//fuchsia/constraints/platforms:fuchsia_arm64 \
63    //:vulkan_freedreno
64