OLD | NEW |
1 # -*- python -*- | 1 # -*- python -*- |
2 | 2 |
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 import glob | 7 import glob |
8 import os | 8 import os |
9 | 9 |
10 env = Environment() | 10 env = Environment() |
11 | 11 |
12 lib_sources = env.Split("""env.cc | 12 lib_sources = env.Split("""env.cc |
13 interface.cc | 13 interface.cc |
14 minijail.cc | 14 minijail.cc |
15 options.cc""") | 15 options.cc""") |
16 bin_sources = env.Split("""minijail_main.cc""") | 16 bin_sources = env.Split("""minijail_main.cc""") |
17 test_sources = env.Split("""minijail_unittest.cc | 17 test_sources = env.Split("""minijail_unittest.cc |
18 options_unittest.cc | 18 options_unittest.cc |
19 minijail_testrunner.cc""") | 19 minijail_testrunner.cc""") |
20 benchmark_sources = glob.glob("*_microbenchmark.cc") | 20 benchmark_sources = glob.glob("*_microbenchmark.cc") |
21 | 21 |
22 env.Append( | 22 env.Append( |
23 CPPPATH=['..', '../../third_party/chrome/files', '../../common'], | 23 CPPPATH=['..', '../../third_party/chrome/files', '../../common'], |
24 CCFLAGS=['-g'], | 24 CCFLAGS=['-g'], |
25 LIBPATH=['../../third_party/chrome'], | 25 LIBPATH=['../../third_party/chrome'], |
26 LIBS=['cap', 'base', 'pthread', 'rt'], | 26 LIBS=['cap', 'glib-2.0', 'base', 'pthread', 'rt'], |
27 ) | 27 ) |
| 28 # glib-2.0 is only required by libbase |
| 29 |
28 for key in Split('CC CXX AR RANLIB LD NM CFLAGS CCFLAGS'): | 30 for key in Split('CC CXX AR RANLIB LD NM CFLAGS CCFLAGS'): |
29 value = os.environ.get(key) | 31 value = os.environ.get(key) |
30 if value != None: | 32 if value != None: |
31 env[key] = Split(value) | 33 env[key] = Split(value) |
32 env['CCFLAGS'] += ['-fno-exceptions', '-Wall', '-Werror'] | 34 env['CCFLAGS'] += ['-fno-exceptions', '-Wall', '-Werror'] |
33 | 35 |
34 # Fix issue with scons not passing some vars through the environment. | 36 # Fix issue with scons not passing some vars through the environment. |
35 for key in Split('PKG_CONFIG_LIBDIR PKG_CONFIG_PATH SYSROOT'): | 37 for key in Split('PKG_CONFIG SYSROOT'): |
36 if os.environ.has_key(key): | 38 if os.environ.has_key(key): |
37 env['ENV'][key] = os.environ[key] | 39 env['ENV'][key] = os.environ[key] |
38 | 40 |
| 41 env.ParseConfig('%s --cflags --libs glib-2.0' % env['ENV']['PKG_CONFIG']) |
| 42 |
39 env_lib = env.Clone() | 43 env_lib = env.Clone() |
40 env_lib.SharedLibrary('minijail', lib_sources) | 44 env_lib.SharedLibrary('minijail', lib_sources) |
41 | 45 |
42 env_bin = env.Clone() | 46 env_bin = env.Clone() |
43 env_bin.Program('minijail', lib_sources + bin_sources) | 47 env_bin.Program('minijail', lib_sources + bin_sources) |
44 | 48 |
45 env_test = env.Clone() | 49 env_test = env.Clone() |
46 env_test.Append(LIBS=['gtest', 'gmock']) | 50 env_test.Append(LIBS=['gtest', 'gmock']) |
47 env_test.Program('minijail_unittests', lib_sources + test_sources) | 51 env_test.Program('minijail_unittests', lib_sources + test_sources) |
48 | 52 |
49 env_benchmarks = env.Clone() | 53 env_benchmarks = env.Clone() |
50 # Note, LIBS needs to have: 'gtest', 'base', 'rt', 'pthread' | 54 # Note, LIBS needs to have: 'gtest', 'base', 'rt', 'pthread' |
51 env_benchmarks.Append(LIBS=['microbenchmark_main.a', | 55 env_benchmarks.Append(LIBS=['microbenchmark_main.a', |
52 # Since we want to run this on a prod image, | 56 # Since we want to run this on a prod image, |
53 # we just statically pull in gtest.a. | 57 # we just statically pull in gtest.a. |
54 File('/usr/lib/libgtest.a')]) | 58 File('/usr/lib/libgtest.a')]) |
55 env_benchmarks.Program('minijail_benchmarks', benchmark_sources) | 59 env_benchmarks.Program('minijail_benchmarks', benchmark_sources) |
OLD | NEW |