The maintainers of the flutter-gallery package archived the project as of
February 16, 2024, necessitating a new reference package for users to port
their Flutter applications to Buildroot. The flutter-packages repository is
the perfect candidate for a reference package for several reasons:
- It contains the source code for Flutter's first-party packages.
- Many of the packages contain examples.
- Many of the examples include Linux-specific examples.
- The repository is updated regularly and often automatically, ensuring
compatibility with the latest versions of Flutter.
However, the layout of the flutter-packages repository stores all of the
examples in sub-directories, which creates an organizational problem; either
every example application is stored in packages/flutter-example-${name}, with
the version, site, site_method, license, license_files, and dependencies of
each package independent from each other, or, each example application is in a
sub-directory of the flutter-packages directory, and flutter-packages acts as
the primary source of the above variables.
As option one is a nightmare to maintain, this patch provides option two,
which only necessitates the use of two features rarely used together in
Buildroot: $(PKG_NAME)_DL_SUBDIR and $(PKG_NAME)_SOURCE. With these two options
appropriately set, each sub-package uses the flutter-packages source tarball,
which downloads once, saving time, disk space, bandwidth, and future
maintenance headaches.
Three variables in the .mk file help with subsequent patches that add more
example applications:
- FLUTTER_MARKDOWN_EXAMPLE_PKG_NAME:
- Set to the name of the application.
- FLUTTER_MARKDOWN_EXAMPLE_INSTALL_DIR:
- It uses the PKG_NAME variable to set the installation directory.
- FLUTTER_MARKDOWN_EXAMPLE_SUBDIR:
- Provides the directory in which to build the package.
With the above variables, adding subsequent packages involves minimal effort:
- Copy, paste, and rename a sub-directory to a new package name.
- Set the above variables to new names and directories.
- Check to see if there are any new build commands, such as specifying a
dart_plugin_registrant.dart file.
Another option that seems appealing is to have a single package, with the
Config.in options to select which example(s) to build. However, this option
does not work well for two reasons:
- The logic between this package and the flutter-gallery package it replaces
would be very different. As the flutter-gallery package acts as a reference
package for other users, changing the logic would make the package difficult
to parse and possibly useless for other users to use as a reference when
porting their Flutter-based applications to Buildroot.
- Not all packages in the flutter-package repository use the same directory
structure. Take, for example, the flutter-rfw-local-example. The build
directory is located at rfw/example/local, whereas most other packages are
at ${pkg_name}/example, which makes a pure-foreach loop impossible.
These packages are intended for reference, and changing the logic instead of
using the same would hinder users from attempting to port their Flutter
applications to Buildroot. As such, this option is ruled out for the above
reasons.
The first package in this series is a Markdown example application that
displays several Markdown formatting demos. However, it does not support inline
HTML. This package also lacks a dart_plugin_registrant file, and unlike the
flutter-gallery package, the lines referencing such a file are not included in
the build commands. This is not a problem, but is something to note.
Also, the `FLUTTER_RUNTIME_MODES=$(FLUTTER_ENGINE_RUNTIME_MODE)` line from the
configure commands is not copied from the flutter-gallery package, as it was
included by mistake and did not have any effecton the clean command.
Note: The version of the flutter-packages git hash is set to
947e34ce9fedcdd6750b54eb1cc74b854b49ab48, the last commit that supported
Flutter 3.16.x. Newer versions require Flutter 3.19.x
Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
Buildroot is a simple, efficient and easy-to-use tool to generate embedded
Linux systems through cross-compilation.
The documentation can be found in docs/manual. You can generate a text
document with 'make manual-text' and read output/docs/manual/manual.text.
Online documentation can be found at http://buildroot.org/docs.html
To build and use the buildroot stuff, do the following:
1) run 'make menuconfig'
2) select the target architecture and the packages you wish to compile
3) run 'make'
4) wait while it compiles
5) find the kernel, bootloader, root filesystem, etc. in output/images
You do not need to be root to build or run buildroot. Have fun!
Buildroot comes with a basic configuration for a number of boards. Run
'make list-defconfigs' to view the list of provided configurations.
Please feed suggestions, bug reports, insults, and bribes back to the
buildroot mailing list: buildroot@buildroot.org
You can also find us on #buildroot on OFTC IRC.
If you would like to contribute patches, please read
https://buildroot.org/manual.html#submitting-patches