aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFredrik Roubert <roubert@google.com>2014-02-18 20:06:44 +0000
committerFredrik Roubert <roubert@google.com>2014-09-01 19:20:41 +0200
commit5710f8fc7c2cbcdad347c443906644b8d44c8a3e (patch)
treef4c85142d302b741fa4d4c9cf788628e4c6e2021
parent051febbd31d09f31966d99ee8138c649e09bc070 (diff)
downloadsrc-5710f8fc7c2cbcdad347c443906644b8d44c8a3e.tar.gz
Add re2 dependency to libaddressinput.
This patch adds the re2 dependency to libaddressinput. The dependency will be used to validate postal code format of addresses. The addresses are provided by the user. The format regular expressions are from: https://i18napis.appspot.com/ssl-address For example, the US postal code has the following regular expression: \\d{5}([ \\-]\\d{4})? BUG=327046 Review URL: https://codereview.chromium.org/98543010
-rw-r--r--cpp/README5
-rw-r--r--cpp/libaddressinput.gyp1
-rw-r--r--cpp/re2.gyp37
3 files changed, 42 insertions, 1 deletions
diff --git a/cpp/README b/cpp/README
index 4f27635..8e60fc7 100644
--- a/cpp/README
+++ b/cpp/README
@@ -24,11 +24,12 @@ GYP: Generates the build files.
Ninja: Executes the build files.
GTest: Used for unit tests.
Python: Used by GRIT, which generates localization files.
+RE2: Used for validating postal code format.
Most of these packages are available on Debian-like distributions. You can
install them with this command:
-$ sudo apt-get install gyp ninja-build libgtest-dev python
+$ sudo apt-get install gyp ninja-build libgtest-dev python libre2-dev
Make sure that your version of GYP is at least 0.1~svn1395. Older versions of
GYP do not generate the Ninja build files correctly. You can download a
@@ -41,6 +42,7 @@ http://packages.ubuntu.com/saucy/gyp
http://packages.ubuntu.com/saucy/ninja-build
http://packages.ubuntu.com/saucy/libgtest-dev
http://packages.ubuntu.com/saucy/python
+http://packages.debian.org/experimental/libre2-dev
Alternatively, you can download, build, and install these tools and libraries
from source code. Their home pages contain information on how to accomplish
@@ -50,6 +52,7 @@ https://code.google.com/p/gyp/
http://martine.github.io/ninja/
https://code.google.com/p/googletest/
http://python.org/
+https://code.google.com/p/re2/
Build
=====
diff --git a/cpp/libaddressinput.gyp b/cpp/libaddressinput.gyp
index 1058b70..fcd2fe6 100644
--- a/cpp/libaddressinput.gyp
+++ b/cpp/libaddressinput.gyp
@@ -49,6 +49,7 @@
'dependencies': [
'grit.gyp:generated_messages',
'rapidjson.gyp:rapidjson',
+ 're2.gyp:re2',
],
},
{
diff --git a/cpp/re2.gyp b/cpp/re2.gyp
new file mode 100644
index 0000000..961178c
--- /dev/null
+++ b/cpp/re2.gyp
@@ -0,0 +1,37 @@
+# Copyright (C) 2013 Google Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+{
+ 'variables': {
+ 're2_dir%': '/usr/include',
+ 're2_lib%': '/usr/lib/libre2.a',
+ },
+ 'targets': [
+ {
+ 'target_name': 're2',
+ 'type': 'none',
+ 'all_dependent_settings': {
+ 'include_dirs': [
+ '<(re2_dir)',
+ ],
+ 'conditions': [
+ ['"<(component)" != "shared_library"', {
+ 'libraries': [
+ '<(re2_lib)',
+ ],
+ }],
+ ],
+ },
+ },
+ ],
+}