From c4514c3c5719c148aacfafb85edabc6cd51ee501 Mon Sep 17 00:00:00 2001
From: "piman@chromium.org"
 <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Fri, 15 Jan 2010 20:19:06 +0000
Subject: [PATCH] linux: enable pepper_test_plugin

This includes a way to build it with full support on x64 (and arm ?), by specifying linux_fpic=1 in GYP_DEFINES and re-running gyp.

Review URL: http://codereview.chromium.org/551041

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36399 0039d316-1c4b-4281-b951-d872f2087c98
---
 build/all.gyp                                  |  5 +----
 build/common.gypi                              |  7 +++++++
 gpu/pgl/pgl.cc                                 |  2 +-
 .../pepper_test_plugin/pepper_test_plugin.gyp  | 18 +++++++++++++-----
 .../tools/pepper_test_plugin/plugin_object.cc  |  2 +-
 5 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/build/all.gyp b/build/all.gyp
index fc19cd2755de3..26220c14d4e4a 100644
--- a/build/all.gyp
+++ b/build/all.gyp
@@ -35,6 +35,7 @@
         '../third_party/sqlite/sqlite.gyp:*',
         '../third_party/WebKit/WebKit/chromium/WebKit.gyp:*',
         '../third_party/zlib/zlib.gyp:*',
+        '../webkit/tools/pepper_test_plugin/pepper_test_plugin.gyp:*',
         '../webkit/tools/test_shell/test_shell.gyp:*',
         '../webkit/webkit.gyp:*',
         'util/build_util.gyp:*',
@@ -59,7 +60,6 @@
         ['OS=="mac"', {
           'dependencies': [
             '../third_party/ocmock/ocmock.gyp:*',
-            '../webkit/tools/pepper_test_plugin/pepper_test_plugin.gyp:*',
           ],
         }],
         ['OS=="linux"', {
@@ -105,9 +105,6 @@
             '../third_party/cld/cld.gyp:*',
             '../third_party/gles2_book/gles2_book.gyp:*',
             '../tools/memory_watcher/memory_watcher.gyp:*',
-            # As of now, build machines do not have GL headers to compile this
-            # TODO(sehr,brettw, neb): Make this unconditional.
-            '../webkit/tools/pepper_test_plugin/pepper_test_plugin.gyp:*',
           ],
         }, {
           'dependencies': [
diff --git a/build/common.gypi b/build/common.gypi
index 8b79110d5d271..164095d47362c 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -193,6 +193,8 @@
     # Enable TCMalloc.
     'linux_use_tcmalloc%': 0,
 
+    'linux_fpic%': 0,
+
     # Set to select the Title Case versions of strings in GRD files.
     'use_titlecase_in_grd_files%': 0,
 
@@ -816,6 +818,11 @@
               }],
             ],
           }],
+          ['linux_fpic==1', {
+            'cflags': [
+              '-fPIC',
+            ],
+          }],
           ['sysroot!=""', {
             'target_conditions': [
               ['_toolset=="target"', {
diff --git a/gpu/pgl/pgl.cc b/gpu/pgl/pgl.cc
index 320dfffbb54c4..c403265d12f8e 100644
--- a/gpu/pgl/pgl.cc
+++ b/gpu/pgl/pgl.cc
@@ -154,7 +154,7 @@ PGLBoolean pglDestroyContext(PGLContext pgl_context) {
   if (!pgl_context)
     return false;
 
-  delete pgl_context;
+  delete static_cast<PGLContextImpl*>(pgl_context);
   return true;
 }
 
diff --git a/webkit/tools/pepper_test_plugin/pepper_test_plugin.gyp b/webkit/tools/pepper_test_plugin/pepper_test_plugin.gyp
index 1cdc8d3ef1bbb..35ba1b0cdfbd9 100644
--- a/webkit/tools/pepper_test_plugin/pepper_test_plugin.gyp
+++ b/webkit/tools/pepper_test_plugin/pepper_test_plugin.gyp
@@ -30,10 +30,6 @@
           'product_name': 'pepper_test_plugin',
           'type': 'shared_library',
           'msvs_guid': 'EE00E36E-9E8C-4DFB-925E-FBE32CEDB91A',
-          'dependencies': [
-            '../../../gpu/gpu.gyp:gles2_demo_lib',
-            '../../../gpu/gpu.gyp:pgl',
-          ],
           'sources': [
             'pepper_test_plugin.def',
             'pepper_test_plugin.rc',
@@ -49,7 +45,11 @@
             ],
           },
         }],
-        ['OS=="linux" and (target_arch=="x64" or target_arch=="arm")', {
+        ['OS=="linux"', {
+          'type': 'shared_library',
+          'cflags': ['-fvisibility=hidden'],
+        }],
+        ['OS=="linux" and (target_arch=="x64" or target_arch=="arm") and linux_fpic!=1', {
           'product_name': 'pepper_test_plugin',
           # Shared libraries need -fPIC on x86-64
           'cflags': ['-fPIC'],
@@ -59,6 +59,14 @@
             '../../../base/base.gyp:base',
             '../../../skia/skia.gyp:skia',
           ],
+          'conditions': [
+            ['OS!="mac"', {
+              'dependencies': [
+                '../../../gpu/gpu.gyp:gles2_demo_lib',
+                '../../../gpu/gpu.gyp:pgl',
+              ],
+            }],
+          ]
         }],
         ['OS=="mac"', {
           'type': 'loadable_module',
diff --git a/webkit/tools/pepper_test_plugin/plugin_object.cc b/webkit/tools/pepper_test_plugin/plugin_object.cc
index aa6422d6f0727..7738a8ccd5045 100644
--- a/webkit/tools/pepper_test_plugin/plugin_object.cc
+++ b/webkit/tools/pepper_test_plugin/plugin_object.cc
@@ -35,7 +35,7 @@
 #else
 #include "base/logging.h"
 #include "gpu/command_buffer/client/gles2_demo_cc.h"
-#include "gpu/command_buffer/common/gles2/gl2.h"
+#include "gpu/command_buffer/common/GLES2/gl2.h"
 #include "third_party/skia/include/core/SkBitmap.h"
 #include "third_party/skia/include/core/SkCanvas.h"
 #include "third_party/skia/include/effects/SkGradientShader.h"
-- 
GitLab