From 668f0a0ce79ecf4d4799ab4e34f59e47f574a2de Mon Sep 17 00:00:00 2001 From: "Lauren N. Liberda" Date: Sat, 29 Apr 2023 12:40:23 +0200 Subject: [PATCH] testing/fluffychat: new aport --- testing/fluffychat/APKBUILD | 91 +++++++++++++++++++++++++ testing/fluffychat/fluffychat.desktop | 8 +++ testing/fluffychat/no-werror.patch | 11 +++ testing/fluffychat/system-flutter.patch | 15 ++++ 4 files changed, 125 insertions(+) create mode 100644 testing/fluffychat/APKBUILD create mode 100644 testing/fluffychat/fluffychat.desktop create mode 100644 testing/fluffychat/no-werror.patch create mode 100644 testing/fluffychat/system-flutter.patch diff --git a/testing/fluffychat/APKBUILD b/testing/fluffychat/APKBUILD new file mode 100644 index 00000000000..2f21d41492e --- /dev/null +++ b/testing/fluffychat/APKBUILD @@ -0,0 +1,91 @@ +# Contributor: Lauren N. Liberda +# Maintainer: Lauren N. Liberda +pkgname=fluffychat +pkgver=1.12.1 +_ref=v$pkgver +pkgrel=0 +pkgdesc="Open source, nonprofit and cute Matrix messenger app" +url="https://fluffychat.im/" +arch="aarch64 x86_64" # flutter +license="AGPL-3.0-only" +# pub/file_picker +depends="zenity" +makedepends=" + flutter-desktop + glib-dev + jsoncpp-dev + libhandy1-dev + libsecret-dev + olm-dev + patchelf + " +source=" + https://gitlab.com/famedly/fluffychat/-/archive/$_ref/fluffychat-$_ref.tar.gz + + system-flutter.patch + no-werror.patch + + fluffychat.desktop + " +builddir="$srcdir/fluffychat-$_ref" +# net: pub dependencies +# !check: no tests +options="net !check" + +case "$CARCH" in + aarch64) _flutter_arch="arm64" ;; + x86_64) _flutter_arch="x64" ;; +esac + +export PUB_CACHE="$srcdir/pub_cache" + +export CFLAGS="${CFLAGS/-g/} -O2 -Wno-error -Wno-unknown-warning-option -Wno-unused-command-line-argument" +export CXXFLAGS="${CXXFLAGS/-g/} -O2 -Wno-error -Wno-unknown-warning-option -Wno-unused-command-line-argument" + +prepare() { + default_prepare + + flutter pub get --enforce-lockfile + + # if there is a binary in the pub_cache, we sure did not build it. + for elf in $(scanelf -RA -F "%F" "$PUB_CACHE"); do + rm -f "$elf" + done +} + +build() { + flutter build linux -v --release + + patchelf --set-rpath '$ORIGIN/lib' build/linux/"$_flutter_arch"/release/bundle/$pkgname + for _elf in build/linux/"$_flutter_arch"/release/bundle/lib/lib*.so; do + # running patchelf on libapp (the AOT snapshot of the whole Dart codebase) + # breaks it with "[FATAL:flutter/runtime/dart_vm_initializer.cc(89)] + # Error while initializing the Dart VM: Invalid vm isolate snapshot seen". + # + # it has no rpath and only links to libc soname anyway. 🤷‍♀️ + [ "$(basename "$_elf")" != "libapp.so" ] || continue + + patchelf --set-rpath '$ORIGIN' "$_elf" + done +} + +package() { + local bundle="$builddir"/build/linux/$_flutter_arch/release/bundle + + install -Dm755 "$bundle"/$pkgname "$pkgdir"/usr/lib/$pkgname/$pkgname + cp -rv "$bundle"/lib "$pkgdir"/usr/lib/$pkgname/lib + cp -rv "$bundle"/data "$pkgdir"/usr/lib/$pkgname/data + + mkdir -p "$pkgdir"/usr/bin + ln -sv /usr/lib/$pkgname/$pkgname "$pkgdir"/usr/bin/$pkgname + + install -Dm644 "$srcdir"/$pkgname.desktop "$pkgdir"/usr/share/applications/$pkgname.desktop + install -Dm644 assets/logo.svg "$pkgdir"/usr/share/icons/hicolor/scalable/apps/im.fluffychat.Fluffychat.svg +} + +sha512sums=" +00892dc24b0c235d0efd854284a067fda53ec929a09607af3123d3e25b16d643dcae761c690e73b6a8b26e1a5d8880b441c2ba3c00022824ac88693518f5d445 fluffychat-v1.12.1.tar.gz +91014708ab7bb81518ce93db0612209d6479dfa503064d9e9d3186cd5e861165a3f63e286d271d5aac8a1d676868fc3acf51648ac01c16a215062a317ccb6623 system-flutter.patch +1d2b7d28a09e26ed48d89aa5f5dffb738ba367fa2760b12980225239705e16fa1ec89901d7aecf26c8527de721a5f50f50cc77ea009cd5f25f219d1af8730ed8 no-werror.patch +c4b3c2ab656da666623a8269ae47d841bfa58153097106efbef7b7895e7845bfed0513442ac355b42b6804b4a68c597079bf4147e72c57a1906ba5b65e3150f8 fluffychat.desktop +" diff --git a/testing/fluffychat/fluffychat.desktop b/testing/fluffychat/fluffychat.desktop new file mode 100644 index 00000000000..578126c3e8e --- /dev/null +++ b/testing/fluffychat/fluffychat.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Name=Fluffychat +Icon=im.fluffychat.Fluffychat +Exec=fluffychat %U +Categories=Network;InstantMessaging;Chat;VideoConference; +Keywords=Matrix;Chat;Messenger;Social +X-Purism-FormFactor=Workstation;Mobile; diff --git a/testing/fluffychat/no-werror.patch b/testing/fluffychat/no-werror.patch new file mode 100644 index 00000000000..ec8df348612 --- /dev/null +++ b/testing/fluffychat/no-werror.patch @@ -0,0 +1,11 @@ +--- ./linux/CMakeLists.txt.orig ++++ ./linux/CMakeLists.txt +@@ -41,7 +41,7 @@ + # of modifying this function. + function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_14) +- target_compile_options(${TARGET} PRIVATE -Wall -Werror) ++ target_compile_options(${TARGET} PRIVATE -Wall) + target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") + target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") + endfunction() diff --git a/testing/fluffychat/system-flutter.patch b/testing/fluffychat/system-flutter.patch new file mode 100644 index 00000000000..e8f7270ec9a --- /dev/null +++ b/testing/fluffychat/system-flutter.patch @@ -0,0 +1,15 @@ +--- a/linux/CMakeLists.txt ++++ b/linux/CMakeLists.txt +@@ -110,12 +110,6 @@ + install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +-install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" +- COMPONENT Runtime) +- +-install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" +- COMPONENT Runtime) +- + foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) + install(FILES "${bundled_library}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"