[webkit-reviews] some build script improvements
Darin Adler
darin at apple.com
Wed Jun 8 22:46:44 PDT 2005
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebKitTools/ChangeLog,v
retrieving revision 1.13
diff -p -u -u -p -r1.13 ChangeLog
--- ChangeLog 8 Jun 2005 09:00:52 -0000 1.13
+++ ChangeLog 9 Jun 2005 05:26:49 -0000
@@ -1,3 +1,19 @@
+2005-06-08 Darin Adler <darin at apple.com>
+
+ Reviewed by NOBODY (OOPS!).
+
+ - some build script enhancements
+
+ * Scripts/build-dumprendertree: Changed to use webkitdirs.
+ * Scripts/build-webkit: Changed to use webkitdirs, also only
copy files from WebKitLibraries if
+ they are newer.
+ * Scripts/run-safari: Reduce number of log messages, change
to respect "-d" flag and get Development
+ before Deplyment in that case.
+ * Scripts/run-webkit-tests: Changed to use webkitdirs.
+ * Scripts/update-webkit: Changed to use webkitdirs.
+
+ * Scripts/webkitdirs.pm: Added.
+
2005-06-08 Maciej Stachowiak <mjs at apple.com>
Code change by Toby Peterson <toby at opendarwin.org>
Index: Scripts/build-dumprendertree
===================================================================
RCS file: /cvs/root/WebKitTools/Scripts/build-dumprendertree,v
retrieving revision 1.3
diff -p -u -u -p -r1.3 Scripts/build-dumprendertree
--- Scripts/build-dumprendertree 8 Jun 2005 00:27:05 -0000 1.3
+++ Scripts/build-dumprendertree 9 Jun 2005 05:26:49 -0000
@@ -31,24 +31,10 @@
# Currently only works for the Deployment build style.
use strict;
+use webkitdirs;
-# Check that we're in the right directory.
-if (! -d "WebKitTools") {
- if (-d "../WebKitTools") {
- chdir ".." or die;
- }
- if (! -d "WebKitTools") {
- die "No WebKitTools directory found. Please run this script
from the directory containing WebKitTools.\n";
- }
-}
-
-# Check that an Xcode product directory is set.
-open PRODUCT, "defaults read com.apple.Xcode PBXProductDirectory 2> /
dev/null |" or die;
-my $productDir = <PRODUCT>;
-close PRODUCT;
-if (!$productDir) {
- die "No product directory set. Please set the 'Place Build
Products' preference to 'Customized location' in XCode Building
Preferences.\n";
-}
+chdirWebKit();
+my $productDir = productDir();
# Build
chdir "WebKitTools/DumpRenderTree" or die;
Index: Scripts/build-webkit
===================================================================
RCS file: /cvs/root/WebKitTools/Scripts/build-webkit,v
retrieving revision 1.6
diff -p -u -u -p -r1.6 Scripts/build-webkit
--- Scripts/build-webkit 7 Jun 2005 21:58:56 -0000 1.6
+++ Scripts/build-webkit 9 Jun 2005 05:26:49 -0000
@@ -30,30 +30,15 @@
use strict;
use Getopt::Long;
+use webkitdirs;
my $debug = 0;
GetOptions("debug!" => \$debug);
my $style = $debug ? "Development" : "Deployment";
-# Check that we're in the right directory.
-if (! -d "WebKitTools") {
- if (-d "../WebKitTools") {
- chdir ".." or die;
- }
- if (! -d "WebKitTools") {
- die "No WebKitTools directory found. Please run this script
from the directory containing WebKitTools.\n";
- }
-}
-
-# Check that an Xcode product directory is set.
-open PRODUCT, "defaults read com.apple.Xcode PBXProductDirectory 2> /
dev/null |" or die;
-my $productDir = <PRODUCT>;
-chomp $productDir;
-close PRODUCT;
-if (!$productDir) {
- die "No product directory set. Please set the 'Place Build
Products' preference to 'Customized location' in XCode Building
Preferences.\n";
-}
+chdirWebKit();
+my $productDir = productDir();
# Check that all the project directories are there.
my @projects = ("JavaScriptCore", "WebCore", "WebKit");
@@ -65,13 +50,20 @@ for my $dir (@projects, @otherDirs) {
}
# Copy library and header from WebKitLibraries to a findable place
in the product directory.
-chdir "WebKitLibraries" or die;
-print "${productDir}/libWebKitSystemInterface.a\n";
-`ditto libWebKitSystemInterface.a "${productDir}/
libWebKitSystemInterface.a"`;
-`ranlib "${productDir}/libWebKitSystemInterface.a"`;
-`mkdir -p "${productDir}/usr/local/include"`;
-`ditto WebKitSystemInterface.h "${productDir}/usr/local/include/
WebKitSystemInterface.h"`;
-chdir ".." or die;
+my $srcLib = "WebKitLibraries/libWebKitSystemInterface.a";
+my $lib = "${productDir}/libWebKitSystemInterface.a";
+if (!-e $lib || -M $lib > -M $srcLib) {
+ print "Updating $lib\n";
+ system "ditto", $srcLib, $lib;
+ system "ranlib", $lib;
+}
+my $srcHeader = "WebKitLibraries/WebKitSystemInterface.h";
+my $header = "${productDir}/usr/local/include/WebKitSystemInterface.h";
+if (!-e $header || -M $header > -M $srcHeader) {
+ print "Updating $header\n";
+ system "mkdir", "-p", "${productDir}/usr/local/include";
+ system "ditto", $srcHeader, $header;
+}
# Make symlinks so Xcode 2.1 can find the WebKitLibraries files.
`mkdir -p "${productDir}/${style}"`;
Index: Scripts/run-safari
===================================================================
RCS file: /cvs/root/WebKitTools/Scripts/run-safari,v
retrieving revision 1.4
diff -p -u -u -p -r1.4 Scripts/run-safari
--- Scripts/run-safari 8 Jun 2005 09:00:52 -0000 1.4
+++ Scripts/run-safari 9 Jun 2005 05:26:49 -0000
@@ -26,24 +26,18 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# Simplified build script for Web Kit Open Source Project.
+# Simplified "run" script for Web Kit Open Source Project.
use strict;
use Getopt::Long;
+use webkitdirs;
my $debug = 0;
GetOptions("debug!" => \$debug);
-# Check that an Xcode product directory is set.
-open PRODUCT, "defaults read com.apple.Xcode PBXProductDirectory 2> /
dev/null |" or die;
-my $productDir = <PRODUCT>;
-chomp $productDir;
-close PRODUCT;
-if (!$productDir) {
- die "No product directory set. Please set the 'Place Build
Products' preference to 'Customized location' in XCode Building
Preferences.\n";
-}
+my $productDir = productDir();
-# Check to see that Safari is there.
+# Check to see that Safari is in the usual place.
my $safariPath = "/Applications/Safari.app/Contents/MacOS/Safari";
if (! -x $safariPath) {
die "Can't find executable at $safariPath.\n";
@@ -51,32 +45,23 @@ if (! -x $safariPath) {
# Search for build products; first test Xcode 2.0 location, then
Xcode 2.1 locations.
# For Xcode 2.1, prefer Deployment if both directories are present.
-my @testDirs = ( "$productDir", "$productDir/Deployment",
"$productDir/Development" );
+my @testDirs;
+if ($debug) {
+ @testDirs = ("$productDir", "$productDir/Deployment",
"$productDir/Development");
+} else {
+ @testDirs = ("$productDir", "$productDir/Development",
"$productDir/Deployment");
+}
my $found = 0;
for my $testDir (@testDirs) {
- # Check to see that frameworks are there.
- print "Looking for frameworks in $testDir ...\n";
-
- if (! -x "$testDir/JavaScriptCore.framework/Versions/A/
JavaScriptCore") {
- print "Can't find executable at $testDir/
JavaScriptCore.framework/Versions/A/JavaScriptCore\n";
- next;
- }
- if (! -x "$testDir/WebCore.framework/Versions/A/WebCore") {
- print "Can't find executable at $testDir/WebCore.framework/
Versions/A/WebCore\n";
- next;
- }
- if (! -x "$testDir/WebKit.framework/Versions/A/WebKit") {
- print "Can't find executable at $testDir/WebKit.framework/
Versions/A/WebKit\n";
- next;
- }
-
- print "Built frameworks found in $testDir\n";
- $productDir = $testDir;
- $found = 1;
- last;
+ next if !-x "$testDir/JavaScriptCore.framework/Versions/A/
JavaScriptCore";
+ next if !-x "$testDir/WebCore.framework/Versions/A/WebCore";
+ next if !-x "$testDir/WebKit.framework/Versions/A/WebKit";
+ $productDir = $testDir;
+ $found = 1;
+ last;
}
if (!$found) {
- die "Could not locate frameworks.\n";
+ die "Could not locate frameworks.\n";
}
# Set up DYLD_FRAMEWORK_PATH to point to the product directory.
Index: Scripts/run-webkit-tests
===================================================================
RCS file: /cvs/root/WebKitTools/Scripts/run-webkit-tests,v
retrieving revision 1.4
diff -p -u -u -p -r1.4 Scripts/run-webkit-tests
--- Scripts/run-webkit-tests 7 Jun 2005 22:45:57 -0000 1.4
+++ Scripts/run-webkit-tests 9 Jun 2005 05:26:49 -0000
@@ -30,6 +30,7 @@
use strict;
use IPC::Open2;
+use webkitdirs;
# Run all the tests passed in on the command line.
# If no tests are passed, find all the .html, .xml, and .xhtml
files in the test directory.
@@ -44,24 +45,8 @@ use IPC::Open2;
# the number of tests that failed to run
# the number of tests that were run but had no expected results
to compare against
-# Check that we're in the right directory.
-if (! -d "WebKitTools") {
- if (-d "../WebKitTools") {
- chdir ".." or die;
- }
- if (! -d "WebKitTools") {
- die "No WebKitTools directory found. Please run this script
from the directory containing WebKitTools.\n";
- }
-}
-
-# Check that an Xcode product directory is set.
-open PRODUCT, "defaults read com.apple.Xcode PBXProductDirectory 2> /
dev/null |" or die;
-my $productDir = <PRODUCT>;
-chomp $productDir;
-close PRODUCT;
-if (!$productDir) {
- die "No product directory set. Please set the 'Place Build
Products' preference to 'Customized location' in XCode Building
Preferences.\n";
-}
+chdirWebKit();
+my $productDir = productDir();
my $result = system "WebKitTools/Scripts/build-dumprendertree";
exit $result if $result;
Index: Scripts/update-webkit
===================================================================
RCS file: /cvs/root/WebKitTools/Scripts/update-webkit,v
retrieving revision 1.2
diff -p -u -u -p -r1.2 Scripts/update-webkit
--- Scripts/update-webkit 7 Jun 2005 22:02:25 -0000 1.2
+++ Scripts/update-webkit 9 Jun 2005 05:26:49 -0000
@@ -29,16 +29,9 @@
# Update script for Web Kit Open Source Project.
use strict;
+use webkitdirs;
-# Check that we're in the right directory.
-if (! -d "WebKitTools") {
- if (-d "../WebKitTools") {
- chdir ".." or die;
- }
- if (! -d "WebKitTools") {
- die "No WebKitTools directory found. Please run this script
from the directory containing WebKitTools.\n";
- }
-}
+chdirWebKit();
# Read the CVS root out of one project that's guaranteed to already
be checked out.
open ROOT, "WebKitTools/CVS/Root" or die;
Index: Scripts/webkitdirs.pm
===================================================================
RCS file: Scripts/webkitdirs.pm
diff -N Scripts/webkitdirs.pm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Scripts/webkitdirs.pm 9 Jun 2005 05:26:49 -0000
@@ -0,0 +1,71 @@
+# Copyright (C) 2005 Apple Computer, 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 Computer, 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.
+
+# Module to share code to get to WebKit directories.
+
+use strict;
+use warnings;
+
+BEGIN {
+ use Exporter ();
+ our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
+ $VERSION = 1.00;
+ @ISA = qw(Exporter);
+ @EXPORT = qw(&chdirWebKit &productDir);
+ %EXPORT_TAGS = ( );
+ @EXPORT_OK = ();
+}
+
+our @EXPORT_OK;
+
+# Check that we're in the right directory.
+sub chdirWebKit
+{
+ if (! -d "WebKitTools") {
+ if (-d "../WebKitTools") {
+ chdir ".." or die;
+ }
+ if (-d "../../WebKitTools") {
+ chdir "../.." or die;
+ }
+ if (! -d "WebKitTools") {
+ die "No WebKitTools directory found. Please run this
script from the directory containing WebKitTools.\n";
+ }
+ }
+}
+
+# Check that an Xcode product directory is set.
+sub productDir
+{
+ open PRODUCT, "defaults read com.apple.Xcode PBXProductDirectory
2> /dev/null |" or die;
+ my $productDir = <PRODUCT>;
+ chomp $productDir;
+ close PRODUCT;
+ $productDir = $ENV{HOME} . "/WebKitBuilds" unless $productDir;
+ return $productDir;
+}
+
+1;
More information about the webkit-reviews
mailing list