Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
build,android: Added option to compile for Android with -fPIE flag
  • Loading branch information
Benjamin SEGAULT committed Mar 18, 2016
commit 12e32f6c76daf5b02f51bf42e87e82780d3908ec
4 changes: 3 additions & 1 deletion android-configure
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ export LINK=$TOOLCHAIN/bin/arm-linux-androideabi-g++

./configure \
--dest-cpu=arm \
--dest-os=android
--dest-os=android \
--cflag-pie=true \
--without-snapshot
8 changes: 8 additions & 0 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@
'cflags': [ '-gxcoff' ],
'ldflags': [ '-Wl,-bbigtoc' ],
}],
['cflag_pie=="true"', {
'cflags': [ '-fPIE' ],
'ldflags': [ '-fPIE', '-pie' ],
}],
],
'msvs_settings': {
'VCCLCompilerTool': {
Expand Down Expand Up @@ -101,6 +105,10 @@
['OS!="mac" and OS!="win"', {
'cflags': [ '-fno-omit-frame-pointer' ],
}],
['cflag_pie=="true"', {
'cflags': [ '-fPIE' ],
'ldflags': [ '-fPIE', '-pie' ],
}],
],
'msvs_settings': {
'VCCLCompilerTool': {
Expand Down
10 changes: 10 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,13 @@ parser.add_option('--enable-static',
dest='enable_static',
help='build as static library')

parser.add_option('--cflag-pie',
action='store',
choices=('true', 'false'),
default='false',
dest='cflag_pie',
help='add cflags -fPIE')

(options, args) = parser.parse_args()

# Expand ~ in the install prefix now, it gets written to multiple files.
Expand Down Expand Up @@ -666,6 +673,9 @@ def configure_mips(o):
def configure_node(o):
if options.dest_os == 'android':
o['variables']['OS'] = 'android'

o['variables']['cflag_pie'] = options.cflag_pie

o['variables']['node_prefix'] = options.prefix
o['variables']['node_install_npm'] = b(not options.without_npm)
o['default_configuration'] = 'Debug' if options.debug else 'Release'
Expand Down