[GTK] Move feature overriding to the configure phase
authormrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Feb 2013 16:19:47 +0000 (16:19 +0000)
committermrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Feb 2013 16:19:47 +0000 (16:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=110293

Reviewed by Gustavo Noronha Silva.

.:

Rework the feature overrides logic so all feature defines go into a
header rather than the command line. This has a few benefits. Most
notably, we can reuse the header in the gyp build. Another nice result
is that changes to the configuration automatically result in a full
rebuild and Debug and Release builds can have different configurations.

All feature define processing happens now during the configuration phase,
instead of when running autogen.sh. This means that we need to distribute
the feature processing script.

* GNUmakefile.am: Read feature defines from WebKitFeatures.txt when kicking
off a build. Also include generate-feature-defines-files in the distribution.
* Source/autotools/SetupAutoconfHeader.m4: Remove an extra ENABLE_3D_RENDERING
from the autoconf header, as it is already provided by the feature configuration.
* Source/autotools/SetupWebKitFeatures.m4: Added.
* Source/autotools/webkitfeature.m4: Removed. The functionality has been moved
to SetupWebKitFeatures.m4.
* autogen.sh: Remove the call to override-feature-defines.
* configure.ac: Now include SetupWebKitFeatures.

Source/WebCore:

* GNUmakefile.am: No longer include GNUmakefile.features.am. We don't
have to process the result of this file or do any modification of
feature_defines_override, because this variable is gone.

Tools:

* Scripts/webkitdirs.pm:
(runAutogenForAutotoolsProjectIfNecessary): Rename the feature file to
WebKitFeatureOverrides.txt to better match the other filenames used in
the new feature processing.
* gtk/generate-feature-defines-files: Added. A script which takes as an argument
the default features, overrides them with the contents of WebKitFeatureOverrrides.txt
and writes WebKitFeatures.txt and WebKitFeatures.h.
* gtk/override-feature-defines: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143604 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
ChangeLog
GNUmakefile.am
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.am
Source/WebCore/GNUmakefile.features.am.in [deleted file]
Source/autotools/SetupAutoconfHeader.m4
Source/autotools/SetupWebKitFeatures.m4 [new file with mode: 0644]
Source/autotools/webkitfeature.m4 [deleted file]
Tools/ChangeLog
Tools/Scripts/webkitdirs.pm
Tools/gtk/generate-feature-defines-files [new file with mode: 0755]
Tools/gtk/override-feature-defines [deleted file]
autogen.sh
configure.ac

index 6f3111d..0524f02 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+2013-02-21  Martin Robinson  <mrobinson@igalia.com>
+
+        [GTK] Move feature overriding to the configure phase
+        https://bugs.webkit.org/show_bug.cgi?id=110293
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Rework the feature overrides logic so all feature defines go into a
+        header rather than the command line. This has a few benefits. Most
+        notably, we can reuse the header in the gyp build. Another nice result
+        is that changes to the configuration automatically result in a full
+        rebuild and Debug and Release builds can have different configurations.
+
+        All feature define processing happens now during the configuration phase,
+        instead of when running autogen.sh. This means that we need to distribute
+        the feature processing script.
+
+        * GNUmakefile.am: Read feature defines from WebKitFeatures.txt when kicking
+        off a build. Also include generate-feature-defines-files in the distribution.
+        * Source/autotools/SetupAutoconfHeader.m4: Remove an extra ENABLE_3D_RENDERING
+        from the autoconf header, as it is already provided by the feature configuration.
+        * Source/autotools/SetupWebKitFeatures.m4: Added.
+        * Source/autotools/webkitfeature.m4: Removed. The functionality has been moved
+        to SetupWebKitFeatures.m4.
+        * autogen.sh: Remove the call to override-feature-defines.
+        * configure.ac: Now include SetupWebKitFeatures.
+
 2013-02-20  Dirk Schulze  <krit@webkit.org>
 
         Enable CANVAS_PATH flag
index e420e4b..ecd305f 100644 (file)
@@ -60,9 +60,6 @@ USER_LINGUAS :=
 USE_LINGUAS :=
 MOFILES :=
 ALL_MOFILES :=
-feature_defines_defaults :=
-feature_defines_overrides :=
-feature_defines :=
 dom_binding_idls :=
 wtf_sources :=
 javascriptcore_h_api :=
@@ -151,6 +148,10 @@ endif
 global_cxxflags += \
        -fno-rtti
 
+# Read the feature defines file, that's created by generate-feature-defines-files
+# during configuration (SetupWebKitFeatures.m4).
+feature_defines := $(shell cat WebKitFeatures.txt)
+
 # -no-undefined required for building DLLs on Windows
 # It breaks the build on other platforms, so we use it conditionally
 if OS_WIN32
@@ -170,6 +171,7 @@ endif
 
 EXTRA_DIST += \
        $(srcdir)/Source/autotools/symbols.filter \
+       $(srcdir)/Tools/generate-feature-defines-files \
        $(srcdir)/Source/WebKit/LICENSE
 
 # Include module makefiles
index d25588b..f976503 100644 (file)
@@ -1,3 +1,14 @@
+2013-02-21  Martin Robinson  <mrobinson@igalia.com>
+
+        [GTK] Move feature overriding to the configure phase
+        https://bugs.webkit.org/show_bug.cgi?id=110293
+
+        Reviewed by Gustavo Noronha Silva.
+
+        * GNUmakefile.am: No longer include GNUmakefile.features.am. We don't
+        have to process the result of this file or do any modification of
+        feature_defines_override, because this variable is gone.
+
 2013-02-21  Andrey Adaikin  <aandrey@chromium.org>
 
         Unreviewed. Rolling out an unindented change from r143580.
index ca01191..7623b9d 100644 (file)
@@ -1,4 +1,3 @@
-include $(srcdir)/Source/WebCore/GNUmakefile.features.am
 include $(srcdir)/Source/WebCore/GNUmakefile.list.am
 
 WEBCORE_CSS_PROPERTY_NAMES := $(WebCore)/css/CSSPropertyNames.in
@@ -137,75 +136,12 @@ webcoregtk_cppflags += \
        -I$(srcdir)/Source/WebCore/platform/graphics/win
 endif # END TARGET_WIN32
 
-# ----
-# Gamepad support
-# ---
-if ENABLE_GAMEPAD
-feature_defines_overrides += ENABLE_GAMEPAD=1
-else
-feature_defines_overrides += ENABLE_GAMEPAD=0
-endif # END ENABLE_GAMEPAD
-
-# ----
-# Video Support
-# ----
-if ENABLE_VIDEO
-feature_defines_overrides += ENABLE_VIDEO=1
-else
-feature_defines_overrides += ENABLE_VIDEO=0 ENABLE_VIDEO_TRACK=0
-endif # END ENABLE_VIDEO
-
-# ----
-# Filters
-# ----
-if ENABLE_CSS_FILTERS
-feature_defines_overrides += ENABLE_CSS_FILTERS=1
-else
-feature_defines_overrides += ENABLE_CSS_FILTERS=0
-endif # END ENABLE_CSS_FILTERS
-
-# ----
-# Media Stream Support
-# ----
-if ENABLE_MEDIA_STREAM
-feature_defines_overrides += ENABLE_MEDIA_STREAM=1
-else
-feature_defines_overrides += ENABLE_MEDIA_STREAM=0
-endif # END ENABLE_MEDIA_STREAM
-
 # XPath grammar
 $(GENSOURCES_WEBCORE)/XPathGrammar.h: $(GENSOURCES_WEBCORE)/XPathGrammar.cpp
 $(GENSOURCES_WEBCORE)/XPathGrammar.cpp: $(WebCore)/xml/XPathGrammar.y
        $(AM_V_GEN)
        $(AM_V_at)perl $(WebCore)/css/makegrammar.pl --outputDir $(GENSOURCES_WEBCORE) --bison "$(BISON)" --symbolsPrefix xpathyy $<
 
-# ----
-# XSLT Support
-# ----
-if ENABLE_XSLT
-feature_defines_overrides += ENABLE_XSLT=1
-else
-feature_defines_overrides += ENABLE_XSLT=0
-endif # END ENABLE_XSLT
-
-# ----
-# Shaders
-# ----
-if ENABLE_CSS_SHADERS
-feature_defines_overrides += ENABLE_CSS_SHADERS=1
-else
-feature_defines_overrides += ENABLE_CSS_SHADERS=0
-endif # END ENABLE_CSS_SHADERS
-
-# ----
-# Geolocation
-# ----
-if ENABLE_GEOLOCATION
-feature_defines_overrides += ENABLE_GEOLOCATION=1
-else
-feature_defines_overrides += ENABLE_GEOLOCATION=0
-endif # END ENABLE_GEOLOCATION
-
 # MathML tag and attribute names, and element factory
 DerivedSources/WebCore/MathMLElementFactory.h: DerivedSources/WebCore/MathMLElementFactory.cpp
 DerivedSources/WebCore/MathMLNames.h: DerivedSources/WebCore/MathMLNames.cpp
@@ -245,18 +181,10 @@ libWebCoreSVG_la_CPPFLAGS = \
        $(LIBSOUP_CFLAGS) \
        $(UNICODE_CFLAGS)
 
-feature_defines_overrides += ENABLE_SVG=1
 WEBCORE_CSS_PROPERTY_NAMES += $(WebCore)/css/SVGCSSPropertyNames.in
 WEBCORE_CSS_VALUE_KEYWORDS += $(WebCore)/css/SVGCSSValueKeywords.in
-# SVG Features
-if ENABLE_SVG_FONTS
-feature_defines_overrides += ENABLE_SVG_FONTS=1
-else
-feature_defines_overrides += ENABLE_SVG_FONTS=0
-endif
-else
-feature_defines_overrides += ENABLE_SVG=0 ENABLE_SVG_FONTS=0
-endif # END ENABLE_SVG
+
+endif # END_ENABLE_SVG
 
 # SVG tag and attribute names (need to pass an extra flag if svg experimental features are enabled)
 DerivedSources/WebCore/SVGNames.cpp: DerivedSources/WebCore/SVGElementFactory.cpp
@@ -270,33 +198,6 @@ DerivedSources/WebCore/XLinkNames.h: DerivedSources/WebCore/XLinkNames.cpp
 DerivedSources/WebCore/XLinkNames.cpp : $(WebCore)/dom/make_names.pl $(WebCore)/svg/xlinkattrs.in
        $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --attrs $(WebCore)/svg/xlinkattrs.in --outputDir "$(GENSOURCES_WEBCORE)"
 
-# ----
-# Web Audio Support
-# ----
-if ENABLE_WEB_AUDIO
-feature_defines_overrides += ENABLE_WEB_AUDIO=1
-else
-feature_defines_overrides += ENABLE_WEB_AUDIO=0
-endif
-
-# ---
-# 3D canvas (WebGL) support
-# ---
-if ENABLE_WEBGL
-feature_defines_overrides += ENABLE_WEBGL=1
-else
-feature_defines_overrides += ENABLE_WEBGL=0
-endif  # END ENABLE_WEBGL
-
-# ---
-# Accelerated compositing support
-# ---
-if USE_ACCELERATED_COMPOSITING
-feature_defines_overrides += ENABLE_3D_RENDERING=1
-else
-feature_defines_overrides += ENABLE_3D_RENDERING=0
-endif  # END USE_ACCELERATED_COMPOSITING
-
 if USE_TEXTURE_MAPPER_CAIRO
 webcore_cppflags += \
        -I$(srcdir)/Source/WebCore/platform/graphics/texmap
@@ -313,15 +214,6 @@ webcore_cppflags += \
        -I$(srcdir)/Source/WebCore/platform/graphics/clutter
 endif  # END USE_CLUTTER
 
-# ---
-# Spell check support
-# ---
-if ENABLE_SPELLCHECK
-feature_defines_overrides += ENABLE_SPELLCHECK=1
-else
-feature_defines_overrides += ENABLE_SPELLCHECK=0
-endif  # END ENABLE_SPELLCHECK
-
 if ENABLE_INDEXED_DATABASE
 webcore_cppflags += \
        -DWTF_USE_LEVELDB=1 \
@@ -329,26 +221,6 @@ webcore_cppflags += \
        -I$(srcdir)/Source/ThirdParty/leveldb/include
 endif
 
-# Fill the feature_defines variable with all the defines, making it possible
-# to override the default define value (as set in feature_defines_defaults)
-# through adding the feature define with the desired value to either
-# feature_defines_unstable or feature_defines_overrides.
-feature_defines += $(strip $(foreach bare_define, \
-       $(foreach define,$(feature_defines_defaults), \
-               $(foreach fvalue,0 1, \
-                       $(if $(findstring =$(fvalue),$(define)),$(patsubst %=$(fvalue),%,$(define))) \
-               ) \
-       ), \
-       $(if $(findstring $(bare_define)=, $(feature_defines_overrides)), \
-               $(filter $(bare_define)=%,$(feature_defines_overrides)), \
-               $(filter $(bare_define)=%,$(feature_defines_defaults)) \
-       ) \
-))
-
-# Add the feature defines to webcore_cppflags in macro form.
-webcore_cppflags += $(foreach define,$(feature_defines),-D$(define))
-
-
 $(WEBCORE_CSS_PROPERTY_NAMES): $(srcdir)/configure.ac $(srcdir)/Source/WebCore/GNUmakefile.am
 
 $(WEBCORE_CSS_VALUE_KEYWORDS): $(srcdir)/configure.ac $(srcdir)/Source/WebCore/GNUmakefile.am
diff --git a/Source/WebCore/GNUmakefile.features.am.in b/Source/WebCore/GNUmakefile.features.am.in
deleted file mode 100644 (file)
index a6dc439..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-feature_defines_defaults += \
-       ENABLE_3D_RENDERING=0 \
-       ENABLE_ACCELERATED_2D_CANVAS=0 \
-       ENABLE_BATTERY_STATUS=0 \
-       ENABLE_BLOB=1 \
-       ENABLE_CANVAS_PATH=0 \
-       ENABLE_CANVAS_PROXY=0 \
-       ENABLE_CHANNEL_MESSAGING=1 \
-       ENABLE_CSP_NEXT=0 \
-       ENABLE_CSS3_TEXT=0 \
-       ENABLE_CSS_BOX_DECORATION_BREAK=1 \
-       ENABLE_CSS_COMPOSITING=0 \
-       ENABLE_CSS_DEVICE_ADAPTATION=0 \
-       ENABLE_CSS_EXCLUSIONS=1 \
-       ENABLE_CSS_FILTERS=0 \
-       ENABLE_CSS_IMAGE_ORIENTATION=0 \
-       ENABLE_CSS_IMAGE_RESOLUTION=0 \
-       ENABLE_CSS_IMAGE_SET=0 \
-       ENABLE_CSS_REGIONS=0 \
-       ENABLE_CSS_SHADERS=0 \
-       ENABLE_CSS_STICKY_POSITION=0 \
-       ENABLE_CSS_TRANSFORMS_ANIMATIONS_UNPREFIXED=0 \
-       ENABLE_CSS_VARIABLES=0 \
-       ENABLE_CSS3_CONDITIONAL_RULES=0 \
-       ENABLE_CUSTOM_SCHEME_HANDLER=0 \
-       ENABLE_DASHBOARD_SUPPORT=0 \
-       ENABLE_DATALIST_ELEMENT=0 \
-       ENABLE_DATA_TRANSFER_ITEMS=0 \
-       ENABLE_DETAILS_ELEMENT=1 \
-       ENABLE_DEVICE_ORIENTATION=0 \
-       ENABLE_DIALOG_ELEMENT=0 \
-       ENABLE_DIRECTORY_UPLOAD=0 \
-       ENABLE_DOM4_EVENTS_CONSTRUCTOR=0 \
-       ENABLE_DOWNLOAD_ATTRIBUTE=0 \
-       ENABLE_FILE_SYSTEM=0 \
-       ENABLE_FILTERS=1 \
-       ENABLE_FTPDIR=0 \
-       ENABLE_FULLSCREEN_API=1 \
-       ENABLE_GAMEPAD=1 \
-       ENABLE_GEOLOCATION=1 \
-       ENABLE_HIGH_DPI_CANVAS=0 \
-       ENABLE_ICONDATABASE=1 \
-       ENABLE_IFRAME_SEAMLESS=1 \
-       ENABLE_INDEXED_DATABASE=0 \
-       ENABLE_INPUT_SPEECH=0 \
-       ENABLE_INPUT_TYPE_COLOR=0 \
-       ENABLE_INPUT_TYPE_DATE=0 \
-       ENABLE_INPUT_TYPE_DATETIME=0 \
-       ENABLE_INPUT_TYPE_DATETIMELOCAL=0 \
-       ENABLE_INPUT_TYPE_MONTH=0 \
-       ENABLE_INPUT_TYPE_TIME=0 \
-       ENABLE_INPUT_TYPE_WEEK=0 \
-       ENABLE_INSPECTOR=1 \
-       ENABLE_JAVASCRIPT_DEBUGGER=1 \
-       ENABLE_LEGACY_CSS_VENDOR_PREFIXES=0 \
-       ENABLE_LEGACY_NOTIFICATIONS=0 \
-       ENABLE_LEGACY_VENDOR_PREFIXES=1 \
-       ENABLE_LEGACY_WEB_AUDIO=0 \
-       ENABLE_LINK_PREFETCH=0 \
-       ENABLE_LINK_PRERENDER=0 \
-       ENABLE_MATHML=1 \
-       ENABLE_MEDIA_CAPTURE=0 \
-       ENABLE_MEDIA_SOURCE=0 \
-       ENABLE_MEDIA_STATISTICS=0 \
-       ENABLE_MEDIA_STREAM=1 \
-       ENABLE_METER_ELEMENT=1 \
-       ENABLE_MHTML=1 \
-       ENABLE_MICRODATA=0 \
-       ENABLE_MOUSE_CURSOR_SCALE=0 \
-       ENABLE_NAVIGATOR_CONTENT_UTILS=0 \
-       ENABLE_NETSCAPE_PLUGIN_API=1 \
-       ENABLE_NETWORK_INFO=0 \
-       ENABLE_NOTIFICATIONS=0 \
-       ENABLE_ORIENTATION_EVENTS=0 \
-       ENABLE_PAGE_VISIBILITY_API=0 \
-       ENABLE_PERFORMANCE_TIMELINE=0 \
-       ENABLE_PROGRESS_ELEMENT=1 \
-       ENABLE_PROXIMITY_EVENTS=0 \
-       ENABLE_QUOTA=0 \
-       ENABLE_RESOURCE_TIMING=0 \
-       ENABLE_REQUEST_ANIMATION_FRAME=1 \
-       ENABLE_SCRIPTED_SPEECH=0 \
-       ENABLE_SHADOW_DOM=1 \
-       ENABLE_SHARED_WORKERS=1 \
-       ENABLE_SMOOTH_SCROLLING=1 \
-       ENABLE_SPELLCHECK=1 \
-       ENABLE_SQL_DATABASE=1 \
-       ENABLE_STYLE_SCOPED=0 \
-       ENABLE_SVG=1 \
-       ENABLE_SVG_DOM_OBJC_BINDINGS=0 \
-       ENABLE_SVG_FONTS=1 \
-       ENABLE_TEMPLATE_ELEMENT=0 \
-       ENABLE_TEXT_AUTOSIZING=0 \
-       ENABLE_TOUCH_EVENTS=0 \
-       ENABLE_TOUCH_ICON_LOADING=0 \
-       ENABLE_USER_TIMING=0 \
-       ENABLE_VIBRATION=0 \
-       ENABLE_VIDEO=1 \
-       ENABLE_VIDEO_TRACK=0 \
-       ENABLE_WEBGL=1 \
-       ENABLE_WEB_AUDIO=0 \
-       ENABLE_WEB_SOCKETS=1 \
-       ENABLE_WEB_TIMING=1 \
-       ENABLE_WORKERS=1 \
-       ENABLE_XHR_TIMEOUT=1 \
-       ENABLE_XSLT=1
index 3c7e51a..8101d3c 100644 (file)
@@ -79,11 +79,10 @@ fi
 
 if test "$enable_accelerated_compositing" = "yes"; then
     AC_DEFINE([WTF_USE_ACCELERATED_COMPOSITING], [1], [ ])
-    AC_DEFINE([ENABLE_3D_RENDERING], [1], [ ])
 
     if test "$with_acceleration_backend" = "none"; then
-        AC_DEFINE([DWTF_USE_TEXTURE_MAPPER], [1], [ ])
-        AC_DEFINE([DWTF_USE_TEXTURE_MAPPER_CAIRO], [1], [ ])
+        AC_DEFINE([WTF_USE_TEXTURE_MAPPER], [1], [ ])
+        AC_DEFINE([WTF_USE_TEXTURE_MAPPER_CAIRO], [1], [ ])
     fi
 
     if test "$with_acceleration_backend" = "opengl"; then
diff --git a/Source/autotools/SetupWebKitFeatures.m4 b/Source/autotools/SetupWebKitFeatures.m4
new file mode 100644 (file)
index 0000000..0d18705
--- /dev/null
@@ -0,0 +1,198 @@
+# This adds the include line to the bottom of the autoconfig header.
+AH_BOTTOM([#include "WebKitFeatures.h"])
+
+# This list of features represents those selected for release builds.
+# If you are adding a new or unstable feature, you should mark it
+# disabled here.
+read -d '' DEFAULT_FEATURE_DEFINES <<"EOF"
+       ENABLE_ACCELERATED_2D_CANVAS=0
+       ENABLE_BATTERY_STATUS=0
+       ENABLE_BLOB=1
+       ENABLE_CANVAS_PATH=0
+       ENABLE_CANVAS_PROXY=0
+       ENABLE_CHANNEL_MESSAGING=1
+       ENABLE_CSP_NEXT=0
+       ENABLE_CSS3_TEXT=0
+       ENABLE_CSS_BOX_DECORATION_BREAK=1
+       ENABLE_CSS_COMPOSITING=0
+       ENABLE_CSS_DEVICE_ADAPTATION=0
+       ENABLE_CSS_EXCLUSIONS=1
+       ENABLE_CSS_IMAGE_ORIENTATION=0
+       ENABLE_CSS_IMAGE_RESOLUTION=0
+       ENABLE_CSS_IMAGE_SET=0
+       ENABLE_CSS_REGIONS=0
+       ENABLE_CSS_STICKY_POSITION=0
+       ENABLE_CSS_TRANSFORMS_ANIMATIONS_UNPREFIXED=0
+       ENABLE_CSS_VARIABLES=0
+       ENABLE_CSS3_CONDITIONAL_RULES=0
+       ENABLE_CUSTOM_SCHEME_HANDLER=0
+       ENABLE_DASHBOARD_SUPPORT=0
+       ENABLE_DATALIST_ELEMENT=0
+       ENABLE_DATA_TRANSFER_ITEMS=0
+       ENABLE_DETAILS_ELEMENT=1
+       ENABLE_DEVICE_ORIENTATION=0
+       ENABLE_DIALOG_ELEMENT=0
+       ENABLE_DIRECTORY_UPLOAD=0
+       ENABLE_DOM4_EVENTS_CONSTRUCTOR=0
+       ENABLE_DOWNLOAD_ATTRIBUTE=0
+       ENABLE_FILE_SYSTEM=0
+       ENABLE_FILTERS=1
+       ENABLE_FTPDIR=0
+       ENABLE_FULLSCREEN_API=1
+       ENABLE_HIGH_DPI_CANVAS=0
+       ENABLE_ICONDATABASE=1
+       ENABLE_IFRAME_SEAMLESS=1
+       ENABLE_INDEXED_DATABASE=0
+       ENABLE_INPUT_SPEECH=0
+       ENABLE_INPUT_TYPE_COLOR=0
+       ENABLE_INPUT_TYPE_DATE=0
+       ENABLE_INPUT_TYPE_DATETIME=0
+       ENABLE_INPUT_TYPE_DATETIMELOCAL=0
+       ENABLE_INPUT_TYPE_MONTH=0
+       ENABLE_INPUT_TYPE_TIME=0
+       ENABLE_INPUT_TYPE_WEEK=0
+       ENABLE_INSPECTOR=1
+       ENABLE_JAVASCRIPT_DEBUGGER=1
+       ENABLE_LEGACY_CSS_VENDOR_PREFIXES=0
+       ENABLE_LEGACY_NOTIFICATIONS=0
+       ENABLE_LEGACY_VENDOR_PREFIXES=1
+       ENABLE_LEGACY_WEB_AUDIO=0
+       ENABLE_LINK_PREFETCH=0
+       ENABLE_LINK_PRERENDER=0
+       ENABLE_MATHML=1
+       ENABLE_MEDIA_CAPTURE=0
+       ENABLE_MEDIA_SOURCE=0
+       ENABLE_MEDIA_STATISTICS=0
+       ENABLE_METER_ELEMENT=1
+       ENABLE_MHTML=1
+       ENABLE_MICRODATA=0
+       ENABLE_MOUSE_CURSOR_SCALE=0
+       ENABLE_NAVIGATOR_CONTENT_UTILS=0
+       ENABLE_NETSCAPE_PLUGIN_API=1
+       ENABLE_NETWORK_INFO=0
+       ENABLE_NOTIFICATIONS=0
+       ENABLE_ORIENTATION_EVENTS=0
+       ENABLE_PAGE_VISIBILITY_API=0
+       ENABLE_PERFORMANCE_TIMELINE=0
+       ENABLE_PROGRESS_ELEMENT=1
+       ENABLE_PROXIMITY_EVENTS=0
+       ENABLE_QUOTA=0
+       ENABLE_RESOURCE_TIMING=0
+       ENABLE_REQUEST_ANIMATION_FRAME=1
+       ENABLE_SCRIPTED_SPEECH=0
+       ENABLE_SHADOW_DOM=1
+       ENABLE_SHARED_WORKERS=1
+       ENABLE_SMOOTH_SCROLLING=1
+       ENABLE_SQL_DATABASE=1
+       ENABLE_STYLE_SCOPED=0
+       ENABLE_SVG_DOM_OBJC_BINDINGS=0
+       ENABLE_TEMPLATE_ELEMENT=0
+       ENABLE_TEXT_AUTOSIZING=0
+       ENABLE_TOUCH_EVENTS=0
+       ENABLE_TOUCH_ICON_LOADING=0
+       ENABLE_USER_TIMING=0
+       ENABLE_VIBRATION=0
+       ENABLE_VIDEO_TRACK=0
+       ENABLE_WEB_AUDIO=0
+       ENABLE_WEB_SOCKETS=1
+       ENABLE_WEB_TIMING=1
+       ENABLE_WORKERS=1
+       ENABLE_XHR_TIMEOUT=1
+EOF
+
+if test "$enable_spellcheck" = "yes"; then
+    DEFAULT_FEATURE_DEFINES="$DEFAULT_FEATURE_DEFINES ENABLE_SPELLCHECK=1"
+else
+    DEFAULT_FEATURE_DEFINES="$DEFAULT_FEATURE_DEFINES ENABLE_SPELLCHECK=0"
+fi
+
+if test "$enable_gamepad" = "yes"; then
+       DEFAULT_FEATURE_DEFINES="$DEFAULT_FEATURE_DEFINES ENABLE_GAMEPAD=1"
+else
+       DEFAULT_FEATURE_DEFINES="$DEFAULT_FEATURE_DEFINES ENABLE_GAMEPAD=0"
+fi
+
+if test "$enable_video" = "yes"; then
+    DEFAULT_FEATURE_DEFINES="$DEFAULT_FEATURE_DEFINES ENABLE_VIDEO=1"
+else
+    DEFAULT_FEATURE_DEFINES="$DEFAULT_FEATURE_DEFINES ENABLE_VIDEO=0"
+fi
+
+if test "$enable_media_stream" = "yes"; then
+    DEFAULT_FEATURE_DEFINES="$DEFAULT_FEATURE_DEFINES ENABLE_MEDIA_STREAM=1"
+else
+    DEFAULT_FEATURE_DEFINES="$DEFAULT_FEATURE_DEFINES ENABLE_MEDIA_STREAM=0"
+fi
+
+if test "$enable_css_shaders" = "yes"; then
+    DEFAULT_FEATURE_DEFINES="$DEFAULT_FEATURE_DEFINES ENABLE_CSS_SHADERS=1"
+else
+    DEFAULT_FEATURE_DEFINES="$DEFAULT_FEATURE_DEFINES ENABLE_CSS_SHADERS=0"
+fi
+
+if test "$enable_css_filters" = "yes"; then
+    DEFAULT_FEATURE_DEFINES="$DEFAULT_FEATURE_DEFINES ENABLE_CSS_FILTERS=1"
+else
+    DEFAULT_FEATURE_DEFINES="$DEFAULT_FEATURE_DEFINES ENABLE_CSS_FILTERS=0"
+fi
+
+if test "$enable_geolocation" = "yes"; then
+    DEFAULT_FEATURE_DEFINES="$DEFAULT_FEATURE_DEFINES ENABLE_GEOLOCATION=1"
+else
+    DEFAULT_FEATURE_DEFINES="$DEFAULT_FEATURE_DEFINES ENABLE_GEOLOCATION=0"
+fi
+
+if test "$enable_svg" = "yes"; then
+    DEFAULT_FEATURE_DEFINES="$DEFAULT_FEATURE_DEFINES ENABLE_SVG=1"
+else
+    DEFAULT_FEATURE_DEFINES="$DEFAULT_FEATURE_DEFINES ENABLE_SVG=0"
+fi
+
+if test "$enable_svg_fonts" = "yes"; then
+    DEFAULT_FEATURE_DEFINES="$DEFAULT_FEATURE_DEFINES ENABLE_SVG_FONTS=1"
+else
+    DEFAULT_FEATURE_DEFINES="$DEFAULT_FEATURE_DEFINES ENABLE_SVG_FONTS=0"
+fi
+
+if test "$enable_webgl" = "yes"; then
+    DEFAULT_FEATURE_DEFINES="$DEFAULT_FEATURE_DEFINES ENABLE_WEBGL=1"
+else
+    DEFAULT_FEATURE_DEFINES="$DEFAULT_FEATURE_DEFINES ENABLE_WEBGL=0"
+fi
+
+if test "$enable_accelerated_compositing" = "yes"; then
+    DEFAULT_FEATURE_DEFINES="$DEFAULT_FEATURE_DEFINES ENABLE_3D_RENDERING=1"
+else
+    DEFAULT_FEATURE_DEFINES="$DEFAULT_FEATURE_DEFINES ENABLE_3D_RENDERING=0"
+fi
+
+if test "$enable_web_audio" = "yes"; then
+    DEFAULT_FEATURE_DEFINES="$DEFAULT_FEATURE_DEFINES ENABLE_WEB_AUDIO=1"
+else
+    DEFAULT_FEATURE_DEFINES="$DEFAULT_FEATURE_DEFINES ENABLE_WEB_AUDIO=0"
+fi
+
+# We need to run this command now rather than use AC_CONFIG_COMMANDS
+# because automake rules depend on the output file (WebKitFeatures.txt).
+$srcdir/Tools/gtk/generate-feature-defines-files $DEFAULT_FEATURE_DEFINES
+
+dnl AM_WEBKIT_FEATURE_CONDITIONAL
+dnl Checks whether the given feature is enabled in the
+dnl build that is being configured and sets up equally-named
+dnl Automake conditional reflecting the feature status.
+dnl
+dnl Usage:
+dnl AM_WEBKIT_FEATURE_CONDITIONAL([FEATURE])
+AC_DEFUN([AM_WEBKIT_FEATURE_CONDITIONAL], [
+  AC_PROG_AWK
+
+  grep -qE "($1=1)" WebKitFeatures.txt
+  if test $? -eq 0; then
+    feature_enabled="yes";
+  else
+    feature_enabled="no";
+  fi
+
+  AM_CONDITIONAL([$1], [test "$feature_enabled" = "yes"])
+
+]) dnl AM_WEBKIT_FEATURE_CONDITIONAL
diff --git a/Source/autotools/webkitfeature.m4 b/Source/autotools/webkitfeature.m4
deleted file mode 100644 (file)
index 79f9c03..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-dnl AM_WEBKIT_FEATURE_CONDITIONAL
-dnl Checks whether the given feature is enabled in the
-dnl build that is being configured and sets up equally-named
-dnl Automake conditional reflecting the feature status.
-dnl
-dnl Usage:
-dnl AM_WEBKIT_FEATURE_CONDITIONAL([FEATURE])
-
-AC_DEFUN([AM_WEBKIT_FEATURE_CONDITIONAL], [
-  AC_PROG_AWK
-
-  dnl Grep the generated GNUmakefile.features.am
-  dnl to determine if the specified feature is enabled.
-  grep -qE "($1=1)" $srcdir/Source/WebCore/GNUmakefile.features.am
-  if test $? -eq 0; then
-    feature_enabled="yes";
-  else
-    feature_enabled="no";
-  fi
-
-  AM_CONDITIONAL([$1],[test "$feature_enabled" = "yes"])
-
-]) dnl AM_WEBKIT_FEATURE_CONDITIONAL
index 8e41a62..d9d59f1 100644 (file)
@@ -1,3 +1,19 @@
+2013-02-21  Martin Robinson  <mrobinson@igalia.com>
+
+        [GTK] Move feature overriding to the configure phase
+        https://bugs.webkit.org/show_bug.cgi?id=110293
+
+        Reviewed by Gustavo Noronha Silva.
+
+        * Scripts/webkitdirs.pm:
+        (runAutogenForAutotoolsProjectIfNecessary): Rename the feature file to
+        WebKitFeatureOverrides.txt to better match the other filenames used in
+        the new feature processing.
+        * gtk/generate-feature-defines-files: Added. A script which takes as an argument
+        the default features, overrides them with the contents of WebKitFeatureOverrrides.txt
+        and writes WebKitFeatures.txt and WebKitFeatures.h.
+        * gtk/override-feature-defines: Removed.
+
 2013-02-21  Oswald Buddenhagen  <oswald.buddenhagen@digia.com>
 
         [Qt] Remove obsolete DEPENDPATH assignment
index cdf5e98..45847b0 100755 (executable)
@@ -2004,7 +2004,7 @@ sub runAutogenForAutotoolsProjectIfNecessary($@)
         }
 
         # Run autogen.sh again if either the features overrided by build-webkit or build arguments have changed.
-        if (!mustReRunAutogen($sourceDir, "feature-defines-overriding.txt", $joinedOverridableFeatures)
+        if (!mustReRunAutogen($sourceDir, "WebKitFeatureOverrides.txt", $joinedOverridableFeatures)
             && !mustReRunAutogen($sourceDir, "previous-autogen-arguments.txt", $joinedBuildArgs)) {
             return;
         }
@@ -2016,7 +2016,7 @@ sub runAutogenForAutotoolsProjectIfNecessary($@)
     # Only for WebKit, write the autogen.sh arguments to a file so that we can detect
     # when they change and automatically re-run it.
     if ($project eq 'WebKit') {
-        open(OVERRIDABLE_FEATURES, ">feature-defines-overriding.txt");
+        open(OVERRIDABLE_FEATURES, ">WebKitFeatureOverrides.txt");
         print OVERRIDABLE_FEATURES $joinedOverridableFeatures;
         close(OVERRIDABLE_FEATURES);
 
diff --git a/Tools/gtk/generate-feature-defines-files b/Tools/gtk/generate-feature-defines-files
new file mode 100755 (executable)
index 0000000..1a92bf5
--- /dev/null
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+
+import os
+import re
+import sys
+
+def read_feature_defines_override(feature_defines):
+    feature_defines_overriding_file = 'WebKitFeatureOverrides.txt'
+    if not os.path.exists(feature_defines_overriding_file):
+        return
+
+    print("The following feature defines were overriden:")
+    with open(feature_defines_overriding_file) as f:
+        match_iter = re.findall(r"((?:ENABLE_)\w+)=(0|1)", f.read())
+
+    for match in match_iter:
+        feature = match[0]
+        value = int(match[1])
+
+        if feature in feature_defines and value != feature_defines[feature]:
+            print("\t{0}: {1} => {2}".format(feature, feature_defines[feature], value))
+        feature_defines[feature] = value
+
+def write_file_if_contents_changed(filename, contents):
+    if os.path.exists(filename):
+        with open(filename, 'r') as f:
+            old_contents = f.read()
+        if old_contents == contents:
+            return
+    with open(filename, 'w') as f:
+        f.write(contents)
+
+def write_feature_defines_header(feature_defines):
+    contents = ''
+    for (feature, value) in feature_defines.iteritems():
+        contents += '#define {0} {1}\n'.format(feature, value)
+    write_file_if_contents_changed("WebKitFeatures.h", contents)
+
+def write_flattened_feature_defines_file(feature_defines):
+    contents = ''
+    for (feature, value) in feature_defines.iteritems():
+        contents += '{0}={1}\n'.format(feature, value)
+    write_file_if_contents_changed("WebKitFeatures.txt", contents)
+
+def generate_feature_defines_files(default_features):
+    build_dir = os.getcwd()
+    feature_defines = {}
+
+    for feature_define in default_features:
+        (feature, value) = feature_define.split("=")
+        feature_defines[feature] = int(value)
+
+    read_feature_defines_override(feature_defines)
+    write_feature_defines_header(feature_defines)
+    write_flattened_feature_defines_file(feature_defines)
+
+if __name__=='__main__':
+    generate_feature_defines_files(sys.argv[1:])
diff --git a/Tools/gtk/override-feature-defines b/Tools/gtk/override-feature-defines
deleted file mode 100755 (executable)
index 6b09ece..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/env python
-
-import os
-import re
-import shutil
-import sys
-
-def copy_feature_defines_makefile():
-    src_path = os.path.join('Source', 'WebCore', 'GNUmakefile.features.am.in')
-    dest_path = os.path.join('Source', 'WebCore', 'GNUmakefile.features.am')
-    shutil.copy(src_path, dest_path)
-
-def adjust_feature_defines_makefile(build_dir, feature_defines_overriding):
-    feature_defines_makefile_file = os.path.join('Source', 'WebCore', 'GNUmakefile.features.am')
-    with open(feature_defines_makefile_file) as f:
-        feature_defines_makefile = f.read()
-
-    overridden_feature_defines = {}
-    def override_feature_define(match):
-        feature_define = match.group('feature')
-        if feature_define not in feature_defines_overriding:
-            return match.string[match.start():match.end()]
-
-        default_value = int(match.group('default_value'))
-        overriding_value = feature_defines_overriding[feature_define]
-        if default_value is not overriding_value:
-            overridden_feature_defines[feature_define] = default_value, overriding_value
-        return "%s=%d" % (feature_define, overriding_value)
-
-    feature_defines_makefile = re.sub(r"(?P<feature>(?:ENABLE_)\w+)=(?P<default_value>0|1)", override_feature_define, feature_defines_makefile)
-    with open(feature_defines_makefile_file, 'w') as f:
-        f.write(feature_defines_makefile)
-
-    if overridden_feature_defines:
-        print("The following feature defines were overriden:")
-        for feature, values in iter(overridden_feature_defines.items()):
-            print("\t{0}: {1} => {2}".format(feature, *values))
-
-def override_feature_defines(build_dir):
-    copy_feature_defines_makefile()
-
-    feature_defines_overriding_file = os.path.join(build_dir, 'feature-defines-overriding.txt')
-    if not os.path.exists(feature_defines_overriding_file):
-        return
-
-    with open(feature_defines_overriding_file) as f:
-        match_iter = re.findall(r"((?:ENABLE_)\w+)=(0|1)", f.read())
-
-    feature_defines_overriding = {}
-    for match in match_iter:
-        feature_defines_overriding[match[0]] = int(match[1])
-
-    adjust_feature_defines_makefile(build_dir, feature_defines_overriding)
-
-if __name__=='__main__':
-    override_feature_defines(sys.argv[1])
index 1ae619a..12c6a4c 100755 (executable)
@@ -12,8 +12,6 @@ rm -f $top_srcdir/autom4te.cache
 
 touch README INSTALL
 
-Tools/gtk/override-feature-defines $ORIGDIR
-
 if test -z `which autoreconf`; then
     echo "Error: autoreconf not found, please install it."
     exit 1
index 0c30ee5..5ecf82d 100644 (file)
@@ -26,6 +26,7 @@ m4_include([Source/autotools/ReadCommandLineArguments.m4])
 m4_include([Source/autotools/FindDependencies.m4])
 m4_include([Source/autotools/SetupCompilerFlags.m4])
 m4_include([Source/autotools/SetupAutoconfHeader.m4])
+m4_include([Source/autotools/SetupWebKitFeatures.m4])
 
 # We would put AM_INIT_AUTOMAKE into SetupAutomake.m4, but seems to cause autoconf errors.
 AM_INIT_AUTOMAKE([foreign subdir-objects dist-xz no-dist-gzip tar-ustar])