Repository: godotengine/godot
File: platform/android/detect.py (Python)

Code before:
            env.extra_suffix = ".armv7.neon" + env.extra_suffix
        else:
            env.extra_suffix = ".armv7" + env.extra_suffix
    elif env["android_arch"] == "arm64v8":
        if get_platform(env["ndk_platform"]) < 21:
            print(
                "WARNING: android_arch=arm64v8 is not supported by ndk_platform lower than android-21; setting"
                " ndk_platform=android-21"
            )
            env["ndk_platform"] = "android-21"
        env["ARCH"] = "arch-arm64"
        target_subpath = "aarch64-linux-android-4.9"
        abi_subpath = "aarch64-linux-android"
        arch_subpath = "arm64-v8a"
        env.extra_suffix = ".armv8" + env.extra_suffix

    # Build type

    if env["target"].startswith("release"):
        if env["optimize"] == "speed":  # optimize for speed (default)
            env.Append(LINKFLAGS=["-O2"])
            env.Append(CCFLAGS=["-O2", "-fomit-frame-pointer"])
            env.Append(CPPDEFINES=["NDEBUG"])
        else:  # optimize for size
            env.Append(CCFLAGS=["-Os"])
            env.Append(CPPDEFINES=["NDEBUG"])
            env.Append(LINKFLAGS=["-Os"])

        if can_vectorize:
            env.Append(CCFLAGS=["-ftree-vectorize"])
        if env["target"] == "release_debug":
            env.Append(CPPDEFINES=["DEBUG_ENABLED"])
    elif env["target"] == "debug":
        env.Append(LINKFLAGS=["-O0"])
        env.Append(CCFLAGS=["-O0", "-g", "-fno-limit-debug-info"])
        env.Append(CPPDEFINES=["_DEBUG", "DEBUG_ENABLED"])
        env.Append(CPPFLAGS=["-UNDEBUG"])

    # Compiler configuration

    env["SHLIBSUFFIX"] = ".so"

    if env["PLATFORM"] == "win32":
        env.Tool("gcc")
        env.use_windows_spawn_fix()

    if sys.platform.startswith("linux"):
        host_subpath = "linux-x86_64"
    elif sys.platform.startswith("darwin"):
        host_subpath = "darwin-x86_64"
    elif sys.platform.startswith("win"):

Review comment (bug):
The `NDEBUG` define should be moved out of the `optimize` blocks IMO.

Code after:
            env.extra_suffix = ".armv7.neon" + env.extra_suffix
        else:
            env.extra_suffix = ".armv7" + env.extra_suffix
    elif env["android_arch"] == "arm64v8":
        if get_platform(env["ndk_platform"]) < 21:
            print(
                "WARNING: android_arch=arm64v8 is not supported by ndk_platform lower than android-21; setting"
                " ndk_platform=android-21"
            )
            env["ndk_platform"] = "android-21"
        env["ARCH"] = "arch-arm64"
        target_subpath = "aarch64-linux-android-4.9"
        abi_subpath = "aarch64-linux-android"
        arch_subpath = "arm64-v8a"
        env.extra_suffix = ".armv8" + env.extra_suffix

    # Build type

    if env["target"].startswith("release"):
        if env["optimize"] == "speed":  # optimize for speed (default)
            env.Append(LINKFLAGS=["-O2"])
            env.Append(CCFLAGS=["-O2", "-fomit-frame-pointer"])
        elif env["optimize"] == "size":  # optimize for size
            env.Append(CCFLAGS=["-Os"])
            env.Append(LINKFLAGS=["-Os"])

        env.Append(CPPDEFINES=["NDEBUG"])
        if can_vectorize:
            env.Append(CCFLAGS=["-ftree-vectorize"])
        if env["target"] == "release_debug":
            env.Append(CPPDEFINES=["DEBUG_ENABLED"])
    elif env["target"] == "debug":
        env.Append(LINKFLAGS=["-O0"])
        env.Append(CCFLAGS=["-O0", "-g", "-fno-limit-debug-info"])
        env.Append(CPPDEFINES=["_DEBUG", "DEBUG_ENABLED"])
        env.Append(CPPFLAGS=["-UNDEBUG"])

    # Compiler configuration

    env["SHLIBSUFFIX"] = ".so"

    if env["PLATFORM"] == "win32":
        env.Tool("gcc")
        env.use_windows_spawn_fix()

    if sys.platform.startswith("linux"):
        host_subpath = "linux-x86_64"
    elif sys.platform.startswith("darwin"):
        host_subpath = "darwin-x86_64"
    elif sys.platform.startswith("win"):
        if platform.machine().endswith("64"):