1*2e149f73SXin Li# ndkports 2*2e149f73SXin Li 3*2e149f73SXin LiA collection of Android build scripts for various third-party libraries and the 4*2e149f73SXin Litooling to build them. 5*2e149f73SXin Li 6*2e149f73SXin LiIf you're an Android app developer looking to *consume* these libraries, this is 7*2e149f73SXin Liprobably not what you want. This project builds AARs to be published to Maven. 8*2e149f73SXin LiYou most likely want to use the AAR, not build it yourself. 9*2e149f73SXin Li 10*2e149f73SXin LiNote: Gradle support for consuming these artifacts from an AAR is a work in 11*2e149f73SXin Liprogress. 12*2e149f73SXin Li 13*2e149f73SXin Li## Ports 14*2e149f73SXin Li 15*2e149f73SXin LiEach third-party project is called a "port". Ports consist of a description of 16*2e149f73SXin Liwhere to fetch the source, apply any patches needed, build, install, and package 17*2e149f73SXin Lithe library into an AAR. 18*2e149f73SXin Li 19*2e149f73SXin LiA port is a subclass of the abstract Kotlin class `com.android.ndkports.Port`. 20*2e149f73SXin LiProjects define the name and version of the port, the URL to fetch source from, 21*2e149f73SXin Lia list of modules (libraries) to build, and the build steps. 22*2e149f73SXin Li 23*2e149f73SXin LiSee the [Port class] for documentation on the port API. 24*2e149f73SXin Li 25*2e149f73SXin LiIndividual port files are kept in `ports/$name/port.kts`. For example, the cURL 26*2e149f73SXin Liport is [ports/curl/port.kts](ports/curl/port.kts). 27*2e149f73SXin Li 28*2e149f73SXin Li[Port class]: src/main/kotlin/com/android/ndkports/Port.kt 29*2e149f73SXin Li 30*2e149f73SXin Li## Building a Port 31*2e149f73SXin Li 32*2e149f73SXin LiWe recommend using the supplied scripts and Dockerfile for consistent builds. 33*2e149f73SXin Li 34*2e149f73SXin LiTo build a release for distribution to a Maven repo, `scripts/build_release.sh` 35*2e149f73SXin Li 36*2e149f73SXin LiTo build a snapshot, `scripts/build_snapshot.sh` 37*2e149f73SXin Li 38*2e149f73SXin LiYou can also pass custom gradle targets: `scripts/build_snapshot.sh curl` 39*2e149f73SXin Li 40*2e149f73SXin LiThe scripts use the standard `ANDROID_NDK_ROOT` environment variable to 41*2e149f73SXin Lilocate the NDK. For example, `ANDROID_NDK_ROOT=/path/to/ndk scripts/build_release.sh`