testing/flutter: new aport

This commit is contained in:
Lauren N. Liberda 2023-02-19 02:20:14 +01:00 committed by Kevin Daudt
parent e708ca52c4
commit 0e42c2f520
22 changed files with 2602 additions and 0 deletions

487
testing/flutter/APKBUILD Normal file
View File

@ -0,0 +1,487 @@
# Contributor: Lauren N. Liberda <lauren@selfisekai.rocks>
# Maintainer: Lauren N. Liberda <lauren@selfisekai.rocks>
pkgname=flutter
pkgver=3.10.6
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.0.7
_depends_common="
bash
clang
cmake
dart-sdk~=$_dartver
git
gtk+3.0-dev
pkgconf
samurai
"
makedepends="
$_depends_common
fontconfig-dev
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/-r/.}.dev"
;;
*.*.*_beta*)
_canonver="${pkgver/_beta/-}"
_canonver="${_canonver/-r/.}.beta"
;;
*.*.*_pre*)
_canonver="${pkgver/_pre/-}"
_canonver="${_canonver/-r/.}.pre"
;;
*.*.*)
_canonver="$pkgver"
;;
esac
case "$_dartver" in
*.*.*_alpha*)
_dartcanonver="${_dartver/_alpha/-}"
_dartcanonver="${_canonver/-r/.}.dev"
;;
*.*.*_beta*)
_dartcanonver="${_dartver/_beta/-}"
_dartcanonver="${_canonver/-r/.}.beta"
;;
*.*.*)
_dartcanonver="$_dartver"
;;
esac
_enginever=cdbeda788a293fa29665dc3fa3d6e63bd221cb0d
_materialfontsver=3012db47f3130e62f7cc0beabff968a33cbec8d8
_gradlewver=fd5c1f2c013565a3bea56ada6df9d2b8e96d56aa
options="!check" # idk no attempt to build tests even with --enable-unittests
source="
https://github.com/flutter/flutter/archive/refs/tags/$_canonver/flutter-$_canonver.tar.gz
https://s3.sakamoto.pl/lnl-aports-snapshots/flutter-engine-$_enginever.tar.zst
https://s3.sakamoto.pl/lnl-aports-snapshots/dart-sdk-$_dartcanonver.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
unbundle.patch
version.patch
pmos-if-touch-is-a-mouse-then-mouse-is-touch.patch
git-revision.patch.engine
target-musl.patch.engine
musl-no-execinfo.patch.engine
musl-no-execinfo-2.patch.engine
musl-no-mallinfo.patch.engine
musl-random_r.patch.engine
no-vpython.patch.engine
shared-libcxx.patch.engine
libstdc++13.patch.engine
system-icu.patch.engine
unbundle.patch.engine
gn-args.patch.engine
flutter
"
builddir="$srcdir/flutter-$_canonver"
export PUB_CACHE="$srcdir/flutter-$_canonver/pub_cache"
case "$CARCH" in
x86_64) _flutter_arch="x64" ;;
aarch64) _flutter_arch="arm64" ;;
esac
_out="$srcdir"/flutter-engine-$_enginever/out
_modes='release profile debug'
_release_out="$_out"/linux_release_$_flutter_arch
_debug_out="$_out"/linux_debug_$_flutter_arch
# gclient comes from teapot-tools
snapshot() {
mkdir -p "$srcdir"
cd "$srcdir"
rm -rf src
rm -rf flutter-engine-$_enginever
rm -f flutter-engine-$_enginever.tar
rm -f flutter-engine-$_enginever.tar.zst
echo "
solutions = [{
'name': 'src/flutter',
'url': 'https://github.com/flutter/engine.git@$_enginever',
'custom_vars': {
'download_android_deps': False,
'download_dart_sdk': False,
},
}]
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" src); do
rm -f "$elf"
done
mv src flutter-engine-$_enginever
msg "generating tarball.."
tar -cf flutter-engine-$_enginever.tar \
--exclude="ChangeLog*" \
--exclude=".build-id" \
--exclude="third_party/dart" \
--exclude-backups \
--exclude-caches-all \
--exclude-vcs \
flutter-engine-$_enginever
zstd --ultra --long -22 -T4 -vv flutter-engine-$_enginever.tar
}
prepare() {
dos2unix "$srcdir"/flutter-engine-$_enginever/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 "$srcdir"/flutter-engine-$_enginever
;;
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 "$srcdir"/flutter-engine-$_enginever
# bind dart source code
rm -rf third_party/dart
ln -s "$srcdir"/dart-sdk-$_dartcanonver third_party/dart
# bind dart build
mkdir -p third_party/dart/tools/sdks/dart-sdk/
ln -s /usr/lib/dart/bin third_party/dart/tools/sdks/dart-sdk/bin
mkdir -p flutter/prebuilts/linux-$_flutter_arch/dart-sdk/
ln -s /usr/lib/dart/bin flutter/prebuilts/linux-$_flutter_arch/dart-sdk/bin
mkdir -p flutter/third_party/gn/
ln -s /usr/bin/gn flutter/third_party/gn/gn
# https://github.com/dart-lang/sdk/issues/52295
mkdir -p third_party/dart/.git/logs
touch third_party/dart/.git/logs/HEAD
# DEPS hooks
python3 third_party/dart/tools/generate_package_config.py
python3 third_party/dart/tools/generate_sdk_version_file.py
python3 flutter/tools/pub_get_offline.py
# reusable system library settings
local use_system="
fontconfig
freetype2
harfbuzz
icu
libjpeg-turbo
libpng
libwebp
libxml
sqlite
vulkan-SPIRV-Headers
vulkan-SPIRV-Tools
zlib
"
for _lib in $use_system vulkan-deps/spirv-headers vulkan-deps/spirv-tools; 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/*" \
\! -path './third_party/libxml/*' \
\! -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 "$srcdir"/flutter-engine-$_enginever
# shellcheck disable=2089
local gn_args="
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 --disable-dart-dev \
--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
}
check() {
(
cd "$srcdir"/flutter-engine-$_enginever
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
# flutter tool (cli) snapshot
install -Dm755 "$builddir"/bin/cache/flutter_tools.snapshot "$pkgdir"/usr/lib/flutter/bin/cache/flutter_tools.snapshot
# patched sdk
mkdir -p "$pkgdir"/usr/lib/flutter/bin/cache/artifacts/engine/common
cp -r "$_release_out"/flutter_patched_sdk/ \
"$pkgdir"/usr/lib/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk_product
cp -r "$_debug_out"/flutter_patched_sdk/ \
"$pkgdir"/usr/lib/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk
# dart:ui package
mkdir -p "$pkgdir"/usr/lib/flutter/bin/cache/pkg
cp -rL "$_release_out"/gen/dart-pkg/sky_engine "$pkgdir"/usr/lib/flutter/bin/cache/pkg/sky_engine
# flutter tool and framework packages (as part of sdk)
cp -r "$builddir"/packages "$pkgdir"/usr/lib/flutter/packages
# needed for flutter analyze 🤨
cp -r "$builddir"/dev "$pkgdir"/usr/lib/flutter/dev
cp -r "$builddir"/examples "$pkgdir"/usr/lib/flutter/examples
# pub dependencies of flutter (part of sdk)
cp -r "$PUB_CACHE" "$pkgdir"/usr/lib/flutter/pub_cache
# version files
echo -n "$_canonver" > "$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/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="
f393c7896af4926b65e830978fe171b026649f242cc46d058e94aeae3b3c05f359646a2bef846948731f5c38121d28a609a90c6edd5efc2f3208f73e213f6659 flutter-3.10.6.tar.gz
c89f3ed27bc1dc2f1bd7d97b825dd3e805c5ff93a9ee7a0734e6a85caa47f21cf73dfc51112bf4f0ddbffc22637a92c035a22d52e45afb3e955a906e61b5fc25 flutter-engine-cdbeda788a293fa29665dc3fa3d6e63bd221cb0d.tar.zst
330206410b98c4d79cd46375c52437d7c0c31f107db10b410621162e03b8e3e5b9fb97469152969a810b148d9c5996cd7a0a32daed767bf676fb3a2fd8d4ef29 dart-sdk-3.0.7.tar.zst
604f9a256fb1ec8c1b3eb6636baa97f195012b89b68197aef28104ed59dbcb70bde4fc1c7e154018999beabda160b60fa1378bcc1cd1ebe71c79071f40ebb26f fonts-3012db47f3130e62f7cc0beabff968a33cbec8d8.zip.noauto
fcce6b1659f3a4ee7849bf7f65a9b8e9b3046fc0cfae70d364efabbff2d6c1ed41e6e9009e5fabc522117cbd2f92c5c664f64426e2606fce6b69d9960dd6ca63 gradle-wrapper-fd5c1f2c013565a3bea56ada6df9d2b8e96d56aa.tar.gz.noauto
a7d6e459a8884bd2b7083b15e6d113576e454c68feba8fcf467c6d288e6abca656a1e669eee2b9973d0b30a1dfbbd736d8ee65292d42bbd832059703b7067dd8 alpine-target.patch
a9db5df026cf641728f744ffd3428db9cf3918718233c707fd154a88b321c4a7af8e41ac6c3b08f1f4614c6b49e0689653b3b01e35c1e3ff3c5c9e7920fdd8d4 doctor.patch
f47f3bb1e97c79bdaf5fdd3b466936a335d80d48bffafa7c015a32d97a665d5450e63a33fd5eb0560215de57d556721eaa92db05848257427dd582b10543adda no-lock.patch
b2705a855163660cc3c472f6416d5839d9d4947164e2ea0ed97e93645255f27b7b513e7dc7de196cae5685b5e328b35ebd65b614be9b32f2fddd1fc8053a3963 no-runtime-download.patch
91e598d9da383519f107c75669d8ec71f85afea38fa9e9a89e2f6c6088ce27f3107ab57e68931c5b27aec73788c9cd81123bcfae87152d878a170465aec9a193 opt-in-analytics.patch
9855cf075781e1d1032f6a8dcc160cdcfc4d360875bc4fe005c83ca87dec767f1ce15e7c55d653688f1f2f0cb6b0b0328ccfd826e18ececc50d5d41d8b5b89d2 unbundle.patch
f8d0a0ec9dd3e2df3a46a06540c4c236994fb058cecebdbf0dbe2fcc7bda19069341c0e65464b0c7f06c77acaa6b3b9a6832fd29ea58429000ffa5d94b34afc0 version.patch
38673902256ee546c45cefd8e82f310ab7207ac50a038efcbf34c67dee04d626fa37462456729e7725729495ecd4ed7c0b16b72967ef768153d189d7b10c7439 pmos-if-touch-is-a-mouse-then-mouse-is-touch.patch
cf07aec8878965cf4729700217857d66c37b9258ccab9a9cf4dd199f97f084504b6ad5dbf8d79ca538cbe86f94092f41be53251940ba0f062ca7fcb6d4de616a git-revision.patch.engine
5276b7d94c51c7362938693b5d5668008787b27a191ee2680efd3f9d71edeffe953622658604e43939b73ecc60f5afe004e60170ae70625f803ff611befb25a7 target-musl.patch.engine
862f5ff1825309d8a0efc21e3b70668037646be8eb673df88935afd739f805b4dd2abf49e1b736afe1065ceb4e3415b0e2c88e56b9e6f926c74d762bde28a851 musl-no-execinfo.patch.engine
ec58a07778ae2c6924da98eb343f2c19a84f5201f660b02e2f7a71593550cce364930add5661910726d47203cba942a5557d7b23e86d9b60d3491fb8ff28117f musl-no-execinfo-2.patch.engine
3fc4769fff7267c9956cf1f318fb1d8d592b9b4ddfd32268bede69e6315e80bb297cc28a4b47922d96f5f71d45fe2dff3d84a3469043ee742ea490b0b1cd7bba musl-no-mallinfo.patch.engine
b4996af19dc3b38cf508d6c3e101fb2cfdcd325583003ebdbff5d4e5fcc41edcb585d246fa8077a20bb007a1bccc5f207739e86d9748dce7ef742c2583d9a0b6 musl-random_r.patch.engine
6634043f5618835dd9f33a3ec473cdf11bfae2456ee670e2ea24c14f8f1f9d45f9dc273dcb035400d18404e74833c4df1d57e78a00de8010aa7e1e68099db6cd no-vpython.patch.engine
ae90bd902c5b7b232d1142f21c93a0a81ef62d19f4c6efd4bc5841a6be8e4b17e4227b2c6230f69832263de7dff964c89cdab94b25df02fd8dc268b440f7dbe2 shared-libcxx.patch.engine
4af257ab2ef60b1b3e127183eeddd8d5c2b95bbd37dddfe5dd1754ccb26624b032b5d9e598f25b3522f8e664425bf2032b2177142159a9d7e3eb58202252b39a libstdc++13.patch.engine
c0066e5668405c8377292d17e8f5ec26b7c24caae1a44a64528130f5da2c2913f9f87718504983af9ab858b3f9783dbff9e3dcac70264e3195ae01b3c87aa87f system-icu.patch.engine
77afe1c7e22f00eace1b67486e92cfd75b1658f52f2326290720a149d42e1536eb20e254f1bd80fa6456713dabc6be4b9eb17d2affce04a48b4b6b5c9054810a unbundle.patch.engine
21937b76539cd3317dac6cd5292e5c18188c6a934fe5f0b5dad64d822055419c0f90ab942bfbfd6470802896bef40b99279d2a834fac3e5ac53cbd087c0d9791 gn-args.patch.engine
9c6cb9b0bdb4333f139d1d7115792de688ac99e0ab6987b0f7e5881a83a1feab2d635bc483cd7aed246e4077a65974c83cfe489acbe59853e93abafdfa0cd7d8 flutter
"

View File

@ -0,0 +1,14 @@
--- ./packages/flutter_tools/lib/src/linux/build_linux.dart.orig
+++ ./packages/flutter_tools/lib/src/linux/build_linux.dart
@@ -135,9 +135,9 @@
if (needCrossBuild)
'-DFLUTTER_TARGET_PLATFORM_SYSROOT=$targetSysroot',
if (needCrossBuildOptionsForArm64)
- '-DCMAKE_C_COMPILER_TARGET=aarch64-linux-gnu',
+ '-DCMAKE_C_COMPILER_TARGET=aarch64-alpine-linux-musl',
if (needCrossBuildOptionsForArm64)
- '-DCMAKE_CXX_COMPILER_TARGET=aarch64-linux-gnu',
+ '-DCMAKE_CXX_COMPILER_TARGET=aarch64-alpine-linux-musl',
sourceDir.path,
],
workingDirectory: buildDir.path,

View File

@ -0,0 +1,17 @@
--- a/packages/flutter_tools/lib/src/doctor.dart
+++ b/packages/flutter_tools/lib/src/doctor.dart
@@ -621,14 +621,6 @@
'$flutterBinDir to your path.',
);
}
- final String resolvedFlutterPath = flutterBin.resolveSymbolicLinksSync();
- if (!_filePathContainsDirPath(flutterRoot, resolvedFlutterPath)) {
- final String hint = 'Warning: `$binary` on your path resolves to '
- '$resolvedFlutterPath, which is not inside your current Flutter '
- 'SDK checkout at $flutterRoot. Consider adding $flutterBinDir to '
- 'the front of your path.';
- return ValidationMessage.hint(hint);
- }
return null;
}

23
testing/flutter/flutter Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
# adapted by lnl from project's repo
# To debug the tool, you can pass the following env to enable debug
# mode and set an observatory port:
# FLUTTER_TOOL_ARGS="$FLUTTER_TOOL_ARGS --enable-asserts --observe=65432"
set -e
export FLUTTER_ROOT="/usr/lib/flutter"
FLUTTER_TOOLS_DIR="$FLUTTER_ROOT/packages/flutter_tools"
SNAPSHOT_PATH="$FLUTTER_ROOT/bin/cache/flutter_tools.snapshot"
# Test if running as superuser but don't warn if running within Docker or CI.
if [ "$(id -u)" = "0" ] && ! [ -f /.dockerenv ] && [ "$CI" != "true" ] && [ "$BOT" != "true" ] && [ "$CONTINUOUS_INTEGRATION" != "true" ]; then
>&2 echo " Woah! You appear to be trying to run flutter as root."
>&2 echo " We strongly recommend running the flutter tool without superuser privileges."
>&2 echo " /"
>&2 echo "📎"
fi
exec dart --disable-dart-dev --packages="$FLUTTER_TOOLS_DIR/.dart_tool/package_config.json" $FLUTTER_TOOL_ARGS "$SNAPSHOT_PATH" "$@"

View File

@ -0,0 +1,22 @@
--- a/flutter/build/git_revision.py
+++ b/flutter/build/git_revision.py
@@ -22,18 +22,7 @@
if not os.path.exists(repository):
raise IOError('path does not exist')
- git = 'git'
- if is_windows():
- git = 'git.bat'
- version = subprocess.check_output([
- git,
- '-C',
- repository,
- 'rev-parse',
- 'HEAD',
- ])
-
- return str(version.strip(), 'utf-8')
+ return '0' * 41
def main():

View File

@ -0,0 +1,19 @@
--- ./flutter/tools/gn.orig
+++ ./flutter/tools/gn
@@ -1018,6 +1038,8 @@
# Verbose output.
parser.add_argument('--verbose', default=False, action='store_true')
+ parser.add_argument('--gn-args', type=str, nargs='+')
+
return parser.parse_args(args)
@@ -1049,6 +1071,7 @@
command.append('--export-compile-commands=default')
gn_args = to_command_line(to_gn_args(args))
+ gn_args.extend(args.gn_args or [])
out_dir = get_out_dir(args)
command.append(out_dir)
command.append('--args=%s' % ' '.join(gn_args))

View File

@ -0,0 +1,123 @@
missing libstdc++13 includes
--
--- a/third_party/swiftshader/third_party/llvm-10.0/llvm/include/llvm/Support/Signals.h
+++ b/third_party/swiftshader/third_party/llvm-10.0/llvm/include/llvm/Support/Signals.h
@@ -14,6 +14,7 @@
#ifndef LLVM_SUPPORT_SIGNALS_H
#define LLVM_SUPPORT_SIGNALS_H
+#include <cstdint>
#include <string>
namespace llvm {
--- a/third_party/swiftshader/src/System/LRUCache.hpp
+++ b/third_party/swiftshader/src/System/LRUCache.hpp
@@ -18,6 +18,7 @@
#include "System/Debug.hpp"
#include <cstddef>
+#include <cstdint>
#include <functional>
#include <unordered_set>
#include <vector>
--- ./third_party/vulkan_memory_allocator/include/vk_mem_alloc.h.orig
+++ ./third_party/vulkan_memory_allocator/include/vk_mem_alloc.h
@@ -2566,6 +2566,7 @@
#undef VMA_IMPLEMENTATION
#include <cstdint>
+#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <utility>
--- ./flutter/third_party/tonic/filesystem/filesystem/file.h.orig
+++ ./flutter/third_party/tonic/filesystem/filesystem/file.h
@@ -5,6 +5,7 @@
#ifndef FILESYSTEM_FILE_H_
#define FILESYSTEM_FILE_H_
+#include <stdint.h>
#include <string>
#include <vector>
--- ./flutter/impeller/geometry/point.h.orig
+++ ./flutter/impeller/geometry/point.h
@@ -6,6 +6,7 @@
#include <algorithm>
#include <cmath>
+#include <cstdint>
#include <ostream>
#include <string>
#include <type_traits>
--- ./flutter/impeller/geometry/size.h.orig
+++ ./flutter/impeller/geometry/size.h
@@ -6,6 +6,7 @@
#include <algorithm>
#include <cmath>
+#include <cstdint>
#include <limits>
#include <ostream>
#include <string>
--- ./flutter/fml/hex_codec.cc.orig
+++ ./flutter/fml/hex_codec.cc
@@ -4,6 +4,7 @@
#include "flutter/fml/base32.h"
+#include <cstdint>
#include <string>
namespace fml {
--- ./flutter/fml/base32.cc.orig
+++ ./flutter/fml/base32.cc
@@ -4,6 +4,7 @@
#include "flutter/fml/base32.h"
+#include <cstdint>
#include <limits>
#include <string>
--- ./flutter/runtime/dart_service_isolate.h.orig
+++ ./flutter/runtime/dart_service_isolate.h
@@ -6,6 +6,7 @@
#define FLUTTER_RUNTIME_DART_SERVICE_ISOLATE_H_
#include <functional>
+#include <memory>
#include <mutex>
#include <set>
#include <string>
--- ./flutter/flow/paint_region.h.orig
+++ ./flutter/flow/paint_region.h
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <memory>
#include <vector>
#include "flutter/fml/logging.h"
#include "third_party/skia/include/core/SkRect.h"
--- ./flutter/vulkan/vulkan_surface.h.orig
+++ ./flutter/vulkan/vulkan_surface.h
@@ -5,6 +5,8 @@
#ifndef FLUTTER_VULKAN_VULKAN_SURFACE_H_
#define FLUTTER_VULKAN_VULKAN_SURFACE_H_
+#include <memory>
+
#include "flutter/fml/macros.h"
#include "flutter/vulkan/procs/vulkan_handle.h"
#include "third_party/skia/include/core/SkSize.h"
--- ./flutter/shell/platform/glfw/flutter_glfw.cc.orig
+++ ./flutter/shell/platform/glfw/flutter_glfw.cc
@@ -7,6 +7,7 @@
#include <GLFW/glfw3.h>
#include <algorithm>
+#include <atomic>
#include <cassert>
#include <chrono>
#include <cstdlib>

View File

@ -0,0 +1,103 @@
rebased config changes and paths to buildroot -lnl
cherry-pick from main: https://github.com/flutter/engine/pull/40980
From b5a8c75cfed7872553874b1721e82d3548f93b4d Mon Sep 17 00:00:00 2001
From: Chris Bracken <chris@bracken.jp>
Date: Thu, 6 Apr 2023 15:08:08 -0700
Subject: [PATCH] Support disabling backtrace support
This adds a gn flag (--backtrace, --no-backtrace) that defaults to
enabling backtraces, which drives a gn variable `enable_backtrace` which
is defaulted true for debug builds.
Backtrace collection is supported on Windows, and on POSIX-like
operating systems via execinfo.h. execinfo support exists in macOS/iOS,
and in glibc and uclibc on Linux. musl libc notably does not include
execinfo support, so this provides an escape hatch to build with
backtrace_stub.cc for situations in which compile time support doesn't
exist.
Proposed as an alternative to
https://github.com/flutter/engine/pull/40958 by @selfisekai.
Issue: https://github.com/flutter/flutter/issues/124285
---
common/config.gni | 3 +++
fml/BUILD.gn | 4 ++--
tools/gn | 20 ++++++++++++++++++++
3 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/flutter/common/config.gni b/flutter/common/config.gni
index 142701b8542f..1e22be21da6b 100644
--- ./flutter/common/config.gni.orig
+++ ./flutter/common/config.gni
@@ -19,6 +19,9 @@
# Whether to build host-side development artifacts.
flutter_build_engine_artifacts = true
+
+ # Whether to include backtrace support.
+ enable_backtrace = true
}
# feature_defines_list ---------------------------------------------------------
diff --git a/flutter/fml/BUILD.gn b/flutter/fml/BUILD.gn
index 1656b1144609..9f7310b5b065 100644
--- a/flutter/fml/BUILD.gn
+++ b/flutter/fml/BUILD.gn
@@ -97,7 +97,7 @@ source_set("fml") {
"wakeable.h",
]
- if (is_mac || is_linux || is_win || (is_ios && is_debug)) {
+ if (enable_backtrace) {
sources += [ "backtrace.cc" ]
} else {
sources += [ "backtrace_stub.cc" ]
@@ -116,7 +116,7 @@ source_set("fml") {
"//third_party/icu",
]
- if (is_mac || is_linux || is_win || (is_ios && is_debug)) {
+ if (enable_backtrace) {
# This abseil dependency is only used by backtrace.cc.
deps += [ "//third_party/abseil-cpp/absl/debugging:symbolize" ]
}
diff --git a/tools/gn b/tools/gn
index 366ec6bdd3ad..1c13e7bbcab1 100755
--- a/flutter/tools/gn
+++ b/flutter/tools/gn
@@ -393,6 +393,15 @@ def to_gn_args(args):
# flags allow preventing those targets from being part of the build tree.
gn_args['enable_desktop_embeddings'] = not args.disable_desktop_embeddings
+ # Determine whether backtace support should be compiled in.
+ if args.backtrace:
+ gn_args['enable_backtrace'] = (
+ args.target_os in ['linux', 'mac', 'win'] or
+ args.target_os == 'ios' and runtime_mode == 'debug'
+ )
+ else:
+ gn_args['enable_backtrace'] = False
+
# Overrides whether Boring SSL is compiled with system as. Only meaningful
# on Android.
gn_args['bssl_use_clang_integrated_as'] = True
@@ -773,6 +782,17 @@ def parse_args(args):
'--arm-float-abi', type=str, choices=['hard', 'soft', 'softfp']
)
+ # Whether to compile in backtrace support.
+ # Available for Windows and POSIX platforms whose libc includes execinfo.h.
+ # MUSL doesn't include execinfo.h should be build with --no-backtrace.
+ parser.add_argument(
+ '--backtrace',
+ default=True,
+ action='store_true',
+ help='Whether OS support exists for collecting backtraces.'
+ )
+ parser.add_argument('--no-backtrace', dest='backtrace', action='store_false')
+
parser.add_argument(
'--build-engine-artifacts',
default=True,

View File

@ -0,0 +1,11 @@
--- a/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h
+++ b/third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h
@@ -58,7 +58,7 @@
#define HAVE_ERRNO_H 1
/* Define to 1 if you have the <execinfo.h> header file. */
-#define HAVE_EXECINFO_H 1
+/* #define HAVE_EXECINFO_H 1 */
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1

View File

@ -0,0 +1,29 @@
--- ./third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Process.inc
+++ ./third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Process.inc.orig
@@ -86,11 +86,11 @@
}
size_t Process::GetMallocUsage() {
-#if defined(HAVE_MALLINFO2)
+#if defined(HAVE_MALLINFO2) && defined(__GLIBC__)
struct mallinfo2 mi;
mi = ::mallinfo2();
return mi.uordblks;
-#elif defined(HAVE_MALLINFO)
+#elif defined(HAVE_MALLINFO) && defined(__GLIBC__)
struct mallinfo mi;
mi = ::mallinfo();
return mi.uordblks;
--- ./third_party/swiftshader/third_party/llvm-10.0/configs/linux/include/llvm/Config/config.h.orig 2019-09-30 13:03:42.556880537 -0400
+++ ./third_party/swiftshader/third_party/llvm-10.0/configs/linux/include/llvm/Config/config.h 2019-09-30 13:07:27.989821227 -0400
@@ -122,7 +122,9 @@
/* #undef HAVE_MALLCTL */
/* Define to 1 if you have the `mallinfo' function. */
+#if defined(__GLIBC__)
#define HAVE_MALLINFO 1
+#endif
/* Define to 1 if you have the <malloc.h> header file. */
#define HAVE_MALLOC_H 1

View File

@ -0,0 +1,11 @@
--- a/third_party/fontconfig/include/config.h
+++ b/third_party/fontconfig/include/config.h
@@ -157,7 +157,7 @@
#define HAVE_RANDOM 1
/* Define to 1 if you have the `random_r' function. */
-#define HAVE_RANDOM_R 1
+#define HAVE_RANDOM_R 0
/* Define to 1 if you have the `rand_r' function. */
#define HAVE_RAND_R 1

View File

@ -0,0 +1,19 @@
--- a/packages/flutter_tools/lib/src/cache.dart
+++ b/packages/flutter_tools/lib/src/cache.dart
@@ -280,7 +280,7 @@
bool useUnsignedMacBinaries = false;
static RandomAccessFile? _lock;
- static bool _lockEnabled = true;
+ static bool _lockEnabled = false;
/// Turn off the [lock]/[releaseLock] mechanism.
///
@@ -634,7 +634,6 @@
}
void setStampFor(String artifactName, String version) {
- getStampFileFor(artifactName).writeAsStringSync(version);
}
File getStampFileFor(String artifactName) {

View File

@ -0,0 +1,38 @@
--- a/packages/flutter_tools/lib/src/cache.dart
+++ b/packages/flutter_tools/lib/src/cache.dart
@@ -926,26 +926,6 @@
}
Future<bool> checkForArtifacts(String? engineVersion) async {
- engineVersion ??= version;
- final String url = '${cache.storageBaseUrl}/flutter_infra_release/flutter/$engineVersion/';
-
- bool exists = false;
- for (final String pkgName in getPackageDirs()) {
- exists = await cache.doesRemoteExist('Checking package $pkgName is available...', Uri.parse('$url$pkgName.zip'));
- if (!exists) {
- return false;
- }
- }
-
- for (final List<String> toolsDir in getBinaryDirs()) {
- final String cacheDir = toolsDir[0];
- final String urlPath = toolsDir[1];
- exists = await cache.doesRemoteExist('Checking $cacheDir tools are available...',
- Uri.parse(url + urlPath));
- if (!exists) {
- return false;
- }
- }
return true;
}
@@ -1036,6 +1016,8 @@
Directory location,
void Function(File, Directory) extractor,
) async {
+ throwToolExit('Tried to download $url. Report on aports.');
+
final String downloadPath = flattenNameSubdirs(url, _fileSystem);
final File tempFile = _createDownloadFile(downloadPath);
Status status;

View File

@ -0,0 +1,11 @@
--- ./.gn.orig
+++ ./.gn
@@ -3,7 +3,7 @@
# Use vpython3 from depot_tools for exec_script() calls.
# See `gn help dotfile` for details.
-script_executable = "vpython3"
+script_executable = "python3"
# The location of the build configuration file.
buildconfig = "//build/config/BUILDCONFIG.gn"

View File

@ -0,0 +1,22 @@
--- a/packages/flutter_tools/lib/src/reporting/usage.dart
+++ b/packages/flutter_tools/lib/src/reporting/usage.dart
@@ -218,7 +218,7 @@
if (globals.platform.environment.containsKey('FLUTTER_HOST')) {
analytics.setSessionValue('aiid', globals.platform.environment['FLUTTER_HOST']);
}
- analytics.analyticsOpt = AnalyticsOpt.optOut;
+ analytics.analyticsOpt = AnalyticsOpt.optIn;
}
return _DefaultUsage._(
--- a/packages/flutter_tools/lib/src/reporting/first_run.dart
+++ b/packages/flutter_tools/lib/src/reporting/first_run.dart
@@ -37,6 +37,8 @@
║ See Google's privacy policy: ║
║ https://policies.google.com/privacy ║
╚════════════════════════════════════════════════════════════════════════════╝
+aports overrides: reporting is disabled by default. Opt-out is not a sent event.
+Run 'flutter config --analytics' to opt in to reports.
''';
/// The first run messenger determines whether the first run license terms

View File

@ -0,0 +1,18 @@
flutter defines a list of pointer kinds that can scroll the screen.
however, it does not bother recognizing the pointer kind on linux,
so every pointer is set to be recognized as mouse. effectively, touch
can't scroll anything. this workarounds the issue by making mouse
one of the "touch-like device types".
Bug: https://github.com/flutter/flutter/issues/63209
--- ./packages/flutter/lib/src/widgets/scroll_configuration.dart.orig
+++ ./packages/flutter/lib/src/widgets/scroll_configuration.dart
@@ -25,6 +25,7 @@
// The VoiceAccess sends pointer events with unknown type when scrolling
// scrollables.
PointerDeviceKind.unknown,
+ PointerDeviceKind.mouse,
};
/// The default overscroll indicator applied on [TargetPlatform.android].

View File

@ -0,0 +1,33 @@
--- ./build/config/BUILDCONFIG.gn.orig
+++ ./build/config/BUILDCONFIG.gn
@@ -324,7 +324,7 @@
is_clang = true
}
-use_flutter_cxx = is_clang && (is_linux || is_android || is_mac || is_ios)
+use_flutter_cxx = false
if (is_msan && !is_linux) {
assert(false, "Memory sanitizer is only available on Linux.")
--- ./third_party/flatbuffers/include/flatbuffers/util.h.orig
+++ ./third_party/flatbuffers/include/flatbuffers/util.h
@@ -202,7 +202,7 @@
// clang-format off
// Use locale independent functions {strtod_l, strtof_l, strtoll_l, strtoull_l}.
-#if defined(FLATBUFFERS_LOCALE_INDEPENDENT) && (FLATBUFFERS_LOCALE_INDEPENDENT > 0)
+#if defined(__GLIBC__) && defined(FLATBUFFERS_LOCALE_INDEPENDENT) && (FLATBUFFERS_LOCALE_INDEPENDENT > 0)
class ClassicLocale {
#ifdef _MSC_VER
typedef _locale_t locale_type;
--- ./third_party/flatbuffers/src/util.cpp.orig
+++ ./third_party/flatbuffers/src/util.cpp
@@ -252,7 +252,7 @@
}
// Locale-independent code.
-#if defined(FLATBUFFERS_LOCALE_INDEPENDENT) && \
+#if defined(__GLIBC__) && defined(FLATBUFFERS_LOCALE_INDEPENDENT) && \
(FLATBUFFERS_LOCALE_INDEPENDENT > 0)
// clang-format off

View File

@ -0,0 +1,37 @@
The icu library knows where icu data is at all times. It knows this because it
knows where it isn't. By subtracting where it is from where it isn't, or where
it isn't from where it is (whichever is greater), it obtains a difference, or
deviation.
The flutter build system uses deviations to generate "corrective" commands to
drive the icu data path from a position where it is to a position where it
isn't, and check at a position where it wasn't, it now is. Consequently, the
position where it is, is now the position that it wasn't, and it follows that
the position that it was, is now the position that it isn't.
XXX: remove this field and whatever is trying to override the icu default with it
--- a/flutter/shell/platform/linux/fl_dart_project.cc
+++ b/flutter/shell/platform/linux/fl_dart_project.cc
@@ -64,7 +64,7 @@
self->assets_path =
g_build_filename(executable_dir, "data", "flutter_assets", nullptr);
self->icu_data_path =
- g_build_filename(executable_dir, "data", "icudtl.dat", nullptr);
+ g_build_filename("/usr/lib/flutter/icudtl.dat", nullptr);
return self;
}
--- ./flutter/build/archives/BUILD.gn.orig
+++ ./flutter/build/archives/BUILD.gn
@@ -74,10 +74,6 @@
}
files += [
{
- source = "//third_party/icu/flutter/icudtl.dat"
- destination = "icudtl.dat"
- },
- {
source = "$root_out_dir/flutter_tester$exe"
destination = "flutter_tester$exe"
},

View File

@ -0,0 +1,352 @@
From 903ae13d643c305c48c4271ed4a05939656ed041 Mon Sep 17 00:00:00 2001
From: "Lauren N. Liberda" <lauren@selfisekai.rocks>
Date: Sat, 8 Apr 2023 02:56:35 +0200
Subject: [PATCH 1/2] add gn args specifying libc for linux
---
build/config/compiler/BUILD.gn | 8 ++-
build/config/linux/detect_host_libc.py | 42 ++++++++++++
build/config/linux/libc.gni | 51 +++++++++++++++
build/toolchain/linux/BUILD.gn | 89 ++++++++++++++------------
4 files changed, 147 insertions(+), 43 deletions(-)
create mode 100755 build/config/linux/detect_host_libc.py
create mode 100644 build/config/linux/libc.gni
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 4c9a1ee..155d433 100644
--- ./build/config/compiler/BUILD.gn.orig
+++ ./build/config/compiler/BUILD.gn
@@ -12,6 +12,9 @@
if (is_win) {
import("//build/config/win/visual_studio_version.gni")
}
+if (is_linux) {
+ import("//build/config/linux/libc.gni")
+}
import("//build/config/c++/c++.gni")
import("//build/config/profiler.gni")
@@ -339,8 +342,8 @@
ldflags += [ "-pthread" ]
if (current_cpu == "arm64") {
- cflags += [ "--target=aarch64-linux-gnu" ]
- ldflags += [ "--target=aarch64-linux-gnu" ]
+ cflags += [ "--target=aarch64-alpine-linux-musl" ]
+ ldflags += [ "--target=aarch64-alpine-linux-musl" ]
cflags += [ "-DBORINGSSL_CLANG_SUPPORTS_DOT_ARCH" ]
}
}
@@ -622,12 +625,15 @@
default_warning_flags += [
# Enables.
"-Wendif-labels", # Weird old-style text after an #endif.
- "-Werror", # Warnings as errors.
# Disables.
"-Wno-missing-field-initializers", # "struct foo f = {0};"
"-Wno-unused-parameter", # Unused function parameters.
]
+ if (!is_linux || is_glibc) {
+ # Warnings as errors. Fails on musl.
+ default_warning_flags += [ "-Werror" ]
+ }
if (is_wasm) {
default_warning_flags += [
diff --git a/build/config/linux/detect_host_libc.py b/build/config/linux/detect_host_libc.py
new file mode 100755
index 0000000..1ebb498
--- /dev/null
+++ b/build/config/linux/detect_host_libc.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python3
+#
+# Copyright (c) 2013 The Flutter Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from optparse import OptionParser
+import re
+import subprocess
+import sys
+
+
+def main():
+ if 'linux' not in sys.platform:
+ return 1
+
+ parser = OptionParser()
+ parser.add_option('--compiler-path', action='store',
+ type='string', default='gcc')
+ (options, args) = parser.parse_args()
+
+ # should work with both gcc and clang
+ #
+ # example outputs: "aarch64-unknown-linux-gnu", "x86_64-alpine-linux-musl",
+ # "armv7-unknown-linux-musleabihf", "mipsel-linux-muslhf"
+ default_target = subprocess.check_output([
+ options.compiler_path, '-dumpmachine']).decode('utf-8').strip()
+
+ host_libc_re = re.match(
+ r'^(?:[^-]+-){1,2}linux-(?P<libc>gnu|musl|uclibc)(?:eabi)?(?:hf)?$',
+ default_target)
+ if host_libc_re is None:
+ print(f'Target not understood: {default_target}')
+
+ host_libc = host_libc_re.group('libc')
+ # print would add a newline
+ sys.stdout.write(host_libc)
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/build/config/linux/libc.gni b/build/config/linux/libc.gni
new file mode 100644
index 0000000..653f312
--- /dev/null
+++ b/build/config/linux/libc.gni
@@ -0,0 +1,51 @@
+# Copyright (c) 2013 The Flutter Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/config/sysroot.gni")
+
+declare_args() {
+ # The C library used by the compilation host.
+ # Expecting one of: "gnu" (glibc), "uclibc", "musl"
+ host_libc = ""
+
+ # The C library of the compilation target.
+ # Expecting one of: "gnu" (glibc), "uclibc", "musl"
+ target_libc = ""
+}
+
+# try to detect host's libc if not explicitly provided
+if (host_libc == "" && is_linux) {
+ if (sysroot == "") {
+ host_compiler = "gcc"
+ if (is_clang) {
+ host_compiler = "clang"
+ }
+
+ # tries to determine libc from "gcc/clang -printmachine"
+ host_libc = exec_script("//build/config/linux/detect_host_libc.py",
+ [
+ "--compiler-path",
+ host_compiler,
+ ],
+ "string")
+ } else {
+ # currently there is only debian sysroot
+ host_libc = "gnu"
+ }
+}
+
+assert(!is_linux || host_libc != "", "Host libc not specified and not detected")
+
+# assume compiling for host if not explicitly specified
+if (target_libc == "") {
+ target_libc = host_libc
+}
+
+is_cross_libc = host_libc != target_libc
+
+is_glibc = target_libc == "gnu"
+is_musl = target_libc == "musl"
+
+is_host_glibc = host_libc == "gnu"
+is_host_musl = host_libc == "musl"
diff --git a/build/toolchain/linux/BUILD.gn b/build/toolchain/linux/BUILD.gn
index 05630d0..b1288ce 100644
--- a/build/toolchain/linux/BUILD.gn
+++ b/build/toolchain/linux/BUILD.gn
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//build/config/linux/libc.gni")
import("//build/config/sysroot.gni")
import("//build/toolchain/ccache.gni")
import("//build/toolchain/gcc_toolchain.gni")
@@ -21,16 +22,20 @@ if (use_goma) {
compiler_prefix = ""
}
-if (host_cpu == "arm64") {
- rebased_clang_dir =
- rebase_path("//buildtools/linux-arm64/clang/bin", root_build_dir)
+if (is_host_glibc) {
+ if (host_cpu == "arm64") {
+ rebased_clang_dir =
+ rebase_path("//buildtools/linux-arm64/clang/bin/", root_build_dir)
+ } else {
+ rebased_clang_dir =
+ rebase_path("//buildtools/linux-x64/clang/bin/", root_build_dir)
+ }
} else {
- rebased_clang_dir =
- rebase_path("//buildtools/linux-x64/clang/bin", root_build_dir)
+ rebased_clang_dir = ""
}
gcc_toolchain("arm") {
- prefix = "arm-linux-gnueabihf-"
+ prefix = "arm-linux-${target_libc}eabihf-"
if (toolchain_prefix != "") {
prefix = toolchain_prefix
}
@@ -51,14 +56,14 @@ gcc_toolchain("arm") {
gcc_toolchain("clang_arm") {
prefix = rebased_clang_dir
- cc = "${compiler_prefix}${prefix}/clang"
- cxx = "${compiler_prefix}${prefix}/clang++"
+ cc = "${compiler_prefix}${prefix}clang"
+ cxx = "${compiler_prefix}${prefix}clang++"
- readelf = "${prefix}/llvm-readelf"
- nm = "${prefix}/llvm-nm"
- ar = "${prefix}/llvm-ar"
+ readelf = "${prefix}llvm-readelf"
+ nm = "${prefix}llvm-nm"
+ ar = "${prefix}llvm-ar"
ld = cxx
- llvm_objcopy = "${prefix}/llvm-objcopy"
+ llvm_objcopy = "${prefix}llvm-objcopy"
toolchain_cpu = "arm"
toolchain_os = "linux"
@@ -66,7 +71,7 @@ gcc_toolchain("clang_arm") {
}
gcc_toolchain("arm64") {
- prefix = "aarch64-linux-gnu-"
+ prefix = "aarch64-linux-${target_libc}-"
if (toolchain_prefix != "") {
prefix = toolchain_prefix
}
@@ -87,14 +92,14 @@ gcc_toolchain("arm64") {
gcc_toolchain("clang_arm64") {
prefix = rebased_clang_dir
- cc = "${compiler_prefix}${prefix}/clang"
- cxx = "${compiler_prefix}${prefix}/clang++"
+ cc = "${compiler_prefix}${prefix}clang"
+ cxx = "${compiler_prefix}${prefix}clang++"
readelf = "readelf"
- nm = "${prefix}/llvm-nm"
- ar = "${prefix}/llvm-ar"
+ nm = "${prefix}llvm-nm"
+ ar = "${prefix}llvm-ar"
ld = cxx
- llvm_objcopy = "${prefix}/llvm-objcopy"
+ llvm_objcopy = "${prefix}llvm-objcopy"
toolchain_cpu = "arm64"
toolchain_os = "linux"
@@ -103,14 +108,14 @@ gcc_toolchain("clang_arm64") {
gcc_toolchain("clang_x86") {
prefix = rebased_clang_dir
- cc = "${compiler_prefix}${prefix}/clang"
- cxx = "${compiler_prefix}${prefix}/clang++"
+ cc = "${compiler_prefix}${prefix}clang"
+ cxx = "${compiler_prefix}${prefix}clang++"
- readelf = "${prefix}/llvm-readelf"
- nm = "${prefix}/llvm-nm"
- ar = "${prefix}/llvm-ar"
+ readelf = "${prefix}llvm-readelf"
+ nm = "${prefix}llvm-nm"
+ ar = "${prefix}llvm-ar"
ld = cxx
- llvm_objcopy = "${prefix}/llvm-objcopy"
+ llvm_objcopy = "${prefix}llvm-objcopy"
toolchain_cpu = "x86"
toolchain_os = "linux"
@@ -135,14 +140,14 @@ gcc_toolchain("x86") {
gcc_toolchain("clang_x64") {
prefix = rebased_clang_dir
- cc = "${compiler_prefix}${prefix}/clang"
- cxx = "${compiler_prefix}${prefix}/clang++"
+ cc = "${compiler_prefix}${prefix}clang"
+ cxx = "${compiler_prefix}${prefix}clang++"
- readelf = "${prefix}/llvm-readelf"
- nm = "${prefix}/llvm-nm"
- ar = "${prefix}/llvm-ar"
+ readelf = "${prefix}llvm-readelf"
+ nm = "${prefix}llvm-nm"
+ ar = "${prefix}llvm-ar"
ld = cxx
- llvm_objcopy = "${prefix}/llvm-objcopy"
+ llvm_objcopy = "${prefix}llvm-objcopy"
toolchain_cpu = "x64"
toolchain_os = "linux"
@@ -166,7 +171,7 @@ gcc_toolchain("x64") {
}
gcc_toolchain("riscv32") {
- prefix = "riscv32-linux-gnu-"
+ prefix = "riscv32-linux-${target_libc}-"
if (toolchain_prefix != "") {
prefix = toolchain_prefix
}
@@ -187,14 +192,14 @@ gcc_toolchain("riscv32") {
gcc_toolchain("clang_riscv32") {
prefix = rebased_clang_dir
- cc = "${compiler_prefix}${prefix}/clang"
- cxx = "${compiler_prefix}${prefix}/clang++"
+ cc = "${compiler_prefix}${prefix}clang"
+ cxx = "${compiler_prefix}${prefix}clang++"
readelf = "readelf"
- nm = "${prefix}/llvm-nm"
- ar = "${prefix}/llvm-ar"
+ nm = "${prefix}llvm-nm"
+ ar = "${prefix}llvm-ar"
ld = cxx
- llvm_objcopy = "${prefix}/llvm-objcopy"
+ llvm_objcopy = "${prefix}llvm-objcopy"
toolchain_cpu = "riscv32"
toolchain_os = "linux"
@@ -202,7 +207,7 @@ gcc_toolchain("clang_riscv32") {
}
gcc_toolchain("riscv64") {
- prefix = "riscv64-linux-gnu-"
+ prefix = "riscv64-linux-${target_libc}-"
if (toolchain_prefix != "") {
prefix = toolchain_prefix
}
@@ -223,14 +228,14 @@ gcc_toolchain("riscv64") {
gcc_toolchain("clang_riscv64") {
prefix = rebased_clang_dir
- cc = "${compiler_prefix}${prefix}/clang"
- cxx = "${compiler_prefix}${prefix}/clang++"
+ cc = "${compiler_prefix}${prefix}clang"
+ cxx = "${compiler_prefix}${prefix}clang++"
readelf = "readelf"
- nm = "${prefix}/llvm-nm"
- ar = "${prefix}/llvm-ar"
+ nm = "${prefix}llvm-nm"
+ ar = "${prefix}llvm-ar"
ld = cxx
- llvm_objcopy = "${prefix}/llvm-objcopy"
+ llvm_objcopy = "${prefix}llvm-objcopy"
toolchain_cpu = "riscv64"
toolchain_os = "linux"
--
2.40.0

View File

@ -0,0 +1,21 @@
--- a/packages/flutter_tools/lib/src/build_system/targets/linux.dart
+++ b/packages/flutter_tools/lib/src/build_system/targets/linux.dart
@@ -19,7 +19,6 @@
/// The only files/subdirectories we care out.
const List<String> _kLinuxArtifacts = <String>[
- 'libflutter_linux_gtk.so',
];
const String _kLinuxDepfile = 'linux_engine_sources.d';
@@ -79,10 +78,6 @@
outputDirectory: outputDirectory,
artifacts: _kLinuxArtifacts,
clientSourcePaths: <String>[headersPath],
- icuDataPath: environment.artifacts.getArtifactPath(
- Artifact.icuData,
- platform: targetPlatform,
- )
);
final DepfileService depfileService = DepfileService(
fileSystem: environment.fileSystem,

View File

@ -0,0 +1,950 @@
diff --git a/build/linux/unbundle/fontconfig.gn b/build/linux/unbundle/fontconfig.gn
new file mode 100644
index 0000000..87926d5
--- /dev/null
+++ b/build/linux/unbundle/fontconfig.gn
@@ -0,0 +1,13 @@
+# Copyright 2017 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+assert(is_linux || is_chromeos)
+
+config("fontconfig_config") {
+ libs = [ "fontconfig" ]
+}
+
+group("fontconfig") {
+ public_configs = [ ":fontconfig_config" ]
+}
diff --git a/build/linux/unbundle/freetype2.gn b/build/linux/unbundle/freetype2.gn
new file mode 100644
index 0000000..3b8cafb
--- /dev/null
+++ b/build/linux/unbundle/freetype2.gn
@@ -0,0 +1,35 @@
+# Copyright 2013 The Flutter Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/config/linux/pkg_config.gni")
+import("//build/shim_headers.gni")
+
+config("freetype_config") {
+ include_dirs = [ "include/freetype-flutter-config" ]
+
+ cflags = []
+
+ if (is_clang) {
+ cflags += [
+ "-Wno-unused-function",
+ "-Wno-unused-variable",
+ ]
+ }
+}
+
+pkg_config("system_freetype2") {
+ packages = [ "freetype2" ]
+}
+
+source_set("freetype2") {
+ output_name = "freetype2"
+ deps = [
+ "//third_party/libpng",
+ "//third_party/zlib",
+ ]
+ public_configs = [
+ ":freetype_config",
+ ":system_freetype2",
+ ]
+}
diff --git a/build/linux/unbundle/harfbuzz.gn b/build/linux/unbundle/harfbuzz.gn
new file mode 100644
index 0000000..72d3e06
--- /dev/null
+++ b/build/linux/unbundle/harfbuzz.gn
@@ -0,0 +1,31 @@
+# Copyright 2013 The Flutter Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/config/linux/pkg_config.gni")
+
+pkg_config("system_harfbuzz") {
+ packages = [ "harfbuzz" ]
+}
+
+pkg_config("system_harfbuzz_subset") {
+ packages = [ "harfbuzz-subset" ]
+}
+
+source_set("harfbuzz") {
+ output_name = "harfbuzz"
+ deps = [
+ "//third_party/freetype2",
+ "//third_party/icu:icuuc",
+ ]
+ public_configs = [ ":system_harfbuzz" ]
+}
+
+source_set("harfbuzz_subset") {
+ output_name = "harfbuzz_subset"
+ deps = [
+ "//third_party/freetype2",
+ "//third_party/icu:icuuc",
+ ]
+ public_configs = [ ":system_harfbuzz_subset" ]
+}
diff --git a/build/linux/unbundle/icu.gn b/build/linux/unbundle/icu.gn
new file mode 100644
index 0000000..9e54d4e
--- /dev/null
+++ b/build/linux/unbundle/icu.gn
@@ -0,0 +1,262 @@
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/config/linux/pkg_config.gni")
+import("//build/shim_headers.gni")
+
+group("icu") {
+ public_deps = [
+ ":icui18n",
+ ":icuuc",
+ ]
+}
+
+config("icu_config") {
+ defines = [
+ "USING_SYSTEM_ICU=1",
+ "ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC",
+
+ # U_EXPORT (defined in unicode/platform.h) is used to set public visibility
+ # on classes through the U_COMMON_API and U_I18N_API macros (among others).
+ # When linking against the system ICU library, we want its symbols to have
+ # public LTO visibility. This disables CFI checks for the ICU classes and
+ # allows whole-program optimization to be applied to the rest of Chromium.
+ #
+ # Both U_COMMON_API and U_I18N_API macros would be defined to U_EXPORT only
+ # when U_COMBINED_IMPLEMENTATION is defined (see unicode/utypes.h). Because
+ # we override the default system UCHAR_TYPE (char16_t), it is not possible
+ # to use U_COMBINED_IMPLEMENTATION at this moment, meaning the U_COMMON_API
+ # and U_I18N_API macros are set to U_IMPORT which is an empty definition.
+ #
+ # Until building with UCHAR_TYPE=char16_t is supported, one way to apply
+ # public visibility (and thus public LTO visibility) to all ICU classes is
+ # to define U_IMPORT to have the same value as U_EXPORT. For more details,
+ # please see: https://crbug.com/822820
+ "U_IMPORT=U_EXPORT",
+ ]
+}
+
+pkg_config("system_icui18n") {
+ packages = [ "icu-i18n" ]
+}
+
+pkg_config("system_icuuc") {
+ packages = [ "icu-uc" ]
+}
+
+source_set("icui18n") {
+ public_deps = [ ":icui18n_shim" ]
+ public_configs = [
+ ":icu_config",
+ ":system_icui18n",
+ ]
+}
+
+source_set("icuuc") {
+ public_deps = [ ":icuuc_shim" ]
+ public_configs = [
+ ":icu_config",
+ ":system_icuuc",
+ ]
+}
+
+group("icui18n_hidden_visibility") {
+ public_deps = [ ":icui18n" ]
+}
+
+group("icuuc_hidden_visibility") {
+ public_deps = [ ":icuuc" ]
+}
+
+shim_headers("icui18n_shim") {
+ root_path = "source/i18n"
+ headers = [
+ # This list can easily be updated using the commands below:
+ # cd third_party/icu/source/i18n
+ # find unicode -iname '*.h' -printf ' "%p",\n' | LC_ALL=C sort -u
+ "unicode/alphaindex.h",
+ "unicode/basictz.h",
+ "unicode/calendar.h",
+ "unicode/choicfmt.h",
+ "unicode/coleitr.h",
+ "unicode/coll.h",
+ "unicode/compactdecimalformat.h",
+ "unicode/curramt.h",
+ "unicode/currpinf.h",
+ "unicode/currunit.h",
+ "unicode/datefmt.h",
+ "unicode/dcfmtsym.h",
+ "unicode/decimfmt.h",
+ "unicode/dtfmtsym.h",
+ "unicode/dtitvfmt.h",
+ "unicode/dtitvinf.h",
+ "unicode/dtptngen.h",
+ "unicode/dtrule.h",
+ "unicode/fieldpos.h",
+ "unicode/fmtable.h",
+ "unicode/format.h",
+ "unicode/fpositer.h",
+ "unicode/gender.h",
+ "unicode/gregocal.h",
+ "unicode/listformatter.h",
+ "unicode/measfmt.h",
+ "unicode/measunit.h",
+ "unicode/measure.h",
+ "unicode/msgfmt.h",
+ "unicode/numfmt.h",
+ "unicode/numsys.h",
+ "unicode/plurfmt.h",
+ "unicode/plurrule.h",
+ "unicode/rbnf.h",
+ "unicode/rbtz.h",
+ "unicode/regex.h",
+ "unicode/region.h",
+ "unicode/reldatefmt.h",
+ "unicode/scientificnumberformatter.h",
+ "unicode/search.h",
+ "unicode/selfmt.h",
+ "unicode/simpletz.h",
+ "unicode/smpdtfmt.h",
+ "unicode/sortkey.h",
+ "unicode/stsearch.h",
+ "unicode/tblcoll.h",
+ "unicode/timezone.h",
+ "unicode/tmunit.h",
+ "unicode/tmutamt.h",
+ "unicode/tmutfmt.h",
+ "unicode/translit.h",
+ "unicode/tzfmt.h",
+ "unicode/tznames.h",
+ "unicode/tzrule.h",
+ "unicode/tztrans.h",
+ "unicode/ucal.h",
+ "unicode/ucol.h",
+ "unicode/ucoleitr.h",
+ "unicode/ucsdet.h",
+ "unicode/udat.h",
+ "unicode/udateintervalformat.h",
+ "unicode/udatpg.h",
+ "unicode/ufieldpositer.h",
+ "unicode/uformattable.h",
+ "unicode/ugender.h",
+ "unicode/ulocdata.h",
+ "unicode/umsg.h",
+ "unicode/unirepl.h",
+ "unicode/unum.h",
+ "unicode/unumsys.h",
+ "unicode/upluralrules.h",
+ "unicode/uregex.h",
+ "unicode/uregion.h",
+ "unicode/ureldatefmt.h",
+ "unicode/usearch.h",
+ "unicode/uspoof.h",
+ "unicode/utmscale.h",
+ "unicode/utrans.h",
+ "unicode/vtzone.h",
+ ]
+}
+
+shim_headers("icuuc_shim") {
+ root_path = "source/common"
+ headers = [
+ # This list can easily be updated using the commands below:
+ # cd third_party/icu/source/common
+ # find unicode -iname '*.h' -printf ' "%p",\n' | LC_ALL=C sort -u
+ "unicode/appendable.h",
+ "unicode/brkiter.h",
+ "unicode/bytestream.h",
+ "unicode/bytestrie.h",
+ "unicode/bytestriebuilder.h",
+ "unicode/caniter.h",
+ "unicode/casemap.h",
+ "unicode/char16ptr.h",
+ "unicode/chariter.h",
+ "unicode/dbbi.h",
+ "unicode/docmain.h",
+ "unicode/dtintrv.h",
+ "unicode/edits.h",
+ "unicode/enumset.h",
+ "unicode/errorcode.h",
+ "unicode/filteredbrk.h",
+ "unicode/icudataver.h",
+ "unicode/icuplug.h",
+ "unicode/idna.h",
+ "unicode/localematcher.h",
+ "unicode/localpointer.h",
+ "unicode/locdspnm.h",
+ "unicode/locid.h",
+ "unicode/messagepattern.h",
+ "unicode/normalizer2.h",
+ "unicode/normlzr.h",
+ "unicode/parseerr.h",
+ "unicode/parsepos.h",
+ "unicode/platform.h",
+ "unicode/ptypes.h",
+ "unicode/putil.h",
+ "unicode/rbbi.h",
+ "unicode/rep.h",
+ "unicode/resbund.h",
+ "unicode/schriter.h",
+ "unicode/simpleformatter.h",
+ "unicode/std_string.h",
+ "unicode/strenum.h",
+ "unicode/stringpiece.h",
+ "unicode/stringtriebuilder.h",
+ "unicode/symtable.h",
+ "unicode/ubidi.h",
+ "unicode/ubiditransform.h",
+ "unicode/ubrk.h",
+ "unicode/ucasemap.h",
+ "unicode/ucat.h",
+ "unicode/uchar.h",
+ "unicode/ucharstrie.h",
+ "unicode/ucharstriebuilder.h",
+ "unicode/uchriter.h",
+ "unicode/uclean.h",
+ "unicode/ucnv.h",
+ "unicode/ucnv_cb.h",
+ "unicode/ucnv_err.h",
+ "unicode/ucnvsel.h",
+ "unicode/uconfig.h",
+ "unicode/ucurr.h",
+ "unicode/udata.h",
+ "unicode/udisplaycontext.h",
+ "unicode/uenum.h",
+ "unicode/uidna.h",
+ "unicode/uiter.h",
+ "unicode/uldnames.h",
+ "unicode/ulistformatter.h",
+ "unicode/uloc.h",
+ "unicode/umachine.h",
+ "unicode/umisc.h",
+ "unicode/unifilt.h",
+ "unicode/unifunct.h",
+ "unicode/unimatch.h",
+ "unicode/uniset.h",
+ "unicode/unistr.h",
+ "unicode/unorm.h",
+ "unicode/unorm2.h",
+ "unicode/uobject.h",
+ "unicode/urename.h",
+ "unicode/urep.h",
+ "unicode/ures.h",
+ "unicode/uscript.h",
+ "unicode/uset.h",
+ "unicode/usetiter.h",
+ "unicode/ushape.h",
+ "unicode/usprep.h",
+ "unicode/ustring.h",
+ "unicode/ustringtrie.h",
+ "unicode/utext.h",
+ "unicode/utf.h",
+ "unicode/utf16.h",
+ "unicode/utf32.h",
+ "unicode/utf8.h",
+ "unicode/utf_old.h",
+ "unicode/utrace.h",
+ "unicode/utypes.h",
+ "unicode/uvernum.h",
+ "unicode/uversion.h",
+ ]
+}
diff --git a/build/linux/unbundle/libjpeg-turbo.gn b/build/linux/unbundle/libjpeg-turbo.gn
new file mode 100644
index 0000000..be0c674
--- /dev/null
+++ b/build/linux/unbundle/libjpeg-turbo.gn
@@ -0,0 +1,11 @@
+# Copyright 2013 The Flutter Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+config("libjpeg_config") {
+ libs = [ "jpeg" ]
+}
+
+group("libjpeg") {
+ public_configs = [ ":libjpeg_config" ]
+}
diff --git a/build/linux/unbundle/libpng.gn b/build/linux/unbundle/libpng.gn
new file mode 100644
index 0000000..91e0ee4
--- /dev/null
+++ b/build/linux/unbundle/libpng.gn
@@ -0,0 +1,23 @@
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/config/linux/pkg_config.gni")
+import("//build/shim_headers.gni")
+
+pkg_config("libpng_config") {
+ packages = [ "libpng" ]
+}
+
+shim_headers("libpng_shim") {
+ root_path = "."
+ headers = [
+ "png.h",
+ "pngconf.h",
+ ]
+}
+
+source_set("libpng") {
+ deps = [ ":libpng_shim" ]
+ public_configs = [ ":libpng_config" ]
+}
diff --git a/build/linux/unbundle/libwebp.gn b/build/linux/unbundle/libwebp.gn
new file mode 100644
index 0000000..708cc9c
--- /dev/null
+++ b/build/linux/unbundle/libwebp.gn
@@ -0,0 +1,35 @@
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/config/linux/pkg_config.gni")
+import("//build/shim_headers.gni")
+
+pkg_config("system_libwebp") {
+ packages = [
+ "libwebp",
+ "libwebpdemux",
+ "libwebpmux",
+ ]
+}
+
+shim_headers("libwebp_shim") {
+ root_path = "src/src"
+ headers = [
+ "webp/decode.h",
+ "webp/demux.h",
+ "webp/encode.h",
+ "webp/mux.h",
+ "webp/mux_types.h",
+ "webp/types.h",
+ ]
+}
+
+source_set("libwebp_webp") {
+ deps = [ ":libwebp_shim" ]
+ public_configs = [ ":system_libwebp" ]
+}
+
+group("libwebp") {
+ deps = [ ":libwebp_webp" ]
+}
diff --git a/build/linux/unbundle/libxml.gn b/build/linux/unbundle/libxml.gn
new file mode 100644
index 0000000..b42d044
--- /dev/null
+++ b/build/linux/unbundle/libxml.gn
@@ -0,0 +1,13 @@
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/config/linux/pkg_config.gni")
+
+pkg_config("system_libxml") {
+ packages = [ "libxml-2.0" ]
+}
+
+source_set("libxml") {
+ public_configs = [ ":system_libxml" ]
+}
diff --git a/build/linux/unbundle/replace_gn_files.py b/build/linux/unbundle/replace_gn_files.py
new file mode 100755
index 0000000..b8b24c6
--- /dev/null
+++ b/build/linux/unbundle/replace_gn_files.py
@@ -0,0 +1,101 @@
+#!/usr/bin/env python3
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Replaces GN files in tree with files from here that
+make the build use system libraries.
+"""
+
+import argparse
+import os
+import shutil
+import sys
+
+
+REPLACEMENTS = {
+ # Use system libabsl_2xxx. These 18 shims MUST be used together.
+ 'absl_algorithm': 'third_party/abseil-cpp/absl/algorithm/BUILD.gn',
+ 'absl_base': 'third_party/abseil-cpp/absl/base/BUILD.gn',
+ 'absl_cleanup': 'third_party/abseil-cpp/absl/cleanup/BUILD.gn',
+ 'absl_container': 'third_party/abseil-cpp/absl/container/BUILD.gn',
+ 'absl_debugging': 'third_party/abseil-cpp/absl/debugging/BUILD.gn',
+ 'absl_flags': 'third_party/abseil-cpp/absl/flags/BUILD.gn',
+ 'absl_functional': 'third_party/abseil-cpp/absl/functional/BUILD.gn',
+ 'absl_hash': 'third_party/abseil-cpp/absl/hash/BUILD.gn',
+ 'absl_memory': 'third_party/abseil-cpp/absl/memory/BUILD.gn',
+ 'absl_meta': 'third_party/abseil-cpp/absl/meta/BUILD.gn',
+ 'absl_numeric': 'third_party/abseil-cpp/absl/numeric/BUILD.gn',
+ 'absl_random': 'third_party/abseil-cpp/absl/random/BUILD.gn',
+ 'absl_status': 'third_party/abseil-cpp/absl/status/BUILD.gn',
+ 'absl_strings': 'third_party/abseil-cpp/absl/strings/BUILD.gn',
+ 'absl_synchronization': 'third_party/abseil-cpp/absl/synchronization/BUILD.gn',
+ 'absl_time': 'third_party/abseil-cpp/absl/time/BUILD.gn',
+ 'absl_types': 'third_party/abseil-cpp/absl/types/BUILD.gn',
+ 'absl_utility': 'third_party/abseil-cpp/absl/utility/BUILD.gn',
+ #
+ 'fontconfig': 'third_party/fontconfig/BUILD.gn',
+ 'freetype2': 'third_party/freetype2/BUILD.gn',
+ 'harfbuzz': 'third_party/harfbuzz/BUILD.gn',
+ 'icu': 'third_party/icu/BUILD.gn',
+ 'libjpeg-turbo': 'third_party/libjpeg-turbo/BUILD.gn',
+ 'libpng': 'third_party/libpng/BUILD.gn',
+ 'libwebp': 'build/secondary/third_party/libwebp/BUILD.gn',
+ 'libxml': 'third_party/libxml/BUILD.gn',
+ 'libXNVCtrl': 'third_party/angle/src/third_party/libXNVCtrl/BUILD.gn',
+ 'sqlite': 'third_party/sqlite/BUILD.gn',
+ # Use system libSPIRV-Tools in Swiftshader. These two shims MUST be used together.
+ 'swiftshader-SPIRV-Headers': 'third_party/swiftshader/third_party/SPIRV-Headers/BUILD.gn',
+ 'swiftshader-SPIRV-Tools': 'third_party/swiftshader/third_party/SPIRV-Tools/BUILD.gn',
+ # Use system libSPIRV-Tools inside ANGLE. These two shims MUST be used together
+ # and can only be used if WebGPU is not compiled (use_dawn=false)
+ 'vulkan-SPIRV-Headers': 'third_party/vulkan-deps/spirv-headers/src/BUILD.gn',
+ 'vulkan-SPIRV-Tools': 'third_party/vulkan-deps/spirv-tools/src/BUILD.gn',
+ #
+ 'zlib': 'third_party/zlib/BUILD.gn',
+}
+
+
+def DoMain(argv):
+ my_dirname = os.path.dirname(__file__)
+ source_tree_root = os.path.abspath(
+ os.path.join(my_dirname, '..', '..', '..'))
+
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--system-libraries', nargs='*', default=[])
+ parser.add_argument('--undo', action='store_true')
+
+ args = parser.parse_args(argv)
+
+ handled_libraries = set()
+ for lib, path in REPLACEMENTS.items():
+ if lib not in args.system_libraries:
+ continue
+ handled_libraries.add(lib)
+
+ if args.undo:
+ # Restore original file, and also remove the backup.
+ # This is meant to restore the source tree to its original state.
+ os.rename(os.path.join(source_tree_root, path + '.orig'),
+ os.path.join(source_tree_root, path))
+ else:
+ # Create a backup copy for --undo.
+ shutil.copyfile(os.path.join(source_tree_root, path),
+ os.path.join(source_tree_root, path + '.orig'))
+
+ # Copy the GN file from directory of this script to target path.
+ shutil.copyfile(os.path.join(my_dirname, '%s.gn' % lib),
+ os.path.join(source_tree_root, path))
+
+ unhandled_libraries = set(args.system_libraries) - handled_libraries
+ if unhandled_libraries:
+ print('Unrecognized system libraries requested: %s' % ', '.join(
+ sorted(unhandled_libraries)), file=sys.stderr)
+ return 1
+
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(DoMain(sys.argv[1:]))
diff --git a/build/linux/unbundle/sqlite.gn b/build/linux/unbundle/sqlite.gn
new file mode 100644
index 0000000..e6c653d
--- /dev/null
+++ b/build/linux/unbundle/sqlite.gn
@@ -0,0 +1,20 @@
+# Copyright 2013 The Flutter Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/config/linux/pkg_config.gni")
+import("//build/shim_headers.gni")
+
+pkg_config("system_sqlite") {
+ packages = [ "sqlite3" ]
+}
+
+shim_headers("sqlite_shim") {
+ root_path = "."
+ headers = [ "sqlite3.h" ]
+}
+
+source_set("sqlite") {
+ public_deps = [ ":sqlite_shim" ]
+ public_configs = [ ":system_sqlite" ]
+}
diff --git a/build/linux/unbundle/zlib.gn b/build/linux/unbundle/zlib.gn
new file mode 100644
index 0000000..6daf3c6
--- /dev/null
+++ b/build/linux/unbundle/zlib.gn
@@ -0,0 +1,72 @@
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/shim_headers.gni")
+
+declare_args() {
+ use_zlib_ng = false
+}
+
+if (use_zlib_ng) {
+ _suffix = "-ng"
+} else {
+ _suffix = ""
+}
+
+shim_headers("zlib_shim") {
+ root_path = "."
+ headers = [ "zlib.h%zlib$_suffix.h" ]
+ additional_includes = [ "third_party" ]
+}
+
+config("system_zlib") {
+ defines = [ "USE_SYSTEM_ZLIB=1" ]
+}
+
+config("zlib_config") {
+ configs = [ ":system_zlib" ]
+}
+
+source_set("zlib") {
+ public_deps = [ ":zlib_shim" ]
+ libs = [ "z$_suffix" ]
+ public_configs = [ ":system_zlib" ]
+}
+
+shim_headers("minizip_shim") {
+ root_path = "contrib"
+ headers = [
+ "minizip/crypt.h",
+ "minizip/ioapi.h",
+ "minizip/iowin32.h",
+ "minizip/mztools.h",
+ "minizip/unzip.h",
+ "minizip/zip.h",
+ ]
+}
+
+source_set("minizip") {
+ deps = [ ":minizip_shim" ]
+ libs = [ "minizip" ]
+}
+
+static_library("zip") {
+ sources = [
+ "google/zip.cc",
+ "google/zip.h",
+ "google/zip_internal.cc",
+ "google/zip_internal.h",
+ "google/zip_reader.cc",
+ "google/zip_reader.h",
+ ]
+ deps = [ ":minizip" ]
+}
+
+static_library("compression_utils") {
+ sources = [
+ "google/compression_utils.cc",
+ "google/compression_utils.h",
+ ]
+ deps = [ ":zlib" ]
+}
diff --git a/build/shim_headers.gni b/build/shim_headers.gni
new file mode 100644
index 0000000..1d24e0a
--- /dev/null
+++ b/build/shim_headers.gni
@@ -0,0 +1,42 @@
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+template("shim_headers") {
+ action_name = "gen_${target_name}"
+ config_name = "${target_name}_config"
+ shim_headers_path = "${root_gen_dir}/shim_headers/${target_name}"
+ config(config_name) {
+ include_dirs = [ shim_headers_path ]
+ if (defined(invoker.additional_includes)) {
+ foreach(i, invoker.additional_includes) {
+ include_dirs += [ shim_headers_path + "/" + i ]
+ }
+ }
+ }
+ action(action_name) {
+ script = "//tools/generate_shim_headers.py"
+ args = [
+ "--generate",
+ "--headers-root",
+ rebase_path(invoker.root_path),
+ "--output-directory",
+ rebase_path(shim_headers_path),
+ ]
+ if (defined(invoker.prefix)) {
+ args += [
+ "--prefix",
+ invoker.prefix,
+ ]
+ }
+ args += invoker.headers
+ outputs = []
+ foreach(h, invoker.headers) {
+ outputs += [ shim_headers_path + "/" +
+ rebase_path(invoker.root_path, "//") + "/" + h ]
+ }
+ }
+ group(target_name) {
+ public_deps = [ ":${action_name}" ]
+ all_dependent_configs = [ ":${config_name}" ]
+ }
+}
diff --git a/tools/generate_shim_headers.py b/tools/generate_shim_headers.py
new file mode 100644
index 0000000..aaa16f8
--- /dev/null
+++ b/tools/generate_shim_headers.py
@@ -0,0 +1,116 @@
+#!/usr/bin/env python
+# Copyright 2012 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Generates shim headers that mirror the directory structure of bundled headers,
+but just forward to the system ones.
+
+This allows seamless compilation against system headers with no changes
+to our source code.
+"""
+
+
+import optparse
+import os.path
+import sys
+
+
+SHIM_TEMPLATE = """
+#if defined(OFFICIAL_BUILD)
+#error shim headers must not be used in official builds!
+#endif
+"""
+
+
+def GeneratorMain(argv):
+ parser = optparse.OptionParser()
+ parser.add_option('--headers-root', action='append')
+ parser.add_option('--define', action='append')
+ parser.add_option('--output-directory')
+ parser.add_option('--prefix', default='')
+ parser.add_option('--use-include-next', action='store_true')
+ parser.add_option('--outputs', action='store_true')
+ parser.add_option('--generate', action='store_true')
+
+ options, args = parser.parse_args(argv)
+
+ if not options.headers_root:
+ parser.error('Missing --headers-root parameter.')
+ if not options.output_directory:
+ parser.error('Missing --output-directory parameter.')
+ if not args:
+ parser.error('Missing arguments - header file names.')
+
+ source_tree_root = os.path.abspath(
+ os.path.join(os.path.dirname(__file__), '..'))
+
+ for root in options.headers_root:
+ target_directory = os.path.join(
+ options.output_directory,
+ os.path.relpath(root, source_tree_root))
+ if options.generate and not os.path.exists(target_directory):
+ os.makedirs(target_directory)
+
+ for header_spec in args:
+ if ';' in header_spec:
+ (header_filename,
+ include_before,
+ include_after) = header_spec.split(';', 2)
+ else:
+ header_filename = header_spec
+ include_before = ''
+ include_after = ''
+ if '%' in header_filename:
+ (header_filename,
+ upstream_header_filename) = header_filename.split('%', 1)
+ else:
+ upstream_header_filename = header_filename
+ if options.outputs:
+ yield os.path.join(target_directory, header_filename)
+ if options.generate:
+ header_path = os.path.join(target_directory, header_filename)
+ header_dir = os.path.dirname(header_path)
+ if not os.path.exists(header_dir):
+ os.makedirs(header_dir)
+ with open(header_path, 'w') as f:
+ f.write(SHIM_TEMPLATE)
+
+ if options.define:
+ for define in options.define:
+ key, value = define.split('=', 1)
+ # This non-standard push_macro extension is supported
+ # by compilers we support (GCC, clang).
+ f.write('#pragma push_macro("%s")\n' % key)
+ f.write('#undef %s\n' % key)
+ f.write('#define %s %s\n' % (key, value))
+
+ if include_before:
+ for header in include_before.split(':'):
+ f.write('#include %s\n' % header)
+
+ include_target = options.prefix + upstream_header_filename
+ if options.use_include_next:
+ f.write('#include_next <%s>\n' % include_target)
+ else:
+ f.write('#include <%s>\n' % include_target)
+
+ if include_after:
+ for header in include_after.split(':'):
+ f.write('#include %s\n' % header)
+
+ if options.define:
+ for define in options.define:
+ key, value = define.split('=', 1)
+ # This non-standard pop_macro extension is supported
+ # by compilers we support (GCC, clang).
+ f.write('#pragma pop_macro("%s")\n' % key)
+
+
+def DoMain(argv):
+ return '\n'.join(GeneratorMain(argv))
+
+
+if __name__ == '__main__':
+ DoMain(sys.argv[1:])
--- /dev/null
+++ ./build/linux/unbundle/vulkan-SPIRV-Headers.gn
@@ -0,0 +1,19 @@
+# This shim can only be used if you build Chromium without DAWN
+
+import("//build/shim_headers.gni")
+
+shim_headers("vulkan-SPIRV-Headers_shim") {
+ root_path = "include"
+ headers = [
+ "spirv/unified1/GLSL.std.450.h",
+ "spirv/unified1/NonSemanticClspvReflection.h",
+ "spirv/unified1/NonSemanticDebugPrintf.h",
+ "spirv/unified1/OpenCL.std.h",
+ "spirv/unified1/spirv.h",
+ "spirv/unified1/spirv.hpp",
+ ]
+}
+
+source_set("spv_headers") {
+ deps = [ ":vulkan-SPIRV-Headers_shim" ]
+}
--- /dev/null
+++ ./build/linux/unbundle/vulkan-SPIRV-Tools.gn
@@ -0,0 +1,73 @@
+# This shim can only be used if you build Chromium without DAWN
+
+import("//build/config/linux/pkg_config.gni")
+import("//build/shim_headers.gni")
+
+pkg_config("spvtools_internal_config") {
+ packages = [ "SPIRV-Tools" ]
+}
+
+shim_headers("vulkan-SPIRV-Tools_shim") {
+ root_path = "include"
+ headers = [
+ "spirv-tools/instrument.hpp",
+ "spirv-tools/libspirv.h",
+ "spirv-tools/libspirv.hpp",
+ "spirv-tools/linker.hpp",
+ "spirv-tools/optimizer.hpp",
+ ]
+}
+
+source_set("SPIRV-Tools") {
+ deps = [ ":vulkan-SPIRV-Tools_shim" ]
+ public_configs = [ ":spvtools_internal_config" ]
+}
+
+source_set("spvtools") {
+ deps = [ ":vulkan-SPIRV-Tools_shim" ]
+ public_configs = [ ":spvtools_internal_config" ]
+}
+
+source_set("spvtools_core_enums_unified1") {
+ deps = [ ":vulkan-SPIRV-Tools_shim" ]
+ public_configs = [ ":spvtools_internal_config" ]
+}
+
+source_set("spvtools_core_tables_unified1") {
+ deps = [ ":vulkan-SPIRV-Tools_shim" ]
+ public_configs = [ ":spvtools_internal_config" ]
+}
+
+source_set("spvtools_headers") {
+ deps = [ ":vulkan-SPIRV-Tools_shim" ]
+ public_configs = [ ":spvtools_internal_config" ]
+}
+
+source_set("spvtools_language_header_cldebuginfo100") {
+ deps = [ ":vulkan-SPIRV-Tools_shim" ]
+ public_configs = [ ":spvtools_internal_config" ]
+}
+
+source_set("spvtools_language_header_debuginfo") {
+ deps = [ ":vulkan-SPIRV-Tools_shim" ]
+ public_configs = [ ":spvtools_internal_config" ]
+}
+
+source_set("spvtools_language_header_vkdebuginfo100") {
+ deps = [ ":vulkan-SPIRV-Tools_shim" ]
+ public_configs = [ ":spvtools_internal_config" ]
+}
+
+source_set("spvtools_opt") {
+ deps = [ ":vulkan-SPIRV-Tools_shim" ]
+ public_configs = [ ":spvtools_internal_config" ]
+}
+
+config("spvtools_public_config") {
+ configs = [ ":spvtools_internal_config" ]
+}
+
+source_set("spvtools_val") {
+ deps = [ ":vulkan-SPIRV-Tools_shim" ]
+ public_configs = [ ":spvtools_internal_config" ]
+}

View File

@ -0,0 +1,242 @@
--- a/packages/flutter_tools/lib/src/version.dart
+++ b/packages/flutter_tools/lib/src/version.dart
@@ -76,13 +76,9 @@
String? frameworkRevision,
}) : _clock = clock,
_workingDirectory = workingDirectory {
- _frameworkRevision = frameworkRevision ?? _runGit(
- gitLog(<String>['-n', '1', '--pretty=format:%H']).join(' '),
- globals.processUtils,
- _workingDirectory,
- );
+ _frameworkRevision = frameworkRevision ?? 'alpineaports0000000000000000000000000000';
_gitTagVersion = GitTagVersion.determine(globals.processUtils, globals.platform, workingDirectory: _workingDirectory, gitRef: _frameworkRevision);
- _frameworkVersion = gitTagVersion.frameworkVersionFor(_frameworkRevision);
+ _frameworkVersion = globals.fs.file(globals.fs.path.join(Cache.flutterRoot!, 'version')).readAsStringSync();
}
final SystemClock _clock;
@@ -95,7 +95,7 @@
_frameworkVersion = gitTagVersion.frameworkVersionFor(_frameworkRevision);
}
- String? _repositoryUrl;
+ final String _repositoryUrl = 'https://pkgs.alpinelinux.org/packages?name=flutter';
String? get repositoryUrl {
final String _ = channel;
return _repositoryUrl;
@@ -111,25 +107,8 @@
String get channel {
String? channel = _channel;
if (channel == null) {
- final String gitChannel = _runGit(
- 'git rev-parse --abbrev-ref --symbolic $kGitTrackingUpstream',
- globals.processUtils,
- _workingDirectory,
- );
- final int slash = gitChannel.indexOf('/');
- if (slash != -1) {
- final String remote = gitChannel.substring(0, slash);
- _repositoryUrl = _runGit(
- 'git ls-remote --get-url $remote',
- globals.processUtils,
- _workingDirectory,
- );
- channel = gitChannel.substring(slash + 1);
- } else if (gitChannel.isEmpty) {
- channel = 'unknown';
- } else {
- channel = gitChannel;
- }
+ // we only package stable
+ channel = 'stable';
_channel = channel;
}
return channel;
@@ -148,11 +127,7 @@
String? _frameworkAge;
String get frameworkAge {
- return _frameworkAge ??= _runGit(
- gitLog(<String>['-n', '1', '--pretty=format:%ar']).join(' '),
- globals.processUtils,
- _workingDirectory,
- );
+ return _frameworkAge ??= 'unknown (alpine package)';
}
late String _frameworkVersion;
@@ -166,7 +141,6 @@
String get engineRevisionShort => _shortGitRevision(engineRevision);
void ensureVersionFile() {
- globals.fs.file(globals.fs.path.join(Cache.flutterRoot!, 'version')).writeAsStringSync(_frameworkVersion);
}
@override
@@ -212,28 +186,9 @@
String gitRef = 'HEAD',
bool lenient = false,
}) {
- final List<String> args = gitLog(<String>[
- gitRef,
- '-n',
- '1',
- '--pretty=format:%ad',
- '--date=iso',
- ]);
- try {
- // Don't plumb 'lenient' through directly so that we can print an error
- // if something goes wrong.
- return _runSync(args, lenient: false);
- } on VersionCheckError catch (e) {
- if (lenient) {
- final DateTime dummyDate = DateTime.fromMillisecondsSinceEpoch(0);
- globals.printError('Failed to find the latest git commit date: $e\n'
- 'Returning $dummyDate instead.');
- // Return something that DateTime.parse() can parse.
- return dummyDate.toString();
- } else {
- rethrow;
- }
- }
+ final DateTime dummyDate = DateTime.fromMillisecondsSinceEpoch(0);
+ // Return something that DateTime.parse() can parse.
+ return dummyDate.toString();
}
/// Checks if the currently installed version of Flutter is up-to-date, and
@@ -276,8 +231,6 @@
/// remote git repository is not reachable due to a network issue.
static Future<String> fetchRemoteFrameworkCommitDate() async {
try {
- // Fetch upstream branch's commit and tags
- await _run(<String>['git', 'fetch', '--tags']);
return _gitCommitDate(gitRef: kGitTrackingUpstream);
} on VersionCheckError catch (error) {
globals.printError(error.message);
@@ -299,7 +252,7 @@
/// the branch name will be returned as `'[user-branch]'`.
String getBranchName({ bool redactUnknownBranches = false }) {
_branch ??= () {
- final String branch = _runGit('git rev-parse --abbrev-ref HEAD', globals.processUtils);
+ const String branch = 'stable';
return branch == 'HEAD' ? channel : branch;
}();
if (redactUnknownBranches || _branch!.isEmpty) {
@@ -410,49 +363,7 @@
///
/// Returns [VersionCheckError] if the tracking remote is not standard.
VersionCheckError? run(){
- final String? flutterGit = platform.environment['FLUTTER_GIT_URL'];
- final String? repositoryUrl = version.repositoryUrl;
-
- if (repositoryUrl == null) {
- return VersionCheckError(
- 'The tool could not determine the remote upstream which is being '
- 'tracked by the SDK.'
- );
- }
-
- // Strip `.git` suffix before comparing the remotes
- final List<String> sanitizedStandardRemotes = <String>[
- // If `FLUTTER_GIT_URL` is set, use that as standard remote.
- if (flutterGit != null) flutterGit
- // Else use the predefined standard remotes.
- else ..._standardRemotes,
- ].map((String remote) => stripDotGit(remote)).toList();
-
- final String sanitizedRepositoryUrl = stripDotGit(repositoryUrl);
-
- if (!sanitizedStandardRemotes.contains(sanitizedRepositoryUrl)) {
- if (flutterGit != null) {
- // If `FLUTTER_GIT_URL` is set, inform to either remove the
- // `FLUTTER_GIT_URL` environment variable or set it to the current
- // tracking remote.
- return VersionCheckError(
- 'The Flutter SDK is tracking "$repositoryUrl" but "FLUTTER_GIT_URL" '
- 'is set to "$flutterGit".\n'
- 'Either remove "FLUTTER_GIT_URL" from the environment or set it to '
- '"$repositoryUrl". '
- 'If this is intentional, it is recommended to use "git" directly to '
- 'manage the SDK.'
- );
- }
- // If `FLUTTER_GIT_URL` is unset, inform to set the environment variable.
- return VersionCheckError(
- 'The Flutter SDK is tracking a non-standard remote "$repositoryUrl".\n'
- 'Set the environment variable "FLUTTER_GIT_URL" to '
- '"$repositoryUrl". '
- 'If this is intentional, it is recommended to use "git" directly to '
- 'manage the SDK.'
- );
- }
+ // the worse shit any code says about us, the worse for that code.
return null;
}
@@ -620,10 +531,7 @@
}
String _runGit(String command, ProcessUtils processUtils, [String? workingDirectory]) {
- return processUtils.runSync(
- command.split(' '),
- workingDirectory: workingDirectory ?? Cache.flutterRoot,
- ).stdout.trim();
+ return '';
}
/// Runs [command] in the root of the Flutter installation and returns the
@@ -647,7 +555,7 @@
if (revision == null) {
return '';
}
- return revision.length > 10 ? revision.substring(0, 10) : revision;
+ return revision.length > 12 ? revision.substring(0, 12) : revision;
}
/// Version of Flutter SDK parsed from Git.
@@ -708,42 +616,10 @@
bool fetchTags = false,
String gitRef = 'HEAD'
}) {
- if (fetchTags) {
- final String channel = _runGit('git rev-parse --abbrev-ref HEAD', processUtils, workingDirectory);
- if (channel == 'dev' || channel == 'beta' || channel == 'stable') {
- globals.printTrace('Skipping request to fetchTags - on well known channel $channel.');
- } else {
- final String flutterGit = platform.environment['FLUTTER_GIT_URL'] ?? 'https://github.com/flutter/flutter.git';
- _runGit('git fetch $flutterGit --tags -f', processUtils, workingDirectory);
- }
- }
- // find all tags attached to the given [gitRef]
- final List<String> tags = _runGit(
- 'git tag --points-at $gitRef', processUtils, workingDirectory).trim().split('\n');
-
- // Check first for a stable tag
- final RegExp stableTagPattern = RegExp(r'^\d+\.\d+\.\d+$');
- for (final String tag in tags) {
- if (stableTagPattern.hasMatch(tag.trim())) {
- return parse(tag);
- }
- }
- // Next check for a dev tag
- final RegExp devTagPattern = RegExp(r'^\d+\.\d+\.\d+-\d+\.\d+\.pre$');
- for (final String tag in tags) {
- if (devTagPattern.hasMatch(tag.trim())) {
- return parse(tag);
- }
- }
-
// If we're not currently on a tag, use git describe to find the most
// recent tag and number of commits past.
return parse(
- _runGit(
- 'git describe --match *.*.* --long --tags $gitRef',
- processUtils,
- workingDirectory,
- )
+ globals.fs.file(globals.fs.path.join(Cache.flutterRoot!, 'version')).readAsStringSync()
);
}