https://bugs.webkit.org/show_bug.cgi?id=99271
Reviewed by Gustavo Noronha Silva.
.:
The autogen.sh script now calls the Tools/gtk/override-feature-defines script
before calling autoreconf. This ensures that Source/WebCore/GNUmakefile.features.am
is present and properly modified if the build-webkit script intends to override
any feature.
The Source/WebCore/GNUmakefile.features.am file is added to the ignored files list
so it doesn't pop out as a new, untracked file.
* .gitignore:
* autogen.sh:
Source/WebCore:
Move the contents of GNUmakefile.features.am into GNUmakefile.features.am.in.
The former is then copied from the latter but then appropriately modified if
the build-webkit script overrides any of the default feature defines.
No new tests - no new testable functionality.
* GNUmakefile.features.am.in: Renamed from Source/WebCore/GNUmakefile.features.am.
Tools:
Refactor the code in webkitdirs.pm that builds an autotools project to generate
autogen.sh arguments, make arguments and installation prefix from the passed-in
parameters rather than generating all of that in build-webkit. The autogen.sh
arguments now contain only enable/disable flags for options that are actually
configurable in configure.ac, the flag value actually reflecting whether the feature
is enabled or disabled in the feature list.
Other features are overridable through modifying the GNUmakefile.features.am file.
All these features are now stored in the build directory and upon change trigger
a rerun of the autogen.sh script, pretty much like the autogen.sh arguments do.
The override-feature-defines script is called by autogen.sh, before GNUmakefile.in is
generated when calling autoreconf. Its task is to copy the GNUmakefile.features.am.in
into GNUmakefile.features.am and modify it if there's a text file in the build directory
that contains all the feature defines the build-webkit script has written. If the build
is not done through build-webkit (and there's no file in build directory listing all the
feature defines) the script does not advance further from copying.
This approach is taken to overcome the rigidness of the automake system as it's impossible
to effectively generate and use GNUmakefile.features.am or even GNUmakefile.features file
after the autoreconf command execution in autogen.sh.
* Scripts/build-jsc:
(buildMyProject):
* Scripts/build-webkit:
* Scripts/webkitdirs.pm:
(runAutogenForAutotoolsProjectIfNecessary):
(mustReRunAutogen):
(buildAutotoolsProject):
(buildGtkProject):
* Scripts/webkitperl/FeatureList.pm: Update the features that are currently enabled in
Source/WebCore/GNUmakefile.features.am.in but aren't in the feature list.
* Scripts/webkitpy/style/checker.py: Source/WebCore/GNUmakefile.features.am.in is recognized
as a text file and tabulation errors are reported. Skip the file to suppress them.
* gtk/override-feature-defines: Added.
(copy_feature_defines_makefile):
(adjust_feature_defines_makefile):
(adjust_feature_defines_makefile.override_feature_define):
(override_feature_defines):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@137270
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
/Source/autotools/ltversion.m4
/Source/autotools/lt~obsolete.m4
/Source/autotools/missing
+/Source/WebCore/GNUmakefile.features.am
/Source/WebKit/gtk/docs/GNUmakefile.in
/Source/WebKit/gtk/po/*.pot
/autotoolsconfig.h.in
+2012-12-11 Zan Dobersek <zandobersek@gmail.com>
+
+ [GTK] Feature enabling/disabling should be possible through build-webkit
+ https://bugs.webkit.org/show_bug.cgi?id=99271
+
+ Reviewed by Gustavo Noronha Silva.
+
+ The autogen.sh script now calls the Tools/gtk/override-feature-defines script
+ before calling autoreconf. This ensures that Source/WebCore/GNUmakefile.features.am
+ is present and properly modified if the build-webkit script intends to override
+ any feature.
+
+ The Source/WebCore/GNUmakefile.features.am file is added to the ignored files list
+ so it doesn't pop out as a new, untracked file.
+
+ * .gitignore:
+ * autogen.sh:
+
2012-12-10 Martin Robinson <mrobinson@igalia.com>
[GTK] Remove the Pango backend
+2012-12-11 Zan Dobersek <zandobersek@gmail.com>
+
+ [GTK] Feature enabling/disabling should be possible through build-webkit
+ https://bugs.webkit.org/show_bug.cgi?id=99271
+
+ Reviewed by Gustavo Noronha Silva.
+
+ Move the contents of GNUmakefile.features.am into GNUmakefile.features.am.in.
+ The former is then copied from the latter but then appropriately modified if
+ the build-webkit script overrides any of the default feature defines.
+
+ No new tests - no new testable functionality.
+
+ * GNUmakefile.features.am.in: Renamed from Source/WebCore/GNUmakefile.features.am.
+
2012-12-11 Jinwoo Song <jinwoo7.song@samsung.com>
[QT][EFL][WK2] Move the GraphicsSurfaceGLX.cpp to common place
+2012-12-11 Zan Dobersek <zandobersek@gmail.com>
+
+ [GTK] Feature enabling/disabling should be possible through build-webkit
+ https://bugs.webkit.org/show_bug.cgi?id=99271
+
+ Reviewed by Gustavo Noronha Silva.
+
+ Refactor the code in webkitdirs.pm that builds an autotools project to generate
+ autogen.sh arguments, make arguments and installation prefix from the passed-in
+ parameters rather than generating all of that in build-webkit. The autogen.sh
+ arguments now contain only enable/disable flags for options that are actually
+ configurable in configure.ac, the flag value actually reflecting whether the feature
+ is enabled or disabled in the feature list.
+
+ Other features are overridable through modifying the GNUmakefile.features.am file.
+ All these features are now stored in the build directory and upon change trigger
+ a rerun of the autogen.sh script, pretty much like the autogen.sh arguments do.
+
+ The override-feature-defines script is called by autogen.sh, before GNUmakefile.in is
+ generated when calling autoreconf. Its task is to copy the GNUmakefile.features.am.in
+ into GNUmakefile.features.am and modify it if there's a text file in the build directory
+ that contains all the feature defines the build-webkit script has written. If the build
+ is not done through build-webkit (and there's no file in build directory listing all the
+ feature defines) the script does not advance further from copying.
+
+ This approach is taken to overcome the rigidness of the automake system as it's impossible
+ to effectively generate and use GNUmakefile.features.am or even GNUmakefile.features file
+ after the autoreconf command execution in autogen.sh.
+
+ * Scripts/build-jsc:
+ (buildMyProject):
+ * Scripts/build-webkit:
+ * Scripts/webkitdirs.pm:
+ (runAutogenForAutotoolsProjectIfNecessary):
+ (mustReRunAutogen):
+ (buildAutotoolsProject):
+ (buildGtkProject):
+ * Scripts/webkitperl/FeatureList.pm: Update the features that are currently enabled in
+ Source/WebCore/GNUmakefile.features.am.in but aren't in the feature list.
+ * Scripts/webkitpy/style/checker.py: Source/WebCore/GNUmakefile.features.am.in is recognized
+ as a text file and tabulation errors are reported. Skip the file to suppress them.
+ * gtk/override-feature-defines: Added.
+ (copy_feature_defines_makefile):
+ (adjust_feature_defines_makefile):
+ (adjust_feature_defines_makefile.override_feature_define):
+ (override_feature_defines):
+
2012-12-10 Yury Semikhatsky <yurys@chromium.org>
Memory instrumentation: make sure each edge is reported only once
$result = buildVisualStudioProject("$projectName.vcproj/$projectName.sln");
} elsif (isGtk()) {
checkForArgumentAndRemoveFromARGV("--gtk");
- $result = buildGtkProject($projectName, 0, @ARGV);
+ $result = buildGtkProject($projectName, 0);
} elsif (isWx()) {
# Builds everything in one-shot. No need to build anything here.
$result = 0;
my @options = ();
-# enable autotool options accordingly
-if (isGtk()) {
- @options = @ARGV;
- foreach (@features) {
- push @options, autotoolsFlag(${$_->{value}}, $_->{option});
- }
-
- push @options, "--prefix=" . $prefixPath if defined($prefixPath);
- push @options, "--makeargs=" . $makeArgs if $makeArgs;
-} elsif (isAppleMacWebKit()) {
+if (isAppleMacWebKit()) {
push @options, XcodeOptions();
sub option($$$)
my $project = basename($dir);
if (isGtk()) {
- if ($noWebKit2) {
- unshift(@options, "--disable-webkit2");
- }
- $result = buildGtkProject($project, $clean, @options);
+ $result = buildGtkProject($project, $clean, $prefixPath, $makeArgs, $noWebKit2, @features);
} elsif (isAppleMacWebKit()) {
my @local_options = @options;
push @local_options, XcodeCoverageSupportOptions() if $coverageSupport && $project ne "ANGLE";
sub runAutogenForAutotoolsProjectIfNecessary($@)
{
- my ($dir, $prefix, $sourceDir, $project, @buildArgs) = @_;
+ my ($dir, $prefix, $sourceDir, $project, $joinedOverridableFeatures, @buildArgs) = @_;
+
+ my $joinedBuildArgs = join(" ", @buildArgs);
- my $argumentsFile = "previous-autogen-arguments.txt";
if (-e "GNUmakefile") {
# Just assume that build-jsc will never be used to reconfigure JSC. Later
# we can go back and make this more complicated if the demand is there.
return;
}
- # We only run autogen.sh again if the arguments passed have changed.
- if (!mustReRunAutogen($sourceDir, $argumentsFile, @buildArgs)) {
+ # 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)
+ && !mustReRunAutogen($sourceDir, "previous-autogen-arguments.txt", $joinedBuildArgs)) {
return;
}
}
# 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(AUTOTOOLS_ARGUMENTS, ">$argumentsFile");
- print AUTOTOOLS_ARGUMENTS join(" ", @buildArgs);
+ open(OVERRIDABLE_FEATURES, ">feature-defines-overriding.txt");
+ print OVERRIDABLE_FEATURES $joinedOverridableFeatures;
+ close(OVERRIDABLE_FEATURES);
+
+ open(AUTOTOOLS_ARGUMENTS, ">previous-autogen-arguments.txt");
+ print AUTOTOOLS_ARGUMENTS $joinedBuildArgs;
close(AUTOTOOLS_ARGUMENTS);
}
sub mustReRunAutogen($@)
{
- my ($sourceDir, $filename, @currentArguments) = @_;
+ my ($sourceDir, $filename, $currentContents) = @_;
if (! -e $filename) {
return 1;
}
- open(AUTOTOOLS_ARGUMENTS, $filename);
- chomp(my $previousArguments = <AUTOTOOLS_ARGUMENTS>);
- close(AUTOTOOLS_ARGUMENTS);
+ open(CONTENTS_FILE, $filename);
+ chomp(my $previousContents = <CONTENTS_FILE>);
+ close(CONTENTS_FILE);
# We only care about the WebKit2 argument when we are building WebKit itself.
# build-jsc never passes --enable-webkit2, so if we didn't do this, autogen.sh
# would run for every single build on the bots, since it runs both build-webkit
# and build-jsc.
- my $joinedCurrentArguments = join(" ", @currentArguments);
- if ($previousArguments ne $joinedCurrentArguments) {
- print "Previous autogen arguments were: $previousArguments\n\n";
- print "New autogen arguments are: $joinedCurrentArguments\n";
+ if ($previousContents ne $currentContents) {
+ print "Contents for file $filename have changed.\n";
+ print "Previous contents were: $previousContents\n\n";
+ print "New contents are: $currentContents\n";
return 1;
}
sub buildAutotoolsProject($@)
{
- my ($project, $clean, @buildParams) = @_;
+ my ($project, $clean, $prefix, $makeArgs, $noWebKit2, @features) = @_;
my $make = 'make';
my $dir = productDir();
my $config = passedConfiguration() || configuration();
- my $prefix;
# Use rm to clean the build directory since distclean may miss files
if ($clean && -d $dir) {
return 0;
}
- my @buildArgs = ();
- my $makeArgs = $ENV{"WebKitMakeArguments"} || "";
- for my $i (0 .. $#buildParams) {
- my $opt = $buildParams[$i];
- if ($opt =~ /^--makeargs=(.*)/i ) {
- $makeArgs = $makeArgs . " " . $1;
- } elsif ($opt =~ /^--prefix=(.*)/i ) {
- $prefix = $1;
+ my @buildArgs = @ARGV;
+ if ($noWebKit2) {
+ unshift(@buildArgs, "--disable-webkit2");
+ }
+
+ # Configurable features listed here should be kept in sync with the
+ # features for which there exists a configuration option in configure.ac.
+ my %configurableFeatures = (
+ "filters" => 1,
+ "gamepad" => 1,
+ "geolocation" => 1,
+ "indexed-database" => 1,
+ "media-stream" => 1,
+ "svg" => 1,
+ "svg-fonts" => 1,
+ "video" => 1,
+ "webgl" => 1,
+ "web-audio" => 1,
+ "xslt" => 1,
+ );
+ my @overridableFeatures = ();
+ foreach (@features) {
+ if ($configurableFeatures{$_->{option}}) {
+ push @buildArgs, autotoolsFlag(${$_->{value}}, $_->{option});;
} else {
- push @buildArgs, $opt;
+ push @overridableFeatures, $_->{define} . "=" . (${$_->{value}} ? "1" : "0");
}
}
+ $makeArgs = $makeArgs || "";
+ $makeArgs = $makeArgs . " " . $ENV{"WebKitMakeArguments"} if $ENV{"WebKitMakeArguments"};
+
# Automatically determine the number of CPUs for make only
# if make arguments haven't already been specified.
if ($makeArgs eq "") {
# If GNUmakefile exists, don't run autogen.sh unless its arguments
# have changed. The makefile should be smart enough to track autotools
# dependencies and re-run autogen.sh when build files change.
- runAutogenForAutotoolsProjectIfNecessary($dir, $prefix, $sourceDir, $project, @buildArgs);
+ my $joinedOverridableFeatures = join(" ", @overridableFeatures);
+ runAutogenForAutotoolsProjectIfNecessary($dir, $prefix, $sourceDir, $project, $joinedOverridableFeatures, @buildArgs);
my $runWithJhbuild = jhbuildWrapperPrefixIfNeeded();
if (system("$runWithJhbuild $make $makeArgs") ne 0) {
sub buildGtkProject
{
- my ($project, $clean, @buildArgs) = @_;
+ my ($project, $clean, $prefix, $makeArgs, $noWebKit2, @features) = @_;
if ($project ne "WebKit" and $project ne "JavaScriptCore" and $project ne "WTF") {
die "Unsupported project: $project. Supported projects: WebKit, JavaScriptCore, WTF\n";
}
- return buildAutotoolsProject($project, $clean, @buildArgs);
+ return buildAutotoolsProject($project, $clean, $prefix, $makeArgs, $noWebKit2, @features);
}
sub buildChromiumMakefile($$@)
define => "ENABLE_CSS3_CONDITIONAL_RULES", default => 0, value => \$css3ConditionalRulesSupport },
{ option => "css3-text", desc => "Toggle CSS3 Text support",
- define => "ENABLE_CSS3_TEXT", default => isEfl(), value => \$css3TextSupport },
+ define => "ENABLE_CSS3_TEXT", default => (isEfl() || isGtk()), value => \$css3TextSupport },
{ option => "css-box-decoration-break", desc => "Toggle CSS box-decoration-break support",
define => "ENABLE_CSS_BOX_DECORATION_BREAK", default => 1, value => \$cssBoxDecorationBreakSupport },
define => "ENABLE_MEDIA_STATISTICS", default => 0, value => \$mediaStatisticsSupport },
{ option => "media-stream", desc => "Toggle Media Stream support",
- define => "ENABLE_MEDIA_STREAM", default => (isChromium() || isGtk() || isBlackBerry()), value => \$mediaStreamSupport },
+ define => "ENABLE_MEDIA_STREAM", default => (isChromium() || isBlackBerry()), value => \$mediaStreamSupport },
{ option => "meter-tag", desc => "Toggle Meter Tag support",
define => "ENABLE_METER_ELEMENT", default => !isAppleWinWebKit(), value => \$meterTagSupport },
define => "ENABLE_SQL_DATABASE", default => 1, value => \$sqlDatabaseSupport },
{ option => "style-scoped", desc => "Toggle Style Scoped support",
- define => "ENABLE_STYLE_SCOPED", default => isBlackBerry(), value => \$styleScopedSupport },
+ define => "ENABLE_STYLE_SCOPED", default => (isBlackBerry() || isGtk()), value => \$styleScopedSupport },
{ option => "svg", desc => "Toggle SVG support",
define => "ENABLE_SVG", default => 1, value => \$svgSupport },
# with FileType.NONE are automatically skipped without warning.
_SKIPPED_FILES_WITHOUT_WARNING = [
"LayoutTests" + os.path.sep,
+ # Prevents this being recognized as a text file.
+ "Source/WebCore/GNUmakefile.features.am.in",
]
# Extensions of files which are allowed to contain carriage returns.
--- /dev/null
+#!/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()
+
+ overriden_feature_defines = []
+ def override_feature_define(match):
+ matched_feature_define = match.group('feature')
+ if matched_feature_define not in feature_defines_overriding:
+ return match.string[match.start():match.end()]
+
+ if int(match.group('default_value')) is not feature_defines_overriding[matched_feature_define]:
+ overriden_feature_defines.append(matched_feature_define)
+ return "%s=%d" % (matched_feature_define, feature_defines_overriding[matched_feature_define])
+
+ 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 overriden_feature_defines:
+ print "The following feature defines were overriden:\n%s" % ', '.join(overriden_feature_defines)
+
+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])
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