mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-05-06 00:05:00 -04:00
refactor setup
This commit is contained in:
parent
bbde85a134
commit
e8046e9a89
9 changed files with 96 additions and 42 deletions
16
dev-setup/_script_common
Normal file
16
dev-setup/_script_common
Normal file
|
@ -0,0 +1,16 @@
|
|||
set -eo pipefail
|
||||
|
||||
get_abs_filename() {
|
||||
# $1 : relative filename
|
||||
echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
|
||||
}
|
||||
|
||||
# Veilid location
|
||||
VEILIDDIR=$(get_abs_filename "$SCRIPTDIR/../../veilid")
|
||||
if [ ! -d "$VEILIDDIR" ]; then
|
||||
echo 'Veilid git clone needs to be at $VEILIDDIR'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# VeilidChat location
|
||||
VEILIDCHATDIR=$(get_abs_filename "$SCRIPTDIR/../../veilid")
|
35
dev-setup/flutter_config.sh
Executable file
35
dev-setup/flutter_config.sh
Executable file
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Run this if you regenerate and need to reconfigure platform specific make system project files
|
||||
#
|
||||
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
source $SCRIPTDIR/_script_common
|
||||
|
||||
# iOS: Set deployment target
|
||||
sed -i '' 's/IPHONEOS_DEPLOYMENT_TARGET = [^;]*/IPHONEOS_DEPLOYMENT_TARGET = 12.4/g' $VEILIDCHATDIR/ios/Runner.xcodeproj/project.pbxproj
|
||||
sed -i '' "s/platform :ios, '[^']*'/platform :ios, '12.4'/g" $VEILIDCHATDIR/ios/Podfile
|
||||
|
||||
# MacOS: Set deployment target
|
||||
sed -i '' 's/MACOSX_DEPLOYMENT_TARGET = [^;]*/MACOSX_DEPLOYMENT_TARGET = 10.14.6/g' $VEILIDCHATDIR/macos/Runner.xcodeproj/project.pbxproj
|
||||
sed -i '' "s/platform :osx, '[^']*'/platform :osx, '10.14.6'/g" $VEILIDCHATDIR/macos/Podfile
|
||||
|
||||
# Android: Set NDK version
|
||||
if [[ "$TMPDIR" != "" ]]; then
|
||||
ANDTMP=$TMPDIR/andtmp_$(date +%s)
|
||||
else
|
||||
ANDTMP=/tmp/andtmp_$(date +%s)
|
||||
fi
|
||||
cat <<EOF > $ANDTMP
|
||||
ndkVersion '25.1.8937393'
|
||||
EOF
|
||||
sed -i '' -e "/android {/r $ANDTMP" $VEILIDCHATDIR/android/app/build.gradle
|
||||
rm -- $ANDTMP
|
||||
|
||||
# Android: Set min sdk version
|
||||
sed -i '' 's/minSdkVersion .*/minSdkVersion Math.max(flutter.minSdkVersion, 24)/g' $VEILIDCHATDIR/android/app/build.gradle
|
||||
|
||||
# Android: Set gradle plugin version
|
||||
sed -i '' "s/classpath \'com.android.tools.build:gradle:[^\']*\'/classpath 'com.android.tools.build:gradle:7.2.0'/g" $VEILIDCHATDIR/android/build.gradle
|
||||
|
||||
# Android: Set gradle version
|
||||
sed -i '' 's/distributionUrl=.*/distributionUrl=https:\/\/services.gradle.org\/distributions\/gradle-7.3.3-all.zip/g' $VEILIDCHATDIR/android/gradle/wrapper/gradle-wrapper.properties
|
37
dev-setup/install_protoc_linux.sh
Executable file
37
dev-setup/install_protoc_linux.sh
Executable file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
PROTOC_VERSION="24.3" # Keep in sync with veilid-core/build.rs
|
||||
|
||||
UNAME_M=$(uname -m)
|
||||
if [[ "$UNAME_M" == "x86_64" ]]; then
|
||||
PROTOC_ARCH=x86_64
|
||||
elif [[ "$UNAME_M" == "aarch64" ]]; then
|
||||
PROTOC_ARCH=aarch_64
|
||||
else
|
||||
echo Unsupported build architecture
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir /tmp/protoc-install
|
||||
pushd /tmp/protoc-install
|
||||
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-linux-$PROTOC_ARCH.zip
|
||||
unzip protoc-$PROTOC_VERSION-linux-$PROTOC_ARCH.zip
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
if command -v checkinstall &> /dev/null; then
|
||||
sudo checkinstall --pkgversion=$PROTOC_VERSION -y cp -r bin include /usr/local/
|
||||
cp *.deb ~
|
||||
else
|
||||
sudo cp -r bin include /usr/local/
|
||||
fi
|
||||
popd
|
||||
sudo rm -rf /tmp/protoc-install
|
||||
else
|
||||
if command -v checkinstall &> /dev/null; then
|
||||
checkinstall --pkgversion=$PROTOC_VERSION -y cp -r bin include /usr/local/
|
||||
cp *.deb ~
|
||||
else
|
||||
cp -r bin include /usr/local/
|
||||
fi
|
||||
popd
|
||||
rm -rf /tmp/protoc-install
|
||||
fi
|
41
dev-setup/setup_linux.sh
Executable file
41
dev-setup/setup_linux.sh
Executable file
|
@ -0,0 +1,41 @@
|
|||
#!/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
|
||||
|
||||
|
||||
# run setup for veilid
|
||||
$VEILIDDIR/dev-setup/setup_linux.sh
|
||||
|
||||
# Install protoc
|
||||
$SCRIPTDIR/install_protoc_linux.sh
|
||||
|
||||
# run setup for veilid_flutter
|
||||
echo 'If prompted to install Flutter, choose an installation bundle (storage.googleapis.com), not snap.'
|
||||
$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
|
46
dev-setup/setup_macos.sh
Executable file
46
dev-setup/setup_macos.sh
Executable file
|
@ -0,0 +1,46 @@
|
|||
#!/bin/bash
|
||||
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
source $SCRIPTDIR/_script_common
|
||||
|
||||
if [[ "$(uname)" != "Darwin" ]]; then
|
||||
echo Not running MacOS
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# run setup for veilid
|
||||
$VEILIDDIR/dev-setup/setup_macos.sh
|
||||
|
||||
# ensure packages are installed
|
||||
if [ "$BREW_USER" == "" ]; then
|
||||
if [ -d /opt/homebrew ]; then
|
||||
BREW_USER=`ls -lad /opt/homebrew/. | cut -d\ -f4`
|
||||
echo "Must sudo to homebrew user \"$BREW_USER\" to install capnp package:"
|
||||
elif [ -d /usr/local/Homebrew ]; then
|
||||
BREW_USER=`ls -lad /usr/local/Homebrew/. | cut -d\ -f4`
|
||||
echo "Must sudo to homebrew user \"$BREW_USER\" to install capnp package:"
|
||||
else
|
||||
echo "Homebrew is not installed in the normal place. Trying as current user"
|
||||
BREW_USER=`whoami`
|
||||
fi
|
||||
fi
|
||||
sudo -H -u $BREW_USER brew install protobuf
|
||||
|
||||
# run setup for veilid_flutter
|
||||
$VEILIDDIR/veilid-flutter/setup_flutter.sh
|
||||
|
||||
# ensure unzip 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
|
26
dev-setup/setup_windows.bat
Normal file
26
dev-setup/setup_windows.bat
Normal file
|
@ -0,0 +1,26 @@
|
|||
@echo off
|
||||
setlocal
|
||||
|
||||
REM #############################################
|
||||
|
||||
CALL ..\..\veilid\dev-setup\setup_windows.bat
|
||||
|
||||
PUSHD %~dp0\..
|
||||
SET VEILIDCHATDIR=%CD%
|
||||
POPD
|
||||
|
||||
IF NOT DEFINED ProgramFiles(x86) (
|
||||
echo This script requires a 64-bit Windows Installation. Exiting.
|
||||
goto end
|
||||
)
|
||||
|
||||
FOR %%X IN (protoc.exe) DO (SET PROTOC_FOUND=%%~$PATH:X)
|
||||
IF NOT DEFINED PROTOC_FOUND (
|
||||
echo protobuf compiler ^(protoc^) is required but it's not installed. Install protoc 23.2 or higher. Ensure it is in your path. Aborting.
|
||||
echo protoc is available here: https://github.com/protocolbuffers/protobuf/releases/download/v23.2/protoc-23.2-win64.zip
|
||||
goto end
|
||||
)
|
||||
|
||||
echo Setup successful
|
||||
:end
|
||||
ENDLOCAL
|
25
dev-setup/wasm_update.sh
Executable file
25
dev-setup/wasm_update.sh
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
source $SCRIPTDIR/_script_common
|
||||
|
||||
pushd $SCRIPTDIR >/dev/null
|
||||
|
||||
# WASM output dir
|
||||
WASMDIR=$VEILIDCHATDIR/web/wasm
|
||||
|
||||
# Build veilid-wasm, passing any arguments here to the build script
|
||||
pushd $VEILIDDIR/veilid-wasm >/dev/null
|
||||
PKGDIR=$(./wasm_build.sh $@ | grep SUCCESS:OUTPUTDIR | cut -d= -f2)
|
||||
popd >/dev/null
|
||||
|
||||
# Copy wasm blob into place
|
||||
echo Updating WASM from $PKGDIR to $WASMDIR
|
||||
if [ -d $WASMDIR ]; then
|
||||
rm -f $WASMDIR/*
|
||||
fi
|
||||
mkdir -p $WASMDIR
|
||||
cp -f $PKGDIR/* $WASMDIR/
|
||||
|
||||
#### Done
|
||||
|
||||
popd >/dev/null
|
Loading…
Add table
Add a link
Reference in a new issue