Merge upstream/dev (28 commits) [upstream-sync]

This commit is contained in:
upstream-sync-bot committed 2026-11-04 04:51:26 +00:00
commit 596e7f9dcd
44 files changed
+1444 -38

No files matched your search

+124 -2
View File
@@ -46,14 +46,136 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Read Linux SDK pin
id: linux-sdk
run: echo "version=$(jq -r '.flutter.version' scripts/appimage-tools.json)" >> "$GITHUB_OUTPUT"
- uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: ${{ steps.linux-sdk.outputs.version }}
cache: true
- name: Install Linux build deps
run: sudo apt-get update && sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev
run: |
sudo apt-get update
sudo apt-get install -y clang cmake ninja-build pkg-config jq libgtk-3-dev librsvg2-dev libgirepository1.0-dev libgtk-3-bin libgdk-pixbuf2.0-bin libgdk-pixbuf-2.0-dev dpkg-dev patchelf file desktop-file-utils xdg-user-dirs shellcheck libssl-dev libunwind-dev libvulkan-dev libgl1-mesa-dev libasound2-dev libsecret-1-dev
- uses: actions/cache@v4
with:
path: ~/.cache/meshcore-open/appimage
key: linux-appimage-x86_64-${{ hashFiles('scripts/appimage-tools.json') }}
- name: Test packaging contracts
run: |
shellcheck scripts/build_appimage.sh scripts/appimage/*.sh scripts/appimage/AppRun
bash scripts/appimage/test_packaging.sh
- run: flutter pub get
- run: flutter build linux --release --no-pub
- uses: docker/setup-buildx-action@v3
- name: Read AppImage base image
id: appimage-base
run: echo "image=$(jq -r '.ubuntu' scripts/appimage-tools.json)" >> "$GITHUB_OUTPUT"
- name: Build cached x86_64 runtime test image
uses: docker/build-push-action@v6
with:
context: scripts
file: scripts/appimage/Dockerfile
target: runtime-test
platforms: linux/amd64
build-args: |
BASE_IMAGE=${{ steps.appimage-base.outputs.image }}
tags: meshcore-appimage-runtime:ci
cache-from: type=gha,scope=meshcore-appimage-runtime-amd64
cache-to: type=gha,mode=max,scope=meshcore-appimage-runtime-amd64
load: true
- name: Test AppImage in clean Ubuntu
run: |
mkdir -p build/appimage-runtime
docker run --rm --stop-timeout 15 --user "$(id -u):$(id -g)" --mount "type=bind,source=$PWD/build/linux/x64/release/meshcore-open-x86_64.AppImage,target=/artifact.AppImage,readonly" --mount "type=bind,source=$PWD/scripts/appimage/test_runtime.sh,target=/test_runtime.sh,readonly" --mount "type=bind,source=$PWD/build/appimage-runtime,target=/results" meshcore-appimage-runtime:ci timeout --verbose --signal=TERM --kill-after=15s 300s xvfb-run -a bash /test_runtime.sh /artifact.AppImage /results
- uses: actions/upload-artifact@v4
if: always()
with:
name: linux-x86_64-appimage
path: |
build/linux/x64/release/meshcore-open-x86_64.AppImage
build/linux/x64/release/appimage-audit.txt
build/linux/x64/release/appimage-tools.json
build/appimage-runtime/
if-no-files-found: warn
linux-arm64:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- name: Read Flutter source pin
id: flutter-arm
run: echo "revision=$(jq -r '.flutter.source_revision' scripts/appimage-tools.json)" >> "$GITHUB_OUTPUT"
- name: Set up pinned native Flutter SDK
uses: subosito/flutter-action@v2
with:
channel: main
flutter-version: ${{ steps.flutter-arm.outputs.revision }}
architecture: arm64
git-source: https://github.com/flutter/flutter.git
cache: true
- name: Verify native ARM64 Flutter
env:
FLUTTER_REVISION: ${{ steps.flutter-arm.outputs.revision }}
run: |
test "$(uname -m)" = aarch64
mkdir -p build
flutter --version
flutter --version --machine > build/flutter-version.json
jq -e --arg revision "$FLUTTER_REVISION" '.frameworkVersion == "3.47.4" and .frameworkRevision == $revision' build/flutter-version.json
- name: Install Linux build deps
run: |
sudo apt-get update
sudo apt-get install -y clang cmake ninja-build pkg-config jq libgtk-3-dev librsvg2-dev libgirepository1.0-dev libgtk-3-bin libgdk-pixbuf2.0-bin libgdk-pixbuf-2.0-dev dpkg-dev patchelf file desktop-file-utils xdg-user-dirs shellcheck libssl-dev libunwind-dev libvulkan-dev libgl1-mesa-dev libasound2-dev libsecret-1-dev
- uses: actions/cache@v4
with:
path: ~/.cache/meshcore-open/appimage
key: linux-appimage-aarch64-${{ hashFiles('scripts/appimage-tools.json') }}
- name: Test packaging contracts
run: |
shellcheck scripts/build_appimage.sh scripts/appimage/*.sh scripts/appimage/AppRun
bash scripts/appimage/test_packaging.sh
- run: flutter pub get
- run: flutter test --reporter expanded
- name: Build ARM64 Linux release
run: |
if ! flutter build linux --release --no-pub --verbose > build/linux-arm64-build.log 2>&1; then
tail -n 200 build/linux-arm64-build.log
exit 1
fi
- uses: docker/setup-buildx-action@v3
- name: Read AppImage base image
id: appimage-base
run: echo "image=$(jq -r '.ubuntu' scripts/appimage-tools.json)" >> "$GITHUB_OUTPUT"
- name: Build cached ARM64 runtime test image
uses: docker/build-push-action@v6
with:
context: scripts
file: scripts/appimage/Dockerfile
target: runtime-test
platforms: linux/arm64
build-args: |
BASE_IMAGE=${{ steps.appimage-base.outputs.image }}
tags: meshcore-appimage-runtime-arm64:ci
cache-from: type=gha,scope=meshcore-appimage-runtime-arm64
cache-to: type=gha,mode=max,scope=meshcore-appimage-runtime-arm64
load: true
- name: Test ARM64 AppImage in clean Ubuntu
run: |
mkdir -p build/appimage-runtime
docker run --rm --stop-timeout 15 --platform linux/arm64 --user "$(id -u):$(id -g)" --mount "type=bind,source=$PWD/build/linux/arm64/release/meshcore-open-aarch64.AppImage,target=/artifact.AppImage,readonly" --mount "type=bind,source=$PWD/scripts/appimage/test_runtime.sh,target=/test_runtime.sh,readonly" --mount "type=bind,source=$PWD/build/appimage-runtime,target=/results" meshcore-appimage-runtime-arm64:ci timeout --verbose --signal=TERM --kill-after=15s 300s xvfb-run -a bash /test_runtime.sh /artifact.AppImage /results
- uses: actions/upload-artifact@v4
if: always()
with:
name: linux-arm64-appimage
path: |
build/linux/arm64/release/meshcore-open-aarch64.AppImage
build/linux/arm64/release/appimage-audit.txt
build/linux/arm64/release/appimage-tools.json
build/flutter-version.json
build/appimage-runtime/
build/linux-arm64-build.log
if-no-files-found: warn
macos:
runs-on: macos-latest
+6 -1
View File
@@ -17,9 +17,14 @@ flutter test
flutter build apk --release
flutter build ios --release
flutter build web --release
flutter build linux --release
MESHCORE_BUILD_APPIMAGE=0 flutter build linux --release
bash scripts/appimage/test_packaging.sh
```
The versioned web build uses `dart run build_pipe:build` (also `bun run build`). Web deployment pins Flutter 3.41.2; other CI jobs track stable. Read `pubspec.yaml` for current app version and dependencies rather than copying them into this guide.
The versioned web build uses `dart run build_pipe:build` (also `bun run build`). Web deployment pins Flutter 3.41.2; Linux packaging uses the SDK pin in `scripts/appimage-tools.json`; other CI jobs track stable. Read `pubspec.yaml` for current app version and dependencies rather than copying them into this guide.
Linux Release installs generate architecture-matched AppImages using linuxdeploy/GTK and appimagetool: x86_64 on x64 and AArch64 on ARM64. Tools and runtime download automatically with pinned SHA-256 checksums. `MESHCORE_BUILD_APPIMAGE=0` skips packaging at install time, without a CMake cache reset. Debug/Profile are unchanged. Nix-linked x64 bundles and hosts with glibc newer than the pinned baseline trigger an isolated Ubuntu rebuild through an available Podman/Docker engine. Rootless Podman uses `--userns=keep-id` for host-owned bind mounts; see [Linux AppImage](README.md#linux-appimage) for prerequisites, cache/offline behavior and limitations. Preserve binary/data/lib adjacency and nested native assets when changing packaging.
For Linux, use `nix develop`; see [Linux with Nix](README.md#linux-with-nix) for the pinned SDK, native build checks, cache troubleshooting, and Sysprof host prerequisites.
+73
View File
@@ -218,6 +218,66 @@ The matrix describes implemented functionality, not a guarantee that every featu
flutter run
```
### Linux AppImage
`flutter build linux --release` produces the regular Flutter bundle and an
AppImage on supported Linux architectures. The x86_64 artifact is
`build/linux/x64/release/meshcore-open-x86_64.AppImage`; the ARM64 artifact is
`build/linux/arm64/release/meshcore-open-aarch64.AppImage`. Debug and Profile
builds do not produce AppImages.
Both use Ubuntu 24.04 as the packaging baseline; older distributions are not
guaranteed.
For a bundle-only build, including other architectures:
```bash
MESHCORE_BUILD_APPIMAGE=0 flutter build linux --release
```
On Ubuntu 24.04, install the packaging prerequisites alongside Flutter's build
dependencies:
```bash
sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev \
librsvg2-dev libgirepository1.0-dev libgtk-3-bin libgdk-pixbuf2.0-bin \
libgdk-pixbuf-2.0-dev dpkg-dev patchelf binutils curl jq file desktop-file-utils xdg-user-dirs
```
The build automatically downloads checksum-verified architecture-matched
linuxdeploy, its GTK plugin, appimagetool, and an AppImage runtime. Pins are in
`scripts/appimage-tools.json`; the cache is under
`${XDG_CACHE_HOME:-$HOME/.cache}/meshcore-open/appimage/`. Packaging can reuse
valid cached tools offline, but Flutter dependencies and native-library
downloads must also be available. A packaging failure fails the enabled build,
without publishing a stale image as a new artifact.
GitHub Actions builds ARM64 on a native `ubuntu-24.04-arm` runner. Flutter's
Linux release SDK archive is x64-only, so that job bootstraps Flutter 3.47.4
from its pinned source revision. Flutter does not support x64-to-ARM64 Linux
cross-builds; use an ARM64 Linux host to build the ARM64 bundle locally. The
ARM64 AppImage is CI-built and hardware validation on a Raspberry Pi 5 is still
needed for graphics, BLE, USB and inference behavior.
Hosts with newer glibc than the pinned baseline (2.39 for Ubuntu 24.04),
including Ubuntu 26.04 runners under `ubuntu-latest`, use the same isolated
Ubuntu rebuild as Nix. A usable Podman or Docker engine is required on those
hosts. Rootless Podman preserves your UID/GID with `--userns=keep-id`, so the
container can write the host-owned output and cache directories. The original
native bundle is retained. Custom targets, obfuscation and split-debug-info
require a bundle-only build when container rebuilding is needed.
The image includes Flutter assets, native plugins, ONNX Runtime and
redistributable GTK dependencies. It does not include graphics drivers, BlueZ
services, USB permissions, downloaded inference models or user data. The GTK
packaging plugin uses X11, so Wayland sessions need XWayland. The host still
needs compatible glibc and graphics libraries (`libgl1`, `libegl1`, and
`libgles2` on Ubuntu). Launch normally, or without
FUSE by extracting:
```bash
./build/linux/x64/release/meshcore-open-x86_64.AppImage --appimage-extract-and-run
```
### Linux with Nix
Enter the development shell from the repository root:
@@ -236,6 +296,19 @@ app requires Flutter 3.41.2 or newer. The Linux shell provides wrapped Clang
compilers, native headers and libraries, and Sysprof capture development files.
Android SDK warnings do not prevent Linux builds.
Release AppImage builds inside `nix develop` require a usable Podman or Docker
engine on the host. The install hook automatically rebuilds in a pinned Ubuntu
container to avoid shipping Nix store dependencies, while keeping the native
Nix bundle intact. The first build downloads a container image and Flutter SDK;
later builds reuse the image and dependency caches. No privileged package
installation is performed on the host. The container uses the SDK pin in
`scripts/appimage-tools.json` and the current source tree, including local
changes and the resolved `pubspec.lock`. Custom Dart defines and build
name/number are forwarded; custom targets, obfuscation and split-debug-info
require a bundle-only build. Use `MESHCORE_BUILD_APPIMAGE=0` to opt out when no
container engine is available. On NixOS, use the distribution's `appimage-run`
support when needed to launch downloaded AppImages.
If an SDK or toolchain update leaves CMake using an old compiler or install
prefix, remove the affected generated cache, for example
`rm -f build/linux/x64/profile/CMakeCache.txt`, and rebuild. If widget tests
+34
View File
@@ -22,6 +22,40 @@ BLE and TCP retry an unexpected disconnect with exponential backoff; manual disc
Companion stats require firmware code 8+, and image channel data requires code 11+. Image inference also needs an enabled, complete model bundle and adequate memory. A missing incoming region label can mean unknown or unavailable metadata, not an unscoped message. See [images](image-messages.md), [regions](regions.md), and [radio stats](radio-statistics.md).
## Linux AppImage build or launch fails
Linux Release builds package an x86_64 AppImage automatically. Missing
packaging dependencies, failed downloads or checksum mismatches fail the build;
see [Linux AppImage prerequisites](../README.md#linux-appimage). A checksum
mismatch must not be bypassed: remove the named corrupted cache file and retry.
Tools are pinned in `scripts/appimage-tools.json`; cached tools can be reused
offline, but dependency downloads and first-time container setup still need
network access. Use `MESHCORE_BUILD_APPIMAGE=0 flutter build linux --release`
for a bundle-only build, including unsupported architectures/build hosts.
ARM64 AppImages are built on a native GitHub `ubuntu-24.04-arm` runner using
the pinned Flutter source revision. An x64 host cannot use Flutter's Linux
cross-build option to produce ARM64; build locally on an ARM64 Linux host or
use the CI artifact. The CI smoke test checks AArch64 ELF files and launches
under emulation on an ARM64 runner, but does not replace Raspberry Pi 5
graphics, BLE, USB or inference hardware testing.
For a Nix build or a host with glibc newer than the pinned Ubuntu baseline,
verify that your user can access Podman or Docker without interactive
privilege escalation. The image is rebuilt in Ubuntu, not made from the
host-linked executable. The regular native bundle remains available if
packaging fails. Custom targets, obfuscation and split-debug-info are not
supported by the container rebuild.
The initial compatibility baseline is Ubuntu 24.04. The host must provide
compatible glibc, graphics drivers, and X11/XWayland; Bluetooth still requires
BlueZ and USB still requires device permissions. If FUSE mounting is
unavailable, try the image's `--appimage-extract-and-run` option, or extract
with `--appimage-extract` and launch `squashfs-root/AppRun`. On NixOS, the
distribution's `appimage-run` support may be required. Include
`appimage-audit.txt` and `appimage-tools.json` from the Release output directory
when reporting packaging failures. Never include private message/model data.
## Useful bug-report details
Include app version, OS/device, radio board and firmware version, transport, reproduction steps, expected behavior, and the exact error. Where relevant, include entries from the **Companion Debug Log** in Settings (frame traffic for BLE, TCP, and USB) or the **App Debug Log**. The App Debug Log only records after you enable App Settings → Debug → **App Debug Logging**. Inspect logs before sharing: they can contain message content, identifiers, and location data.
+3
View File
@@ -43,6 +43,9 @@
unzip
] ++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isLinux [
pkgs.libsysprof-capture
pkgs.jq
pkgs.binutils
pkgs.util-linux
];
shellHook = ''
+1 -1
View File
@@ -328,7 +328,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\nFRAMEWORKS_DIR=\"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\nMIN_OS=\"${IPHONEOS_DEPLOYMENT_TARGET}\"\nif [ ! -d \"$FRAMEWORKS_DIR\" ] || [ -z \"$MIN_OS\" ]; then\n exit 0\nfi\nfind \"$FRAMEWORKS_DIR\" -maxdepth 2 -name Info.plist | while read -r plist; do\n bundle_id=$(/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' \"$plist\" 2>/dev/null || true)\n case \"$bundle_id\" in\n io.flutter.flutter.native-assets.*)\n /usr/libexec/PlistBuddy -c \"Set :MinimumOSVersion $MIN_OS\" \"$plist\" 2>/dev/null || \\\n /usr/libexec/PlistBuddy -c \"Add :MinimumOSVersion string $MIN_OS\" \"$plist\"\n ;;\n esac\ndone\n";
shellScript = "set -e\nFRAMEWORKS_DIR=\"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\nMIN_OS=\"${IPHONEOS_DEPLOYMENT_TARGET}\"\nif [ ! -d \"$FRAMEWORKS_DIR\" ] || [ -z \"$MIN_OS\" ]; then\n exit 0\nfi\nfind \"$FRAMEWORKS_DIR\" -maxdepth 2 -name Info.plist | while read -r plist; do\n bundle_id=$(/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' \"$plist\" 2>/dev/null || true)\n case \"$bundle_id\" in\n io.flutter.flutter.native-assets.*)\n /usr/libexec/PlistBuddy -c \"Set :MinimumOSVersion $MIN_OS\" \"$plist\" 2>/dev/null || \\\n /usr/libexec/PlistBuddy -c \"Add :MinimumOSVersion string $MIN_OS\" \"$plist\"\n # Editing Info.plist invalidates the signature applied when the framework was embedded.\n if [ -n \"$EXPANDED_CODE_SIGN_IDENTITY\" ] && [ \"$CODE_SIGNING_ALLOWED\" != NO ]; then\n codesign --force --sign \"$EXPANDED_CODE_SIGN_IDENTITY\" --preserve-metadata=identifier,entitlements,flags --timestamp=none \"$(dirname \"$plist\")\"\n fi\n ;;\n esac\ndone\n";
};
/* End PBXShellScriptBuildPhase section */
+3
View File
@@ -604,6 +604,8 @@
"appSettings_showChatNodesSubtitle": "Display chat nodes on the map",
"appSettings_showOtherNodes": "Show Other Nodes",
"appSettings_showOtherNodesSubtitle": "Display other node types on the map",
"appSettings_showOnlineLinks": "Show Online Map Connections",
"appSettings_showOnlineLinksSubtitle": "Display connection lines between nodes from the online map",
"appSettings_timeFilter": "Time Filter",
"appSettings_timeFilterShowAll": "Show all nodes",
"appSettings_timeFilterShowLast": "Show nodes from last {hours} hours",
@@ -1398,6 +1400,7 @@
"map_chatNodes": "Chat Nodes",
"map_repeaters": "Repeaters",
"map_otherNodes": "Other Nodes",
"map_showOnlineLinks": "Show Online Map Connections",
"map_showOverlaps": "Repeater Key Overlaps",
"map_keyPrefix": "Key Prefix",
"map_filterByKeyPrefix": "Filter by key prefix",
+18
View File
@@ -2566,6 +2566,18 @@ abstract class AppLocalizations {
/// **'Display other node types on the map'**
String get appSettings_showOtherNodesSubtitle;
/// No description provided for @appSettings_showOnlineLinks.
///
/// In en, this message translates to:
/// **'Show Online Map Connections'**
String get appSettings_showOnlineLinks;
/// No description provided for @appSettings_showOnlineLinksSubtitle.
///
/// In en, this message translates to:
/// **'Display connection lines between nodes from the online map'**
String get appSettings_showOnlineLinksSubtitle;
/// No description provided for @appSettings_timeFilter.
///
/// In en, this message translates to:
@@ -4774,6 +4786,12 @@ abstract class AppLocalizations {
/// **'Other Nodes'**
String get map_otherNodes;
/// No description provided for @map_showOnlineLinks.
///
/// In en, this message translates to:
/// **'Show Online Map Connections'**
String get map_showOnlineLinks;
/// No description provided for @map_showOverlaps.
///
/// In en, this message translates to:
+10
View File
@@ -1420,6 +1420,13 @@ class AppLocalizationsBg extends AppLocalizations {
String get appSettings_showOtherNodesSubtitle =>
'Покажи други типове възли на картата';
@override
String get appSettings_showOnlineLinks => 'Show Online Map Connections';
@override
String get appSettings_showOnlineLinksSubtitle =>
'Display connection lines between nodes from the online map';
@override
String get appSettings_timeFilter => 'Филтриране по време';
@@ -2698,6 +2705,9 @@ class AppLocalizationsBg extends AppLocalizations {
@override
String get map_otherNodes => 'Други възли';
@override
String get map_showOnlineLinks => 'Show Online Map Connections';
@override
String get map_showOverlaps => 'Покриване на ключа на повтаряча';
+10
View File
@@ -1418,6 +1418,13 @@ class AppLocalizationsDe extends AppLocalizations {
String get appSettings_showOtherNodesSubtitle =>
'Andere Knotentypen auf der Karte anzeigen';
@override
String get appSettings_showOnlineLinks => 'Show Online Map Connections';
@override
String get appSettings_showOnlineLinksSubtitle =>
'Display connection lines between nodes from the online map';
@override
String get appSettings_timeFilter => 'Zeitfilter';
@@ -2697,6 +2704,9 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get map_otherNodes => 'Andere Knoten';
@override
String get map_showOnlineLinks => 'Show Online Map Connections';
@override
String get map_showOverlaps => 'Repeater-Schlüsselüberlappungen';
+10
View File
@@ -1395,6 +1395,13 @@ class AppLocalizationsEn extends AppLocalizations {
String get appSettings_showOtherNodesSubtitle =>
'Display other node types on the map';
@override
String get appSettings_showOnlineLinks => 'Show Online Map Connections';
@override
String get appSettings_showOnlineLinksSubtitle =>
'Display connection lines between nodes from the online map';
@override
String get appSettings_timeFilter => 'Time Filter';
@@ -2656,6 +2663,9 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get map_otherNodes => 'Other Nodes';
@override
String get map_showOnlineLinks => 'Show Online Map Connections';
@override
String get map_showOverlaps => 'Repeater Key Overlaps';
+10
View File
@@ -1409,6 +1409,13 @@ class AppLocalizationsEs extends AppLocalizations {
String get appSettings_showOtherNodesSubtitle =>
'Mostrar otros tipos de nodo en el mapa';
@override
String get appSettings_showOnlineLinks => 'Show Online Map Connections';
@override
String get appSettings_showOnlineLinksSubtitle =>
'Display connection lines between nodes from the online map';
@override
String get appSettings_timeFilter => 'Filtro de tiempo';
@@ -2687,6 +2694,9 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String get map_otherNodes => 'Otros nodos';
@override
String get map_showOnlineLinks => 'Show Online Map Connections';
@override
String get map_showOverlaps => 'Superposiciones de tecla repetidora';
+10
View File
@@ -1417,6 +1417,13 @@ class AppLocalizationsFr extends AppLocalizations {
String get appSettings_showOtherNodesSubtitle =>
'Afficher d\'autres types de nœuds sur la carte';
@override
String get appSettings_showOnlineLinks => 'Show Online Map Connections';
@override
String get appSettings_showOnlineLinksSubtitle =>
'Display connection lines between nodes from the online map';
@override
String get appSettings_timeFilter => 'Filtre du temps';
@@ -2695,6 +2702,9 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get map_otherNodes => 'Autres nœuds';
@override
String get map_showOnlineLinks => 'Show Online Map Connections';
@override
String get map_showOverlaps => 'Chevauchements de clés de répéteur';
+10
View File
@@ -1407,6 +1407,13 @@ class AppLocalizationsHu extends AppLocalizations {
String get appSettings_showOtherNodesSubtitle =>
'Más csomóponttípusok megjelenítése a térképen';
@override
String get appSettings_showOnlineLinks => 'Show Online Map Connections';
@override
String get appSettings_showOnlineLinksSubtitle =>
'Display connection lines between nodes from the online map';
@override
String get appSettings_timeFilter => 'Időszűrő';
@@ -2685,6 +2692,9 @@ class AppLocalizationsHu extends AppLocalizations {
@override
String get map_otherNodes => 'Egyéb csomópontok';
@override
String get map_showOnlineLinks => 'Show Online Map Connections';
@override
String get map_showOverlaps => 'Repeater Key átfedések';
+10
View File
@@ -1418,6 +1418,13 @@ class AppLocalizationsIt extends AppLocalizations {
String get appSettings_showOtherNodesSubtitle =>
'Mostra altri tipi di nodo sulla mappa';
@override
String get appSettings_showOnlineLinks => 'Show Online Map Connections';
@override
String get appSettings_showOnlineLinksSubtitle =>
'Display connection lines between nodes from the online map';
@override
String get appSettings_timeFilter => 'Filtro Temporale';
@@ -2696,6 +2703,9 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get map_otherNodes => 'Altri nodi';
@override
String get map_showOnlineLinks => 'Show Online Map Connections';
@override
String get map_showOverlaps => 'Sovrapposizioni chiave ripetitore';
+10
View File
@@ -1338,6 +1338,13 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get appSettings_showOtherNodesSubtitle => '地図上に、他のノードの種類を表示する';
@override
String get appSettings_showOnlineLinks => 'Show Online Map Connections';
@override
String get appSettings_showOnlineLinksSubtitle =>
'Display connection lines between nodes from the online map';
@override
String get appSettings_timeFilter => '時間フィルター';
@@ -2576,6 +2583,9 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get map_otherNodes => 'その他のノード';
@override
String get map_showOnlineLinks => 'Show Online Map Connections';
@override
String get map_showOverlaps => 'リピータキーの重複';
+10
View File
@@ -1343,6 +1343,13 @@ class AppLocalizationsKo extends AppLocalizations {
@override
String get appSettings_showOtherNodesSubtitle => '지도에 다른 노드 유형을 표시';
@override
String get appSettings_showOnlineLinks => 'Show Online Map Connections';
@override
String get appSettings_showOnlineLinksSubtitle =>
'Display connection lines between nodes from the online map';
@override
String get appSettings_timeFilter => '시간 필터';
@@ -2580,6 +2587,9 @@ class AppLocalizationsKo extends AppLocalizations {
@override
String get map_otherNodes => '다른 노드';
@override
String get map_showOnlineLinks => 'Show Online Map Connections';
@override
String get map_showOverlaps => '반복 키 중복';
+10
View File
@@ -1408,6 +1408,13 @@ class AppLocalizationsNl extends AppLocalizations {
String get appSettings_showOtherNodesSubtitle =>
'Toon andere nodetypes op de kaart';
@override
String get appSettings_showOnlineLinks => 'Show Online Map Connections';
@override
String get appSettings_showOnlineLinksSubtitle =>
'Display connection lines between nodes from the online map';
@override
String get appSettings_timeFilter => 'Filter op tijd';
@@ -2679,6 +2686,9 @@ class AppLocalizationsNl extends AppLocalizations {
@override
String get map_otherNodes => 'Andere Nodes';
@override
String get map_showOnlineLinks => 'Show Online Map Connections';
@override
String get map_showOverlaps => 'Overlappende repeatersleutels';
+10
View File
@@ -1422,6 +1422,13 @@ class AppLocalizationsPl extends AppLocalizations {
String get appSettings_showOtherNodesSubtitle =>
'Wyświetl inne typy węzłów na mapie';
@override
String get appSettings_showOnlineLinks => 'Show Online Map Connections';
@override
String get appSettings_showOnlineLinksSubtitle =>
'Display connection lines between nodes from the online map';
@override
String get appSettings_timeFilter => 'Filtrowanie Czasu';
@@ -2712,6 +2719,9 @@ class AppLocalizationsPl extends AppLocalizations {
@override
String get map_otherNodes => 'Inne węzły';
@override
String get map_showOnlineLinks => 'Show Online Map Connections';
@override
String get map_showOverlaps => 'Nakładające się klucze przekaźników';
+10
View File
@@ -1412,6 +1412,13 @@ class AppLocalizationsPt extends AppLocalizations {
String get appSettings_showOtherNodesSubtitle =>
'Exibir outros tipos de nó no mapa';
@override
String get appSettings_showOnlineLinks => 'Show Online Map Connections';
@override
String get appSettings_showOnlineLinksSubtitle =>
'Display connection lines between nodes from the online map';
@override
String get appSettings_timeFilter => 'Filtro de Tempo';
@@ -2690,6 +2697,9 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get map_otherNodes => 'Outros Nós';
@override
String get map_showOnlineLinks => 'Show Online Map Connections';
@override
String get map_showOverlaps => 'Sobreposições da Chave Repeater';
+10
View File
@@ -1418,6 +1418,13 @@ class AppLocalizationsRu extends AppLocalizations {
String get appSettings_showOtherNodesSubtitle =>
'Отображать другие типы нод на карте';
@override
String get appSettings_showOnlineLinks => 'Show Online Map Connections';
@override
String get appSettings_showOnlineLinksSubtitle =>
'Display connection lines between nodes from the online map';
@override
String get appSettings_timeFilter => 'Фильтр по времени';
@@ -2696,6 +2703,9 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get map_otherNodes => 'Другие ноды';
@override
String get map_showOnlineLinks => 'Show Online Map Connections';
@override
String get map_showOverlaps => 'Перекрытия ключа повтора';
+10
View File
@@ -1408,6 +1408,13 @@ class AppLocalizationsSk extends AppLocalizations {
String get appSettings_showOtherNodesSubtitle =>
'Zobraziť ostatné typy uzlov na mape';
@override
String get appSettings_showOnlineLinks => 'Show Online Map Connections';
@override
String get appSettings_showOnlineLinksSubtitle =>
'Display connection lines between nodes from the online map';
@override
String get appSettings_timeFilter => 'Časový filter';
@@ -2687,6 +2694,9 @@ class AppLocalizationsSk extends AppLocalizations {
@override
String get map_otherNodes => 'Ostatné uzly';
@override
String get map_showOnlineLinks => 'Show Online Map Connections';
@override
String get map_showOverlaps => 'Prekrývanie opakovača kľúča';
+10
View File
@@ -1406,6 +1406,13 @@ class AppLocalizationsSl extends AppLocalizations {
String get appSettings_showOtherNodesSubtitle =>
'Pokaži druge vrste naprav na zemljevidu.';
@override
String get appSettings_showOnlineLinks => 'Show Online Map Connections';
@override
String get appSettings_showOnlineLinksSubtitle =>
'Display connection lines between nodes from the online map';
@override
String get appSettings_timeFilter => 'Filter po času';
@@ -2678,6 +2685,9 @@ class AppLocalizationsSl extends AppLocalizations {
@override
String get map_otherNodes => 'Druge vozlišča';
@override
String get map_showOnlineLinks => 'Show Online Map Connections';
@override
String get map_showOverlaps => 'Prekrivanje ključa ponovnega predvajanja';
+10
View File
@@ -1393,6 +1393,13 @@ class AppLocalizationsSv extends AppLocalizations {
String get appSettings_showOtherNodesSubtitle =>
'Visa andra nodtyper på kartan';
@override
String get appSettings_showOnlineLinks => 'Show Online Map Connections';
@override
String get appSettings_showOnlineLinksSubtitle =>
'Display connection lines between nodes from the online map';
@override
String get appSettings_timeFilter => 'Tidsfilter';
@@ -2664,6 +2671,9 @@ class AppLocalizationsSv extends AppLocalizations {
@override
String get map_otherNodes => 'Andra noder';
@override
String get map_showOnlineLinks => 'Show Online Map Connections';
@override
String get map_showOverlaps => 'Repeater-nyckelöverlappningar';
+10
View File
@@ -1410,6 +1410,13 @@ class AppLocalizationsUk extends AppLocalizations {
String get appSettings_showOtherNodesSubtitle =>
'Відображати інші типи вузлів на карті';
@override
String get appSettings_showOnlineLinks => 'Show Online Map Connections';
@override
String get appSettings_showOnlineLinksSubtitle =>
'Display connection lines between nodes from the online map';
@override
String get appSettings_timeFilter => 'Фільтр часу';
@@ -2688,6 +2695,9 @@ class AppLocalizationsUk extends AppLocalizations {
@override
String get map_otherNodes => 'Інші вузли';
@override
String get map_showOnlineLinks => 'Show Online Map Connections';
@override
String get map_showOverlaps => 'Перекриття ключів ретрансляторів';
+10
View File
@@ -1320,6 +1320,13 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get appSettings_showOtherNodesSubtitle => '在地图上显示其他节点类型';
@override
String get appSettings_showOnlineLinks => 'Show Online Map Connections';
@override
String get appSettings_showOnlineLinksSubtitle =>
'Display connection lines between nodes from the online map';
@override
String get appSettings_timeFilter => '时间过滤器';
@@ -2540,6 +2547,9 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get map_otherNodes => '其他节点';
@override
String get map_showOnlineLinks => 'Show Online Map Connections';
@override
String get map_showOverlaps => '重复键重叠';
+6
View File
@@ -102,6 +102,7 @@ class AppSettings {
final bool mapShowRepeaters;
final bool mapShowChatNodes;
final bool mapShowOtherNodes;
final bool mapShowOnlineLinks;
final bool mapShowOverlaps;
final double mapTimeFilterHours; // 0 = all time
final bool mapKeyPrefixEnabled;
@@ -254,6 +255,7 @@ class AppSettings {
this.mapShowRepeaters = true,
this.mapShowChatNodes = true,
this.mapShowOtherNodes = true,
this.mapShowOnlineLinks = true,
this.mapShowOverlaps = false,
this.mapTimeFilterHours = 168,
this.mapKeyPrefixEnabled = false,
@@ -349,6 +351,7 @@ class AppSettings {
'map_show_repeaters': mapShowRepeaters,
'map_show_chat_nodes': mapShowChatNodes,
'map_show_other_nodes': mapShowOtherNodes,
'map_show_online_links': mapShowOnlineLinks,
'map_show_overlaps': mapShowOverlaps,
'map_time_filter_hours': mapTimeFilterHours,
'map_key_prefix_enabled': mapKeyPrefixEnabled,
@@ -481,6 +484,7 @@ class AppSettings {
mapShowRepeaters: json['map_show_repeaters'] as bool? ?? true,
mapShowChatNodes: json['map_show_chat_nodes'] as bool? ?? true,
mapShowOtherNodes: json['map_show_other_nodes'] as bool? ?? true,
mapShowOnlineLinks: json['map_show_online_links'] as bool? ?? true,
mapShowOverlaps: json['map_show_overlaps'] as bool? ?? false,
mapTimeFilterHours:
(json['map_time_filter_hours'] as num?)?.toDouble() ?? 168,
@@ -648,6 +652,7 @@ class AppSettings {
bool? mapShowRepeaters,
bool? mapShowChatNodes,
bool? mapShowOtherNodes,
bool? mapShowOnlineLinks,
bool? mapShowOverlaps,
double? mapTimeFilterHours,
bool? mapKeyPrefixEnabled,
@@ -727,6 +732,7 @@ class AppSettings {
mapShowRepeaters: mapShowRepeaters ?? this.mapShowRepeaters,
mapShowChatNodes: mapShowChatNodes ?? this.mapShowChatNodes,
mapShowOtherNodes: mapShowOtherNodes ?? this.mapShowOtherNodes,
mapShowOnlineLinks: mapShowOnlineLinks ?? this.mapShowOnlineLinks,
mapShowOverlaps: mapShowOverlaps ?? this.mapShowOverlaps,
mapTimeFilterHours: mapTimeFilterHours ?? this.mapTimeFilterHours,
mapKeyPrefixEnabled: mapKeyPrefixEnabled ?? this.mapKeyPrefixEnabled,
+9
View File
@@ -1135,6 +1135,15 @@ class AppSettingsScreen extends StatelessWidget {
onChanged: (value) => settingsService.setMapShowOtherNodes(value),
),
const Divider(height: 1, indent: 16),
SwitchListTile(
contentPadding: tilePadding,
secondary: const Icon(Icons.polyline_outlined, size: 24),
title: Text(context.l10n.appSettings_showOnlineLinks),
subtitle: Text(context.l10n.appSettings_showOnlineLinksSubtitle),
value: settings.mapShowOnlineLinks,
onChanged: (value) => settingsService.setMapShowOnlineLinks(value),
),
const Divider(height: 1, indent: 16),
MeshNavTile(
icon: Icons.timer_outlined,
title: context.l10n.appSettings_timeFilter,
+62 -1
View File
@@ -250,7 +250,13 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
void _requestOnlineData() {
try {
_online.requestBounds(_mapController.camera.visibleBounds);
_online.requestBounds(
_mapController.camera.visibleBounds,
fetchLinks: context
.read<AppSettingsService>()
.settings
.mapShowOnlineLinks,
);
} catch (_) {
// Camera not ready yet; onMapReady requests once it is.
}
@@ -727,6 +733,11 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
contactsWithLocation,
settings,
);
final visibleOnlineRepeaters = _filterOnlineRepeatersBySettings(
_online.repeaters,
settings,
showGuessedLocations: settings.mapShowGuessedLocations,
);
Contact? selectedContact;
if (_selectedKey != null) {
for (final c in allContacts) {
@@ -950,6 +961,8 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
if (showOnline)
...buildNetworkMapOnlineLayers(
controller: _online,
repeaters: visibleOnlineRepeaters,
showLinks: settings.mapShowOnlineLinks,
localMarkerKeys: showLocal
? {for (final c in visibleContacts) c.publicKeyHex}
: const {},
@@ -1438,6 +1451,43 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
return filtered;
}
List<NetworkMapRepeater> _filterOnlineRepeatersBySettings(
List<NetworkMapRepeater> repeaters,
dynamic settings, {
required bool showGuessedLocations,
}) {
final keyPrefix = settings.mapKeyPrefix.trim().toLowerCase();
final now = DateTime.now();
return repeaters.where((repeater) {
if (repeater.isEstimated && !showGuessedLocations) return false;
final typeVisible = switch (repeater.type) {
advTypeRepeater => settings.mapShowRepeaters,
advTypeChat => settings.mapShowChatNodes,
_ => settings.mapShowOtherNodes,
};
if (!typeVisible) return false;
final freshnessVisible = switch (_freshness) {
_Freshness.all => true,
_Freshness.online => repeater.status == NetworkMapRepeaterStatus.active,
_Freshness.recent => repeater.status != NetworkMapRepeaterStatus.stale,
_Freshness.stale => repeater.status == NetworkMapRepeaterStatus.stale,
};
if (!freshnessVisible) return false;
if (settings.mapTimeFilterHours > 0 && repeater.lastSeen != null) {
final age = now.difference(repeater.lastSeen!).inHours;
if (age > settings.mapTimeFilterHours) return false;
}
return !settings.mapKeyPrefixEnabled ||
keyPrefix.isEmpty ||
repeater.key.toLowerCase().startsWith(keyPrefix);
}).toList();
}
List<Marker> _buildNodeMarkers(
List<Contact> contacts,
settings, {
@@ -2129,6 +2179,7 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
!settings.mapShowChatNodes,
!settings.mapShowRepeaters,
!settings.mapShowOtherNodes,
!settings.mapShowOnlineLinks,
settings.mapKeyPrefixEnabled,
].where((active) => active).length;
@@ -3577,6 +3628,8 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
BuildContext context,
AppSettingsService settingsService,
) {
final showOnlineFilters =
context.read<UiViewStateService>().mapSource != MapSourceOption.local;
showMeshSheet(
context,
builder: (sheetContext) => StatefulBuilder(
@@ -3707,6 +3760,14 @@ class _MapScreenState extends State<MapScreen> with DisconnectNavigationMixin {
onChanged: (value) =>
service.setMapShowOtherNodes(value),
),
if (showOnlineFilters)
SwitchListTile(
title: Text(sheetContext.l10n.map_showOnlineLinks),
value: settings.mapShowOnlineLinks,
dense: true,
onChanged: (value) =>
service.setMapShowOnlineLinks(value),
),
SectionHeader(sheetContext.l10n.map_markers),
SwitchListTile(
title: Text(sheetContext.l10n.map_showSharedMarkers),
+4
View File
@@ -95,6 +95,10 @@ class AppSettingsService extends ChangeNotifier {
await updateSettings(_settings.copyWith(mapShowOtherNodes: value));
}
Future<void> setMapShowOnlineLinks(bool value) async {
await updateSettings(_settings.copyWith(mapShowOnlineLinks: value));
}
Future<void> setMapShowOverlaps(bool value) async {
await updateSettings(_settings.copyWith(mapShowOverlaps: value));
}
+31 -27
View File
@@ -40,9 +40,9 @@ class NetworkMapOnlineController extends ChangeNotifier {
List<NetworkMapLink> get links => _links;
NetworkMapLoadState get state => _state;
void requestBounds(LatLngBounds bounds) {
void requestBounds(LatLngBounds bounds, {bool fetchLinks = true}) {
_timer?.cancel();
_timer = Timer(_debounce, () => _load(bounds));
_timer = Timer(_debounce, () => _load(bounds, fetchLinks: fetchLinks));
}
/// Drops any pending or in-flight request (the online layer was hidden).
@@ -51,7 +51,7 @@ class NetworkMapOnlineController extends ChangeNotifier {
_generation++;
}
Future<void> _load(LatLngBounds bounds) async {
Future<void> _load(LatLngBounds bounds, {required bool fetchLinks}) async {
final boxes = NetworkMapBbox.forVisibleArea(
west: bounds.west,
south: bounds.south,
@@ -65,19 +65,21 @@ class NetworkMapOnlineController extends ChangeNotifier {
}
_setState(NetworkMapLoadState.loading);
try {
final results = await Future.wait([
Future.wait(boxes.map(_client.fetchRepeaters)),
Future.wait(boxes.map((b) => _client.fetchLinks(b))),
]);
final repeaterFuture = Future.wait(boxes.map(_client.fetchRepeaters));
final Future<List<List<NetworkMapLink>>> linkFuture = fetchLinks
? Future.wait<List<NetworkMapLink>>(
boxes.map((b) => _client.fetchLinks(b)),
)
: Future.value(const <List<NetworkMapLink>>[]);
final repeaterResults = await repeaterFuture;
final linkResults = await linkFuture;
if (_disposed || generation != _generation) return;
// Two boxes (antimeridian) can both return items on the seam.
_repeaters = {
for (final r in results[0].expand((l) => l as List<NetworkMapRepeater>))
r.key: r,
for (final r in repeaterResults.expand((l) => l)) r.key: r,
}.values.toList();
_links = {
for (final l in results[1].expand((l) => l as List<NetworkMapLink>))
'${l.a}:${l.b}': l,
for (final l in linkResults.expand((l) => l)) '${l.a}:${l.b}': l,
}.values.toList();
_setState(NetworkMapLoadState.ready);
} catch (_) {
@@ -109,15 +111,12 @@ Color networkMapStatusColor(NetworkMapRepeaterStatus status) {
};
}
/// Above this many in-view repeaters, hexagons and marker shadows are skipped.
const int networkMapDenseNodeCount = 30;
/// Above this many in-view links, each line is one stroke at half width
const int networkMapDenseLinkCount = 70;
/// Full style is a 3.5 px confirmed stroke or a 2.5 px unconfirmed stroke,
/// each with a 1 px border. Simple style keeps the pattern and drops the
/// border, so the painter records the line once, at half the stroke width.
@@ -136,8 +135,6 @@ Polyline _onlineLinkPolyline(NetworkMapLink link, {required bool simple}) {
);
}
/// Map layers for the online network: links, repeater hexagons and a
/// tappable center marker so small cells stay visible when zoomed out.
///
@@ -145,20 +142,27 @@ Polyline _onlineLinkPolyline(NetworkMapLink link, {required bool simple}) {
/// their hexagon outline is added.
List<Widget> buildNetworkMapOnlineLayers({
required NetworkMapOnlineController controller,
List<NetworkMapRepeater>? repeaters,
bool showLinks = true,
required Set<String> localMarkerKeys,
required ValueChanged<NetworkMapRepeater> onTap,
}) {
final repeaters = controller.repeaters;
final links = controller.links;
final dropHexagons = repeaters.length > networkMapDenseNodeCount;
final visibleRepeaters = repeaters ?? controller.repeaters;
final visibleKeys = {for (final repeater in visibleRepeaters) repeater.key};
final links = [
for (final link in controller.links)
if (visibleKeys.contains(link.a) && visibleKeys.contains(link.b)) link,
];
final dropHexagons = visibleRepeaters.length > networkMapDenseNodeCount;
final simpleLines = links.length > networkMapDenseLinkCount;
return [
PolylineLayer(
polylines: [
for (final link in links)
_onlineLinkPolyline(link, simple: simpleLines),
],
),
if (showLinks)
PolylineLayer(
polylines: [
for (final link in links)
_onlineLinkPolyline(link, simple: simpleLines),
],
),
if (!dropHexagons)
GestureDetector(
onTap: () {
@@ -168,7 +172,7 @@ List<Widget> buildNetworkMapOnlineLayers({
child: PolygonLayer<NetworkMapRepeater>(
hitNotifier: controller.hitNotifier,
polygons: [
for (final repeater in repeaters)
for (final repeater in visibleRepeaters)
if (repeater.cell.boundary.length >= 3)
Polygon<NetworkMapRepeater>(
points: repeater.cell.boundary,
@@ -189,7 +193,7 @@ List<Widget> buildNetworkMapOnlineLayers({
),
MarkerLayer(
markers: [
for (final repeater in repeaters)
for (final repeater in visibleRepeaters)
if (!localMarkerKeys.contains(repeater.key))
Marker(
point: repeater.cell.center,
+4
View File
@@ -181,3 +181,7 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/appimage.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/appimage.cmake" @ONLY)
install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/appimage.cmake" COMPONENT Runtime)
+25
View File
@@ -0,0 +1,25 @@
if(NOT CMAKE_INSTALL_CONFIG_NAME STREQUAL "Release" OR
"$ENV{MESHCORE_BUILD_APPIMAGE}" STREQUAL "0")
return()
endif()
function(meshcore_package_appimage)
include("@CMAKE_CURRENT_SOURCE_DIR@/flutter/ephemeral/generated_config.cmake")
set(packaging_environment)
foreach(entry IN LISTS FLUTTER_TOOL_ENVIRONMENT)
if(entry MATCHES "^(FLUTTER_ROOT|FLUTTER_TARGET|DART_DEFINES|DART_OBFUSCATION|SPLIT_DEBUG_INFO|TREE_SHAKE_ICONS)=")
list(APPEND packaging_environment "MESHCORE_APPIMAGE_${entry}")
endif()
endforeach()
execute_process(
COMMAND "@CMAKE_COMMAND@" -E env ${packaging_environment}
bash "@CMAKE_CURRENT_SOURCE_DIR@/../scripts/build_appimage.sh"
"@CMAKE_CURRENT_SOURCE_DIR@/.." "${CMAKE_INSTALL_PREFIX}"
"@CMAKE_CURRENT_BINARY_DIR@" "${CMAKE_INSTALL_CONFIG_NAME}" "@CMAKE_SYSTEM_PROCESSOR@"
RESULT_VARIABLE appimage_result)
if(NOT appimage_result EQUAL 0)
message(FATAL_ERROR "AppImage packaging failed (${appimage_result}). Set MESHCORE_BUILD_APPIMAGE=0 to build only the Flutter bundle.")
endif()
endfunction()
meshcore_package_appimage()
+2
View File
@@ -90,6 +90,8 @@ dependencies:
hooks:
user_defines:
llamadart:
# Translation uses llama.cpp. LiteRT-LM is unused and requires iOS 26.4.
llamadart_native_runtimes: [llama_cpp]
llamadart_native_backends:
platforms:
android-arm64:
+44
View File
@@ -0,0 +1,44 @@
{
"ubuntu": "ubuntu:24.04@sha256:fe81560990fae86dc4743202b2cb4d3df98d0bcf949173cecef15ce1127ef852",
"glibc": "2.39",
"flutter": {
"version": "3.47.4",
"source_revision": "9584c6713b324636289d067944a46fd6b49df14b",
"url": "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.47.4-stable.tar.xz",
"sha256": "5b45f0ceda99b9bebdc873e7e69f6450aeb4c30f454b505e2e62fc9255a907d3"
},
"tools": {
"gtk": {
"url": "https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/7a3fbc31a9e5075073ff8790f26effbac5f84453/linuxdeploy-plugin-gtk.sh",
"sha256": "b0f4cbc684a0103a9651f0955b635eaea0096b3a66c0f5a2c2aa337960375171"
},
"x86_64": {
"linuxdeploy": {
"url": "https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20251107-1/linuxdeploy-x86_64.AppImage",
"sha256": "c20cd71e3a4e3b80c3483cef793cda3f4e990aca14014d23c544ca3ce1270b4d"
},
"appimagetool": {
"url": "https://github.com/AppImage/appimagetool/releases/download/1.9.1/appimagetool-x86_64.AppImage",
"sha256": "ed4ce84f0d9caff66f50bcca6ff6f35aae54ce8135408b3fa33abfc3cb384eb0"
},
"runtime": {
"url": "https://github.com/AppImage/type2-runtime/releases/download/20251108/runtime-x86_64",
"sha256": "2fca8b443c92510f1483a883f60061ad09b46b978b2631c807cd873a47ec260d"
}
},
"aarch64": {
"linuxdeploy": {
"url": "https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20251107-1/linuxdeploy-aarch64.AppImage",
"sha256": "620095110d693282b8ebeb244a95b5e911cf8f65f76c88b4b47d16ae6346fcff"
},
"appimagetool": {
"url": "https://github.com/AppImage/appimagetool/releases/download/1.9.1/appimagetool-aarch64.AppImage",
"sha256": "f0837e7448a0c1e4e650a93bb3e85802546e60654ef287576f46c71c126a9158"
},
"runtime": {
"url": "https://github.com/AppImage/type2-runtime/releases/download/20251108/runtime-aarch64",
"sha256": "00cbdfcf917cc6c0ff6d3347d59e0ca1f7f45a6df1a428a0d6d8a78664d87444"
}
}
}
}
+10
View File
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -eo pipefail
export APPDIR="${APPDIR:-$(cd "$(dirname "$0")" && pwd)}"
export PATH="$APPDIR/usr/bin:$PATH"
for hook in "$APPDIR"/apprun-hooks/*.sh; do
# shellcheck source=/dev/null
[[ ! -f "$hook" ]] || source "$hook"
done
exec "$APPDIR/usr/bin/meshcore_open" "$@"
+27
View File
@@ -0,0 +1,27 @@
ARG BASE_IMAGE=ubuntu:24.04@sha256:fe81560990fae86dc4743202b2cb4d3df98d0bcf949173cecef15ce1127ef852
FROM ${BASE_IMAGE} AS build
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates clang cmake ninja-build pkg-config libgtk-3-dev \
librsvg2-dev libgirepository1.0-dev libgdk-pixbuf-2.0-dev libgtk-3-bin \
libgdk-pixbuf2.0-bin binutils patchelf curl jq \
file desktop-file-utils xdg-user-dirs git rsync unzip xz-utils make g++ dpkg-dev \
libssl-dev libunwind-dev libvulkan-dev libgl1-mesa-dev libglu1-mesa-dev \
libasound2-dev libsecret-1-dev \
&& rm -rf /var/lib/apt/lists/*
COPY appimage-tools.json /opt/packaging/
RUN set -eu; curl --fail --location --retry 3 --connect-timeout 20 --max-time 600 \
"$(jq -er .flutter.url /opt/packaging/appimage-tools.json)" --output /tmp/flutter.tar.xz \
&& printf '%s /tmp/flutter.tar.xz\n' "$(jq -er .flutter.sha256 /opt/packaging/appimage-tools.json)" | sha256sum --check \
&& tar -xJf /tmp/flutter.tar.xz -C /opt && rm /tmp/flutter.tar.xz \
&& chmod -R a+rwX /opt/flutter
ENV PATH="/opt/flutter/bin:${PATH}"
FROM ${BASE_IMAGE} AS runtime-test
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
xvfb xauth x11-utils x11-apps xdotool imagemagick dbus-x11 binutils libgl1 libegl1 libgles2 \
libgl1-mesa-dri fonts-dejavu-core \
&& rm -rf /var/lib/apt/lists/*
@@ -0,0 +1,7 @@
[Desktop Entry]
Type=Application
Name=MeshCore Open
Exec=meshcore_open
Icon=com.meshcore.meshcore_open
Terminal=false
Categories=Network;InstantMessaging;
+150
View File
@@ -0,0 +1,150 @@
#!/usr/bin/env bash
set -euo pipefail
project="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
source "$project/scripts/build_appimage.sh"
temporary="$(mktemp -d)"
trap 'rm -rf "$temporary"' EXIT
assert_fails() {
if "$@" >"$temporary/error" 2>&1; then
printf 'Expected failure: %s\n' "$*" >&2
exit 1
fi
}
assert_fails packaging_enabled Debug
assert_fails packaging_enabled Profile
packaging_enabled Release
[[ "$(canonical_arch x64)" == x86_64 ]]
[[ "$(canonical_arch aarch64)" == aarch64 ]]
[[ "$(canonical_arch arm64)" == aarch64 ]]
assert_fails canonical_arch riscv64
MESHCORE_BUILD_APPIMAGE=0 assert_fails packaging_enabled Release
assert_fails check_bundle "$temporary/missing"
mkdir -p "$temporary/bundle/lib" "$temporary/bundle/data/flutter_assets"
touch "$temporary/bundle/meshcore_open" "$temporary/bundle/lib/libapp.so" \
"$temporary/bundle/data/icudtl.dat"
chmod +x "$temporary/bundle/meshcore_open"
check_bundle "$temporary/bundle"
rm "$temporary/bundle/lib/libapp.so"
assert_fails check_bundle "$temporary/bundle"
touch "$temporary/bundle/lib/libapp.so"
MESHCORE_BUILD_APPIMAGE=0 bash "$project/scripts/build_appimage.sh" \
"$project" /missing "$temporary/output" Release x64
bash "$project/scripts/build_appimage.sh" "$project" /missing "$temporary/output" Debug x64
[[ ! -d "$temporary/output" ]]
assert_fails bash "$project/scripts/build_appimage.sh" \
"$project" /missing "$temporary/output" Release riscv64
# shellcheck disable=SC2218
jq -e '.flutter.source_revision == "9584c6713b324636289d067944a46fd6b49df14b" and
(.tools.x86_64.linuxdeploy.sha256 | length == 64) and
(.tools.aarch64.linuxdeploy.sha256 | length == 64) and
(.tools.aarch64.appimagetool.sha256 | length == 64) and
(.tools.aarch64.runtime.sha256 | length == 64)' \
"$project/scripts/appimage-tools.json" >/dev/null
stage_bundle "$project" "$temporary/bundle" "$temporary/AppDir with spaces"
check_bundle "$temporary/AppDir with spaces/usr/bin"
[[ -x "$temporary/AppDir with spaces/AppRun" ]]
[[ -f "$temporary/AppDir with spaces/usr/share/applications/com.meshcore.meshcore_open.desktop" ]]
printf 'fixture\n' > "$temporary/input"
checksum="$(sha256sum "$temporary/input")"
checksum="${checksum%% *}"
# shellcheck disable=SC2218
download_verified "file://$temporary/input" "$checksum" "$temporary/cache/tool"
# shellcheck disable=SC2218
download_verified 'https://invalid.example/offline' "$checksum" "$temporary/cache/tool"
assert_fails download_verified "file://$temporary/input" \
'0000000000000000000000000000000000000000000000000000000000000000' "$temporary/cache/invalid"
[[ ! -e "$temporary/cache/invalid" ]]
printf 'corruption\n' >> "$temporary/cache/tool"
assert_fails download_verified "file://$temporary/input" "$checksum" "$temporary/cache/tool"
# shellcheck disable=SC2329
download_verified() {
printf '%s %s\n' "$1" "$3" >> "$temporary/tool-selection"
mkdir -p "$(dirname "$3")"
: > "$3"
}
prepare_tools "$project/scripts/appimage-tools.json" "$temporary/tools-x64" x86_64
prepare_tools "$project/scripts/appimage-tools.json" "$temporary/tools-arm64" aarch64
grep -Fq 'linuxdeploy-x86_64.AppImage' "$temporary/tool-selection"
grep -Fq 'appimagetool-x86_64.AppImage' "$temporary/tool-selection"
grep -Fq 'runtime-x86_64' "$temporary/tool-selection"
grep -Fq 'linuxdeploy-aarch64.AppImage' "$temporary/tool-selection"
grep -Fq 'appimagetool-aarch64.AppImage' "$temporary/tool-selection"
grep -Fq 'runtime-aarch64' "$temporary/tool-selection"
unset -f download_verified
mkdir -p "$temporary/project/scripts/appimage"
touch "$temporary/project/pubspec.lock"
cp "$project/scripts/appimage/Dockerfile" "$temporary/project/scripts/appimage/"
# shellcheck disable=SC2329
jq() {
case "$*" in
*'.flutter.version'*) printf '3.47.4\n' ;;
*'.ubuntu'*) printf 'ubuntu:24.04\n' ;;
*) return 1 ;;
esac
}
# shellcheck disable=SC2329
podman() {
# shellcheck disable=SC2317
case "$1" in
info) [[ "$mock_engine" == podman ]] ;;
image) return 0 ;;
run) printf '%s\n' "$@" > "$temporary/container-arguments" ;;
*) return 1 ;;
esac
}
# shellcheck disable=SC2329
docker() {
# shellcheck disable=SC2317
case "$1" in
info|image) return 0 ;;
run) printf '%s\n' "$@" > "$temporary/container-arguments" ;;
*) return 1 ;;
esac
}
mock_engine=podman
package_container "$temporary/project" "$temporary/output" \
"$project/scripts/appimage-tools.json" "$temporary/container-cache"
grep -Fxq -- '--userns=keep-id' "$temporary/container-arguments"
grep -Fxq -- "$(id -u):$(id -g)" "$temporary/container-arguments"
mock_engine=docker
package_container "$temporary/project" "$temporary/output" \
"$project/scripts/appimage-tools.json" "$temporary/container-cache"
assert_fails grep -Fxq -- '--userns=keep-id' "$temporary/container-arguments"
grep -Fxq -- "$(id -u):$(id -g)" "$temporary/container-arguments"
unset -f jq podman docker
# shellcheck disable=SC2329
readelf() {
printf '%s\n' "$mock_interpreter"
}
# shellcheck disable=SC2329
getconf() {
printf 'glibc %s\n' "$mock_glibc"
}
mock_interpreter=/lib64/ld-linux-x86-64.so.2
mock_glibc=2.39
assert_fails requires_container_rebuild "$temporary/bundle/meshcore_open" 2.39
mock_glibc=2.43
requires_container_rebuild "$temporary/bundle/meshcore_open" 2.39
mock_interpreter=/nix/store/glibc/lib/ld-linux-x86-64.so.2
mock_glibc=2.39
requires_container_rebuild "$temporary/bundle/meshcore_open" 2.39
unset -f readelf getconf
printf 'AppImage packaging contract tests passed\n'
+178
View File
@@ -0,0 +1,178 @@
#!/usr/bin/env bash
set -euo pipefail
image="$(realpath "$1")"
mkdir -p "$2"
output="$(realpath "$2")"
exec > >(tee -a "$output/runtime-test.log") 2>&1
log() {
printf '[%s] %s\n' "$(date -u +'%Y-%m-%dT%H:%M:%SZ')" "$*" >&2
}
run_timed() {
local label="$1" limit="$2" capture="$3" started status
shift 3
started=$SECONDS
log "START $label (timeout $limit)"
if timeout --signal=TERM --kill-after=5s "$limit" "$@" >"$capture" 2>&1; then
log "PASS $label ($((SECONDS - started))s)"
return 0
else
status=$?
tail -n 40 "$capture" >&2 || true
log "FAIL $label (exit $status after $((SECONDS - started))s)"
return "$status"
fi
}
case "$(uname -m)" in
x86_64) expected_machine='Advanced Micro Devices X86-64' ;;
aarch64) expected_machine='AArch64' ;;
*) log "Unsupported runtime-test architecture: $(uname -m)"; exit 1 ;;
esac
log "Runtime test starting: architecture=$(uname -m) image=$image size=$(stat -c %s "$image") bytes"
if ! readelf -h "$image" | grep -Fq "$expected_machine"; then
log "AppImage runtime is not built for $(uname -m)"
exit 1
fi
workspace="$(mktemp -d)"
app_pid=''
stop_process() {
local process_id="$1" attempt
[[ -n "$process_id" ]] || return 0
kill -0 "$process_id" 2>/dev/null || return 0
kill -TERM "$process_id" 2>/dev/null || true
for ((attempt = 0; attempt < 5; attempt++)); do
kill -0 "$process_id" 2>/dev/null || break
sleep 1
done
kill -KILL "$process_id" 2>/dev/null || true
wait "$process_id" 2>/dev/null || true
}
cleanup() {
log 'Cleanup: stopping application process'
stop_process "$app_pid"
rm -rf "$workspace"
}
trap cleanup EXIT
cd "$workspace"
cp "$image" "$workspace/extractor"
printf '\0\0\0' | dd of="$workspace/extractor" bs=1 seek=8 count=3 conv=notrunc status=none
run_timed 'extract AppImage' 120s "$output/extract.log" \
"$workspace/extractor" --appimage-extract
appdir="$workspace/squashfs-root"
log 'Checking extracted AppImage structure'
[[ -x "$appdir/AppRun" && -f "$appdir/usr/bin/lib/libapp.so" && \
-f "$appdir/usr/bin/data/icudtl.dat" && -d "$appdir/usr/bin/data/flutter_assets" ]]
[[ -f "$appdir/usr/bin/lib/libonnxruntime.so.1" && \
-f "$appdir/usr/share/glib-2.0/schemas/gschemas.compiled" ]]
log 'Starting bundled ELF architecture audit'
elf_count=0
while IFS= read -r -d '' library; do
if readelf -h "$library" >/dev/null 2>&1; then
elf_count=$((elf_count + 1))
log "Checking ELF $elf_count: ${library#"$appdir/"}"
if ! readelf -h "$library" | grep -Fq "$expected_machine"; then
log "Wrong ELF architecture in AppImage: ${library#"$appdir/"}"
exit 1
fi
fi
done < <(find "$appdir/usr/bin" "$appdir/usr/lib" -type f -print0)
log "ELF architecture audit passed ($elf_count files)"
dependencies="$output/dependencies.log"
: > "$dependencies"
run_timed 'check application dependencies' 20s "$workspace/ldd.log" \
ldd "$appdir/usr/bin/meshcore_open"
cat "$workspace/ldd.log" >> "$dependencies"
while IFS= read -r -d '' library; do
relative="${library#"$appdir/"}"
if run_timed "check dependencies: $relative" 20s "$workspace/ldd.log" ldd "$library"; then
cat "$workspace/ldd.log" >> "$dependencies"
else
status=$?
cat "$workspace/ldd.log" >> "$dependencies"
if [[ "$status" == 124 || "$status" == 137 ]]; then
exit "$status"
fi
log "ldd returned $status for $relative; continuing unresolved-dependency scan"
fi
done < <(find "$appdir/usr/bin/lib" "$appdir/usr/lib" -type f -name '*.so*' -print0)
if grep 'not found' "$dependencies"; then
log 'Unresolved AppImage dependencies'
exit 1
fi
log 'Dependency audit passed'
mkdir -p "$workspace/home/Documents" "$workspace/home/config"
printf 'XDG_DOCUMENTS_DIR="%s/Documents"\n' "$workspace/home" > "$workspace/home/config/user-dirs.dirs"
log 'Starting AppRun under a private D-Bus session (also used as the system bus)'
# shellcheck disable=SC2016
env -u LD_LIBRARY_PATH -u GTK_PATH -u GSETTINGS_SCHEMA_DIR \
HOME="$workspace/home" XDG_CONFIG_HOME="$workspace/home/config" \
XDG_DATA_HOME="$workspace/home/data" XDG_CACHE_HOME="$workspace/home/cache" \
dbus-run-session -- bash -c \
'export DBUS_SYSTEM_BUS_ADDRESS="$DBUS_SESSION_BUS_ADDRESS"; exec "$1"' \
_ "$appdir/AppRun" > "$output/startup.log" 2>&1 &
app_pid=$!
log "AppRun started: pid=$app_pid"
window=''
window_deadline=$((SECONDS + 90))
next_window_report=$((SECONDS + 10))
while ((SECONDS < window_deadline)); do
if ! kill -0 "$app_pid" 2>/dev/null; then
log 'AppRun exited before opening a visible window; startup.log follows'
tail -n 100 "$output/startup.log" >&2 || true
exit 1
fi
if window="$(timeout --signal=TERM --kill-after=2s 5s \
xdotool search --onlyvisible --limit 1 --name 'MeshCore Open|meshcore_open' 2>/dev/null)"; then
break
fi
if ((SECONDS >= next_window_report)); then
log "Still waiting for the application window (${SECONDS}s elapsed)"
next_window_report=$((SECONDS + 10))
fi
sleep 1
done
if [[ -z "$window" ]]; then
log 'Timed out waiting 90s for a visible application window; startup.log follows'
tail -n 100 "$output/startup.log" >&2 || true
exit 1
fi
log "Visible application window found: id=$window"
colors=0
screenshot_deadline=$((SECONDS + 60))
next_screenshot_report=$((SECONDS + 10))
while ((SECONDS < screenshot_deadline)); do
# shellcheck disable=SC2016
if timeout --signal=TERM --kill-after=5s 15s bash -e -c \
'xwd -silent -id "$1" -out "$2" && convert "$2" "$3" && identify -format "%k" "$3"' \
_ "$window" "$workspace/window.xwd" "$output/startup.png" \
> "$workspace/screenshot.log" 2>&1; then
colors="$(<"$workspace/screenshot.log")"
else
status=$?
tail -n 40 "$workspace/screenshot.log" >&2 || true
log "Screenshot capture failed (exit $status)"
exit "$status"
fi
[[ "$colors" =~ ^[0-9]+$ ]] || { log "Unexpected screenshot color count: $colors"; exit 1; }
((colors >= 20)) && break
if ((SECONDS >= next_screenshot_report)); then
log "Window still appears blank (${colors} colors, $((screenshot_deadline - SECONDS))s remaining)"
next_screenshot_report=$((SECONDS + 10))
fi
done
((colors >= 20)) || { log 'Application window remained blank after 60s'; exit 1; }
[[ -s "$output/startup.png" ]]
if grep -Ei 'error while loading shared libraries|cannot open shared object|failed to load asset|unhandled exception' "$output/startup.log"; then
exit 1
fi
log "Runtime test passed; screenshot: $output/startup.png"
+329
View File
@@ -0,0 +1,329 @@
#!/usr/bin/env bash
set -euo pipefail
fail() {
printf 'AppImage: %s\n' "$*" >&2
return 1
}
packaging_enabled() {
[[ "${MESHCORE_BUILD_APPIMAGE:-1}" != 0 && "$1" == Release ]]
}
canonical_arch() {
case "$1" in
x64|x86_64) printf 'x86_64\n' ;;
arm64|aarch64) printf 'aarch64\n' ;;
*) fail "Unsupported AppImage architecture: $1"; return 1 ;;
esac
}
check_bundle() {
local bundle="$1"
[[ -x "$bundle/meshcore_open" && -f "$bundle/lib/libapp.so" && \
-f "$bundle/data/icudtl.dat" && -d "$bundle/data/flutter_assets" ]] || \
fail "Incomplete release bundle: $bundle"
}
download_verified() {
local url="$1" checksum="$2" destination="$3" temporary
mkdir -p "$(dirname "$destination")"
if [[ -f "$destination" ]]; then
if printf '%s %s\n' "$checksum" "$destination" | sha256sum --check --status; then
return
fi
fail "Cached tool checksum mismatch: $destination; remove it and retry"
return 1
fi
temporary="$(mktemp "$destination.download.XXXXXX")"
if ! curl --fail --location --retry 3 --connect-timeout 20 --max-time 600 \
--output "$temporary" "$url"; then
rm -f "$temporary"
fail "Cannot download $url; populate the verified cache or disable packaging with MESHCORE_BUILD_APPIMAGE=0"
return 1
fi
if ! printf '%s %s\n' "$checksum" "$temporary" | sha256sum --check --status; then
rm -f "$temporary"
fail "Downloaded tool checksum mismatch: $url"
return 1
fi
mv "$temporary" "$destination"
}
require_tools() {
local tool
for tool in "$@"; do
command -v "$tool" >/dev/null || {
fail "Missing $tool; see README Linux AppImage prerequisites or set MESHCORE_BUILD_APPIMAGE=0"
return 1
}
done
}
prepare_tools() {
local manifest="$1" cache="$2" architecture="$3" tool url checksum
mkdir -p "$cache"
exec {cache_lock}>"$cache/tools.lock"
flock "$cache_lock"
for tool in linuxdeploy appimagetool gtk runtime; do
if [[ "$tool" == gtk ]]; then
url="$(jq -er '.tools.gtk.url' "$manifest")"
checksum="$(jq -er '.tools.gtk.sha256' "$manifest")"
else
url="$(jq -er --arg arch "$architecture" --arg tool "$tool" '.tools[$arch][$tool].url' "$manifest")"
checksum="$(jq -er --arg arch "$architecture" --arg tool "$tool" '.tools[$arch][$tool].sha256' "$manifest")"
fi
download_verified "$url" "$checksum" "$cache/$tool"
chmod +x "$cache/$tool"
done
flock -u "$cache_lock"
exec {cache_lock}>&-
}
extract_tool() {
local tool="$1" destination="$2"
mkdir -p "$destination"
cp "$tool" "$destination/extractor"
printf '\0\0\0' | dd of="$destination/extractor" bs=1 seek=8 count=3 conv=notrunc status=none
(cd "$destination" && ./extractor --appimage-extract >/dev/null)
}
stage_bundle() {
local project="$1" bundle="$2" appdir="$3" identity=com.meshcore.meshcore_open
mkdir -p "$appdir/usr/bin" "$appdir/usr/share/applications" \
"$appdir/usr/share/icons/hicolor/256x256/apps"
cp -a "$bundle/." "$appdir/usr/bin/"
install -m 644 "$project/scripts/appimage/$identity.desktop" "$appdir/usr/share/applications/"
install -m 644 "$project/mesh-icon.png" "$appdir/usr/share/icons/hicolor/256x256/apps/$identity.png"
install -m 755 "$project/scripts/appimage/AppRun" "$appdir/AppRun"
}
audit_appdir() {
local appdir="$1" report="$2" library rpath interpreter needed
: > "$report"
while IFS= read -r -d '' library; do
readelf -h "$library" >/dev/null 2>&1 || continue
rpath="$(patchelf --print-rpath "$library")"
interpreter="$(patchelf --print-interpreter "$library" 2>/dev/null || true)"
needed="$(patchelf --print-needed "$library")"
if [[ "$rpath$interpreter$needed" == *'/nix/store/'* || \
"$rpath" == *"$appdir"* ]]; then
fail "Non-relocatable ELF: $library"
return 1
fi
printf '%s\n interpreter: %s\n rpath: %s\n%s\n' \
"${library#"$appdir/"}" "$interpreter" "$rpath" "$needed" >> "$report"
done < <(find "$appdir" -type f -print0)
}
package_direct() {
local project="$1" bundle="$2" output="$3" manifest="$4" cache="$5" architecture="$6"
local work appdir library relative linuxdeploy appimagetool appimage_name appimage_arch
local dependencies=()
require_tools curl jq sha256sum flock file readelf patchelf pkg-config \
desktop-file-validate glib-compile-schemas gdk-pixbuf-thumbnailer xdg-user-dir
pkg-config --exists gtk+-3.0 librsvg-2.0 gobject-introspection-1.0 || \
{ fail 'Missing GTK, librsvg or GObject introspection development files'; return 1; }
prepare_tools "$manifest" "$cache" "$architecture"
appimage_arch="$architecture"
appimage_name="meshcore-open-$architecture.AppImage"
work="$(mktemp -d "$output/appimage.XXXXXX")"
# shellcheck disable=SC2064
trap "rm -rf -- $(printf '%q' "$work")" EXIT
appdir="$work/AppDir"
extract_tool "$cache/linuxdeploy" "$work/linuxdeploy"
extract_tool "$cache/appimagetool" "$work/appimagetool"
linuxdeploy="$work/linuxdeploy/squashfs-root/AppRun"
appimagetool="$work/appimagetool/squashfs-root/AppRun"
install -m 755 "$cache/gtk" "$work/linuxdeploy/squashfs-root/linuxdeploy-plugin-gtk.sh"
export PATH="$work/linuxdeploy/squashfs-root:$PATH"
stage_bundle "$project" "$bundle" "$appdir"
install -m 755 "$(command -v xdg-user-dir)" "$appdir/usr/bin/xdg-user-dir"
gdk-pixbuf-thumbnailer --size 256 "$project/mesh-icon.png" \
"$appdir/usr/share/icons/hicolor/256x256/apps/com.meshcore.meshcore_open.png"
desktop-file-validate "$appdir/usr/share/applications/com.meshcore.meshcore_open.desktop"
export DEPLOY_GTK_VERSION=3 NO_STRIP=1
"$linuxdeploy" --appdir "$appdir" --executable "$appdir/usr/bin/meshcore_open" \
--library "$(pkg-config --variable=libdir harfbuzz)/libharfbuzz.so.0" \
--library "$(pkg-config --variable=libdir freetype2)/libfreetype.so.6" \
--library "$(pkg-config --variable=libdir fontconfig)/libfontconfig.so.1" \
--library "$(pkg-config --variable=libdir fribidi)/libfribidi.so.0" \
--desktop-file "$appdir/usr/share/applications/com.meshcore.meshcore_open.desktop" \
--icon-file "$appdir/usr/share/icons/hicolor/256x256/apps/com.meshcore.meshcore_open.png" \
--plugin gtk
while IFS= read -r -d '' library; do
readelf -h "$library" >/dev/null 2>&1 || continue
dependencies+=(--deploy-deps-only "$library")
done < <(find "$appdir/usr/bin/lib" -type f -print0)
"$linuxdeploy" --appdir "$appdir" "${dependencies[@]}"
while IFS= read -r -d '' library; do
readelf -h "$library" >/dev/null 2>&1 || continue
relative="$(realpath --relative-to="$(dirname "$library")" "$appdir/usr/lib")"
patchelf --set-rpath "\$ORIGIN:\$ORIGIN/lib:\$ORIGIN/$relative" "$library"
done < <(find "$appdir" -type f -print0)
install -m 755 "$project/scripts/appimage/AppRun" "$appdir/AppRun"
mkdir -p "$appdir/usr/share/doc/meshcore-open"
cp "$project/LICENSE" "$appdir/usr/share/doc/meshcore-open/"
while IFS= read -r -d '' library; do
relative="${library#/usr/share/doc/}"
mkdir -p "$appdir/usr/share/doc/meshcore-open/$(dirname "$relative")"
cp -L "$library" "$appdir/usr/share/doc/meshcore-open/$relative"
done < <(find -L /usr/share/doc -name copyright -type f -print0)
while IFS= read -r -d '' library; do
relative="$(realpath --relative-to="$project" "$library")"
mkdir -p "$appdir/usr/share/doc/meshcore-open/build-notices/$(dirname "$relative")"
cp -L "$library" "$appdir/usr/share/doc/meshcore-open/build-notices/$relative"
done < <(find "$(dirname "$bundle")/plugins" -type f \
\( -iname LICENSE -o -iname NOTICE -o -name ThirdPartyNotices.txt \) -print0)
if [[ -n "${PUB_CACHE:-}" && -d "$PUB_CACHE/hosted" ]]; then
while IFS= read -r -d '' library; do
relative="${library#"$PUB_CACHE/"}"
mkdir -p "$appdir/usr/share/doc/meshcore-open/packages/$(dirname "$relative")"
cp -L "$library" "$appdir/usr/share/doc/meshcore-open/packages/$relative"
done < <(find "$PUB_CACHE/hosted" -maxdepth 4 -type f \
\( -iname LICENSE -o -iname NOTICE \) -print0)
fi
if [[ -f "${MESHCORE_APPIMAGE_FLUTTER_ROOT:-}/LICENSE" ]]; then
cp "$MESHCORE_APPIMAGE_FLUTTER_ROOT/LICENSE" "$appdir/usr/share/doc/meshcore-open/Flutter-LICENSE"
fi
audit_appdir "$appdir" "$work/audit.txt"
ARCH="$appimage_arch" "$appimagetool" --runtime-file "$cache/runtime" --no-appstream \
"$appdir" "$work/$appimage_name"
chmod +x "$work/$appimage_name"
mv "$work/$appimage_name" "$output/$appimage_name"
mv "$work/audit.txt" "$output/appimage-audit.txt"
cp "$manifest" "$output/appimage-tools.json"
rm -rf "$work"
trap - EXIT
}
container_build() {
local workspace arguments=() definitions=() encoded decoded
workspace="$(mktemp -d /tmp/meshcore-appimage.XXXXXX)"
# shellcheck disable=SC2064
trap "rm -rf -- $(printf '%q' "$workspace")" EXIT
rsync -aL --exclude '/build' --exclude '/.dart_tool' --exclude '/.git' \
--exclude '/.pub-cache' --exclude '/.pub' --exclude '/.env' \
--exclude '/linux/flutter/ephemeral' --exclude '/android' --exclude '/ios' \
--exclude '/macos' --exclude '/windows' /source/ "$workspace/"
mkdir -p "$HOME"
git config --global --add safe.directory /opt/flutter
flutter config --no-analytics >/dev/null
cd "$workspace"
flutter pub get --enforce-lockfile
IFS=',' read -r -a definitions <<< "${MESHCORE_APPIMAGE_DART_DEFINES:-}"
for encoded in "${definitions[@]}"; do
[[ -n "$encoded" ]] || continue
decoded="$(printf '%s' "$encoded" | base64 --decode)"
case "$decoded" in
FLUTTER_BUILD_NAME=*) arguments+=("--build-name=${decoded#*=}") ;;
FLUTTER_BUILD_NUMBER=*) arguments+=("--build-number=${decoded#*=}") ;;
FLUTTER_VERSION=*|FLUTTER_CHANNEL=*|FLUTTER_GIT_URL=*|FLUTTER_FRAMEWORK_REVISION=*|FLUTTER_ENGINE_REVISION=*|FLUTTER_DART_VERSION=*) ;;
*) arguments+=("--dart-define=$decoded") ;;
esac
done
if [[ "${MESHCORE_APPIMAGE_TREE_SHAKE_ICONS:-true}" == false ]]; then
arguments+=(--no-tree-shake-icons)
fi
flutter build linux --release --no-pub "${arguments[@]}"
cp build/linux/x64/release/meshcore-open-x86_64.AppImage /output/
cp build/linux/x64/release/appimage-audit.txt /output/
cp build/linux/x64/release/appimage-tools.json /output/
rm -rf "$workspace"
trap - EXIT
}
package_container() {
local project="$1" output="$2" manifest="$3" cache="$4" engine image pin key
[[ "${MESHCORE_APPIMAGE_IN_CONTAINER:-0}" != 1 ]] || \
{ fail 'The container bundle unexpectedly contains Nix-linked executables'; return 1; }
[[ "${MESHCORE_APPIMAGE_FLUTTER_TARGET:-lib/main.dart}" == lib/main.dart && \
"${MESHCORE_APPIMAGE_DART_OBFUSCATION:-false}" == false && \
-z "${MESHCORE_APPIMAGE_SPLIT_DEBUG_INFO:-}" ]] || \
{ fail 'Nix AppImage rebuilding supports main.dart without obfuscation/split-debug-info; set MESHCORE_BUILD_APPIMAGE=0 for other builds'; return 1; }
[[ -f "$project/pubspec.lock" ]] || \
{ fail 'The container rebuild requires pubspec.lock from flutter pub get'; return 1; }
engine=''
for key in podman docker; do
if command -v "$key" >/dev/null && "$key" info >/dev/null 2>&1; then
engine="$key"
break
fi
done
[[ -n "$engine" ]] || \
{ fail 'Nix AppImage packaging requires a usable Podman or Docker engine; set MESHCORE_BUILD_APPIMAGE=0 to opt out'; return 1; }
mkdir -p "$cache" "$cache/pub"
pin="$(sha256sum "$manifest" "$project/scripts/appimage/Dockerfile" | sha256sum)"
image="meshcore-open-appimage:${pin:0:16}"
printf 'AppImage: rebuilding in Ubuntu with %s (Flutter %s); original native bundle is unchanged\n' \
"$engine" "$(jq -r '.flutter.version' "$manifest")"
if ! "$engine" image inspect "$image" >/dev/null 2>&1; then
"$engine" build --target build --platform linux/amd64 --tag "$image" \
--build-arg "BASE_IMAGE=$(jq -er '.ubuntu' "$manifest")" \
--file "$project/scripts/appimage/Dockerfile" "$project/scripts"
fi
local environment=(--env MESHCORE_APPIMAGE_IN_CONTAINER=1 --env HOME=/tmp/home \
--env XDG_CACHE_HOME=/cache --env PUB_CACHE=/cache/pub)
for key in FLUTTER_TARGET DART_DEFINES DART_OBFUSCATION SPLIT_DEBUG_INFO TREE_SHAKE_ICONS; do
environment+=(--env "MESHCORE_APPIMAGE_$key")
done
local user_namespace=()
if [[ "$engine" == podman ]]; then
user_namespace+=(--userns=keep-id)
fi
"$engine" run --rm --platform linux/amd64 "${user_namespace[@]}" --user "$(id -u):$(id -g)" \
"${environment[@]}" --mount "type=bind,source=$(realpath "$project"),target=/source,readonly" \
--mount "type=bind,source=$output,target=/output" \
--mount "type=bind,source=$cache,target=/cache" \
"$image" bash /source/scripts/build_appimage.sh --container-build
}
requires_container_rebuild() {
local executable="$1" baseline="$2" host_glibc host_major host_minor baseline_major baseline_minor
if [[ "$(readelf -l "$executable")" == *'/nix/store/'* ]]; then
return 0
fi
host_glibc="$(getconf GNU_LIBC_VERSION)" || return 0
host_glibc="${host_glibc#glibc }"
host_major="${host_glibc%%.*}"
host_minor="${host_glibc#*.}"
host_minor="${host_minor%%.*}"
baseline_major="${baseline%%.*}"
baseline_minor="${baseline#*.}"
[[ "$host_major" =~ ^[0-9]+$ && "$host_minor" =~ ^[0-9]+$ ]] || return 0
(( host_major > baseline_major || (host_major == baseline_major && host_minor > baseline_minor) ))
}
main() {
[[ $# == 5 ]] || { fail 'Expected: project bundle output configuration architecture'; return 1; }
local project="$1" bundle="$2" output="$3" configuration="$4" architecture="$5"
packaging_enabled "$configuration" || return 0
architecture="$(canonical_arch "$architecture")" || return 1
mkdir -p "$output"
output="$(realpath "$output")"
exec {output_lock}>"$output/appimage.lock"
flock "$output_lock"
rm -f "$output/meshcore-open-$architecture.AppImage" "$output/appimage-audit.txt" "$output/appimage-tools.json"
check_bundle "$bundle"
require_tools jq readelf sha256sum
local manifest="$project/scripts/appimage-tools.json" pin cache
pin="$(sha256sum "$manifest")"
pin="${pin%% *}"
cache="${XDG_CACHE_HOME:-$HOME/.cache}/meshcore-open/appimage/$pin/$architecture"
if requires_container_rebuild "$bundle/meshcore_open" "$(jq -er '.glibc' "$manifest")"; then
[[ "$architecture" == x86_64 ]] || \
{ fail 'ARM64 container rebuild is not configured; build on an Ubuntu 24.04 ARM64 host or set MESHCORE_BUILD_APPIMAGE=0'; return 1; }
package_container "$project" "$output" "$manifest" "$cache"
else
package_direct "$project" "$bundle" "$output" "$manifest" "$cache" "$architecture"
fi
printf 'AppImage created: %s/meshcore-open-%s.AppImage\n' "$output" "$architecture"
}
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
if [[ "${1:-}" == --container-build ]]; then
container_build
else
main "$@"
fi
fi
+7
View File
@@ -450,6 +450,13 @@ void main() {
expect(AppSettings.fromJson(saved).loadLinkImages, isFalse);
});
test('online map links default on and round-trip through JSON', () {
expect(AppSettings().mapShowOnlineLinks, isTrue);
expect(AppSettings.fromJson({}).mapShowOnlineLinks, isTrue);
final saved = AppSettings(mapShowOnlineLinks: false).toJson();
expect(AppSettings.fromJson(saved).mapShowOnlineLinks, isFalse);
});
test('show link images by default is off and round-trips', () {
expect(AppSettings().showLinkImagesByDefault, isFalse);
expect(AppSettings.fromJson({}).showLinkImagesByDefault, isFalse);
+4 -5
View File
@@ -55,11 +55,10 @@ using serial::SerialException;
using serial::PortNotOpenedException;
using serial::IOException;
// glibc 2.42 made cfsetispeed/cfsetospeed default to GLIBC_2.42 and turned
// the B* macros into plain baud numbers. A library built on that glibc will
// not load on Ubuntu 24.04 / Linux Mint 22 (glibc 2.39). Bind the old symbols
// and pass the legacy c_cflag values those symbols still expect.
#if defined(__linux__) && defined(__GLIBC__)
// On x86_64, glibc 2.42 changed cfsetispeed/cfsetospeed to GLIBC_2.42 and
// changed the B* macros to plain baud numbers. Bind the old x86_64 symbols
// so builds remain compatible with Ubuntu 24.04 / Linux Mint 22 (glibc 2.39).
#if defined(__linux__) && defined(__GLIBC__) && defined(__x86_64__)
__asm__(".symver cfsetispeed, cfsetispeed@GLIBC_2.2.5");
__asm__(".symver cfsetospeed, cfsetospeed@GLIBC_2.2.5");
+103 -1
View File
@@ -1 +1,103 @@
{}
{
"bg": [
"appSettings_showOnlineLinks",
"appSettings_showOnlineLinksSubtitle",
"map_showOnlineLinks"
],
"de": [
"appSettings_showOnlineLinks",
"appSettings_showOnlineLinksSubtitle",
"map_showOnlineLinks"
],
"es": [
"appSettings_showOnlineLinks",
"appSettings_showOnlineLinksSubtitle",
"map_showOnlineLinks"
],
"fr": [
"appSettings_showOnlineLinks",
"appSettings_showOnlineLinksSubtitle",
"map_showOnlineLinks"
],
"hu": [
"appSettings_showOnlineLinks",
"appSettings_showOnlineLinksSubtitle",
"map_showOnlineLinks"
],
"it": [
"appSettings_showOnlineLinks",
"appSettings_showOnlineLinksSubtitle",
"map_showOnlineLinks"
],
"ja": [
"appSettings_showOnlineLinks",
"appSettings_showOnlineLinksSubtitle",
"map_showOnlineLinks"
],
"ko": [
"appSettings_showOnlineLinks",
"appSettings_showOnlineLinksSubtitle",
"map_showOnlineLinks"
],
"nl": [
"appSettings_showOnlineLinks",
"appSettings_showOnlineLinksSubtitle",
"map_showOnlineLinks"
],
"pl": [
"appSettings_showOnlineLinks",
"appSettings_showOnlineLinksSubtitle",
"map_showOnlineLinks"
],
"pt": [
"appSettings_showOnlineLinks",
"appSettings_showOnlineLinksSubtitle",
"map_showOnlineLinks"
],
"ru": [
"appSettings_showOnlineLinks",
"appSettings_showOnlineLinksSubtitle",
"map_showOnlineLinks"
],
"sk": [
"appSettings_showOnlineLinks",
"appSettings_showOnlineLinksSubtitle",
"map_showOnlineLinks"
],
"sl": [
"appSettings_showOnlineLinks",
"appSettings_showOnlineLinksSubtitle",
"map_showOnlineLinks"
],
"sv": [
"appSettings_showOnlineLinks",
"appSettings_showOnlineLinksSubtitle",
"map_showOnlineLinks"
],
"uk": [
"appSettings_showOnlineLinks",
"appSettings_showOnlineLinksSubtitle",
"map_showOnlineLinks"
],
"zh": [
"appSettings_showOnlineLinks",
"appSettings_showOnlineLinksSubtitle",
"map_showOnlineLinks"
]
}