| OLD | NEW |
| 1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2009 The Chromium OS 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 os | 5 import os |
| 6 import sys | 6 import sys |
| 7 | 7 |
| 8 env = Environment() | 8 env = Environment() |
| 9 | 9 |
| 10 # define generic dbus server/client bindings builders | 10 # define generic dbus server/client bindings builders |
| 11 dbus_server_builder = Builder(action = 'dbus-binding-tool --mode=glib-server --p
refix=`basename $SOURCE .xml` $SOURCE > $TARGET') | 11 dbus_server_builder = Builder(action = 'dbus-binding-tool --mode=glib-server --p
refix=`basename $SOURCE .xml` $SOURCE > $TARGET') |
| 12 dbus_client_builder = Builder(action = 'dbus-binding-tool --mode=glib-client --p
refix=`basename $SOURCE .xml` $SOURCE > $TARGET') | 12 dbus_client_builder = Builder(action = 'dbus-binding-tool --mode=glib-client --p
refix=`basename $SOURCE .xml` $SOURCE > $TARGET') |
| 13 env.Append(BUILDERS = { 'DbusServerBindings' : dbus_server_builder, | 13 env.Append(BUILDERS = { 'DbusServerBindings' : dbus_server_builder, |
| 14 'DbusClientBindings' : dbus_client_builder}) | 14 'DbusClientBindings' : dbus_client_builder}) |
| 15 # setup sources | 15 # setup sources |
| 16 serverlib_sources = env.Split("""interface.cc | 16 commonlib_sources = env.Split("""crypto.cc |
| 17 interface.cc |
| 17 mount.cc | 18 mount.cc |
| 19 platform.cc |
| 18 secure_blob.cc | 20 secure_blob.cc |
| 19 service.cc | 21 service.cc |
| 20 username_passkey.cc | 22 username_passkey.cc |
| 21 vault_keyset.cc | 23 vault_keyset.cc |
| 22 """) | 24 """) |
| 23 server_sources = env.Split("""cryptohomed.cc""") | 25 server_sources = env.Split("""cryptohomed.cc""") |
| 24 client_sources = env.Split("""cryptohome.cc | 26 client_sources = env.Split("""cryptohome.cc""") |
| 25 secure_blob.cc | 27 test_sources = env.Split("""crypto_unittest.cc |
| 26 username_passkey.cc | 28 service_unittest.cc |
| 27 """) | |
| 28 test_sources = env.Split("""service_unittest.cc | |
| 29 mount_unittest.cc | 29 mount_unittest.cc |
| 30 secure_blob_unittest.cc |
| 30 username_passkey_unittest.cc | 31 username_passkey_unittest.cc |
| 32 vault_keyset_unittest.cc |
| 31 cryptohome_testrunner.cc | 33 cryptohome_testrunner.cc |
| 32 """) | 34 """) |
| 33 | 35 |
| 34 | 36 |
| 35 | 37 |
| 36 env.Append( | 38 env.Append( |
| 37 CPPPATH=['.', '..'], | 39 CPPPATH=['.', '..'], |
| 38 CPPFLAGS=['-pie', '-fstack-protector-all', | 40 CPPFLAGS=['-pie', '-fstack-protector-all', |
| 39 '-fno-exceptions', '-O2', '-Wall', '-Werror'], | 41 '-fno-exceptions', '-O2', '-Wall', '-Werror'], |
| 40 LIBS = ['base', 'chromeos', 'rt', 'crypto', 'ecryptfs', 'keyutils'], | 42 LIBS = ['base', 'chromeos', 'rt', 'crypto', 'ecryptfs', 'keyutils'], |
| 41 ) | 43 ) |
| 42 for key in Split('CC CXX AR RANLIB LD NM CFLAGS CCFLAGS'): | 44 for key in Split('CC CXX AR RANLIB LD NM CFLAGS CCFLAGS'): |
| 43 value = os.environ.get(key) | 45 value = os.environ.get(key) |
| 44 if value != None: | 46 if value != None: |
| 45 env[key] = value | 47 env[key] = value |
| 46 | 48 |
| 47 # Fix issue with scons not passing some vars through the environment. | 49 # Fix issue with scons not passing some vars through the environment. |
| 48 for key in Split('PKG_CONFIG_LIBDIR PKG_CONFIG_PATH SYSROOT'): | 50 for key in Split('PKG_CONFIG_LIBDIR PKG_CONFIG_PATH SYSROOT'): |
| 49 if os.environ.has_key(key): | 51 if os.environ.has_key(key): |
| 50 env['ENV'][key] = os.environ[key] | 52 env['ENV'][key] = os.environ[key] |
| 51 | 53 |
| 52 env.Append(LIBPATH = ['.']) | 54 env.Append(LIBPATH = ['.']) |
| 53 env.ParseConfig('pkg-config --cflags --libs gobject-2.0 dbus-1 dbus-glib-1') | 55 env.ParseConfig('pkg-config --cflags --libs gobject-2.0 dbus-1 dbus-glib-1') |
| 54 | 56 |
| 55 env_serverlib = env.Clone() | 57 env_commonlib = env.Clone() |
| 56 env_serverlib.DbusServerBindings('bindings/server.h', 'cryptohome.xml') | 58 env_commonlib.SharedLibrary('cryptohome', commonlib_sources) |
| 57 env_serverlib.SharedLibrary('cryptohome_service', serverlib_sources) | |
| 58 | 59 |
| 59 env_server = env.Clone() | 60 env_server = env.Clone() |
| 60 env_server.Append(LIBS=['cryptohome_service']) | 61 env_server.Append(LIBS=['cryptohome']) |
| 62 env_server.DbusServerBindings('bindings/server.h', 'cryptohome.xml') |
| 61 env_server.Program('cryptohomed', server_sources) | 63 env_server.Program('cryptohomed', server_sources) |
| 62 | 64 |
| 65 env_client = env.Clone() |
| 66 env_client.Append(LIBS=['cryptohome']) |
| 67 env_client.DbusClientBindings('bindings/client.h', 'cryptohome.xml') |
| 68 env_client.Program('cryptohome', client_sources) |
| 69 |
| 63 # TODO(wad) we'll probably want a separate runner for client roundtrip tests | 70 # TODO(wad) we'll probably want a separate runner for client roundtrip tests |
| 64 env_tests = env.Clone() | 71 env_tests = env.Clone() |
| 65 env_tests.Append(LIBS=['cryptohome_service', 'gtest', 'gmock']) | 72 env_tests.Append(LIBS=['cryptohome', 'gtest', 'gmock']) |
| 66 env_tests.Program('cryptohome_testrunner', test_sources) | 73 env_tests.Program('cryptohome_testrunner', test_sources) |
| 67 | |
| 68 env_client = env.Clone() | |
| 69 env_client.DbusClientBindings('bindings/client.h', 'cryptohome.xml') | |
| 70 env_client.Program('cryptohome', client_sources) | |
| OLD | NEW |