winzik/tools/android/project/app/build.gradle
David Nurdin db72321bd9 Android natif : ffmpeg dans l'app, ouverture d'URL, presse-papiers, auto-mise à jour
- project.yaml android.ffmpeg : ffmpeg 8.0.1 (LGPL, LAME 3.100 pour le MP3) compilé avec le NDK par ABI
  (tools/android/build.sh build_ffmpeg, cache ~/.jumphp/android-native/ffmpeg), empaqueté en
  lib/<abi>/libffmpeg.so (useLegacyPackaging : déballé dans nativeLibraryDir), chemin donné à PHP par
  JUMPHP_FFMPEG (GameActivity)
- PHP Android : proc_open revient (le -include de jumphp-android.h passé à make et non plus à configure :
  il faisait échouer tous les tests de fonctions d'unistd.h, fork compris) ; --enable-posix ; arbre PHP
  par clé de build
- php-sdl : docker/ext/php-sdl-system.patch (SDL_OpenURL, SDL_Set/Get/HasClipboardText) ;
  SdlProvider sur Android : Shell::openUrl ouvre le navigateur, Clipboard::copy/paste le presse-papiers
- project.yaml android.self_update : JumPHP\Native\AndroidApp::install($apk) (ApkProvider content://,
  REQUEST_INSTALL_PACKAGES, page « sources inconnues » puis reprise), JUMPHP_ANDROID_VERSION_CODE/_NAME
- WinZik : android.ffmpeg et android.self_update ; docs/android-native.md

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-20 11:52:52 +01:00

74 lines
2.3 KiB
Groovy

// Filled in by tools/android/build.sh from the environment: JUMPHP_PACKAGE, JUMPHP_VERSION_CODE, JUMPHP_VERSION_NAME,
// JUMPHP_ABIS, JUMPHP_PHP (PHP built per ABI), JUMPHP_SRC (SDL and the libraries' sources), and the signing key
// (JUMPHP_KEYSTORE, JUMPHP_KEYSTORE_PASSWORD, JUMPHP_KEY_ALIAS, JUMPHP_KEY_PASSWORD).
plugins {
id 'com.android.application'
}
def env = { String name, String fallback = null -> System.getenv(name) ?: fallback }
android {
namespace 'net.jumphp.app'
compileSdk 36
ndkVersion env('JUMPHP_NDK', '29.0.14206865')
defaultConfig {
applicationId env('JUMPHP_PACKAGE', 'net.jumphp.game')
minSdk 26
targetSdk 36
versionCode Integer.parseInt(env('JUMPHP_VERSION_CODE', '1'))
versionName env('JUMPHP_VERSION_NAME', '1.0')
ndk {
abiFilters(*env('JUMPHP_ABIS', 'arm64-v8a x86_64').split(' '))
}
externalNativeBuild {
cmake {
arguments "-DJUMPHP_PHP=${env('JUMPHP_PHP', '/cache/php')}", "-DJUMPHP_SRC=${env('JUMPHP_SRC', '/cache/src')}",
'-DANDROID_STL=c++_static'
}
}
}
signingConfigs {
release {
if (env('JUMPHP_KEYSTORE')) {
storeFile file(env('JUMPHP_KEYSTORE'))
storePassword env('JUMPHP_KEYSTORE_PASSWORD')
keyAlias env('JUMPHP_KEY_ALIAS')
keyPassword env('JUMPHP_KEY_PASSWORD')
}
}
}
buildTypes {
release {
minifyEnabled false
signingConfig env('JUMPHP_KEYSTORE') ? signingConfigs.release : signingConfigs.debug
}
}
externalNativeBuild {
cmake {
path 'jni/CMakeLists.txt'
version '3.31.8'
}
}
// the game is large and already compressed where it matters (pictures, sounds): stored as is
androidResources {
noCompress 'tar'
}
// project.yaml android.ffmpeg (JUMPHP_FFMPEG=1): lib/<abi>/libffmpeg.so is a program, not a library: unpacked on
// the phone at the install (nativeLibraryDir, the only place Android runs programs from), not read from the APK
packaging {
jniLibs {
useLegacyPackaging env('JUMPHP_FFMPEG', '0') == '1'
}
}
lint {
abortOnError false
checkReleaseBuilds false
}
}