Commit cb59cb58 authored by eric@webkit.org's avatar eric@webkit.org

2011-04-07 Eric Seidel <eric@webkit.org>

        Reviewed by Adam Barth.

        Add stub support for generating Gtk build system from gyp
        https://bugs.webkit.org/show_bug.cgi?id=58086

        This adds support for a new --port argument and plumbs through
        the necessary paths to allow generating for a port other than Mac.

        * Source/gyp/configure:
2011-04-07  Eric Seidel  <eric@webkit.org>

        Reviewed by Adam Barth.

        Add stub support for generating Gtk build system from gyp
        https://bugs.webkit.org/show_bug.cgi?id=58086

        This does not produce a buildable JavaScriptCore, but it
        does allow running gyp/configure --port=gtk and having
        it generate a gtk.Makefile which we can use for testing
        the rest of the plumbing.

        * gyp/gtk.gyp: Added.
2011-04-07  Eric Seidel  <eric@webkit.org>

        Reviewed by Adam Barth.

        Add stub support for generating Gtk build system from gyp
        https://bugs.webkit.org/show_bug.cgi?id=58086

        This does not produce a buildable WebCore, but it
        does allow running gyp/configure --port=gtk and having
        it generate a gtk.Makefile which we can use for testing
        the rest of the plumbing.

        * gyp/gtk.gyp: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@83225 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 63a58153
2011-04-07 Eric Seidel <eric@webkit.org>
Reviewed by Adam Barth.
Add stub support for generating Gtk build system from gyp
https://bugs.webkit.org/show_bug.cgi?id=58086
This adds support for a new --port argument and plumbs through
the necessary paths to allow generating for a port other than Mac.
* Source/gyp/configure:
2011-04-07 Andrew Scherkus <scherkus@chromium.org>
Revert ENABLE_TRACK patch due to compile failures.
......
2011-04-07 Eric Seidel <eric@webkit.org>
Reviewed by Adam Barth.
Add stub support for generating Gtk build system from gyp
https://bugs.webkit.org/show_bug.cgi?id=58086
This does not produce a buildable JavaScriptCore, but it
does allow running gyp/configure --port=gtk and having
it generate a gtk.Makefile which we can use for testing
the rest of the plumbing.
* gyp/gtk.gyp: Added.
2011-04-07 Andrew Scherkus <scherkus@chromium.org>
Revert ENABLE_TRACK patch due to compile failures.
......
{ # Just a stub file to allow Source/gyp/configure to run successfully for testing.
'includes': [
'../../gyp/common.gypi',
'../JavaScriptCore.gypi',
],
'targets': [
{
'target_name': 'JavaScriptCore',
'type': 'static_library',
'sources': [
'<@(javascriptcore_files)',
'<@(javascriptcore_publicheader_files)',
'<@(javascriptcore_privateheader_files)',
'<@(javascriptcore_derived_source_files)',
],
},
], # targets
}
#!/usr/bin/python
# Copyright (c) 2011 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""filelist output module
Just dumps the list of files to a text file for import into another build system.
"""
import gyp.common
import errno
import os
# FIXME: These defaults are wrong, but serve to allow us to generate something for now.
generator_default_variables = {
'OS': 'linux',
'PRODUCT_DIR': '$(builddir)',
}
def GenerateOutput(target_list, target_dicts, data, params):
options = params['options']
for build_file, build_file_dict in data.iteritems():
(build_file_root, build_file_ext) = os.path.splitext(build_file)
if build_file_ext != '.gyp':
continue
filelist_suffix = ".am" # FIXME: This should be configurable in the .gyp file
filelist_path = build_file_root + options.suffix + filelist_suffix
with open(filelist_path, 'w') as output:
for qualified_target in target_list:
[input_file, target] = gyp.common.ParseQualifiedTarget(qualified_target)[0:2]
lowered_target = target.lower() # FIXME: This is a hack for now to matche gtk automake style.
output.write("%s_sources += \\\n" % lowered_target)
for source in target_dicts[qualified_target]['sources']:
output.write("\t%s \\\n" % source)
2011-04-07 Eric Seidel <eric@webkit.org>
Reviewed by Adam Barth.
Add stub support for generating Gtk build system from gyp
https://bugs.webkit.org/show_bug.cgi?id=58086
This does not produce a buildable WebCore, but it
does allow running gyp/configure --port=gtk and having
it generate a gtk.Makefile which we can use for testing
the rest of the plumbing.
* gyp/gtk.gyp: Added.
2011-04-07 David Hyatt <hyatt@apple.com>
Reviewed by Dan Bernstein.
{ # Just a stub file to allow Source/gyp/configure to run successfully for testing.
'includes': [
'../../gyp/common.gypi',
'../WebCore.gypi',
],
'targets': [
{
'target_name': 'WebCore',
'type': 'static_library',
'sources': [
'<@(webcore_files)',
'<@(webcore_privateheader_files)',
'<@(webcore_derived_source_files)',
],
},
], # targets
}
......@@ -40,6 +40,7 @@ def chdir_to_source():
def gyp():
return os.path.join('ThirdParty', 'gyp', 'gyp')
class Project:
def __init__(self, name):
self._name = name
......@@ -47,44 +48,77 @@ class Project:
def name(self):
return self._name
def inputs(self):
def _gyp_directory(self):
return os.path.join(self._name, 'gyp')
def _gyp_file_for_port(self, port):
# Gyp uses the gyp file name as the XCode proj file name, so for now "apple-mac" must be ProjectName.gyp
if port == "mac":
return '%s.gyp' % self._name
return "%s.gyp" % port
def inputs(self, port):
return [
os.path.join(self._name, 'gyp', self._name + '.gyp'),
os.path.join(self._gyp_directory(), self._gyp_file_for_port(port)),
os.path.join(self._name, self._name + '.gypi'),
os.path.join('gyp', 'common.gypi'),
]
def output(self):
return os.path.join(self._name, 'gyp', self._name + '.xcodeproj', 'project.pbxproj')
def _output_for_port(self, port):
format = format_for_port(port)
return {
'filelist': '%s.am' % port,
'xcode': os.path.join(self._name + '.xcodeproj', 'project.pbxproj'),
}[format]
def should_generate(self):
if not os.path.exists(self.output()):
def output(self, port):
return os.path.join(self._gyp_directory(), self._output_for_port(port))
def should_generate(self, port):
if not os.path.exists(self.output(port)):
return True
return os.path.getmtime(self.output()) < self._newest(self.inputs())
return os.path.getmtime(self.output(port)) < self._newest(self.inputs(port))
def _extra_args_for_format(self, format):
if format == "xcode":
return ['-G', 'xcode_list_excluded_files=0']
return []
def generate(self):
subprocess.call([
def generate(self, port):
args = [
gyp(),
self.inputs()[0],
'-G',
'xcode_list_excluded_files=0',
self.inputs(port)[0],
'--depth=.',
])
]
format = format_for_port(port)
args.append('--format=%s' % format)
args += self._extra_args_for_format(format)
subprocess.call(args)
# 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)
os.utime(self.output(port), None)
@staticmethod
def _newest(paths):
return max([os.path.getmtime(path) for path in paths])
def format_for_port(port):
return {
'mac': 'xcode',
'gtk': 'filelist',
'win': 'msvs',
}[port] # Valid port is required.
PROJECTS = [
Project("JavaScriptCore"),
Project("WebCore"),
]
def projects_to_generate():
should_generate = [project for project in PROJECTS if project.should_generate()]
def projects_to_generate(port):
should_generate = [project for project in PROJECTS if project.should_generate(port)]
already_generated = [project.name() for project in set(PROJECTS) - set(should_generate)]
if already_generated:
......@@ -93,11 +127,13 @@ def projects_to_generate():
return should_generate
def main():
chdir_to_source()
parser = OptionParser()
# FIXME: The user should be able to pass which port on the command line.
parser.add_option("--port", dest="port", action="store", default="mac", # Default to Mac for now
help="Which port to generate for.")
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.")
......@@ -105,11 +141,12 @@ def main():
projects = PROJECTS
if not options.regenerate_projects:
projects = projects_to_generate()
projects = projects_to_generate(options.port)
for project in projects:
print "Generating %s." % project.name()
project.generate()
project.generate(options.port)
if __name__ == "__main__":
main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment