about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/libphonenumber/default.nix
blob: a9b0df3304be5aa47a12b44436564957186125db (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{ lib, stdenv, fetchFromGitHub, cmake, gtest, boost, pkg-config, protobuf, icu, Foundation, buildPackages }:

stdenv.mkDerivation rec {
  pname = "phonenumber";
  version = "8.12.37";

  src = fetchFromGitHub {
    owner = "googlei18n";
    repo = "libphonenumber";
    rev = "v${version}";
    sha256 = "sha256-xLxadSxVY3DjFDQrqj3BuOvdMaKdFSLjocfzovJCBB0=";
  };

  patches = [
    # Submitted upstream: https://github.com/google/libphonenumber/pull/2921
    ./build-reproducibility.patch
  ];

  nativeBuildInputs = [
    cmake
    pkg-config
  ];

  buildInputs = [
    boost
    protobuf
    icu
    gtest
  ] ++ lib.optional stdenv.isDarwin Foundation;

  cmakeDir = "../cpp";
  cmakeFlags =
    lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
      "-DBUILD_GEOCODER=OFF"
      "-DPROTOC_BIN=${buildPackages.protobuf}/bin/protoc"
    ];

  checkPhase = "./libphonenumber_test";

  meta = with lib; {
    description = "Google's i18n library for parsing and using phone numbers";
    homepage = "https://github.com/google/libphonenumber";
    license = licenses.asl20;
    maintainers = with maintainers; [ illegalprime ];
  };
}