Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Setup & building instructions

Cherry edited this page Oct 29, 2022 · 3 revisions

Quick Setup Instructions

  • Android app setup code, including gradle files, assets, binary / java code, etc, can all be found under the app folder. This is not a 100% complete Android app, but rather it contains all the code examples needed for you to adapt it to your own project. Just copy / rewrite / delete code you want / don't need and combine it with your Android Studio project.
  • Place your libs under the libs/arch folder. It's already setup to be noticed when your APK is built.

How to run the binary

  1. Put the generated binary in the assets bin folder. Put all libs in the libs/arch folder.
  2. Add environment variables before you run the binary.
  3. Execute binary with args.
ENV Variable Description Example Value
TMPDIR Temporary cache directory. Set to a directory writable by your app /data/data/com.myapp/files/TMP
MAGICK_HOME The directory containing imagemagick xml config files. Should be set to the base directory, e.g. /usr , with config files being in /usr/etc/ImageMagick-7. /data/data/com.myapp/files/usr
ICU_DATA_DIR_PREFIX The directory containing the folder named icu which contains the ICU data files (required by icuuc library). For example, a path of /usr will result in /usr/icu/icu.dat being loaded. Only required if the libxml2 delegate is enabled. /data/data/com.myapp/files/usr
LD_LIBRARY_PATH Needed in order for the binary to find the libc++_shared.so library (or other libraries if you compiled them into shared libraries). Preferable to use the code context.getApplicationInfo().nativeLibraryDir /data/data/com.myapp/files/usr/lib/arm64-v8a

Building from Source

  • We use NDK 23 (as that's what's currently supported by the project)
  • If you haven't already, install and setup NDK 23 as per Google's instructions. If you don't know how NDK works, make sure to read how NDK works as it is important to getting your build successfully compiling. The required gradle files for building inside the app folder.
  • Edit your build configuration under Application.mk to your liking, then (next step below)
  • Use your CMD in the root and execute build-release.bat. Sorry, the build only currently works on Windows because I didn't have time to test the make files under Linux. Contributions are welcome.

Building with Docker

  • Install Docker
  • Run the build-with-docker script :)

Use -r for release, or -d for debug build. No arguments means release mode

Docker image: https://hub.docker.com/repository/docker/cherryleafroad/imbuild

The script will ask you to download or build it yourself. It may be faster for you to build the image (cause there's less to download)

No Linux shell script currently exists, but there's nothing stopping you from setting it up yourself (just read the build-with-docker file).

Building with Github

  • Fork the repo, change the config file (if you want), then use github actions to build it, and download the build artifacts. Pretty much almost no setup required in order to build. :)