From 9b2d281293174c9815e9d8db2cc2d94db8ce9bef Mon Sep 17 00:00:00 2001 From: Erdem Yerebasmaz Date: Mon, 6 May 2024 16:21:12 +0300 Subject: [PATCH] Add bash script counterpart of linux/windows targets build script ! This script is not being used by Melos and is added for local testing ! --- .../bindings-flutter/scripts/build_other.sh | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 lib/bindings/bindings-flutter/scripts/build_other.sh diff --git a/lib/bindings/bindings-flutter/scripts/build_other.sh b/lib/bindings/bindings-flutter/scripts/build_other.sh new file mode 100644 index 0000000..207cc81 --- /dev/null +++ b/lib/bindings/bindings-flutter/scripts/build_other.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# ! This script is not being used by Melos and is added for local testing ! + +# Setup +BUILD_DIR=platform-build +mkdir $BUILD_DIR +cd $BUILD_DIR + +# Install build dependencies +cargo install cargo-zigbuild +cargo install cargo-xwin + +zig_build () { + local TARGET="$1" + local PLATFORM_NAME="$2" + local LIBNAME="$3" + local PROFILE="$4" + rustup target add "$TARGET" + cargo zigbuild --package breez-liquid-sdk --target "$TARGET" --profile $PROFILE + mkdir "$PLATFORM_NAME" + cp "../../../target/$TARGET/$PROFILE/$LIBNAME" "$PLATFORM_NAME/" +} + +win_build () { + local TARGET="$1" + local PLATFORM_NAME="$2" + local LIBNAME="$3" + local PROFILE="$4" + rustup target add "$TARGET" + cargo xwin build --package breez-liquid-sdk --target "$TARGET" --profile $PROFILE + mkdir "$PLATFORM_NAME" + cp "../../../target/$TARGET/$PROFILE/$LIBNAME" "$PLATFORM_NAME/" +} + +PROFILE=frb-min +# Build all the dynamic libraries +LIBNAME=breez_liquid_sdk +LINUX_LIBNAME=lib$LIBNAME.so +zig_build aarch64-unknown-linux-gnu linux-arm64 $LINUX_LIBNAME $PROFILE +zig_build x86_64-unknown-linux-gnu linux-x64 $LINUX_LIBNAME $PROFILE +WINDOWS_LIBNAME=$LIBNAME.dll +win_build aarch64-pc-windows-msvc windows-arm64 $WINDOWS_LIBNAME $PROFILE +win_build x86_64-pc-windows-msvc windows-x64 $WINDOWS_LIBNAME $PROFILE + +# Archive the dynamic libs +tar -czvf other.tar.gz linux-* windows-* + +# Cleanup +rm -rf linux-* windows-* \ No newline at end of file