| # -*- python -*- |
| # Copyright (c) 2012 The Chromium OS 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 os |
| import SCons.Util |
| |
| PKG_CONFIG = os.environ.get('PKG_CONFIG', 'pkg-config') |
| BASE_VER = os.environ['BASE_VER'] |
| libchrome = 'chrome-%s' % BASE_VER |
| |
| env = Environment() |
| |
| # Keep ebuild up to date with appropriate headers, or else figure |
| # out how to get scons to handle header installation as well. |
| sources = env.Split(""" |
| nss_util.cc |
| rsa_private_key.cc |
| rsa_private_key_nss.cc |
| signature_creator_nss.cc |
| signature_verifier_nss.cc |
| symmetric_key_nss.cc |
| """) |
| |
| env.Append( |
| CCFLAGS=['-g'] |
| ) |
| for key in Split('CC CXX AR RANLIB LD NM CFLAGS CXXFLAGS CCFLAGS'): |
| value = os.environ.get(key) |
| if value: |
| env[key] = Split(value) |
| |
| if os.environ.has_key('CPPFLAGS'): |
| env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CPPFLAGS']) |
| if os.environ.has_key('LDFLAGS'): |
| env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS']) |
| |
| env['CCFLAGS'] += ['-fPIC', |
| '-fno-exceptions', |
| '-Wall', |
| '-Werror', |
| '-DOS_CHROMEOS', |
| '-DUSE_NSS', |
| '-DUSE_SYSTEM_LIBEVENT', |
| '-I..'] |
| |
| # Fix issue with scons not passing some vars through the environment. |
| for key in Split('PKG_CONFIG_LIBDIR PKG_CONFIG_PATH SYSROOT'): |
| if os.environ.has_key(key): |
| env['ENV'][key] = os.environ[key] |
| |
| # glib, nss environment |
| env.ParseConfig('%s --cflags --libs nss lib%s' % (PKG_CONFIG, libchrome)) |
| |
| env.StaticLibrary('chrome_crypto', sources) |
| |
| # We don't actually install the shared lib. The point of this is to verify |
| # all the necessary objects are compiled and the symbols used are available. |
| # Otherwise we might not find out until building something else against the |
| # static library. |
| env.Append( |
| LINKFLAGS = ['-Wl,--as-needed', '-Wl,-z,defs'], |
| ) |
| env.SharedLibrary('chrome_crypto', sources) |