Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite68d4b0

Browse files
authored
gh-125940: Android: support 16 KB pages (#125941)
Modify Android build tooling to use 16kB pages.
1 parentfed501d commite68d4b0

File tree

6 files changed

+28
-20
lines changed

6 files changed

+28
-20
lines changed

‎Android/android-env.sh‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fail() {
2424
# * https://android.googlesource.com/platform/ndk/+/ndk-rXX-release/docs/BuildSystemMaintainers.md
2525
# where XX is the NDK version. Do a diff against the version you're upgrading from, e.g.:
2626
# https://android.googlesource.com/platform/ndk/+/ndk-r25-release..ndk-r26-release/docs/BuildSystemMaintainers.md
27-
ndk_version=26.2.11394342
27+
ndk_version=27.1.12297006
2828

2929
ndk=$ANDROID_HOME/ndk/$ndk_version
3030
if! [-e$ndk ];then
@@ -58,8 +58,8 @@ for path in "$AR" "$AS" "$CC" "$CXX" "$LD" "$NM" "$RANLIB" "$READELF" "$STRIP";
5858
fi
5959
done
6060

61-
export CFLAGS=""
62-
export LDFLAGS="-Wl,--build-id=sha1 -Wl,--no-rosegment"
61+
export CFLAGS="-D__BIONIC_NO_PAGE_SIZE_MACRO"
62+
export LDFLAGS="-Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,-z,max-page-size=16384"
6363

6464
# Unlike Linux, Android does not implicitly use a dlopened library to resolve
6565
# relocations in subsequently-loaded libraries, even if RTLD_GLOBAL is used
@@ -85,6 +85,10 @@ if [ -n "${PREFIX:-}" ]; then
8585
export PKG_CONFIG_LIBDIR="$abs_prefix/lib/pkgconfig"
8686
fi
8787

88+
# When compiling C++, some build systems will combine CFLAGS and CXXFLAGS, and some will
89+
# use CXXFLAGS alone.
90+
export CXXFLAGS=$CFLAGS
91+
8892
# Use the same variable name as conda-build
8993
if [$(uname)="Darwin" ];then
9094
export CPU_COUNT=$(sysctl -n hw.ncpu)

‎Android/android.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ def make_build_python(context):
138138

139139
defunpack_deps(host):
140140
deps_url="https://github.com/beeware/cpython-android-source-deps/releases/download"
141-
forname_verin ["bzip2-1.0.8-1","libffi-3.4.4-2","openssl-3.0.15-0",
142-
"sqlite-3.45.1-0","xz-5.4.6-0"]:
141+
forname_verin ["bzip2-1.0.8-2","libffi-3.4.4-3","openssl-3.0.15-4",
142+
"sqlite-3.45.3-3","xz-5.4.6-1"]:
143143
filename=f"{name_ver}-{host}.tar.gz"
144144
download(f"{deps_url}/{name_ver}/{filename}")
145145
run(["tar","-xf",filename])
@@ -189,12 +189,13 @@ def configure_host_python(context):
189189

190190
defmake_host_python(context):
191191
# The CFLAGS and LDFLAGS set in android-env include the prefix dir, so
192-
# delete anypreviously-installed Pythonlibs and include files to prevent
193-
#them being used duringthe build.
192+
# delete anyprevious Pythoninstallation to prevent it being used during
193+
# the build.
194194
host_dir=subdir(context.host)
195195
prefix_dir=host_dir/"prefix"
196196
delete_glob(f"{prefix_dir}/include/python*")
197197
delete_glob(f"{prefix_dir}/lib/libpython*")
198+
delete_glob(f"{prefix_dir}/lib/python*")
198199

199200
os.chdir(host_dir/"build")
200201
run(["make","-j",str(os.cpu_count())],host=context.host)

‎Android/testbed/app/build.gradle.kts‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,6 @@ val PYTHON_VERSION = file("$PYTHON_DIR/Include/patchlevel.h").useLines {
3030
throwGradleException("Failed to find Python version")
3131
}
3232

33-
android.ndkVersion= file("../../android-env.sh").useLines {
34-
for (linein it) {
35-
val match="""ndk_version=(\S+)""".toRegex().find(line)
36-
if (match!=null) {
37-
return@useLines match.groupValues[1]
38-
}
39-
}
40-
throwGradleException("Failed to find NDK version")
41-
}
42-
4333

4434
android {
4535
namespace="org.python.testbed"
@@ -55,11 +45,22 @@ android {
5545
ndk.abiFilters.addAll(ABIS.keys)
5646
externalNativeBuild.cmake.arguments(
5747
"-DPYTHON_CROSS_DIR=$PYTHON_CROSS_DIR",
58-
"-DPYTHON_VERSION=$PYTHON_VERSION")
48+
"-DPYTHON_VERSION=$PYTHON_VERSION",
49+
"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON",
50+
)
5951

6052
testInstrumentationRunner="androidx.test.runner.AndroidJUnitRunner"
6153
}
6254

55+
val androidEnvFile= file("../../android-env.sh").absoluteFile
56+
ndkVersion= androidEnvFile.useLines {
57+
for (linein it) {
58+
"""ndk_version=(\S+)""".toRegex().find(line)?.let {
59+
return@useLines it.groupValues[1]
60+
}
61+
}
62+
throwGradleException("Failed to find NDK version in$androidEnvFile")
63+
}
6364
externalNativeBuild.cmake {
6465
path("src/main/c/CMakeLists.txt")
6566
}

‎Android/testbed/build.gradle.kts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
plugins {
3-
id("com.android.application") version"8.4.2" applyfalse
3+
id("com.android.application") version"8.6.1" applyfalse
44
id("org.jetbrains.kotlin.android") version"1.9.22" applyfalse
55
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Mon Feb 19 20:29:06 GMT 2024
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The Android build now supports `16 KB page sizes
2+
<https://developer.android.com/guide/practices/page-sizes>`__.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp