15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles){
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  'target_defaults': {
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    'include_dirs': [
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src',
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/test',
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      # The libphonenumber source (and test code) expects the
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      # generated protocol headers to be available with "phonenumbers" include
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      # path, e.g. #include "phonenumbers/foo.pb.h".
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      '<(SHARED_INTERMEDIATE_DIR)/protoc_out/third_party/libphonenumber',
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ],
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    'defines': [
16eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      'I18N_PHONENUMBERS_USE_ICU_REGEXP=1',
17eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch    ],
18eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch    'conditions': [
19eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      # libphonenumber can only be thread-safe on POSIX platforms. This is ok
20eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      # since Android is the only Chromium port that requires thread-safety.
21eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      # It uses the PhoneNumberUtil singleton in renderer threads as opposed to
22eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      # other platforms that only use it in the browser process (on a single
23eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      # thread). Note that any unsafe use of the library would be caught by a
24eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      # DCHECK.
25eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      ['OS != "android"', {
26eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch        'defines': [
27eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch          'I18N_PHONENUMBERS_NO_THREAD_SAFETY=1',
28eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch        ],
29eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      }],
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ],
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  },
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  'includes': [
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    '../../build/win_precompile.gypi',
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ],
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  'targets': [{
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    # Build a library without metadata so that we can use it with both testing
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    # and production metadata. This library should not be used by clients.
38116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    # GN version: //third_party/libphonenumber:libphonenumber_without_metadata
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    'target_name': 'libphonenumber_without_metadata',
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    'type': 'static_library',
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    'dependencies': [
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      '../icu/icu.gyp:icui18n',
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      '../icu/icu.gyp:icuuc',
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      '../protobuf/protobuf.gyp:protobuf_lite',
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ],
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    'sources': [
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/phonenumbers/asyoutypeformatter.cc',
48eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      'src/phonenumbers/base/strings/string_piece.cc',
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/phonenumbers/default_logger.cc',
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/phonenumbers/logger.cc',
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/phonenumbers/phonenumber.cc',
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/phonenumbers/phonenumbermatch.cc',
535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/phonenumbers/phonenumbermatcher.cc',
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/phonenumbers/phonenumberutil.cc',
555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/phonenumbers/regexp_adapter_icu.cc',
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/phonenumbers/regexp_cache.cc',
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/phonenumbers/string_byte_sink.cc',
585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/phonenumbers/stringutil.cc',
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/phonenumbers/unicodestring.cc',
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/phonenumbers/utf/rune.c',
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/phonenumbers/utf/unicodetext.cc',
625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/phonenumbers/utf/unilib.cc',
635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/resources/phonemetadata.proto',
645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/resources/phonenumber.proto',
655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ],
665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    'variables': {
675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'proto_in_dir': 'src/resources',
685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'proto_out_dir': 'third_party/libphonenumber/phonenumbers',
695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    },
705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    'includes': [ '../../build/protoc.gypi' ],
715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    'direct_dependent_settings': {
725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'include_dirs': [
735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        '<(SHARED_INTERMEDIATE_DIR)/protoc_out/third_party/libphonenumber',
745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        'src',
755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      ],
76eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      'defines': [
77eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch        'I18N_PHONENUMBERS_USE_ICU_REGEXP=1',
78eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      ],
79eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      'conditions': [
80eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch        ['OS != "android"', {
81eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch          'defines': [
82eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch            'I18N_PHONENUMBERS_NO_THREAD_SAFETY=1',
83eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch          ],
84eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch        }],
85eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      ],
865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    },
875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    'conditions': [
885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      ['OS=="win"', {
895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        'action': [
905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)          '/wo4309',
915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        ],
925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      }],
935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ],
945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  },
955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  {
965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    # Library used by clients that includes production metadata.
97116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    # GN version: //third_party/libphonenumber
985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    'target_name': 'libphonenumber',
995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    'type': 'static_library',
1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    'dependencies': [
1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'libphonenumber_without_metadata',
1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ],
1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    'export_dependent_settings': [
1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'libphonenumber_without_metadata',
1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ],
1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    'sources': [
1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      # Comment next line and uncomment the line after, if complete metadata
1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      # (with examples) is needed.
1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/phonenumbers/lite_metadata.cc',
1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      #'src/phonenumbers/metadata.cc',
1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ],
1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  },
1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  {
114116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch    # GN version: //third_party/libphonenumber:libphonenumber_unittests
1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    'target_name': 'libphonenumber_unittests',
1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    'type': 'executable',
1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    'sources': [
1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/phonenumbers/test_metadata.cc',
1195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/test/phonenumbers/asyoutypeformatter_test.cc',
1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/test/phonenumbers/phonenumbermatch_test.cc',
1215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/test/phonenumbers/phonenumbermatcher_test.cc',
1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/test/phonenumbers/phonenumberutil_test.cc',
1235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/test/phonenumbers/regexp_adapter_test.cc',
1245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/test/phonenumbers/stringutil_test.cc',
1255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/test/phonenumbers/test_util.cc',
1265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'src/test/phonenumbers/unicodestring_test.cc',
1275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ],
1285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    'dependencies': [
1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      '../icu/icu.gyp:icui18n',
1305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      '../icu/icu.gyp:icuuc',
1315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      '../../base/base.gyp:run_all_unittests',
1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      '../../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      '../../testing/gmock.gyp:gmock',
1345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      '../../testing/gtest.gyp:gtest',
1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      'libphonenumber_without_metadata',
1365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ],
1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    'conditions': [
1385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      ['OS=="win"', {
1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        'action': [
1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)          '/wo4309',
1415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)        ],
1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      }],
1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ],
1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }]
1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
146