diff mbox series

[bug#37988,v4,3/6] gnu: Add r-rprotobuflib.

Message ID 20191105182931.27048-1-zimon.toutoune@gmail.com
State Accepted
Headers show
Series None | expand

Commit Message

Simon Tournier Nov. 5, 2019, 6:29 p.m. UTC
* gnu/packages/bioconductor.scm (r-rprotobuflib): New variable.
* gnu/packages/patches/r-rprotobuflib-unbundle-dependency.patch: New file.
---
 gnu/local.mk                                  |  2 +
 gnu/packages/bioconductor.scm                 | 31 ++++++++++
 .../r-rprotobuflib-unbundle-dependency.patch  | 57 +++++++++++++++++++
 3 files changed, 90 insertions(+)
 create mode 100644 gnu/packages/patches/r-rprotobuflib-unbundle-dependency.patch
diff mbox series

Patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 5b81791542..178c8b903f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -22,6 +22,7 @@ 
 # Copyright © 2018 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 # Copyright © 2019 Guillaume Le Vaillant <glv@posteo.net>
 # Copyright © 2019 John Soo <jsoo1@asu.edu>
+# Copyright © 2019 Simon Tournier <zimon.toutoune@gmail.com>
 #
 # This file is part of GNU Guix.
 #
@@ -1295,6 +1296,7 @@  dist_patch_DATA =						\
   %D%/packages/patches/quagga-reproducible-build.patch          \
   %D%/packages/patches/quickswitch-fix-dmenu-check.patch	\
   %D%/packages/patches/qtwebkit-pbutils-include.patch		\
+  %D%/packages/patches/r-rprotobuflib-unbundle-dependency.patch \
   %D%/packages/patches/randomjungle-disable-static-build.patch	\
   %D%/packages/patches/rapicorn-isnan.patch			\
   %D%/packages/patches/rapidjson-gcc-compat.patch		\
diff --git a/gnu/packages/bioconductor.scm b/gnu/packages/bioconductor.scm
index 92e5d3ec0b..801e52245b 100644
--- a/gnu/packages/bioconductor.scm
+++ b/gnu/packages/bioconductor.scm
@@ -38,6 +38,7 @@ 
   #:use-module (gnu packages netpbm)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages protobuf)
   #:use-module (gnu packages statistics)
   #:use-module (gnu packages web)
   #:use-module (srfi srfi-1))
@@ -6166,3 +6167,33 @@  data.")
     (synopsis "Visualization for flow cytometry data")
     (description "This package provides visualization tools for flow cytometry data.")
     (license license:artistic2.0)))
+
+(define-public r-rprotobuflib
+  (package
+    (name "r-rprotobuflib")
+    (version "1.6.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (bioconductor-uri "RProtoBufLib" version))
+       (sha256
+        (base32
+         "1vhwxw7281n5wpg30ik3m1gwarfmj4b8cqxdvj0sck44yx24lphg"))
+       ;; Remove bundled binaries:
+       ;; src/win/lib/{i386,x64}/libprotobuf.a
+       (modules '((guix build utils)))
+       (snippet '(begin
+                   (delete-file-recursively "src/win")
+                   #t))
+       (patches
+        (search-patches "r-rprotobuflib-unbundle-dependency.patch"))))
+    (properties
+     `((upstream-name . "RProtoBufLib")))
+    (build-system r-build-system)
+    (propagated-inputs
+     `(("protobuf-2" ,protobuf-2)))
+    (home-page "https://bioconductor.org/packages/RProtoBufLib")
+    (synopsis "C++ headers and static libraries of Protocol buffers")
+    (description "This package provides the headers and static library of
+Protocol buffers for other R packages to compile and link against.")
+    (license license:bsd-3)))
diff --git a/gnu/packages/patches/r-rprotobuflib-unbundle-dependency.patch b/gnu/packages/patches/r-rprotobuflib-unbundle-dependency.patch
new file mode 100644
index 0000000000..c26b6c7e0f
--- /dev/null
+++ b/gnu/packages/patches/r-rprotobuflib-unbundle-dependency.patch
@@ -0,0 +1,57 @@ 
+diff --git a/configure b/configure
+index 7edae5f..eff2489 100755
+--- a/configure
++++ b/configure
+@@ -2856,39 +2856,6 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex
+ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+-#untar the lib
+-BASEPBNAME="protobuf-2.6.0"
+-PBTGZNAME=${BASEPBNAME}.tgz
+-cd src
+-if test -d ./${BASEPBNAME}; then
+-	echo 'found ' $BASEPBNAME ' header sources and tar archive;using what is there.'
+-else
+-	echo "untarring protobuf ...";
+-	gunzip -dc ${PBTGZNAME} | tar xf -;
+-fi;
+-
+-#run this bootstrap script to update all the gnu auto build files (e.g.  automake symlinked fils (e.g. ./compile), alocal.m4,etc... )
+-cd ${BASEPBNAME}
+-#./autogen.sh
+-#automake --add-missing #do this because the old Autoconf (e.g. 2.13) may not handle this in autoreconf
+-#mv m4/lt~obsolete.m4 m4/lt-obsolete.m4 # R CMD check gives warning about ~ character in filename
+-cd ..
+-
+-echo "building protobuf...";
+-PBBUILD=$(pwd)/pb_build
+-if test -d ${PBBUILD}; then
+-	echo 'found ' $PBBUILD ' ;using what is there.'
+-else
+-	mkdir ${PBBUILD}
+-fi;
+-
+-cd ${BASEPBNAME};
+-./configure --enable-static=yes --with-pic=yes --enable-shared=no --prefix="${PBBUILD}" --libdir="${PBBUILD}/lib" CXX="${CXX}" CXXFLAGS="${CXXFLAGS}" CC="${CC}" CFLAGS="${CFLAGS}"
+-$MAKE install
+-
+-cd ../../
+-
+-
+
+
+ ac_config_files="$ac_config_files src/Makevars"
+diff --git a/src/Makevars.in b/src/Makevars.in
+index 63803fb..575d507 100644
+--- a/src/Makevars.in
++++ b/src/Makevars.in
+@@ -10,9 +10,6 @@ all: copying
+
+ #copy hdf5 library headers to package include
+ copying: $(GS_LIB)
+-	mkdir -p "${USER_INCLUDE}"
+-	cp -r @PBBUILD@/include/google ${USER_INCLUDE}
+ 	mkdir -p "${USER_LIB_DIR}"
+-	cp @PBBUILD@/lib/* ${USER_LIB_DIR}
+ 	cp $(GS_LIB) ${USER_LIB_DIR}/GatingSet.pb.o