summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorsgk@google.com <sgk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-29 10:05:54 +0000
committersgk@google.com <sgk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-29 10:05:54 +0000
commitf9dec56132dffbf5d3aacf4a6af4491dcd87856d (patch)
tree8fe3173f5439eaf8b10270d9bb5a3699696d6eef /webkit
parentb492eae3b74de8a1258ec4331f61ec4ea124826e (diff)
downloadchromium_src-f9dec56132dffbf5d3aacf4a6af4491dcd87856d.zip
chromium_src-f9dec56132dffbf5d3aacf4a6af4491dcd87856d.tar.gz
chromium_src-f9dec56132dffbf5d3aacf4a6af4491dcd87856d.tar.bz2
Fix SCons-based webkit build on Windows (broken by the Linux
command-line changes) by using portable SCons idioms: * Side-step command-line differences by using a Python function as a build action to generate a .h file by surrounding the contents of the yacc-generated .hpp file with a #ifndef-#define-#endif guard. * Use the pre-defined Delete() ActionFactory to let SCons delete the .hpp file directly, instead of calling "rm" to do it. TBR: evanm git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1523 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/build/port/SConscript31
1 files changed, 21 insertions, 10 deletions
diff --git a/webkit/build/port/SConscript b/webkit/build/port/SConscript
index 49b58e9..ab0bcc9 100644
--- a/webkit/build/port/SConscript
+++ b/webkit/build/port/SConscript
@@ -566,20 +566,31 @@ env.Command(['$DERIVED_DIR/UserAgentStyleSheets.h',
'$DERIVED_DIR/quirks.css'],
'$PERL ${SOURCES[0].posix} ${TARGETS.posix} ${SOURCES[1:].posix}')
+def create_h_wrapper(target, source, env):
+ """
+ Create a *.h file by surrounding the contents of a
+ yacc-generated *.hpp with a #ifndef-#define-#endif guard.
+ """
+ t = str(target[1])
+ fp = open(t, 'w')
+ define = os.path.splitext(os.path.split(t)[1])[0]
+ fp.write('#ifndef %s_h\n' % define)
+ fp.write('#define %s_h\n' % define)
+ fp.write(open(t + 'pp', 'r').read())
+ fp.write('#endif %s_h\n' % define)
+
+# TODO(sgk): make this a real pseudo-Builder
def BuildYacc(env, dir, name, file):
env.Command(['$DERIVED_DIR/%s.cpp' % file,
'$DERIVED_DIR/%s.h' % file],
['$WEBKIT_PORT_DIR/%s/%s.y' % (dir, file)],
- ('$YACC -d -p %syy ${SOURCES[0].posix} ' % name +
- '-o ${TARGET.posix} && ' +
- '(echo \#ifndef %s_h;' % file +
- ' echo \#define %s_h;' % file +
- ' cat $DERIVED_DIR/%s.hpp;' % file +
- ' echo \#endif) >> $DERIVED_DIR/%s.h && ' % file +
- 'rm $DERIVED_DIR/%s.hpp' % file))
-
-BuildYacc(env, 'xml', 'xpath', 'XPathGrammar')
-BuildYacc(env, 'css', 'css', 'CSSGrammar')
+ ['$YACC -d -p %s ${SOURCES[0].posix} ' % name +
+ '-o ${TARGET.posix}',
+ Action(create_h_wrapper),
+ Delete('${TARGETS[1]}pp')])
+
+BuildYacc(env, 'xml', 'xpathyy', 'XPathGrammar')
+BuildYacc(env, 'css', 'cssyy', 'CSSGrammar')
# TODO(bradnelson): need to add in error checking