[Buildroot] [PATCH/next v2 9/9] package/flutter-gallery: clean up install_target_cmds
Adam Duskett
adam.duskett at amarulasolutions.com
Sat Nov 18 22:14:14 UTC 2023
Remove and create the kernel_blob.bin file in the flutter_assets directory:
When Flutter compiles the source code, it creates the kernel_blob.bin file,
a Dart Kernel Bytecode of the application.
If kernel_blob.bin exists inside the flutter_assets directory, then the
application source code can be extracted with nothing more than apktool.
Not only is this a security risk, it's also redundant and a waste of space.
Removing the kernel_blob.bin file generated for flutter-gallery saves 86M!
Because this package is a reference package, and some applications may check
if the kernel_blob.bin file exists, we also touch a blank kernel_blob.bin
file.
Do not use relative symlinks:
Users may not install their applications in the
/usr/share/flutter/${package_name} directory. Because this is a reference
application, we should use exact symlinks to icudtl.dat and
libflutter_engine.so. Besides, the output of ls -la looks cleaner as well!
Signed-off-by: Adam Duskett <adam.duskett at amarulasolutions.com>
---
v1 -> v2: Add a far more comprehensive git log explaining the reasoning of the
changes. [Yann]
package/flutter-gallery/flutter-gallery.mk | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/package/flutter-gallery/flutter-gallery.mk b/package/flutter-gallery/flutter-gallery.mk
index 5299b18134..492b426510 100644
--- a/package/flutter-gallery/flutter-gallery.mk
+++ b/package/flutter-gallery/flutter-gallery.mk
@@ -46,10 +46,12 @@ define FLUTTER_GALLERY_INSTALL_TARGET_CMDS
$(INSTALL) -D -m 0755 $(@D)/libapp.so \
$(FLUTTER_GALLERY_INSTALL_DIR)/lib/libapp.so
- ln -sf ../../../$(FLUTTER_ENGINE_RUNTIME_MODE)/data/icudtl.dat \
+ ln -sf /usr/share/flutter/$(FLUTTER_ENGINE_RUNTIME_MODE)/data/icudtl.dat \
$(FLUTTER_GALLERY_INSTALL_DIR)/data/
- ln -sf ../../../../../lib/libflutter_engine.so $(FLUTTER_GALLERY_INSTALL_DIR)/lib/
+ ln -sf /usr/lib/libflutter_engine.so $(FLUTTER_GALLERY_INSTALL_DIR)/lib/
+ $(RM) $(FLUTTER_GALLERY_INSTALL_DIR)/data/flutter_assets/kernel_blob.bin
+ touch $(FLUTTER_GALLERY_INSTALL_DIR)/data/flutter_assets/kernel_blob.bin
endef
$(eval $(generic-package))
--
2.42.0
More information about the buildroot
mailing list