1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
# Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import re
Import('env')
env = env.Clone(OPEN_VCDIFF_DIR='open-vcdiff')
cpppath = [
'$OPEN_VCDIFF_DIR/src',
]
if env.Bit('windows'):
cpppath.append('$OPEN_VCDIFF_DIR/vsprojects')
env.Prepend(CPPPATH = cpppath)
input_files = ChromeFileList([
# TODO(sgk): violate standard indentation so we don't have to
# reindent too much when we remove the explicit MSVSFilter() calls
# in favor of generating the hierarchy to reflect the file system.
MSVSFilter('Header Files', [
'open-vcdiff/src/blockhash.h',
'open-vcdiff/src/checksum.h',
'open-vcdiff/src/codetable.h',
'open-vcdiff/src/compile_assert.h',
'open-vcdiff/vsprojects/config.h',
'open-vcdiff/src/decodetable.h',
'open-vcdiff/src/encodetable.h',
'open-vcdiff/src/headerparser.h',
'open-vcdiff/src/logging.h',
'open-vcdiff/src/google/output_string.h',
'open-vcdiff/src/rolling_hash.h',
'open-vcdiff/vsprojects/stdint.h',
'open-vcdiff/src/testing.h',
'open-vcdiff/src/varint_bigendian.h',
'open-vcdiff/src/google/vcdecoder.h',
'open-vcdiff/src/vcdiff_defs.h',
'open-vcdiff/src/vcdiffengine.h',
'open-vcdiff/src/zconf.h',
'open-vcdiff/src/zlib.h',
]),
MSVSFilter('Source Files', [
'open-vcdiff/src/addrcache.cc',
'open-vcdiff/src/adler32.c',
'open-vcdiff/src/blockhash.cc',
'open-vcdiff/src/codetable.cc',
'open-vcdiff/src/decodetable.cc',
'open-vcdiff/src/encodetable.cc',
'open-vcdiff/src/headerparser.cc',
'open-vcdiff/src/logging.cc',
'open-vcdiff/src/varint_bigendian.cc',
'open-vcdiff/src/vcdecoder.cc',
'open-vcdiff/src/vcdiffengine.cc',
]),
])
env.ChromeLibrary('sdch', input_files)
if env.Bit('posix'):
# Generate a target config.h file from a source config.h.in file.
#
# The list of defines has been taken empirically from Autoconf
# (./configure) runs on Mac OS X and Ubuntu Hardy.
defines = [
'HAVE_DLFCN_H',
'HAVE_FNMATCH_H',
'HAVE_GETOPT_H',
'HAVE_GETTIMEOFDAY',
'HAVE_INTTYPES_H',
'HAVE_MEMORY_H',
'HAVE_MPROTECT',
'HAVE_PTHREAD',
'HAVE_STDINT_H',
'HAVE_STDLIB_H',
'HAVE_STRINGS_H',
'HAVE_STRING_H',
'HAVE_STRTOLL',
'HAVE_STRTOQ',
'HAVE_SYS_MMAN_H',
'HAVE_SYS_STAT_H',
'HAVE_SYS_TIME_H',
'HAVE_SYS_TYPES_H',
'HAVE_UINT16_T',
'HAVE_UNISTD_H',
'HAVE_U_INT16_T',
'HAVE___ATTRIBUTE__',
('PACKAGE', '"open-vcdiff"'),
('PACKAGE_BUGREPORT', '"opensource@google.com"'),
('PACKAGE_NAME', '"open-vcdiff"'),
('PACKAGE_STRING', '"open-vcdiff 0.1"'),
('PACKAGE_TARNAME', '"open-vcdiff"'),
('PACKAGE_VERSION', '"0.1"'),
('VERSION', '"0.1"'),
'STDC_HEADERS',
]
if env.Bit('linux'):
defines.extend([
'HAVE_MALLOC_H',
'HAVE_MEMALIGN',
'HAVE_POSIX_MEMALIGN',
])
if env.Bit('mac'):
defines.extend([
'HAVE_WORKING_KQUEUE',
])
def AutoConfig(target, source, env):
"""
Action to generate a config.h file from an Autotools config.h.in file,
given the list of definitions in the DEFINES construction variable.
Each entry in DEFINES is either a string, in which case it
will be enabled with a value of 1, or a tuple, in which case
the first element is the #define name and the second its value.
Any leftover #undef lines get commented out.
"""
contents = open(str(source[0]), 'r').read()
for d in env['DEFINES']:
if isinstance(d, tuple):
define, value = d
else:
define = d
value = 1
undef = '^#undef %s$' % re.escape(define)
definition = '#define %s %s' % (define, value)
contents = re.sub(undef, definition, contents)
undef_re = re.compile(r'^(#undef .*)$', re.M)
contents = undef_re.sub(r'/* \1 */', contents)
header = '/* src/config.h. Generated by SCons. */\n'
open(str(target[0]), 'w').write(header + contents)
# varlist['DEFINES'] below makes the target config.h file depend
# on the list of definitions in the passed-in $DEFINES variable.
env.Command('$OPEN_VCDIFF_DIR/src/config.h',
'$OPEN_VCDIFF_DIR/src/config.h.in',
Action(AutoConfig, varlist=['DEFINES']),
DEFINES=defines)
p = env.ChromeMSVSProject('sdch.vcproj',
dest='$CHROME_SRC_DIR/sdch/sdch.vcproj',
guid='{F54ABC59-5C00-414A-A9BA-BAF26D1699F0}',
keyword='Win32Proj',
# TODO(sgk): when we can intuit the hierarchy
# from the built targets.
#buildtargets=TODO,
files=input_files,
relative_path_prefix='./',
tools=[
'VCPreBuildEventTool',
'VCCustomBuildTool',
'VCXMLDataGeneratorTool',
'VCWebServiceProxyGeneratorTool',
'VCMIDLTool',
MSVSTool('VCCLCompilerTool',
AdditionalIncludeDirectories=[
'./open-vcdiff/vsprojects',
'',
],
DefaultCharIsUnsigned="true"),
'VCManagedResourceCompilerTool',
'VCResourceCompilerTool',
'VCPreLinkEventTool',
'VCLibrarianTool',
'VCALinkTool',
'VCXDCMakeTool',
'VCBscMakeTool',
'VCFxCopTool',
'VCPostBuildEventTool',
],
ConfigurationType='4')
p.AddConfig('Debug|Win32',
InheritedPropertySheets=[
'$(SolutionDir)../build/debug.vsprops',
'$(SolutionDir)../sdch/using_sdch.vsprops',
])
p.AddConfig('Release|Win32',
InheritedPropertySheets=[
'$(SolutionDir)../build/release.vsprops',
'$(SolutionDir)../sdch/using_sdch.vsprops',
])
|