• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

.idea/23-Nov-2023-9494

gradle/wrapper/23-Nov-2023-65

ports/23-Nov-2023-206130

scripts/23-Nov-2023-53

src/23-Nov-2023-1,314910

.gitD01-Jan-19700

.gitignoreD23-Nov-20231.7 KiB8463

DockerfileD23-Nov-2023404 1613

README.mdD23-Nov-20232.2 KiB7758

build.gradle.ktsD23-Nov-20231.7 KiB6042

gradle.propertiesD23-Nov-202326 11

gradlewD23-Nov-20235.2 KiB173128

gradlew.batD23-Nov-20232.1 KiB8561

settings.gradle.ktsD23-Nov-2023281 1110

README.md

1# ndkports
2
3A collection of Android build scripts for various third-party libraries and the
4tooling to build them.
5
6If you're an Android app developer looking to *consume* these libraries, this is
7probably not what you want. This project builds AARs to be published to Maven.
8You most likely want to use the AAR, not build it yourself.
9
10Note: Gradle support for consuming these artifacts from an AAR is a work in
11progress.
12
13## Ports
14
15Each third-party project is called a "port". Ports consist of a description of
16where to fetch the source, apply any patches needed, build, install, and package
17the library into an AAR.
18
19A port is a subclass of the abstract Kotlin class `com.android.ndkports.Port`.
20Projects define the name and version of the port, the URL to fetch source from,
21a list of modules (libraries) to build, and the build steps.
22
23```kotlin
24abstract class Port {
25    abstract val name: String
26    abstract val version: String
27    abstract val url: String
28
29    open val dependencies: List<String> = emptyList()
30    abstract val modules: List<Module>
31
32    open fun fetchSource(
33        sourceDirectory: File,
34        workingDirectory: File
35    ): Result<Unit, String>
36
37    open fun configure(
38        toolchain: Toolchain,
39        sourceDirectory: File,
40        buildDirectory: File,
41        installDirectory: File,
42        workingDirectory: File
43    ): Result<Unit, String>
44
45    open fun build(
46        toolchain: Toolchain,
47        buildDirectory: File
48    ): Result<Unit, String>
49
50    open fun install(
51        toolchain: Toolchain,
52        buildDirectory: File,
53        installDirectory: File
54    ): Result<Unit, String>
55}
56```
57
58Individual port files are kept in `ports/$name/port.kts`. For example, the cURL
59port is [ports/curl/port.kts](ports/curl/port.kts).
60
61## Building a Port
62
63ndkports requires an NDK to be used for building to be specified on the command
64line as well as a list of packages to build. For example, to build cURL:
65
66```bash
67$ ./gradlew run --args='--ndk /path/to/android-ndk-r20 openssl curl'
68Build output...
69$ find  -name '*.aar'
70./out/curl/curl.aar
71./out/openssl/openssl.aar
72```
73
74Note that dependencies currently need to be already built or ordered explicitly.
75
76To build all ports using Docker, use `scripts/build.sh`.
77