build: adapt native build to minSdk 26

Stop forcing --hash-style=both: the Android dynamic linker supports GNU
hash tables since API 23, and the toolchain emits them by default at
this minimum API level. Keep --build-id=none for reproducible builds.

Include minSdk in the native cache hash so prebuilt libraries are not
reused after an API-level change.
This commit is contained in:
Bambooin 2026-10-28 15:43:53 +08:00
parent dd139de8f0
commit adc2808f26
2 changed files with 4 additions and 2 deletions

View File

@ -6,8 +6,8 @@ cmake_minimum_required(VERSION 3.18.0)
project(trime VERSION 3.0.0)
# for reproducible build
add_link_options("LINKER:--hash-style=both,--build-id=none")
# for reproducible build; GNU hash is enough above API 22
add_link_options("LINKER:--build-id=none")
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})

View File

@ -2,6 +2,7 @@
* SPDX-FileCopyrightText: 2015 - 2025 Rime community
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import com.android.build.api.dsl.ApplicationExtension
import org.gradle.api.DefaultTask
import org.gradle.api.Plugin
import org.gradle.api.Project
@ -33,6 +34,7 @@ class NativeCacheHashPlugin : Plugin<Project> {
appendLine(cmakeVersion)
appendLine(ndkVersion)
appendLine(buildAbiOverride)
appendLine(extensions.getByType(ApplicationExtension::class.java).defaultConfig.minSdk)
appendLine(runCmd("git submodule status"))
fileTree("src/main/jni/cmake").forEach { module ->
appendLine(sha256(module))