Skip to content

Commit 19023cd

Browse files
authored
Merge pull request #206 from OpenBrickProtocolFoundation/update-ndk
Update ndk to 28-RC1
2 parents 53b312e + 5542d29 commit 19023cd

File tree

10 files changed

+150
-36
lines changed

10 files changed

+150
-36
lines changed

.github/workflows/android.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646

4747
- name: Setup NDK
4848
run: |
49-
sdkmanager --install "ndk;28.0.12433566"
49+
sdkmanager --install "ndk;28.0.12674087"
5050
5151
- name: Build native libraries
5252
run: |

platforms/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ android {
248248
}
249249

250250
compileSdkVersion 35
251-
ndkVersion "28.0.12433566"
251+
ndkVersion "28.0.12674087"
252252
defaultConfig {
253253
if (buildAsApplication) {
254254
applicationId "com.github.oopetris"

platforms/android/app/jni/Android.mk

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@ LOCAL_SRC_FILES := $(shell find "${SUBPROJECTS_PATH}" -name libogg.so)
5050
include $(PREBUILT_SHARED_LIBRARY)
5151

5252

53-
include $(CLEAR_VARS)
54-
LOCAL_MODULE := flac
55-
LOCAL_SRC_FILES := $(shell find "${SUBPROJECTS_PATH}" -name libFLAC.so)
56-
include $(PREBUILT_SHARED_LIBRARY)
57-
58-
5953
include $(CLEAR_VARS)
6054
LOCAL_MODULE := sdl2_image
6155
LOCAL_SRC_FILES := $(shell find "${SUBPROJECTS_PATH}" -name libsdl2image.so)
@@ -105,7 +99,7 @@ include $(PREBUILT_SHARED_LIBRARY)
10599

106100
include $(CLEAR_VARS)
107101
LOCAL_MODULE := main
108-
LOCAL_SHARED_LIBRARIES := SDL2 sdl2_ttf freetype png16 sdl2_mixer vorbis vorbisfile ogg flac sdl2_image fmt keyutils oopetris_core oopetris_recordings oopetris_graphics oopetris
102+
LOCAL_SHARED_LIBRARIES := SDL2 sdl2_ttf freetype png16 sdl2_mixer vorbis vorbisfile ogg sdl2_image fmt keyutils oopetris_core oopetris_recordings oopetris_graphics oopetris
109103
LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -lOpenSLES -llog -landroid
110104
LOCAL_LDFLAGS := -Wl,--no-undefined
111105
include $(BUILD_SHARED_LIBRARY)

platforms/android/app/jni/Application.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ APP_PLATFORM := android-35
1111
# support 16KB page sizes:
1212
# see: https://developer.android.com/guide/practices/page-sizes
1313
APP_SUPPORT_FLEXIBLE_PAGE_SIZES := true
14+
15+
# support weak api defs:
16+
# see https://developer.android.com/ndk/guides/using-newer-apis
17+
APP_WEAK_API_DEFS := true

platforms/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
google()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:8.7.0'
9+
classpath 'com.android.tools.build:gradle:8.7.2'
1010

1111
// NOTE: Do not place your application dependencies here; they belong
1212
// in the individual module build.gradle files

platforms/build-3ds.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,12 @@ if [ "$COMPILE_TYPE" == "complete_rebuild" ] || [ ! -e "$BUILD_DIR" ]; then
255255
"--wipe" \
256256
--cross-file "$CROSS_FILE" \
257257
"-Dbuildtype=$BUILDTYPE" \
258-
-Ddefault_library=static
258+
-Ddefault_library=static \
259+
-Dcurl:tests=disabled \
260+
-Dcurl:unittests=disabled \
261+
-Dcurl:bearer-auth=enabled \
262+
-Dcurl:brotli=enabled \
263+
-Dcurl:libz=enabled
259264

260265
fi
261266

platforms/build-android.sh

Lines changed: 82 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ if [ ! -d "toolchains" ]; then
66
mkdir -p toolchains
77
fi
88

9-
export NDK_VER_DOWNLOAD="r28-beta1"
10-
export NDK_VER_DESC="r28-beta1"
9+
export NDK_VER_DOWNLOAD="r28-beta2"
10+
export NDK_VER_DESC="r28-beta2"
1111

1212
export BASE_PATH="$PWD/toolchains/android-ndk-$NDK_VER_DESC"
1313
export ANDROID_NDK_HOME="$BASE_PATH"
@@ -165,36 +165,36 @@ for INDEX in "${ARCH_KEYS_INDEX[@]}"; do
165165

166166
## BUILD dependencies not buildable with meson (to complicated to port)
167167

168-
## build mpg123 with autotools (meson port is to much work atm, for this feature)
168+
## build mpg123 with cmake (meson port is to much work atm, for this feature)
169169

170170
LAST_DIR="$PWD"
171171

172172
cd "$SYS_ROOT"
173173

174174
BUILD_DIR_MPG123="build-mpg123"
175175

176-
BUILD_MPG123_FILE="$SYS_ROOT/$BUILD_DIR_MPG123/build_succesfull.meta"
176+
BUILD_MPG123_FILE="$SYS_ROOT/$BUILD_DIR_MPG123/build_successfull.meta"
177177

178178
if [ "$COMPILE_TYPE" == "complete_rebuild" ] || ! [ -e "$BUILD_MPG123_FILE" ]; then
179179

180180
mkdir -p "$BUILD_DIR_MPG123"
181181

182182
cd "$BUILD_DIR_MPG123"
183183

184-
if [ ! -e "mpg123-1.32.6.tar.bz2" ]; then
185-
wget -q "https://www.mpg123.de/download/mpg123-1.32.6.tar.bz2"
184+
MPG123_VERSION="1.32.9"
185+
186+
if [ ! -e "mpg123-$MPG123_VERSION.tar.bz2" ]; then
187+
wget -q "https://www.mpg123.de/download/mpg123-$MPG123_VERSION.tar.bz2"
186188
fi
187189

188-
if [ ! -d "mpg123-1.32.6" ]; then
189-
tar -xf "mpg123-1.32.6.tar.bz2"
190+
if [ ! -d "mpg123-$MPG123_VERSION" ]; then
191+
tar -xf "mpg123-$MPG123_VERSION.tar.bz2"
190192
fi
191193

192-
cd "mpg123-1.32.6"
194+
cd "mpg123-$MPG123_VERSION"
193195

194196
cd ports/cmake/
195197

196-
BUILD_DIR_MPG123="build-mpg123"
197-
198198
mkdir -p "$BUILD_DIR_MPG123"
199199

200200
cd "$BUILD_DIR_MPG123"
@@ -223,6 +223,64 @@ for INDEX in "${ARCH_KEYS_INDEX[@]}"; do
223223

224224
cd "$LAST_DIR"
225225

226+
## build flac with cmake (meson port doesn't work for 32 bits machines atm) (we need to check for fseeko and ftello correctly in there)
227+
228+
LAST_DIR="$PWD"
229+
230+
cd "$SYS_ROOT"
231+
232+
BUILD_DIR_FLAC="build-flac"
233+
234+
BUILD_FLAC_FILE="$SYS_ROOT/$BUILD_DIR_FLAC/build_successfull.meta"
235+
236+
if [ "$COMPILE_TYPE" == "complete_rebuild" ] || ! [ -e "$BUILD_FLAC_FILE" ]; then
237+
238+
mkdir -p "$BUILD_DIR_FLAC"
239+
240+
cd "$BUILD_DIR_FLAC"
241+
242+
FLAC_VERSION="1.4.3"
243+
244+
if [ ! -e "flac-$FLAC_VERSION.tar.xz" ]; then
245+
wget -q "https://github.com/xiph/flac/releases/download/$FLAC_VERSION/flac-$FLAC_VERSION.tar.xz"
246+
fi
247+
248+
if [ ! -d "flac-$FLAC_VERSION" ]; then
249+
tar -xf "flac-$FLAC_VERSION.tar.xz"
250+
fi
251+
252+
cd "flac-$FLAC_VERSION"
253+
254+
mkdir -p "$BUILD_DIR_FLAC"
255+
256+
cd "$BUILD_DIR_FLAC"
257+
258+
cmake .. --install-prefix "$SYS_ROOT/usr" "-DCMAKE_SYSROOT=$SYS_ROOT" -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
259+
"-DCMAKE_SYSTEM_NAME=Android" \
260+
"-DCMAKE_SYSTEM_VERSION=$SDK_VERSION" \
261+
"-DCMAKE_ANDROID_ARCH_ABI=$KEY" \
262+
"-DCMAKE_ANDROID_NDK=$ANDROID_NDK" \
263+
"-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang" \
264+
-DBUILD_PROGRAMS=OFF \
265+
-DBUILD_EXAMPLES=OFF \
266+
-DBUILD_TESTING=OFF \
267+
-DBUILD_CXXLIBS=OFF \
268+
-DBUILD_DOCS=OFF \
269+
-DWITH_OGG=OFF \
270+
-DBUILD_SHARED_LIBS=OFF \
271+
-DINSTALL_PKGCONFIG_MODULES=ON
272+
273+
274+
cmake --build .
275+
276+
cmake --install .
277+
278+
touch "$BUILD_FLAC_FILE"
279+
280+
fi
281+
282+
cd "$LAST_DIR"
283+
226284
## build openssl with make (meson port is to much work atm, for this feature)
227285

228286
LAST_DIR="$PWD"
@@ -231,23 +289,25 @@ for INDEX in "${ARCH_KEYS_INDEX[@]}"; do
231289

232290
BUILD_DIR_OPENSSL="build-openssl"
233291

234-
BUILD_OPENSSL_FILE="$SYS_ROOT/$BUILD_DIR_OPENSSL/build_succesfull.meta"
292+
BUILD_OPENSSL_FILE="$SYS_ROOT/$BUILD_DIR_OPENSSL/build_successfull.meta"
235293

236294
if [ "$COMPILE_TYPE" == "complete_rebuild" ] || ! [ -e "$BUILD_OPENSSL_FILE" ]; then
237295

238296
mkdir -p "$BUILD_DIR_OPENSSL"
239297

240298
cd "$BUILD_DIR_OPENSSL"
241299

242-
if [ ! -e "openssl-3.3.0.tar.gz" ]; then
243-
wget -q "https://github.com/openssl/openssl/releases/download/openssl-3.3.0/openssl-3.3.0.tar.gz"
300+
OPENSSL_VERSION="3.4.0"
301+
302+
if [ ! -e "openssl-$OPENSSL_VERSION.tar.gz" ]; then
303+
wget -q "https://github.com/openssl/openssl/releases/download/openssl-$OPENSSL_VERSION/openssl-$OPENSSL_VERSION.tar.gz"
244304
fi
245305

246-
if [ ! -d "openssl-3.3.0" ]; then
247-
tar -xzf "openssl-3.3.0.tar.gz"
306+
if [ ! -d "openssl-$OPENSSL_VERSION" ]; then
307+
tar -xzf "openssl-$OPENSSL_VERSION.tar.gz"
248308
fi
249309

250-
cd "openssl-3.3.0"
310+
cd "openssl-$OPENSSL_VERSION"
251311

252312
OPENSSL_TARGET_ARCH="android-$ARCH"
253313

@@ -293,7 +353,7 @@ for INDEX in "${ARCH_KEYS_INDEX[@]}"; do
293353
MESON_CPU_FAMILY="aarch64"
294354
fi
295355

296-
export COMPILE_FLAGS="'--sysroot=${SYS_ROOT:?}','-fPIE','-fPIC','--target=$ARM_COMPILER_TRIPLE','-DAUDIO_PREFER_MP3'"
356+
export COMPILE_FLAGS="'--sysroot=${SYS_ROOT:?}','-fPIE','-fPIC','--target=$ARM_COMPILER_TRIPLE','-D__ANDROID_API__=$SDK_VERSION', '-DBITNESS=$BITNESS','-DAUDIO_PREFER_MP3'"
297357

298358
export LINK_FLAGS="'-fPIE','-L$SYS_ROOT/usr/lib'"
299359

@@ -318,7 +378,7 @@ as = '$AS'
318378
ranlib = '$RANLIB'
319379
strip = '$STRIP'
320380
objcopy = '$OBJCOPY'
321-
pkg-config = 'false'
381+
pkg-config = 'pkg-config'
322382
llvm-config = '$LLVM_CONFIG'
323383
324384
[built-in options]
@@ -333,7 +393,7 @@ prefix = '$SYS_ROOT'
333393
libdir = '$LIB_PATH'
334394
335395
[properties]
336-
pkg_config_libdir = '$LIB_PATH'
396+
pkg_config_libdir = '$SYS_ROOT/usr/lib/pkgconfig'
337397
sys_root = '${SYS_ROOT}'
338398
339399
EOF
@@ -363,7 +423,7 @@ meson.override_dependency(
363423
EOF
364424
fi
365425

366-
export LIBRARY_PATH="$LIBRARY_PATH:usr/lib/$ARM_NAME_TRIPLE/$SDK_VERSION:$LIB_PATH"
426+
export LIBRARY_PATH="$LIBRARY_PATH:$SYS_ROOT/usr/lib/$ARM_NAME_TRIPLE/$SDK_VERSION:$LIB_PATH"
367427

368428
if [ "$COMPILE_TYPE" == "complete_rebuild" ] || [ ! -e "$BUILD_DIR" ]; then
369429

@@ -372,7 +432,7 @@ EOF
372432
"--prefix=$SYS_ROOT" \
373433
"--wipe" \
374434
"--includedir=$INC_PATH" \
375-
"--libdir=usr/lib/$ARM_NAME_TRIPLE/$SDK_VERSION" \
435+
"--libdir=$SYS_ROOT/usr/lib/$ARM_NAME_TRIPLE/$SDK_VERSION" \
376436
--cross-file "./platforms/crossbuild-android-$ARM_TARGET_ARCH.ini" \
377437
"-Dbuildtype=$BUILDTYPE" \
378438
-Dsdl2:use_hidapi=enabled \

platforms/build-switch.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,12 @@ if [ "$COMPILE_TYPE" == "complete_rebuild" ] || [ ! -e "$BUILD_DIR" ]; then
152152
"--wipe" \
153153
--cross-file "$CROSS_FILE" \
154154
"-Dbuildtype=$BUILDTYPE" \
155-
-Ddefault_library=static
155+
-Ddefault_library=static \
156+
-Dcurl:tests=disabled \
157+
-Dcurl:unittests=disabled \
158+
-Dcurl:bearer-auth=enabled \
159+
-Dcurl:brotli=enabled \
160+
-Dcurl:libz=enabled
156161

157162
fi
158163

tools/dependencies/meson.build

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,15 @@ if meson.is_cross_build()
2929
# )
3030
# endif
3131
elif host_machine.system() == 'android'
32-
# noop
32+
33+
flac_dep = dependency(
34+
'flac',
35+
allow_fallback: false,
36+
required: true,
37+
)
38+
39+
meson.override_dependency('libflac', flac_dep)
40+
3341
elif host_machine.system() == 'emscripten'
3442

3543
# check if the command line flags are supported and a simple example compiles
@@ -384,7 +392,9 @@ if build_application
384392
curl_cpp_wrapper = dependency(
385393
'cpr',
386394
required: true,
387-
default_options: {'tests': 'disabled'},
395+
default_options: {
396+
'tests': 'disabled',
397+
},
388398
)
389399

390400
graphics_lib += {

tools/options/meson.build

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,42 @@ if meson.is_cross_build() and host_machine.system() == 'serenity'
3434
]
3535
core_lib += {'compile_args': temp}
3636
temp = 0
37+
elif meson.is_cross_build() and host_machine.system() == 'android'
38+
cpp = meson.get_compiler('cpp')
39+
target_android_api = '35'
40+
41+
android_api = cpp.get_define(
42+
'__ANDROID_API__',
43+
prefix: '#include <features.h>',
44+
).strip('"')
45+
assert(
46+
android_api != '',
47+
'failed to get android_api version',
48+
)
49+
50+
android_compile_args = []
51+
android_link_args = []
52+
53+
# APP_SUPPORT_FLEXIBLE_PAGE_SIZES
54+
android_link_args += '-Wl,-z,max-page-size=16384'
55+
56+
if android_api != target_android_api
57+
android_compile_args += ('-D__ANDROID_API__=' + target_android_api)
58+
endif
59+
60+
android_compile_args += [
61+
'-D__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__',
62+
'-Werror=unguarded-availability',
63+
]
64+
65+
if not meson.is_subproject()
66+
add_global_link_arguments(android_link_args, language: ['cpp'])
67+
add_global_arguments(android_compile_args, language: ['cpp'])
68+
else
69+
add_project_link_arguments(android_link_args, language: ['cpp'])
70+
add_project_arguments(android_compile_args, language: ['cpp'])
71+
72+
endif
3773
endif
3874

3975
cpp = meson.get_compiler('cpp')

0 commit comments

Comments
 (0)