827da2242c
There are many issues with this package: - The release tarballs from https://github.com/flutter/engine are in no state to compile. They are only for the use of gclient to download a source directory structure suitable to build the Flutter engine! If you download, extract and attempt to run `./tools/gn --no-goma --no-prebuilt-dart-sdk`, you receive the error message: `No such file or directory: 'flutter/flutter/third_party/gn/gn.' But wait! Wasn't the gn binary just called? No, that's a wrapper in the Flutter source tree that formats arguments to call the real gn binary. The real gn is not provided in the tarball but is downloaded via gclient (among many other supporting repositories.) Even worse, the flutter buildsystem depends on the .git dirs being present. (https://github.com/meta-flutter/meta-flutter/issues/271) This dependency means it is not possible to create a reproducible tarball from the downloaded sources, which is why there is no .hash file provided. I have asked the flutter project to release full tarballs suitable for compiling here: https://github.com/flutter/flutter/issues/130734 - Flutter engine includes a patched copy of clang that must be used to compile. Using a Buildroot-build clang results in linking warning and errors. As such, we depend on LLVM_ARCH_SUPPORTS but use the included clang for building. On the plus side, this saves time having to compile clang. - flutter-engine relies on the "PUB_CACHE", that is provided by flutter-sdk, so we need a build dependency, even if no tool from host-flutter-sdk-bin is used to build flutter-engine Tested with: - Debian 11 and 12 - Ubuntu 18.04, 20.04, and 22.04 - Fedora 38 - Per-package directories Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com> [yann.morin.1998@free.fr: - search gclient.py from PATH - indent shell script with 4 spaces - reorganise schell script with prepare/cleanup - tweak comment about weirdness of flutter buildsystem - use suitable-extactor and TAR_OPTIONS - use FLUTTER_SDK_BIN_PUB_CACHE - add dependency to host-futter-sdk-bin (Adam) ] Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
94 lines
2.4 KiB
Bash
Executable File
94 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Call gclient and generate a flutter-engine source tarball if one does not
|
|
# already exist.
|
|
set -eu
|
|
|
|
DL_DIR=
|
|
DOT_GCLIENT=
|
|
JOBS=
|
|
SCRATCH_DIR=
|
|
TARBALL_DL_PATH=
|
|
VERSION=
|
|
TARBALL_NAME=
|
|
|
|
term_bold="$(tput smso 2>/dev/null || true)"
|
|
term_reset="$(tput rmso 2>/dev/null || true)"
|
|
|
|
# Print status messages in the same style Buildroot prints.
|
|
message() {
|
|
printf "%s>>> flutter-engine %s %s%s\n" "${term_bold}" "${VERSION}" "${1}" "${term_reset}"
|
|
}
|
|
|
|
parse_opts() {
|
|
local o O opts
|
|
|
|
o='d:j:s:t:v:'
|
|
O='dot-gclient:,jobs:,scratch-dir:,tarball-dl-path:,version:'
|
|
opts="$(getopt -o "${o}" -l "${O}" -- "${@}")"
|
|
eval set -- "${opts}"
|
|
|
|
while [ ${#} -gt 0 ]; do
|
|
case "${1}" in
|
|
(-d|--dot-gclient) DOT_GCLIENT="${2}"; shift 2;;
|
|
(-j|--jobs) JOBS="${2}"; shift 2;;
|
|
(-s|--scratch-dir) SCRATCH_DIR="${2}"; shift 2;;
|
|
(-t|--tarball-dl-path) DL_DIR=$(dirname "${2}"); TARBALL_DL_PATH="${2}"; shift 2;;
|
|
(-v|--version) VERSION="${2}"; TARBALL_NAME=flutter-"${VERSION}".tar.gz; shift 2;;
|
|
(--) shift; break;;
|
|
esac
|
|
done
|
|
}
|
|
|
|
prepare() {
|
|
rm -rf "${SCRATCH_DIR}"
|
|
mkdir -p "${SCRATCH_DIR}"
|
|
pushd "${SCRATCH_DIR}" >/dev/null
|
|
}
|
|
|
|
copy_dot_gclient() {
|
|
sed "s%!FLUTTER_VERSION!%${VERSION}%g" "${DOT_GCLIENT}" >.gclient
|
|
}
|
|
|
|
run_gclient() {
|
|
message "Downloading"
|
|
gclient.py \
|
|
sync \
|
|
--delete_unversioned_trees \
|
|
--no-history \
|
|
--reset \
|
|
--shallow \
|
|
-j"${JOBS}"
|
|
}
|
|
|
|
gen_tarball() {
|
|
message "Generating tarball"
|
|
mkdir -p "${DL_DIR}"
|
|
# There are two issues with the flutter-engine buildsystem:
|
|
# - it expects empty directories created by gclient.py to be present; that
|
|
# means we can't use the mk_tar_gz helper method from support/download/helpers,
|
|
# becasue it does not include emnpty directories;
|
|
# - it insists on having a full git repositoy, with .git et al., which means
|
|
# we can't generate a reproducible archive anyway.
|
|
# So we jsut create a plain tarball.
|
|
tar -C "${SCRATCH_DIR}"/src -czf "${TARBALL_NAME}" .
|
|
mv "${TARBALL_NAME}" "${TARBALL_DL_PATH}"
|
|
}
|
|
|
|
cleanup() {
|
|
popd >/dev/null
|
|
rm -rf "${SCRATCH_DIR}"
|
|
}
|
|
|
|
main() {
|
|
parse_opts "${@}"
|
|
if [[ ! -e "${TARBALL_DL_PATH}" ]]; then
|
|
prepare
|
|
copy_dot_gclient
|
|
run_gclient
|
|
gen_tarball
|
|
cleanup
|
|
fi
|
|
}
|
|
|
|
main "${@}"
|