Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include bootstrap zip as shared library #1301

Merged
merged 1 commit into from
Oct 20, 2019
Merged

Conversation

fornwall
Copy link
Member

@fornwall fornwall commented Oct 13, 2019

This is an experiment with including the bootstrap zip as a shared library.

The gradle build now downloads the bootstrap of a specified version from bintray.

  • Why include the bootstrap zip in the app?

    • To save several terabytes of monthly bandwidth on the server, and instead rely on Google to provide a speedy download of bootstrap files.
    • To allow offline installation.
    • To avoid surprising users with data traffic on first use.
  • Why as a shared library?

    • To make the app splitting work on Google Play. Termux is uploaded to the Play store as an Android App Bundle, and Google generates optimized apps for devices, so that e.g. only aarch64 devices gets the aarch64 bootstrap. See https://developer.android.com/studio/projects/dynamic-delivery. F-Droid can also do the corresponding thing with a custom build.
  • Issues

    • Is there a better way?
    • The shared library is never unloaded - this probably causes increased memory usage? But the library is only loaded on demand, so after the initial run of the Termux process the library is not loaded.
    • This bumps the required version of Android to API level 24 (Android 7.0) - we could create an Android-5 branch if needed as well.

@fornwall fornwall force-pushed the bootstrap-zip-included branch 2 times, most recently from a6b6e4e to 785f075 Compare October 13, 2019 21:24
@ghost
Copy link

ghost commented Oct 14, 2019

this probably causes increased memory usage?

I don't think that additional 15-17 MB of used ram will cause problems.

We may try to dlopen() lib with bootstrap from another smaller library so we will be able to dlclose() it when bootstrap installation is finished. But that is not necessary for now.


I also noted that such installation method may cause failure of Android Runtime and application will be force-closed if bootstrap archive is big (I created 450 MB one with clang, rust, go, etc... for testing). Failure happens independently of how much RAM is available. So that method is unsuitable for https://github.com/termux/termux-packages/wiki/Termux-and-Android-10#3-generate-an-app-on-device-containing-packages.

@finagolfin
Copy link
Member

Sounds like a good idea, I've recommended Termux to people and then have them complain it gets stuck when first run, maybe because of this additional download.

@fornwall fornwall changed the title EXPERIMENTAL: Include bootstrap zip as shared library Include bootstrap zip as shared library Oct 15, 2019
@fornwall fornwall merged commit c76cec1 into master Oct 20, 2019
@ghost ghost deleted the bootstrap-zip-included branch October 28, 2019 12:54
@agnostic-apollo agnostic-apollo mentioned this pull request Mar 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants