From 47a37ccc7a50637fa4d39c842d7df81760ee6836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= Date: Sun, 8 Jun 2025 13:48:57 +0200 Subject: [PATCH 01/11] build: add rust to build packages for snap --- snap/snapcraft.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 0e5a32f37..d19b62a7a 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -74,6 +74,8 @@ parts: - libssl-dev - curl - libpciaccess-dev + - cargo + - rustc stage-packages: - libsecret-1-0 - libjsoncpp25 From c9927477bc9dfe2d4d15958638d089121927f783 Mon Sep 17 00:00:00 2001 From: krille-chan Date: Sun, 8 Jun 2025 15:58:09 +0200 Subject: [PATCH 02/11] build: Upgrade flutter to 3.32.2 --- .github/workflows/versions.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/versions.env b/.github/workflows/versions.env index 1d646f732..b99b89cdf 100644 --- a/.github/workflows/versions.env +++ b/.github/workflows/versions.env @@ -1,2 +1,2 @@ -FLUTTER_VERSION=3.32.1 +FLUTTER_VERSION=3.32.2 JAVA_VERSION=17 From 40a7dde0592fda6528d0bedd05014c185874223c Mon Sep 17 00:00:00 2001 From: krille-chan Date: Sun, 8 Jun 2025 15:58:20 +0200 Subject: [PATCH 03/11] build: Remove olm from snapcraft --- snap/snapcraft.yaml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index d19b62a7a..61104d517 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -51,16 +51,6 @@ platforms: build-on: arm64 parts: - olm: - plugin: cmake - cmake-parameters: - - -DCMAKE_INSTALL_PREFIX=/usr - source: https://gitlab.matrix.org/matrix-org/olm.git - source-type: git - source-tag: '3.2.14' - build-packages: - - g++ - fluffychat: plugin: flutter source: . From a37b0946f23bd1274524fcb83a7663c4521676fb Mon Sep 17 00:00:00 2001 From: krille-chan Date: Sun, 8 Jun 2025 16:38:53 +0200 Subject: [PATCH 04/11] build: Update linux build and copy web pkg --- .github/workflows/main_deploy.yaml | 2 ++ pubspec.lock | 4 ++-- pubspec.yaml | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main_deploy.yaml b/.github/workflows/main_deploy.yaml index 44993e517..61662ded1 100644 --- a/.github/workflows/main_deploy.yaml +++ b/.github/workflows/main_deploy.yaml @@ -26,6 +26,8 @@ jobs: run: ./scripts/prepare-web.sh - name: Build Release Web run: flutter build web --dart-define=FLUTTER_WEB_CANVASKIT_URL=canvaskit/ --release --source-maps --base-href "/nightly/" + - name: Copy pkg directory for WASM + run: mv web/pkg build/web/ - run: mv build/web/ public - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v4 diff --git a/pubspec.lock b/pubspec.lock index 25cd6ac75..234dab9b2 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -720,10 +720,10 @@ packages: dependency: "direct main" description: name: flutter_vodozemac - sha256: e9a6257ccdefacd2bf0128fcf41086d809f05fb34e9a4ebe0f50e7e3ff4c0970 + sha256: d09dab2b4de9881adb864a3c258849ddb39ca2adf87d7ce2d932e90542f28547 url: "https://pub.dev" source: hosted - version: "0.2.0" + version: "0.2.1" flutter_web_auth_2: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 0e34fc568..fac756529 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -45,7 +45,7 @@ dependencies: git: url: https://github.com/famedly/flutter_typeahead.git ref: main - flutter_vodozemac: ^0.2.0 + flutter_vodozemac: ^0.2.1 flutter_web_auth_2: ^3.1.1 # Version 4 blocked by https://github.com/MixinNetwork/flutter-plugins/issues/379 flutter_webrtc: ^0.12.9 geolocator: ^13.0.1 From 2476e82c8e8d3b6e0654e954a5d5db56bf6b4b55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= Date: Mon, 9 Jun 2025 08:03:55 +0200 Subject: [PATCH 05/11] build: Follow up vodozemac web integration and clean up old scripts --- assets/js/package/.gitkeep | 0 pubspec.lock | 4 ++-- pubspec.yaml | 4 +--- scripts/build-macos.sh | 2 -- scripts/build-olm-windows.sh | 7 ------- scripts/prepare-macos.sh | 8 -------- 6 files changed, 3 insertions(+), 22 deletions(-) delete mode 100644 assets/js/package/.gitkeep delete mode 100755 scripts/build-olm-windows.sh delete mode 100755 scripts/prepare-macos.sh diff --git a/assets/js/package/.gitkeep b/assets/js/package/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/pubspec.lock b/pubspec.lock index 234dab9b2..6d5b4559f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -720,10 +720,10 @@ packages: dependency: "direct main" description: name: flutter_vodozemac - sha256: d09dab2b4de9881adb864a3c258849ddb39ca2adf87d7ce2d932e90542f28547 + sha256: "2405ca121b84d1cd83200a14021022e1691b123a23bcefc36adc7740cefbc1f9" url: "https://pub.dev" source: hosted - version: "0.2.1" + version: "0.2.2" flutter_web_auth_2: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index fac756529..8596ef90a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -45,7 +45,7 @@ dependencies: git: url: https://github.com/famedly/flutter_typeahead.git ref: main - flutter_vodozemac: ^0.2.1 + flutter_vodozemac: ^0.2.2 flutter_web_auth_2: ^3.1.1 # Version 4 blocked by https://github.com/MixinNetwork/flutter-plugins/issues/379 flutter_webrtc: ^0.12.9 geolocator: ^13.0.1 @@ -124,8 +124,6 @@ flutter: assets: - assets/ - assets/sounds/ - - assets/js/ - - assets/js/package/ msix_config: display_name: FluffyChat diff --git a/scripts/build-macos.sh b/scripts/build-macos.sh index 11d3e4a09..f25711e13 100755 --- a/scripts/build-macos.sh +++ b/scripts/build-macos.sh @@ -30,6 +30,4 @@ FLUFFYCHAT_ORIG_TEAM="4NXF6Z997G" ### Make release build ### flutter build macos --release -cp /usr/local/Cellar/libolm/**/lib/libolm.3.dylib build/macos/Build/Products/Release/FluffyChat.app/Contents/Frameworks/libolm.3.dylib - echo "Build build/macos/Build/Products/Release/FluffyChat.app" diff --git a/scripts/build-olm-windows.sh b/scripts/build-olm-windows.sh deleted file mode 100755 index 003b98eeb..000000000 --- a/scripts/build-olm-windows.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -git clone https://gitlab.matrix.org/matrix-org/olm.git -b 3.2.12 -cd olm -cmake . -Bbuild -DCMAKE_TOOLCHAIN_FILE=Windows64.cmake -cmake --build build -cd .. diff --git a/scripts/prepare-macos.sh b/scripts/prepare-macos.sh deleted file mode 100755 index 95f2a9cff..000000000 --- a/scripts/prepare-macos.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -if ! type "flutter" > /dev/null; then - brew install flutter -fi - -brew install libolm - From 72f0b821a7423387a3f24f0d2e18cf6a8e55c624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= Date: Mon, 9 Jun 2025 08:27:31 +0200 Subject: [PATCH 06/11] build: Follow up vodozemac web --- assets/vodozemac/.gitignore | 1 + lib/main.dart | 2 +- lib/utils/client_manager.dart | 2 +- pubspec.yaml | 1 + scripts/prepare-web.sh | 3 ++- 5 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 assets/vodozemac/.gitignore diff --git a/assets/vodozemac/.gitignore b/assets/vodozemac/.gitignore new file mode 100644 index 000000000..d9bc44261 --- /dev/null +++ b/assets/vodozemac/.gitignore @@ -0,0 +1 @@ +vodozemac_bindings_dart* \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 00b6b0042..f3be9dc52 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -21,7 +21,7 @@ void main() async { // widget bindings are initialized already. WidgetsFlutterBinding.ensureInitialized(); - await vod.init(); + await vod.init(wasmPath: './assets/assets/vodozemac/'); Logs().nativeColors = !PlatformInfos.isIOS; final store = await SharedPreferences.getInstance(); diff --git a/lib/utils/client_manager.dart b/lib/utils/client_manager.dart index 5ada7ac96..25b5af34e 100644 --- a/lib/utils/client_manager.dart +++ b/lib/utils/client_manager.dart @@ -101,7 +101,7 @@ abstract class ClientManager { ? const NativeImplementationsDummy() : NativeImplementationsIsolate( compute, - vodozemacInit: vod.init, + vodozemacInit: () => vod.init(wasmPath: './assets/assets/vodozemac/'), ); static Future createClient( diff --git a/pubspec.yaml b/pubspec.yaml index 8596ef90a..6d6fa1fed 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -124,6 +124,7 @@ flutter: assets: - assets/ - assets/sounds/ + - assets/vodozemac/ msix_config: display_name: FluffyChat diff --git a/scripts/prepare-web.sh b/scripts/prepare-web.sh index a92b3b256..4658253d1 100755 --- a/scripts/prepare-web.sh +++ b/scripts/prepare-web.sh @@ -5,5 +5,6 @@ cd .vodozemac cargo install flutter_rust_bridge_codegen flutter_rust_bridge_codegen build-web --dart-root dart --rust-root $(readlink -f rust) --release cd .. -mv .vodozemac/dart/web/pkg ./web/ +rm ./assets/vodozemac/vodozemac_bindings_dart* +mv .vodozemac/dart/web/pkg/vodozemac_bindings_dart* ./assets/vodozemac/ rm -rf .vodozemac \ No newline at end of file From 92735062f74d3902b7d9ea82d31ac589d17c0555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= Date: Mon, 9 Jun 2025 08:44:22 +0200 Subject: [PATCH 07/11] build: Follow up vodozemac web --- scripts/prepare-web.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/prepare-web.sh b/scripts/prepare-web.sh index 4658253d1..bc47f0237 100755 --- a/scripts/prepare-web.sh +++ b/scripts/prepare-web.sh @@ -5,6 +5,6 @@ cd .vodozemac cargo install flutter_rust_bridge_codegen flutter_rust_bridge_codegen build-web --dart-root dart --rust-root $(readlink -f rust) --release cd .. -rm ./assets/vodozemac/vodozemac_bindings_dart* +rm -f ./assets/vodozemac/vodozemac_bindings_dart* mv .vodozemac/dart/web/pkg/vodozemac_bindings_dart* ./assets/vodozemac/ rm -rf .vodozemac \ No newline at end of file From fe409481d6bd040e9b69b7e26dfe73d9e1cc1452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= Date: Mon, 9 Jun 2025 08:51:57 +0200 Subject: [PATCH 08/11] build: Follow up pkg wasm --- .github/workflows/main_deploy.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/main_deploy.yaml b/.github/workflows/main_deploy.yaml index 61662ded1..44993e517 100644 --- a/.github/workflows/main_deploy.yaml +++ b/.github/workflows/main_deploy.yaml @@ -26,8 +26,6 @@ jobs: run: ./scripts/prepare-web.sh - name: Build Release Web run: flutter build web --dart-define=FLUTTER_WEB_CANVASKIT_URL=canvaskit/ --release --source-maps --base-href "/nightly/" - - name: Copy pkg directory for WASM - run: mv web/pkg build/web/ - run: mv build/web/ public - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v4 From 11a45b281fd21813643ab96b4ac79eff8766ca86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= Date: Mon, 9 Jun 2025 09:06:04 +0200 Subject: [PATCH 09/11] build: Follow up vodozemac web prepare --- .github/workflows/main_deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main_deploy.yaml b/.github/workflows/main_deploy.yaml index 44993e517..0a394318c 100644 --- a/.github/workflows/main_deploy.yaml +++ b/.github/workflows/main_deploy.yaml @@ -21,9 +21,9 @@ jobs: flutter-version: ${{ env.FLUTTER_VERSION }} - uses: moonrepo/setup-rust@v1 - run: rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu - - run: flutter pub get - name: Prepare web run: ./scripts/prepare-web.sh + - run: flutter pub get - name: Build Release Web run: flutter build web --dart-define=FLUTTER_WEB_CANVASKIT_URL=canvaskit/ --release --source-maps --base-href "/nightly/" - run: mv build/web/ public From 00c0492574566cd25395a9daab4ce47c4bddb8ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= Date: Mon, 9 Jun 2025 09:08:45 +0200 Subject: [PATCH 10/11] build: Follow up remove gitignore before deploying --- .github/workflows/main_deploy.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main_deploy.yaml b/.github/workflows/main_deploy.yaml index 0a394318c..d9347edef 100644 --- a/.github/workflows/main_deploy.yaml +++ b/.github/workflows/main_deploy.yaml @@ -23,6 +23,7 @@ jobs: - run: rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu - name: Prepare web run: ./scripts/prepare-web.sh + - run: rm ./assets/vodozemac/.gitignore - run: flutter pub get - name: Build Release Web run: flutter build web --dart-define=FLUTTER_WEB_CANVASKIT_URL=canvaskit/ --release --source-maps --base-href "/nightly/" From 04839a5b60531847c53927d7c6e4e901d3047376 Mon Sep 17 00:00:00 2001 From: krille-chan Date: Mon, 9 Jun 2025 12:10:35 +0200 Subject: [PATCH 11/11] build: Follow up vodozemac snap --- snap/snapcraft.yaml | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 61104d517..1bd301866 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,7 +1,7 @@ name: fluffychat title: FluffyChat base: core24 -version: git +version: 1.27.0 license: AGPL-3.0 summary: The cutest messenger in the Matrix network description: | @@ -51,21 +51,48 @@ platforms: build-on: arm64 parts: + flutter-git: + source: https://github.com/flutter/flutter.git + source-tag: 3.32.2 + source-depth: 1 + plugin: nil + override-build: | + mkdir -p $CRAFT_PART_INSTALL/usr/bin + mkdir -p $CRAFT_PART_INSTALL/usr/libexec + cp -r $CRAFT_PART_SRC $CRAFT_PART_INSTALL/usr/libexec/flutter + ln -s $CRAFT_PART_INSTALL/usr/libexec/flutter/bin/flutter $CRAFT_PART_INSTALL/usr/bin/flutter + ln -s $SNAPCRAFT_PART_INSTALL/usr/libexec/flutter/bin/dart $SNAPCRAFT_PART_INSTALL/usr/bin/dart + $CRAFT_PART_INSTALL/usr/bin/flutter doctor + build-packages: + - clang + - cmake + - curl + - libgtk-3-dev + - ninja-build + - unzip + - xz-utils + - zip + override-prime: '' + fluffychat: - plugin: flutter + after: [flutter-git] + plugin: nil source: . override-build: | # Workaround for Flutter build error: rm -rf build - craftctl default + + flutter build linux --release -v + mkdir -p $CRAFT_PART_INSTALL/bin/ + cp -r build/linux/*/release/bundle/* $CRAFT_PART_INSTALL/bin/ build-packages: - libsecret-1-dev - libjsoncpp-dev - libssl-dev - curl - libpciaccess-dev - - cargo - - rustc + build-snaps: + - rustup stage-packages: - libsecret-1-0 - libjsoncpp25 @@ -79,7 +106,7 @@ slots: apps: fluffychat: - command: fluffychat + command: bin/fluffychat extensions: [ gnome ] plugs: - audio-playback