2022-01-16 17:45:42 -05:00
|
|
|
#!/bin/bash
|
|
|
|
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
|
|
|
|
|
|
OS="unknown"
|
|
|
|
if [ "$(uname)" == "Linux" ]; then
|
|
|
|
if [ ! "$(grep -Ei 'debian|buntu|mint' /etc/*release)" ]; then
|
|
|
|
echo Not a supported Linux
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
OS="linux"
|
|
|
|
elif [ "$(uname)" == "Darwin" ]; then
|
|
|
|
OS="macos"
|
|
|
|
fi
|
|
|
|
if [ "$OS" == "unknown" ]; then
|
|
|
|
echo "Not a supported operating system for this script"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# ensure flutter is installed
|
|
|
|
if command -v flutter &> /dev/null; then
|
2022-01-16 18:21:46 -05:00
|
|
|
echo '[X] Flutter is available in the path'
|
2022-01-16 17:45:42 -05:00
|
|
|
else
|
2022-01-16 18:21:46 -05:00
|
|
|
echo 'Flutter is not available in the path, install Flutter from here: https://docs.flutter.dev/get-started/install'
|
2022-01-16 17:45:42 -05:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# ensure dart is installed
|
|
|
|
if command -v dart &> /dev/null; then
|
2022-01-16 18:21:46 -05:00
|
|
|
echo '[X] Dart is available in the path'
|
2022-01-16 17:45:42 -05:00
|
|
|
else
|
2022-01-16 18:21:46 -05:00
|
|
|
echo 'Dart is not available in the path, check your environment variables and that Flutter is installed correctly'
|
2022-01-16 17:45:42 -05:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# ensure cargo is installed
|
|
|
|
if command -v cargo &> /dev/null; then
|
2022-01-16 18:21:46 -05:00
|
|
|
echo '[X] Cargo is available in the path'
|
2022-01-16 17:45:42 -05:00
|
|
|
else
|
2022-01-16 18:21:46 -05:00
|
|
|
echo 'Cargo is not available in the path, ensure Rust is installed correctly'
|
2022-01-16 17:45:42 -05:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# install cargo cbindgen
|
|
|
|
cargo install cbindgen
|
|
|
|
|
|
|
|
# install dart ffigen
|
|
|
|
dart pub global activate ffigen
|
|
|
|
|
|
|
|
# install flutter_rust_bridge_codegen
|
|
|
|
cargo install flutter_rust_bridge_codegen
|
|
|
|
|
2022-01-17 13:44:38 -05:00
|
|
|
# install just
|
|
|
|
cargo install just
|
|
|
|
|
2022-01-16 18:21:46 -05:00
|
|
|
# platform specific stuff
|
2022-01-16 17:45:42 -05:00
|
|
|
if [ "$OS" == "linux" ]; then
|
2022-01-16 18:21:46 -05:00
|
|
|
# ensure packages are installed
|
2022-01-17 10:17:32 -05:00
|
|
|
echo "Must sudo to root to install LLVM package:"
|
2022-01-16 17:45:42 -05:00
|
|
|
sudo apt-get install libclang-dev
|
2022-01-16 18:21:46 -05:00
|
|
|
|
|
|
|
# ensure platforms are enabled in flutter
|
|
|
|
flutter config --enable-linux-desktop --enable-android
|
|
|
|
|
2022-01-16 17:45:42 -05:00
|
|
|
elif [ "$OS" == "macos" ]; then
|
2022-01-16 18:21:46 -05:00
|
|
|
# ensure packages are installed
|
2022-01-17 10:11:39 -05:00
|
|
|
if [ "$BREW_USER" == "" ]; then
|
|
|
|
BREW_USER=`ls -lad /opt/homebrew/. | cut -d\ -f4`
|
2022-01-17 10:17:32 -05:00
|
|
|
echo "Must sudo to homebrew user \"$BREW_USER\" to install LLVM package:"
|
2022-01-17 10:11:39 -05:00
|
|
|
fi
|
|
|
|
sudo -H -u $BREW_USER brew install llvm
|
2022-01-17 10:17:32 -05:00
|
|
|
echo "Must sudo to root to install CocoaPods gem:"
|
2022-01-16 19:22:23 -05:00
|
|
|
sudo gem install cocoapods
|
|
|
|
|
2022-01-16 18:21:46 -05:00
|
|
|
# ensure platforms are enabled in flutter
|
|
|
|
flutter config --enable-macos-desktop --enable-ios --no-enable-android
|
|
|
|
fi
|
2022-01-16 17:45:42 -05:00
|
|
|
|
2022-01-16 19:22:23 -05:00
|
|
|
# turn off analytics
|
|
|
|
flutter config --no-analytics
|
|
|
|
dart --disable-analytics
|
|
|
|
|
2022-01-16 18:21:46 -05:00
|
|
|
# run flutter doctor
|
|
|
|
flutter doctor -v
|