Commit 6770357e by Rémi Verschelde

Android: Better identify thirdparty C/C++ code

- The `cpu-features.{c,h}` code was only used by chance by the webm (libvpx) code, so I moved it there. It was actually introduced before that and wasn't in use, and libvpx just happened to be able to compile thanks to it being bundled. It could potentially be compiled on the fly from the Android NDK, but since we plan to replace the webm module by a GDNative plugin in the near future, I went the bundling route. - `ifaddrs_android.h` is already provided in the Android NDK as `ifaddrs.h`, same as on other Unixes. Yet we cannot use it until we up the min API level to 24, where `getifaddrs` is first defined. I moved the files to `thirdparty/misc` and synced them with upstream WebRTC (only indentation changes and removal of `static` qualifiers). Also removes dropped thirdparty files from COPYRIGHT.txt after changes in #24105 and #24145.
parent d8067e90
......@@ -55,31 +55,16 @@ Comment: Godot Engine logo
Copyright: 2017, Andrea Calabró
License: CC-BY-3.0
Files: ./platform/android/android_native_app_glue.c
./platform/android/android_native_app_glue.h
./platform/android/java/aidl/com/android/vending/billing/IInAppBillingService.aidl
Files: ./platform/android/java/aidl/com/android/vending/billing/IInAppBillingService.aidl
./platform/android/java/res/layout/status_bar_ongoing_event_progress_bar.xml
./platform/android/java/src/com/android/vending/licensing/*
./platform/android/java/src/com/google/android/vending/expansion/downloader/*
./platform/android/java/src/com/google/android/vending/licensing/*
./platform/android/java/src/org/godotengine/godot/input/InputManagerCompat.java
./platform/android/java/src/org/godotengine/godot/input/InputManagerV16.java
./platform/android/java/src/org/godotengine/godot/input/InputManagerV9.java
Comment: The Android Open Source Project
Copyright: 2008-2013, The Android Open Source Project
License: Apache-2.0
Files: ./platform/android/cpu-features.c
./platform/android/cpu-features.h
Comment: The Android Open Source Project
Copyright: 2010, The Android Open Source Project
License: BSD-2-clause
Files: ./platform/android/ifaddrs_android.cpp
./platform/android/ifaddrs_android.h
Comment: The Android Open Source Project
Copyright: 2012-2013, Google Inc.
License: BSD-3-clause
Files: ./platform/android/java/src/com/android/vending/licensing/util/Base64.java
./platform/android/java/src/com/android/vending/licensing/util/Base64DecoderException.java
Comment: The Android Open Source Project
......@@ -225,6 +210,12 @@ Comment: The WebM Project
Copyright: 2010, The WebM Project authors.
License: BSD-3-clause
Files: ./thirdparty/libvpx/third_party/android/cpu-features.c
./thirdparty/libvpx/third_party/android/cpu-features.h
Comment: The Android Open Source Project
Copyright: 2010, The Android Open Source Project
License: BSD-2-clause
Files: ./thirdparty/libwebp/
Comment: WebP codec
Copyright: 2010, Google Inc.
......@@ -295,6 +286,12 @@ Comment: hq2x implementation
Copyright: 2016, Bruno Ribeiro
License: Apache-2.0
Files: ./thirdparty/misc/ifaddrs-android.cc
./thirdparty/misc/ifaddrs-android.h
Comment: libjingle
Copyright: 2012-2013, Google Inc.
License: BSD-3-clause
Files: ./thirdparty/misc/md5.cpp
./thirdparty/misc/md5.h
Comment: MD5 Message Digest Algorithm
......
......@@ -55,10 +55,12 @@
#include <iphlpapi.h>
#endif // MINGW hack
#endif
#else
#else // UNIX
#include <netdb.h>
#ifdef ANDROID_ENABLED
#include "platform/android/ifaddrs_android.h"
// We could drop this file once we up our API level to 24,
// where the NDK's ifaddrs.h supports to needed getifaddrs.
#include "thirdparty/misc/ifaddrs-android.h"
#else
#ifdef __FreeBSD__
#include <sys/types.h>
......@@ -201,7 +203,7 @@ void IP_Unix::get_local_addresses(List<IP_Address> *r_addresses) const {
#endif
#else
#else // UNIX
void IP_Unix::get_local_addresses(List<IP_Address> *r_addresses) const {
......
......@@ -379,6 +379,9 @@ if webm_cpu_x86:
env_libvpx.add_source_files(env.modules_sources, libvpx_sources_x86_64asm)
elif webm_cpu_arm:
env_libvpx.add_source_files(env.modules_sources, libvpx_sources_arm)
if env["platform"] == 'android':
env_libvpx.Append(CPPPATH=[libvpx_dir + "third_party/android"])
env_libvpx.add_source_files(env.modules_sources, [libvpx_dir + "third_party/android/cpu-features.c"])
env_libvpx_neon = env_libvpx.Clone()
if env["platform"] == 'android' and env["android_arch"] == 'armv6':
......
......@@ -21,11 +21,6 @@ android_files = [
# 'power_android.cpp'
]
thirdparty_files = [
'ifaddrs_android.cpp',
'cpu-features.c',
]
env_android = env.Clone()
if env['target'] == "profile":
env_android.Append(CPPFLAGS=['-DPROFILER_ENABLED'])
......@@ -36,14 +31,10 @@ for x in android_files:
env_thirdparty = env_android.Clone()
env_thirdparty.disable_warnings()
for x in thirdparty_files:
android_objects.append(env_thirdparty.SharedObject(x))
prog = None
android_objects.append(env_thirdparty.SharedObject('#thirdparty/misc/ifaddrs-android.cc'))
abspath = env.Dir(".").abspath
with open_utf8(abspath + "/build.gradle.template", "r") as gradle_basein:
gradle_text = gradle_basein.read()
......
......@@ -229,6 +229,9 @@ TODO.
Important: File `libvpx/vpx_dsp/x86/vpx_subpixel_8t_intrin_avx2.c` has
Godot-made change marked with `// -- GODOT --` comments.
The files `libvpx/third_party/android/cpu-features.{c,h}` were copied
from the Android NDK r18.
## libwebp
......@@ -337,6 +340,10 @@ Collection of single-file libraries used in Godot components.
* Upstream: http://www.efgh.com/software/md5.htm
* Version: TBD, might not be latest from above URL
* License: RSA Message-Digest License
- `open-simplex-noise.{c,h}`
* Upstream: https://github.com/smcameron/open-simplex-noise-in-c
* Version: git (0d555e7, 2015)
* License: Unlicense
- `pcg.{cpp,h}`
* Upstream: http://www.pcg-random.org
* Version: minimal C implementation, http://www.pcg-random.org/download.html
......@@ -354,11 +361,6 @@ Collection of single-file libraries used in Godot components.
* Upstream: https://github.com/ivanfratric/polypartition (`src/polypartition.cpp`)
* Version: TBD, class was renamed
* License: MIT
- `open-simplex-noise.{c,h}`
* Upstream: https://github.com/smcameron/open-simplex-noise-in-c
* Version: git (0d555e7, 2015)
* License: Unlicense
### modules
......@@ -371,6 +373,13 @@ Collection of single-file libraries used in Godot components.
* Version: ?
* License: BSD
### platform
- `ifaddrs-android.{cc,h}`
* Upstream: https://chromium.googlesource.com/external/webrtc/stable/talk/+/master/base/ifaddrs-android.h
* Version: 5976650 (2013)
* License: BSD-3-Clause
### scene
- `easing_equations.cpp`
......
......@@ -33,6 +33,9 @@
__BEGIN_DECLS
/* A list of valid values returned by android_getCpuFamily().
* They describe the CPU Architecture of the current process.
*/
typedef enum {
ANDROID_CPU_FAMILY_UNKNOWN = 0,
ANDROID_CPU_FAMILY_ARM,
......@@ -46,11 +49,24 @@ typedef enum {
} AndroidCpuFamily;
/* Return family of the device's CPU */
extern AndroidCpuFamily android_getCpuFamily(void);
/* Return the CPU family of the current process.
*
* Note that this matches the bitness of the current process. I.e. when
* running a 32-bit binary on a 64-bit capable CPU, this will return the
* 32-bit CPU family value.
*/
extern AndroidCpuFamily android_getCpuFamily(void);
/* Return a bitmap describing a set of optional CPU features that are
* supported by the current device's CPU. The exact bit-flags returned
* depend on the value returned by android_getCpuFamily(). See the
* documentation for the ANDROID_CPU_*_FEATURE_* flags below for details.
*/
extern uint64_t android_getCpuFeatures(void);
/* The list of feature flags for ARM CPUs that can be recognized by the
* library. Value details are:
/* The list of feature flags for ANDROID_CPU_FAMILY_ARM that can be
* recognized by the library (see note below for 64-bit ARM). Value details
* are:
*
* VFPv2:
* CPU supports the VFPv2 instruction set. Many, but not all, ARMv6 CPUs
......@@ -106,6 +122,27 @@ extern AndroidCpuFamily android_getCpuFamily(void);
* ARM CPU. This is only available on a few XScale-based CPU designs
* sold by Marvell. Pretty rare in practice.
*
* AES:
* CPU supports AES instructions. These instructions are only
* available for 32-bit applications running on ARMv8 CPU.
*
* CRC32:
* CPU supports CRC32 instructions. These instructions are only
* available for 32-bit applications running on ARMv8 CPU.
*
* SHA2:
* CPU supports SHA2 instructions. These instructions are only
* available for 32-bit applications running on ARMv8 CPU.
*
* SHA1:
* CPU supports SHA1 instructions. These instructions are only
* available for 32-bit applications running on ARMv8 CPU.
*
* PMULL:
* CPU supports 64-bit PMULL and PMULL2 instructions. These
* instructions are only available for 32-bit applications
* running on ARMv8 CPU.
*
* If you want to tell the compiler to generate code that targets one of
* the feature set above, you should probably use one of the following
* flags (for more details, see technical note at the end of this file):
......@@ -153,6 +190,13 @@ extern AndroidCpuFamily android_getCpuFamily(void);
*
* -mcpu=iwmmxt
* Allows the use of iWMMXt instrinsics with GCC.
*
* IMPORTANT NOTE: These flags should only be tested when
* android_getCpuFamily() returns ANDROID_CPU_FAMILY_ARM, i.e. this is a
* 32-bit process.
*
* When running a 64-bit ARM process on an ARMv8 CPU,
* android_getCpuFeatures() will return a different set of bitflags
*/
enum {
ANDROID_CPU_ARM_FEATURE_ARMv7 = (1 << 0),
......@@ -167,19 +211,84 @@ enum {
ANDROID_CPU_ARM_FEATURE_IDIV_ARM = (1 << 9),
ANDROID_CPU_ARM_FEATURE_IDIV_THUMB2 = (1 << 10),
ANDROID_CPU_ARM_FEATURE_iWMMXt = (1 << 11),
ANDROID_CPU_ARM_FEATURE_AES = (1 << 12),
ANDROID_CPU_ARM_FEATURE_PMULL = (1 << 13),
ANDROID_CPU_ARM_FEATURE_SHA1 = (1 << 14),
ANDROID_CPU_ARM_FEATURE_SHA2 = (1 << 15),
ANDROID_CPU_ARM_FEATURE_CRC32 = (1 << 16),
};
/* The bit flags corresponding to the output of android_getCpuFeatures()
* when android_getCpuFamily() returns ANDROID_CPU_FAMILY_ARM64. Value details
* are:
*
* FP:
* CPU has Floating-point unit.
*
* ASIMD:
* CPU has Advanced SIMD unit.
*
* AES:
* CPU supports AES instructions.
*
* CRC32:
* CPU supports CRC32 instructions.
*
* SHA2:
* CPU supports SHA2 instructions.
*
* SHA1:
* CPU supports SHA1 instructions.
*
* PMULL:
* CPU supports 64-bit PMULL and PMULL2 instructions.
*/
enum {
ANDROID_CPU_ARM64_FEATURE_FP = (1 << 0),
ANDROID_CPU_ARM64_FEATURE_ASIMD = (1 << 1),
ANDROID_CPU_ARM64_FEATURE_AES = (1 << 2),
ANDROID_CPU_ARM64_FEATURE_PMULL = (1 << 3),
ANDROID_CPU_ARM64_FEATURE_SHA1 = (1 << 4),
ANDROID_CPU_ARM64_FEATURE_SHA2 = (1 << 5),
ANDROID_CPU_ARM64_FEATURE_CRC32 = (1 << 6),
};
/* The bit flags corresponding to the output of android_getCpuFeatures()
* when android_getCpuFamily() returns ANDROID_CPU_FAMILY_X86 or
* ANDROID_CPU_FAMILY_X86_64.
*/
enum {
ANDROID_CPU_X86_FEATURE_SSSE3 = (1 << 0),
ANDROID_CPU_X86_FEATURE_POPCNT = (1 << 1),
ANDROID_CPU_X86_FEATURE_MOVBE = (1 << 2),
ANDROID_CPU_X86_FEATURE_SSE4_1 = (1 << 3),
ANDROID_CPU_X86_FEATURE_SSE4_2 = (1 << 4),
ANDROID_CPU_X86_FEATURE_AES_NI = (1 << 5),
ANDROID_CPU_X86_FEATURE_AVX = (1 << 6),
ANDROID_CPU_X86_FEATURE_RDRAND = (1 << 7),
ANDROID_CPU_X86_FEATURE_AVX2 = (1 << 8),
ANDROID_CPU_X86_FEATURE_SHA_NI = (1 << 9),
};
/* The bit flags corresponding to the output of android_getCpuFeatures()
* when android_getCpuFamily() returns ANDROID_CPU_FAMILY_MIPS
* or ANDROID_CPU_FAMILY_MIPS64. Values are:
*
* R6:
* CPU executes MIPS Release 6 instructions natively, and
* supports obsoleted R1..R5 instructions only via kernel traps.
*
* MSA:
* CPU supports Mips SIMD Architecture instructions.
*/
enum {
ANDROID_CPU_MIPS_FEATURE_R6 = (1 << 0),
ANDROID_CPU_MIPS_FEATURE_MSA = (1 << 1),
};
extern uint64_t android_getCpuFeatures(void);
#define android_getCpuFeaturesExt android_getCpuFeatures
/* Return the number of CPU cores detected on this device. */
extern int android_getCpuCount(void);
extern int android_getCpuCount(void);
/* The following is used to force the CPU count and features
* mask in sandboxed processes. Under 4.1 and higher, these processes
......
......@@ -33,13 +33,13 @@
// about every network interface available on the host.
// See 'man getifaddrs' on Linux or OS X (nb: it is not a POSIX function).
struct ifaddrs {
struct ifaddrs* ifa_next;
char* ifa_name;
unsigned int ifa_flags;
struct sockaddr* ifa_addr;
struct sockaddr* ifa_netmask;
// Real ifaddrs has broadcast, point to point and data members.
// We don't need them (yet?).
struct ifaddrs* ifa_next;
char* ifa_name;
unsigned int ifa_flags;
struct sockaddr* ifa_addr;
struct sockaddr* ifa_netmask;
// Real ifaddrs has broadcast, point to point and data members.
// We don't need them (yet?).
};
int getifaddrs(struct ifaddrs** result);
void freeifaddrs(struct ifaddrs* addrs);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment