mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
CW-1020 arm64 linux support (#2110)
* arm64 linux support * add missing dependencies to Dockerfile * run everything in docker to not break permissions * remove current linux dir * proper directory name * Clean up build script by removing .flatpak-builder directory flatpak before build process * account for arm64 in docs [skip ci] --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
parent
831e54498f
commit
eab91de9f6
10 changed files with 177 additions and 81 deletions
98
scripts/linux/build_cake_release.sh
Executable file
98
scripts/linux/build_cake_release.sh
Executable file
|
@ -0,0 +1,98 @@
|
|||
#!/bin/bash
|
||||
|
||||
# build_cake_release.sh - Script to build Cake Wallet for Linux
|
||||
# Usage: ./build_cake_release.sh --amd64 [--arm64] [--app=cakewallet|monero.com]
|
||||
|
||||
set -e
|
||||
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
|
||||
# Default values
|
||||
BUILD_AMD64=false
|
||||
BUILD_ARM64=false
|
||||
APP_TYPE="cakewallet"
|
||||
DOCKER_IMAGE="ghcr.io/cake-tech/cake_wallet:debian12-flutter3.27.4-go1.24.1"
|
||||
|
||||
# Parse arguments
|
||||
for arg in "$@"
|
||||
do
|
||||
case $arg in
|
||||
--amd64)
|
||||
BUILD_AMD64=true
|
||||
shift
|
||||
;;
|
||||
--arm64)
|
||||
BUILD_ARM64=true
|
||||
shift
|
||||
;;
|
||||
--app=*)
|
||||
APP_TYPE="${arg#*=}"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Unknown argument: $arg"
|
||||
echo "Usage: ./build_cake_release.sh --amd64 [--arm64] [--app=cakewallet|monero.com]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
cd ../..
|
||||
|
||||
# Validate arguments
|
||||
if [[ "$BUILD_AMD64" == "false" && "$BUILD_ARM64" == "false" ]]; then
|
||||
echo "Error: At least one architecture (--amd64 or --arm64) must be specified."
|
||||
echo "Usage: ./build_cake_release.sh --amd64 [--arm64] [--app=cakewallet|monero.com]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$APP_TYPE" != "cakewallet" && "$APP_TYPE" != "monero.com" ]]; then
|
||||
echo "Error: App type must be either 'cakewallet' or 'monero.com'"
|
||||
echo "Usage: ./build_cake_release.sh --amd64 [--arm64] [--app=cakewallet|monero.com]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Function to build for a specific architecture
|
||||
build_for_arch() {
|
||||
local arch=$1
|
||||
local flutter_arch=$2
|
||||
echo "Building $APP_TYPE for Linux ($arch)"
|
||||
|
||||
docker run --privileged -v$(pwd):$(pwd) -w $(pwd) -i --rm --platform linux/$arch $DOCKER_IMAGE bash -x << EOF
|
||||
set -x -e
|
||||
pushd scripts
|
||||
./gen_android_manifest.sh
|
||||
popd
|
||||
pushd scripts/linux
|
||||
source ./app_env.sh $APP_TYPE
|
||||
./app_config.sh
|
||||
./build_monero_all.sh
|
||||
popd
|
||||
flutter clean
|
||||
./model_generator.sh
|
||||
dart run tool/generate_localization.dart
|
||||
flutter build linux
|
||||
rm -rf build/linux/current
|
||||
cp -r build/linux/$flutter_arch build/linux/current
|
||||
rm -rf .flatpak-builder
|
||||
flatpak-builder --force-clean flatpak-build com.cakewallet.CakeWallet.yml
|
||||
flatpak build-export export flatpak-build
|
||||
flatpak build-bundle export build/linux/current/cake_wallet.flatpak com.cakewallet.CakeWallet
|
||||
cp build/linux/current/cake_wallet.flatpak build/linux/$flutter_arch/
|
||||
EOF
|
||||
}
|
||||
|
||||
# Build for specified architectures
|
||||
echo "Building $APP_TYPE for Linux"
|
||||
if [[ "$BUILD_AMD64" == "true" ]]; then
|
||||
build_for_arch "amd64" "x64"
|
||||
fi
|
||||
|
||||
if [[ "$BUILD_ARM64" == "true" ]]; then
|
||||
build_for_arch "arm64" "arm64"
|
||||
fi
|
||||
|
||||
echo "Build process completed."
|
|
@ -10,15 +10,19 @@ cd "$(dirname "$0")"
|
|||
for COIN in monero wownero;
|
||||
do
|
||||
pushd ../monero_c
|
||||
for target in x86_64-linux-gnu # aarch64-linux-gnu
|
||||
do
|
||||
if [[ -f "release/${COIN}/${target}_libwallet2_api_c.so" ]];
|
||||
then
|
||||
echo "file exist, not building monero_c for ${COIN}/$target.";
|
||||
else
|
||||
./build_single.sh ${COIN} $target -j$MAKE_JOB_COUNT
|
||||
unxz -f ../monero_c/release/${COIN}/${target}_libwallet2_api_c.so.xz
|
||||
fi
|
||||
done
|
||||
# Determine target architecture based on system architecture
|
||||
if [[ $(uname -m) == "arm64" || $(uname -m) == "aarch64" ]]; then
|
||||
target="aarch64-linux-gnu"
|
||||
else
|
||||
target="x86_64-linux-gnu"
|
||||
fi
|
||||
|
||||
if [[ -f "release/${COIN}/${target}_libwallet2_api_c.so" ]];
|
||||
then
|
||||
echo "file exist, not building monero_c for ${COIN}/$target.";
|
||||
else
|
||||
./build_single.sh ${COIN} $target -j$MAKE_JOB_COUNT
|
||||
unxz -f ../monero_c/release/${COIN}/${target}_libwallet2_api_c.so.xz
|
||||
fi
|
||||
popd
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue