veilidchat/dev-setup/setup_linux.sh

42 lines
1.1 KiB
Bash
Raw Permalink Normal View History

2023-01-11 02:04:18 +00:00
#!/bin/bash
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
source $SCRIPTDIR/_script_common
if [[ "$(uname)" != "Linux" ]]; then
echo Not running Linux
exit 1
fi
if [ "$(lsb_release -d | grep -qEi 'debian|buntu|mint')" ]; then
echo Not a supported Linux
exit 1
fi
2023-07-07 23:33:28 +00:00
# run setup for veilid
2023-09-30 00:28:37 +00:00
$VEILIDDIR/dev-setup/setup_linux.sh
2023-11-16 12:51:55 +00:00
# Install protoc
$SCRIPTDIR/install_protoc_linux.sh
2023-07-07 23:33:28 +00:00
# run setup for veilid_flutter
Disrecommend Flutter snap (Corrosion builds fail) If Flutter has not been installed before building VeilidChat on Linux, the user can end up with CMake 3.16.3 and encounter errors for Corrosion files that require CMake 3.22 or later. Unfortunately, recovering from this is apparently more complex than putting a newer cmake earlier in the PATH, so it's perhaps best not to obtain CMake 3.16.3 in the first place. The set of conflicts that cause this issue to exist include: veilidchat indirectly recommends the Flutter snap: https://gitlab.com/veilid/veilidchat/-/blob/268b86d1319d3bd77dff857c7154250679a081ef/setup_linux.sh#L19 https://gitlab.com/veilid/veilid/-/blob/f59c4509ea7e0c0e8b1088138a6eb5297844b112/veilid-flutter/setup_flutter.sh#L23 https://docs.flutter.dev/get-started/install https://docs.flutter.dev/get-started/install/linux "The easiest way to install Flutter on Linux is by using snapd." Flutter apparently requires CMake 3.16.3 and someone is not especially interested in newer versions. Historically, CMake in the Flutter snap has been multiple minor versions behind upstream CMake (e.g., 3.10 when a user needed 3.16, 3.16 when a user needed 3.22, etc.): https://github.com/flutter/flutter/blob/9427b77376d22ceb2c02174ac65dfe9983377a6e/packages/flutter_tools/test/general.shard/linux/linux_doctor_test.dart#L120 https://github.com/canonical/flutter-snap/issues/53 https://github.com/flutter/flutter/issues/101726#issuecomment-1095681610 "We discourage plugin developers from requiring a newer version of CMake than Flutter requires, but we cannot control what third-party developers do. ... If you want to use the snap installation, and want an update with a newer version of CMake, you'd need to file a request at https://github.com/canonical/flutter-snap" When the Flutter snap is installed, flutter commands execute cmake from within the snap's read-only filesystem, and do not use the cmake found in the PATH. This may lead to challenges regardless of whether the user already has a /usr/bin/cmake that is recent enough, or whether the user needs to replace /usr/bin/cmake by following the https://apt.kitware.com process. 3.16.3 is not recent enough because veilid uses Corrosion from GitHub: https://gitlab.com/veilid/veilid/-/blob/f59c4509ea7e0c0e8b1088138a6eb5297844b112/veilid-flutter/linux/rust.cmake#L11 https://corrosion-rs.github.io/corrosion/ "The master branch of Corrosion currently requires CMake 3.22 or newer."
2023-10-01 17:43:42 +00:00
echo 'If prompted to install Flutter, choose an installation bundle (storage.googleapis.com), not snap.'
2023-07-07 23:33:28 +00:00
$VEILIDDIR/veilid-flutter/setup_flutter.sh
# ensure protoc is installed
if command -v protoc &> /dev/null; then
echo '[X] protoc is available in the path'
else
echo 'protoc is not available in the path'
exit 1
fi
# Install protoc-gen-dart
dart pub global activate protoc_plugin
if command -v protoc-gen-dart &> /dev/null; then
echo '[X] protoc-gen-dart is available in the path'
else
echo 'protoc-gen-dart is not available in the path. Add "$HOME/.pub-cache/bin" to your path.'
exit 1
fi