Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/snap build #638

Merged
merged 2 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions qaul_ui/lib/force_update.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ class ForceUpdateSystem {
}
if (Platform.isLinux) {
final env = Platform.environment;
if (env["FLUTTER_ROOT"]!.contains('snap')) {
if (env.containsKey("SNAP_USER_COMMON")) {
return Directory(env['SNAP_USER_COMMON']!);
}
if (env.containsKey("FLUTTER_ROOT") &&
["FLUTTER_ROOT"].contains('snap')) {
return Directory('${env['HOME']}/snap/flutter/common');
}
return env.containsKey('SNAP')
? Directory('${env['HOME']}/snap/qaul/common')
: Directory('${env['HOME']}/.config/qaul');
return Directory('${env['HOME']}/.config/qaul');
}

// Returns the following Path:
Expand Down
1 change: 0 additions & 1 deletion qaul_ui/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ void main() async {
return MaterialApp(
theme: theme,
darkTheme: darkTheme,

localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
home: ForceUpdateDialog(
Expand Down
18 changes: 9 additions & 9 deletions qaul_ui/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ summary: qaul - Internet Independent Wireless Mesh Communication App
description: Communicate directly from device to device via your local wifi network, or via the shared wifi network of your phone. Mesh local clouds together via manually added static nodes. Use this peer to peer communication method to communicate internet independently and completely off-the-grid.

confinement: strict
base: core20
base: core22
grade: stable

slots:
Expand All @@ -16,7 +16,7 @@ slots:
apps:
qaul:
command: bin/qaul
extensions: [gnome-3-38]
extensions: [gnome]
plugs:
- home
- mount-observe
Expand Down Expand Up @@ -46,7 +46,7 @@ parts:
flutter-deps:
plugin: nil
source: https://github.com/flutter/flutter.git
source-tag: 3.22.2
source-tag: 3.22.1
override-build: |
set -eux
mkdir -p $SNAPCRAFT_PART_INSTALL/usr/bin
Expand All @@ -61,12 +61,12 @@ parts:
- curl
- ninja-build
- unzip
override-prime: ''
override-prime: ""

libqaul:
plugin: nil
source: https://github.com/qaul/qaul.net.git
after: [ rust-deps ]
after: [rust-deps]
build-packages:
- protobuf-compiler
- libc-bin
Expand All @@ -77,26 +77,26 @@ parts:
cargo --version

cd rust/libqaul || exit 1

rm build.rs
cargo build --release

cd ..

mkdir -p $SNAPCRAFT_PART_INSTALL/bin/lib
cp target/release/liblibqaul.so $SNAPCRAFT_PART_INSTALL/bin/lib

qaul:
plugin: nil
after: [ flutter-deps ]
after: [flutter-deps]
source: .
override-build: |
set -eux

BEFORE="_lib = DynamicLibrary.open('../rust/target/\$mode/liblibqaul.so');"
AFTER="_lib = DynamicLibrary.open('\${Platform.environment['SNAP']}/bin/lib/liblibqaul.so');"
sed -i -e "s|$BEFORE|$AFTER|g" packages/qaul_rpc/lib/src/libqaul/ffi.dart

flutter pub get || true
flutter build linux --release -v

Expand Down
Loading