Initial source release: v2.0.8-0-679
Change-Id: Idf6316a8faf4b4fdc54265aad12084e5aa60707a
This commit is contained in:
117
build/build.py
Executable file
117
build/build.py
Executable file
@@ -0,0 +1,117 @@
|
||||
#!/usr/bin/python2
|
||||
# Copyright 2013 Google Inc. All rights reserved.
|
||||
|
||||
import gyp
|
||||
import os
|
||||
from os import path
|
||||
import string
|
||||
import subprocess
|
||||
import sys
|
||||
import argparse
|
||||
|
||||
toolchain = {}
|
||||
starting_dir = os.getcwd()
|
||||
|
||||
toolset_variables = ['CC', 'CXX', 'AR']
|
||||
env_variables = ['CFLAGS', 'CXXFLAGS', 'LDFLAGS']
|
||||
|
||||
gyp_args = string.split('--format=make --depth=.')
|
||||
|
||||
parser = argparse.ArgumentParser(description='Process build options.')
|
||||
parser_arguments = []
|
||||
build_config = '--build=Debug'
|
||||
global_include_file = '--include=build/global_config.gypi'
|
||||
|
||||
print ' Gyp Args: %s' % (gyp_args)
|
||||
|
||||
def ImportPlatform(name):
|
||||
os.chdir('build/platforms')
|
||||
sys.path.insert(0, os.getcwd())
|
||||
platforms_list = __import__('cdm_platforms')
|
||||
platforms = platforms_list.platforms
|
||||
target_platform = platforms[name]
|
||||
print ' Target Platform: %s' % (target_platform)
|
||||
target_folder = target_platform['folder']
|
||||
print ' Target Folder: %s' % (target_folder)
|
||||
target_file = target_platform['file']
|
||||
print ' Target File: %s' % (target_file)
|
||||
global target_env
|
||||
target_env = target_file
|
||||
|
||||
os.chdir(target_folder)
|
||||
sys.path.insert(0, os.getcwd())
|
||||
target = __import__(target_file)
|
||||
tooldir = ''
|
||||
if 'tooldir' in target.toolchain:
|
||||
tooldir = target.toolchain['tooldir']
|
||||
print ' tooldir: %s' % (tooldir)
|
||||
for i, v in enumerate(toolset_variables):
|
||||
if v in target.toolchain:
|
||||
os.environ[v] = path.join(tooldir, target.toolchain[v])
|
||||
print ' tool: %s' % (os.environ[v])
|
||||
if 'tooldir' in target.toolchain:
|
||||
tooldir = target.toolchain['tooldir']
|
||||
|
||||
for i, v in enumerate(env_variables):
|
||||
if v in target.toolchain:
|
||||
os.environ[v] = target.toolchain[v]
|
||||
if hasattr(target, 'gyp_variables'):
|
||||
global gyp_args
|
||||
gyp_args += target.gyp_variables
|
||||
|
||||
if hasattr(target, 'export_variables'):
|
||||
print '---------------has export variables'
|
||||
|
||||
for v in target.export_variables:
|
||||
first = v.split(':')
|
||||
x = first[0]
|
||||
y = target.export_variables[x]
|
||||
if x=="ADD_PATH":
|
||||
os.environ["PATH"] = os.environ["PATH"] + y
|
||||
print ' just updated to PATH'
|
||||
print os.environ["PATH"]
|
||||
else:
|
||||
os.environ[x] = y
|
||||
print ' just set Env variable %s to %s' % (x, y)
|
||||
else:
|
||||
print '-------has NO export variables'
|
||||
|
||||
os.chdir(starting_dir)
|
||||
os.environ['CDM_TOP'] = starting_dir
|
||||
|
||||
#print ' Actual: %s' % (starting_dir)
|
||||
|
||||
def RunGyp(args):
|
||||
print ' Args: %s' % (args)
|
||||
global gyp_args
|
||||
global build_config
|
||||
if parser_arguments.release:
|
||||
build_config = '--build=Release'
|
||||
gyp_args.append(build_config)
|
||||
# Append the global include file last.
|
||||
# This allows a platform definition to exist
|
||||
# in a gypi file adding the ability for the
|
||||
# platform definition to use the features of gyp.
|
||||
gyp_args.append(global_include_file)
|
||||
gyp.main(gyp_args)
|
||||
|
||||
def ParseOptions(args):
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("platform", help="The platform configuration you want to build")
|
||||
parser.add_argument("-r", "--release", help='build release build', action='store_true')
|
||||
global parser_arguments
|
||||
parser_arguments = parser.parse_args()
|
||||
|
||||
def main(args):
|
||||
def exitOnFailure(result):
|
||||
if not result == 0:
|
||||
sys.exit(result)
|
||||
|
||||
ParseOptions(args)
|
||||
ImportPlatform(parser_arguments.platform)
|
||||
print ' Running Gyp with: %s' % args
|
||||
|
||||
RunGyp(args)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv[1:])
|
||||
43
build/global_config.gypi
Normal file
43
build/global_config.gypi
Normal file
@@ -0,0 +1,43 @@
|
||||
# Copyright 2013 Google Inc. All rights reserved.
|
||||
{
|
||||
# Global place to define variables and defines.
|
||||
# This file is passed to gyp and the contents included in
|
||||
# every gyp referenced.
|
||||
|
||||
'variables': {
|
||||
'target_build%':"x86-64",
|
||||
'company_name%':'"UndefinedCompanyName"',
|
||||
'model_name%':'"UndefinedModelName"',
|
||||
'architecture_name%':'"UndefinedArchitectureName"',
|
||||
'device_name%':'"UndefinedDeviceName"',
|
||||
'product_name%':'"UndefinedProductName"',
|
||||
'buildinfo_data%':'"UndefinedBuildInfo"',
|
||||
'target_oemcrypto%': 'oec_mock',
|
||||
'oemcrypto_target%':'../oemcrypto/mock/oec_mock.gyp:oec_mock',
|
||||
'protoc_dir%':'/usr/bin',
|
||||
'certificate_provision%':'false',
|
||||
},
|
||||
'target_defaults': {
|
||||
'default_configuration': 'Release',
|
||||
'configurations': {
|
||||
'Debug': {
|
||||
'cflags': ['-g'],
|
||||
},
|
||||
'Release': {},
|
||||
}, # end configurations
|
||||
'target_conditions': [
|
||||
['_type=="static_library"', {
|
||||
'standalone_static_library': 1,
|
||||
}]
|
||||
],
|
||||
'defines': [
|
||||
'PLATFORM_COMPANY_NAME_WV=<(company_name)',
|
||||
'PLATFORM_MODEL_NAME_WV=<(model_name)',
|
||||
'PLATFORM_ARCHITECTURE_NAME_WV=<(architecture_name)',
|
||||
'PLATFORM_DEVICE_NAME_WV=<(device_name)',
|
||||
'PLATFORM_PRODUCT_NAME_WV=<(product_name)',
|
||||
'PLATFORM_BUILDINFO_WV=<(buildinfo_data)',
|
||||
'PLATFORM_CERTIFICATE_PROV=<(certificate_provision)',
|
||||
],
|
||||
} # end target_defaults
|
||||
}
|
||||
12
build/platforms/cdm_platforms.py
Normal file
12
build/platforms/cdm_platforms.py
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/python2
|
||||
# Copyright 2013 Google Inc. All rights reserved.
|
||||
|
||||
# cdm_platforms.py --- Supported platforms
|
||||
# Modify this file to extend the platforms that can be built by build.py
|
||||
|
||||
platforms = {
|
||||
'x86-64': {
|
||||
'folder': 'x86-64',
|
||||
'file': 'x86-64',
|
||||
},
|
||||
}
|
||||
24
build/platforms/x86-64/oemcrypto/oec_build.gyp
Normal file
24
build/platforms/x86-64/oemcrypto/oec_build.gyp
Normal file
@@ -0,0 +1,24 @@
|
||||
# Copyright 2013 Google Inc. All Rights Reserved.
|
||||
#
|
||||
# Build the vendor's oemcrypto (simulated with mock for x86-64)
|
||||
#
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'oemcrypto',
|
||||
'type': 'static_library',
|
||||
'include_dirs': [
|
||||
'../../../../core/include',
|
||||
'../../../../oemcrypto/include',
|
||||
'../../../../',
|
||||
],
|
||||
'sources': [
|
||||
'../../../../oemcrypto/mock/src/oemcrypto_engine_mock.cpp',
|
||||
'../../../../oemcrypto/mock/src/oemcrypto_key_mock.cpp',
|
||||
'../../../../oemcrypto/mock/src/oemcrypto_keybox_mock.cpp',
|
||||
'../../../../oemcrypto/mock/src/oemcrypto_mock.cpp',
|
||||
'../../../../oemcrypto/mock/src/wvcrc.cpp',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
6
build/platforms/x86-64/x86-64.gypi
Normal file
6
build/platforms/x86-64/x86-64.gypi
Normal file
@@ -0,0 +1,6 @@
|
||||
# Copyright 2013 Google Inc. All rights reserved.
|
||||
{
|
||||
'variables': {
|
||||
'certificate_provision':'true',
|
||||
},
|
||||
}
|
||||
50
build/platforms/x86-64/x86-64.py
Normal file
50
build/platforms/x86-64/x86-64.py
Normal file
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/python2
|
||||
# Copyright 2013 Google Inc. All rights reserved.
|
||||
#
|
||||
# x86-64 baseline
|
||||
# Definitions:
|
||||
# external_build - boolean if 0, we will build libwvcdm_shared from source.
|
||||
# Comment out "V:1" for non-verbose make, it's not based on bool value.
|
||||
#
|
||||
toolchain = {
|
||||
'tooldir': '/usr/bin/',
|
||||
'CC' : 'gcc',
|
||||
'CXX' : 'g++',
|
||||
'AR' : 'ar',
|
||||
'LD' : 'ld',
|
||||
'CFLAGS': '-fno-exceptions -fPIC \
|
||||
-I/usr/local/include \
|
||||
-I./build/platforms/x86-64',
|
||||
'CXXFLAGS': '-fno-exceptions -fPIC \
|
||||
-I/usr/local/include \
|
||||
-I$(CDM_TOP)/build/platforms/x86-64',
|
||||
'LDFLAGS': '-L$(CDM_TOP)/prebuilt/gtest/out_x86_linux/Release/lib',
|
||||
}
|
||||
|
||||
# gyp_variables
|
||||
# Definitions:
|
||||
# external_build = vendor can only get binary libwvcdm, no source.
|
||||
# oemcrypto_lib = where the vendor's oemcrypto lib is if not a mock.
|
||||
# target_oemcrypto = oemcrypto_lib or comment out for default of oec_mock.
|
||||
gyp_variables = [
|
||||
'-Duse_system_protobuf=1',
|
||||
'-Dexternal_build=0',
|
||||
'-Dtarget_build=x86-64',
|
||||
'-Doemcrypto_target=../build/platforms/x86-64/oemcrypto/oec_build.gyp:oemcrypto',
|
||||
'-Doemcrypto_lib=',
|
||||
'cdm/cdm_api_external.gyp',
|
||||
'-Dcompany_name="www"',
|
||||
'-Dmodel_name="www"',
|
||||
'-Darchitecture_name="x86-64"',
|
||||
'-Ddevice_name="x86-64 Linux"',
|
||||
'-Dproduct_name="x86-64 cdm"',
|
||||
'-Dbuildinfo_data="cdm_partner_2.0"',
|
||||
'--include=build/platforms/x86-64/x86-64.gypi',
|
||||
]
|
||||
|
||||
# Comment out "V:1" if you want non-verbose make, it's not based on bool value.
|
||||
|
||||
export_variables = {
|
||||
'V':'1', \
|
||||
'builddir_name':'$(CDM_TOP)/out/x86-64', \
|
||||
}
|
||||
40
build/protoc.gypi
Normal file
40
build/protoc.gypi
Normal file
@@ -0,0 +1,40 @@
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
{
|
||||
'variables': {
|
||||
'cc_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out/<(proto_out_dir)',
|
||||
'proto_in_dir%': '.',
|
||||
},
|
||||
'rules': [
|
||||
{
|
||||
'rule_name': 'genproto',
|
||||
'extension': 'proto',
|
||||
'outputs': [
|
||||
'<(cc_dir)/<(RULE_INPUT_ROOT).pb.cc',
|
||||
'<(cc_dir)/<(RULE_INPUT_ROOT).pb.h',
|
||||
],
|
||||
'action': [
|
||||
'<(protoc_dir)/protoc',
|
||||
'--proto_path=<(proto_in_dir)',
|
||||
# Naively you'd use <(RULE_INPUT_PATH) here, but protoc requires
|
||||
# --proto_path is a strict prefix of the path given as an argument.
|
||||
'<(proto_in_dir)/<(RULE_INPUT_ROOT)<(RULE_INPUT_EXT)',
|
||||
'--cpp_out=<(cc_dir)',
|
||||
],
|
||||
'message': 'Generating C++ code from <(RULE_INPUT_PATH) ccdir=<(cc_dir)',
|
||||
'process_outputs_as_sources': 1,
|
||||
},
|
||||
],
|
||||
'include_dirs': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/protoc_out',
|
||||
'<(proto_out_dir)',
|
||||
],
|
||||
'direct_dependent_settings': {
|
||||
'include_dirs': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/protoc_out',
|
||||
'<(cc_dir)',
|
||||
]
|
||||
},
|
||||
# This target exports a hard dependency because it generates header
|
||||
# files.
|
||||
'hard_dependency': 1,
|
||||
}
|
||||
Reference in New Issue
Block a user