diff --git a/build.py b/build.py index 772b55274..edb253a3c 100755 --- a/build.py +++ b/build.py @@ -405,34 +405,33 @@ def setup_ndk(args): rm_rf(ndk_path) with zipfile.ZipFile(ndk_zip, 'r') as zf: for info in zf.infolist(): + print(f'Extracting {info.filename}') + if info.external_attr == 2716663808: # symlink + src = zf.read(info).decode("utf-8") + dest = op.join(ndk_root, info.filename) + os.symlink(src, dest) + continue extracted_path = zf.extract(info, ndk_root) - vprint(f'Extracting {info.filename}') if info.create_system == 3: # ZIP_UNIX_SYSTEM = 3 unix_attributes = info.external_attr >> 16 if unix_attributes: os.chmod(extracted_path, unix_attributes) mv(op.join(ndk_root, f'android-ndk-r{ndk_ver}'), ndk_path) - header('* Removing unnecessary files') - for dirname, subdirs, _ in os.walk(op.join(ndk_path, 'platforms')): - for plats in subdirs: - pp = op.join(dirname, plats) - rm_rf(pp) - mkdir(pp) - subdirs.clear() - rm_rf(op.join(ndk_path, 'sysroot')) - - header('* Replacing API-16 static libs') - for target in ['arm-linux-androideabi', 'i686-linux-android']: - arch = target.split('-')[0] - lib_dir = op.join( - ndk_path, 'toolchains', 'llvm', 'prebuilt', f'{os_name}-x86_64', - 'sysroot', 'usr', 'lib', f'{target}', '16') - src_dir = op.join('tools', 'ndk-bins', arch) - # Remove stupid macOS crap - rm(op.join(src_dir, '.DS_Store')) - for path in copy_tree(src_dir, lib_dir): - vprint(f'Replaced {path}') + header('* Patching static libs') + for api in ['16', '21']: + for target in ['aarch64-linux-android', 'arm-linux-androideabi', + 'i686-linux-android', 'x86_64-linux-android']: + arch = target.split('-')[0] + lib_dir = op.join( + ndk_path, 'toolchains', 'llvm', 'prebuilt', f'{os_name}-x86_64', + 'sysroot', 'usr', 'lib', f'{target}', api) + if not op.exists(lib_dir): + continue + src_dir = op.join('tools', 'ndk-bins', api, arch) + rm(op.join(src_dir, '.DS_Store')) + for path in copy_tree(src_dir, lib_dir): + vprint(f'Replaced {path}') def build_all(args): diff --git a/gradle.properties b/gradle.properties index dbe69c6a5..c3d9a0b53 100644 --- a/gradle.properties +++ b/gradle.properties @@ -29,5 +29,5 @@ kapt.incremental.apt=true # Magisk magisk.stubVersion=18 magisk.versionCode=22001 -magisk.ndkVersion=21d -magisk.fullNdkVersion=21.3.6528147 +magisk.ndkVersion=21e +magisk.fullNdkVersion=21.4.7075529 diff --git a/native/jni/external/Android.mk b/native/jni/external/Android.mk index 1072489ef..fa827ff2a 100644 --- a/native/jni/external/Android.mk +++ b/native/jni/external/Android.mk @@ -253,9 +253,10 @@ LOCAL_EXPORT_C_INCLUDES := $(LIBSELINUX) LOCAL_STATIC_LIBRARIES := libpcre2 LOCAL_CFLAGS := \ -Wno-implicit-function-declaration -Wno-int-conversion -Wno-unused-function \ - -D_GNU_SOURCE -DUSE_PCRE2 \ + -Wno-macro-redefined -D_GNU_SOURCE -DUSE_PCRE2 \ -DNO_PERSISTENTLY_STORED_PATTERNS -DDISABLE_SETRANS -DDISABLE_BOOL \ - -DNO_MEDIA_BACKEND -DNO_X_BACKEND -DNO_DB_BACKEND -DNO_ANDROID_BACKEND + -DNO_MEDIA_BACKEND -DNO_X_BACKEND -DNO_DB_BACKEND -DNO_ANDROID_BACKEND \ + -Dfgets_unlocked=fgets -D'__fsetlocking(...)=' LOCAL_SRC_FILES := \ selinux/libselinux/src/avc.c \ selinux/libselinux/src/avc_internal.c \ diff --git a/native/jni/external/busybox b/native/jni/external/busybox index 6e22deb30..76822933a 160000 --- a/native/jni/external/busybox +++ b/native/jni/external/busybox @@ -1 +1 @@ -Subproject commit 6e22deb3006f5ab49d50b1840540a64ae6eb4a34 +Subproject commit 76822933adc85c853daa6743d93433461f620849 diff --git a/tools/ndk-bins/arm/crtbegin_dynamic.o b/tools/ndk-bins/16/arm/crtbegin_dynamic.o similarity index 100% rename from tools/ndk-bins/arm/crtbegin_dynamic.o rename to tools/ndk-bins/16/arm/crtbegin_dynamic.o diff --git a/tools/ndk-bins/arm/crtbegin_so.o b/tools/ndk-bins/16/arm/crtbegin_so.o similarity index 100% rename from tools/ndk-bins/arm/crtbegin_so.o rename to tools/ndk-bins/16/arm/crtbegin_so.o diff --git a/tools/ndk-bins/arm/crtbegin_static.o b/tools/ndk-bins/16/arm/crtbegin_static.o similarity index 100% rename from tools/ndk-bins/arm/crtbegin_static.o rename to tools/ndk-bins/16/arm/crtbegin_static.o diff --git a/tools/ndk-bins/arm/crtend_android.o b/tools/ndk-bins/16/arm/crtend_android.o similarity index 100% rename from tools/ndk-bins/arm/crtend_android.o rename to tools/ndk-bins/16/arm/crtend_android.o diff --git a/tools/ndk-bins/arm/crtend_so.o b/tools/ndk-bins/16/arm/crtend_so.o similarity index 100% rename from tools/ndk-bins/arm/crtend_so.o rename to tools/ndk-bins/16/arm/crtend_so.o diff --git a/tools/ndk-bins/arm/libc.a b/tools/ndk-bins/16/arm/libc.a similarity index 100% rename from tools/ndk-bins/arm/libc.a rename to tools/ndk-bins/16/arm/libc.a diff --git a/tools/ndk-bins/arm/libm.a b/tools/ndk-bins/16/arm/libm.a similarity index 100% rename from tools/ndk-bins/arm/libm.a rename to tools/ndk-bins/16/arm/libm.a diff --git a/tools/ndk-bins/arm/libstdc++.a b/tools/ndk-bins/16/arm/libstdc++.a similarity index 100% rename from tools/ndk-bins/arm/libstdc++.a rename to tools/ndk-bins/16/arm/libstdc++.a diff --git a/tools/ndk-bins/i686/crtbegin_dynamic.o b/tools/ndk-bins/16/i686/crtbegin_dynamic.o similarity index 100% rename from tools/ndk-bins/i686/crtbegin_dynamic.o rename to tools/ndk-bins/16/i686/crtbegin_dynamic.o diff --git a/tools/ndk-bins/i686/crtbegin_so.o b/tools/ndk-bins/16/i686/crtbegin_so.o similarity index 100% rename from tools/ndk-bins/i686/crtbegin_so.o rename to tools/ndk-bins/16/i686/crtbegin_so.o diff --git a/tools/ndk-bins/i686/crtbegin_static.o b/tools/ndk-bins/16/i686/crtbegin_static.o similarity index 100% rename from tools/ndk-bins/i686/crtbegin_static.o rename to tools/ndk-bins/16/i686/crtbegin_static.o diff --git a/tools/ndk-bins/i686/crtend_android.o b/tools/ndk-bins/16/i686/crtend_android.o similarity index 100% rename from tools/ndk-bins/i686/crtend_android.o rename to tools/ndk-bins/16/i686/crtend_android.o diff --git a/tools/ndk-bins/i686/crtend_so.o b/tools/ndk-bins/16/i686/crtend_so.o similarity index 100% rename from tools/ndk-bins/i686/crtend_so.o rename to tools/ndk-bins/16/i686/crtend_so.o diff --git a/tools/ndk-bins/i686/libc.a b/tools/ndk-bins/16/i686/libc.a similarity index 100% rename from tools/ndk-bins/i686/libc.a rename to tools/ndk-bins/16/i686/libc.a diff --git a/tools/ndk-bins/i686/libm.a b/tools/ndk-bins/16/i686/libm.a similarity index 100% rename from tools/ndk-bins/i686/libm.a rename to tools/ndk-bins/16/i686/libm.a diff --git a/tools/ndk-bins/i686/libstdc++.a b/tools/ndk-bins/16/i686/libstdc++.a similarity index 100% rename from tools/ndk-bins/i686/libstdc++.a rename to tools/ndk-bins/16/i686/libstdc++.a diff --git a/tools/ndk-bins/i686/libz.a b/tools/ndk-bins/16/i686/libz.a similarity index 100% rename from tools/ndk-bins/i686/libz.a rename to tools/ndk-bins/16/i686/libz.a diff --git a/tools/ndk-bins/21/aarch64/crtbegin_dynamic.o b/tools/ndk-bins/21/aarch64/crtbegin_dynamic.o new file mode 100644 index 000000000..8e1aa7131 Binary files /dev/null and b/tools/ndk-bins/21/aarch64/crtbegin_dynamic.o differ diff --git a/tools/ndk-bins/21/aarch64/crtbegin_so.o b/tools/ndk-bins/21/aarch64/crtbegin_so.o new file mode 100644 index 000000000..75d561cf4 Binary files /dev/null and b/tools/ndk-bins/21/aarch64/crtbegin_so.o differ diff --git a/tools/ndk-bins/21/aarch64/crtbegin_static.o b/tools/ndk-bins/21/aarch64/crtbegin_static.o new file mode 100644 index 000000000..8e1aa7131 Binary files /dev/null and b/tools/ndk-bins/21/aarch64/crtbegin_static.o differ diff --git a/tools/ndk-bins/21/aarch64/crtend_android.o b/tools/ndk-bins/21/aarch64/crtend_android.o new file mode 100644 index 000000000..a5bf08470 Binary files /dev/null and b/tools/ndk-bins/21/aarch64/crtend_android.o differ diff --git a/tools/ndk-bins/21/aarch64/crtend_so.o b/tools/ndk-bins/21/aarch64/crtend_so.o new file mode 100644 index 000000000..8330c9d42 Binary files /dev/null and b/tools/ndk-bins/21/aarch64/crtend_so.o differ diff --git a/tools/ndk-bins/21/aarch64/libc.a b/tools/ndk-bins/21/aarch64/libc.a new file mode 100644 index 000000000..4e8c6efc4 Binary files /dev/null and b/tools/ndk-bins/21/aarch64/libc.a differ diff --git a/tools/ndk-bins/21/aarch64/libm.a b/tools/ndk-bins/21/aarch64/libm.a new file mode 100644 index 000000000..093ca2cee Binary files /dev/null and b/tools/ndk-bins/21/aarch64/libm.a differ diff --git a/tools/ndk-bins/21/aarch64/libstdc++.a b/tools/ndk-bins/21/aarch64/libstdc++.a new file mode 100644 index 000000000..99b485666 Binary files /dev/null and b/tools/ndk-bins/21/aarch64/libstdc++.a differ diff --git a/tools/ndk-bins/21/aarch64/libz.a b/tools/ndk-bins/21/aarch64/libz.a new file mode 100644 index 000000000..e96c72134 Binary files /dev/null and b/tools/ndk-bins/21/aarch64/libz.a differ diff --git a/tools/ndk-bins/21/arm/crtbegin_dynamic.o b/tools/ndk-bins/21/arm/crtbegin_dynamic.o new file mode 100644 index 000000000..41b89050c Binary files /dev/null and b/tools/ndk-bins/21/arm/crtbegin_dynamic.o differ diff --git a/tools/ndk-bins/21/arm/crtbegin_so.o b/tools/ndk-bins/21/arm/crtbegin_so.o new file mode 100644 index 000000000..87062da77 Binary files /dev/null and b/tools/ndk-bins/21/arm/crtbegin_so.o differ diff --git a/tools/ndk-bins/21/arm/crtbegin_static.o b/tools/ndk-bins/21/arm/crtbegin_static.o new file mode 100644 index 000000000..89d9a6744 Binary files /dev/null and b/tools/ndk-bins/21/arm/crtbegin_static.o differ diff --git a/tools/ndk-bins/21/arm/crtend_android.o b/tools/ndk-bins/21/arm/crtend_android.o new file mode 100644 index 000000000..d2d7b4ad5 Binary files /dev/null and b/tools/ndk-bins/21/arm/crtend_android.o differ diff --git a/tools/ndk-bins/21/arm/crtend_so.o b/tools/ndk-bins/21/arm/crtend_so.o new file mode 100644 index 000000000..e8a98e8ce Binary files /dev/null and b/tools/ndk-bins/21/arm/crtend_so.o differ diff --git a/tools/ndk-bins/21/arm/libc.a b/tools/ndk-bins/21/arm/libc.a new file mode 100644 index 000000000..fb3ee8cdf Binary files /dev/null and b/tools/ndk-bins/21/arm/libc.a differ diff --git a/tools/ndk-bins/21/arm/libm.a b/tools/ndk-bins/21/arm/libm.a new file mode 100644 index 000000000..9429fb527 Binary files /dev/null and b/tools/ndk-bins/21/arm/libm.a differ diff --git a/tools/ndk-bins/21/arm/libstdc++.a b/tools/ndk-bins/21/arm/libstdc++.a new file mode 100644 index 000000000..698f3d61e Binary files /dev/null and b/tools/ndk-bins/21/arm/libstdc++.a differ diff --git a/tools/ndk-bins/21/arm/libz.a b/tools/ndk-bins/21/arm/libz.a new file mode 100644 index 000000000..fd67a523f Binary files /dev/null and b/tools/ndk-bins/21/arm/libz.a differ diff --git a/tools/ndk-bins/21/i686/crtbegin_dynamic.o b/tools/ndk-bins/21/i686/crtbegin_dynamic.o new file mode 100644 index 000000000..de5826286 Binary files /dev/null and b/tools/ndk-bins/21/i686/crtbegin_dynamic.o differ diff --git a/tools/ndk-bins/21/i686/crtbegin_so.o b/tools/ndk-bins/21/i686/crtbegin_so.o new file mode 100644 index 000000000..1971da7fc Binary files /dev/null and b/tools/ndk-bins/21/i686/crtbegin_so.o differ diff --git a/tools/ndk-bins/21/i686/crtbegin_static.o b/tools/ndk-bins/21/i686/crtbegin_static.o new file mode 100644 index 000000000..7f1a8d265 Binary files /dev/null and b/tools/ndk-bins/21/i686/crtbegin_static.o differ diff --git a/tools/ndk-bins/21/i686/crtend_android.o b/tools/ndk-bins/21/i686/crtend_android.o new file mode 100644 index 000000000..9c62fe09e Binary files /dev/null and b/tools/ndk-bins/21/i686/crtend_android.o differ diff --git a/tools/ndk-bins/21/i686/crtend_so.o b/tools/ndk-bins/21/i686/crtend_so.o new file mode 100644 index 000000000..2c8850149 Binary files /dev/null and b/tools/ndk-bins/21/i686/crtend_so.o differ diff --git a/tools/ndk-bins/21/i686/libc.a b/tools/ndk-bins/21/i686/libc.a new file mode 100644 index 000000000..94a33f3e0 Binary files /dev/null and b/tools/ndk-bins/21/i686/libc.a differ diff --git a/tools/ndk-bins/21/i686/libm.a b/tools/ndk-bins/21/i686/libm.a new file mode 100644 index 000000000..a944a6a92 Binary files /dev/null and b/tools/ndk-bins/21/i686/libm.a differ diff --git a/tools/ndk-bins/21/i686/libstdc++.a b/tools/ndk-bins/21/i686/libstdc++.a new file mode 100644 index 000000000..4565d3f30 Binary files /dev/null and b/tools/ndk-bins/21/i686/libstdc++.a differ diff --git a/tools/ndk-bins/21/i686/libz.a b/tools/ndk-bins/21/i686/libz.a new file mode 100644 index 000000000..6ea48c692 Binary files /dev/null and b/tools/ndk-bins/21/i686/libz.a differ diff --git a/tools/ndk-bins/21/x86_64/crtbegin_dynamic.o b/tools/ndk-bins/21/x86_64/crtbegin_dynamic.o new file mode 100644 index 000000000..cbec8c96e Binary files /dev/null and b/tools/ndk-bins/21/x86_64/crtbegin_dynamic.o differ diff --git a/tools/ndk-bins/21/x86_64/crtbegin_so.o b/tools/ndk-bins/21/x86_64/crtbegin_so.o new file mode 100644 index 000000000..728703fb6 Binary files /dev/null and b/tools/ndk-bins/21/x86_64/crtbegin_so.o differ diff --git a/tools/ndk-bins/21/x86_64/crtbegin_static.o b/tools/ndk-bins/21/x86_64/crtbegin_static.o new file mode 100644 index 000000000..cbec8c96e Binary files /dev/null and b/tools/ndk-bins/21/x86_64/crtbegin_static.o differ diff --git a/tools/ndk-bins/21/x86_64/crtend_android.o b/tools/ndk-bins/21/x86_64/crtend_android.o new file mode 100644 index 000000000..1c39bb420 Binary files /dev/null and b/tools/ndk-bins/21/x86_64/crtend_android.o differ diff --git a/tools/ndk-bins/21/x86_64/crtend_so.o b/tools/ndk-bins/21/x86_64/crtend_so.o new file mode 100644 index 000000000..0de25a40b Binary files /dev/null and b/tools/ndk-bins/21/x86_64/crtend_so.o differ diff --git a/tools/ndk-bins/21/x86_64/libc.a b/tools/ndk-bins/21/x86_64/libc.a new file mode 100644 index 000000000..830077f4d Binary files /dev/null and b/tools/ndk-bins/21/x86_64/libc.a differ diff --git a/tools/ndk-bins/21/x86_64/libm.a b/tools/ndk-bins/21/x86_64/libm.a new file mode 100644 index 000000000..991cc053c Binary files /dev/null and b/tools/ndk-bins/21/x86_64/libm.a differ diff --git a/tools/ndk-bins/21/x86_64/libstdc++.a b/tools/ndk-bins/21/x86_64/libstdc++.a new file mode 100644 index 000000000..18a78a483 Binary files /dev/null and b/tools/ndk-bins/21/x86_64/libstdc++.a differ diff --git a/tools/ndk-bins/21/x86_64/libz.a b/tools/ndk-bins/21/x86_64/libz.a new file mode 100644 index 000000000..ca200a419 Binary files /dev/null and b/tools/ndk-bins/21/x86_64/libz.a differ diff --git a/tools/ndk-bins/README.md b/tools/ndk-bins/README.md index 6216a7dee..a7c30772b 100644 Binary files a/tools/ndk-bins/README.md and b/tools/ndk-bins/README.md differ diff --git a/tools/ndk-bins/arm/libm_hard.a b/tools/ndk-bins/arm/libm_hard.a deleted file mode 100644 index 1ab948ee5..000000000 Binary files a/tools/ndk-bins/arm/libm_hard.a and /dev/null differ