Skip to content

Commit

Permalink
Merge pull request #411 from staltz/fix-android
Browse files Browse the repository at this point in the history
Fix Android compilation
  • Loading branch information
ralphtheninja authored Nov 24, 2017
2 parents 3a7c399 + af67c3e commit 2462735
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 7 deletions.
12 changes: 12 additions & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@
]
, 'cflags!': [ '-fno-tree-vrp']
}]
, ['OS == "android"', {
'cflags': [ '-fPIC' ]
, 'ldflags': [ '-fPIC' ]
, 'cflags!': [
'-fno-tree-vrp'
, '-fno-exceptions'
, '-mfloat-abi=hard'
, '-fPIE'
]
, 'cflags_cc!': [ '-fno-exceptions' ]
, 'ldflags!': [ '-fPIE' ]
}]
, ['target_arch == "arm"', {
'cflags': [ '-mfloat-abi=hard'
]
Expand Down
30 changes: 27 additions & 3 deletions deps/leveldb/leveldb.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
'ldbversion': '1.20'
}
, 'type': 'static_library'
# Overcomes an issue with the linker and thin .a files on SmartOS
# Overcomes an issue with the linker and thin .a files on SmartOS
, 'standalone_static_library': 1
, 'dependencies': [
'../snappy/snappy.gyp:snappy'
Expand Down Expand Up @@ -142,10 +142,34 @@
]
}
}]
, ['OS == "android"', {
'defines': [
'OS_ANDROID=1'
, '_REENTRANT=1'
]
, 'libraries': [
'-lpthread'
]
, 'ccflags': [
'-pthread',
'-fno-builtin-memcmp',
'-fexceptions'
]
, 'cflags': [
'-fPIC'
]
, 'cflags!': [
'-fno-exceptions'
, '-fPIE'
, '-mfloat-abi=hard'
, '-Wno-unused-but-set-variable'
]
, 'cflags_cc!': [ '-fno-exceptions' ]
}]
, ['target_arch == "arm"', {
'cflags': [
'-mfloat-abi=hard'
]
'-mfloat-abi=hard'
]
}]
]
, 'sources': [
Expand Down
21 changes: 17 additions & 4 deletions deps/snappy/snappy.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
'variables': {
'conditions': [
['OS=="linux"', {'os_include': 'linux'}]
, ['OS=="android"', {'os_include': 'linux'}]
, ['OS=="mac"', {'os_include': 'mac'}]
, ['OS=="solaris"', {'os_include': 'solaris'}]
, ['OS=="win"', {'os_include': 'win32'}]
Expand All @@ -11,15 +12,15 @@
}
, 'target_name': 'snappy'
, 'type': 'static_library'
# Overcomes an issue with the linker and thin .a files on SmartOS
# Overcomes an issue with the linker and thin .a files on SmartOS
, 'standalone_static_library': 1
, 'include_dirs': [
'<(os_include)'
, 'snappy-1.1.4'
]
, 'direct_dependent_settings': {
'include_dirs': [
'<(os_include)'
'<(os_include)'
, 'snappy-1.1.4'
]
}
Expand Down Expand Up @@ -73,10 +74,22 @@
]
}
}]
, ['OS == "android"', {
'cflags': [
'-Wno-sign-compare'
, '-fPIC'
, '-Wno-unused-function'
]
, 'cflags!': [
'-fno-tree-vrp'
, '-mfloat-abi=hard'
, '-fPIE'
]
}]
, ['target_arch == "arm"', {
'cflags': [
'-mfloat-abi=hard'
]
'-mfloat-abi=hard'
]
}]
]
, 'sources': [
Expand Down

0 comments on commit 2462735

Please sign in to comment.