Bug 243809 - [WPE][GTK] Share public headers
Summary: [WPE][GTK] Share public headers
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Michael Catanzaro
URL:
Keywords: InRadar
: 243863 (view as bug list)
Depends on: 243879 244031
Blocks: GTK4
  Show dependency treegraph
 
Reported: 2022-08-10 19:56 PDT by Michael Catanzaro
Modified: 2022-10-04 15:20 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2022-08-10 19:56:17 PDT
We're soon going to have four public APIs:

 * GTK 3
 * GTK 4
 * WPE 1.0/1.1
 * WPE 2.0

To avoid having four different copies of all the public headers, let's generate the public headers from a shared template. We'll start by unifying the existing WPE and GTK headers without making any API changes. Using a customized version of unifdef, we can use PLATFORM(GTK) and PLATFORM(WPE) guards in the header templates in order to hide platform-specific code from the generated headers. Be careful around comments, though: the guards do not work inside comments, so if any part of a doc comment needs to differ, the entire doc comment will need to be duplicated.

Thanks to Adrian for proposing this solution.
Comment 1 Michael Catanzaro 2022-08-10 20:41:03 PDT
Pull request: https://github.com/WebKit/WebKit/pull/3212
Comment 2 EWS 2022-08-12 06:47:51 PDT
Committed 253377@main (37db7aba2fe6): <https://commits.webkit.org/253377@main>

Reviewed commits have been landed. Closing PR #3212 and removing active labels.
Comment 3 Philippe Normand 2022-08-12 07:41:53 PDT
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitNetworkProxySettings.h:20:1: error: unknown type name 'webkit2'
webkit2
^
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitNetworkProxySettings.h:28:8: error: expected unqualified-id
extern "C" {
       ^
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit/WebKitEnumTypes.cpp:26:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/Headers/webkit2/webkit2.h:72:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/Headers/webkit2/WebKitPrintOperation.h:29:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebView.h:52:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebContext.h:34:
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitNetworkProxySettings.h:20:1: error: unknown type name 'webkit2'
webkit2
^
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit/WebKitEnumTypes.cpp:26:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/Headers/webkit2/webkit2.h:72:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/Headers/webkit2/WebKitPrintOperation.h:29:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebView.h:52:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebContext.h:35:
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitSecurityManager.h:30:8: error: expected unqualified-id
extern "C" {
       ^
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit/WebKitEnumTypes.cpp:26:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/Headers/webkit2/webkit2.h:72:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/Headers/webkit2/WebKitPrintOperation.h:29:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebView.h:52:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebContext.h:38:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebsiteDataManager.h:31:
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitNetworkProxySettings.h:20:1: error: unknown type name 'webkit2'
webkit2
^
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit/WebKitEnumTypes.cpp:26:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/Headers/webkit2/webkit2.h:72:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/Headers/webkit2/WebKitPrintOperation.h:29:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebView.h:52:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebContext.h:38:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebsiteDataManager.h:32:
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebsiteData.h:30:8: error: expected unqualified-id
extern "C" {
       ^
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit/WebKitEnumTypes.cpp:26:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/Headers/webkit2/webkit2.h:72:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/Headers/webkit2/WebKitPrintOperation.h:29:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebView.h:52:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebContext.h:38:
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebsiteDataManager.h:150:72: error: unknown type name 'WebKitNetworkProxyMode'; did you mean 'WebKitNetworkError'?
                                                                       WebKitNetworkProxyMode proxy_mode,
                                                                       ^~~~~~~~~~~~~~~~~~~~~~
                                                                       WebKitNetworkError
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitError.h:58:3: note: 'WebKitNetworkError' declared here
} WebKitNetworkError;
  ^
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit/WebKitEnumTypes.cpp:26:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/Headers/webkit2/webkit2.h:72:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/Headers/webkit2/WebKitPrintOperation.h:29:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebView.h:52:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebContext.h:38:
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebsiteDataManager.h:151:72: error: unknown type name 'WebKitNetworkProxySettings'
                                                                       WebKitNetworkProxySettings *proxy_settings);
                                                                       ^
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebsiteDataManager.h:155:72: error: unknown type name 'WebKitWebsiteDataTypes'; did you mean 'WebKitWebsiteDataManager'?
                                                                       WebKitWebsiteDataTypes types,
                                                                       ^~~~~~~~~~~~~~~~~~~~~~
                                                                       WebKitWebsiteDataManager
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebsiteDataManager.h:58:42: note: 'WebKitWebsiteDataManager' declared here
typedef struct _WebKitWebsiteDataManager WebKitWebsiteDataManager;
                                         ^
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebsiteDataManager.h:166:72: error: unknown type name 'WebKitWebsiteDataTypes'; did you mean 'WebKitWebsiteDataManager'?
                                                                       WebKitWebsiteDataTypes types,
                                                                       ^~~~~~~~~~~~~~~~~~~~~~
                                                                       WebKitWebsiteDataManager
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebsiteDataManager.h:58:42: note: 'WebKitWebsiteDataManager' declared here
typedef struct _WebKitWebsiteDataManager WebKitWebsiteDataManager;
                                         ^
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebsiteDataManager.h:178:73: error: unknown type name 'WebKitWebsiteDataTypes'; did you mean 'WebKitWebsiteDataManager'?
                                                                        WebKitWebsiteDataTypes types,
                                                                        ^~~~~~~~~~~~~~~~~~~~~~
                                                                        WebKitWebsiteDataManager
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebsiteDataManager.h:58:42: note: 'WebKitWebsiteDataManager' declared here
typedef struct _WebKitWebsiteDataManager WebKitWebsiteDataManager;
                                         ^
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit/WebKitEnumTypes.cpp:26:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/Headers/webkit2/webkit2.h:72:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/Headers/webkit2/WebKitPrintOperation.h:29:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebView.h:52:
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebContext.h:177:54: error: unknown type name 'WebKitNetworkProxyMode'; did you mean 'WebKitNetworkError'?
                                                     WebKitNetworkProxyMode proxy_mode,
                                                     ^~~~~~~~~~~~~~~~~~~~~~
                                                     WebKitNetworkError
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitError.h:58:3: note: 'WebKitNetworkError' declared here
} WebKitNetworkError;
  ^
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit/WebKitEnumTypes.cpp:26:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/Headers/webkit2/webkit2.h:72:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/Headers/webkit2/WebKitPrintOperation.h:29:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebView.h:52:
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebContext.h:178:54: error: unknown type name 'WebKitNetworkProxySettings'
                                                     WebKitNetworkProxySettings *proxy_settings);
                                                     ^
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitWebContext.h:199:40: error: unknown type name 'WebKitSecurityManager'; did you mean 'WebKitSecurityOrigin'?
__attribute__((visibility("default"))) WebKitSecurityManager *
                                       ^~~~~~~~~~~~~~~~~~~~~
                                       WebKitSecurityOrigin
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitSecurityOrigin.h:34:38: note: 'WebKitSecurityOrigin' declared here
typedef struct _WebKitSecurityOrigin WebKitSecurityOrigin;
                                     ^
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit/WebKitEnumTypes.cpp:26:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/Headers/webkit2/webkit2.h:100:
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitAutocleanups.h:54:9: error: unknown type name 'WebKitSecurityManager'; did you mean 'WebKitSecurityOrigin'?
typedef WebKitSecurityManager *WebKitSecurityManager_autoptr; typedef GList *WebKitSecurityManager_listautoptr; typedef GSList *WebKitSecurityManager_slistautoptr; typedef GQueue *WebKitSecurityManager_queueautoptr;
        ^~~~~~~~~~~~~~~~~~~~~
        WebKitSecurityOrigin
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitSecurityOrigin.h:34:38: note: 'WebKitSecurityOrigin' declared here
typedef struct _WebKitSecurityOrigin WebKitSecurityOrigin;
                                     ^
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit/WebKitEnumTypes.cpp:26:
In file included from /app/webkit/WebKitBuild/Release/WebKit2Gtk/Headers/webkit2/webkit2.h:100:
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitAutocleanups.h:54:92: error: unknown type name 'WebKitSecurityManager'
 static __attribute__ ((__unused__)) inline void glib_autoptr_clear_WebKitSecurityManager (WebKitSecurityManager *_ptr) { if (_ptr) (g_object_unref) ((WebKitSecurityManager *) _ptr); } static __attribute__ ((__unused__)) inline void glib_autoptr_cleanup_WebKitSecurityManager (WebKitSecurityManager **_ptr) { glib_autoptr_clear_WebKitSecurityManager (*_ptr); } static __attribute__ ((__unused__)) inline void glib_listautoptr_cleanup_WebKitSecurityManager (GList **_l) { g_list_free_full (*_l, (GDestroyNotify) (void(*)(void)) g_object_unref); } static __attribute__ ((__unused__)) inline void glib_slistautoptr_cleanup_WebKitSecurityManager (GSList **_l) { g_slist_free_full (*_l, (GDestroyNotify) (void(*)(void)) g_object_unref); } static __attribute__ ((__unused__)) inline void glib_queueautoptr_cleanup_WebKitSecurityManager (GQueue **_q) { if (*_q) g_queue_free_full (*_q, (GDestroyNotify) (void(*)(void)) g_object_unref); }
                                                                                           ^
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitAutocleanups.h:54:152: error: use of undeclared identifier 'WebKitSecurityManager'
 static __attribute__ ((__unused__)) inline void glib_autoptr_clear_WebKitSecurityManager (WebKitSecurityManager *_ptr) { if (_ptr) (g_object_unref) ((WebKitSecurityManager *) _ptr); } static __attribute__ ((__unused__)) inline void glib_autoptr_cleanup_WebKitSecurityManager (WebKitSecurityManager **_ptr) { glib_autoptr_clear_WebKitSecurityManager (*_ptr); } static __attribute__ ((__unused__)) inline void glib_listautoptr_cleanup_WebKitSecurityManager (GList **_l) { g_list_free_full (*_l, (GDestroyNotify) (void(*)(void)) g_object_unref); } static __attribute__ ((__unused__)) inline void glib_slistautoptr_cleanup_WebKitSecurityManager (GSList **_l) { g_slist_free_full (*_l, (GDestroyNotify) (void(*)(void)) g_object_unref); } static __attribute__ ((__unused__)) inline void glib_queueautoptr_cleanup_WebKitSecurityManager (GQueue **_q) { if (*_q) g_queue_free_full (*_q, (GDestroyNotify) (void(*)(void)) g_object_unref); }
                                                                                                                                                       ^
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitAutocleanups.h:54:175: error: expected expression
 static __attribute__ ((__unused__)) inline void glib_autoptr_clear_WebKitSecurityManager (WebKitSecurityManager *_ptr) { if (_ptr) (g_object_unref) ((WebKitSecurityManager *) _ptr); } static __attribute__ ((__unused__)) inline void glib_autoptr_cleanup_WebKitSecurityManager (WebKitSecurityManager **_ptr) { glib_autoptr_clear_WebKitSecurityManager (*_ptr); } static __attribute__ ((__unused__)) inline void glib_listautoptr_cleanup_WebKitSecurityManager (GList **_l) { g_list_free_full (*_l, (GDestroyNotify) (void(*)(void)) g_object_unref); } static __attribute__ ((__unused__)) inline void glib_slistautoptr_cleanup_WebKitSecurityManager (GSList **_l) { g_slist_free_full (*_l, (GDestroyNotify) (void(*)(void)) g_object_unref); } static __attribute__ ((__unused__)) inline void glib_queueautoptr_cleanup_WebKitSecurityManager (GQueue **_q) { if (*_q) g_queue_free_full (*_q, (GDestroyNotify) (void(*)(void)) g_object_unref); }
                                                                                                                                                                              ^
/app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitAutocleanups.h:54:278: error: unknown type name 'WebKitSecurityManager'
 static __attribute__ ((__unused__)) inline void glib_autoptr_clear_WebKitSecurityManager (WebKitSecurityManager *_ptr) { if (_ptr) (g_object_unref) ((WebKitSecurityManager *) _ptr); } static __attribute__ ((__unused__)) inline void glib_autoptr_cleanup_WebKitSecurityManager (WebKitSecurityManager **_ptr) { glib_autoptr_clear_WebKitSecurityManager (*_ptr); } static __attribute__ ((__unused__)) inline void glib_listautoptr_cleanup_WebKitSecurityManager (GList **_l) { g_list_free_full (*_l, (GDestroyNotify) (void(*)(void)) g_object_unref); } static __attribute__ ((__unused__)) inline void glib_slistautoptr_cleanup_WebKitSecurityManager (GSList **_l) { g_slist_free_full (*_l, (GDestroyNotify) (void(*)(void)) g_object_unref); } static __attribute__ ((__unused__)) inline void glib_queueautoptr_cleanup_WebKitSecurityManager (GQueue **_q) { if (*_q) g_queue_free_full (*_q, (GDestroyNotify) (void(*)(void)) g_object_unref); }
                                                                                                                                                                                                                                                                                     ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
Comment 4 Michael Catanzaro 2022-08-12 07:52:05 PDT
It's hard to know what's going wrong. Can you attach /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitNetworkProxySettings.h and /app/webkit/WebKitBuild/Release/WebKit2Gtk/DerivedSources/webkit2/WebKitSecurityManager.h for starters?

If I don't immediately see the problem, we'll need to revert and try again next week.
Comment 5 WebKit Commit Bot 2022-08-12 07:55:35 PDT
Re-opened since this is blocked by bug 243879
Comment 6 Michael Catanzaro 2022-08-12 07:57:40 PDT
(In reply to WebKit Commit Bot from comment #5)
> Re-opened since this is blocked by bug 243879

Yeah we need to revert this, it broke the post-commit buildbots. :/
Comment 7 Michael Catanzaro 2022-08-12 08:14:51 PDT
OK, Aakash found a WPE buildbot that looks like this:

/app/webkit/WebKitBuild/Debug/DerivedSources/WebKit/wpe/webkit-web-extension.h:29:10: fatal error: /WebKitConsoleMessage.h: No such file or directory
   29 | #include </WebKitConsoleMessage.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

So the configure_file() replacement is just not happening at all. O_O Not sure how to explain that.
Comment 8 Michael Catanzaro 2022-08-12 08:37:45 PDT
I can reproduce this locally when I use a clean build directory. My mistake was to only test incremental builds. This also explains why EWS didn't notice. My build directory, and presumably also the build directories on the EWS bots, were polluted by correct .h.tmp files generated by a previous version of the pull request. The source .h.in files didn't change, so I guess CMake didn't see any need to regenerate the .h.tmp files. But the post-commit bots never saw the previous versions of my PR.

I still don't know what's wrong, but at least I was able to reproduce this locally by simply using a clean build directory, so at least it's not magic. Will investigate more next week.
Comment 9 Michael Catanzaro 2022-08-15 09:59:20 PDT
OK, ignore all of that. I confused myself by switching between GTK and WPE build directories. In fact, WPE was broken due to a typo.

I'm still not sure what's going wrong with the GTK problem that Phil showed above, but my guess is incremental build issue after unapplying previous version of the patch.
Comment 10 Michael Catanzaro 2022-08-15 10:05:41 PDT
Pull request: https://github.com/WebKit/WebKit/pull/3314
Comment 11 Michael Catanzaro 2022-08-15 10:41:15 PDT
Found a copy/paste error in one of my header templates. Also found a dependency error in the unifdef file that made final generated files depend only on the original templates, not on the intermediate templates like they were supposed to. This resulted in it not properly rebuilding the header when the original template changed, hiding the breakage from me and messing up incremental builds.
Comment 12 Michael Catanzaro 2022-08-15 11:07:34 PDT
Unfortunately, even after fixing the dependency, it just doesn't work. Currently I have this macro in Source/WebKit/GLib.cmake:

macro(GENERATE_API_HEADERS _input_header_templates _derived_sources_directory _output_headers)
    foreach (header_template ${${_input_header_templates}})
        get_filename_component(header ${header_template} NAME_WLE)
        configure_file(${header_template} ${_derived_sources_directory}/${header}.tmp)
        add_custom_command(
            OUTPUT ${_derived_sources_directory}/${header}
            DEPENDS ${_derived_sources_directory}/${header}.tmp unifdef
            COMMAND unifdef ${ARGN} -x2 -o ${_derived_sources_directory}/${header} ${_derived_sources_directory}/${header}.tmp
            VERBATIM
        )
        list(APPEND ${_output_headers} ${_derived_sources_directory}/${header})
        unset(header)
    endforeach ()

    list(APPEND WebKit_SOURCES ${${_output_headers}})
endmacro()

Note the line:

DEPENDS ${_derived_sources_directory}/${header}.tmp unifdef

However, the command does not actually get executed when the file ${_derived_sources_directory}/${header}.tmp changes. configure_file() does run again, but unifdef does not run. This means a clean build is required whenever editing a header template, which is not OK. We need to fix this to land safely.

I'll try a few more things, but I'm starting to get rather frustrated as there do not appear to be any typos here. Help welcome.
Comment 13 Michael Catanzaro 2022-08-15 11:17:51 PDT
(In reply to Michael Catanzaro from comment #12)
> I'll try a few more things, but I'm starting to get rather frustrated as
> there do not appear to be any typos here. Help welcome.

I've checked the generated ninja file and searched for WebKitNetworkProxySettings.h.tmp. It appears on only one line:

COMMAND = cd /home/mcatanzaro/Projects/WebKit/WebKitBuild/CustomWPE/Source/WebKit && /home/mcatanzaro/Projects/WebKit/WebKitBuild/CustomWPE/bin/unifdef "-DPLATFORM(GTK)=0" "-DPLATFORM(WPE)=1" "-DUSE(GTK4)=0" -x2 -o /home/mcatanzaro/Projects/WebKit/WebKitBuild/CustomWPE/DerivedSources/WebKit/wpe/WebKitNetworkProxySettings.h /home/mcatanzaro/Projects/WebKit/WebKitBuild/CustomWPE/DerivedSources/WebKit/wpe/WebKitNetworkProxySettings.h.tmp

and nowhere else. CMake is ignoring the dependency for some reason. :/
Comment 14 Michael Catanzaro 2022-08-15 11:52:59 PDT
Don says configure_file() isn't a build step, but a CMake-time step. So trying to have a build dependency on its output apparently does not work.
Comment 15 Michael Catanzaro 2022-08-15 15:35:58 PDT
Well I tried converting it to a build-time step, as Don recommended:

diff --git a/Source/WebKit/GLib.cmake b/Source/WebKit/GLib.cmake
index c755bf045597..e0e55fb48347 100644
--- a/Source/WebKit/GLib.cmake
+++ b/Source/WebKit/GLib.cmake
@@ -3,7 +3,12 @@ include(../ThirdParty/unifdef/CMakeLists.txt)
 macro(GENERATE_API_HEADERS _input_header_templates _derived_sources_directory _output_headers)
     foreach (header_template ${${_input_header_templates}})
         get_filename_component(header ${header_template} NAME_WLE)
-        configure_file(${header_template} ${_derived_sources_directory}/${header}.tmp)
+        add_custom_command(
+            OUTPUT ${_derived_sources_directory}/${header}.tmp
+            DEPENDS ${header_template}
+            COMMAND cmake -DPORT=${PORT} -DINPUT=${header_template} -DOUTPUT=${_derived_sources_directory}/${header}.tmp -P ${CMAKE_CURRENT_SOURCE_DIR}/GenerateGLibHeader.cmake
+            VERBATIM
+        )
         add_custom_command(
             OUTPUT ${_derived_sources_directory}/${header}
             DEPENDS ${_derived_sources_directory}/${header}.tmp unifdef

But it didn't work: the command is still not being run. (Details of the new .cmake file do not matter, because it's not being executed.)

I've been stumped for several hours and am going to give up for now. Will push my latest work to the draft pull request. Help welcome....


But this didn't work: the command is still not being run.
Comment 16 Michael Catanzaro 2022-08-16 06:19:35 PDT
So I'm seriously stumped here. The order of things is:

header.h.in ---> run GenerateGLibHeader.cmake ---> header.h.tmp ---> run unifdef ---> header.h

But when header.h.tmp is modified, header.h does not get regenerated. I cannot figure out why.

> (Details of the new .cmake file do not matter, because it's not being executed.)

This doesn't seem to be a problem anymore. I don't know why, because I don't remember changing anything. Whatever.
Comment 17 Michael Catanzaro 2022-08-16 06:29:22 PDT
(In reply to Michael Catanzaro from comment #16)
> So I'm seriously stumped here.

Carlos Garcia just pushed a solution to the pull request, using one command instead of two. That should surely dodge these problems.
Comment 18 EWS 2022-08-17 11:45:40 PDT
Committed 253528@main (f76a7e30e574): <https://commits.webkit.org/253528@main>

Reviewed commits have been landed. Closing PR #3314 and removing active labels.
Comment 19 Adrian Perez 2022-08-22 01:57:40 PDT
*** Bug 243863 has been marked as a duplicate of this bug. ***
Comment 20 Jonathan Bedard 2022-09-21 14:07:39 PDT
<rdar://problem/100041347>
Comment 21 EWS 2022-10-04 15:20:38 PDT
Committed 252432.506@safari-7614-branch (69080fc62fe3): <https://commits.webkit.org/252432.506@safari-7614-branch>

Reviewed commits have been landed. Closing PR #58 and removing active labels.