Skip to content

Commit 77c2273

Browse files
committed
build: fix library version and compile flags on Android
Compiling a library with -fPIE won't do, and on Android libraries are not versioned.
1 parent 71b342f commit 77c2273

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

common.gypi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@
156156
'ldflags': [ '-Wl,-bbigtoc' ],
157157
}],
158158
['OS == "android"', {
159-
'cflags': [ '-fPIE' ],
160-
'ldflags': [ '-fPIE', '-pie' ]
159+
'cflags': [ '-fPIC' ],
160+
'ldflags': [ '-fPIC' ]
161161
}],
162162
],
163163
'msvs_settings': {
@@ -216,8 +216,8 @@
216216
],
217217
},],
218218
['OS == "android"', {
219-
'cflags': [ '-fPIE' ],
220-
'ldflags': [ '-fPIE', '-pie' ]
219+
'cflags': [ '-fPIC' ],
220+
'ldflags': [ '-fPIC' ]
221221
}],
222222
],
223223
'msvs_settings': {

configure.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,14 +1103,17 @@ def configure_node(o):
11031103
o['variables']['node_shared'] = b(options.shared)
11041104
node_module_version = getmoduleversion.get_version()
11051105

1106-
if sys.platform == 'darwin':
1106+
if options.dest_os == 'android':
1107+
shlib_suffix = 'so'
1108+
elif sys.platform == 'darwin':
11071109
shlib_suffix = '%s.dylib'
11081110
elif sys.platform.startswith('aix'):
11091111
shlib_suffix = '%s.a'
11101112
else:
11111113
shlib_suffix = 'so.%s'
1114+
if '%s' in shlib_suffix:
1115+
shlib_suffix %= node_module_version
11121116

1113-
shlib_suffix %= node_module_version
11141117
o['variables']['node_module_version'] = int(node_module_version)
11151118
o['variables']['shlib_suffix'] = shlib_suffix
11161119

0 commit comments

Comments
 (0)