From b82d5d6aab536087519e981464bd45a2a662364d Mon Sep 17 00:00:00 2001 From: ericz Date: Sun, 1 Nov 2026 14:13:27 +0100 Subject: [PATCH 01/17] Add online map filtering controls --- lib/l10n/app_en.arb | 3 + lib/l10n/app_localizations.dart | 18 ++++ lib/l10n/app_localizations_bg.dart | 10 +++ lib/l10n/app_localizations_de.dart | 10 +++ lib/l10n/app_localizations_en.dart | 10 +++ lib/l10n/app_localizations_es.dart | 10 +++ lib/l10n/app_localizations_fr.dart | 10 +++ lib/l10n/app_localizations_hu.dart | 10 +++ lib/l10n/app_localizations_it.dart | 10 +++ lib/l10n/app_localizations_ja.dart | 10 +++ lib/l10n/app_localizations_ko.dart | 10 +++ lib/l10n/app_localizations_nl.dart | 10 +++ lib/l10n/app_localizations_pl.dart | 10 +++ lib/l10n/app_localizations_pt.dart | 10 +++ lib/l10n/app_localizations_ru.dart | 10 +++ lib/l10n/app_localizations_sk.dart | 10 +++ lib/l10n/app_localizations_sl.dart | 10 +++ lib/l10n/app_localizations_sv.dart | 10 +++ lib/l10n/app_localizations_uk.dart | 10 +++ lib/l10n/app_localizations_zh.dart | 10 +++ lib/models/app_settings.dart | 6 ++ lib/screens/app_settings_screen.dart | 9 ++ lib/screens/map_screen.dart | 56 +++++++++++- lib/services/app_settings_service.dart | 4 + lib/widgets/network_map_online_layer.dart | 58 ++++++------ test/models/model_changes_test.dart | 7 ++ untranslated.json | 104 +++++++++++++++++++++- 27 files changed, 416 insertions(+), 29 deletions(-) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index c56769df..9e163d3e 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -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", diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index bd9c23d7..8908fd69 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -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: diff --git a/lib/l10n/app_localizations_bg.dart b/lib/l10n/app_localizations_bg.dart index 2779c65d..4783f614 100644 --- a/lib/l10n/app_localizations_bg.dart +++ b/lib/l10n/app_localizations_bg.dart @@ -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 => 'Покриване на ключа на повтаряча'; diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart index 105806d7..806c399b 100644 --- a/lib/l10n/app_localizations_de.dart +++ b/lib/l10n/app_localizations_de.dart @@ -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'; diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 83564176..c835670d 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -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'; diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart index 072a7c5f..5b056b44 100644 --- a/lib/l10n/app_localizations_es.dart +++ b/lib/l10n/app_localizations_es.dart @@ -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'; diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart index 872e0a44..08b3758a 100644 --- a/lib/l10n/app_localizations_fr.dart +++ b/lib/l10n/app_localizations_fr.dart @@ -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'; diff --git a/lib/l10n/app_localizations_hu.dart b/lib/l10n/app_localizations_hu.dart index c0771ef8..897866a4 100644 --- a/lib/l10n/app_localizations_hu.dart +++ b/lib/l10n/app_localizations_hu.dart @@ -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'; diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart index 94960af9..0b5a6208 100644 --- a/lib/l10n/app_localizations_it.dart +++ b/lib/l10n/app_localizations_it.dart @@ -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'; diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart index b76ae22e..8413e4b7 100644 --- a/lib/l10n/app_localizations_ja.dart +++ b/lib/l10n/app_localizations_ja.dart @@ -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 => 'リピータキーの重複'; diff --git a/lib/l10n/app_localizations_ko.dart b/lib/l10n/app_localizations_ko.dart index aeb094b4..05994b3c 100644 --- a/lib/l10n/app_localizations_ko.dart +++ b/lib/l10n/app_localizations_ko.dart @@ -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 => '반복 키 중복'; diff --git a/lib/l10n/app_localizations_nl.dart b/lib/l10n/app_localizations_nl.dart index d7fcde62..3be448a5 100644 --- a/lib/l10n/app_localizations_nl.dart +++ b/lib/l10n/app_localizations_nl.dart @@ -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'; diff --git a/lib/l10n/app_localizations_pl.dart b/lib/l10n/app_localizations_pl.dart index bc243688..e9eba38a 100644 --- a/lib/l10n/app_localizations_pl.dart +++ b/lib/l10n/app_localizations_pl.dart @@ -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'; diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart index f227ff76..b43c2aa6 100644 --- a/lib/l10n/app_localizations_pt.dart +++ b/lib/l10n/app_localizations_pt.dart @@ -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'; diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart index 4ba9f082..5922d05c 100644 --- a/lib/l10n/app_localizations_ru.dart +++ b/lib/l10n/app_localizations_ru.dart @@ -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 => 'Перекрытия ключа повтора'; diff --git a/lib/l10n/app_localizations_sk.dart b/lib/l10n/app_localizations_sk.dart index e283d889..9be22e45 100644 --- a/lib/l10n/app_localizations_sk.dart +++ b/lib/l10n/app_localizations_sk.dart @@ -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'; diff --git a/lib/l10n/app_localizations_sl.dart b/lib/l10n/app_localizations_sl.dart index ba6db474..39fece9d 100644 --- a/lib/l10n/app_localizations_sl.dart +++ b/lib/l10n/app_localizations_sl.dart @@ -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'; diff --git a/lib/l10n/app_localizations_sv.dart b/lib/l10n/app_localizations_sv.dart index f07d3aa4..d0bae11a 100644 --- a/lib/l10n/app_localizations_sv.dart +++ b/lib/l10n/app_localizations_sv.dart @@ -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'; diff --git a/lib/l10n/app_localizations_uk.dart b/lib/l10n/app_localizations_uk.dart index 28562cf4..38482a52 100644 --- a/lib/l10n/app_localizations_uk.dart +++ b/lib/l10n/app_localizations_uk.dart @@ -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 => 'Перекриття ключів ретрансляторів'; diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index c306e8b9..d3b0c4c5 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -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 => '重复键重叠'; diff --git a/lib/models/app_settings.dart b/lib/models/app_settings.dart index 29aaf814..a1970b2b 100644 --- a/lib/models/app_settings.dart +++ b/lib/models/app_settings.dart @@ -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, diff --git a/lib/screens/app_settings_screen.dart b/lib/screens/app_settings_screen.dart index 33bb651e..3ec2a153 100644 --- a/lib/screens/app_settings_screen.dart +++ b/lib/screens/app_settings_screen.dart @@ -1130,6 +1130,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, diff --git a/lib/screens/map_screen.dart b/lib/screens/map_screen.dart index d9af753c..ba83baaf 100644 --- a/lib/screens/map_screen.dart +++ b/lib/screens/map_screen.dart @@ -237,7 +237,13 @@ class _MapScreenState extends State with DisconnectNavigationMixin { void _requestOnlineData() { try { - _online.requestBounds(_mapController.camera.visibleBounds); + _online.requestBounds( + _mapController.camera.visibleBounds, + fetchLinks: context + .read() + .settings + .mapShowOnlineLinks, + ); } catch (_) { // Camera not ready yet; onMapReady requests once it is. } @@ -714,6 +720,10 @@ class _MapScreenState extends State with DisconnectNavigationMixin { contactsWithLocation, settings, ); + final visibleOnlineRepeaters = _filterOnlineRepeatersBySettings( + _online.repeaters, + settings, + ); Contact? selectedContact; if (_selectedKey != null) { for (final c in allContacts) { @@ -937,6 +947,8 @@ class _MapScreenState extends State with DisconnectNavigationMixin { if (showOnline) ...buildNetworkMapOnlineLayers( controller: _online, + repeaters: visibleOnlineRepeaters, + showLinks: settings.mapShowOnlineLinks, localMarkerKeys: showLocal ? {for (final c in visibleContacts) c.publicKeyHex} : const {}, @@ -1425,6 +1437,40 @@ class _MapScreenState extends State with DisconnectNavigationMixin { return filtered; } + List _filterOnlineRepeatersBySettings( + List repeaters, + dynamic settings, + ) { + final keyPrefix = settings.mapKeyPrefix.trim().toLowerCase(); + final now = DateTime.now(); + + return repeaters.where((repeater) { + 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 _buildNodeMarkers( List contacts, settings, { @@ -2116,6 +2162,7 @@ class _MapScreenState extends State with DisconnectNavigationMixin { !settings.mapShowChatNodes, !settings.mapShowRepeaters, !settings.mapShowOtherNodes, + !settings.mapShowOnlineLinks, settings.mapKeyPrefixEnabled, ].where((active) => active).length; @@ -3694,6 +3741,13 @@ class _MapScreenState extends State with DisconnectNavigationMixin { onChanged: (value) => service.setMapShowOtherNodes(value), ), + 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), diff --git a/lib/services/app_settings_service.dart b/lib/services/app_settings_service.dart index 5e9f1d73..22a2e565 100644 --- a/lib/services/app_settings_service.dart +++ b/lib/services/app_settings_service.dart @@ -95,6 +95,10 @@ class AppSettingsService extends ChangeNotifier { await updateSettings(_settings.copyWith(mapShowOtherNodes: value)); } + Future setMapShowOnlineLinks(bool value) async { + await updateSettings(_settings.copyWith(mapShowOnlineLinks: value)); + } + Future setMapShowOverlaps(bool value) async { await updateSettings(_settings.copyWith(mapShowOverlaps: value)); } diff --git a/lib/widgets/network_map_online_layer.dart b/lib/widgets/network_map_online_layer.dart index f9782058..122de7fe 100644 --- a/lib/widgets/network_map_online_layer.dart +++ b/lib/widgets/network_map_online_layer.dart @@ -40,9 +40,9 @@ class NetworkMapOnlineController extends ChangeNotifier { List 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 _load(LatLngBounds bounds) async { + Future _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>> linkFuture = fetchLinks + ? Future.wait>( + boxes.map((b) => _client.fetchLinks(b)), + ) + : Future.value(const >[]); + 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)) - 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)) - '${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 buildNetworkMapOnlineLayers({ required NetworkMapOnlineController controller, + List? repeaters, + bool showLinks = true, required Set localMarkerKeys, required ValueChanged 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 buildNetworkMapOnlineLayers({ child: PolygonLayer( hitNotifier: controller.hitNotifier, polygons: [ - for (final repeater in repeaters) + for (final repeater in visibleRepeaters) if (repeater.cell.boundary.length >= 3) Polygon( points: repeater.cell.boundary, @@ -189,7 +193,7 @@ List buildNetworkMapOnlineLayers({ ), MarkerLayer( markers: [ - for (final repeater in repeaters) + for (final repeater in visibleRepeaters) if (!localMarkerKeys.contains(repeater.key)) Marker( point: repeater.cell.center, diff --git a/test/models/model_changes_test.dart b/test/models/model_changes_test.dart index 42e3f91e..1815e9d9 100644 --- a/test/models/model_changes_test.dart +++ b/test/models/model_changes_test.dart @@ -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); diff --git a/untranslated.json b/untranslated.json index 9e26dfee..e24ecc86 100644 --- a/untranslated.json +++ b/untranslated.json @@ -1 +1,103 @@ -{} \ No newline at end of file +{ + "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" + ] +} From 7baf29ca628f4fe17c87abc050b4610188ef59b3 Mon Sep 17 00:00:00 2001 From: ericz Date: Sun, 1 Nov 2026 15:06:02 +0100 Subject: [PATCH 02/17] small addition, to not display option in local map filter. --- lib/screens/map_screen.dart | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/screens/map_screen.dart b/lib/screens/map_screen.dart index ba83baaf..03921477 100644 --- a/lib/screens/map_screen.dart +++ b/lib/screens/map_screen.dart @@ -3611,6 +3611,8 @@ class _MapScreenState extends State with DisconnectNavigationMixin { BuildContext context, AppSettingsService settingsService, ) { + final showOnlineFilters = + context.read().mapSource != MapSourceOption.local; showMeshSheet( context, builder: (sheetContext) => StatefulBuilder( @@ -3741,13 +3743,16 @@ class _MapScreenState extends State with DisconnectNavigationMixin { onChanged: (value) => service.setMapShowOtherNodes(value), ), - SwitchListTile( - title: Text(sheetContext.l10n.map_showOnlineLinks), - value: settings.mapShowOnlineLinks, - dense: true, - onChanged: (value) => - service.setMapShowOnlineLinks(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), From e073f6bd5293b827eaaa4a54194711f036347f2b Mon Sep 17 00:00:00 2001 From: ericz Date: Sun, 1 Nov 2026 15:10:21 +0100 Subject: [PATCH 03/17] dart format --- lib/screens/map_screen.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/screens/map_screen.dart b/lib/screens/map_screen.dart index 03921477..b901a083 100644 --- a/lib/screens/map_screen.dart +++ b/lib/screens/map_screen.dart @@ -3745,9 +3745,7 @@ class _MapScreenState extends State with DisconnectNavigationMixin { ), if (showOnlineFilters) SwitchListTile( - title: Text( - sheetContext.l10n.map_showOnlineLinks, - ), + title: Text(sheetContext.l10n.map_showOnlineLinks), value: settings.mapShowOnlineLinks, dense: true, onChanged: (value) => From b60e18fe6b2afe5d86d79e7d21318aa9cdfac732 Mon Sep 17 00:00:00 2001 From: Logan Rawlins Date: Sun, 1 Nov 2026 13:19:53 -0700 Subject: [PATCH 04/17] init appimage building --- .github/workflows/build.yml | 31 +- CLAUDE.md | 7 +- README.md | 56 ++++ documentation/troubleshooting.md | 26 ++ flake.nix | 3 + linux/CMakeLists.txt | 4 + linux/appimage.cmake.in | 25 ++ scripts/appimage-tools.json | 26 ++ scripts/appimage/AppRun | 10 + scripts/appimage/Dockerfile | 27 ++ .../com.meshcore.meshcore_open.desktop | 7 + scripts/appimage/test_packaging.sh | 53 ++++ scripts/appimage/test_runtime.sh | 60 ++++ scripts/build_appimage.sh | 293 ++++++++++++++++++ 14 files changed, 625 insertions(+), 3 deletions(-) create mode 100644 linux/appimage.cmake.in create mode 100644 scripts/appimage-tools.json create mode 100644 scripts/appimage/AppRun create mode 100644 scripts/appimage/Dockerfile create mode 100644 scripts/appimage/com.meshcore.meshcore_open.desktop create mode 100644 scripts/appimage/test_packaging.sh create mode 100644 scripts/appimage/test_runtime.sh create mode 100644 scripts/build_appimage.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 05c82de6..d6e92382 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,14 +46,41 @@ 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 libgtk-3-dev librsvg2-dev libgirepository1.0-dev libgtk-3-bin libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-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 + - name: Test AppImage in clean Ubuntu + run: | + docker build --target runtime-test --build-arg "BASE_IMAGE=$(jq -r '.ubuntu' scripts/appimage-tools.json)" -f scripts/appimage/Dockerfile -t meshcore-appimage-runtime scripts + mkdir -p build/appimage-runtime + docker run --rm --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 xvfb-run -a bash /test_runtime.sh /artifact.AppImage /results + - uses: actions/upload-artifact@v4 + 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: error macos: runs-on: macos-latest diff --git a/CLAUDE.md b/CLAUDE.md index fc69bf60..87d9ceab 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -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 also generate `build/linux/x64/release/meshcore-open-x86_64.AppImage` using linuxdeploy/GTK and an explicit appimagetool invocation. Tools and the 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 bundles trigger an isolated Ubuntu rebuild through an available Podman/Docker engine; 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. diff --git a/README.md b/README.md index de5d2101..7470da2b 100644 --- a/README.md +++ b/README.md @@ -150,6 +150,49 @@ The matrix describes implemented functionality, not a guarantee that every featu flutter run ``` +### Linux AppImage + +`flutter build linux --release` produces both the regular Flutter bundle and +`build/linux/x64/release/meshcore-open-x86_64.AppImage`. Packaging runs after +Flutter installs its assets and native libraries. Debug and Profile builds do +not produce an AppImage. The initial AppImage target is x86_64, with 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-pixbuf2.0-dev patchelf binutils curl jq file desktop-file-utils xdg-user-dirs +``` + +The build automatically downloads checksum-verified 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. + +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: @@ -168,6 +211,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 diff --git a/documentation/troubleshooting.md b/documentation/troubleshooting.md index 1f94cf3e..886af097 100644 --- a/documentation/troubleshooting.md +++ b/documentation/troubleshooting.md @@ -22,6 +22,32 @@ 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 ARM builds. + +For a Nix build, verify that your user can access Podman or Docker without +interactive privilege escalation. The image is rebuilt in Ubuntu, not made +from the Nix-linked executable. The regular Nix 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. diff --git a/flake.nix b/flake.nix index d64b0fb3..528c3d87 100644 --- a/flake.nix +++ b/flake.nix @@ -43,6 +43,9 @@ unzip ] ++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isLinux [ pkgs.libsysprof-capture + pkgs.jq + pkgs.binutils + pkgs.util-linux ]; shellHook = '' diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt index f697e5dc..a3fc95c7 100644 --- a/linux/CMakeLists.txt +++ b/linux/CMakeLists.txt @@ -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) diff --git a/linux/appimage.cmake.in b/linux/appimage.cmake.in new file mode 100644 index 00000000..781c3ddf --- /dev/null +++ b/linux/appimage.cmake.in @@ -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() \ No newline at end of file diff --git a/scripts/appimage-tools.json b/scripts/appimage-tools.json new file mode 100644 index 00000000..f8762768 --- /dev/null +++ b/scripts/appimage-tools.json @@ -0,0 +1,26 @@ +{ + "ubuntu": "ubuntu:24.04@sha256:fe81560990fae86dc4743202b2cb4d3df98d0bcf949173cecef15ce1127ef852", + "flutter": { + "version": "3.47.4", + "url": "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.47.4-stable.tar.xz", + "sha256": "5b45f0ceda99b9bebdc873e7e69f6450aeb4c30f454b505e2e62fc9255a907d3" + }, + "tools": { + "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" + }, + "gtk": { + "url": "https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/7a3fbc31a9e5075073ff8790f26effbac5f84453/linuxdeploy-plugin-gtk.sh", + "sha256": "b0f4cbc684a0103a9651f0955b635eaea0096b3a66c0f5a2c2aa337960375171" + }, + "runtime": { + "url": "https://github.com/AppImage/type2-runtime/releases/download/20251108/runtime-x86_64", + "sha256": "2fca8b443c92510f1483a883f60061ad09b46b978b2631c807cd873a47ec260d" + } + } +} \ No newline at end of file diff --git a/scripts/appimage/AppRun b/scripts/appimage/AppRun new file mode 100644 index 00000000..5aaaaece --- /dev/null +++ b/scripts/appimage/AppRun @@ -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" "$@" \ No newline at end of file diff --git a/scripts/appimage/Dockerfile b/scripts/appimage/Dockerfile new file mode 100644 index 00000000..2d9b4106 --- /dev/null +++ b/scripts/appimage/Dockerfile @@ -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 libgdk-pixbuf2.0-dev binutils patchelf curl jq \ + file desktop-file-utils xdg-user-dirs git rsync unzip xz-utils make g++ \ + 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 libgl1 libegl1 libgles2 \ + libgl1-mesa-dri fonts-dejavu-core \ + && rm -rf /var/lib/apt/lists/* \ No newline at end of file diff --git a/scripts/appimage/com.meshcore.meshcore_open.desktop b/scripts/appimage/com.meshcore.meshcore_open.desktop new file mode 100644 index 00000000..05d08f4c --- /dev/null +++ b/scripts/appimage/com.meshcore.meshcore_open.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Type=Application +Name=MeshCore Open +Exec=meshcore_open +Icon=com.meshcore.meshcore_open +Terminal=false +Categories=Network;InstantMessaging; \ No newline at end of file diff --git a/scripts/appimage/test_packaging.sh b/scripts/appimage/test_packaging.sh new file mode 100644 index 00000000..1e338778 --- /dev/null +++ b/scripts/appimage/test_packaging.sh @@ -0,0 +1,53 @@ +#!/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 +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 arm64 + +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%% *}" +download_verified "file://$temporary/input" "$checksum" "$temporary/cache/tool" +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" + +printf 'AppImage packaging contract tests passed\n' \ No newline at end of file diff --git a/scripts/appimage/test_runtime.sh b/scripts/appimage/test_runtime.sh new file mode 100644 index 00000000..f84a05aa --- /dev/null +++ b/scripts/appimage/test_runtime.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +set -euo pipefail + +image="$(realpath "$1")" +mkdir -p "$2" +output="$(realpath "$2")" +workspace="$(mktemp -d)" +app_pid='' +bus_pid='' +cleanup() { + [[ -z "$app_pid" ]] || kill "$app_pid" 2>/dev/null || true + [[ -z "$bus_pid" ]] || kill "$bus_pid" 2>/dev/null || true + rm -rf "$workspace" +} +trap cleanup EXIT +cd "$workspace" +printf 'AppImage runtime test: extracting image\n' +cp "$image" "$workspace/extractor" +printf '\0\0\0' | dd of="$workspace/extractor" bs=1 seek=8 count=3 conv=notrunc status=none +timeout 60 "$workspace/extractor" --appimage-extract > /dev/null +appdir="$workspace/squashfs-root" +[[ -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" ]] +ldd "$appdir/usr/bin/meshcore_open" > "$output/dependencies.log" 2>&1 +while IFS= read -r -d '' library; do + printf '\n%s\n' "${library#"$appdir/"}" >> "$output/dependencies.log" + ldd "$library" >> "$output/dependencies.log" 2>&1 || true +done < <(find "$appdir/usr/bin/lib" "$appdir/usr/lib" -type f -name '*.so*' -print0) +if grep 'not found' "$output/dependencies.log"; then + printf 'Unresolved AppImage dependencies\n' >&2 + exit 1 +fi +mkdir -p "$workspace/home/Documents" "$workspace/home/config" +printf 'XDG_DOCUMENTS_DIR="%s/Documents"\n' "$workspace/home" > "$workspace/home/config/user-dirs.dirs" +bus_pid="$(dbus-daemon --session --address="unix:path=$workspace/system-bus" --fork --print-pid)" +printf 'AppImage runtime test: launching application\n' +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_SYSTEM_BUS_ADDRESS="unix:path=$workspace/system-bus" \ + dbus-run-session -- "$appdir/AppRun" > "$output/startup.log" 2>&1 & +app_pid=$! +window="$(timeout 60 xdotool search --sync --onlyvisible --limit 1 --name 'MeshCore Open|meshcore_open')" +colors=0 +deadline=$((SECONDS + 60)) +while (( SECONDS < deadline )); do + kill -0 "$app_pid" + xwd -silent -id "$window" -out "$workspace/window.xwd" + convert "$workspace/window.xwd" "$output/startup.png" + colors="$(identify -format '%k' "$output/startup.png")" + (( colors < 20 )) || break +done +(( colors >= 20 )) || { printf 'Application window remained blank\n' >&2; 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 +printf 'Extracted AppImage startup passed; screenshot: %s/startup.png\n' "$output" \ No newline at end of file diff --git a/scripts/build_appimage.sh b/scripts/build_appimage.sh new file mode 100644 index 00000000..92063da4 --- /dev/null +++ b/scripts/build_appimage.sh @@ -0,0 +1,293 @@ +#!/usr/bin/env bash +set -euo pipefail + +fail() { + printf 'AppImage: %s\n' "$*" >&2 + return 1 +} + +packaging_enabled() { + [[ "${MESHCORE_BUILD_APPIMAGE:-1}" != 0 && "$1" == Release ]] +} + +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" tool url checksum + mkdir -p "$cache" + exec {cache_lock}>"$cache/tools.lock" + flock "$cache_lock" + for tool in linuxdeploy appimagetool gtk runtime; do + url="$(jq -er --arg tool "$tool" '.tools[$tool].url' "$manifest")" + checksum="$(jq -er --arg tool "$tool" '.tools[$tool].sha256' "$manifest")" + 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" + local work appdir library relative linuxdeploy appimagetool + 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" + 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=x86_64 "$appimagetool" --runtime-file "$cache/runtime" --no-appstream \ + "$appdir" "$work/meshcore-open-x86_64.AppImage" + chmod +x "$work/meshcore-open-x86_64.AppImage" + mv "$work/meshcore-open-x86_64.AppImage" "$output/meshcore-open-x86_64.AppImage" + 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); native Nix 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 + "$engine" run --rm --platform linux/amd64 --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 +} + +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" == x64 || "$architecture" == x86_64 ]] || \ + { fail 'Only x86_64 AppImages are supported; set MESHCORE_BUILD_APPIMAGE=0 for other architectures'; return 1; } + mkdir -p "$output" + output="$(realpath "$output")" + exec {output_lock}>"$output/appimage.lock" + flock "$output_lock" + rm -f "$output/meshcore-open-x86_64.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/x86_64" + if [[ "$(readelf -l "$bundle/meshcore_open")" == *'/nix/store/'* ]]; then + package_container "$project" "$output" "$manifest" "$cache" + else + package_direct "$project" "$bundle" "$output" "$manifest" "$cache" + fi + printf 'AppImage created: %s/meshcore-open-x86_64.AppImage\n' "$output" +} + +if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then + if [[ "${1:-}" == --container-build ]]; then + container_build + else + main "$@" + fi +fi \ No newline at end of file From c19cd28de89f0d0fbd140ecc3d4e556531b2c2a2 Mon Sep 17 00:00:00 2001 From: Logan Rawlins Date: Sun, 1 Nov 2026 14:27:34 -0700 Subject: [PATCH 05/17] fix CI build pipeline --- .github/workflows/build.yml | 5 +- CLAUDE.md | 2 +- README.md | 10 +++- documentation/troubleshooting.md | 7 +-- lib/widgets/network_map_online_layer.dart | 5 -- scripts/appimage-tools.json | 1 + scripts/appimage/Dockerfile | 4 +- scripts/appimage/test_packaging.sh | 56 +++++++++++++++++++++++ scripts/build_appimage.sh | 26 +++++++++-- 9 files changed, 99 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d6e92382..1af54dbd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,7 +56,7 @@ jobs: - name: Install Linux build deps run: | sudo apt-get update - sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev librsvg2-dev libgirepository1.0-dev libgtk-3-bin libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-dev patchelf file desktop-file-utils xdg-user-dirs shellcheck libssl-dev libunwind-dev libvulkan-dev libgl1-mesa-dev libasound2-dev libsecret-1-dev + 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 @@ -73,6 +73,7 @@ jobs: mkdir -p build/appimage-runtime docker run --rm --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 xvfb-run -a bash /test_runtime.sh /artifact.AppImage /results - uses: actions/upload-artifact@v4 + if: always() with: name: linux-x86_64-appimage path: | @@ -80,7 +81,7 @@ jobs: build/linux/x64/release/appimage-audit.txt build/linux/x64/release/appimage-tools.json build/appimage-runtime/ - if-no-files-found: error + if-no-files-found: warn macos: runs-on: macos-latest diff --git a/CLAUDE.md b/CLAUDE.md index 87d9ceab..1362a3a7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -24,7 +24,7 @@ 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; 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 also generate `build/linux/x64/release/meshcore-open-x86_64.AppImage` using linuxdeploy/GTK and an explicit appimagetool invocation. Tools and the 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 bundles trigger an isolated Ubuntu rebuild through an available Podman/Docker engine; 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. +Linux Release installs also generate `build/linux/x64/release/meshcore-open-x86_64.AppImage` using linuxdeploy/GTK and an explicit appimagetool invocation. Tools and the 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 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. diff --git a/README.md b/README.md index 7470da2b..d69a5524 100644 --- a/README.md +++ b/README.md @@ -170,7 +170,7 @@ 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-pixbuf2.0-dev patchelf binutils curl jq file desktop-file-utils xdg-user-dirs + libgdk-pixbuf-2.0-dev dpkg-dev patchelf binutils curl jq file desktop-file-utils xdg-user-dirs ``` The build automatically downloads checksum-verified linuxdeploy, its GTK @@ -181,6 +181,14 @@ 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. +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 diff --git a/documentation/troubleshooting.md b/documentation/troubleshooting.md index 886af097..660878c6 100644 --- a/documentation/troubleshooting.md +++ b/documentation/troubleshooting.md @@ -33,9 +33,10 @@ 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 ARM builds. -For a Nix build, verify that your user can access Podman or Docker without -interactive privilege escalation. The image is rebuilt in Ubuntu, not made -from the Nix-linked executable. The regular Nix bundle remains available if +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. diff --git a/lib/widgets/network_map_online_layer.dart b/lib/widgets/network_map_online_layer.dart index f9782058..c2581f57 100644 --- a/lib/widgets/network_map_online_layer.dart +++ b/lib/widgets/network_map_online_layer.dart @@ -109,15 +109,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 +133,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. /// diff --git a/scripts/appimage-tools.json b/scripts/appimage-tools.json index f8762768..209e5ccc 100644 --- a/scripts/appimage-tools.json +++ b/scripts/appimage-tools.json @@ -1,5 +1,6 @@ { "ubuntu": "ubuntu:24.04@sha256:fe81560990fae86dc4743202b2cb4d3df98d0bcf949173cecef15ce1127ef852", + "glibc": "2.39", "flutter": { "version": "3.47.4", "url": "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.47.4-stable.tar.xz", diff --git a/scripts/appimage/Dockerfile b/scripts/appimage/Dockerfile index 2d9b4106..9a14a2eb 100644 --- a/scripts/appimage/Dockerfile +++ b/scripts/appimage/Dockerfile @@ -5,8 +5,8 @@ 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 libgdk-pixbuf2.0-dev binutils patchelf curl jq \ - file desktop-file-utils xdg-user-dirs git rsync unzip xz-utils make g++ \ + 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/* diff --git a/scripts/appimage/test_packaging.sh b/scripts/appimage/test_packaging.sh index 1e338778..32854598 100644 --- a/scripts/appimage/test_packaging.sh +++ b/scripts/appimage/test_packaging.sh @@ -50,4 +50,60 @@ assert_fails download_verified "file://$temporary/input" \ printf 'corruption\n' >> "$temporary/cache/tool" assert_fails download_verified "file://$temporary/input" "$checksum" "$temporary/cache/tool" +mkdir -p "$temporary/project/scripts/appimage" +touch "$temporary/project/pubspec.lock" +cp "$project/scripts/appimage/Dockerfile" "$temporary/project/scripts/appimage/" + +# shellcheck disable=SC2329 +podman() { + case "$1" in + info) [[ "$mock_engine" == podman ]] ;; + image) return 0 ;; + run) printf '%s\n' "$@" > "$temporary/container-arguments" ;; + *) return 1 ;; + esac +} + +# shellcheck disable=SC2329 +docker() { + 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 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' \ No newline at end of file diff --git a/scripts/build_appimage.sh b/scripts/build_appimage.sh index 92063da4..1a4ba562 100644 --- a/scripts/build_appimage.sh +++ b/scripts/build_appimage.sh @@ -240,7 +240,7 @@ package_container() { 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); native Nix bundle is unchanged\n' \ + 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" \ @@ -252,13 +252,33 @@ package_container() { for key in FLUTTER_TARGET DART_DEFINES DART_OBFUSCATION SPLIT_DEBUG_INFO TREE_SHAKE_ICONS; do environment+=(--env "MESHCORE_APPIMAGE_$key") done - "$engine" run --rm --platform linux/amd64 --user "$(id -u):$(id -g)" \ + 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" @@ -276,7 +296,7 @@ main() { pin="$(sha256sum "$manifest")" pin="${pin%% *}" cache="${XDG_CACHE_HOME:-$HOME/.cache}/meshcore-open/appimage/$pin/x86_64" - if [[ "$(readelf -l "$bundle/meshcore_open")" == *'/nix/store/'* ]]; then + if requires_container_rebuild "$bundle/meshcore_open" "$(jq -er '.glibc' "$manifest")"; then package_container "$project" "$output" "$manifest" "$cache" else package_direct "$project" "$bundle" "$output" "$manifest" "$cache" From c7847f0d9e22dc04246928013aa129e2a830c713 Mon Sep 17 00:00:00 2001 From: Logan Rawlins Date: Sun, 1 Nov 2026 15:05:12 -0700 Subject: [PATCH 06/17] add arm64 appimage --- .github/workflows/build.yml | 107 +++++++++++++++++++++++++++++ CLAUDE.md | 2 +- README.md | 23 +++++-- documentation/troubleshooting.md | 9 ++- scripts/appimage-tools.json | 39 ++++++++--- scripts/appimage/Dockerfile | 4 +- scripts/appimage/test_packaging.sh | 40 ++++++++++- scripts/appimage/test_runtime.sh | 16 +++++ scripts/build_appimage.sh | 48 ++++++++----- 9 files changed, 248 insertions(+), 40 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1af54dbd..a3646763 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -83,6 +83,113 @@ jobs: 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" + - 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 toolchain + run: | + test "$(uname -m)" = aarch64 + mkdir -p build + flutter --version --machine > build/flutter-version.json + jq -e --arg revision "${{ steps.flutter-arm.outputs.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 + - run: flutter build linux --release --no-pub + - name: Test ARM64 AppImage in clean Ubuntu + run: | + docker build --platform linux/arm64 --target runtime-test --build-arg "BASE_IMAGE=$(jq -r '.ubuntu' scripts/appimage-tools.json)" -f scripts/appimage/Dockerfile -t meshcore-appimage-runtime-arm64 scripts + mkdir -p build/appimage-runtime + docker run --rm --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 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/ + 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 --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 + - run: flutter build linux --release --no-pub + - name: Test ARM64 AppImage in clean Ubuntu + run: | + docker build --platform linux/arm64 --target runtime-test --build-arg "BASE_IMAGE=$(jq -r '.ubuntu' scripts/appimage-tools.json)" -f scripts/appimage/Dockerfile -t meshcore-appimage-runtime-arm64 scripts + mkdir -p build/appimage-runtime + docker run --rm --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 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/ + if-no-files-found: warn + macos: runs-on: macos-latest steps: diff --git a/CLAUDE.md b/CLAUDE.md index 1362a3a7..9cad1ca8 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -24,7 +24,7 @@ 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; 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 also generate `build/linux/x64/release/meshcore-open-x86_64.AppImage` using linuxdeploy/GTK and an explicit appimagetool invocation. Tools and the 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 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. +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. diff --git a/README.md b/README.md index d69a5524..dc07feb1 100644 --- a/README.md +++ b/README.md @@ -152,11 +152,13 @@ The matrix describes implemented functionality, not a guarantee that every featu ### Linux AppImage -`flutter build linux --release` produces both the regular Flutter bundle and -`build/linux/x64/release/meshcore-open-x86_64.AppImage`. Packaging runs after -Flutter installs its assets and native libraries. Debug and Profile builds do -not produce an AppImage. The initial AppImage target is x86_64, with Ubuntu -24.04 as the packaging baseline; older distributions are not guaranteed. +`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: @@ -173,14 +175,21 @@ sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev \ libgdk-pixbuf-2.0-dev dpkg-dev patchelf binutils curl jq file desktop-file-utils xdg-user-dirs ``` -The build automatically downloads checksum-verified linuxdeploy, its GTK -plugin, appimagetool, and an AppImage runtime. Pins are in +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 diff --git a/documentation/troubleshooting.md b/documentation/troubleshooting.md index 660878c6..87969efd 100644 --- a/documentation/troubleshooting.md +++ b/documentation/troubleshooting.md @@ -31,7 +31,14 @@ 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 ARM builds. +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 diff --git a/scripts/appimage-tools.json b/scripts/appimage-tools.json index 209e5ccc..82ebbad4 100644 --- a/scripts/appimage-tools.json +++ b/scripts/appimage-tools.json @@ -3,25 +3,42 @@ "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": { - "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" - }, "gtk": { "url": "https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/7a3fbc31a9e5075073ff8790f26effbac5f84453/linuxdeploy-plugin-gtk.sh", "sha256": "b0f4cbc684a0103a9651f0955b635eaea0096b3a66c0f5a2c2aa337960375171" }, - "runtime": { - "url": "https://github.com/AppImage/type2-runtime/releases/download/20251108/runtime-x86_64", - "sha256": "2fca8b443c92510f1483a883f60061ad09b46b978b2631c807cd873a47ec260d" + "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" + } } } } \ No newline at end of file diff --git a/scripts/appimage/Dockerfile b/scripts/appimage/Dockerfile index 9a14a2eb..605484d4 100644 --- a/scripts/appimage/Dockerfile +++ b/scripts/appimage/Dockerfile @@ -22,6 +22,6 @@ 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 libgl1 libegl1 libgles2 \ - libgl1-mesa-dri fonts-dejavu-core \ + 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/* \ No newline at end of file diff --git a/scripts/appimage/test_packaging.sh b/scripts/appimage/test_packaging.sh index 32854598..876166fd 100644 --- a/scripts/appimage/test_packaging.sh +++ b/scripts/appimage/test_packaging.sh @@ -16,6 +16,10 @@ assert_fails() { 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" @@ -32,7 +36,13 @@ MESHCORE_BUILD_APPIMAGE=0 bash "$project/scripts/build_appimage.sh" \ 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 arm64 + "$project" /missing "$temporary/output" Release riscv64 +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" @@ -50,10 +60,36 @@ assert_fails download_verified "file://$temporary/input" \ 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() { case "$1" in @@ -84,7 +120,7 @@ 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 podman docker +unset -f jq podman docker # shellcheck disable=SC2329 readelf() { diff --git a/scripts/appimage/test_runtime.sh b/scripts/appimage/test_runtime.sh index f84a05aa..1a5f6589 100644 --- a/scripts/appimage/test_runtime.sh +++ b/scripts/appimage/test_runtime.sh @@ -4,6 +4,15 @@ set -euo pipefail image="$(realpath "$1")" mkdir -p "$2" output="$(realpath "$2")" +case "$(uname -m)" in + x86_64) expected_machine='Advanced Micro Devices X86-64' ;; + aarch64) expected_machine='AArch64' ;; + *) printf 'Unsupported runtime-test architecture: %s\n' "$(uname -m)" >&2; exit 1 ;; +esac +if ! readelf -h "$image" | grep -Fq "$expected_machine"; then + printf 'AppImage runtime is not built for %s\n' "$(uname -m)" >&2 + exit 1 +fi workspace="$(mktemp -d)" app_pid='' bus_pid='' @@ -23,6 +32,13 @@ appdir="$workspace/squashfs-root" -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" ]] +while IFS= read -r -d '' library; do + if readelf -h "$library" >/dev/null 2>&1 && \ + ! readelf -h "$library" | grep -Fq "$expected_machine"; then + printf 'Wrong ELF architecture in AppImage: %s\n' "${library#"$appdir/"}" >&2 + exit 1 + fi +done < <(find "$appdir/usr/bin" "$appdir/usr/lib" -type f -print0) ldd "$appdir/usr/bin/meshcore_open" > "$output/dependencies.log" 2>&1 while IFS= read -r -d '' library; do printf '\n%s\n' "${library#"$appdir/"}" >> "$output/dependencies.log" diff --git a/scripts/build_appimage.sh b/scripts/build_appimage.sh index 1a4ba562..572e42a4 100644 --- a/scripts/build_appimage.sh +++ b/scripts/build_appimage.sh @@ -10,6 +10,14 @@ 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" && \ @@ -53,13 +61,18 @@ require_tools() { } prepare_tools() { - local manifest="$1" cache="$2" tool url checksum + 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 - url="$(jq -er --arg tool "$tool" '.tools[$tool].url' "$manifest")" - checksum="$(jq -er --arg tool "$tool" '.tools[$tool].sha256' "$manifest")" + 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 @@ -104,14 +117,16 @@ audit_appdir() { } package_direct() { - local project="$1" bundle="$2" output="$3" manifest="$4" cache="$5" - local work appdir library relative linuxdeploy appimagetool + 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" + 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 @@ -172,10 +187,10 @@ package_direct() { cp "$MESHCORE_APPIMAGE_FLUTTER_ROOT/LICENSE" "$appdir/usr/share/doc/meshcore-open/Flutter-LICENSE" fi audit_appdir "$appdir" "$work/audit.txt" - ARCH=x86_64 "$appimagetool" --runtime-file "$cache/runtime" --no-appstream \ - "$appdir" "$work/meshcore-open-x86_64.AppImage" - chmod +x "$work/meshcore-open-x86_64.AppImage" - mv "$work/meshcore-open-x86_64.AppImage" "$output/meshcore-open-x86_64.AppImage" + 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" @@ -283,25 +298,26 @@ 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" == x64 || "$architecture" == x86_64 ]] || \ - { fail 'Only x86_64 AppImages are supported; set MESHCORE_BUILD_APPIMAGE=0 for other architectures'; return 1; } + 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-x86_64.AppImage" "$output/appimage-audit.txt" "$output/appimage-tools.json" + 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/x86_64" + 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" + package_direct "$project" "$bundle" "$output" "$manifest" "$cache" "$architecture" fi - printf 'AppImage created: %s/meshcore-open-x86_64.AppImage\n' "$output" + printf 'AppImage created: %s/meshcore-open-%s.AppImage\n' "$output" "$architecture" } if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then From 35161603a547aeaa0e2afd9cdff29a8080497e26 Mon Sep 17 00:00:00 2001 From: Logan Rawlins Date: Sun, 1 Nov 2026 15:11:52 -0700 Subject: [PATCH 07/17] remove duplicate linux-arm64 build --- .github/workflows/build.yml | 52 ------------------------------------- 1 file changed, 52 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a3646763..fbef5ae9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -83,58 +83,6 @@ jobs: 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" - - 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 toolchain - run: | - test "$(uname -m)" = aarch64 - mkdir -p build - flutter --version --machine > build/flutter-version.json - jq -e --arg revision "${{ steps.flutter-arm.outputs.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 - - run: flutter build linux --release --no-pub - - name: Test ARM64 AppImage in clean Ubuntu - run: | - docker build --platform linux/arm64 --target runtime-test --build-arg "BASE_IMAGE=$(jq -r '.ubuntu' scripts/appimage-tools.json)" -f scripts/appimage/Dockerfile -t meshcore-appimage-runtime-arm64 scripts - mkdir -p build/appimage-runtime - docker run --rm --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 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/ - if-no-files-found: warn - linux-arm64: runs-on: ubuntu-24.04-arm steps: From 43ba46ab88416631668375f4d422869b44195dd9 Mon Sep 17 00:00:00 2001 From: Logan Rawlins Date: Sun, 1 Nov 2026 15:22:26 -0700 Subject: [PATCH 08/17] fix arm64 build --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fbef5ae9..c149ea15 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -104,6 +104,7 @@ jobs: 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 From 563f7fbd2a4c96af2b016b3a2deb06e0482c01bc Mon Sep 17 00:00:00 2001 From: Logan Rawlins Date: Sun, 1 Nov 2026 15:27:10 -0700 Subject: [PATCH 09/17] suppress shellcheck for test packaging --- scripts/appimage/test_packaging.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/appimage/test_packaging.sh b/scripts/appimage/test_packaging.sh index 876166fd..0d6f930b 100644 --- a/scripts/appimage/test_packaging.sh +++ b/scripts/appimage/test_packaging.sh @@ -37,6 +37,7 @@ bash "$project/scripts/build_appimage.sh" "$project" /missing "$temporary/output [[ ! -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 @@ -52,7 +53,9 @@ check_bundle "$temporary/AppDir with spaces/usr/bin" 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" @@ -92,6 +95,7 @@ jq() { # shellcheck disable=SC2329 podman() { + # shellcheck disable=SC2317 case "$1" in info) [[ "$mock_engine" == podman ]] ;; image) return 0 ;; @@ -102,6 +106,7 @@ podman() { # shellcheck disable=SC2329 docker() { + # shellcheck disable=SC2317 case "$1" in info|image) return 0 ;; run) printf '%s\n' "$@" > "$temporary/container-arguments" ;; From 362275e387fc5996abbf54a370520ef8108328a0 Mon Sep 17 00:00:00 2001 From: Logan Rawlins Date: Sun, 1 Nov 2026 15:38:25 -0700 Subject: [PATCH 10/17] capture build log failure for clang++ --- .github/workflows/build.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c149ea15..bf7659d8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -121,7 +121,12 @@ jobs: bash scripts/appimage/test_packaging.sh - run: flutter pub get - run: flutter test --reporter expanded - - run: flutter build linux --release --no-pub + - 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 - name: Test ARM64 AppImage in clean Ubuntu run: | docker build --platform linux/arm64 --target runtime-test --build-arg "BASE_IMAGE=$(jq -r '.ubuntu' scripts/appimage-tools.json)" -f scripts/appimage/Dockerfile -t meshcore-appimage-runtime-arm64 scripts @@ -137,6 +142,7 @@ jobs: 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: From c8607804a368c70316e805f82e471069a3219458 Mon Sep 17 00:00:00 2001 From: ahalekelly <7078138+ahalekelly@users.noreply.github.com> Date: Sun, 1 Nov 2026 14:39:22 -0800 Subject: [PATCH 11/17] Bundle only llama.cpp from llamadart Translation runs GGUF models on llama.cpp. llamadart 0.8.20+ also bundles the LiteRT-LM runtime, whose iOS GemmaModelConstraintProvider.framework requires iOS 26.4, so App Store Connect rejects 16.4 builds (ITMS-90208). Co-Authored-By: Claude Opus 5.5 --- pubspec.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pubspec.yaml b/pubspec.yaml index 0f9d463b..bb48521f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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: From 9f19ace95a284ca3f3c10f5d71c4bd63bc233e56 Mon Sep 17 00:00:00 2001 From: ahalekelly <7078138+ahalekelly@users.noreply.github.com> Date: Sun, 1 Nov 2026 14:44:39 -0800 Subject: [PATCH 12/17] Re-sign native asset frameworks after setting MinimumOSVersion The Fix Native Asset Minimum OS phase edits each framework's Info.plist after it was signed, so development builds fail to install (ApplicationVerificationFailed on objective_c.framework). App Store exports re-sign and hid the problem. Co-Authored-By: Claude Opus 5.5 --- ios/Runner.xcodeproj/project.pbxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 52009fe5..07b7e4d0 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -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 */ From 2045809b32e1c0a331ed8afbd8932f5b62b99694 Mon Sep 17 00:00:00 2001 From: Logan Rawlins Date: Sun, 1 Nov 2026 15:49:37 -0700 Subject: [PATCH 13/17] fix ftserial to allow arm64 --- third_party/flserial/src/native_libs/src/impl/unix.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/third_party/flserial/src/native_libs/src/impl/unix.cpp b/third_party/flserial/src/native_libs/src/impl/unix.cpp index 0ad59cf8..f83fc29d 100644 --- a/third_party/flserial/src/native_libs/src/impl/unix.cpp +++ b/third_party/flserial/src/native_libs/src/impl/unix.cpp @@ -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"); From d8a33b7547a748da9a80ca8d2f9463d523710e7e Mon Sep 17 00:00:00 2001 From: Logan Rawlins Date: Sun, 1 Nov 2026 16:11:03 -0700 Subject: [PATCH 14/17] add docker layer cache for gh runners to speed up build time --- .github/workflows/build.yml | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bf7659d8..98817bcc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -67,11 +67,23 @@ jobs: bash scripts/appimage/test_packaging.sh - run: flutter pub get - run: flutter build linux --release --no-pub + - uses: docker/setup-buildx-action@v3 + - name: Build cached x86_64 runtime test image + run: | + docker buildx build \ + --platform linux/amd64 \ + --target runtime-test \ + --build-arg "BASE_IMAGE=$(jq -r '.ubuntu' scripts/appimage-tools.json)" \ + --cache-from type=gha,scope=meshcore-appimage-runtime-amd64 \ + --cache-to type=gha,mode=max,scope=meshcore-appimage-runtime-amd64 \ + --tag meshcore-appimage-runtime:ci \ + --load \ + -f scripts/appimage/Dockerfile \ + scripts - name: Test AppImage in clean Ubuntu run: | - docker build --target runtime-test --build-arg "BASE_IMAGE=$(jq -r '.ubuntu' scripts/appimage-tools.json)" -f scripts/appimage/Dockerfile -t meshcore-appimage-runtime scripts mkdir -p build/appimage-runtime - docker run --rm --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 xvfb-run -a bash /test_runtime.sh /artifact.AppImage /results + docker run --rm --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 xvfb-run -a bash /test_runtime.sh /artifact.AppImage /results - uses: actions/upload-artifact@v4 if: always() with: @@ -127,11 +139,23 @@ jobs: tail -n 200 build/linux-arm64-build.log exit 1 fi + - uses: docker/setup-buildx-action@v3 + - name: Build cached ARM64 runtime test image + run: | + docker buildx build \ + --platform linux/arm64 \ + --target runtime-test \ + --build-arg "BASE_IMAGE=$(jq -r '.ubuntu' scripts/appimage-tools.json)" \ + --cache-from type=gha,scope=meshcore-appimage-runtime-arm64 \ + --cache-to type=gha,mode=max,scope=meshcore-appimage-runtime-arm64 \ + --tag meshcore-appimage-runtime-arm64:ci \ + --load \ + -f scripts/appimage/Dockerfile \ + scripts - name: Test ARM64 AppImage in clean Ubuntu run: | - docker build --platform linux/arm64 --target runtime-test --build-arg "BASE_IMAGE=$(jq -r '.ubuntu' scripts/appimage-tools.json)" -f scripts/appimage/Dockerfile -t meshcore-appimage-runtime-arm64 scripts mkdir -p build/appimage-runtime - docker run --rm --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 xvfb-run -a bash /test_runtime.sh /artifact.AppImage /results + docker run --rm --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 xvfb-run -a bash /test_runtime.sh /artifact.AppImage /results - uses: actions/upload-artifact@v4 if: always() with: From 4ab32d796696315c99448195096bb090c93dd35c Mon Sep 17 00:00:00 2001 From: Logan Rawlins Date: Sun, 1 Nov 2026 19:15:54 -0700 Subject: [PATCH 15/17] fix gh buildx cache and test appimage logging --- .github/workflows/build.yml | 56 ++++++----- scripts/appimage/test_runtime.sh | 162 +++++++++++++++++++++++++------ 2 files changed, 166 insertions(+), 52 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 98817bcc..d04c783d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,22 +68,26 @@ jobs: - 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 - run: | - docker buildx build \ - --platform linux/amd64 \ - --target runtime-test \ - --build-arg "BASE_IMAGE=$(jq -r '.ubuntu' scripts/appimage-tools.json)" \ - --cache-from type=gha,scope=meshcore-appimage-runtime-amd64 \ - --cache-to type=gha,mode=max,scope=meshcore-appimage-runtime-amd64 \ - --tag meshcore-appimage-runtime:ci \ - --load \ - -f scripts/appimage/Dockerfile \ - scripts + 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 --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 xvfb-run -a bash /test_runtime.sh /artifact.AppImage /results + 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: @@ -140,22 +144,26 @@ jobs: 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 - run: | - docker buildx build \ - --platform linux/arm64 \ - --target runtime-test \ - --build-arg "BASE_IMAGE=$(jq -r '.ubuntu' scripts/appimage-tools.json)" \ - --cache-from type=gha,scope=meshcore-appimage-runtime-arm64 \ - --cache-to type=gha,mode=max,scope=meshcore-appimage-runtime-arm64 \ - --tag meshcore-appimage-runtime-arm64:ci \ - --load \ - -f scripts/appimage/Dockerfile \ - scripts + 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 --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 xvfb-run -a bash /test_runtime.sh /artifact.AppImage /results + 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: diff --git a/scripts/appimage/test_runtime.sh b/scripts/appimage/test_runtime.sh index 1a5f6589..d7a1f78b 100644 --- a/scripts/appimage/test_runtime.sh +++ b/scripts/appimage/test_runtime.sh @@ -4,73 +4,179 @@ 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 + fi + status=$? + tail -n 40 "$capture" >&2 || true + log "FAIL $label (exit $status after $((SECONDS - started))s)" + return "$status" +} + case "$(uname -m)" in x86_64) expected_machine='Advanced Micro Devices X86-64' ;; aarch64) expected_machine='AArch64' ;; - *) printf 'Unsupported runtime-test architecture: %s\n' "$(uname -m)" >&2; exit 1 ;; + *) 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 - printf 'AppImage runtime is not built for %s\n' "$(uname -m)" >&2 + log "AppImage runtime is not built for $(uname -m)" exit 1 fi + workspace="$(mktemp -d)" app_pid='' bus_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() { - [[ -z "$app_pid" ]] || kill "$app_pid" 2>/dev/null || true - [[ -z "$bus_pid" ]] || kill "$bus_pid" 2>/dev/null || true + log 'Cleanup: stopping application and D-Bus processes' + stop_process "$app_pid" + stop_process "$bus_pid" rm -rf "$workspace" } trap cleanup EXIT cd "$workspace" -printf 'AppImage runtime test: extracting image\n' + cp "$image" "$workspace/extractor" printf '\0\0\0' | dd of="$workspace/extractor" bs=1 seek=8 count=3 conv=notrunc status=none -timeout 60 "$workspace/extractor" --appimage-extract > /dev/null +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 && \ - ! readelf -h "$library" | grep -Fq "$expected_machine"; then - printf 'Wrong ELF architecture in AppImage: %s\n' "${library#"$appdir/"}" >&2 - exit 1 + 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) -ldd "$appdir/usr/bin/meshcore_open" > "$output/dependencies.log" 2>&1 +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 - printf '\n%s\n' "${library#"$appdir/"}" >> "$output/dependencies.log" - ldd "$library" >> "$output/dependencies.log" 2>&1 || true + 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' "$output/dependencies.log"; then - printf 'Unresolved AppImage dependencies\n' >&2 +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" -bus_pid="$(dbus-daemon --session --address="unix:path=$workspace/system-bus" --fork --print-pid)" -printf 'AppImage runtime test: launching application\n' +run_timed 'start private D-Bus system bus' 10s "$output/dbus-daemon.log" \ + dbus-daemon --session --address="unix:path=$workspace/system-bus" --fork --print-pid +bus_pid="$(<"$output/dbus-daemon.log")" +log "D-Bus system bus started: pid=$bus_pid" + +log 'Starting AppRun' 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_SYSTEM_BUS_ADDRESS="unix:path=$workspace/system-bus" \ dbus-run-session -- "$appdir/AppRun" > "$output/startup.log" 2>&1 & app_pid=$! -window="$(timeout 60 xdotool search --sync --onlyvisible --limit 1 --name 'MeshCore Open|meshcore_open')" -colors=0 -deadline=$((SECONDS + 60)) -while (( SECONDS < deadline )); do - kill -0 "$app_pid" - xwd -silent -id "$window" -out "$workspace/window.xwd" - convert "$workspace/window.xwd" "$output/startup.png" - colors="$(identify -format '%k' "$output/startup.png")" - (( colors < 20 )) || break +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 -(( colors >= 20 )) || { printf 'Application window remained blank\n' >&2; exit 1; } +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 -printf 'Extracted AppImage startup passed; screenshot: %s/startup.png\n' "$output" \ No newline at end of file +log "Runtime test passed; screenshot: $output/startup.png" \ No newline at end of file From 6a8173e116cd400d1d85f83c7bdd1835a05a811b Mon Sep 17 00:00:00 2001 From: Logan Rawlins Date: Sun, 1 Nov 2026 19:28:07 -0700 Subject: [PATCH 16/17] fix appimage test --- scripts/appimage/test_runtime.sh | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/scripts/appimage/test_runtime.sh b/scripts/appimage/test_runtime.sh index d7a1f78b..3182ec5a 100644 --- a/scripts/appimage/test_runtime.sh +++ b/scripts/appimage/test_runtime.sh @@ -18,11 +18,12 @@ run_timed() { 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 - status=$? - tail -n 40 "$capture" >&2 || true - log "FAIL $label (exit $status after $((SECONDS - started))s)" - return "$status" } case "$(uname -m)" in @@ -38,7 +39,6 @@ fi workspace="$(mktemp -d)" app_pid='' -bus_pid='' stop_process() { local process_id="$1" attempt [[ -n "$process_id" ]] || return 0 @@ -52,9 +52,8 @@ stop_process() { wait "$process_id" 2>/dev/null || true } cleanup() { - log 'Cleanup: stopping application and D-Bus processes' + log 'Cleanup: stopping application process' stop_process "$app_pid" - stop_process "$bus_pid" rm -rf "$workspace" } trap cleanup EXIT @@ -111,17 +110,14 @@ 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" -run_timed 'start private D-Bus system bus' 10s "$output/dbus-daemon.log" \ - dbus-daemon --session --address="unix:path=$workspace/system-bus" --fork --print-pid -bus_pid="$(<"$output/dbus-daemon.log")" -log "D-Bus system bus started: pid=$bus_pid" - -log 'Starting AppRun' +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_SYSTEM_BUS_ADDRESS="unix:path=$workspace/system-bus" \ - dbus-run-session -- "$appdir/AppRun" > "$output/startup.log" 2>&1 & + 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" From 512bc1952c8694db73596a348dfa41819aa75c30 Mon Sep 17 00:00:00 2001 From: ericz Date: Mon, 2 Nov 2026 18:00:15 +0100 Subject: [PATCH 17/17] guessed location filter applies to estimated online nodes. --- lib/screens/map_screen.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/screens/map_screen.dart b/lib/screens/map_screen.dart index b901a083..72083217 100644 --- a/lib/screens/map_screen.dart +++ b/lib/screens/map_screen.dart @@ -723,6 +723,7 @@ class _MapScreenState extends State with DisconnectNavigationMixin { final visibleOnlineRepeaters = _filterOnlineRepeatersBySettings( _online.repeaters, settings, + showGuessedLocations: settings.mapShowGuessedLocations, ); Contact? selectedContact; if (_selectedKey != null) { @@ -1439,12 +1440,15 @@ class _MapScreenState extends State with DisconnectNavigationMixin { List _filterOnlineRepeatersBySettings( List repeaters, - dynamic settings, - ) { + 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,