refactor setup

This commit is contained in:
Christien Rioux 2023-11-16 07:51:55 -05:00
parent bbde85a134
commit e8046e9a89
9 changed files with 96 additions and 42 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

View File

@ -6,8 +6,11 @@ get_abs_filename() {
}
# Veilid location
VEILIDDIR=$(get_abs_filename "$SCRIPTDIR/../veilid")
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")

View File

@ -6,12 +6,12 @@ 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' $SCRIPTDIR/ios/Runner.xcodeproj/project.pbxproj
sed -i '' "s/platform :ios, '[^']*'/platform :ios, '12.4'/g" $SCRIPTDIR/ios/Podfile
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' $SCRIPTDIR/macos/Runner.xcodeproj/project.pbxproj
sed -i '' "s/platform :osx, '[^']*'/platform :osx, '10.14.6'/g" $SCRIPTDIR/macos/Podfile
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
@ -22,14 +22,14 @@ fi
cat <<EOF > $ANDTMP
ndkVersion '25.1.8937393'
EOF
sed -i '' -e "/android {/r $ANDTMP" $SCRIPTDIR/android/app/build.gradle
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' $SCRIPTDIR/android/app/build.gradle
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" $SCRIPTDIR/android/build.gradle
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' $SCRIPTDIR/android/gradle/wrapper/gradle-wrapper.properties
sed -i '' 's/distributionUrl=.*/distributionUrl=https:\/\/services.gradle.org\/distributions\/gradle-7.3.3-all.zip/g' $VEILIDCHATDIR/android/gradle/wrapper/gradle-wrapper.properties

View 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

View File

@ -15,6 +15,10 @@ 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
@ -35,19 +39,3 @@ else
echo 'protoc-gen-dart is not available in the path. Add "$HOME/.pub-cache/bin" to your path.'
exit 1
fi
# # ensure rsync is installed
# if command -v rsync &> /dev/null; then
# echo '[X] rsync is available in the path'
# else
# echo 'rsync is not available in the path'
# exit 1
# fi
# # ensure sed is installed
# if command -v sed &> /dev/null; then
# echo '[X] sed is available in the path'
# else
# echo 'sed is not available in the path'
# exit 1
# fi

View File

@ -9,6 +9,22 @@ 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
@ -28,19 +44,3 @@ else
echo 'protoc-gen-dart is not available in the path. Add "$HOME/.pub-cache/bin" to your path.'
exit 1
fi
# # ensure rsync is installed
# if command -v rsync &> /dev/null; then
# echo '[X] rsync is available in the path'
# else
# echo 'rsync is not available in the path'
# exit 1
# fi
# # ensure sed is installed
# if command -v sed &> /dev/null; then
# echo '[X] sed is available in the path'
# else
# echo 'sed is not available in the path'
# exit 1
# fi

View 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

View File

@ -5,7 +5,7 @@ source $SCRIPTDIR/_script_common
pushd $SCRIPTDIR >/dev/null
# WASM output dir
WASMDIR=$SCRIPTDIR/web/wasm
WASMDIR=$VEILIDCHATDIR/web/wasm
# Build veilid-wasm, passing any arguments here to the build script
pushd $VEILIDDIR/veilid-wasm >/dev/null