# Contributor: lauren n. liberda # Maintainer: lauren n. liberda pkgname=flutter # upgrade checklist: https://md.sdomi.pl/Q-ECZTJ2Qqyp3ahfJuYSBw pkgver=3.29.1 pkgrel=0 pkgdesc="Cross-platform apps, built in Omelas" url="https://flutter.dev/" arch="aarch64 x86_64" # officially supported for linux desktop license="BSD-3-Clause" _dartver=3.7.1 _depends_common=" bash clang cmake dart-sdk~$_dartver git gtk+3.0-dev pkgconf samurai " makedepends=" $_depends_common freetype-dev gn harfbuzz-dev icu-dev jpeg-dev libpng-dev llvm python3 spirv-tools-dev sqlite-dev zlib-dev zstd " subpackages=" $pkgname-common $pkgname-desktop $pkgname-developer $pkgname-glfw $pkgname-gtk $pkgname-tool $pkgname-tool-developer:tool_developer " case "$pkgver" in *.*.*_alpha*) _canonver="${pkgver/_alpha/-}" _canonver="${_canonver/_p/.}.dev" _channel=master ;; *.*.*_beta*) _canonver="${pkgver/_beta/-}" _canonver="${_canonver/_p/.}.beta" _channel=beta ;; *.*.*_pre*) _canonver="${pkgver/_pre/-}" _canonver="${_canonver/_p/.}.pre" _channel=master ;; *.*.*) _canonver="$pkgver" _channel=stable ;; esac case "$_dartver" in *.*.*_alpha*) _dartcanonver="${_dartver/_alpha/-}" _dartcanonver="${_dartcanonver/_p/.}.dev" ;; *.*.*_beta*) _dartcanonver="${_dartver/_beta/-}" _dartcanonver="${_dartcanonver/_p/.}.beta" ;; *.*.*) _dartcanonver="$_dartver" ;; esac _enginever=f73bfc4522dd0bc87bbcdb4bb3088082755c5e87 _materialfontsver=3012db47f3130e62f7cc0beabff968a33cbec8d8 _gradlewver=fd5c1f2c013565a3bea56ada6df9d2b8e96d56aa options="!check" # idk no attempt to build tests even with --enable-unittests source=" https://ab-sn.lnl.gay/flutter-$_canonver.tar.zst fonts-$_materialfontsver.zip.noauto::https://storage.googleapis.com/flutter_infra_release/flutter/fonts/$_materialfontsver/fonts.zip gradle-wrapper-$_gradlewver.tar.gz.noauto::https://storage.googleapis.com/flutter_infra_release/gradle-wrapper/$_gradlewver/gradle-wrapper.tgz alpine-target.patch doctor.patch no-lock.patch no-runtime-download.patch opt-in-analytics.patch system-dart.patch unbundle.patch version.patch pmos-if-touch-is-a-mouse-then-mouse-is-touch.patch geometry-floats.patch.engine git-revision.patch.engine target-musl.patch.engine musl-no-execinfo.patch.engine musl-no-mallinfo.patch.engine not-in-git.patch.engine no-vpython.patch.engine shared-libcxx.patch.engine libstdc++13.patch.engine system-icu.patch.engine unbundle.patch.engine unbundle-icu.patch.engine unbundle-icu.patch.dart flutter " builddir="$srcdir/flutter-$_canonver" export PUB_CACHE="$srcdir/flutter-$_canonver/pub_cache" export CFLAGS="${CFLAGS/-g/} -O2 -Wno-error -Wno-absolute-value -Wno-implicit-float-conversion" export CXXFLAGS="${CXXFLAGS/-g/} -O2 -Wno-error -Wno-absolute-value -Wno-implicit-float-conversion" case "$CARCH" in x86_64) _flutter_arch="x64" ;; aarch64) _flutter_arch="arm64" ;; esac _out="$builddir"/engine/src/out _modes='release profile debug' _release_out="$_out"/linux_release_$_flutter_arch _debug_out="$_out"/linux_debug_$_flutter_arch # gclient comes from teapot-tools _distbucket="sakamoto/lnl-aports-snapshots/" snapshot() { mkdir -p "$srcdir" cd "$srcdir" rm -rf src rm -rf flutter-$_canonver rm -f flutter-$_canonver.tar rm -f flutter-$_canonver.tar.zst mkdir flutter-$_canonver cd flutter-$_canonver echo " solutions = [{ 'name': '.', 'url': 'https://github.com/flutter/flutter.git@$_canonver', 'custom_vars': { 'download_android_deps': False, 'download_dart_sdk': True, }, }] target_cpu = ['x64', 'arm', 'arm64', 'riscv64'] target_cpu_only = True " > .gclient gclient sync --no-history --nohooks --tpot-cipd-ignore-platformed for elf in $(scanelf -RA -F "%F" .); do rm -f "$elf" done cd .. msg "generating tarball.." tar -cf flutter-$_canonver.tar \ --exclude="ChangeLog*" \ --exclude=".build-id" \ --exclude-backups \ --exclude-caches-all \ --exclude-vcs \ flutter-$_canonver zstd --auto-threads=logical --ultra --long -22 -T"${ZSTD_LIMIT:-0}" -vv flutter-$_canonver.tar -o "$SRCDEST"/flutter-$_canonver.tar.zst mcli cp "$SRCDEST"/flutter-$_canonver.tar.zst "$_distbucket" } prepare() { dos2unix engine/src/flutter/third_party/vulkan_memory_allocator/include/vk_mem_alloc.h default_prepare msg "Applying more patches" for x in $source; do case "$x" in *.patch.engine) msg "$x" patch -p1 -i "$srcdir"/$x -d engine/src ;; *.patch.dart) msg "$x" patch -p1 -i "$srcdir"/$x -d engine/src/flutter/third_party/dart ;; esac done _dart_installed="$(cat /usr/lib/dart/version)" if [ "$_dart_installed" != "$_dartcanonver" ]; then echo "mismatch between installed dart version ($_dart_installed) and downloaded source code ($_dartcanonver)" exit 1 fi echo -n "$_canonver" > version mkdir bin/cache ( cd engine/src # bind dart build mkdir -p flutter/third_party/dart/tools/sdks/dart-sdk/ ln -sv /usr/lib/dart/bin flutter/third_party/dart/tools/sdks/dart-sdk/bin rm -r flutter/prebuilts/linux-$_flutter_arch/dart-sdk/bin ln -sv /usr/lib/dart/bin flutter/prebuilts/linux-$_flutter_arch/dart-sdk/bin mkdir -p flutter/third_party/gn/ ln -sv /usr/bin/gn flutter/third_party/gn/gn # https://github.com/dart-lang/sdk/issues/52295 mkdir -p flutter/third_party/dart/.git/logs touch flutter/third_party/dart/.git/logs/HEAD # DEPS hooks python3 flutter/third_party/dart/tools/generate_package_config.py python3 flutter/third_party/dart/tools/generate_sdk_version_file.py python3 flutter/tools/pub_get_offline.py # reusable system library settings local use_system=" freetype2 harfbuzz icu libjpeg-turbo libpng libwebp sqlite zlib " for _lib in $use_system; do msg "Removing buildscripts for system provided $_lib" find . -type f -path "*third_party/$_lib/*" \ \! -path "*third_party/$_lib/chromium/*" \ \! -path "*third_party/$_lib/google/*" \ \! -regex '.*\.\(gn\|gni\|isolate\|py\)' \ -delete done msg "Replacing gn files" python3 build/linux/unbundle/replace_gn_files.py --system-libraries \ $use_system ) ( cd packages/flutter_tools/ # no pubspec.lock in repo (?) dart pub get --no-offline --no-precompile ) } build() { ( cd engine/src # shellcheck disable=2089 local gn_args=" dart_embed_icu_data=false host_libc=\"musl\" target_libc=\"musl\" use_custom_libcxx=false use_default_linux_sysroot=false " local gnw_args=" --no-goma --no-dart-version-git-info --linux --linux-cpu=$_flutter_arch --lto --clang --target-triple=$CTARGET --no-backtrace --no-stripped --prebuilt-dart-sdk --build-glfw-shell --build-engine-artifacts --no-enable-unittests --enable-fontconfig " for _mode in $_modes; do msg "Generating ninja files for engine - $_mode" # shellcheck disable=2090,2116 python3 ./flutter/tools/gn \ $gnw_args \ --runtime-mode="$_mode" \ --gn-args="$(echo $gn_args)" msg "Build engine artifacts - $_mode" ninja -C "$_out"/linux_${_mode}_$_flutter_arch artifacts done msg "Build flutter common and product patched sdk" ninja -C "$_release_out" flutter flutter_patched_sdk sky msg "Build debug patched sdk" ninja -C "$_debug_out" flutter_patched_sdk ) dart --verbosity=error \ --snapshot="bin/cache/flutter_tools.snapshot" --snapshot-kind="app-jit" \ --packages="packages/flutter_tools/.dart_tool/package_config.json" \ --no-enable-mirrors "packages/flutter_tools/bin/flutter_tools.dart" sed -Ei 's|'"$PUB_CACHE"'|/usr/lib/flutter/pub_cache|g' packages/flutter_tools/.dart_tool/package_config.json # looks like they can get created in the process find "$PUB_CACHE" -name '*.aot' -delete } check() { ( cd engine/src ln -s ./linux_debug_$_flutter_arch ./out/linux_debug_unopt python3 flutter/testing/run_tests.py --type=engine ) } package() { depends="flutter-developer=$pkgver-r$pkgrel" # our entrypoint install -Dm755 "$srcdir"/flutter "$pkgdir"/usr/lib/flutter/bin/flutter mkdir -p "$pkgdir"/usr/bin/ ln -s ../lib/flutter/bin/flutter "$pkgdir"/usr/bin/flutter # our dart mkdir -p "$pkgdir"/usr/lib/flutter/bin/cache/ ln -s ../../../dart "$pkgdir"/usr/lib/flutter/bin/cache/dart-sdk _devtoolsver="$(grep 'devtools_rev' engine/src/flutter/third_party/dart/DEPS | head -n1 | awk -F\" '{ print $4 }')" cat > "$pkgdir"/usr/lib/flutter/bin/cache/flutter.version.json < "$pkgdir"/usr/lib/flutter/version mkdir -p "$pkgdir"/usr/lib/flutter/bin/internal/ echo -n "$_enginever" > "$pkgdir"/usr/lib/flutter/bin/internal/engine.version # fonts mkdir -p "$pkgdir"/usr/lib/flutter/bin/cache/artifacts/material_fonts unzip "$srcdir"/fonts-"$_materialfontsver".zip.noauto \ -d "$pkgdir"/usr/lib/flutter/bin/cache/artifacts/material_fonts # gradle wrapper (-developer only, needed for flutter create) mkdir -p "$pkgdir"/usr/lib/flutter/bin/cache/artifacts/gradle_wrapper tar xf "$srcdir"/gradle-wrapper-"$_gradlewver".tar.gz.noauto \ -C "$pkgdir"/usr/lib/flutter/bin/cache/artifacts/gradle_wrapper # build-time artifacts from engine (for use by tool) for _mode in $_modes; do case "$_mode" in debug) _mode_art_name=linux-$_flutter_arch ;; *) _mode_art_name=linux-$_flutter_arch-$_mode ;; esac mkdir -p "$pkgdir"/usr/lib/flutter/bin/cache/artifacts/engine/$_mode_art_name/ unzip "$_out"/linux_${_mode}_$_flutter_arch/zip_archives/$_mode_art_name/artifacts.zip \ -d "$pkgdir"/usr/lib/flutter/bin/cache/artifacts/engine/$_mode_art_name/ done # they are all the same, simply copied from tree cp -r "$_release_out"/flutter_linux/ \ "$pkgdir"/usr/lib/flutter/bin/cache/artifacts/engine/linux-$_flutter_arch/flutter_linux ln -s ../linux-$_flutter_arch/flutter_linux "$pkgdir"/usr/lib/flutter/bin/cache/artifacts/engine/linux-$_flutter_arch-profile/flutter_linux ln -s ../linux-$_flutter_arch/flutter_linux "$pkgdir"/usr/lib/flutter/bin/cache/artifacts/engine/linux-$_flutter_arch-release/flutter_linux mkdir -p "$pkgdir"/usr/include/ ln -s ../lib/flutter/bin/cache/artifacts/engine/linux-$_flutter_arch/flutter_linux \ "$pkgdir"/usr/include/flutter_linux install -Dm755 "$_release_out"/libflutter_linux_gtk.so \ "$pkgdir"/usr/lib/libflutter_linux_gtk.so # see system-icu.patch.engine ln -s /usr/share/icu/*/icudt*l.dat "$pkgdir"/usr/lib/flutter/icudtl.dat install -Dm755 "$_release_out"/libflutter_linux_glfw.so "$pkgdir"/usr/lib/libflutter_linux_glfw.so } common() { pkgdesc="$pkgdesc (parts common to all targets)" depends="$_depends_common" amove usr/lib/flutter/bin/cache/artifacts/engine/common amove usr/lib/flutter/bin/cache/artifacts/material_fonts amove usr/lib/flutter/bin/cache/dart-sdk amove usr/lib/flutter/bin/cache/pkg amove usr/lib/flutter/bin/internal amove usr/lib/flutter/packages amove usr/lib/flutter/pub_cache } desktop() { pkgdesc="$pkgdesc (release linux desktop target)" depends="flutter-common=$pkgver-r$pkgrel flutter-glfw=$pkgver-r$pkgrel flutter-gtk=$pkgver-r$pkgrel flutter-tool=$pkgver-r$pkgrel" amove usr/include/flutter_linux amove usr/lib/flutter/bin/cache/artifacts/engine/linux-$_flutter_arch amove usr/lib/flutter/bin/cache/artifacts/engine/linux-$_flutter_arch-release } developer() { pkgdesc="$pkgdesc (app developer tools)" depends="flutter-desktop=$pkgver-r$pkgrel flutter-tool-developer=$pkgver-r$pkgrel" amove usr/lib/flutter/bin/cache/artifacts/engine/linux-$_flutter_arch-profile amove usr/lib/flutter/bin/cache/artifacts/gradle_wrapper } gtk() { pkgdesc="$pkgdesc (GTK embedder runtime)" depends="" amove usr/lib/libflutter_linux_gtk.so amove usr/lib/flutter/icudtl.dat } glfw() { pkgdesc="$pkgdesc (GLFW embedder runtime)" depends="" amove usr/lib/libflutter_linux_glfw.so } tool() { pkgdesc="$pkgdesc (CLI tool)" depends="flutter-common=$pkgver-r$pkgrel" amove usr/bin/flutter amove usr/lib/flutter/bin/cache/flutter_tools.snapshot amove usr/lib/flutter/bin/cache/flutter.version.json amove usr/lib/flutter/bin/flutter amove usr/lib/flutter/version } tool_developer() { pkgdesc="$pkgdesc (CLI tool, parts for app developers)" depends="flutter-tool=$pkgver-r$pkgrel" amove usr/lib/flutter/dev amove usr/lib/flutter/examples } sha512sums=" 054256cbe197cc15b0dd358a93719212f79819a4c93de187c53ba56061d13a26ecd362f203104be1336785ecebbc32cfbc74529916ad1f9e15ea653ad9b91488 flutter-3.29.1.tar.zst 604f9a256fb1ec8c1b3eb6636baa97f195012b89b68197aef28104ed59dbcb70bde4fc1c7e154018999beabda160b60fa1378bcc1cd1ebe71c79071f40ebb26f fonts-3012db47f3130e62f7cc0beabff968a33cbec8d8.zip.noauto fcce6b1659f3a4ee7849bf7f65a9b8e9b3046fc0cfae70d364efabbff2d6c1ed41e6e9009e5fabc522117cbd2f92c5c664f64426e2606fce6b69d9960dd6ca63 gradle-wrapper-fd5c1f2c013565a3bea56ada6df9d2b8e96d56aa.tar.gz.noauto 69a6df90f67f03a73a3e5d334b4f31188e2084775e1fe53744eb9cac89314355ba1bff33d93cbf6d2ac231d9a2511a71d9abd57878c2ff4d48e75725452556e4 alpine-target.patch cec69e02f72084f29ea27c9d3c5301091016f69f2f63055138bc09d7ba87a7e8709e15b9b0541a0afebe28ce966dda09e712e5acc8e2e7c86f68ac768037f1d0 doctor.patch f47f3bb1e97c79bdaf5fdd3b466936a335d80d48bffafa7c015a32d97a665d5450e63a33fd5eb0560215de57d556721eaa92db05848257427dd582b10543adda no-lock.patch 55a4973e001b425d65b419f92cfe9880a86a47b357e11b82da10d4c27eb8d12b72fbbcf28e25d555dd4e91eeb263089c7ea7a407491691ae591a362d1e314255 no-runtime-download.patch 91e598d9da383519f107c75669d8ec71f85afea38fa9e9a89e2f6c6088ce27f3107ab57e68931c5b27aec73788c9cd81123bcfae87152d878a170465aec9a193 opt-in-analytics.patch d3a31d863d3ded51484d67d7874e0776709dc42e70d2240bf093218ad1d45703e9be2fd25a3c6d58d684226527745d3e9490d9453abcb1aa90a7fc1781d61baf system-dart.patch a809cc1ad8598a4f8fe0cef01116b521c3aa8171c9099bb7eb2c0048c1d4283481b7495a125eafb9318f6a92e7bbfd7c5a59f30b925fd8c72fb367473ff3719d unbundle.patch 9af7c6e68c891dfdcb794cd7bd3090b1035c0f6a5c8edd13aeb08a268a103f4a6b99600a2a34d0897a958363f9fbc6d9a23cb0bb9823703204f167f2d5766fc7 version.patch 38673902256ee546c45cefd8e82f310ab7207ac50a038efcbf34c67dee04d626fa37462456729e7725729495ecd4ed7c0b16b72967ef768153d189d7b10c7439 pmos-if-touch-is-a-mouse-then-mouse-is-touch.patch 49afc6fb142680d42a27716a1f2fcb39a1240934a02d04117ec7cc6bf1da29a960f3bd25215da1211664da48c2cf5a3fda9d684197eee9606ddc76c36801b17e geometry-floats.patch.engine 2c74f25be53500f1b91bd920751dae72913167f7c45aa5aeec28a1712cc723ae469957ebbae60c230439af15483d5186052cef8e4f0e2caf3111d5b73234ed0d git-revision.patch.engine d60578a06001d3c6393b4f429f8cf32d50289c34b5157404ddb945d4e52c7c6733f4659128b3dfce9dc02efd9b498b75c1f3ec7533ccceaab9496577a5d628f8 target-musl.patch.engine d2c55af9dc64c380905cd5d9bc792cec2e37063265cc84643b77995f9787d2239fe34f596a575ac6aa9eae5d82cd55dcd1ed20d59f58c631291064a8c9ae47c0 musl-no-execinfo.patch.engine 5794a5f9f8532dc6615bc7c89c2f5953ad09a4e8cc1ef7618c9fa8a7816488714ab972b83fef0ff87da797404e182c516975d3376493b906be067edcda015914 musl-no-mallinfo.patch.engine 592e4d2239162f7c8f34a54b80d9d67fecd1d65924e06f23851362d6fecd6eed6f6ade18f463b5b9197641bdbf30be6717f19466d8c4a2b831d766cb68822dff not-in-git.patch.engine 6634043f5618835dd9f33a3ec473cdf11bfae2456ee670e2ea24c14f8f1f9d45f9dc273dcb035400d18404e74833c4df1d57e78a00de8010aa7e1e68099db6cd no-vpython.patch.engine e138d2b393db3aa1328199fc4d1ac4b2e0ef8384faf04bf077c6fd97ef9813f94b7f25fccbe5fed4919d7ec0bbd800289b5d3a9b8bc654cbe5c5574fb6bee329 shared-libcxx.patch.engine 1c7c06470881151ecd899b79e9ca5fb7661183c3124cfcfb711ceacbc8527ee50ba943307346db31dc72d3e8c102de690327730399887543cc5ca41ac2c41159 libstdc++13.patch.engine 56ab8c8ee82be1e39698605888b71a829ac59e309d1d02f932794b0ed4b0f2e8e7382e4530217723234733509a7a0c65e0e7627084c88687f00ab464cdd307c1 system-icu.patch.engine 160813c47cc3d12b2623208566b81be167781d2f16b1e57493ba565a0efc8b78b30c9af1f2962cfa7e9e96b61bf0357427af38f9130e219875528bdcd1588c66 unbundle.patch.engine 897df86c37e8d42296141e13da646b35a135391bdf78c922479d1e4f7af849e47213bc0bcc65415828c9ef794b855d4c5832c6ad781c78efb6c57bda8a7669de unbundle-icu.patch.engine 04478a0927c4f1c316346fc0e53386a841493b1e5c7facb4e2a2fffd11b5110a3779bca8bc5a33510964d320f24e883b6afc653c48849380c5b9097611a3eb55 unbundle-icu.patch.dart 38e6484b18cff811be30da4f770b281cbffccbcbd813121d55eb869edfca7e4ff751d59e6bfcc79c23d427d021d0fd363a7eff26bbc11a5dc90de2be1a153c4e flutter "