improve: Zygiskd build.gradle.kts

This commit improves Zygisk's build gradle file by avoiding the repetition of compiler flags.
This commit is contained in:
ThePedroo
2024-10-05 15:33:06 -03:00
parent 0352d9378b
commit 980bf2ab4c
2 changed files with 5 additions and 8 deletions

View File

@@ -27,6 +27,9 @@ val verName: String by rootProject.extra
val commitHash: String by rootProject.extra val commitHash: String by rootProject.extra
val CStandardFlags = arrayOf( val CStandardFlags = arrayOf(
"-D_GNU_SOURCE", "-std=c99", "-Wpedantic", "-Wall", "-Wextra", "-Werror",
"-Wformat", "-Wuninitialized", "-Wshadow", "-Wno-zero-length-array",
"-Wno-fixed-enum-extension", "-Iroot_impl", "-llog",
"-DMIN_APATCH_VERSION=$minAPatchVersion", "-DMIN_APATCH_VERSION=$minAPatchVersion",
"-DMIN_KSU_VERSION=$minKsuVersion", "-DMIN_KSU_VERSION=$minKsuVersion",
"-DMAX_KSU_VERSION=$maxKsuVersion", "-DMAX_KSU_VERSION=$maxKsuVersion",
@@ -35,16 +38,10 @@ val CStandardFlags = arrayOf(
) )
val CFlagsRelease = arrayOf( val CFlagsRelease = arrayOf(
"-D_GNU_SOURCE", "-std=c99", "-Wpedantic", "-Wall", "-Wextra", "-Werror",
"-Wformat", "-Wuninitialized", "-Wshadow", "-Wno-zero-length-array",
"-Wno-fixed-enum-extension", "-Iroot_impl", "-llog",
"-Wl,--strip-all", "-flto=thin", "-Ofast" "-Wl,--strip-all", "-flto=thin", "-Ofast"
) )
val CFlagsDebug = arrayOf( val CFlagsDebug = arrayOf(
"-D_GNU_SOURCE", "-std=c99", "-Wpedantic", "-Wall", "-Wextra", "-Werror",
"-Wformat", "-Wuninitialized", "-Wshadow", "-Wno-zero-length-array",
"-Wno-fixed-enum-extension", "-Iroot_impl", "-llog",
"-g", "-O0" "-g", "-O0"
) )

View File

@@ -13,7 +13,7 @@
so we need to cast it to signed int to so we need to cast it to signed int to
avoid any potential UB. avoid any potential UB.
*/ */
#define KERNEL_SU_OPTION (signed int)0xdeadbeef #define KERNEL_SU_OPTION 0xdeadbeef
#define CMD_GET_VERSION 2 #define CMD_GET_VERSION 2
#define CMD_UID_GRANTED_ROOT 12 #define CMD_UID_GRANTED_ROOT 12
@@ -21,7 +21,7 @@
enum RootImplState ksu_get_existence(void) { enum RootImplState ksu_get_existence(void) {
int version = 0; int version = 0;
prctl(KERNEL_SU_OPTION, CMD_GET_VERSION, &version, 0, 0); prctl((signed int)KERNEL_SU_OPTION, CMD_GET_VERSION, &version, 0, 0);
if (version == 0) return Inexistent; if (version == 0) return Inexistent;
if (version >= MIN_KSU_VERSION && version <= MAX_KSU_VERSION) return Supported; if (version >= MIN_KSU_VERSION && version <= MAX_KSU_VERSION) return Supported;