Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: sdch/SConscript

Issue 5204: Get open-vcdiff building on Linux and Mac (in SCons) using... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/filter.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import re
6
5 Import('env') 7 Import('env')
6 8
7 env = env.Clone(OPEN_VCDIFF_DIR='open_vcdiff/depot/opensource/open-vcdiff') 9 env = env.Clone(OPEN_VCDIFF_DIR='open_vcdiff/depot/opensource/open-vcdiff')
8 10
9 env.Prepend( 11 cpppath = [
10 CPPPATH = [
11 '$OPEN_VCDIFF_DIR/src', 12 '$OPEN_VCDIFF_DIR/src',
12 '$OPEN_VCDIFF_DIR/vsprojects', 13 ]
13 ], 14
14 ) 15 if env['PLATFORM'] == 'win32':
16 cpppath.append('$OPEN_VCDIFF_DIR/vsprojects')
17
18 env.Prepend(CPPPATH = cpppath)
15 19
16 input_files = [ 20 input_files = [
17 '$OPEN_VCDIFF_DIR/src/addrcache.cc', 21 '$OPEN_VCDIFF_DIR/src/addrcache.cc',
18 '$OPEN_VCDIFF_DIR/src/adler32.c', 22 '$OPEN_VCDIFF_DIR/src/adler32.c',
19 '$OPEN_VCDIFF_DIR/src/blockhash.cc', 23 '$OPEN_VCDIFF_DIR/src/blockhash.cc',
20 '$OPEN_VCDIFF_DIR/src/codetable.cc', 24 '$OPEN_VCDIFF_DIR/src/codetable.cc',
21 '$OPEN_VCDIFF_DIR/src/decodetable.cc', 25 '$OPEN_VCDIFF_DIR/src/decodetable.cc',
22 '$OPEN_VCDIFF_DIR/src/encodetable.cc', 26 '$OPEN_VCDIFF_DIR/src/encodetable.cc',
23 '$OPEN_VCDIFF_DIR/src/headerparser.cc', 27 '$OPEN_VCDIFF_DIR/src/headerparser.cc',
24 '$OPEN_VCDIFF_DIR/src/logging.cc', 28 '$OPEN_VCDIFF_DIR/src/logging.cc',
25 '$OPEN_VCDIFF_DIR/src/varint_bigendian.cc', 29 '$OPEN_VCDIFF_DIR/src/varint_bigendian.cc',
26 '$OPEN_VCDIFF_DIR/src/vcdecoder.cc', 30 '$OPEN_VCDIFF_DIR/src/vcdecoder.cc',
27 '$OPEN_VCDIFF_DIR/src/vcdiffengine.cc', 31 '$OPEN_VCDIFF_DIR/src/vcdiffengine.cc',
28 ] 32 ]
29 33
30 env.ChromeStaticLibrary('sdch', input_files) 34 env.ChromeStaticLibrary('sdch', input_files)
35
36 if env['PLATFORM'] in ('posix', 'darwin'):
37
38 # Generate a target config.h file from a source config.h.in file.
39 #
40 # The list of defines has been taken empirically from Autoconf
41 # (./configure) runs on Mac OS X and Ubuntu Hardy.
42
43 defines = [
44 'HAVE_DLFCN_H',
45 'HAVE_FNMATCH_H',
46 'HAVE_GETOPT_H',
47 'HAVE_GETTIMEOFDAY',
48 'HAVE_INTTYPES_H',
49 'HAVE_MEMORY_H',
50 'HAVE_MPROTECT',
51 'HAVE_PTHREAD',
52 'HAVE_STDINT_H',
53 'HAVE_STDLIB_H',
54 'HAVE_STRINGS_H',
55 'HAVE_STRING_H',
56 'HAVE_STRTOLL',
57 'HAVE_STRTOQ',
58 'HAVE_SYS_MMAN_H',
59 'HAVE_SYS_STAT_H',
60 'HAVE_SYS_TIME_H',
61 'HAVE_SYS_TYPES_H',
62 'HAVE_UINT16_T',
63 'HAVE_UNISTD_H',
64 'HAVE_U_INT16_T',
65 'HAVE___ATTRIBUTE__',
66 ('PACKAGE', '"open-vcdiff"'),
67 ('PACKAGE_BUGREPORT', '"opensource@google.com"'),
68 ('PACKAGE_NAME', '"open-vcdiff"'),
69 ('PACKAGE_STRING', '"open-vcdiff 0.1"'),
70 ('PACKAGE_TARNAME', '"open-vcdiff"'),
71 ('PACKAGE_VERSION', '"0.1"'),
72 ('VERSION', '"0.1"'),
73 'STDC_HEADERS',
74 ]
75
76 if env['PLATFORM'] == 'posix':
77 defines.extend([
78 'HAVE_MALLOC_H',
79 'HAVE_MEMALIGN',
80 'HAVE_POSIX_MEMALIGN',
81 ])
82
83 if env['PLATFORM'] == 'darwin':
84 defines.extend([
85 'HAVE_WORKING_KQUEUE',
86 ])
87
88 def AutoConfig(target, source, env):
89 """
90 Action to generate a config.h file from an Autotools config.h.in file,
91 given the list of definitions in the DEFINES construction variable.
92
93 Each entry in DEFINES is either a string, in which case it
94 will be enabled with a value of 1, or a tuple, in which case
95 the first element is the #define name and the second its value.
96
97 Any leftover #undef lines get commented out.
98 """
99 contents = open(str(source[0]), 'r').read()
100
101 for d in env['DEFINES']:
102 if isinstance(d, tuple):
103 define, value = d
104 else:
105 define = d
106 value = 1
107 undef = '^#undef %s$' % re.escape(define)
108 definition = '#define %s %s' % (define, value)
109 contents = re.sub(undef, definition, contents)
110
111 undef_re = re.compile(r'^(#undef .*)$', re.M)
112 contents = undef_re.sub(r'/* \1 */', contents)
113
114 header = '/* src/config.h. Generated by SCons. */\n'
115 open(str(target[0]), 'w').write(header + contents)
116
117 # varlist['DEFINES'] below makes the target config.h file depend
118 # on the list of definitions in the passed-in $DEFINES variable.
119 env.Command('$OPEN_VCDIFF_DIR/src/config.h',
120 '$OPEN_VCDIFF_DIR/src/config.h.in',
121 Action(AutoConfig, varlist=['DEFINES']),
122 DEFINES=defines)
OLDNEW
« no previous file with comments | « net/base/filter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698