GNU bug report logs - #42630
[PATCH] gnu: r-httpuv: Unvendor libuv.

Previous Next

Package: guix-patches;

Reported by: Lars-Dominik Braun <ldb <at> leibniz-psychology.org>

Date: Fri, 31 Jul 2020 12:38:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 42630 in the body.
You can then email your comments to 42630 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#42630; Package guix-patches. (Fri, 31 Jul 2020 12:38:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lars-Dominik Braun <ldb <at> leibniz-psychology.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 31 Jul 2020 12:38:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Lars-Dominik Braun <ldb <at> leibniz-psychology.org>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: r-httpuv: Unvendor libuv.
Date: Fri, 31 Jul 2020 14:37:20 +0200
[Message part 1 (text/plain, inline)]
* gnu/packages/cran.scm (r-httpuv) [source]: Remove bundled libuv, add
patch. [arguments] Rewrite header locations, fix pipe server issue.
[inputs] Add libuv.
* gnu/packages/patches/r-httpuv-1.5.4-unvendor-libuv.patch: New file.
* gnu/local.mk: Add it.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/cran.scm                         | 32 +++++++++-
 .../r-httpuv-1.5.4-unvendor-libuv.patch       | 59 +++++++++++++++++++
 3 files changed, 91 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/r-httpuv-1.5.4-unvendor-libuv.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index a2a1caa709..41cec534e5 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1497,6 +1497,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/readline-link-ncurses.patch		\
   %D%/packages/patches/readline-6.2-CVE-2014-2524.patch		\
   %D%/packages/patches/reposurgeon-add-missing-docbook-files.patch	\
+  %D%/packages/patches/r-httpuv-1.5.4-unvendor-libuv.patch	\
   %D%/packages/patches/ri-li-modernize_cpp.patch		\
   %D%/packages/patches/ripperx-missing-file.patch		\
   %D%/packages/patches/rpcbind-CVE-2017-8779.patch		\
diff --git a/gnu/packages/cran.scm b/gnu/packages/cran.scm
index 5ede11a4e3..c7619dc621 100644
--- a/gnu/packages/cran.scm
+++ b/gnu/packages/cran.scm
@@ -22,6 +22,7 @@
 ;;; Copyright © 2020 Naga Malleswari <nagamalli <at> riseup.net>
 ;;; Copyright © 2020 Eric Brown <ecbrown <at> ericcbrown.com>
 ;;; Copyright © 2020 Peter Lo <peterloleungyau <at> gmail.com>
+;;; Copyright © 2020 Lars-Dominik Braun <ldb <at> leibniz-psychology.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -45,6 +46,7 @@
   #:use-module (guix git-download)
   #:use-module (guix utils)
   #:use-module (guix build-system r)
+  #:use-module (gnu packages)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
@@ -67,6 +69,7 @@
   #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages java)
   #:use-module (gnu packages javascript)
+  #:use-module (gnu packages libevent)
   #:use-module (gnu packages lisp-xyz)
   #:use-module (gnu packages machine-learning)
   #:use-module (gnu packages maths)
@@ -800,8 +803,35 @@ into a pipeline of data manipulation and visualisation.")
               (uri (cran-uri "httpuv" version))
               (sha256
                (base32
-                "066rprqvz9qln6xd85x1yh1wbbmzd157xjl8zq1zbgr8l6347inm"))))
+                "066rprqvz9qln6xd85x1yh1wbbmzd157xjl8zq1zbgr8l6347inm"))
+              ;; Unvendor bundled libraries. As of 1.5.4 the vendored libuv
+              ;; only contains fixes for building on Solaris.
+              (patches (search-patches "r-httpuv-1.5.4-unvendor-libuv.patch"))
+              (modules '((guix build utils)
+                         (ice-9 ftw)
+                         (srfi srfi-1)))
+              (snippet
+               `(begin
+                  (delete-file-recursively "src/libuv")
+                  ;; Cannot unbundle http-parser, because it contains local
+                  ;; modifications.
+                  #t))))
     (build-system r-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'unbundle-libuv
+           (lambda* (#:key outputs #:allow-other-keys)
+             (substitute* (find-files "src" "\\.cpp$|\\.h$")
+               (("\"libuv/include/uv\\.h\"")
+                "<uv.h>"))
+             ;; Fix https://github.com/rstudio/httpuv/issues/282
+             (substitute* "src/http.cpp"
+               (("uv_pipe_init\\(pLoop, &pSocket->handle\\.pipe, true\\);")
+                "uv_pipe_init(pLoop, &pSocket->handle.pipe, 0);"))
+             #t)))))
+    (inputs
+     `(("libuv" ,libuv)))
     (propagated-inputs
      `(("r-bh" ,r-bh)
        ("r-later" ,r-later)
diff --git a/gnu/packages/patches/r-httpuv-1.5.4-unvendor-libuv.patch b/gnu/packages/patches/r-httpuv-1.5.4-unvendor-libuv.patch
new file mode 100644
index 0000000000..0947718059
--- /dev/null
+++ b/gnu/packages/patches/r-httpuv-1.5.4-unvendor-libuv.patch
@@ -0,0 +1,59 @@
+Removes references to bundled libuv.
+
+--- a/src/Makevars	2020-07-31 11:53:30.576484531 +0200
++++ b/src/Makevars	2020-07-31 11:54:19.369863118 +0200
+@@ -5,7 +5,7 @@
+ 
+ UNAME := $(shell uname)
+ 
+-PKG_LIBS = ./libuv/.libs/libuv.a ./http-parser/http_parser.o ./sha1/sha1.o ./base64/base64.o -pthread
++PKG_LIBS = -luv ./http-parser/http_parser.o ./sha1/sha1.o ./base64/base64.o -pthread
+ 
+ ifeq ($(UNAME), Darwin)
+ PKG_LIBS += -framework CoreServices
+@@ -23,7 +23,7 @@
+ 
+ PKG_CFLAGS = $(C_VISIBILITY) -DSTRICT_R_HEADERS
+ PKG_CXXFLAGS = $(CXX_VISIBILITY) -DSTRICT_R_HEADERS
+-PKG_CPPFLAGS = -Ilibuv/include -pthread
++PKG_CPPFLAGS = -pthread
+ 
+ # To avoid spurious warnings from `R CMD check --as-cran`, about compiler
+ # warning flags like -Werror.
+@@ -43,35 +43,5 @@
+ # PKG_CPPFLAGS += -D_GLIBCXX_ASSERTIONS
+ 
+ 
+-$(SHLIB): libuv/.libs/libuv.a http-parser/http_parser.o sha1/sha1.o base64/base64.o
++$(SHLIB): http-parser/http_parser.o sha1/sha1.o base64/base64.o
+ 
+-# We needed to rename lt~obsolete.m4 because the name causes problems with R
+-# CMD check. Here we rename it back.
+-libuv/m4/lt~obsolete.m4: libuv/m4/lt_obsolete.m4
+-	cp -p -f libuv/m4/lt_obsolete.m4 libuv/m4/lt~obsolete.m4
+-
+-# Run ./configure. We need to touch various autotools-related files to avoid
+-# it trying to run autotools programs again. We also need to make sure
+-# configure is executable, because on some platforms, calling unzip() in R
+-# does not preserve the executable bit.
+-#
+-# It's VERY IMPORTANT that mtime(aclocal.m4) <= mtime(configure), and also
+-# mtime(aclocal.m4) <= mtime(Makefile.in). On some platforms, passing multiple
+-# files to a single touch command gives them all the same time, but on others
+-# (Solaris and possibly some Fedoras) the timestamps are slightly increasing
+-# from one to the next, i.e. the order matters. To remove this fragility, we
+-# use "-r aclocal.m4" to ensure that all three files are guaranteed to have
+-# precisely the same timestamp value.
+-libuv/Makefile: libuv/m4/lt~obsolete.m4
+-	(cd libuv \
+-		&& touch aclocal.m4 \
+-		&& touch -r aclocal.m4 configure Makefile.in \
+-		&& chmod +x configure \
+-		&& CC="$(CC)" CFLAGS="$(CFLAGS) $(CPICFLAGS) $(C_VISIBILITY)" AR="$(AR)" RANLIB="$(RANLIB)" LDFLAGS="$(LDFLAGS)" ./configure $(CONFIGURE_FLAGS))
+-
+-libuv/.libs/libuv.a: libuv/Makefile
+-	$(MAKE) --directory=libuv \
+-		HAVE_DTRACE=0
+-
+-clean:
+-	$(MAKE) --directory=libuv distclean
-- 
2.26.2

[signature.asc (application/pgp-signature, inline)]

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Fri, 04 Sep 2020 14:00:02 GMT) Full text and rfc822 format available.

Notification sent to Lars-Dominik Braun <ldb <at> leibniz-psychology.org>:
bug acknowledged by developer. (Fri, 04 Sep 2020 14:00:02 GMT) Full text and rfc822 format available.

Message #10 received at 42630-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Lars-Dominik Braun <ldb <at> leibniz-psychology.org>
Cc: 42630-done <at> debbugs.gnu.org
Subject: Re: [bug#42630] [PATCH] gnu: r-httpuv: Unvendor libuv.
Date: Fri, 04 Sep 2020 15:59:46 +0200
Hi,

Lars-Dominik Braun <ldb <at> leibniz-psychology.org> skribis:

> * gnu/packages/cran.scm (r-httpuv) [source]: Remove bundled libuv, add
> patch. [arguments] Rewrite header locations, fix pipe server issue.
> [inputs] Add libuv.
> * gnu/packages/patches/r-httpuv-1.5.4-unvendor-libuv.patch: New file.
> * gnu/local.mk: Add it.

Perfect, pushed as d6983b1331fce3a014c19963379af7a7e00a2780!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 03 Oct 2020 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 199 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.