Skip to content

Commit 98471dc

Browse files
committed
release: build aarch64 libraries with 16kiB page size
[ci skip]
1 parent bc15070 commit 98471dc

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

build-scripts/build-release.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,9 @@ def __init__(self, name: str, ints: tuple[int, ...]):
542542
def __repr__(self) -> str:
543543
return f"<{self.name} ({'.'.join(str(v) for v in self.ints)})>"
544544

545+
ANDROID_ABI_EXTRA_LINK_OPTIONS = {
546+
"arm64-v8a": "-Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384",
547+
}
545548

546549
class Releaser:
547550
def __init__(self, release_info: dict, commit: str, revision: str, root: Path, dist_path: Path, section_printer: SectionPrinter, executer: Executer, cmake_generator: str, deps_path: Path, overwrite: bool, github: bool, fast: bool):
@@ -1013,6 +1016,7 @@ def create_android_archives(self, android_api: int, android_home: Path, android_
10131016
android_devel_file_tree = ArchiveFileTree()
10141017

10151018
for android_abi in android_abis:
1019+
extra_link_options = ANDROID_ABI_EXTRA_LINK_OPTIONS.get(android_abi, "")
10161020
with self.section_printer.group(f"Building for Android {android_api} {android_abi}"):
10171021
build_dir = self.root / "build-android" / f"{android_abi}-build"
10181022
install_dir = self.root / "install-android" / f"{android_abi}-install"
@@ -1023,8 +1027,11 @@ def create_android_archives(self, android_api: int, android_home: Path, android_
10231027
"cmake",
10241028
"-S", str(self.root),
10251029
"-B", str(build_dir),
1026-
f'''-DCMAKE_C_FLAGS="-ffile-prefix-map={self.root}=/src/{self.project}"''',
1027-
f'''-DCMAKE_CXX_FLAGS="-ffile-prefix-map={self.root}=/src/{self.project}"''',
1030+
# NDK 21e does not support -ffile-prefix-map
1031+
# f'''-DCMAKE_C_FLAGS="-ffile-prefix-map={self.root}=/src/{self.project}"''',
1032+
# f'''-DCMAKE_CXX_FLAGS="-ffile-prefix-map={self.root}=/src/{self.project}"''',
1033+
f"-DCMAKE_EXE_LINKER_FLAGS={extra_link_options}",
1034+
f"-DCMAKE_SHARED_LINKER_FLAGS={extra_link_options}",
10281035
f"-DCMAKE_TOOLCHAIN_FILE={cmake_toolchain_file}",
10291036
f"-DCMAKE_PREFIX_PATH={str(android_deps_path)}",
10301037
f"-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH",
@@ -1530,7 +1537,7 @@ def main(argv=None) -> int:
15301537
parser.error("Invalid --android-api, and/or could not be detected")
15311538
android_api_path = Path(args.android_home) / f"platforms/{args.android_api.name}"
15321539
if not android_api_path.is_dir():
1533-
parser.error(f"Android API directory does not exist ({android_api_path})")
1540+
logger.warning(f"Android API directory does not exist ({android_api_path})")
15341541
with section_printer.group("Android arguments"):
15351542
print(f"android_home = {args.android_home}")
15361543
print(f"android_ndk_home = {args.android_ndk_home}")

0 commit comments

Comments
 (0)