diff options
author | Steve Block <steveblock@google.com> | 2011-05-25 19:08:45 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-06-08 13:51:31 +0100 |
commit | 2bde8e466a4451c7319e3a072d118917957d6554 (patch) | |
tree | 28f4a1b869a513e565c7760d0e6a06e7cf1fe95a /Source/gyp | |
parent | 6939c99b71d9372d14a0c74a772108052e8c48c8 (diff) | |
download | external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.zip external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.gz external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.bz2 |
Merge WebKit at r82507: Initial merge by git
Change-Id: I60ce9d780725b58b45e54165733a8ffee23b683e
Diffstat (limited to 'Source/gyp')
-rw-r--r-- | Source/gyp/common.gypi | 6 | ||||
-rwxr-xr-x | Source/gyp/configure | 88 | ||||
-rw-r--r-- | Source/gyp/remove-headers-if-needed.sh | 3 | ||||
-rw-r--r-- | Source/gyp/run-if-exists.sh | 5 | ||||
-rwxr-xr-x | Source/gyp/update-info-plist.sh | 4 |
5 files changed, 72 insertions, 34 deletions
diff --git a/Source/gyp/common.gypi b/Source/gyp/common.gypi index 892009c..d40bd84 100644 --- a/Source/gyp/common.gypi +++ b/Source/gyp/common.gypi @@ -1,10 +1,10 @@ { 'target_defaults': { 'configurations': { - 'Debug': {}, - 'Release': {}, 'Production': {}, + 'Release': {}, + 'Debug': {}, }, - 'default_configuration': 'Debug', + 'default_configuration': 'Production', }, } diff --git a/Source/gyp/configure b/Source/gyp/configure index cd2b126..28d6677 100755 --- a/Source/gyp/configure +++ b/Source/gyp/configure @@ -31,35 +31,85 @@ import os import subprocess +from optparse import OptionParser -PROJECTS = [ - "JavaScriptGlue", - "JavaScriptCore", - "WebCore", -] +def chdir_to_source(): + source_directory = os.path.abspath(os.path.join(__file__, '..', '..')) + os.chdir(source_directory) + +def gyp(): + return os.path.join('ThirdParty', 'gyp', 'gyp') +class Project: + def __init__(self, name): + self._name = name -def create_project(project): - subprocess.call([ - 'gyp', # FIXME: gyp shouldn't need to be in the PATH. - os.path.join(project, 'gyp', project + '.gyp'), - '-G', - 'xcode_list_excluded_files=0', - '--depth=.', - ]) + def name(self): + return self._name + def inputs(self): + return [ + os.path.join(self._name, 'gyp', self._name + '.gyp'), + os.path.join(self._name, self._name + '.gypi'), + os.path.join('gyp', 'common.gypi'), + ] -def create_all_projects(): - for project in PROJECTS: - create_project(project) + def output(self): + return os.path.join(self._name, 'gyp', self._name + '.xcodeproj', 'project.pbxproj') + def should_generate(self): + if not os.path.exists(self.output()): + return True + return os.path.getmtime(self.output()) < self._newest(self.inputs()) + + def generate(self): + subprocess.call([ + gyp(), + self.inputs()[0], + '-G', + 'xcode_list_excluded_files=0', + '--depth=.', + ]) + # GYP doesn't always touch the output file, but we want to touch the + # file so that we don't keep trying to regenerate it. + os.utime(self.output(), None) + + @staticmethod + def _newest(paths): + return max([os.path.getmtime(path) for path in paths]) + +PROJECTS = [ + Project("JavaScriptCore"), + Project("WebCore"), +] + +def projects_to_generate(): + should_generate = [project for project in PROJECTS if project.should_generate()] + already_generated = [project.name() for project in set(PROJECTS) - set(should_generate)] + + if already_generated: + print "Not generating %s because the generated files exist and are newer than the GYP files." % ', '.join(already_generated) + print "Pass --regenerate-projects to override." + + return should_generate def main(): - source_directory = os.path.abspath(os.path.join(__file__, '..', '..')) - os.chdir(source_directory) + chdir_to_source() + + parser = OptionParser() # FIXME: The user should be able to pass which port on the command line. - create_all_projects() + parser.add_option("--regenerate-projects", dest="regenerate_projects", + default=False, action="store_true", + help="Generate all project files even if they appear to be up to date.") + (options, args) = parser.parse_args() + + projects = PROJECTS + if not options.regenerate_projects: + projects = projects_to_generate() + for project in projects: + print "Generating %s." % project.name() + project.generate() if __name__ == "__main__": main() diff --git a/Source/gyp/remove-headers-if-needed.sh b/Source/gyp/remove-headers-if-needed.sh deleted file mode 100644 index 4137859..0000000 --- a/Source/gyp/remove-headers-if-needed.sh +++ /dev/null @@ -1,3 +0,0 @@ -if (( TARGET_MAC_OS_X_VERSION_MAJOR > 1050 )); then - rm -rf \"$BUILT_PRODUCTS_DIR/$PUBLIC_HEADERS_FOLDER_PATH\"/*.h; -fi diff --git a/Source/gyp/run-if-exists.sh b/Source/gyp/run-if-exists.sh deleted file mode 100644 index 242ffc8..0000000 --- a/Source/gyp/run-if-exists.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -if [ -f $1 ]; then - $1 || exit $?; -fi diff --git a/Source/gyp/update-info-plist.sh b/Source/gyp/update-info-plist.sh deleted file mode 100755 index d02ecce..0000000 --- a/Source/gyp/update-info-plist.sh +++ /dev/null @@ -1,4 +0,0 @@ -# Touch Info.plist to let Xcode know it needs to copy it into the built product -if [[ "${CONFIGURATION}" != "Production" ]]; then - touch "$1"; -fi |