gnu: protobuf: Add ‘static’ output.
[jackhill/guix/guix.git] / gnu / packages / protobuf.scm
CommitLineData
14d17788
LC
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
8d63ddda
DP
3;;; Copyright © 2016 Daniel Pimentel <d4n1@d4n1.org>
4;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
dd12d4aa 5;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
fa9ac83e 6;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
14d17788
LC
7;;;
8;;; This file is part of GNU Guix.
9;;;
10;;; GNU Guix is free software; you can redistribute it and/or modify it
11;;; under the terms of the GNU General Public License as published by
12;;; the Free Software Foundation; either version 3 of the License, or (at
13;;; your option) any later version.
14;;;
15;;; GNU Guix is distributed in the hope that it will be useful, but
16;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;;; GNU General Public License for more details.
19;;;
20;;; You should have received a copy of the GNU General Public License
21;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23(define-module (gnu packages protobuf)
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix build-system gnu)
8d63ddda 27 #:use-module (guix build-system python)
14d17788 28 #:use-module ((guix licenses)
bfd07331 29 #:select (bsd-2 bsd-3))
8d63ddda
DP
30 #:use-module (gnu packages compression)
31 #:use-module (gnu packages gcc)
bfd07331 32 #:use-module (gnu packages pkg-config)
8d63ddda 33 #:use-module (gnu packages python))
14d17788
LC
34
35(define-public protobuf
36 (package
37 (name "protobuf")
dd12d4aa 38 (version "3.4.1")
14d17788
LC
39 (source (origin
40 (method url-fetch)
de30a6e0 41 (uri (string-append "https://github.com/google/protobuf/releases/"
dd12d4aa
RW
42 "download/v" version "/protobuf-cpp-"
43 version ".tar.gz"))
14d17788
LC
44 (sha256
45 (base32
dd12d4aa 46 "0y6cr4l7bwa6zvjv5flzr4cx28shk5h8dz99xw90v8qih954pcrb"))))
14d17788
LC
47 (build-system gnu-build-system)
48 (inputs `(("zlib" ,zlib)))
ffe7eee5
TGR
49 (outputs (list "out"
50 "static")) ; ~12 MiB of .a files
51 (arguments
52 `(#:phases
53 (modify-phases %standard-phases
54 (add-after 'install 'move-static-libraries
55 (lambda* (#:key outputs #:allow-other-keys)
56 ;; Move static libraries to the "static" output.
57 (let* ((out (assoc-ref outputs "out"))
58 (lib (string-append out "/lib"))
59 (static (assoc-ref outputs "static"))
60 (slib (string-append static "/lib")))
61 (mkdir-p slib)
62 (for-each (lambda (file)
63 (install-file file slib)
64 (delete-file file))
65 (find-files lib "\\.a$"))
66 #t))))))
3b0ac795 67 (home-page "https://github.com/google/protobuf")
14d17788
LC
68 (synopsis "Data encoding for remote procedure calls (RPCs)")
69 (description
70 "Protocol Buffers are a way of encoding structured data in an efficient
71yet extensible format. Google uses Protocol Buffers for almost all of its
72internal RPC protocols and file formats.")
73 (license bsd-3)))
8d63ddda 74
fa9ac83e
TGR
75;; XXX Remove this old version when no other packages depend on it.
76(define-public protobuf-2
77 (package (inherit protobuf)
78 (version "2.6.1")
79 (source (origin
80 (method url-fetch)
81 (uri (string-append "https://github.com/google/protobuf/releases/"
82 "download/v" version "/protobuf-"
83 version ".tar.bz2"))
84 (sha256
85 (base32
86 "040rcs9fpv4bslhiy43v7dcrzakz4vwwpyqg4jp8bn24sl95ci7f"))))))
87
bfd07331
RW
88(define-public protobuf-c
89 (package
90 (name "protobuf-c")
91 (version "1.3.0")
92 (source (origin
93 (method url-fetch)
94 (uri (string-append "https://github.com/protobuf-c/protobuf-c/"
95 "releases/download/v" version
96 "/protobuf-c-" version ".tar.gz"))
97 (sha256
98 (base32
99 "18aj4xfv26zjmj44zbb01wk90jl7y4aj5xvbzz4gg748kdxavjax"))))
100 (build-system gnu-build-system)
101 (inputs `(("protobuf" ,protobuf)))
102 (native-inputs `(("pkg-config" ,pkg-config)))
103 (home-page "https://github.com/protobuf-c/protobuf-c")
104 (synopsis "Protocol Buffers implementation in C")
105 (description
106 "This is protobuf-c, a C implementation of the Google Protocol Buffers
107data serialization format. It includes @code{libprotobuf-c}, a pure C library
108that implements protobuf encoding and decoding, and @code{protoc-c}, a code
109generator that converts Protocol Buffer @code{.proto} files to C descriptor
110code.")
111 (license bsd-2)))
112
8d63ddda
DP
113(define-public python-protobuf
114 (package
115 (name "python-protobuf")
dc1d06ba 116 (version "3.4.0")
8d63ddda
DP
117 (source
118 (origin
119 (method url-fetch)
120 (uri (pypi-uri "protobuf" version))
121 (sha256
122 (base32
dc1d06ba 123 "0x33xz85cy5ilg1n2rn92l4qwlcw25vzysx2ldv7k625yjg600pg"))))
8d63ddda 124 (build-system python-build-system)
f22efa01 125 (propagated-inputs
8d63ddda
DP
126 `(("python-six" ,python-six)))
127 (home-page "https://github.com/google/protobuf")
128 (synopsis "Protocol buffers is a data interchange format")
129 (description
130 "Protocol buffers are a language-neutral, platform-neutral extensible
131mechanism for serializing structured data.")
5c31f4aa 132 (license bsd-3)))
8d63ddda
DP
133
134(define-public python2-protobuf
5c31f4aa 135 (package-with-python2 python-protobuf))