#!/usr/bin/env bash
# Copyright 2022 The Dawn & Tint Authors
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
#    list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
#    this list of conditions and the following disclaimer in the documentation
#    and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its
#    contributors may be used to endorse or promote products derived from
#    this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

set -e # Fail on any error.

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd )"
ROOT_DIR="$( cd "$SCRIPT_DIR/.." >/dev/null 2>&1 && pwd )"

POSSIBLE_BUILD_SYSTEMS="[gn|cmake]"
POSSIBLE_BUILD_TYPES="[debug|release]"
POSSIBLE_BUILD_ARCHS="[native|x86]"
BUILD_FUZZER=""

BUILD_SYSTEM=""
BUILD_TYPE=""
BUILD_ARCH=""

function show_usage() {
  echo "setup-build $POSSIBLE_BUILD_SYSTEMS $POSSIBLE_BUILD_TYPES $POSSIBLE_BUILD_ARCHS [fuzz|fuzzer]"
  echo
  echo "creates a build directory in <dawn>/out using either GN or CMake, then"
  echo "updates the '<dawn>/out/active' symlink to point to the build directory"
  echo "Specifying 'fuzz' or 'fuzzer' forces Clang to be used"
  if [[ ! -z "$1" ]]; then
    echo
    echo "$1"
  fi
  exit 1
}

function set_build_system() {
  if [[ ! -z "$BUILD_SYSTEM" ]]; then
    echo "conflicting build systems $BUILD_SYSTEM and $1"
    exit 1
  fi
  BUILD_SYSTEM=$1
}

function set_build_type() {
  if [[ ! -z "$BUILD_TYPE" ]]; then
    echo "conflicting build types $BUILD_TYPE and $1"
    exit 1
  fi
  BUILD_TYPE=$1
}

function set_build_arch() {
  if [[ ! -z "$BUILD_ARCH" ]]; then
    echo "conflicting build architectures $BUILD_ARCH and $1"
    exit 1
  fi
  BUILD_ARCH=$1
}

for arg in "$@"; do
  lowered_arg=$(echo "$arg" | tr '[:upper:]' '[:lower:]') # lowercase
  case $lowered_arg in
    "gn")
      set_build_system $lowered_arg
    ;;
    "cmake")
      set_build_system $lowered_arg
    ;;
    "debug")
      set_build_type $lowered_arg
    ;;
    "release")
      set_build_type $lowered_arg
    ;;
    "x86")
      set_build_arch $lowered_arg
    ;;
    "native")
    ;;
    "fuzz" | "fuzzer")
      BUILD_FUZZER=1
    ;;
    "--help" | "-help" | "-h")
      show_usage
    ;;
    *)
      show_usage "unknown argument '$arg'"
    ;;
  esac
done

if [[ -z "$BUILD_SYSTEM" ]]; then
  show_usage "build system $POSSIBLE_BUILD_SYSTEMS is required"
fi

if [[ -z "$BUILD_TYPE" ]]; then
  show_usage "build type $POSSIBLE_BUILD_TYPES required"
fi

BUILD_DIR="$BUILD_SYSTEM-$BUILD_TYPE"
if [[ ! -z "$BUILD_ARCH" ]]; then
  BUILD_DIR+="-$BUILD_ARCH"
fi
if [[ ! -z "$BUILD_FUZZER" ]]; then
  BUILD_DIR+="-fuzz"
fi

function generate() {
  pushd "$ROOT_DIR" > /dev/null
    mkdir -p "out/$BUILD_DIR"
    rm -fr "out/active" || true
    ln -s "$BUILD_DIR" "out/active"
    "$@"
  popd > /dev/null
}

case $BUILD_SYSTEM in
  "gn")
    GN_ARGS=""
    case $BUILD_TYPE in
      "debug")
        GN_ARGS+="is_debug=true"
      ;;
      "release")
        GN_ARGS+="is_debug=false"
      ;;
      *)
        show_usage "invalid build type '$BUILD_TYPE'"
      ;;
    esac
    case $BUILD_ARCH in
      "")
      ;;
      "x86")
        GN_ARGS+=" target_cpu=\"x86\""
      ;;
      *)
        show_usage "invalid build architecture '$BUILD_ARCH'"
      ;;
    esac
    if [[ -n "$BUILD_FUZZER" ]]; then
        GN_ARGS+=" use_libfuzzer=true"
    fi
    if [ -f "$ROOT_DIR/out/$BUILD_DIR/args.gn" ]; then
      generate "gn" "gen" "out/active" # keep existing args
    else
      generate "gn" "gen" "out/active" "--args=$GN_ARGS"
    fi
  ;;
  "cmake")
    CMAKE_FLAGS=()
    CMAKE_FLAGS+=("-DTINT_BUILD_GLSL_WRITER=1")
    CMAKE_FLAGS+=("-DTINT_BUILD_HLSL_WRITER=1")
    CMAKE_FLAGS+=("-DTINT_BUILD_MSL_WRITER=1")
    CMAKE_FLAGS+=("-DTINT_BUILD_SPV_WRITER=1")
    CMAKE_FLAGS+=("-DTINT_BUILD_WGSL_WRITER=1")
    CMAKE_FLAGS+=("-DTINT_BUILD_TINTD=1")
    CMAKE_FLAGS+=("-DDAWN_BUILD_NODE_BINDINGS=1")
    if [[ -n "$BUILD_FUZZER" ]]; then
        CMAKE_FLAGS+=("-DCMAKE_CXX_COMPILER=clang++")
        CMAKE_FLAGS+=("-DCMAKE_C_COMPILER=clang")
        CMAKE_FLAGS+=("-DTINT_BUILD_FUZZERS=ON")
    fi
    if [[ -x $(command -v ccache) ]]; then
      CMAKE_FLAGS+=("-DCMAKE_CXX_COMPILER_LAUNCHER=ccache")
    fi
    case $BUILD_TYPE in
      "debug")
        CMAKE_FLAGS+=("-DCMAKE_BUILD_TYPE=Debug")
      ;;
      "release")
        CMAKE_FLAGS+=("-DCMAKE_BUILD_TYPE=RelWithDebInfo")
      ;;
      *)
        show_usage "invalid build type '$BUILD_TYPE'"
      ;;
    esac
    case $BUILD_ARCH in
      "")
      ;;
      "x86")
        CMAKE_FLAGS+=("-DCMAKE_CXX_FLAGS=-m32")
        CMAKE_FLAGS+=("-DCMAKE_C_FLAGS=-m32")
      ;;
      *)
        show_usage "invalid build architecture '$BUILD_ARCH'"
      ;;
    esac
    generate "cmake"             \
             "-S" "."            \
             "-B" "out/active"   \
             "-GNinja"           \
             "${CMAKE_FLAGS[@]}"
  ;;
  *)
    echo "invalid build system '$BUILD_SYSTEM'"
    show_usage
  ;;
esac
