2024-02-28 19:21:08 +01:00
|
|
|
#!/bin/bash
|
2025-04-30 14:06:26 +02:00
|
|
|
# Script to build NetBird mobile bindings using gomobile
|
|
|
|
|
# Usage: ./script.sh [version]
|
|
|
|
|
# If no version is provided, "development" is used as default
|
2024-02-28 19:21:08 +01:00
|
|
|
set -e
|
|
|
|
|
|
2025-04-30 14:06:26 +02:00
|
|
|
# Set version from the first argument or use "development" as default
|
|
|
|
|
version=${1:-development}
|
|
|
|
|
app_path=$(pwd)
|
2024-02-28 19:21:08 +01:00
|
|
|
|
2025-04-30 14:06:26 +02:00
|
|
|
cd netbird
|
2024-02-28 19:21:08 +01:00
|
|
|
gomobile init
|
|
|
|
|
|
2025-04-30 14:06:26 +02:00
|
|
|
CGO_ENABLED=0 gomobile bind \
|
|
|
|
|
-o $app_path/gomobile/netbird.aar \
|
|
|
|
|
-javapkg=io.netbird.gomobile \
|
|
|
|
|
-ldflags="-X golang.zx2c4.com/wireguard/ipc.socketDirectory=/data/data/io.netbird.client/cache/wireguard -X github.com/netbirdio/netbird/version.version=$version" \
|
|
|
|
|
$(pwd)/client/android
|
|
|
|
|
|
|
|
|
|
cd - > /dev/null
|