Title: [182164] trunk/Source/WebCore
Revision
182164
Author
[email protected]
Date
2015-03-30 16:59:02 -0700 (Mon, 30 Mar 2015)

Log Message

Allow building on Windows without Cygwin
https://bugs.webkit.org/show_bug.cgi?id=143219

Reviewed by Brent Fulgham.

* AVFoundationSupport.py: Renamed from Source/WebCore/WebCore.vcxproj/MigrateScripts.
Move logic from DerivedSources.make to its own script
(lookFor):
* DerivedSources.make: Paths like /usr/bin don't exist on Windows.
Windows uses del instead of rm -f
Windows doesn't have printf
* WebCore.vcxproj/WebCoreGenerated.make: Pass the CC executable to
build-generated-files.pl
* WebCore.vcxproj/build-generated-files.pl: Export the CC executable as an environment
variable. Don't use /usr/bin.
* WebCore.vcxproj/migrate-scripts.pl: Deleted the MigrateScripts makefile. We don't
need a whole Makefile just to copy 5 files. Moved this logic into migrate-scripts.pl.
(copyFile):
* bindings/scripts/preprocessor.pm:
(applyPreprocessor): Support passing preprocessing flags to the Visual Studio
compiler.
* dom/make_names.pl: Ditto.

Modified Paths

Added Paths

Removed Paths

Diff

Copied: trunk/Source/WebCore/AVFoundationSupport.py (from rev 182163, trunk/Source/WebCore/WebCore.vcxproj/MigrateScripts) (0 => 182164)


--- trunk/Source/WebCore/AVFoundationSupport.py	                        (rev 0)
+++ trunk/Source/WebCore/AVFoundationSupport.py	2015-03-30 23:59:02 UTC (rev 182164)
@@ -0,0 +1,42 @@
+#!/usr/bin/python
+
+# Copyright (C) 2015 Apple Inc.  All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+# 3.  Neither the name of Apple puter, Inc. ("Apple") nor the names of
+#     its contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import sys
+import os
+
+
+def lookFor(relativePath):
+    return os.path.isfile(os.environ['WEBKIT_LIBRARIES'] + relativePath) or os.path.isfile(os.environ['WEBKITLIBRARIESDIR'] + relativePath)
+
+print "/* Identifying AVFoundation Support */"
+if lookFor("/include/AVFoundationCF/AVCFBase.h"):
+    print "#define HAVE_AVCF 1"
+if lookFor("/include/AVFoundationCF/AVCFPlayerItemLegibleOutput.h"):
+    print "#define HAVE_AVCF_LEGIBLE_OUTPUT 1"
+if lookFor("/include/AVFoundationCF/AVCFAssetResourceLoader.h"):
+    print "#define HAVE_AVFOUNDATION_LOADER_DELEGATE 1"

Modified: trunk/Source/WebCore/ChangeLog (182163 => 182164)


--- trunk/Source/WebCore/ChangeLog	2015-03-30 23:54:01 UTC (rev 182163)
+++ trunk/Source/WebCore/ChangeLog	2015-03-30 23:59:02 UTC (rev 182164)
@@ -1,3 +1,28 @@
+2015-03-30  Myles C. Maxfield  <[email protected]>
+
+        Allow building on Windows without Cygwin
+        https://bugs.webkit.org/show_bug.cgi?id=143219
+
+        Reviewed by Brent Fulgham.
+
+        * AVFoundationSupport.py: Renamed from Source/WebCore/WebCore.vcxproj/MigrateScripts.
+        Move logic from DerivedSources.make to its own script
+        (lookFor):
+        * DerivedSources.make: Paths like /usr/bin don't exist on Windows.
+        Windows uses del instead of rm -f
+        Windows doesn't have printf
+        * WebCore.vcxproj/WebCoreGenerated.make: Pass the CC executable to
+        build-generated-files.pl
+        * WebCore.vcxproj/build-generated-files.pl: Export the CC executable as an environment
+        variable. Don't use /usr/bin.
+        * WebCore.vcxproj/migrate-scripts.pl: Deleted the MigrateScripts makefile. We don't
+        need a whole Makefile just to copy 5 files. Moved this logic into migrate-scripts.pl.
+        (copyFile):
+        * bindings/scripts/preprocessor.pm:
+        (applyPreprocessor): Support passing preprocessing flags to the Visual Studio
+        compiler.
+        * dom/make_names.pl: Ditto.
+
 2015-03-30  Alexey Proskuryakov  <[email protected]>
 
         Build fix.

Modified: trunk/Source/WebCore/DerivedSources.make (182163 => 182164)


--- trunk/Source/WebCore/DerivedSources.make	2015-03-30 23:54:01 UTC (rev 182163)
+++ trunk/Source/WebCore/DerivedSources.make	2015-03-30 23:59:02 UTC (rev 182164)
@@ -682,13 +682,13 @@
     $(WebCore)/svg/SVGZoomEvent.idl
 #
 
-# Windows has specific needs for specifying the path to its interpreters
+PYTHON = python
+PERL = perl
+
 ifeq ($(OS),Windows_NT)
-    PYTHON = /usr/bin/python
-    PERL = /usr/bin/perl
+    DELETE = cmd //C del
 else
-    PYTHON = python
-    PERL = perl
+    DELETE = rm -f
 endif
 # --------
 
@@ -881,7 +881,7 @@
 XMLViewerCSS.h : xml/XMLViewer.css
 	$(PYTHON) $(InspectorScripts)/cssmin.py <"$(WebCore)/xml/XMLViewer.css" > ./XMLViewer.min.css
 	$(PERL) $(InspectorScripts)/xxd.pl XMLViewer_css ./XMLViewer.min.css XMLViewerCSS.h
-	rm -f ./XMLViewer.min.css
+	$(DELETE) XMLViewer.min.css
 
 # --------
 
@@ -892,7 +892,7 @@
 XMLViewerJS.h : xml/XMLViewer.js
 	$(PYTHON) $(InspectorScripts)/jsmin.py <"$(WebCore)/xml/XMLViewer.js" > ./XMLViewer.min.js
 	$(PERL) $(InspectorScripts)/xxd.pl XMLViewer_js ./XMLViewer.min.js XMLViewerJS.h
-	rm -f ./XMLViewer.min.js
+	$(DELETE) XMLViewer.min.js
 
 # --------
 
@@ -1169,15 +1169,17 @@
 IDL_FILES_TMP = ./idl_files.tmp
 IDL_ATTRIBUTES_FILE = $(WebCore)/bindings/scripts/IDLAttributes.txt
 
-# The following two lines get a space character stored in a variable.
-# See <http://blog.jgc.org/2007/06/escaping-comma-and-space-in-gnu-make.html>.
-space :=
-space +=
+# The following lines get a newline character stored in a variable.
+# See <http://stackoverflow.com/questions/7039811/how-do-i-process-extremely-long-lists-of-files-in-a-make-recipe>.
+define NL
 
+
+endef
+
 $(SUPPLEMENTAL_MAKEFILE_DEPS) : $(PREPROCESS_IDLS_SCRIPTS) $(BINDING_IDLS) $(PLATFORM_FEATURE_DEFINES) DerivedSources.make
-	printf "$(subst $(space),,$(patsubst %,%\n,$(BINDING_IDLS)))" > $(IDL_FILES_TMP)
+	$(foreach f,$(BINDING_IDLS),echo $(f)>>$(IDL_FILES_TMP)$(NL))
 	$(call preprocess_idls_script, $(PREPROCESS_IDLS_SCRIPTS)) --defines "$(FEATURE_DEFINES) $(ADDITIONAL_IDL_DEFINES) LANGUAGE_JAVASCRIPT" --idlFilesList $(IDL_FILES_TMP) --supplementalDependencyFile $(SUPPLEMENTAL_DEPENDENCY_FILE) --windowConstructorsFile $(WINDOW_CONSTRUCTORS_FILE) --workerGlobalScopeConstructorsFile $(WORKERGLOBALSCOPE_CONSTRUCTORS_FILE) --dedicatedWorkerGlobalScopeConstructorsFile $(DEDICATEDWORKERGLOBALSCOPE_CONSTRUCTORS_FILE) --supplementalMakefileDeps $@
-	rm -f $(IDL_FILES_TMP)
+	$(DELETE) $(IDL_FILES_TMP)
 
 JS%.h : %.idl $(JS_BINDINGS_SCRIPTS) $(IDL_ATTRIBUTES_FILE) $(WINDOW_CONSTRUCTORS_FILE) $(WORKERGLOBALSCOPE_CONSTRUCTORS_FILE) $(PLATFORM_FEATURE_DEFINES)
 	$(call generator_script, $(JS_BINDINGS_SCRIPTS)) $(IDL_COMMON_ARGS) --defines "$(FEATURE_DEFINES) $(ADDITIONAL_IDL_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --idlAttributesFile $(IDL_ATTRIBUTES_FILE) --supplementalDependencyFile $(SUPPLEMENTAL_DEPENDENCY_FILE) $<
@@ -1191,7 +1193,7 @@
 InspectorOverlayPage.h : InspectorOverlayPage.html InspectorOverlayPage.css InspectorOverlayPage.js
 	$(PYTHON) $(InspectorScripts)/inline-and-minify-stylesheets-and-scripts.py $(WebCore)/inspector/InspectorOverlayPage.html ./InspectorOverlayPage.combined.html
 	$(PERL) $(InspectorScripts)/xxd.pl InspectorOverlayPage_html ./InspectorOverlayPage.combined.html InspectorOverlayPage.h
-	rm -f ./InspectorOverlayPage.combined.html
+	$(DELETE) InspectorOverlayPage.combined.html
 
 all : CommandLineAPIModuleSource.h
 
@@ -1199,7 +1201,7 @@
 	echo "//# sourceURL=__WebInspectorCommandLineAPIModuleSource__" > ./CommandLineAPIModuleSource.min.js
 	$(PYTHON) $(InspectorScripts)/jsmin.py <$(WebCore)/inspector/CommandLineAPIModuleSource.js >> ./CommandLineAPIModuleSource.min.js
 	$(PERL) $(InspectorScripts)/xxd.pl CommandLineAPIModuleSource_js ./CommandLineAPIModuleSource.min.js CommandLineAPIModuleSource.h
-	rm -f ./CommandLineAPIModuleSource.min.js
+	$(DELETE) CommandLineAPIModuleSource.min.js
 
 # Web Replay inputs generator
 
@@ -1269,10 +1271,7 @@
 
 all : WebCoreHeaderDetection.h
 
-WebCoreHeaderDetection.h : DerivedSources.make
-	echo "/* Identifying AVFoundation Support */" > $@
-	if [ -f "$(WEBKIT_LIBRARIES)/include/AVFoundationCF/AVCFBase.h" ]||[ -f "$(WEBKITLIBRARIESDIR)/include/AVFoundationCF/AVCFBase.h" ]; then echo "#define HAVE_AVCF 1" >> $@; else echo >> $@; fi
-	if [ -f "$(WEBKIT_LIBRARIES)/include/AVFoundationCF/AVCFPlayerItemLegibleOutput.h" ]||[ -f "$(WEBKITLIBRARIESDIR)/include/AVFoundationCF/AVCFPlayerItemLegibleOutput.h" ]; then echo "#define HAVE_AVCF_LEGIBLE_OUTPUT 1" >> $@; else echo >> $@; fi
-	if [ -f "$(WEBKIT_LIBRARIES)/include/AVFoundationCF/AVCFAssetResourceLoader.h" ]||[ -f "$(WEBKITLIBRARIESDIR)/include/AVFoundationCF/AVCFAssetResourceLoader.h" ]; then echo "#define HAVE_AVFOUNDATION_LOADER_DELEGATE 1" >> $@; else echo >> $@; fi
+WebCoreHeaderDetection.h : $(WebCore)/AVFoundationSupport.py DerivedSources.make
+	$(PYTHON) $(WebCore)/AVFoundationSupport.py > $@
 
 endif # Windows_NT

Deleted: trunk/Source/WebCore/WebCore.vcxproj/MigrateScripts (182163 => 182164)


--- trunk/Source/WebCore/WebCore.vcxproj/MigrateScripts	2015-03-30 23:54:01 UTC (rev 182163)
+++ trunk/Source/WebCore/WebCore.vcxproj/MigrateScripts	2015-03-30 23:59:02 UTC (rev 182164)
@@ -1,40 +0,0 @@
-# Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1.  Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer. 
-# 2.  Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution. 
-# 3.  Neither the name of Apple Inc. ("Apple") nor the names of
-#     its contributors may be used to endorse or promote products derived
-#     from this software without specific prior written permission. 
-#
-# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
-# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-.PHONY : all
-all : \
-    $(WEBKIT_OUTPUT)/CodeGenerator.pm \
-    $(WEBKIT_OUTPUT)/IDLParser.pm \
-    $(WEBKIT_OUTPUT)/generate-bindings.pl \
-    $(WEBKIT_OUTPUT)/preprocessor.pm \
-    $(WEBKIT_OUTPUT)/preprocess-idls.pl \
-#
-
-MIGRATE_CMD = cp $< $@
-
-# Migrate generation scripts
-$(WEBKIT_OUTPUT)/% : $(WEBCORE)/bindings/scripts/%
-	$(MIGRATE_CMD)

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCoreGenerated.make (182163 => 182164)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCoreGenerated.make	2015-03-30 23:54:01 UTC (rev 182163)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCoreGenerated.make	2015-03-30 23:59:02 UTC (rev 182164)
@@ -3,7 +3,7 @@
     @if errorlevel 1 exit 1
     @echo XXWebCoreGeneratedXX > "%ConfigurationBuildDir%\buildfailed"
 
-    perl build-generated-files.pl "%ConfigurationBuildDir%" "%WebKit_Libraries%" windows "%PlatformArchitecture%"
+    perl build-generated-files.pl "%ConfigurationBuildDir%" "%WebKit_Libraries%" windows "%PlatformArchitecture%" "$(CC)"
     perl migrate-scripts.pl "%ConfigurationBuildDir%\obj%PlatformArchitecture%\WebCore\scripts"
     @cmd /C copyForwardingHeaders.cmd cg cf
     @cmd /C copyWebCoreResourceFiles.cmd

Modified: trunk/Source/WebCore/WebCore.vcxproj/build-generated-files.pl (182163 => 182164)


--- trunk/Source/WebCore/WebCore.vcxproj/build-generated-files.pl	2015-03-30 23:54:01 UTC (rev 182163)
+++ trunk/Source/WebCore/WebCore.vcxproj/build-generated-files.pl	2015-03-30 23:59:02 UTC (rev 182164)
@@ -28,6 +28,7 @@
 
 use strict;
 use Cwd;
+use Config;
 use File::Path qw(make_path);
 use File::Spec;
 
@@ -80,5 +81,11 @@
     $ENV{'PLATFORM_FEATURE_DEFINES'} = File::Spec->catfile($SDKROOT, 'tools', 'vsprops', 'FeatureDefines.props');
 }
 
+if ($Config{osname} eq 'MSWin32') {
+    my $ccPath = `where $ARGV[4]`;
+    chomp($ccPath);
+    $ENV{CC} = $ccPath;
+}
+
 my $DERIVED_SOURCES_MAKEFILE = File::Spec->catfile($XSRCROOT, 'DerivedSources.make');
-system('/usr/bin/make', '-f', $DERIVED_SOURCES_MAKEFILE, '-j', $NUMCPUS) and die "Failed to build $DERIVED_SOURCES_MAKEFILE: $!";
+system('make', '-f', $DERIVED_SOURCES_MAKEFILE, '-j', $NUMCPUS) and die "Failed to build $DERIVED_SOURCES_MAKEFILE: $!";

Modified: trunk/Source/WebCore/WebCore.vcxproj/migrate-scripts.pl (182163 => 182164)


--- trunk/Source/WebCore/WebCore.vcxproj/migrate-scripts.pl	2015-03-30 23:54:01 UTC (rev 182163)
+++ trunk/Source/WebCore/WebCore.vcxproj/migrate-scripts.pl	2015-03-30 23:59:02 UTC (rev 182164)
@@ -28,6 +28,7 @@
 
 use strict;
 use Cwd;
+use File::Copy;
 use File::Path qw(make_path);
 use File::Spec;
 
@@ -60,5 +61,17 @@
 $ENV{'WebCore'} = $XSRCROOT;
 $ENV{'WEBKIT_OUTPUT'} = $XDSTROOT;
 
-my $MIGRATE_SCRIPTS_MAKEFILE = File::Spec->catfile($XSRCROOT, 'WebCore.vcxproj', 'MigrateScripts');
-system('/usr/bin/make', '-f', $MIGRATE_SCRIPTS_MAKEFILE, '-j', $NUMCPUS) and die "Failed to build $MIGRATE_SCRIPTS_MAKEFILE: $!";
+sub copyFile {
+    my $filename = shift;
+    my $source = File::Spec->catfile($XSRCROOT, "bindings", "scripts", $filename);
+    my $destination = File::Spec->catfile($XDSTROOT, $filename);
+    if (! -e $destination || (stat($source))[9] > (stat($destination))[9]) { # 9th element is file modification time
+        copy($source, $destination);
+    }
+}
+
+copyFile("CodeGenerator.pm");
+copyFile("IDLParser.pm");
+copyFile("generate-bindings.pl");
+copyFile("preprocessor.pm");
+copyFile("preprocess-idls.pl");

Modified: trunk/Source/WebCore/bindings/scripts/preprocessor.pm (182163 => 182164)


--- trunk/Source/WebCore/bindings/scripts/preprocessor.pm	2015-03-30 23:54:01 UTC (rev 182163)
+++ trunk/Source/WebCore/bindings/scripts/preprocessor.pm	2015-03-30 23:59:02 UTC (rev 182164)
@@ -54,7 +54,11 @@
         } else {
             $preprocessor = "/usr/bin/gcc";
         }
-        push(@args, qw(-E -P -x c++));
+        if ($Config::Config{"osname"} eq "MSWin32") {
+            push(@args, qw(/EP));
+        } else {
+            push(@args, qw(-E -P -x c++));
+        }
     }
 
     if ($Config::Config{"osname"} eq "darwin") {
@@ -71,7 +75,7 @@
     @macros = map { "-D$_" } @macros;
 
     my $pid = 0;
-    if ($Config{osname} eq "cygwin" || $Config{osname} eq 'MSWin32') {
+    if ($Config{osname} eq "cygwin") {
         # This call can fail if Windows rebases cygwin, so retry a few times until it succeeds.
         for (my $tries = 0; !$pid && ($tries < 20); $tries++) {
             eval {
@@ -84,6 +88,8 @@
                 sleep 1;
             }
         };
+    } elsif ($Config::Config{"osname"} eq "MSWin32") {
+        $pid = open2(\*PP_OUT, \*PP_IN, $preprocessor, @args, @macros, $fileName);
     } else {
         $pid = open2(\*PP_OUT, \*PP_IN, split(' ', $preprocessor), @args, @macros, $fileName);
     }

Modified: trunk/Source/WebCore/dom/make_names.pl (182163 => 182164)


--- trunk/Source/WebCore/dom/make_names.pl	2015-03-30 23:54:01 UTC (rev 182163)
+++ trunk/Source/WebCore/dom/make_names.pl	2015-03-30 23:59:02 UTC (rev 182164)
@@ -62,18 +62,24 @@
 
 require Config;
 
-my $gccLocation = "";
+my $ccLocation = "";
 if ($ENV{CC}) {
-    $gccLocation = $ENV{CC};
+    $ccLocation = $ENV{CC};
 } elsif (($Config::Config{"osname"}) =~ /solaris/i) {
-    $gccLocation = "/usr/sfw/bin/gcc";
+    $ccLocation = "/usr/sfw/bin/gcc";
 } elsif ($Config::Config{"osname"} eq "darwin" && $ENV{SDKROOT}) {
-    chomp($gccLocation = `xcrun -find cc -sdk '$ENV{SDKROOT}'`);
+    chomp($ccLocation = `xcrun -find cc -sdk '$ENV{SDKROOT}'`);
 } else {
-    $gccLocation = "/usr/bin/cc";
+    $ccLocation = "/usr/bin/cc";
 }
-my $preprocessor = $gccLocation . " -E -x c++";
 
+my $preprocessor = "";
+if ($Config::Config{"osname"} eq "MSWin32") {
+    $preprocessor = "\"$ccLocation\" /EP";
+} else {
+    $preprocessor = $ccLocation . " -E -x c++";
+}
+
 GetOptions(
     'tags=s' => \$tagsFile, 
     'attrs=s' => \$attrsFile,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to