From e7aba3b7cbfb7fe0984bcc4bc7dff90680d24395 Mon Sep 17 00:00:00 2001 From: John Smith Date: Sun, 16 Jan 2022 17:45:42 -0500 Subject: [PATCH] flutter setup for linux --- setup_flutter.sh | 59 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100755 setup_flutter.sh diff --git a/setup_flutter.sh b/setup_flutter.sh new file mode 100755 index 00000000..06fb922b --- /dev/null +++ b/setup_flutter.sh @@ -0,0 +1,59 @@ +#!/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 + echo '[X] flutter is available in the path' +else + echo 'flutter is not available in the path, install flutter from here: https://docs.flutter.dev/get-started/install' + exit 1 +fi + +# ensure dart is installed +if command -v dart &> /dev/null; then + echo '[X] dart is available in the path' +else + echo 'dart is not available in the path, check your environment variables and that Flutter was installed correctly' + exit 1 +fi + +# ensure cargo is installed +if command -v cargo &> /dev/null; then + echo '[X] cargo is available in the path' +else + echo 'cargo is not available in the path, ensure Rust is installed correctly' + 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 + +# Ensure packages are installed +if [ "$OS" == "linux" ]; then + sudo apt-get install libclang-dev +elif [ "$OS" == "macos" ]; then + brew install llvm +fi + +