aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 05:07:42 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 05:07:42 +0000
commitd285d191def5a8b9fc7ad6ac4efbb689e6d40d43 (patch)
treee75b07b8baccd662b0b51425df808da5b0f2b916
parent1ec8f13e5a938f306b54e76fcdf067599be5b189 (diff)
parentcf9cad3c87c8ed5999d19e1a9f185f9a1e2c201d (diff)
downloadndkports-android14-mainline-mediaprovider-release.tar.gz
Change-Id: I3294f6e6487ea2d0a6fd100dd1540abc69476a50
-rw-r--r--.gitignore1
-rw-r--r--Dockerfile9
-rw-r--r--README.md18
-rw-r--r--build.gradle.kts23
-rw-r--r--buildSrc/build.gradle.kts9
-rw-r--r--buildSrc/src/main/kotlin/com/android/ndkports/Abi.kt4
-rw-r--r--buildSrc/src/main/kotlin/com/android/ndkports/Toolchain.kt9
-rw-r--r--curl/build.gradle.kts32
-rw-r--r--curl/src.tar.gzbin4144744 -> 4182153 bytes
-rw-r--r--googletest/build.gradle.kts20
-rw-r--r--gradle/wrapper/gradle-wrapper.properties2
-rw-r--r--jsoncpp/build.gradle.kts20
-rw-r--r--openssl/build.gradle.kts22
-rw-r--r--openssl/src.tar.gzbin9834044 -> 9868981 bytes
-rwxr-xr-xscripts/build_release.sh13
-rwxr-xr-xscripts/build_snapshot.sh12
16 files changed, 121 insertions, 73 deletions
diff --git a/.gitignore b/.gitignore
index 8f8ed69..6c09f90 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
.gradle
+/.gradle_home/
/build/
/buildSrc/build/
/curl/build/
diff --git a/Dockerfile b/Dockerfile
index ac011ef..644c120 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -6,15 +6,12 @@ RUN apt-get update && apt-get install -y \
ninja-build \
python3-pip
RUN pip3 install meson
-RUN curl -o ndk.zip \
- https://dl.google.com/android/repository/android-ndk-r21e-linux-x86_64.zip
-RUN unzip ndk.zip
-RUN mv android-ndk-r21e /ndk
RUN curl -L -o platform-tools.zip \
https://dl.google.com/android/repository/platform-tools-latest-linux.zip
RUN unzip platform-tools.zip platform-tools/adb
RUN mv platform-tools/adb /usr/bin/adb
+RUN mkdir -m 0750 /.android
WORKDIR /src
-ENTRYPOINT ["./gradlew"]
-CMD ["--stacktrace", "-PndkPath=/ndk", "release"]
+ENTRYPOINT ["./gradlew", "--no-daemon", "--gradle-user-home=.gradle_home", "--stacktrace", "-PndkPath=/ndk"]
+CMD ["-Prelease", "clean", "release"]
diff --git a/README.md b/README.md
index 6a70957..ddbe624 100644
--- a/README.md
+++ b/README.md
@@ -29,17 +29,13 @@ port is [ports/curl/port.kts](ports/curl/port.kts).
## Building a Port
-ndkports requires an NDK to be used for building to be specified on the command
-line as well as a list of packages to build. For example, to build cURL:
+We recommend using the supplied scripts and Dockerfile for consistent builds.
-```bash
-$ ./gradlew run --args='--ndk /path/to/android-ndk-r20 openssl curl'
-Build output...
-$ find -name '*.aar'
-./out/curl/curl.aar
-./out/openssl/openssl.aar
-```
+To build a release for distribution to a Maven repo, `scripts/build_release.sh`
-Note that dependencies currently need to be already built or ordered explicitly.
+To build a snapshot, `scripts/build_snapshot.sh`
-To build all ports using Docker, use `scripts/build.sh`.
+You can also pass custom gradle targets: `scripts/build_snapshot.sh curl`
+
+The scripts use the standard `ANDROID_NDK_ROOT` environment variable to
+locate the NDK. For example, `ANDROID_NDK_ROOT=/path/to/ndk scripts/build_release.sh` \ No newline at end of file
diff --git a/build.gradle.kts b/build.gradle.kts
index f217598..c1a7350 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -15,33 +15,12 @@ buildscript {
group = "com.android"
version = "1.0.0${extra.get("snapshotSuffix")}"
-plugins {
- distribution
-}
-
repositories {
mavenCentral()
- jcenter()
google()
}
-distributions {
- main {
- contents {
- from("${rootProject.buildDir}/repository")
- include("**/*.aar")
- include("**/*.pom")
- }
- }
-}
-
-tasks {
- distZip {
- dependsOn(project.getTasksByName("publish", true))
- }
-}
-
tasks.register("release") {
dependsOn(project.getTasksByName("test", true))
- dependsOn(":distZip")
+ dependsOn(project.getTasksByName("distZip", true))
}
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts
index 4de21c7..23635cc 100644
--- a/buildSrc/build.gradle.kts
+++ b/buildSrc/build.gradle.kts
@@ -1,7 +1,7 @@
-val kotlinVersion = "1.4.20"
+val kotlinVersion = "1.7.10"
plugins {
- id("org.jetbrains.kotlin.jvm") version "1.4.20"
+ id("org.jetbrains.kotlin.jvm") version "1.7.10"
id("java-gradle-plugin")
id("maven-publish")
}
@@ -11,16 +11,15 @@ version = "1.0.0-SNAPSHOT"
repositories {
mavenCentral()
- jcenter()
google()
}
dependencies {
implementation(kotlin("stdlib", kotlinVersion))
- implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1")
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.3")
implementation("com.google.prefab:api:1.1.2")
- implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.0")
+ implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.3")
implementation("org.redundent:kotlin-xml-builder:1.6.1")
testImplementation(kotlin("test", kotlinVersion))
diff --git a/buildSrc/src/main/kotlin/com/android/ndkports/Abi.kt b/buildSrc/src/main/kotlin/com/android/ndkports/Abi.kt
index 155c59c..f6dbc01 100644
--- a/buildSrc/src/main/kotlin/com/android/ndkports/Abi.kt
+++ b/buildSrc/src/main/kotlin/com/android/ndkports/Abi.kt
@@ -24,9 +24,9 @@ enum class Abi(
val triple: String,
val minSupportedVersion: Int
) {
- Arm("arm", "armeabi-v7a", "arm-linux-androideabi", 16),
+ Arm("arm", "armeabi-v7a", "arm-linux-androideabi", 19),
Arm64("arm64", "arm64-v8a", "aarch64-linux-android", 21),
- X86("x86", "x86", "i686-linux-android", 16),
+ X86("x86", "x86", "i686-linux-android", 19),
X86_64("x86_64", "x86_64", "x86_64-linux-android", 21);
fun adjustMinSdkVersion(minSdkVersion: Int) =
diff --git a/buildSrc/src/main/kotlin/com/android/ndkports/Toolchain.kt b/buildSrc/src/main/kotlin/com/android/ndkports/Toolchain.kt
index 1293ecb..4e32a25 100644
--- a/buildSrc/src/main/kotlin/com/android/ndkports/Toolchain.kt
+++ b/buildSrc/src/main/kotlin/com/android/ndkports/Toolchain.kt
@@ -32,9 +32,12 @@ class Toolchain(val ndk: Ndk, val abi: Abi, val api: Int) {
val sysrootLibs = ndk.sysrootDirectory.resolve("usr/lib/$binutilsTriple")
val binDir = ndk.toolchainBinDirectory
- val ar = binDir.resolve("$binutilsTriple-ar")
+ val ar = binDir.resolve("llvm-ar")
val clang = binDir.resolve("$clangTriple-clang")
val clangxx = binDir.resolve("$clangTriple-clang++")
- val ranlib = binDir.resolve("$binutilsTriple-ranlib")
- val strip = binDir.resolve("$binutilsTriple-strip")
+ val nm = binDir.resolve("llvm-nm")
+ val objdump = binDir.resolve("llvm-objdump")
+ val ranlib = binDir.resolve("llvm-ranlib")
+ val readelf = binDir.resolve("llvm-readelf")
+ val strip = binDir.resolve("llvm-strip")
} \ No newline at end of file
diff --git a/curl/build.gradle.kts b/curl/build.gradle.kts
index 089ef04..8dfa105 100644
--- a/curl/build.gradle.kts
+++ b/curl/build.gradle.kts
@@ -2,7 +2,7 @@ import com.android.ndkports.AutoconfPortTask
import com.android.ndkports.CMakeCompatibleVersion
import com.android.ndkports.PrefabSysrootPlugin
-val portVersion = "7.79.1"
+val portVersion = "7.85.0"
group = "com.android.ndk.thirdparty"
version = "$portVersion${rootProject.extra.get("snapshotSuffix")}"
@@ -10,6 +10,7 @@ version = "$portVersion${rootProject.extra.get("snapshotSuffix")}"
plugins {
id("maven-publish")
id("com.android.ndkports.NdkPorts")
+ distribution
}
dependencies {
@@ -19,7 +20,7 @@ dependencies {
ndkPorts {
ndkPath.set(File(project.findProperty("ndkPath") as String))
source.set(project.file("src.tar.gz"))
- minSdkVersion.set(16)
+ minSdkVersion.set(19)
}
tasks.prefab {
@@ -35,14 +36,6 @@ tasks.register<AutoconfPortTask>("buildPort") {
"--with-ca-path=/system/etc/security/cacerts",
"--with-ssl=$sysroot"
)
-
- // aarch64 still defaults to bfd which transitively checks libraries.
- // When curl is linking one of its own libraries which depends on
- // openssl, it doesn't pass -rpath-link to be able to find the SSL
- // libraries and fails to build because of it.
- //
- // TODO: Switch to lld once we're using r21.
- env("LDFLAGS", "-fuse-ld=gold")
}
}
@@ -100,7 +93,24 @@ publishing {
repositories {
maven {
- url = uri("${rootProject.buildDir}/repository")
+ url = uri("${project.buildDir}/repository")
+ }
+ }
+}
+
+distributions {
+ main {
+ contents {
+ from("${project.buildDir}/repository")
+ include("**/*.aar")
+ include("**/*.pom")
}
}
}
+
+tasks {
+ distZip {
+ dependsOn("publish")
+ destinationDirectory.set(File(rootProject.buildDir, "distributions"))
+ }
+}
diff --git a/curl/src.tar.gz b/curl/src.tar.gz
index b6d3b85..ad8994c 100644
--- a/curl/src.tar.gz
+++ b/curl/src.tar.gz
Binary files differ
diff --git a/googletest/build.gradle.kts b/googletest/build.gradle.kts
index c365519..b86b9eb 100644
--- a/googletest/build.gradle.kts
+++ b/googletest/build.gradle.kts
@@ -10,6 +10,7 @@ version = "$portVersion${rootProject.extra.get("snapshotSuffix")}"
plugins {
id("maven-publish")
id("com.android.ndkports.NdkPorts")
+ distribution
}
ndkPorts {
@@ -118,7 +119,24 @@ publishing {
repositories {
maven {
- url = uri("${rootProject.buildDir}/repository")
+ url = uri("${project.buildDir}/repository")
}
}
}
+
+distributions {
+ main {
+ contents {
+ from("${project.buildDir}/repository")
+ include("**/*.aar")
+ include("**/*.pom")
+ }
+ }
+}
+
+tasks {
+ distZip {
+ dependsOn("publish")
+ destinationDirectory.set(File(rootProject.buildDir, "distributions"))
+ }
+}
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index da9702f..2ec77e5 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/jsoncpp/build.gradle.kts b/jsoncpp/build.gradle.kts
index 29ffc66..101bf38 100644
--- a/jsoncpp/build.gradle.kts
+++ b/jsoncpp/build.gradle.kts
@@ -10,6 +10,7 @@ version = "$portVersion${rootProject.extra.get("snapshotSuffix")}"
plugins {
id("maven-publish")
id("com.android.ndkports.NdkPorts")
+ distribution
}
ndkPorts {
@@ -97,7 +98,24 @@ publishing {
repositories {
maven {
- url = uri("${rootProject.buildDir}/repository")
+ url = uri("${project.buildDir}/repository")
}
}
}
+
+distributions {
+ main {
+ contents {
+ from("${project.buildDir}/repository")
+ include("**/*.aar")
+ include("**/*.pom")
+ }
+ }
+}
+
+tasks {
+ distZip {
+ dependsOn("publish")
+ destinationDirectory.set(File(rootProject.buildDir, "distributions"))
+ }
+}
diff --git a/openssl/build.gradle.kts b/openssl/build.gradle.kts
index b7c7a48..2052043 100644
--- a/openssl/build.gradle.kts
+++ b/openssl/build.gradle.kts
@@ -19,7 +19,7 @@ fun openSslVersionToCMakeVersion(openSslVersion: String): CMakeCompatibleVersion
)
}
-val portVersion = "1.1.1l"
+val portVersion = "1.1.1s"
val prefabVersion = openSslVersionToCMakeVersion(portVersion)
group = "com.android.ndk.thirdparty"
@@ -28,6 +28,7 @@ version = "$portVersion${rootProject.extra.get("snapshotSuffix")}"
plugins {
id("maven-publish")
id("com.android.ndkports.NdkPorts")
+ distribution
}
ndkPorts {
@@ -174,7 +175,24 @@ publishing {
repositories {
maven {
- url = uri("${rootProject.buildDir}/repository")
+ url = uri("${project.buildDir}/repository")
}
}
}
+
+distributions {
+ main {
+ contents {
+ from("${project.buildDir}/repository")
+ include("**/*.aar")
+ include("**/*.pom")
+ }
+ }
+}
+
+tasks {
+ distZip {
+ dependsOn("publish")
+ destinationDirectory.set(File(rootProject.buildDir, "distributions"))
+ }
+}
diff --git a/openssl/src.tar.gz b/openssl/src.tar.gz
index 81be7f9..9f41c50 100644
--- a/openssl/src.tar.gz
+++ b/openssl/src.tar.gz
Binary files differ
diff --git a/scripts/build_release.sh b/scripts/build_release.sh
index f99e223..a427551 100755
--- a/scripts/build_release.sh
+++ b/scripts/build_release.sh
@@ -1,8 +1,11 @@
#!/bin/bash
set -e
+if [ -z "${ANDROID_NDK_ROOT}" ] ; then
+ echo "ANDROID_NDK_ROOT is not set."
+ exit 1
+elif [ ! -d "${ANDROID_NDK_ROOT}" ] ; then
+ echo "ANDROID_NDK_ROOT=${ANDROID_NDK_ROOT} is not a directory."
+ exit 1
+fi
docker build -t ndkports .
-# We need to specify the full argument list for gradle explicitly because
-# there's no way to append to docker's CMD. This should be kept the same as the
-# default, but adding -Prelease.
-docker run --rm -v $(pwd):/src ndkports \
- --stacktrace -PndkPath=/ndk -Prelease release
+docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) -v $(pwd):/src -v "${ANDROID_NDK_ROOT}":/ndk ndkports
diff --git a/scripts/build_snapshot.sh b/scripts/build_snapshot.sh
index 4c9d767..74f787f 100755
--- a/scripts/build_snapshot.sh
+++ b/scripts/build_snapshot.sh
@@ -1,6 +1,12 @@
#!/bin/bash
set -e
+if [ -z "${ANDROID_NDK_ROOT}" ] ; then
+ echo "ANDROID_NDK_ROOT is not set."
+ exit 1
+elif [ ! -d "${ANDROID_NDK_ROOT}" ] ; then
+ echo "ANDROID_NDK_ROOT=${ANDROID_NDK_ROOT} is not a directory."
+ exit 1
+fi
docker build -t ndkports .
-# Default command for the docker image handles the NDK location, --stacktrace,
-# task list, etc.
-docker run --rm -v $(pwd):/src ndkports
+TARGETS="${@:-release}"
+docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) -v $(pwd):/src -v "${ANDROID_NDK_ROOT}":/ndk ndkports "${TARGETS}"