summaryrefslogtreecommitdiffstats
path: root/o3d/plugin
diff options
context:
space:
mode:
authortschmelcher@chromium.org <tschmelcher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-06 20:10:06 +0000
committertschmelcher@chromium.org <tschmelcher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-06 20:10:06 +0000
commit0aa936cb4abf259bf8f528d756d2c4aa65c130ef (patch)
tree2e24eebe738141d0a13fe1d181badccf5a062b1f /o3d/plugin
parenta2e7635d1041978c2bd9cac44efdc6c9b842e049 (diff)
downloadchromium_src-0aa936cb4abf259bf8f528d756d2c4aa65c130ef.zip
chromium_src-0aa936cb4abf259bf8f528d756d2c4aa65c130ef.tar.gz
chromium_src-0aa936cb4abf259bf8f528d756d2c4aa65c130ef.tar.bz2
Linux: bring back the RPATH setting that was deleted by the GYP transition. Also, make both it and the envvars path be configurable with GYP_DEFINES, and disable the envvars file by default for the Chrome built-in build (since we don't want an external file at /opt/google/o3d controlling Chrome's behaviour). Also specify --gc-sections for the shared library to reduce size.
TEST=built shared library and verified that RPATH is set and envvars parsing is compiled-in; verified library is usable; verified that variables can be overridden; verified that --gc-sections reduces size Review URL: http://codereview.chromium.org/517052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35644 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/plugin')
-rw-r--r--o3d/plugin/linux/main_linux.cc5
-rw-r--r--o3d/plugin/plugin.gyp42
2 files changed, 41 insertions, 6 deletions
diff --git a/o3d/plugin/linux/main_linux.cc b/o3d/plugin/linux/main_linux.cc
index 40f6c1b..8184a19 100644
--- a/o3d/plugin/linux/main_linux.cc
+++ b/o3d/plugin/linux/main_linux.cc
@@ -60,8 +60,9 @@ base::AtExitManager g_at_exit_manager;
bool g_xembed_support = false;
-// This is a #define set on the build command-line for greater flexibility.
+#ifdef O3D_PLUGIN_ENV_VARS_FILE
static const char *kEnvVarsFilePath = O3D_PLUGIN_ENV_VARS_FILE;
+#endif
static void DrawPlugin(PluginObject *obj) {
// Limit drawing to no more than once every timer tick.
@@ -628,6 +629,7 @@ NPError InitializePlugin() {
DLOG(INFO) << "NP_Initialize";
+#ifdef O3D_PLUGIN_ENV_VARS_FILE
// Before doing anything more, we first load our environment variables file.
// This file is a newline-delimited list of any system-specific environment
// variables that need to be set in the browser. Since we are a shared library
@@ -637,6 +639,7 @@ NPError InitializePlugin() {
// variables are already set when we initialize our shared library
// dependencies.
o3d::LoadEnvironmentVariablesFile(kEnvVarsFilePath);
+#endif
// Check for XEmbed support in the browser.
NPBool xembed_support = 0;
diff --git a/o3d/plugin/plugin.gyp b/o3d/plugin/plugin.gyp
index caff190..1104157 100644
--- a/o3d/plugin/plugin.gyp
+++ b/o3d/plugin/plugin.gyp
@@ -75,6 +75,12 @@
'targets': [
{
# This is the shared library version of the plugin.
+ 'variables': {
+ # Default values. Can be overridden with GYP_DEFINES for ease of
+ # repackaging.
+ 'plugin_rpath%' : '/opt/google/o3d/lib', # empty => none
+ 'plugin_env_vars_file%' : '/opt/google/o3d/envvars', # empty => none
+ },
'target_name': 'npo3dautoplugin',
'type': 'loadable_module',
'dependencies': [
@@ -206,14 +212,28 @@
'ldflags': [
'-z',
'nodelete',
+ '-Wl,--gc-sections',
],
'link_settings': {
'libraries': [
'-lGL',
],
},
- 'defines': [
- 'O3D_PLUGIN_ENV_VARS_FILE="/opt/google/o3d/envvars"',
+ 'conditions' : [
+ ['plugin_rpath != ""',
+ {
+ 'ldflags': [
+ '-Wl,-rpath', '-Wl,<(plugin_rpath)',
+ ],
+ },
+ ],
+ ['plugin_env_vars_file != ""',
+ {
+ 'defines': [
+ 'O3D_PLUGIN_ENV_VARS_FILE="<(plugin_env_vars_file)"',
+ ],
+ },
+ ],
],
},
],
@@ -268,6 +288,12 @@
# tree.
'targets': [
{
+ 'variables': {
+ # By default the built-in Chrome version does not read an env
+ # vars file, but this can be overridden by giving a different
+ # value for this.
+ 'plugin_env_vars_file%' : '',
+ },
'target_name': 'o3dPlugin',
'type': 'static_library',
'dependencies': [
@@ -363,9 +389,6 @@
'-lGL',
],
},
- 'defines': [
- 'O3D_PLUGIN_ENV_VARS_FILE="/opt/google/o3d/envvars"',
- ],
# On Linux, shared library targets aren't copied to the
# product dir automatically. Filed GYP issue #74 to address this.
# TODO(gspencer): Remove when issue #74 is resolved.
@@ -377,6 +400,15 @@
],
},
],
+ 'conditions' : [
+ ['plugin_env_vars_file != ""',
+ {
+ 'defines': [
+ 'O3D_PLUGIN_ENV_VARS_FILE="<(plugin_env_vars_file)"',
+ ],
+ },
+ ],
+ ],
},
],
['OS == "win"',