OLD | NEW |
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 | 5 import re |
6 | 6 |
7 Import('env') | 7 Import('env') |
8 | 8 |
9 env = env.Clone(OPEN_VCDIFF_DIR='open-vcdiff') | 9 env = env.Clone(OPEN_VCDIFF_DIR='open-vcdiff') |
10 | 10 |
11 cpppath = [ | 11 cpppath = [ |
12 '$OPEN_VCDIFF_DIR/src', | 12 '$OPEN_VCDIFF_DIR/src', |
13 ] | 13 ] |
14 | 14 |
15 if env['PLATFORM'] == 'win32': | 15 if env.Bit('windows'): |
16 cpppath.append('$OPEN_VCDIFF_DIR/vsprojects') | 16 cpppath.append('$OPEN_VCDIFF_DIR/vsprojects') |
17 | 17 |
18 env.Prepend(CPPPATH = cpppath) | 18 env.Prepend(CPPPATH = cpppath) |
19 | 19 |
20 input_files = [ | 20 input_files = [ |
21 '$OPEN_VCDIFF_DIR/src/addrcache.cc', | 21 '$OPEN_VCDIFF_DIR/src/addrcache.cc', |
22 '$OPEN_VCDIFF_DIR/src/adler32.c', | 22 '$OPEN_VCDIFF_DIR/src/adler32.c', |
23 '$OPEN_VCDIFF_DIR/src/blockhash.cc', | 23 '$OPEN_VCDIFF_DIR/src/blockhash.cc', |
24 '$OPEN_VCDIFF_DIR/src/codetable.cc', | 24 '$OPEN_VCDIFF_DIR/src/codetable.cc', |
25 '$OPEN_VCDIFF_DIR/src/decodetable.cc', | 25 '$OPEN_VCDIFF_DIR/src/decodetable.cc', |
26 '$OPEN_VCDIFF_DIR/src/encodetable.cc', | 26 '$OPEN_VCDIFF_DIR/src/encodetable.cc', |
27 '$OPEN_VCDIFF_DIR/src/headerparser.cc', | 27 '$OPEN_VCDIFF_DIR/src/headerparser.cc', |
28 '$OPEN_VCDIFF_DIR/src/logging.cc', | 28 '$OPEN_VCDIFF_DIR/src/logging.cc', |
29 '$OPEN_VCDIFF_DIR/src/varint_bigendian.cc', | 29 '$OPEN_VCDIFF_DIR/src/varint_bigendian.cc', |
30 '$OPEN_VCDIFF_DIR/src/vcdecoder.cc', | 30 '$OPEN_VCDIFF_DIR/src/vcdecoder.cc', |
31 '$OPEN_VCDIFF_DIR/src/vcdiffengine.cc', | 31 '$OPEN_VCDIFF_DIR/src/vcdiffengine.cc', |
32 ] | 32 ] |
33 | 33 |
34 env.ChromeStaticLibrary('sdch', input_files) | 34 env.ChromeStaticLibrary('sdch', input_files) |
35 | 35 |
36 if env['PLATFORM'] in ('posix', 'darwin'): | 36 if env.Bit('posix'): |
37 | 37 |
38 # Generate a target config.h file from a source config.h.in file. | 38 # Generate a target config.h file from a source config.h.in file. |
39 # | 39 # |
40 # The list of defines has been taken empirically from Autoconf | 40 # The list of defines has been taken empirically from Autoconf |
41 # (./configure) runs on Mac OS X and Ubuntu Hardy. | 41 # (./configure) runs on Mac OS X and Ubuntu Hardy. |
42 | 42 |
43 defines = [ | 43 defines = [ |
44 'HAVE_DLFCN_H', | 44 'HAVE_DLFCN_H', |
45 'HAVE_FNMATCH_H', | 45 'HAVE_FNMATCH_H', |
46 'HAVE_GETOPT_H', | 46 'HAVE_GETOPT_H', |
(...skipping 19 matching lines...) Expand all Loading... |
66 ('PACKAGE', '"open-vcdiff"'), | 66 ('PACKAGE', '"open-vcdiff"'), |
67 ('PACKAGE_BUGREPORT', '"opensource@google.com"'), | 67 ('PACKAGE_BUGREPORT', '"opensource@google.com"'), |
68 ('PACKAGE_NAME', '"open-vcdiff"'), | 68 ('PACKAGE_NAME', '"open-vcdiff"'), |
69 ('PACKAGE_STRING', '"open-vcdiff 0.1"'), | 69 ('PACKAGE_STRING', '"open-vcdiff 0.1"'), |
70 ('PACKAGE_TARNAME', '"open-vcdiff"'), | 70 ('PACKAGE_TARNAME', '"open-vcdiff"'), |
71 ('PACKAGE_VERSION', '"0.1"'), | 71 ('PACKAGE_VERSION', '"0.1"'), |
72 ('VERSION', '"0.1"'), | 72 ('VERSION', '"0.1"'), |
73 'STDC_HEADERS', | 73 'STDC_HEADERS', |
74 ] | 74 ] |
75 | 75 |
76 if env['PLATFORM'] == 'posix': | 76 if env.Bit('linux'): |
77 defines.extend([ | 77 defines.extend([ |
78 'HAVE_MALLOC_H', | 78 'HAVE_MALLOC_H', |
79 'HAVE_MEMALIGN', | 79 'HAVE_MEMALIGN', |
80 'HAVE_POSIX_MEMALIGN', | 80 'HAVE_POSIX_MEMALIGN', |
81 ]) | 81 ]) |
82 | 82 |
83 if env['PLATFORM'] == 'darwin': | 83 if env.Bit('mac'): |
84 defines.extend([ | 84 defines.extend([ |
85 'HAVE_WORKING_KQUEUE', | 85 'HAVE_WORKING_KQUEUE', |
86 ]) | 86 ]) |
87 | 87 |
88 def AutoConfig(target, source, env): | 88 def AutoConfig(target, source, env): |
89 """ | 89 """ |
90 Action to generate a config.h file from an Autotools config.h.in file, | 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. | 91 given the list of definitions in the DEFINES construction variable. |
92 | 92 |
93 Each entry in DEFINES is either a string, in which case it | 93 Each entry in DEFINES is either a string, in which case it |
(...skipping 19 matching lines...) Expand all Loading... |
113 | 113 |
114 header = '/* src/config.h. Generated by SCons. */\n' | 114 header = '/* src/config.h. Generated by SCons. */\n' |
115 open(str(target[0]), 'w').write(header + contents) | 115 open(str(target[0]), 'w').write(header + contents) |
116 | 116 |
117 # varlist['DEFINES'] below makes the target config.h file depend | 117 # varlist['DEFINES'] below makes the target config.h file depend |
118 # on the list of definitions in the passed-in $DEFINES variable. | 118 # on the list of definitions in the passed-in $DEFINES variable. |
119 env.Command('$OPEN_VCDIFF_DIR/src/config.h', | 119 env.Command('$OPEN_VCDIFF_DIR/src/config.h', |
120 '$OPEN_VCDIFF_DIR/src/config.h.in', | 120 '$OPEN_VCDIFF_DIR/src/config.h.in', |
121 Action(AutoConfig, varlist=['DEFINES']), | 121 Action(AutoConfig, varlist=['DEFINES']), |
122 DEFINES=defines) | 122 DEFINES=defines) |
OLD | NEW |