Skip to content

Commit

Permalink
build: fix library version and compile flags on Android
Browse files Browse the repository at this point in the history
Compiling a library with -fPIE won't do, and on Android libraries
are not versioned.

PR-URL: #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>
  • Loading branch information
gcampax authored and BethGriggs committed Feb 6, 2020
1 parent 6d674d4 commit fbf5bee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 4 additions & 4 deletions common.gypi
Expand Up @@ -161,8 +161,8 @@
'ldflags': [ '-Wl,-bbigtoc' ],
}],
['OS == "android"', {
'cflags': [ '-fPIE' ],
'ldflags': [ '-fPIE', '-pie' ]
'cflags': [ '-fPIC' ],
'ldflags': [ '-fPIC' ]
}],
],
'msvs_settings': {
Expand Down Expand Up @@ -221,8 +221,8 @@
],
},],
['OS == "android"', {
'cflags': [ '-fPIE' ],
'ldflags': [ '-fPIE', '-pie' ]
'cflags': [ '-fPIC' ],
'ldflags': [ '-fPIC' ]
}],
],
'msvs_settings': {
Expand Down
7 changes: 5 additions & 2 deletions configure.py
Expand Up @@ -1089,14 +1089,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

Expand Down

0 comments on commit fbf5bee

Please sign in to comment.