Hi, Leo Famulari <l...@famulari.name> 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
>From cfb8a68cb4e18e3a811e7ae96b7df64fceb8c6c5 Mon Sep 17 00:00:00 2001 From: Lukas Gradl <lgr...@openmailbox.org> 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 © 2015 Ricardo Wurmus <rek...@elephly.net> +;;; Copyright © 2016 Lukas Gradl <lgr...@openmailbox.org> ;;; ;;; 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)) (define-public cereal (package @@ -72,3 +78,45 @@ arbitrary data types and reversibly turns them into different representations, 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))) -- 2.7.4