aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@google.com>2014-07-22 12:09:30 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-07-22 12:09:30 -0700
commitc0bc9134514a4f138621203a6f7d4553ebec238a (patch)
treef1164825db06ec08e40715982ec3f8e2cc7627f0
parent4f9a01e03ef3bbe7dd8f9bebdcb3555226087e06 (diff)
Introduce skia_pic gyp variable.
skia_pic tells ninja to use -fPIC when building for position independent code. Set skia_pic to true when building our existing targets that require position independent code. Also use skia_pic when building for Android. R=mtklein@google.com, djsollen@google.com Author: scroggo@google.com Review URL: https://codereview.chromium.org/406613003
-rw-r--r--gyp/common_conditions.gypi38
-rw-r--r--gyp/common_variables.gypi6
2 files changed, 24 insertions, 20 deletions
diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi
index 254da0a57a..abb47502b6 100644
--- a/gyp/common_conditions.gypi
+++ b/gyp/common_conditions.gypi
@@ -8,6 +8,24 @@
'SK_FORCE_DISTANCEFIELD_FONTS=<(skia_force_distancefield_fonts)',
],
'conditions' : [
+ ['skia_pic', {
+ 'cflags': [
+ '-fPIC',
+ ],
+ 'conditions' : [
+ # FIXME: The reason we don't do this on Android is due to the way
+ # we build the executables/skia_launcher on Android. See
+ # https://codereview.chromium.org/406613003/diff/1/gyp/common_conditions.gypi#newcode455
+ ['skia_os != "android"', {
+ 'target_conditions': [
+ [ '_type == "executable"', {
+ 'cflags': [ '-fPIE' ],
+ 'ldflags': [ '-pie' ],
+ }],
+ ],
+ }],
+ ],
+ }],
[ 'skia_arch_type == "arm64"', {
'cflags': [
'-ffp-contract=off',
@@ -394,9 +412,6 @@
},
'conditions' : [
[ 'skia_shared_lib', {
- 'cflags': [
- '-fPIC',
- ],
'defines': [
'SKIA_DLL',
'SKIA_IMPLEMENTATION=1',
@@ -440,23 +455,9 @@
'conditions' : [
[ 'skia_sanitizer == "thread"', {
'defines': [ 'SK_DYNAMIC_ANNOTATIONS_ENABLED=1' ],
- 'cflags': [ '-fPIC' ],
- 'target_conditions': [
- [ '_type == "executable"', {
- 'cflags': [ '-fPIE' ],
- 'ldflags': [ '-pie' ],
- }],
- ],
}],
[ 'skia_sanitizer == "undefined"', {
- 'cflags': [ '-fPIC' ],
'cflags_cc!': ['-fno-rtti'],
- 'target_conditions': [
- [ '_type == "executable"', {
- 'cflags': [ '-fPIE' ],
- 'ldflags': [ '-pie' ],
- }],
- ],
}],
],
}],
@@ -660,9 +661,6 @@
],
}],
[ 'skia_shared_lib', {
- 'cflags': [
- '-fPIC',
- ],
'defines': [
'SKIA_DLL',
'SKIA_IMPLEMENTATION=1',
diff --git a/gyp/common_variables.gypi b/gyp/common_variables.gypi
index e084cd9d88..b7c82e3b02 100644
--- a/gyp/common_variables.gypi
+++ b/gyp/common_variables.gypi
@@ -181,6 +181,12 @@
'skia_clang_build%': 0,
'skia_keep_frame_pointer%': 0,
}],
+ [ 'skia_shared_lib or skia_sanitizer or skia_os == "android"', {
+ 'skia_pic%' : 1,
+ }, {
+ 'skia_pic%' : 0,
+ }
+ ],
],
# Re-define all variables defined within the level-2 'variables' dict,