Bug 137389 - [GTK] Do not generate a symlink in derived sources for every header in WebCore/bindings/gobject
Summary: [GTK] Do not generate a symlink in derived sources for every header in WebCor...
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
Keywords: Gtk
Depends on:
Blocks: 130075
  Show dependency treegraph
Reported: 2014-10-03 04:34 PDT by Carlos Garcia Campos
Modified: 2014-10-05 00:41 PDT (History)
8 users (show)

See Also:

Patch (4.13 KB, patch)
2014-10-03 04:36 PDT, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff
Simplified version using a foreach loop (3.41 KB, patch)
2014-10-04 01:34 PDT, Carlos Garcia Campos
mrobinson: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 2014-10-03 04:34:52 PDT
We only need a symlink for static sources that are included in public generated headers, because they are added with as <webkitdom/WebKitDOMFoo.h> so they need to be inside a webkitdom directory. Also use proper targets and commands to create the symlinks only when needed instead of for every build.
Comment 1 Carlos Garcia Campos 2014-10-03 04:36:58 PDT
Created attachment 239199 [details]

This removes one of the targets that are always built, see bug #130075
Comment 2 Martin Robinson 2014-10-03 09:01:25 PDT
Comment on attachment 239199 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=239199&action=review

> Source/WebCore/PlatformGTK.cmake:770
> +# Some of the static headers are included by generated public headers with include <webkitdom/WebKitDOMFoo.h>.
> +# We need those headers in the derived sources to be in webkitdom directory.
> +add_custom_command(
> +    DEPENDS ${WEBCORE_DIR}/bindings/gobject/WebKitDOMCustom.h
> +    COMMAND ln -n -s -f ${WEBCORE_DIR}/bindings/gobject/WebKitDOMCustom.h ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}
> +)
> +add_custom_command(
> +    DEPENDS ${WEBCORE_DIR}/bindings/gobject/WebKitDOMEventTarget.h
> +    COMMAND ln -n -s -f ${WEBCORE_DIR}/bindings/gobject/WebKitDOMEventTarget.h ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}
> +)
> +add_custom_command(
> +    DEPENDS ${WEBCORE_DIR}/bindings/gobject/WebKitDOMNodeFilter.h
> +    COMMAND ln -n -s -f ${WEBCORE_DIR}/bindings/gobject/WebKitDOMNodeFilter.h ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}
> +)
> +add_custom_command(
> +    DEPENDS ${WEBCORE_DIR}/bindings/gobject/WebKitDOMObject.h
> +    COMMAND ln -n -s -f ${WEBCORE_DIR}/bindings/gobject/WebKitDOMObject.h ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}
> +)
> +add_custom_command(
> +    DEPENDS ${WEBCORE_DIR}/bindings/gobject/WebKitDOMXPathNSResolver.h
> +    COMMAND ln -n -s -f ${WEBCORE_DIR}/bindings/gobject/WebKitDOMXPathNSResolver.h ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}
> +)
> +add_custom_target(fake-generated-webkitdom-headers

I think there are a couple ways to make this a little cleaner. One is to use a macro and a list of file names (you could even omit the directories). The other is to use a single add_custom_command with multiple outputs and dependencies.
Comment 3 Carlos Garcia Campos 2014-10-03 09:20:23 PDT
I guess I prefer the macro solution, not sure I will find the time to learn how to do that in cmake, though.
Comment 4 Martin Robinson 2014-10-03 10:56:55 PDT
Let me see if I can find a few moments to propose something this weekend.
Comment 5 Carlos Garcia Campos 2014-10-04 01:34:36 PDT
Created attachment 239273 [details]
Simplified version using a foreach loop

Hope this is cleaner
Comment 6 Carlos Garcia Campos 2014-10-05 00:41:24 PDT
Committed r174326: <http://trac.webkit.org/changeset/174326>