From 65e67cb6719e0a46faabfab63f21da92f5553948 Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Sun, 24 Sep 2017 16:11:48 -0700 Subject: [PATCH] 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 Reviewed-By: Christian Clauss Reviewed-By: Benjamin Gruenbaum Reviewed-By: Rich Trott --- common.gypi | 8 ++++---- configure.py | 7 +++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/common.gypi b/common.gypi index 7d08d61e57982d..bdb1f7b32bf08b 100644 --- a/common.gypi +++ b/common.gypi @@ -161,8 +161,8 @@ 'ldflags': [ '-Wl,-bbigtoc' ], }], ['OS == "android"', { - 'cflags': [ '-fPIE' ], - 'ldflags': [ '-fPIE', '-pie' ] + 'cflags': [ '-fPIC' ], + 'ldflags': [ '-fPIC' ] }], ], 'msvs_settings': { @@ -221,8 +221,8 @@ ], },], ['OS == "android"', { - 'cflags': [ '-fPIE' ], - 'ldflags': [ '-fPIE', '-pie' ] + 'cflags': [ '-fPIC' ], + 'ldflags': [ '-fPIC' ] }], ], 'msvs_settings': { diff --git a/configure.py b/configure.py index dde68e041f464f..cac22e4a43c9b7 100755 --- a/configure.py +++ b/configure.py @@ -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