Bug 1271169 - Move all device binding code into librlz and remove static runtime requirement. r=glandium draft
authorChris Pearce <cpearce@mozilla.com>
Fri, 20 May 2016 16:11:29 +1200
changeset 369948 f60f1e68649fa90cbe1f2fe09f5f69948444b1df
parent 369947 824c7a9841bce83c438decad48ce210f6c2a5571
child 369949 bea5acc878a639fb819051e19e23533c14c19927
push id18959
push usercpearce@mozilla.com
push dateTue, 24 May 2016 01:20:09 +0000
reviewersglandium
bugs1271169
milestone49.0a1
Bug 1271169 - Move all device binding code into librlz and remove static runtime requirement. r=glandium I want the EME device binding/nodeId code to be callable from gtests, as well as in plugin-container. I need this because I want to add a gtest that ensures that we don't regress the EME/GMP device binding code. I want to call the GMP device binding code in the gtest and in the GMP process, and compare the result. So we need to make it possible to link the device binding code into the gtests as well as plugin-container. So move all code that device binding calls into librlz, to make it easier to link against all the code required. Note: the device binding code needs to be statically linked into plugin-container so that it's covered by the Adobe CDM's voucher tool. MozReview-Commit-ID: AvBAe1dh49Z
dom/media/gmp/moz.build
dom/media/gmp/rlz/moz.build
dom/media/gmp/rlz/sha256.c
dom/media/gmp/rlz/sha256.h
dom/media/gtest/moz.build
ipc/app/moz.build
ipc/app/sha256.c
ipc/app/sha256.h
--- a/dom/media/gmp/moz.build
+++ b/dom/media/gmp/moz.build
@@ -74,16 +74,19 @@ EXPORTS += [
 ]
 
 # We link GMPLoader into xul on B2G/Fennec as its code does not need to be
 # covered by a DRM vendor's voucher.
 if CONFIG['OS_TARGET'] == 'Android':
     SOURCES += [
       'GMPLoader.cpp',
     ]
+    USE_LIBS += [
+        'rlz',
+    ]
 
 UNIFIED_SOURCES += [
     'GMPAudioDecoderChild.cpp',
     'GMPAudioDecoderParent.cpp',
     'GMPAudioHost.cpp',
     'GMPChild.cpp',
     'GMPContentChild.cpp',
     'GMPContentParent.cpp',
@@ -110,20 +113,19 @@ UNIFIED_SOURCES += [
     'GMPVideoEncodedFrameImpl.cpp',
     'GMPVideoEncoderChild.cpp',
     'GMPVideoEncoderParent.cpp',
     'GMPVideoHost.cpp',
     'GMPVideoi420FrameImpl.cpp',
     'GMPVideoPlaneImpl.cpp',
 ]
 
-if CONFIG['OS_TARGET'] in ('WINNT', 'Darwin'):
-  DIRS += [
-      'rlz',
-  ]
+DIRS += [
+    'rlz',
+]
 
 if 'widevine' in CONFIG['MOZ_EME_MODULES']:
   DIRS += [
       'widevine-adapter',
   ]
 
 IPDL_SOURCES += [
   'GMPTypes.ipdlh',
--- a/dom/media/gmp/rlz/moz.build
+++ b/dom/media/gmp/rlz/moz.build
@@ -3,30 +3,40 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 # Note: build rlz in its own moz.build, so it doesn't pickup any of
 # Chromium IPC's headers used in the moz.build of the parent file.
 
 Library('rlz')
-FORCE_STATIC_LIB = True
 
 UNIFIED_SOURCES += [
-    'lib/string_utils.cc',
+    'GMPDeviceBinding.cpp',
 ]
 
+if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_TARGET'] in ['WINNT', 'Darwin']:
+    DEFINES['HASH_NODE_ID_WITH_DEVICE_ID'] = 1;
+    UNIFIED_SOURCES += [
+        'lib/string_utils.cc',
+        'sha256.c',
+    ]
+
 if CONFIG['OS_TARGET'] == 'WINNT':
     UNIFIED_SOURCES += [
         'win/lib/machine_id_win.cc',
     ]
 
 if CONFIG['OS_TARGET'] == 'Darwin':
     UNIFIED_SOURCES += [
         'mac/lib/machine_id_mac.cc',
     ]
     OS_LIBS += [
         '-framework IOKit',
     ]
 
 LOCAL_INCLUDES += [
     '..',
 ]
+
+EXPORTS += [
+    'GMPDeviceBinding.h',
+]
rename from ipc/app/sha256.c
rename to dom/media/gmp/rlz/sha256.c
rename from ipc/app/sha256.h
rename to dom/media/gmp/rlz/sha256.h
--- a/dom/media/gtest/moz.build
+++ b/dom/media/gtest/moz.build
@@ -70,8 +70,12 @@ LOCAL_INCLUDES += [
     '/security/certverifier',
     '/security/pkix/include',
 ]
 
 FINAL_LIBRARY = 'xul-gtest'
 
 if CONFIG['GNU_CXX']:
     CXXFLAGS += ['-Wno-error=shadow']
+
+USE_LIBS += [
+   'rlz',
+]
--- a/ipc/app/moz.build
+++ b/ipc/app/moz.build
@@ -28,36 +28,31 @@ LOCAL_INCLUDES += [
 ]
 
 # We link GMPLoader into plugin-container on desktop so that its code is
 # covered by the desktop DRM vendor's voucher.
 if CONFIG['OS_TARGET'] != 'Android':
     SOURCES += [
         '../../dom/media/gmp/GMPLoader.cpp',
     ]
+    USE_LIBS += [
+        'rlz',
+    ]
 
 if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_ARCH'] == 'WINNT':
     # For sandbox includes and the include dependencies those have
     LOCAL_INCLUDES += [
         '/security/sandbox/chromium',
         '/security/sandbox/chromium-shim',
     ]
-    USE_LIBS += [
-        'rlz',
-    ]
 
     USE_LIBS += [
         'sandbox_s',
     ]
 
-    DEFINES['HASH_NODE_ID_WITH_DEVICE_ID'] = 1;
-    SOURCES += [
-        'sha256.c',
-    ]
-
 if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_TARGET'] in ('Linux', 'Android'):
     USE_LIBS += [
         'mozsandbox',
     ]
 
     # gcc lto likes to put the top level asm in syscall.cc in a different partition
     # from the function using it which breaks the build.  Work around that by
     # forcing there to be only one partition.
@@ -67,22 +62,16 @@ if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_
 if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_TARGET'] == 'Darwin':
     # For sandbox includes and the include dependencies those have
     LOCAL_INCLUDES += [
         '/security/sandbox/chromium',
         '/security/sandbox/chromium-shim',
     ]
     USE_LIBS += [
         'mozsandbox',
-        'rlz',
-    ]
-
-    DEFINES['HASH_NODE_ID_WITH_DEVICE_ID'] = 1;
-    SOURCES += [
-        'sha256.c',
     ]
 
 if CONFIG['_MSC_VER']:
     # Always enter a Windows program through wmain, whether or not we're
     # a console application.
     WIN32_EXE_LDFLAGS += ['-ENTRY:wmainCRTStartup']
 
 LDFLAGS += CONFIG['MOZ_ALLOW_HEAP_EXECUTE_FLAGS']