build: fix library version and compile flags on Android

Compiling a library with -fPIE won't do, and on Android libraries
are not versioned.

PR-URL: https://github.com/nodejs/node/pull/29388
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
Giovanni Campagna 2017-09-24 16:11:48 -07:00 committed by Rich Trott
parent d8fc0ae50f
commit 99fe9dd112
2 changed files with 9 additions and 6 deletions

View File

@ -127,8 +127,8 @@
'ldflags': [ '-Wl,-bbigtoc' ],
}],
['OS == "android"', {
'cflags': [ '-fPIE' ],
'ldflags': [ '-fPIE', '-pie' ]
'cflags': [ '-fPIC' ],
'ldflags': [ '-fPIC' ]
}],
],
'msvs_settings': {
@ -187,8 +187,8 @@
],
},],
['OS == "android"', {
'cflags': [ '-fPIE' ],
'ldflags': [ '-fPIE', '-pie' ]
'cflags': [ '-fPIC' ],
'ldflags': [ '-fPIC' ]
}],
],
'msvs_settings': {

View File

@ -1122,14 +1122,17 @@ def configure_node(o):
o['variables']['node_shared'] = b(options.shared)
node_module_version = getmoduleversion.get_version()
if sys.platform == 'darwin':
if options.dest_os == 'android':
shlib_suffix = 'so'
elif sys.platform == 'darwin':
shlib_suffix = '%s.dylib'
elif sys.platform.startswith('aix'):
shlib_suffix = '%s.a'
else:
shlib_suffix = 'so.%s'
if '%s' in shlib_suffix:
shlib_suffix %= node_module_version
shlib_suffix %= node_module_version
o['variables']['node_module_version'] = int(node_module_version)
o['variables']['shlib_suffix'] = shlib_suffix