Skip to content

Commit

Permalink
android,build: zlib needs getCpuFeatures from NDK src
Browse files Browse the repository at this point in the history
  • Loading branch information
staltz committed Oct 12, 2023
1 parent 7d6236e commit 8b5b938
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions android_configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def patch_android():
GYP_DEFINES += " android_target_arch=" + arch
GYP_DEFINES += " host_os=" + host_os + " OS=android"
GYP_DEFINES += " ANDROID_NDK_ROOT=" + android_ndk_path
GYP_DEFINES += " ANDROID_NDK_SYSROOT=" + toolchain_path + "/sysroot"
os.environ['GYP_DEFINES'] = GYP_DEFINES

if os.path.exists("./configure"):
Expand Down
44 changes: 44 additions & 0 deletions tools/v8_gypfiles/v8.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -1952,6 +1952,46 @@
},
}, # postmortem-metadata

# nodejs-mobile patch: this whole target
{
'target_name': 'ndk_sources',
'type': 'none',
'conditions': [
['OS=="android"', {
'copies': [{
'files': [
'<(ANDROID_NDK_ROOT)/sources/android/cpufeatures/cpu-features.c',
],
'destination': '<(SHARED_INTERMEDIATE_DIR)/ndk-sources/',
}],
}]
]
},

# nodejs-mobile patch: this whole target
{
'target_name': 'ndk_cpufeatures',
'type': 'static_library',
'toolsets': ['target'],
'conditions': [
['OS=="android" and _toolset=="target"', {
'dependencies': ['ndk_sources'],
'include_dirs': [
'<(ANDROID_NDK_ROOT)/sources/android/cpufeatures',
'<(ANDROID_NDK_SYSROOT)/usr/include', # cpu-features.c needs sys/system_properties.h
],
'sources': [
'<(SHARED_INTERMEDIATE_DIR)/ndk-sources/cpu-features.c',
],
'direct_dependent_settings': {
'include_dirs': [
'<(ANDROID_NDK_ROOT)/sources/android/cpufeatures',
],
},
}],
],
},

{
'target_name': 'v8_zlib',
'type': 'static_library',
Expand All @@ -1966,6 +2006,10 @@
}]
]
}],
# nodejs-mobile patch:
['OS=="android" and _toolset=="target"', {
'dependencies': ['ndk_cpufeatures'],
}],
],
'direct_dependent_settings': {
'include_dirs': [
Expand Down

0 comments on commit 8b5b938

Please sign in to comment.