Use unbundled libuv.

This commit is contained in:
Elliott Sales de Andrade 2018-04-30 05:01:58 -04:00
parent fd56bdb665
commit c3b4f5d094
2 changed files with 236 additions and 4 deletions

View File

@ -0,0 +1,223 @@
From 928b1c2999f7214a646d4c000a0ff30a5583f7ad Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Mon, 30 Apr 2018 04:53:42 -0400
Subject: [PATCH] Use unbundled libuv.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
src/Makevars | 34 +++-------------------------------
src/callbackqueue.cpp | 2 +-
src/callbackqueue.h | 2 +-
src/http.h | 2 +-
src/httprequest.h | 2 +-
src/httpresponse.cpp | 2 +-
src/httpuv.cpp | 2 +-
src/socket.cpp | 2 +-
src/socket.h | 2 +-
src/thread.h | 2 +-
src/uvutil.h | 2 +-
src/webapplication.h | 2 +-
12 files changed, 14 insertions(+), 42 deletions(-)
diff --git a/src/Makevars b/src/Makevars
index ebfd618..78c2e93 100644
--- a/src/Makevars
+++ b/src/Makevars
@@ -9,7 +9,7 @@ ifeq ($(UNAME), Darwin)
FRAMEWORK = -framework CoreServices
endif
-PKG_LIBS = ./libuv/.libs/libuv.a ./http-parser/http_parser.o ./sha1/sha1.o ./base64/base64.o $(FRAMEWORK)
+PKG_LIBS = $(shell pkgconf --libs libuv) ./http-parser/http_parser.o ./sha1/sha1.o ./base64/base64.o $(FRAMEWORK)
ifeq ($(UNAME), SunOS)
PKG_LIBS += -lkstat -lsendfile -lsocket -lxnet
endif
@@ -20,7 +20,7 @@ ifeq ($(UNAME), OpenBSD)
PKG_LIBS += -lkvm
endif
-PKG_CPPFLAGS = $(C_VISIBILITY)
+PKG_CPPFLAGS = $(C_VISIBILITY) $(shell pkgconf --cflags libuv)
# To avoid spurious warnings from `R CMD check --as-cran`, about compiler
# warning flags like -Werror.
@@ -33,32 +33,4 @@ CONFIGURE_FLAGS="--quiet"
# PKG_CPPFLAGS += -DDEBUG_TRACE
-$(SHLIB): libuv/.libs/libuv.a 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.
-#
-# 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 \
- && 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
+$(SHLIB): http-parser/http_parser.o sha1/sha1.o base64/base64.o
diff --git a/src/callbackqueue.cpp b/src/callbackqueue.cpp
index a72fa06..220cb0b 100644
--- a/src/callbackqueue.cpp
+++ b/src/callbackqueue.cpp
@@ -2,7 +2,7 @@
#include "tqueue.h"
#include "thread.h"
#include <boost/function.hpp>
-#include "libuv/include/uv.h"
+#include <uv.h>
// This non-class function is a plain C wrapper for CallbackQueue::flush(), and
diff --git a/src/callbackqueue.h b/src/callbackqueue.h
index 27f8bf5..5d995c9 100644
--- a/src/callbackqueue.h
+++ b/src/callbackqueue.h
@@ -3,7 +3,7 @@
#include "tqueue.h"
#include <boost/function.hpp>
-#include "libuv/include/uv.h"
+#include <uv.h>
class CallbackQueue {
public:
diff --git a/src/http.h b/src/http.h
index 06b70ff..c410712 100644
--- a/src/http.h
+++ b/src/http.h
@@ -1,7 +1,7 @@
#ifndef HTTP_HPP
#define HTTP_HPP
-#include "libuv/include/uv.h"
+#include <uv.h>
#include <boost/shared_ptr.hpp>
#include <boost/bind.hpp>
#include "webapplication.h"
diff --git a/src/httprequest.h b/src/httprequest.h
index 2cc62bd..08649b7 100644
--- a/src/httprequest.h
+++ b/src/httprequest.h
@@ -8,7 +8,7 @@
#include <boost/bind.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/shared_ptr.hpp>
-#include "libuv/include/uv.h"
+#include <uv.h>
#include "http-parser/http_parser.h"
#include "socket.h"
#include "webapplication.h"
diff --git a/src/httpresponse.cpp b/src/httpresponse.cpp
index 3eae69a..781d75f 100644
--- a/src/httpresponse.cpp
+++ b/src/httpresponse.cpp
@@ -3,7 +3,7 @@
#include "constants.h"
#include "thread.h"
#include "utils.h"
-#include "libuv/include/uv.h"
+#include <uv.h>
void on_response_written(uv_write_t* handle, int status) {
diff --git a/src/httpuv.cpp b/src/httpuv.cpp
index e2a6579..6e37214 100644
--- a/src/httpuv.cpp
+++ b/src/httpuv.cpp
@@ -7,7 +7,7 @@
#include <errno.h>
#include <boost/function.hpp>
#include <boost/bind.hpp>
-#include "libuv/include/uv.h"
+#include <uv.h>
#include "base64/base64.hpp"
#include "uvutil.h"
#include "webapplication.h"
diff --git a/src/socket.cpp b/src/socket.cpp
index 830cb1e..8f621b3 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -1,7 +1,7 @@
#include "socket.h"
#include "httprequest.h"
#include <later_api.h>
-#include "libuv/include/uv.h"
+#include <uv.h>
void on_Socket_close(uv_handle_t* pHandle);
diff --git a/src/socket.h b/src/socket.h
index d9cfe15..bcf7e0b 100644
--- a/src/socket.h
+++ b/src/socket.h
@@ -3,7 +3,7 @@
#include "http.h"
#include <boost/shared_ptr.hpp>
-#include "libuv/include/uv.h"
+#include <uv.h>
class HttpRequest;
class WebApplication;
diff --git a/src/thread.h b/src/thread.h
index e9066cb..80ea8b1 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -1,7 +1,7 @@
#ifndef THREAD_HPP
#define THREAD_HPP
-#include "libuv/include/uv.h"
+#include <uv.h>
// These must be called from the main and background thread, respectively, so
// that is_main_thread() and is_background_thread() can be tested later.
diff --git a/src/uvutil.h b/src/uvutil.h
index 4a7c4c0..d212fbb 100644
--- a/src/uvutil.h
+++ b/src/uvutil.h
@@ -4,7 +4,7 @@
#include "thread.h"
#include <string>
#include <vector>
-#include "libuv/include/uv.h"
+#include <uv.h>
/* Prevent naming conflicts for Free() and Calloc() */
#define R_NO_REMAP
diff --git a/src/webapplication.h b/src/webapplication.h
index 7ec2ed8..8f79a4c 100644
--- a/src/webapplication.h
+++ b/src/webapplication.h
@@ -2,7 +2,7 @@
#define WEBAPPLICATION_HPP
#include <boost/function.hpp>
-#include "libuv/include/uv.h"
+#include <uv.h>
#include <Rcpp.h>
#include "websockets.h"
#include "thread.h"
--
2.14.3

View File

@ -6,10 +6,11 @@ Version: 1.4.1
Release: 1%{?dist}
Summary: HTTP and WebSocket Server Library
# Main: GPLv2+; http-parser & libuv: MIT; sha1: Public Domain
# Main: GPLv2+; http-parser: MIT; sha1: Public Domain
License: GPLv2+ and MIT and Public Domain
URL: https://cran.r-project.org/web/packages/%{packname}/index.html
Source0: https://cran.r-project.org/src/contrib/%{packname}_%{version}.tar.gz
Patch0001: 0001-Use-unbundled-libuv.patch
# Here's the R view of the dependencies world:
# Depends: R-methods
@ -33,10 +34,11 @@ BuildRequires: R-later-devel >= 0.7.1
BuildRequires: R-testthat
BuildRequires: R-callr
BuildRequires: R-BH-devel
# Hopefully will be removable in the next release, which also upgrades the
# internal copies.
# Hopefully will be removable in the later releases, but for now it includes
# some patches:
# https://github.com/rstudio/httpuv/pull/93#issuecomment-340802818
Provides: bundled(http-parser) = 2.7.1
Provides: bundled(libuv) = 1.18.0
BuildRequires: libuv-devel >= 1.18.0
%description
Provides low-level socket and protocol support for handling HTTP and
@ -50,6 +52,12 @@ by Joyent, Inc.
%prep
%setup -q -c -n %{packname}
pushd %{packname}
%patch0001 -p1
rm -r src/libuv
sed -i '/libuv/d' MD5
popd
%build
@ -84,6 +92,7 @@ rm -f %{buildroot}%{rlibdir}/R.css
%changelog
* Mon Apr 30 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.4.1-1
- Update to latest version
- Unbundle libuv
* Fri Mar 09 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 1.3.6.2-2
- Fix license and changelog