Bug 144845 - [CMake] Some macros need to be defined/undefined, rather than ON/OFF
Summary: [CMake] Some macros need to be defined/undefined, rather than ON/OFF
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified OS X 10.10
: P2 Major
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 126492
  Show dependency treegraph
 
Reported: 2015-05-10 12:12 PDT by Philip Chimento
Modified: 2015-05-10 20:04 PDT (History)
3 users (show)

See Also:


Attachments
Patch (1.48 KB, patch)
2015-05-10 12:23 PDT, Philip Chimento
no flags Details | Formatted Diff | Diff
Patch (1.68 KB, patch)
2015-05-10 15:02 PDT, Philip Chimento
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philip Chimento 2015-05-10 12:12:16 PDT
I ran into these three errors while compiling the 2.9.1 GTK port with no X11, with MiniBrowser turned on but developer mode off:

In file included from /Users/fliep/gtk/source/webkitgtk-2.9.1/Source/WebCore/bindings/js/ScriptController.cpp:39:
In file included from /Users/fliep/gtk/source/webkitgtk-2.9.1/Source/WebCore/bridge/NP_jsobject.h:31:
In file included from /Users/fliep/gtk/source/webkitgtk-2.9.1/Source/WebCore/bridge/npruntime_internal.h:28:
/Users/fliep/gtk/source/webkitgtk-2.9.1/Source/WebCore/plugins/npapi.h:89:10: fatal error: 
      'X11/Xlib.h' file not found
#include <X11/Xlib.h>
         ^
-------------
/Users/fliep/gtk/source/webkitgtk-2.9.1/Source/WebKit2/PluginProcess/unix/PluginProcessMainUnix.cpp:60:25: error: 
      unknown type name 'Display'; did you mean 'WebCore::EDisplay'?
static int webkitXError(Display* xdisplay, XErrorEvent* error)
                        ^~~~~~~
                        WebCore::EDisplay
/Users/fliep/gtk/source/webkitgtk-2.9.1/Source/WebCore/rendering/style/RenderStyleConstants.h:536:6: note: 
      'WebCore::EDisplay' declared here
enum EDisplay {
     ^
/Users/fliep/gtk/source/webkitgtk-2.9.1/Source/WebKit2/PluginProcess/unix/PluginProcessMainUnix.cpp:60:44: error: 
      unknown type name 'XErrorEvent'
static int webkitXError(Display* xdisplay, XErrorEvent* error)
                                           ^
---------------
/Users/fliep/gtk/source/webkitgtk-2.9.1/Tools/MiniBrowser/gtk/main.c:260:45: error: 
      use of undeclared identifier 'WEBKIT_INJECTED_BUNDLE_PATH'
    g_setenv("WEBKIT_INJECTED_BUNDLE_PATH", WEBKIT_INJECTED_BUNDLE_PATH, FALSE);
                                            ^

This is because of the preprocessor variables MOZ_X11, XP_UNIX, and DEVELOPMENT_BUILD, respectively, being set to the values ON or OFF by the CMake build system, whereas the code expects them to be either defined or undefined. In the common case where they were ON, they were naturally also defined, and so the problem was not immediately apparent.
Comment 1 Philip Chimento 2015-05-10 12:16:16 PDT
The latter failure (DEVELOPMENT_BUILD) has already been changed on master but Tools/MiniBrowser/gtk/main.c:260 may still need to read #if ENABLE(DEVELOPER_MODE) instead of #if ENABLE_DEVELOPER_MODE - I'm not exactly sure how that WTF mechanism works.
Comment 2 Philip Chimento 2015-05-10 12:23:04 PDT
Created attachment 252822 [details]
Patch
Comment 3 Michael Catanzaro 2015-05-10 14:37:26 PDT
Thanks for your patches. I'd like to change the code to be more robust to this, checking values rather than definitions. But I don't see value in fighting that fight in npapi.h, so this is probably the best approach. Let's see what Martin thinks. There should for sure be a warning comment, though, or someone will revert this patch in passing as a cleanup.

(In reply to comment #1)
> The latter failure (DEVELOPMENT_BUILD) has already been changed on master
> but Tools/MiniBrowser/gtk/main.c:260 may still need to read #if
> ENABLE(DEVELOPER_MODE) instead of #if ENABLE_DEVELOPER_MODE - I'm not
> exactly sure how that WTF mechanism works.

ENABLE(DEVELOPER_MODE) is true if ENABLE_DEVELOPER_MODE is defined and its value is not 0, and false otherwise. Since MiniBrowser uses the WebKitGTK+ public API and not WTF internals, ENABLE(DEVELOPER_MODE) is unavailable to it, so it just checks ENABLE_DEVELOPER_MODE directly.
Comment 4 Philip Chimento 2015-05-10 15:02:33 PDT
Created attachment 252827 [details]
Patch
Comment 5 Philip Chimento 2015-05-10 15:04:17 PDT
(In reply to comment #3)
> Thanks for your patches. I'd like to change the code to be more robust to
> this, checking values rather than definitions. But I don't see value in
> fighting that fight in npapi.h, so this is probably the best approach. Let's
> see what Martin thinks. There should for sure be a warning comment, though,
> or someone will revert this patch in passing as a cleanup.

Sure thing. I did kind of assume that npapi.h was off limits. I've added a warning comment.
Comment 6 Martin Robinson 2015-05-10 18:01:14 PDT
Comment on attachment 252827 [details]
Patch

Thank you for fixing this.
Comment 7 Philip Chimento 2015-05-10 19:04:57 PDT
You're welcome. Thanks for the reviews.
Comment 8 WebKit Commit Bot 2015-05-10 20:04:33 PDT
Comment on attachment 252827 [details]
Patch

Clearing flags on attachment: 252827

Committed r184062: <http://trac.webkit.org/changeset/184062>
Comment 9 WebKit Commit Bot 2015-05-10 20:04:37 PDT
All reviewed patches have been landed.  Closing bug.