#!/bin/bash -e function show_help () { cat <> $CONFIGURED_FILE while test "x$1" != x; do case $1 in --disable-all-platforms) echo "INCLUDE_MAC=" >> $CONFIGURED_FILE echo "INCLUDE_IOS=" >> $CONFIGURED_FILE echo "INCLUDE_TVOS=" >> $CONFIGURED_FILE echo "INCLUDE_MACCATALYST=" >> $CONFIGURED_FILE echo "Disabled all platforms" shift ;; --disable-mac | --disable-macos) echo "INCLUDE_MAC=" >> $CONFIGURED_FILE echo "Mac Build disabled" shift ;; --enable-mac | --enable-macos) echo "INCLUDE_MAC=1" >> $CONFIGURED_FILE echo "Mac Build enabled" shift ;; --disable-ios-device) echo "INCLUDE_DEVICE=" >> $CONFIGURED_FILE shift ;; --disable-ios) echo "INCLUDE_IOS=" >> $CONFIGURED_FILE echo "iOS Build disabled" shift ;; --enable-ios) echo "INCLUDE_IOS=1" >> $CONFIGURED_FILE echo "iOS Build enabled" shift ;; --disable-tvos) echo "INCLUDE_TVOS=" >> $CONFIGURED_FILE echo "tvOS Build disabled" shift ;; --enable-tvos) echo "INCLUDE_TVOS=1" >> $CONFIGURED_FILE echo "tvOS Build enabled" shift ;; --disable-maccatalyst) echo "INCLUDE_MACCATALYST=" >> $CONFIGURED_FILE echo "Mac Catalyst Build disabled" shift ;; --enable-maccatalyst) echo "INCLUDE_MACCATALYST=1" >> $CONFIGURED_FILE echo "Mac Catalyst Build enabled" shift ;; --disable-strip) echo "DISABLE_STRIP=1" >> $CONFIGURED_FILE shift ;; --disable-ccache) echo "ENABLE_CCACHE=" >> $CONFIGURED_FILE shift ;; --enable-ccache) if ! command -v ccache >/dev/null; then echo "Could not find ccache" else echo "ENABLE_CCACHE=1" >> $CONFIGURED_FILE echo "cache enabled" fi shift ;; --enable-xamarin) echo "ENABLE_XAMARIN=1" >> $CONFIGURED_FILE shift ;; --disable-xamarin) echo "ENABLE_XAMARIN=" >> $CONFIGURED_FILE shift ;; --disable-packaged-llvm) echo "DISABLE_DOWNLOAD_LLVM=1" >> $CONFIGURED_FILE shift ;; --enable-packaged-mono) echo "MONO_BUILD_FROM_SOURCE=" >> "$CONFIGURED_FILE" shift ;; --disable-packaged-mono) echo "MONO_BUILD_FROM_SOURCE=1" >> "$CONFIGURED_FILE" shift ;; --disable-packaged-mono=no | --disable-packaged-mono=false) echo "MONO_BUILD_FROM_SOURCE=" >> "$CONFIGURED_FILE" shift ;; --enable-dotnet) # This is the default, and there's no way do enable it, so ignore this argument shift ;; --disable-dotnet) echo "It's not possible to disable .NET anymore." exit 1 ;; --enable-dotnet-windows) echo "$1 is ignored. Use --enable-dotnet instead" shift ;; --disable-dotnet-windows) echo "$1 is ignored. Use --disable-dotnet instead" shift ;; --enable-legacy-xamarin) echo "It's not possible to enable legacy Xamarin anymore." exit 1 ;; --disable-legacy-xamarin) # This is the default, and there's no way do enable it, so ignore this argument shift ;; --custom-dotnet=*) echo "CUSTOM_DOTNET=1" >> "$CONFIGURED_FILE" echo "DOTNET_RUNTIME_PATH=${1:16}" >> "$CONFIGURED_FILE" shift ;; --custom-dotnet) echo "CUSTOM_DOTNET=1" >> "$CONFIGURED_FILE" echo "DOTNET_RUNTIME_PATH=$2" >> "$CONFIGURED_FILE" shift 2 ;; --ignore-unknown-params) echo "ignoring unknown parameters" IGNORE_UNKNOWN_PARAMS=true shift ;; --help|-h) show_help exit 0 ;; *) echo "Unknown configure argument $1" >&2 UNKNOWN_PARAMETERS="$UNKNOWN_PARAMETERS $1" shift ;; esac done if [[ "$IGNORE_UNKNOWN_PARAMS" = false ]] && [[ -n "$UNKNOWN_PARAMETERS" ]]; then exit 1 fi if [[ "$IGNORE_UNKNOWN_PARAMS" = true ]] && [[ -n "$UNKNOWN_PARAMETERS" ]]; then echo "The following parameters were ignored: $UNKNOWN_PARAMETERS" fi exit 0