From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lukas Gradl Subject: Re: [PATCH] Add msgpack Date: Fri, 17 Jun 2016 10:13:28 -0500 Message-ID: <87fusbyhk7.fsf@openmailbox.org> References: <87wpmbuv6m.fsf@openmailbox.org> <20160606140737.GA26555@jasmine> <20160611030655.GA24837@jasmine> <87lh2b7009.fsf@openmailbox.org> <20160612001750.GA9854@jasmine> <87eg836nm3.fsf@openmailbox.org> <20160613165852.GA31846@jasmine> <20160613175910.GA6456@jasmine> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDvSy-0004aW-1H for guix-devel@gnu.org; Fri, 17 Jun 2016 11:13:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDvSu-0006vx-7P for guix-devel@gnu.org; Fri, 17 Jun 2016 11:13:51 -0400 Received: from mail2.openmailbox.org ([62.4.1.33]:52801) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDvSt-0006vm-PF for guix-devel@gnu.org; Fri, 17 Jun 2016 11:13:48 -0400 In-Reply-To: <20160613175910.GA6456@jasmine> (Leo Famulari's message of "Mon, 13 Jun 2016 13:59:10 -0400") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Leo Famulari Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain Hi, Leo Famulari writes: > On Mon, Jun 13, 2016 at 12:58:52PM -0400, Leo Famulari wrote: >> On Sat, Jun 11, 2016 at 11:24:23PM -0500, Lukas Gradl wrote: >> > Oh, that is true. I searched around, but I could not find anything >> > about zbuffer.h[pp]. I am not sure what it is used for. FWIW, it is >> > only referenced in src/Makefile, src/Makefile.in, src/Makefile.am >> > CMakeLists.txt and in the tests: >> >> [...] >> >> > Judging from this, I am inclined to think that msgpack does not use >> > these two headers for anything but tests. But I am not sure about >> > this. >> >> I think that another application would call the zbuffer functions, >> although the string 'zbuffer' does not exist in the opendht source code. >> But, we should make sure msgpack will work for other calling >> applications that might be added later. OK, I agree. >> >> On #guix, bavier suggested we patch 'msgpack.pc.in'. Specifically, we >> should append the include flag to 'Cflags:' and create a 'Libs.private:' >> field for the -L and -l flags. There are some examples in >> 'gnu/packages'. >> >> More details on the IRC log: >> https://gnunet.org/bot/log/guix/2016-06-13#T1056507 >> >> I've cc-ed Eric since I don't know much about pkg-config. Neither do I. I have experimented with this a bit. IIUC, since our zlib provides a pkg-config file we can generate the the -I flag by adding ---8<--- cut here -------------------- start --->8--- Requires.private: zlib ---8<--- cut here -------------------- end ----->8--- to the msgpack.pc.in file. This also gives me the -L flag. The -l flag is only emitted when --static is passed to pkg-config. I tried to fix this by adding -lz to Libs.private resulting in: ---8<--- cut here -------------------- start --->8--- lukas@serenity$ guix environment msgpack lukas@serenity [env]$ cat /gnu/store/gibnvxf2029gxmmxv8bgqilvlagzzskb-msgpack-1.4.1/lib/pkgconfig/msgpack.pc prefix=/gnu/store/gibnvxf2029gxmmxv8bgqilvlagzzskb-msgpack-1.4.1 exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include Name: MessagePack Description: Binary-based efficient object serialization library Version: 1.4.1 Libs: -L${libdir} -lmsgpackc Cflags: -I${includedir} Requires.private: zlib Libs.private: -lz lukas@serenity [env]$ pkg-config --libs --cflags /gnu/store/gibnvxf2029gxmmxv8bgqilvlagzzskb-msgpack-1.4.1/lib/pkgconfig/msgpack.pc -I/gnu/store/gibnvxf2029gxmmxv8bgqilvlagzzskb-msgpack-1.4.1/include -I/gnu/store/hsxhfmjgh8m4c0pavq3gd3gcrn8zrgxj-zlib-1.2.8/include -L/gnu/store/gibnvxf2029gxmmxv8bgqilvlagzzskb-msgpack-1.4.1/lib -lmsgpackc lukas@serenity [env]$ pkg-config --libs --cflags --static /gnu/store/gibnvxf2029gxmmxv8bgqilvlagzzskb-msgpack-1.4.1/lib/pkgconfig/msgpack.pc -I/gnu/store/gibnvxf2029gxmmxv8bgqilvlagzzskb-msgpack-1.4.1/include -I/gnu/store/hsxhfmjgh8m4c0pavq3gd3gcrn8zrgxj-zlib-1.2.8/include -L/gnu/store/gibnvxf2029gxmmxv8bgqilvlagzzskb-msgpack-1.4.1/lib -L/gnu/store/hsxhfmjgh8m4c0pavq3gd3gcrn8zrgxj-zlib-1.2.8/lib -lmsgpackc -lz lukas@serenity [env]$ guix gc --references /gnu/store/gibnvxf2029gxmmxv8bgqilvlagzzskb-msgpack-1.4.1 /gnu/store/8m00x5x8ykmar27s9248cmhnkdb2n54a-glibc-2.22 /gnu/store/gibnvxf2029gxmmxv8bgqilvlagzzskb-msgpack-1.4.1 /gnu/store/v39bh3ln3ncnzhyw0kd12d46kww9747v-gcc-4.9.3-lib lukas@serenity [env]$ ---8<--- cut here -------------------- end ----->8--- So I still only get the -lz flag for static linking. I am not sure if this is what we want, what do you think? Also, still no store refernece. BTW, where is "guix gc --references" implemented? I looked for it but failed to find the actual logic, since I am not that fluent with Scheme... >From this I think that adding the -lz to Libs.private is redundant if zlib is in "Requires.private". But if we want -lz also for dynamic linking then I think we need to move zlib to "Requires". I went ahead and tried that leading to this result: ---8<--- cut here -------------------- start --->8--- lukas@serenity$ guix environment msgpack lukas@serenity [env]$ cat /gnu/store/9ipfx15i5hbkgq26by13d07i47nmbldp-msgpack-1.4.1/lib/pkgconfig/msgpack.pc prefix=/gnu/store/9ipfx15i5hbkgq26by13d07i47nmbldp-msgpack-1.4.1 exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include Name: MessagePack Description: Binary-based efficient object serialization library Version: 1.4.1 Libs: -L${libdir} -lmsgpackc Cflags: -I${includedir} Requires: zlib lukas@serenity [env]$ pkg-config --libs --cflags /gnu/store/9ipfx15i5hbkgq26by13d07i47nmbldp-msgpack-1.4.1/lib/pkgconfig/msgpack.pc -I/gnu/store/9ipfx15i5hbkgq26by13d07i47nmbldp-msgpack-1.4.1/include -I/gnu/store/hsxhfmjgh8m4c0pavq3gd3gcrn8zrgxj-zlib-1.2.8/include -L/gnu/store/9ipfx15i5hbkgq26by13d07i47nmbldp-msgpack-1.4.1/lib -L/gnu/store/hsxhfmjgh8m4c0pavq3gd3gcrn8zrgxj-zlib-1.2.8/lib -lmsgpackc -lz lukas@serenity [env]$ pkg-config --libs --cflags --static /gnu/store/9ipfx15i5hbkgq26by13d07i47nmbldp-msgpack-1.4.1/lib/pkgconfig/msgpack.pc -I/gnu/store/9ipfx15i5hbkgq26by13d07i47nmbldp-msgpack-1.4.1/include -I/gnu/store/hsxhfmjgh8m4c0pavq3gd3gcrn8zrgxj-zlib-1.2.8/include -L/gnu/store/9ipfx15i5hbkgq26by13d07i47nmbldp-msgpack-1.4.1/lib -L/gnu/store/hsxhfmjgh8m4c0pavq3gd3gcrn8zrgxj-zlib-1.2.8/lib -lmsgpackc -lz lukas@serenity [env]$ guix gc --references /gnu/store/9ipfx15i5hbkgq26by13d07i47nmbldp-msgpack-1.4.1 /gnu/store/8m00x5x8ykmar27s9248cmhnkdb2n54a-glibc-2.22 /gnu/store/9ipfx15i5hbkgq26by13d07i47nmbldp-msgpack-1.4.1 /gnu/store/v39bh3ln3ncnzhyw0kd12d46kww9747v-gcc-4.9.3-lib lukas@serenity [env]$ ---8<--- cut here -------------------- end ----->8--- So the flags -I, -L, -l for zlib are all there for both dynamic and static linking. But still no store reference. A patch for this last case is attached. IIUC, zlib has to be a propagated input in this case. Do you agree with that? More general, do you think what I did makes sense? I am not really sure if -lz is needed for dynamic linking or not. Also, is it OK to do things like that in a snippet as in the attached patch? Thank you for your help! Best, Lukas --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-gnu-Add-msgpack.patch Content-Transfer-Encoding: quoted-printable >From cfb8a68cb4e18e3a811e7ae96b7df64fceb8c6c5 Mon Sep 17 00:00:00 2001 From: Lukas Gradl Date: Fri, 17 Jun 2016 10:08:48 -0500 Subject: [PATCH] gnu: Add msgpack. * gnu/packages/serialization.scm (msgpack): New variable. --- gnu/packages/serialization.scm | 50 ++++++++++++++++++++++++++++++++++++++= +++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/gnu/packages/serialization.scm b/gnu/packages/serialization.scm index 8dfd21d..085534d 100644 --- a/gnu/packages/serialization.scm +++ b/gnu/packages/serialization.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =C2=A9 2015 Ricardo Wurmus +;;; Copyright =C2=A9 2016 Lukas Gradl ;;; ;;; This file is part of GNU Guix. ;;; @@ -21,8 +22,13 @@ #:use-module (guix packages) #:use-module (guix download) #:use-module (guix build-system cmake) + #:use-module (guix build-system gnu) #:use-module (gnu packages) - #:use-module (gnu packages documentation)) + #:use-module (gnu packages autotools) + #:use-module (gnu packages check) + #:use-module (gnu packages compression) + #:use-module (gnu packages documentation) + #:use-module (gnu packages pkg-config)) =20 (define-public cereal (package @@ -72,3 +78,45 @@ arbitrary data types and reversibly turns them into different representati= ons, such as compact binary encodings, XML, or JSON.") (license license:bsd-3))) + + +(define-public msgpack + (package + (name "msgpack") + (version "1.4.1") + (source + (origin + (method url-fetch) + (uri + (string-append + "https://github.com/msgpack/msgpack-c/releases/download/" + "cpp-" version "/msgpack-" version ".tar.gz")) + (snippet + '(let ((p (open-file "msgpack.pc.in" "a"))) + (begin + (display + (string-append "Requires: " "zlib" "\n") p) + (close-output-port p)))) + (sha256 + (base32 + "0bpjfh9vz0n2k93mph3x15clmigkgs223xfn8h12ymrh5gsi5ica")))) + (build-system gnu-build-system) + (native-inputs + `(("googletest" ,googletest) + ("autoconf" ,autoconf) + ("automake" ,automake) + ("libtool" ,libtool) + ("pkg-config" ,pkg-config))) + (propagated-inputs + `(("zlib" ,zlib))) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-before 'configure 'autoconf + (lambda _ + (system* "autoreconf" "-vfi")))))) + (home-page "http://www.msgpack.org") + (synopsis "Binary serialization library") + (description "Msgpack is a library for C/C++ that implements binary +serialization.") + (license license:boost1.0))) --=20 2.7.4 --=-=-=--