Source release v2.1.5-0-811 + third_party libs

Change-Id: Ic8eafba071e486e671257bc22a8208e86d68b08a
This commit is contained in:
Joey Parrish
2014-07-07 16:22:33 -07:00
parent d7cd9243b0
commit fa64436e4f
13 changed files with 184 additions and 170 deletions

View File

@@ -1,5 +1,5 @@
README.upgrading for Widevine CDM Partner Kit v2.1 README.upgrading for Widevine CDM Partner Kit v2.1
Date: 7/02/2014 Date: 7/07/2014
This document provides details on important changes between versions of the This document provides details on important changes between versions of the
Widevine CDM. Some upgrades may require you to make changes to your Widevine CDM. Some upgrades may require you to make changes to your
@@ -9,13 +9,13 @@ NOTE: All gyp variables have default values in platforms/global_config.gypi.
You may override these defaults in your platform-specific gypi. You may override these defaults in your platform-specific gypi.
New in v2.1.4: New in v2.1.5:
===== =====
New gyp variables have been introduced to make the build more configurable: New gyp variables have been introduced to make the build more configurable:
* protobuf_gyp * protobuf_lib_type and protobuf_lib
For gyp-based projects with their own internal version of protobuf, allows These, along with 'protoc_dir', form a new protobuf configuration model
the path to the protobuf gyp file to be overridden. The default is and replace the variables 'protobuf_source_dir', 'use_system_protobuf',
third_party/protobuf.gyp. Ignored if use_system_protobuf is 'true'. and 'protobuf_gyp'. For details, see platforms/global_config.gypi.
New in v2.1.3: New in v2.1.3:
@@ -103,12 +103,3 @@ updated in oemcrypto/include. The following functions were added:
The file ./platforms/x86-64/x86-64.gypi now contains examples of how settings The file ./platforms/x86-64/x86-64.gypi now contains examples of how settings
can be customized for a given platform. can be customized for a given platform.
New gyp variables have been introduced to make the build more configurable:
* use_system_protobuf
Allows building protobuf from source, rather than using a system-wide
installation of the library and its tools. Defaults to 'true'.
* protobuf_source_dir
The path to the protobuf sources. Ignored if use_system_protobuf is
'true'. The source dir is expected to have a valid config.h for the
platform.

View File

@@ -4,8 +4,6 @@
# setting up your system, performing the build, and using/testing # setting up your system, performing the build, and using/testing
# the build targets. # the build targets.
# Set external_build=0 via GYP_DEFINES if debug information in
# libwvcdm_shared.so is desirable.
{ {
'targets': [ 'targets': [
{ {
@@ -14,7 +12,6 @@
'sources': ['../core/src/license_protocol.proto',], 'sources': ['../core/src/license_protocol.proto',],
'variables': { 'variables': {
'proto_in_dir': '../core/src', 'proto_in_dir': '../core/src',
'proto_out_dir': 'license_protocol',
}, },
'includes': ['../third_party/protoc.gypi'], 'includes': ['../third_party/protoc.gypi'],
}, },
@@ -24,7 +21,6 @@
'sources': ['../core/src/device_files.proto',], 'sources': ['../core/src/device_files.proto',],
'variables': { 'variables': {
'proto_in_dir': '../core/src', 'proto_in_dir': '../core/src',
'proto_out_dir': 'device_files',
}, },
'includes': ['../third_party/protoc.gypi'], 'includes': ['../third_party/protoc.gypi'],
}, },
@@ -57,10 +53,15 @@
'wvcdm_sysdep', 'wvcdm_sysdep',
'<(oemcrypto_target)', '<(oemcrypto_target)',
], ],
# Without this, library deps do not propagate from the protocol targets
# up to the shared lib or executable above.
'export_dependent_settings': [
'device_files',
'license_protocol',
],
'include_dirs': [ 'include_dirs': [
'../cdm/include', '../cdm/include',
'../core/include', '../core/include',
'../third_party/gmock/include',
'../linux/include', '../linux/include',
'../oemcrypto/include', '../oemcrypto/include',
], ],
@@ -99,13 +100,6 @@
'../core/src/oemcrypto_adapter_static_v8.cpp', '../core/src/oemcrypto_adapter_static_v8.cpp',
], ],
}], }],
['use_system_protobuf=="true"', {
'direct_dependent_settings': {
'libraries': [
'-lprotobuf',
],
},
}],
], ],
}, },
{ {

View File

@@ -1,3 +1,3 @@
// Widevine CDM Kit Version // Widevine CDM Kit Version
#define WV_CDM_VERSION "v2.1.4-0-804" #define WV_CDM_VERSION "v2.1.5-0-811"

View File

@@ -83,8 +83,9 @@ class CdmSession {
virtual void OnTimerEvent(); virtual void OnTimerEvent();
virtual void OnKeyReleaseEvent(const CdmKeySetId& key_set_id); virtual void OnKeyReleaseEvent(const CdmKeySetId& key_set_id);
virtual SecurityLevel GetRequestedSecurityLevel(); virtual SecurityLevel GetRequestedSecurityLevel() {
virtual CdmSecurityLevel GetSecurityLevel(); return requested_security_level_; }
virtual CdmSecurityLevel GetSecurityLevel() { return security_level_; }
virtual CdmResponseType UpdateUsageInformation(); virtual CdmResponseType UpdateUsageInformation();
@@ -119,7 +120,9 @@ class CdmSession {
bool is_release_; bool is_release_;
bool is_usage_update_needed_; bool is_usage_update_needed_;
bool is_initial_decryption_; bool is_initial_decryption_;
CdmSecurityLevel security_level_; CdmSecurityLevel security_level_;
SecurityLevel requested_security_level_;
// information useful for offline and usage scenarios // information useful for offline and usage scenarios
CdmKeyMessage key_request_; CdmKeyMessage key_request_;

View File

@@ -8,7 +8,7 @@ namespace wvcdm {
bool BufferReader::Read1(uint8_t* v) { bool BufferReader::Read1(uint8_t* v) {
if (!HasBytes(1)) { if (!HasBytes(1)) {
LOGE("BufferReader::Read1 : Failure while parsing: Not enough bytes (1)"); LOGW("BufferReader::Read1 : Failure while parsing: Not enough bytes (1)");
return false; return false;
} }
@@ -19,7 +19,7 @@ bool BufferReader::Read1(uint8_t* v) {
// Internal implementation of multi-byte reads // Internal implementation of multi-byte reads
template<typename T> bool BufferReader::Read(T* v) { template<typename T> bool BufferReader::Read(T* v) {
if (!HasBytes(sizeof(T))) { if (!HasBytes(sizeof(T))) {
LOGE("BufferReader::Read<T> : Failure during parse: Not enough bytes (%u)", LOGW("BufferReader::Read<T> : Failure during parse: Not enough bytes (%u)",
sizeof(T)); sizeof(T));
return false; return false;
} }
@@ -42,7 +42,7 @@ bool BufferReader::Read8s(int64_t* v) { return Read(v); }
bool BufferReader::ReadString(std::string* str, int count) { bool BufferReader::ReadString(std::string* str, int count) {
if (!HasBytes(count)) { if (!HasBytes(count)) {
LOGE("BufferReader::ReadString : Parse Failure: Not enough bytes (%d)", LOGW("BufferReader::ReadString : Parse Failure: Not enough bytes (%d)",
count); count);
return false; return false;
} }
@@ -54,7 +54,7 @@ bool BufferReader::ReadString(std::string* str, int count) {
bool BufferReader::ReadVec(std::vector<uint8_t>* vec, int count) { bool BufferReader::ReadVec(std::vector<uint8_t>* vec, int count) {
if (!HasBytes(count)) { if (!HasBytes(count)) {
LOGE("BufferReader::ReadVec : Parse Failure: Not enough bytes (%d)", count); LOGW("BufferReader::ReadVec : Parse Failure: Not enough bytes (%d)", count);
return false; return false;
} }
@@ -66,7 +66,7 @@ bool BufferReader::ReadVec(std::vector<uint8_t>* vec, int count) {
bool BufferReader::SkipBytes(int bytes) { bool BufferReader::SkipBytes(int bytes) {
if (!HasBytes(bytes)) { if (!HasBytes(bytes)) {
LOGE("BufferReader::SkipBytes : Parse Failure: Not enough bytes (%d)", LOGW("BufferReader::SkipBytes : Parse Failure: Not enough bytes (%d)",
bytes); bytes);
return false; return false;
} }

View File

@@ -73,8 +73,12 @@ void CdmSession::Create(
is_release_ = false; is_release_ = false;
is_usage_update_needed_ = false; is_usage_update_needed_ = false;
is_initial_decryption_ = true; is_initial_decryption_ = true;
security_level_ = crypto_session_.get()->GetSecurityLevel(); requested_security_level_ = kLevelDefault;
if (cdm_client_property_set) { if (NULL != cdm_client_property_set) {
if (QUERY_VALUE_SECURITY_LEVEL_L3.compare(
cdm_client_property_set->security_level()) == 0) {
requested_security_level_ = kLevel3;
}
Properties::AddSessionPropertySet(session_id_, cdm_client_property_set); Properties::AddSessionPropertySet(session_id_, cdm_client_property_set);
} }
} }
@@ -90,8 +94,9 @@ CdmResponseType CdmSession::Init() {
LOGE("CdmSession::Init: Failed due to previous initialization"); LOGE("CdmSession::Init: Failed due to previous initialization");
return UNKNOWN_ERROR; return UNKNOWN_ERROR;
} }
CdmResponseType sts = crypto_session_->Open(GetRequestedSecurityLevel()); CdmResponseType sts = crypto_session_->Open(requested_security_level_);
if (NO_ERROR != sts) return sts; if (NO_ERROR != sts) return sts;
security_level_ = crypto_session_->GetSecurityLevel();
std::string token; std::string token;
if (Properties::use_certificates_as_identification()) { if (Properties::use_certificates_as_identification()) {
@@ -271,7 +276,7 @@ CdmResponseType CdmSession::QueryStatus(CdmQueryMap* key_info) {
return UNKNOWN_ERROR; return UNKNOWN_ERROR;
} }
switch (crypto_session_->GetSecurityLevel()) { switch (security_level_) {
case kSecurityLevelL1: case kSecurityLevelL1:
(*key_info)[QUERY_KEY_SECURITY_LEVEL] = QUERY_VALUE_SECURITY_LEVEL_L1; (*key_info)[QUERY_KEY_SECURITY_LEVEL] = QUERY_VALUE_SECURITY_LEVEL_L1;
break; break;
@@ -530,23 +535,6 @@ void CdmSession::OnKeyReleaseEvent(const CdmKeySetId& key_set_id) {
} }
} }
SecurityLevel CdmSession::GetRequestedSecurityLevel() {
std::string security_level;
if (Properties::GetSecurityLevel(session_id_, &security_level) &&
security_level == QUERY_VALUE_SECURITY_LEVEL_L3) {
return kLevel3;
}
return kLevelDefault;
}
CdmSecurityLevel CdmSession::GetSecurityLevel() {
if (NULL == crypto_session_.get())
return kSecurityLevelUninitialized;
return crypto_session_.get()->GetSecurityLevel();
}
CdmResponseType CdmSession::UpdateUsageInformation() { CdmResponseType CdmSession::UpdateUsageInformation() {
return crypto_session_->UpdateUsageInformation(); return crypto_session_->UpdateUsageInformation();
} }

View File

@@ -168,13 +168,9 @@ bool CryptoSession::GetApiVersion(uint32_t* version) {
if (!initialized_) { if (!initialized_) {
return false; return false;
} }
CdmSecurityLevel level = GetSecurityLevel();
SecurityLevel security_level = kLevelDefault;
if (kSecurityLevelL3 == level) security_level = kLevel3;
LOGV("CryptoSession::GetApiVersion: Lock"); LOGV("CryptoSession::GetApiVersion: Lock");
AutoLock auto_lock(crypto_lock_); *version = OEMCrypto_APIVersion(requested_security_level_);
*version = OEMCrypto_APIVersion(security_level);
return true; return true;
} }

View File

@@ -65,8 +65,6 @@ bool Properties::GetSecurityLevel(const CdmSessionId& session_id,
const CdmClientPropertySet* property_set = const CdmClientPropertySet* property_set =
GetCdmClientPropertySet(session_id); GetCdmClientPropertySet(session_id);
if (NULL == property_set) { if (NULL == property_set) {
LOGE("Properties::GetSecurityLevel: cannot find property set for %s",
session_id.c_str());
return false; return false;
} }
*security_level = property_set->security_level(); *security_level = property_set->security_level();
@@ -78,8 +76,6 @@ bool Properties::GetServiceCertificate(const CdmSessionId& session_id,
const CdmClientPropertySet* property_set = const CdmClientPropertySet* property_set =
GetCdmClientPropertySet(session_id); GetCdmClientPropertySet(session_id);
if (NULL == property_set) { if (NULL == property_set) {
LOGE("Properties::GetServiceCertificate: cannot find property set for %s",
session_id.c_str());
return false; return false;
} }
*service_certificate = property_set->service_certificate(); *service_certificate = property_set->service_certificate();
@@ -90,8 +86,6 @@ bool Properties::UsePrivacyMode(const CdmSessionId& session_id) {
const CdmClientPropertySet* property_set = const CdmClientPropertySet* property_set =
GetCdmClientPropertySet(session_id); GetCdmClientPropertySet(session_id);
if (NULL == property_set) { if (NULL == property_set) {
LOGE("Properties::UsePrivacyMode: cannot find property set for %s",
session_id.c_str());
return false; return false;
} }
return property_set->use_privacy_mode(); return property_set->use_privacy_mode();
@@ -101,8 +95,6 @@ uint32_t Properties::GetSessionSharingId(const CdmSessionId& session_id) {
const CdmClientPropertySet* property_set = const CdmClientPropertySet* property_set =
GetCdmClientPropertySet(session_id); GetCdmClientPropertySet(session_id);
if (NULL == property_set) { if (NULL == property_set) {
LOGE("Properties::GetSessionSharingId: cannot find property set for %s",
session_id.c_str());
return 0; return 0;
} }
return property_set->session_sharing_id(); return property_set->session_sharing_id();

View File

@@ -91,6 +91,7 @@ using ::testing::Eq;
using ::testing::NotNull; using ::testing::NotNull;
using ::testing::Return; using ::testing::Return;
using ::testing::SetArgPointee; using ::testing::SetArgPointee;
using ::testing::Sequence;
using ::testing::StrEq; using ::testing::StrEq;
class MockDeviceFiles : public DeviceFiles { class MockDeviceFiles : public DeviceFiles {
@@ -150,15 +151,20 @@ class CdmSessionTest : public ::testing::Test {
}; };
TEST_F(CdmSessionTest, InitWithCertificate) { TEST_F(CdmSessionTest, InitWithCertificate) {
Sequence crypto_session_seq;
CdmSecurityLevel level = kSecurityLevelL1; CdmSecurityLevel level = kSecurityLevelL1;
EXPECT_CALL(*crypto_session_, GetSecurityLevel()).WillOnce(Return(level));
EXPECT_CALL(*crypto_session_, Open(Eq(kLevelDefault))) EXPECT_CALL(*crypto_session_, Open(Eq(kLevelDefault)))
.InSequence(crypto_session_seq)
.WillOnce(Return(NO_ERROR)); .WillOnce(Return(NO_ERROR));
EXPECT_CALL(*crypto_session_, GetSecurityLevel())
.InSequence(crypto_session_seq)
.WillOnce(Return(level));
EXPECT_CALL(*file_handle_, Init(Eq(level))).WillOnce(Return(true)); EXPECT_CALL(*file_handle_, Init(Eq(level))).WillOnce(Return(true));
EXPECT_CALL(*file_handle_, RetrieveCertificate(NotNull(), NotNull())) EXPECT_CALL(*file_handle_, RetrieveCertificate(NotNull(), NotNull()))
.WillOnce(DoAll(SetArgPointee<0>(kToken), SetArgPointee<1>(kWrappedKey), .WillOnce(DoAll(SetArgPointee<0>(kToken), SetArgPointee<1>(kWrappedKey),
Return(true))); Return(true)));
EXPECT_CALL(*crypto_session_, LoadCertificatePrivateKey(StrEq(kWrappedKey))) EXPECT_CALL(*crypto_session_, LoadCertificatePrivateKey(StrEq(kWrappedKey)))
.InSequence(crypto_session_seq)
.WillOnce(Return(true)); .WillOnce(Return(true));
EXPECT_CALL(*license_parser_, EXPECT_CALL(*license_parser_,
Init(Eq(kToken), Eq(crypto_session_), Eq(policy_engine_))) Init(Eq(kToken), Eq(crypto_session_), Eq(policy_engine_)))
@@ -171,11 +177,16 @@ TEST_F(CdmSessionTest, InitWithCertificate) {
} }
TEST_F(CdmSessionTest, InitWithKeybox) { TEST_F(CdmSessionTest, InitWithKeybox) {
Sequence crypto_session_seq;
CdmSecurityLevel level = kSecurityLevelL1; CdmSecurityLevel level = kSecurityLevelL1;
EXPECT_CALL(*crypto_session_, GetSecurityLevel()).WillOnce(Return(level));
EXPECT_CALL(*crypto_session_, Open(Eq(kLevelDefault))) EXPECT_CALL(*crypto_session_, Open(Eq(kLevelDefault)))
.InSequence(crypto_session_seq)
.WillOnce(Return(NO_ERROR)); .WillOnce(Return(NO_ERROR));
EXPECT_CALL(*crypto_session_, GetSecurityLevel())
.InSequence(crypto_session_seq)
.WillOnce(Return(level));
EXPECT_CALL(*crypto_session_, GetToken(NotNull())) EXPECT_CALL(*crypto_session_, GetToken(NotNull()))
.InSequence(crypto_session_seq)
.WillOnce(DoAll(SetArgPointee<0>(kToken), Return(true))); .WillOnce(DoAll(SetArgPointee<0>(kToken), Return(true)));
EXPECT_CALL(*license_parser_, EXPECT_CALL(*license_parser_,
Init(Eq(kToken), Eq(crypto_session_), Eq(policy_engine_))) Init(Eq(kToken), Eq(crypto_session_), Eq(policy_engine_)))
@@ -188,15 +199,20 @@ TEST_F(CdmSessionTest, InitWithKeybox) {
} }
TEST_F(CdmSessionTest, ReInitFail) { TEST_F(CdmSessionTest, ReInitFail) {
Sequence crypto_session_seq;
CdmSecurityLevel level = kSecurityLevelL1; CdmSecurityLevel level = kSecurityLevelL1;
EXPECT_CALL(*crypto_session_, GetSecurityLevel()).WillOnce(Return(level));
EXPECT_CALL(*crypto_session_, Open(Eq(kLevelDefault))) EXPECT_CALL(*crypto_session_, Open(Eq(kLevelDefault)))
.InSequence(crypto_session_seq)
.WillOnce(Return(NO_ERROR)); .WillOnce(Return(NO_ERROR));
EXPECT_CALL(*crypto_session_, GetSecurityLevel())
.InSequence(crypto_session_seq)
.WillOnce(Return(level));
EXPECT_CALL(*file_handle_, Init(Eq(level))).WillOnce(Return(true)); EXPECT_CALL(*file_handle_, Init(Eq(level))).WillOnce(Return(true));
EXPECT_CALL(*file_handle_, RetrieveCertificate(NotNull(), NotNull())) EXPECT_CALL(*file_handle_, RetrieveCertificate(NotNull(), NotNull()))
.WillOnce(DoAll(SetArgPointee<0>(kToken), SetArgPointee<1>(kWrappedKey), .WillOnce(DoAll(SetArgPointee<0>(kToken), SetArgPointee<1>(kWrappedKey),
Return(true))); Return(true)));
EXPECT_CALL(*crypto_session_, LoadCertificatePrivateKey(StrEq(kWrappedKey))) EXPECT_CALL(*crypto_session_, LoadCertificatePrivateKey(StrEq(kWrappedKey)))
.InSequence(crypto_session_seq)
.WillOnce(Return(true)); .WillOnce(Return(true));
EXPECT_CALL(*license_parser_, EXPECT_CALL(*license_parser_,
Init(Eq(kToken), Eq(crypto_session_), Eq(policy_engine_))) Init(Eq(kToken), Eq(crypto_session_), Eq(policy_engine_)))
@@ -211,7 +227,6 @@ TEST_F(CdmSessionTest, ReInitFail) {
TEST_F(CdmSessionTest, InitFailCryptoError) { TEST_F(CdmSessionTest, InitFailCryptoError) {
CdmSecurityLevel level = kSecurityLevelL1; CdmSecurityLevel level = kSecurityLevelL1;
EXPECT_CALL(*crypto_session_, GetSecurityLevel()).WillOnce(Return(level));
EXPECT_CALL(*crypto_session_, Open(Eq(kLevelDefault))) EXPECT_CALL(*crypto_session_, Open(Eq(kLevelDefault)))
.WillOnce(Return(UNKNOWN_ERROR)); .WillOnce(Return(UNKNOWN_ERROR));
@@ -222,10 +237,14 @@ TEST_F(CdmSessionTest, InitFailCryptoError) {
} }
TEST_F(CdmSessionTest, InitNeedsProvisioning) { TEST_F(CdmSessionTest, InitNeedsProvisioning) {
Sequence crypto_session_seq;
CdmSecurityLevel level = kSecurityLevelL1; CdmSecurityLevel level = kSecurityLevelL1;
EXPECT_CALL(*crypto_session_, GetSecurityLevel()).WillOnce(Return(level));
EXPECT_CALL(*crypto_session_, Open(Eq(kLevelDefault))) EXPECT_CALL(*crypto_session_, Open(Eq(kLevelDefault)))
.InSequence(crypto_session_seq)
.WillOnce(Return(NO_ERROR)); .WillOnce(Return(NO_ERROR));
EXPECT_CALL(*crypto_session_, GetSecurityLevel())
.InSequence(crypto_session_seq)
.WillOnce(Return(level));
EXPECT_CALL(*file_handle_, Init(Eq(level))).WillOnce(Return(true)); EXPECT_CALL(*file_handle_, Init(Eq(level))).WillOnce(Return(true));
EXPECT_CALL(*file_handle_, RetrieveCertificate(NotNull(), NotNull())) EXPECT_CALL(*file_handle_, RetrieveCertificate(NotNull(), NotNull()))
.WillOnce(Return(false)); .WillOnce(Return(false));

View File

@@ -2879,14 +2879,15 @@ TEST_F(DISABLED_TestKeybox, RSASignature) {
OEMCrypto_GetRandom(&licenseRequest[0], licenseRequest.size()); OEMCrypto_GetRandom(&licenseRequest[0], licenseRequest.size());
size_t signature_length = 0; size_t signature_length = 0;
uint8_t signature[500];
sts = OEMCrypto_GenerateRSASignature(s.session_id(), &licenseRequest[0], sts = OEMCrypto_GenerateRSASignature(s.session_id(), &licenseRequest[0],
licenseRequest.size(), signature, licenseRequest.size(), signature,
&signature_length, kSign_RSASSA_PSS); &signature_length, kSign_RSASSA_PSS);
ASSERT_EQ(OEMCrypto_ERROR_SHORT_BUFFER, sts); ASSERT_EQ(OEMCrypto_ERROR_SHORT_BUFFER, sts);
ASSERT_NE(static_cast<size_t>(0), signature_length); ASSERT_NE(static_cast<size_t>(0), signature_length);
ASSERT_GE(sizeof(signature), signature_length);
uint8_t* signature = new uint8_t[signature_length];
sts = OEMCrypto_GenerateRSASignature(s.session_id(), &licenseRequest[0], sts = OEMCrypto_GenerateRSASignature(s.session_id(), &licenseRequest[0],
licenseRequest.size(), signature, licenseRequest.size(), signature,
@@ -2898,7 +2899,6 @@ TEST_F(DISABLED_TestKeybox, RSASignature) {
s.PreparePublicKey(); s.PreparePublicKey();
s.VerifyRSASignature(&licenseRequest[0], licenseRequest.size(), signature, s.VerifyRSASignature(&licenseRequest[0], licenseRequest.size(), signature,
signature_length, kSign_RSASSA_PSS); signature_length, kSign_RSASSA_PSS);
delete[] signature;
} }
TEST_F(DISABLED_TestKeybox, LoadRSASessionKey) { TEST_F(DISABLED_TestKeybox, LoadRSASessionKey) {

View File

@@ -12,13 +12,29 @@
'buildinfo_data%': '"UndefinedBuildInfo"', 'buildinfo_data%': '"UndefinedBuildInfo"',
'oemcrypto_target%': '../oemcrypto/mock/oec_mock.gyp:oec_mock', 'oemcrypto_target%': '../oemcrypto/mock/oec_mock.gyp:oec_mock',
'oemcrypto_v8%': 'false', 'oemcrypto_v8%': 'false',
'protobuf_source_dir%': '',
'use_system_protobuf%': 'true',
'protoc_dir%': '/usr/bin',
'certificate_provision%': 'false', 'certificate_provision%': 'false',
'force_use_of_secure_buffers%': 'false', 'force_use_of_secure_buffers%': 'false',
'disable_privacy_crypto%': 'false', 'disable_privacy_crypto%': 'false',
'protobuf_gyp%': '<(DEPTH)/third_party/protobuf.gyp',
# There are three protobuf configurations:
#
# 1) protobuf_lib_type == 'system'
# Use a system-wide installation of protobuf.
# Specify the protobuf library in protobuf_lib.
# Specify the path to protoc in protoc_dir.
#
# 2) protobuf_lib_type == 'target'
# Use an existing protobuf gyp target from your project.
# Specify the protobuf gyp file and target in protobuf_lib.
# Specify the path to protoc in protoc_dir.
#
# 3) protobuf_lib_type == 'source'
# Build protobuf and protoc from source.
# Specify the path to the protobuf source in protobuf_lib.
# Make sure that a valid config.h for your target is in the source tree.
'protobuf_lib_type%': 'system',
'protobuf_lib%': '-lprotobuf',
'protoc_dir%': '/usr/bin',
}, # end variables }, # end variables
'target_defaults': { 'target_defaults': {

View File

@@ -1,8 +1,8 @@
# Copyright 2014 Google Inc. All Rights Reserved. # Copyright 2014 Google Inc. All Rights Reserved.
# Describes building protobuf and protoc from sources. # Describes building protobuf and protoc from sources.
# Requires configuration of protobuf_source_dir and setting of # Requires configuration of protobuf_lib and setting of
# use_system_protobuf to false. # protobuf_lib_type to 'source'.
{ {
# Some sources are used by both libprotobuf_lite and libprotobuf. # Some sources are used by both libprotobuf_lite and libprotobuf.
@@ -13,21 +13,21 @@
# instead. # instead.
'variables': { 'variables': {
'protobuf_lite_sources': [ 'protobuf_lite_sources': [
'<(protobuf_source_dir)/src/google/protobuf/extension_set.cc', '<(protobuf_lib)/src/google/protobuf/extension_set.cc',
'<(protobuf_source_dir)/src/google/protobuf/generated_message_util.cc', '<(protobuf_lib)/src/google/protobuf/generated_message_util.cc',
'<(protobuf_source_dir)/src/google/protobuf/message_lite.cc', '<(protobuf_lib)/src/google/protobuf/message_lite.cc',
'<(protobuf_source_dir)/src/google/protobuf/repeated_field.cc', '<(protobuf_lib)/src/google/protobuf/repeated_field.cc',
'<(protobuf_source_dir)/src/google/protobuf/wire_format_lite.cc', '<(protobuf_lib)/src/google/protobuf/wire_format_lite.cc',
'<(protobuf_source_dir)/src/google/protobuf/io/coded_stream.cc', '<(protobuf_lib)/src/google/protobuf/io/coded_stream.cc',
'<(protobuf_source_dir)/src/google/protobuf/io/zero_copy_stream.cc', '<(protobuf_lib)/src/google/protobuf/io/zero_copy_stream.cc',
'<(protobuf_source_dir)/src/google/protobuf/io/zero_copy_stream_impl_lite.cc', '<(protobuf_lib)/src/google/protobuf/io/zero_copy_stream_impl_lite.cc',
'<(protobuf_source_dir)/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc', '<(protobuf_lib)/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc',
'<(protobuf_source_dir)/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc', '<(protobuf_lib)/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc',
'<(protobuf_source_dir)/src/google/protobuf/stubs/common.cc', '<(protobuf_lib)/src/google/protobuf/stubs/common.cc',
'<(protobuf_source_dir)/src/google/protobuf/stubs/once.cc', '<(protobuf_lib)/src/google/protobuf/stubs/once.cc',
'<(protobuf_source_dir)/src/google/protobuf/stubs/stringprintf.cc', '<(protobuf_lib)/src/google/protobuf/stubs/stringprintf.cc',
], ],
}, },
'targets': [ 'targets': [
@@ -39,12 +39,12 @@
'<@(protobuf_lite_sources)', '<@(protobuf_lite_sources)',
], ],
'include_dirs': [ 'include_dirs': [
'<(protobuf_source_dir)', '<(protobuf_lib)',
'<(protobuf_source_dir)/src', '<(protobuf_lib)/src',
], ],
'direct_dependent_settings': { 'direct_dependent_settings': {
'include_dirs': [ 'include_dirs': [
'<(protobuf_source_dir)/src', '<(protobuf_lib)/src',
], ],
}, },
}, },
@@ -56,34 +56,34 @@
'sources': [ 'sources': [
'<@(protobuf_lite_sources)', '<@(protobuf_lite_sources)',
'<(protobuf_source_dir)/src/google/protobuf/descriptor.cc', '<(protobuf_lib)/src/google/protobuf/descriptor.cc',
'<(protobuf_source_dir)/src/google/protobuf/descriptor.pb.cc', '<(protobuf_lib)/src/google/protobuf/descriptor.pb.cc',
'<(protobuf_source_dir)/src/google/protobuf/descriptor_database.cc', '<(protobuf_lib)/src/google/protobuf/descriptor_database.cc',
'<(protobuf_source_dir)/src/google/protobuf/dynamic_message.cc', '<(protobuf_lib)/src/google/protobuf/dynamic_message.cc',
'<(protobuf_source_dir)/src/google/protobuf/extension_set_heavy.cc', '<(protobuf_lib)/src/google/protobuf/extension_set_heavy.cc',
'<(protobuf_source_dir)/src/google/protobuf/generated_message_reflection.cc', '<(protobuf_lib)/src/google/protobuf/generated_message_reflection.cc',
'<(protobuf_source_dir)/src/google/protobuf/message.cc', '<(protobuf_lib)/src/google/protobuf/message.cc',
'<(protobuf_source_dir)/src/google/protobuf/reflection_ops.cc', '<(protobuf_lib)/src/google/protobuf/reflection_ops.cc',
'<(protobuf_source_dir)/src/google/protobuf/service.cc', '<(protobuf_lib)/src/google/protobuf/service.cc',
'<(protobuf_source_dir)/src/google/protobuf/text_format.cc', '<(protobuf_lib)/src/google/protobuf/text_format.cc',
'<(protobuf_source_dir)/src/google/protobuf/unknown_field_set.cc', '<(protobuf_lib)/src/google/protobuf/unknown_field_set.cc',
'<(protobuf_source_dir)/src/google/protobuf/wire_format.cc', '<(protobuf_lib)/src/google/protobuf/wire_format.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/importer.cc', '<(protobuf_lib)/src/google/protobuf/compiler/importer.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/parser.cc', '<(protobuf_lib)/src/google/protobuf/compiler/parser.cc',
'<(protobuf_source_dir)/src/google/protobuf/io/gzip_stream.cc', '<(protobuf_lib)/src/google/protobuf/io/gzip_stream.cc',
'<(protobuf_source_dir)/src/google/protobuf/io/printer.cc', '<(protobuf_lib)/src/google/protobuf/io/printer.cc',
'<(protobuf_source_dir)/src/google/protobuf/io/tokenizer.cc', '<(protobuf_lib)/src/google/protobuf/io/tokenizer.cc',
'<(protobuf_source_dir)/src/google/protobuf/io/zero_copy_stream_impl.cc', '<(protobuf_lib)/src/google/protobuf/io/zero_copy_stream_impl.cc',
'<(protobuf_source_dir)/src/google/protobuf/stubs/structurally_valid.cc', '<(protobuf_lib)/src/google/protobuf/stubs/structurally_valid.cc',
'<(protobuf_source_dir)/src/google/protobuf/stubs/strutil.cc', '<(protobuf_lib)/src/google/protobuf/stubs/strutil.cc',
'<(protobuf_source_dir)/src/google/protobuf/stubs/substitute.cc', '<(protobuf_lib)/src/google/protobuf/stubs/substitute.cc',
], ],
'include_dirs': [ 'include_dirs': [
'<(protobuf_source_dir)', '<(protobuf_lib)',
'<(protobuf_source_dir)/src', '<(protobuf_lib)/src',
], ],
}, },
{ {
@@ -92,46 +92,46 @@
'toolsets': ['host'], 'toolsets': ['host'],
'includes': ['xcode_host.gypi'], # xcode workaround 'includes': ['xcode_host.gypi'], # xcode workaround
'sources': [ 'sources': [
'<(protobuf_source_dir)/src/google/protobuf/compiler/code_generator.cc', '<(protobuf_lib)/src/google/protobuf/compiler/code_generator.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/command_line_interface.cc', '<(protobuf_lib)/src/google/protobuf/compiler/command_line_interface.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/main.cc', '<(protobuf_lib)/src/google/protobuf/compiler/main.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/plugin.cc', '<(protobuf_lib)/src/google/protobuf/compiler/plugin.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/plugin.pb.cc', '<(protobuf_lib)/src/google/protobuf/compiler/plugin.pb.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/subprocess.cc', '<(protobuf_lib)/src/google/protobuf/compiler/subprocess.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/zip_writer.cc', '<(protobuf_lib)/src/google/protobuf/compiler/zip_writer.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/cpp/cpp_enum.cc', '<(protobuf_lib)/src/google/protobuf/compiler/cpp/cpp_enum.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/cpp/cpp_enum_field.cc', '<(protobuf_lib)/src/google/protobuf/compiler/cpp/cpp_enum_field.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/cpp/cpp_extension.cc', '<(protobuf_lib)/src/google/protobuf/compiler/cpp/cpp_extension.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/cpp/cpp_field.cc', '<(protobuf_lib)/src/google/protobuf/compiler/cpp/cpp_field.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/cpp/cpp_file.cc', '<(protobuf_lib)/src/google/protobuf/compiler/cpp/cpp_file.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/cpp/cpp_generator.cc', '<(protobuf_lib)/src/google/protobuf/compiler/cpp/cpp_generator.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/cpp/cpp_helpers.cc', '<(protobuf_lib)/src/google/protobuf/compiler/cpp/cpp_helpers.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/cpp/cpp_message.cc', '<(protobuf_lib)/src/google/protobuf/compiler/cpp/cpp_message.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/cpp/cpp_message_field.cc', '<(protobuf_lib)/src/google/protobuf/compiler/cpp/cpp_message_field.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc', '<(protobuf_lib)/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/cpp/cpp_service.cc', '<(protobuf_lib)/src/google/protobuf/compiler/cpp/cpp_service.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/cpp/cpp_string_field.cc', '<(protobuf_lib)/src/google/protobuf/compiler/cpp/cpp_string_field.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/java/java_doc_comment.cc', '<(protobuf_lib)/src/google/protobuf/compiler/java/java_doc_comment.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/java/java_enum.cc', '<(protobuf_lib)/src/google/protobuf/compiler/java/java_enum.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/java/java_enum_field.cc', '<(protobuf_lib)/src/google/protobuf/compiler/java/java_enum_field.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/java/java_extension.cc', '<(protobuf_lib)/src/google/protobuf/compiler/java/java_extension.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/java/java_field.cc', '<(protobuf_lib)/src/google/protobuf/compiler/java/java_field.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/java/java_file.cc', '<(protobuf_lib)/src/google/protobuf/compiler/java/java_file.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/java/java_generator.cc', '<(protobuf_lib)/src/google/protobuf/compiler/java/java_generator.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/java/java_helpers.cc', '<(protobuf_lib)/src/google/protobuf/compiler/java/java_helpers.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/java/java_message.cc', '<(protobuf_lib)/src/google/protobuf/compiler/java/java_message.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/java/java_message_field.cc', '<(protobuf_lib)/src/google/protobuf/compiler/java/java_message_field.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/java/java_primitive_field.cc', '<(protobuf_lib)/src/google/protobuf/compiler/java/java_primitive_field.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/java/java_service.cc', '<(protobuf_lib)/src/google/protobuf/compiler/java/java_service.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/java/java_string_field.cc', '<(protobuf_lib)/src/google/protobuf/compiler/java/java_string_field.cc',
'<(protobuf_source_dir)/src/google/protobuf/compiler/python/python_generator.cc', '<(protobuf_lib)/src/google/protobuf/compiler/python/python_generator.cc',
], ],
'include_dirs': [ 'include_dirs': [
'<(protobuf_source_dir)', '<(protobuf_lib)',
'<(protobuf_source_dir)/src', '<(protobuf_lib)/src',
], ],
'dependencies': [ 'dependencies': [
'protobuf', 'protobuf',

View File

@@ -1,25 +1,42 @@
# Copyright 2014 Google Inc. All rights reserved. # Copyright 2014 Google Inc. All rights reserved.
{ {
'variables': { 'variables': {
'cc_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out/<(proto_out_dir)', 'cc_dir': '<(SHARED_INTERMEDIATE_DIR)/protoc_out',
'proto_in_dir%': '.', 'proto_in_dir%': '.',
}, },
'conditions': [ 'conditions': [
['use_system_protobuf=="false"', { ['protobuf_lib_type=="system"', {
'variables': { # protobuf_lib is a library setting.
'protoc_dir': '<(PRODUCT_DIR)', 'direct_dependent_settings': {
'libraries': [
'<(protobuf_lib)',
],
}, },
}],
['protobuf_lib_type=="target"', {
# protobuf_lib is a gyp target.
'dependencies': [ 'dependencies': [
'<(protobuf_gyp):protoc#host', '<(protobuf_lib)',
'<(protobuf_gyp):protobuf_lite',
], ],
'export_dependent_settings': [ 'export_dependent_settings': [
# Direct dependents of protobuf_lite have the correct protobuf include '<(protobuf_lib)',
# path, so export this as a dep to anyone who depends on the sources
# generated by this target.
'<(protobuf_gyp):protobuf_lite',
], ],
}], }],
['protobuf_lib_type=="source"', {
# protobuf_lib is a source folder.
# We use protobuf.gyp to describe the build.
'dependencies': [
'../third_party/protobuf.gyp:protoc#host',
'../third_party/protobuf.gyp:protobuf_lite',
],
'export_dependent_settings': [
'../third_party/protobuf.gyp:protobuf_lite',
],
'variables': {
# Since we are building our own protoc, override protoc_dir.
'protoc_dir': '<(PRODUCT_DIR)',
},
}],
], ],
'rules': [ 'rules': [
{ {
@@ -42,12 +59,10 @@
}, },
], ],
'include_dirs': [ 'include_dirs': [
'<(SHARED_INTERMEDIATE_DIR)/protoc_out', '<(cc_dir)',
'<(proto_out_dir)',
], ],
'direct_dependent_settings': { 'direct_dependent_settings': {
'include_dirs': [ 'include_dirs': [
'<(SHARED_INTERMEDIATE_DIR)/protoc_out',
'<(cc_dir)', '<(cc_dir)',
] ]
}, },