1{ lib, stdenv, fetchFromGitHub, cmake, gtest, boost, pkg-config, protobuf, icu, Foundation, buildPackages }:
2
3stdenv.mkDerivation rec {
4 pname = "phonenumber";
5 version = "8.12.37";
6
7 src = fetchFromGitHub {
8 owner = "googlei18n";
9 repo = "libphonenumber";
10 rev = "v${version}";
11 sha256 = "sha256-xLxadSxVY3DjFDQrqj3BuOvdMaKdFSLjocfzovJCBB0=";
12 };
13
14 patches = [
15 # Submitted upstream: https://github.com/google/libphonenumber/pull/2921
16 ./build-reproducibility.patch
17 ];
18
19 nativeBuildInputs = [
20 cmake
21 pkg-config
22 ];
23
24 buildInputs = [
25 boost
26 protobuf
27 icu
28 gtest
29 ] ++ lib.optional stdenv.isDarwin Foundation;
30
31 cmakeDir = "../cpp";
32 cmakeFlags =
33 lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
34 "-DBUILD_GEOCODER=OFF"
35 "-DPROTOC_BIN=${buildPackages.protobuf}/bin/protoc"
36 ];
37
38 checkPhase = "./libphonenumber_test";
39
40 meta = with lib; {
41 description = "Google's i18n library for parsing and using phone numbers";
42 homepage = "https://github.com/google/libphonenumber";
43 license = licenses.asl20;
44 maintainers = with maintainers; [ illegalprime ];
45 };
46}