Build system prep work for upstreaming iOS changes
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Mar 2012 03:58:35 +0000 (03:58 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Mar 2012 03:58:35 +0000 (03:58 +0000)
<http://webkit.org/b/82267>

Reviewed by Mark Rowe.

* DerivedSources.make: Move 'bison' into a variable and use
xcrun to find it on Mac OS X.
* bindings/scripts/preprocessor.pm:
(applyPreprocessor): Add local @args variable.  On iOS, the
compiler needs additional "-isysroot $(SDKROOT)" arguments when
invoked, so it's easier to add them to an array, especially if
$SDKROOT contains a space in the path.  Remove now-redundant
$gccLocation variable.

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

Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/bindings/scripts/preprocessor.pm

index 13ed8e5..2616dc1 100644 (file)
@@ -1,3 +1,19 @@
+2012-03-26  David Kilzer  <ddkilzer@apple.com>
+
+        Build system prep work for upstreaming iOS changes
+        <http://webkit.org/b/82267>
+
+        Reviewed by Mark Rowe.
+
+        * DerivedSources.make: Move 'bison' into a variable and use
+        xcrun to find it on Mac OS X.
+        * bindings/scripts/preprocessor.pm:
+        (applyPreprocessor): Add local @args variable.  On iOS, the
+        compiler needs additional "-isysroot $(SDKROOT)" arguments when
+        invoked, so it's easier to add them to an array, especially if
+        $SDKROOT contains a space in the path.  Remove now-redundant
+        $gccLocation variable.
+
 2012-03-26  Nate Chapin  <japhet@chromium.org>
 
         Remove duplicate error() impls in CachedResource subclasses
index 94da336..1e4dede 100644 (file)
@@ -728,11 +728,21 @@ ColorData.cpp : platform/ColorData.gperf $(WebCore)/make-hash-tools.pl
 
 # --------
 
+# Path to bison
+
+ifeq ($(OS),MACOS)
+BISON=$(shell xcrun -find bison)
+else
+BISON=bison
+endif
+
+# --------
+
 # CSS grammar
 # NOTE: Older versions of bison do not inject an inclusion guard, so we add one.
 
 CSSGrammar.cpp : css/CSSGrammar.y
-       bison -d -p cssyy $< -o $@
+       $(BISON) -d -p cssyy $< -o $@
        touch CSSGrammar.cpp.h
        touch CSSGrammar.hpp
        echo '#ifndef CSSGrammar_h' > CSSGrammar.h
@@ -747,7 +757,7 @@ CSSGrammar.cpp : css/CSSGrammar.y
 # NOTE: Older versions of bison do not inject an inclusion guard, so we add one.
 
 XPathGrammar.cpp : xml/XPathGrammar.y $(PROJECT_FILE)
-       bison -d -p xpathyy $< -o $@
+       $(BISON) -d -p xpathyy $< -o $@
        touch XPathGrammar.cpp.h
        touch XPathGrammar.hpp
        echo '#ifndef XPathGrammar_h' > XPathGrammar.h
index e1da488..bed7bec 100644 (file)
@@ -40,17 +40,17 @@ sub applyPreprocessor
     my $defines = shift;
     my $preprocessor = shift;
 
+    my @args = ();
     if (!$preprocessor) {
         require Config;
-        my $gccLocation = "";
         if ($ENV{CC}) {
-            $gccLocation = $ENV{CC};
+            $preprocessor = $ENV{CC};
         } elsif (($Config::Config{'osname'}) =~ /solaris/i) {
-            $gccLocation = "/usr/sfw/bin/gcc";
+            $preprocessor = "/usr/sfw/bin/gcc";
         } else {
-            $gccLocation = "/usr/bin/gcc";
+            $preprocessor = "/usr/bin/gcc";
         }
-        $preprocessor = $gccLocation . " -E -P -x c++";
+        push(@args, qw(-E -P -x c++));
     }
 
     # Remove double quotations from $defines and extract macros.
@@ -60,7 +60,7 @@ sub applyPreprocessor
     my @macros = grep { $_ } split(/\s+/, $defines); # grep skips empty macros.
     @macros = map { "-D$_" } @macros;
 
-    my $pid = open2(\*PP_OUT, \*PP_IN, split(' ', $preprocessor), @macros, $fileName);
+    my $pid = open2(\*PP_OUT, \*PP_IN, split(' ', $preprocessor), @args, @macros, $fileName);
     close PP_IN;
     my @documentContent = <PP_OUT>;
     close PP_OUT;