CPP: Add phonenumbermatcher.
[platform/upstream/libphonenumber.git] / cpp / README
1 C++ version of the libphonenumber project.
2 Work in progress.
3
4 This is a port of the Java version.
5
6 This project uses some third-party code:
7   - src/base/ sources come from Chromium browser.
8   - src/utf/ sources come from lib9 which is also used in Go.
9
10 Requirements:
11   - CMake build system
12     http://www.cmake.org
13
14     You can install it very easily on a Debian-based GNU/Linux distribution:
15     $ sudo apt-get install cmake
16
17   - Protocol Buffers
18     http://code.google.com/p/protobuf/
19     Version 2.4 or more recent is required.
20
21     You can install it very easily on a Debian-based GNU/Linux distribution:
22     $ sudo apt-get install libprotobuf-dev
23
24     Note: if your GNU/Linux distribution doesn't provide the needed package,
25           please download and install it manually:
26     $ tar xjf protobuf-2.4.tar.bz2
27     $ cd protobuf-2.4
28     $ ./configure && make && sudo make install
29
30   - Google Test
31     http://code.google.com/p/googletest/
32
33     You can install it very easily on a Debian-based GNU/Linux distribution:
34     $ sudo apt-get install libgtest-dev
35
36   - RE2
37     http://code.google.com/p/re2/
38
39     You can install it very easily on Ubuntu Maverick and later:
40     $ sudo apt-get install libre2-dev
41
42     Otherwise if you use a Debian-based distribution you can fetch the Ubuntu
43     package which should work:
44     http://packages.ubuntu.com/maverick/libre2-dev
45
46     If you want to install it manually:
47     You need Mercurial to checkout its source code:
48     $ sudo apt-get install mercurial
49
50     Then checkout, build and install it:
51     $ hg clone https://re2.googlecode.com/hg re2
52     $ cd re2
53     $ make test
54     $ make install
55     $ make testinstall
56
57   - ICU
58     Version 4.4 or more recent is required.
59     It can be built from sources. You need to download the source tarball at
60     this location:
61     http://site.icu-project.org/download
62     Then you can extract, build and install it this way:
63     $ tar xzf icu4c-4_4_2-src.tgz
64     $ cd icu/source
65     $ ./configure && make && sudo make install
66
67     If you have a Debian-based distribution providing an up-to-date version of
68     ICU, you can install it using apt-get:
69     $ sudo apt-get install libicu-dev
70
71   - Boost
72     Version 1.40 or more recent is required.
73
74     You can install it very easily on a Debian-based GNU/Linux distribution:
75     $ sudo apt-get install libboost1.40-dev libboost-thread1.40-dev
76
77     Note: Boost Thread is the only library needed at link time.
78
79 How to build libphonenumber C++:
80   $ cd libphonenumber
81   $ mkdir build
82   $ cd build
83   $ cmake ..
84   $ make
85
86 Supported build parameters:
87   Build parameters can be specified invoking CMake with '-DKEY=VALUE' or using a
88   CMake user interface (ccmake or cmake-gui).
89
90   USE_ICU_REGEXP    = ON | OFF [ON]  -- Use ICU regexp engine.
91   USE_LITE_METADATA = ON | OFF [OFF] -- Generates smaller metadata that doesn't
92                                         include example numbers.
93   USE_RE2           = ON | OFF [OFF] -- Use RE2.
94   USE_STD_MAP       = ON | OFF [OFF] -- Force the use of std::map.