metrics: Migrate libchromeos to its own ebuild

All platform2 packages should have their own ebuild that will be compiled
independently. Packages should DEPEND on libchromeos and should not have a gyp
dependency on libchromeos's gyp file anymore.

BUG=chromium:381372
TEST=emerge-daisy libchromeos && emerge-daisy platform2 work
TEST=trybot run on daisy, link, mario and duck.
TEST=trybot run on lumpy-incremental-paladin.

CQ-DEPEND=CL:202748

Change-Id: I0fe0732d47463e880b11d3d547e99dba0ac83ace
Reviewed-on: https://chromium-review.googlesource.com/202771
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
diff --git a/metrics/libmetrics.gypi b/metrics/libmetrics.gypi
index bc000a4..1753830 100644
--- a/metrics/libmetrics.gypi
+++ b/metrics/libmetrics.gypi
@@ -1,11 +1,9 @@
 {
   'target_defaults': {
-    'dependencies': [
-      '../../platform2/libchromeos/libchromeos-<(libbase_ver).gyp:libchromeos-<(libbase_ver)',
-    ],
     'variables': {
       'deps': [
         'libchrome-<(libbase_ver)',
+        'libchromeos-<(libbase_ver)',
       ]
     },
     'cflags_cc': [
@@ -19,6 +17,9 @@
       'cflags': [
         '-fvisibility=default',
       ],
+      'libraries+': [
+        '-lpolicy-<(libbase_ver)',
+      ],
       'sources': [
         'c_metrics_library.cc',
         'metrics_library.cc',
diff --git a/metrics/metrics.gyp b/metrics/metrics.gyp
index c5bfedb..b8dccf6 100644
--- a/metrics/metrics.gyp
+++ b/metrics/metrics.gyp
@@ -3,9 +3,6 @@
     'libbase_ver': 271506,
   },
   'target_defaults': {
-    'dependencies': [
-      '../../platform2/libchromeos/libchromeos-<(libbase_ver).gyp:libchromeos-<(libbase_ver)',
-    ],
     'variables': {
       'deps': [
         'dbus-1',
@@ -14,6 +11,7 @@
         'gobject-2.0',
         'gthread-2.0',
         'libchrome-<(libbase_ver)',
+        'libchromeos-<(libbase_ver)',
       ]
     },
     'cflags_cc': [
@@ -26,6 +24,7 @@
       'type': 'static_library',
       'dependencies': [
         '../metrics/libmetrics-<(libbase_ver).gyp:libmetrics-<(libbase_ver)',
+        '<(platform_root)/system_api/system_api.gyp:system_api-headers',
       ],
       'link_settings': {
         'libraries': [
@@ -80,7 +79,12 @@
           'includes': ['../../platform2/common-mk/common_test.gypi'],
           'sources': [
             'metrics_library_test.cc',
-          ]
+          ],
+          'link_settings': {
+            'libraries': [
+              '-lpolicy-<(libbase_ver)',
+            ]
+          }
         },
         {
           'target_name': 'timer_test',