pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

htslib: Patch to work with latest libcurl



Module Name:	pkgsrc-wip
Committed By:	Jason Bacon <bacon%NetBSD.org@localhost>
Pushed By:	outpaddling
Date:		Tue Jul 21 15:17:01 2020 -0500
Changeset:	0433bef3a8e322edb6fe4c759fb04700993ca053

Modified Files:
	htslib/distinfo
Added Files:
	htslib/patches/patch-Makefile
	htslib/patches/patch-cram_open__trace__file.c
	htslib/patches/patch-hfile__libcurl.c

Log Message:
htslib: Patch to work with latest libcurl

Also clean up Makefile to respect pkgsrc env

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=0433bef3a8e322edb6fe4c759fb04700993ca053

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 htslib/distinfo                               |  3 ++
 htslib/patches/patch-Makefile                 | 76 ++++++++++++++++++++++++++
 htslib/patches/patch-cram_open__trace__file.c | 18 +++++++
 htslib/patches/patch-hfile__libcurl.c         | 78 +++++++++++++++++++++++++++
 4 files changed, 175 insertions(+)

diffs:
diff --git a/htslib/distinfo b/htslib/distinfo
index 9b637567b5..723b6cbeb7 100644
--- a/htslib/distinfo
+++ b/htslib/distinfo
@@ -4,3 +4,6 @@ SHA1 (htslib-1.10.2.tar.gz) = 0ac4b86e49556d7dcaa89d4cce2661c9ca706631
 RMD160 (htslib-1.10.2.tar.gz) = 6d8b6a362297345420dc9acc544029276ce4b1b6
 SHA512 (htslib-1.10.2.tar.gz) = 7a91c15ca1de35653d068dc57ae511ad791ae0bd8504867d4e60c46e813e58b441409541197cde3b2a37840e60331336aebc627ecbf5c64fca1af63dd05f8f9e
 Size (htslib-1.10.2.tar.gz) = 1452177 bytes
+SHA1 (patch-Makefile) = e13333dd97ecd6c6753d14c1b738d6e5934a2911
+SHA1 (patch-cram_open__trace__file.c) = 49b47e13786317e652a8ec810cc91f10d21bb8ea
+SHA1 (patch-hfile__libcurl.c) = 2a143818f1099ef01c57a3c904060a76abb63f14
diff --git a/htslib/patches/patch-Makefile b/htslib/patches/patch-Makefile
new file mode 100644
index 0000000000..1d09336074
--- /dev/null
+++ b/htslib/patches/patch-Makefile
@@ -0,0 +1,76 @@
+$NetBSD$
+
+# Respect pkgsrc env
+
+--- Makefile.orig	2019-12-19 09:54:30.000000000 +0000
++++ Makefile
+@@ -22,44 +22,43 @@
+ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ # DEALINGS IN THE SOFTWARE.
+ 
+-CC     = gcc
+-AR     = ar
+-RANLIB = ranlib
++CC     ?= gcc
++AR     ?= ar
++RANLIB ?= ranlib
+ 
+ # Default libraries to link if configure is not used
+ htslib_default_libs = -lz -lm -lbz2 -llzma -lcurl
+ 
+-CPPFLAGS =
++# CPPFLAGS =
+ # TODO: make the 64-bit support for VCF optional via configure, for now add -DVCF_ALLOW_INT64
+ #       to CFLAGS manually, here or in config.mk if the latter exists.
+ # TODO: probably update cram code to make it compile cleanly with -Wc++-compat
+ # For testing strict C99 support add -std=c99 -D_XOPEN_SOURCE=600
+ #CFLAGS   = -g -Wall -O2 -pedantic -std=c99 -D_XOPEN_SOURCE=600
+-CFLAGS   = -g -Wall -O2 -fvisibility=hidden
++CFLAGS   ?= -g -Wall -O2 -fvisibility=hidden
+ EXTRA_CFLAGS_PIC = -fpic
+-LDFLAGS  = -fvisibility=hidden
++LDFLAGS  ?= -fvisibility=hidden
+ LIBS     = $(htslib_default_libs)
+ 
+-prefix      = /usr/local
+-exec_prefix = $(prefix)
++PREFIX      ?= /usr/local
++exec_prefix = $(PREFIX)
+ bindir      = $(exec_prefix)/bin
+-includedir  = $(prefix)/include
++includedir  = $(PREFIX)/include
+ libdir      = $(exec_prefix)/lib
+ libexecdir  = $(exec_prefix)/libexec
+-datarootdir = $(prefix)/share
++datarootdir = $(PREFIX)/share
+ mandir      = $(datarootdir)/man
+ man1dir     = $(mandir)/man1
+ man5dir     = $(mandir)/man5
+ man7dir     = $(mandir)/man7
+ pkgconfigdir= $(libdir)/pkgconfig
+ 
+-MKDIR_P = mkdir -p
+-INSTALL = install -p
+-INSTALL_DATA    = $(INSTALL) -m 644
+-INSTALL_DIR     = $(MKDIR_P) -m 755
+-INSTALL_LIB     = $(INSTALL_DATA)
+-INSTALL_MAN     = $(INSTALL_DATA)
+-INSTALL_PROGRAM = $(INSTALL)
++MKDIR_P         = mkdir -p
++INSTALL_DATA    = ${BSD_INSTALL_DATA}
++INSTALL_DIR     = $(MKDIR_P)
++INSTALL_LIB     = ${BSD_INSTALL_LIB}
++INSTALL_MAN     = ${BSD_INSTALL_MAN}
++INSTALL_PROGRAM = ${BSD_INSTALL_PROGRAM}
+ 
+ # Set by config.mk if plugins are enabled
+ plugindir =
+@@ -98,7 +97,7 @@ BUILT_THRASH_PROGRAMS = \
+ 	test/thrash_threads6 \
+ 	test/thrash_threads7
+ 
+-all: lib-static lib-shared $(BUILT_PROGRAMS) plugins $(BUILT_TEST_PROGRAMS)
++all: lib-static lib-shared $(BUILT_PROGRAMS) plugins
+ 
+ HTSPREFIX =
+ include htslib_vars.mk
diff --git a/htslib/patches/patch-cram_open__trace__file.c b/htslib/patches/patch-cram_open__trace__file.c
new file mode 100644
index 0000000000..9e4a633a42
--- /dev/null
+++ b/htslib/patches/patch-cram_open__trace__file.c
@@ -0,0 +1,18 @@
+$NetBSD$
+
+# Enhance error message
+
+--- cram/open_trace_file.c.orig	2019-12-19 09:54:30.000000000 +0000
++++ cram/open_trace_file.c
+@@ -204,8 +204,9 @@ mFILE *find_file_url(const char *file, c
+             goto fail;
+         }
+     }
+-    if (hclose(hf) < 0 || len < 0) {
+-        hts_log_warning("Failed to read reference \"%s\": %s", path, strerror(errno));
++    int close_status = hclose(hf);
++    if (close_status < 0 || len < 0) {
++        hts_log_warning("Failed to read reference \"%s\": %s  close_status = %d len = %ld", path, strerror(errno));
+         goto fail;
+     }
+ 
diff --git a/htslib/patches/patch-hfile__libcurl.c b/htslib/patches/patch-hfile__libcurl.c
new file mode 100644
index 0000000000..cc6298c065
--- /dev/null
+++ b/htslib/patches/patch-hfile__libcurl.c
@@ -0,0 +1,78 @@
+$NetBSD$
+
+# recent libcurl compatibility
+
+--- hfile_libcurl.c.orig	2019-12-19 09:54:30.000000000 +0000
++++ hfile_libcurl.c
+@@ -74,6 +74,10 @@ typedef struct {
+     unsigned int size;
+ } hdrlist;
+ 
++#ifndef ENOTRECOVERABLE
++#define ENOTRECOVERABLE EIO
++#endif
++
+ typedef struct {
+     hdrlist fixed;                   // List of headers supplied at hopen()
+     hdrlist extra;                   // List of headers from callback
+@@ -218,6 +222,8 @@ static int easy_errno(CURL *easy, CURLco
+         return EEXIST;
+ 
+     default:
++        hts_log_error("Libcurl reported error %d (%s)", (int) err,
++                      curl_easy_strerror(err));
+         return EIO;
+     }
+ }
+@@ -238,6 +244,8 @@ static int multi_errno(CURLMcode errm)
+         return ENOMEM;
+ 
+     default:
++        hts_log_error("Libcurl reported error %d (%s)", (int) errm,
++                      curl_multi_strerror(errm));
+         return EIO;
+     }
+ }
+@@ -797,9 +805,13 @@ static ssize_t libcurl_read(hFILE *fpv, 
+         fp->buffer.ptr.rd = buffer;
+         fp->buffer.len = nbytes;
+         fp->paused = 0;
+-        err = curl_easy_pause(fp->easy, CURLPAUSE_CONT);
+-        if (err != CURLE_OK) { errno = easy_errno(fp->easy, err); return -1; }
+-
++	if (! fp->finished) {
++            err = curl_easy_pause(fp->easy, CURLPAUSE_CONT);
++            if (err != CURLE_OK) {
++		errno = easy_errno(fp->easy, err);
++		return -1;
++	    }
++	}
+         while (! fp->paused && ! fp->finished) {
+             if (wait_perform(fp) < 0) return -1;
+         }
+@@ -1003,12 +1015,6 @@ static int restart_from_position(hFILE_l
+     }
+     temp_fp.nrunning = ++fp->nrunning;
+ 
+-    err = curl_easy_pause(temp_fp.easy, CURLPAUSE_CONT);
+-    if (err != CURLE_OK) {
+-        save_errno = easy_errno(temp_fp.easy, err);
+-        goto error_remove;
+-    }
+-
+     while (! temp_fp.paused && ! temp_fp.finished)
+         if (wait_perform(&temp_fp) < 0) {
+             save_errno = errno;
+@@ -1084,8 +1090,10 @@ static int libcurl_close(hFILE *fpv)
+     fp->buffer.len = 0;
+     fp->closing = 1;
+     fp->paused = 0;
+-    err = curl_easy_pause(fp->easy, CURLPAUSE_CONT);
+-    if (err != CURLE_OK) save_errno = easy_errno(fp->easy, err);
++    if (! fp->finished) {
++        err = curl_easy_pause(fp->easy, CURLPAUSE_CONT);
++        if (err != CURLE_OK) save_errno = easy_errno(fp->easy, err);
++    }
+ 
+     while (save_errno == 0 && ! fp->paused && ! fp->finished)
+         if (wait_perform(fp) < 0) save_errno = errno;


Home | Main Index | Thread Index | Old Index