xamarin-macios/configure

229 строки
6.9 KiB
Bash
Executable File

#!/bin/bash -e
function show_help () {
cat <<EOL
Usage: configure [options]
-h, --help Displays this help
--disable-mac Disable most of the Mac-related parts.
--disable-ios Disable most of the iOS-related parts.
The iOS build depend on some parts of the Mac build, so
a complete separation is not possible (neither desirable,
some parts will always be enabled to catch common programmer
errors causing build breaks).
The main reasons for disabling either part is to have faster
builds and disable the non-relevant tests.
--disable-ios-device Disables all device-related parts from the iOS build.
This can be used to speed up the build.
--disable-strip: If executables should be stripped or not.
Disable to make it easier to debug executables using lldb.
--enable-ccache
--disable-ccache Enable/disable ccache. Default: enabled if detected.
--enable-xamarin
--disable-xamarin Enable/disable additional Xamarin-specific parts of the build.
--disable-packaged-llvm Compile LLVM instead of downloading a precompiled version.
--enable-packaged-mono
--disable-packaged-mono Enable/disable using the precompiled version of mono. If disabled mono will be compiled from source.
--enable-dotnet Enable building .NET 6 bits.
--disable-dotnet Disable building .NET 6 bits.
--enable-documentation Enable building of API documentation
--disable-documentation Disable building of API documentation.
--enable-legacy-xamarin Enable building the legacy version of Xamarin.iOS/Xamarin.Mac.
--disable-legacy-xamarin Disable building the legacy version of Xamarin.iOS/Xamarin.Mac.
--custom-dotnet=[artifacts] Use a locally built version of dotnet/runtime. See docs/CORECLR.md for detailed instructions about how to build dotnet/runtime from source.
--ignore-unknown-params alters the default behavior to not return an non-zero exit code when an unknown parameter is provided.
EOL
}
cd "$(dirname "${BASH_SOURCE[0]}")"
CONFIGURED_FILE=configure.inc
IGNORE_UNKNOWN_PARAMS=false
UNKNOWN_PARAMETERS=
rm -f $CONFIGURED_FILE
if test -z "$1"; then
echo "configure: all default values assumed."
exit 0
fi
echo "# Configure arguments: $*" >> $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_WATCH=" >> $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-watchos)
echo "INCLUDE_WATCH=" >> $CONFIGURED_FILE
echo "watchOS Build disabled"
shift
;;
--enable-watchos)
echo "INCLUDE_WATCH=1" >> $CONFIGURED_FILE
echo "watchOS 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)
echo "ENABLE_DOTNET=1" >> "$CONFIGURED_FILE"
shift
;;
--disable-dotnet)
echo "ENABLE_DOTNET=" >> "$CONFIGURED_FILE"
shift
;;
--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 "INCLUDE_XAMARIN_LEGACY=1" >> "$CONFIGURED_FILE"
shift
;;
--disable-legacy-xamarin)
echo "INCLUDE_XAMARIN_LEGACY=" >> "$CONFIGURED_FILE"
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