[med-svn] [Git][med-team/iitii][master] Use Debian packaged libraries also in tests

Andreas Tille gitlab at salsa.debian.org
Mon Jun 8 17:44:21 BST 2020



Andreas Tille pushed to branch master at Debian Med / iitii


Commits:
544fee73 by Andreas Tille at 2020-06-08T18:43:41+02:00
Use Debian packaged libraries also in tests

- - - - -


9 changed files:

- debian/control
- debian/install → debian/iitii.install
- + debian/libiitii-dev.install
- + debian/missing-sources/htslib/hts_defs.h
- + debian/missing-sources/htslib/kstring.h
- + debian/missing-sources/htslib/tbx.h
- debian/patches/series
- + debian/patches/use_debian_packages_libs_in_test.patch
- debian/rules


Changes:

=====================================
debian/control
=====================================
@@ -7,7 +7,10 @@ Build-Depends: debhelper-compat (= 13),
                cmake,
                libips4o-dev,
                libargs-dev,
-               libmmap-allocator-dev (>= 0.4.0+git20200122.adbfbe1)
+               libmmap-allocator-dev (>= 0.4.0+git20200122.adbfbe1),
+               libopenmpi-dev,
+               libhts-dev <!nocheck>,
+               libctpl-dev <!nocheck>
 Standards-Version: 4.5.0
 Vcs-Browser: https://salsa.debian.org/med-team/iitii
 Vcs-Git: https://salsa.debian.org/med-team/iitii.git
@@ -23,3 +26,18 @@ Description: Implicit Interval Tree with Interpolation Index
  items overlapping a query interval. Building on cgranges by Heng Li,
  iitii explores ideas from DBMS interpolation search and learned index
  structures to speed up queries on large datasets.
+
+Package: libiitii-dev
+Architecture: all
+Depends: ${misc:Depends}
+         libips4o-dev,
+         libargs-dev,
+         libmmap-allocator-dev
+Description: Implicit Interval Tree with Interpolation Index (devel)
+ Iitii is a data structure for indexing begin/end position intervals,
+ such as genomic feature annotations, and answering requests for all
+ items overlapping a query interval. Building on cgranges by Heng Li,
+ iitii explores ideas from DBMS interpolation search and learned index
+ structures to speed up queries on large datasets.
+ .
+ This package contains the header for development.


=====================================
debian/install → debian/iitii.install
=====================================


=====================================
debian/libiitii-dev.install
=====================================
@@ -0,0 +1 @@
+src/*.h	usr/include


=====================================
debian/missing-sources/htslib/hts_defs.h
=====================================
@@ -0,0 +1,114 @@
+/*  hts_defs.h -- Miscellaneous definitions.
+
+    Copyright (C) 2013-2015,2017, 2019 Genome Research Ltd.
+
+    Author: John Marshall <jm18 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.  */
+
+#ifndef HTSLIB_HTS_DEFS_H
+#define HTSLIB_HTS_DEFS_H
+
+#include <stdio.h>     // For __MINGW_PRINTF_FORMAT macro
+
+#ifdef __clang__
+#ifdef __has_attribute
+#define HTS_COMPILER_HAS(attribute) __has_attribute(attribute)
+#endif
+
+#elif defined __GNUC__
+#define HTS_GCC_AT_LEAST(major, minor) \
+    (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
+#endif
+
+#ifndef HTS_COMPILER_HAS
+#define HTS_COMPILER_HAS(attribute) 0
+#endif
+#ifndef HTS_GCC_AT_LEAST
+#define HTS_GCC_AT_LEAST(major, minor) 0
+#endif
+
+#if HTS_COMPILER_HAS(__noreturn__) || HTS_GCC_AT_LEAST(3,0)
+#define HTS_NORETURN __attribute__ ((__noreturn__))
+#else
+#define HTS_NORETURN
+#endif
+
+// GCC introduced warn_unused_result in 3.4 but added -Wno-unused-result later
+#if HTS_COMPILER_HAS(__warn_unused_result__) || HTS_GCC_AT_LEAST(4,5)
+#define HTS_RESULT_USED __attribute__ ((__warn_unused_result__))
+#else
+#define HTS_RESULT_USED
+#endif
+
+#if HTS_COMPILER_HAS(__unused__) || HTS_GCC_AT_LEAST(3,0)
+#define HTS_UNUSED __attribute__ ((__unused__))
+#else
+#define HTS_UNUSED
+#endif
+
+#if HTS_COMPILER_HAS(__deprecated__) || HTS_GCC_AT_LEAST(4,5)
+#define HTS_DEPRECATED(message) __attribute__ ((__deprecated__ (message)))
+#elif HTS_GCC_AT_LEAST(3,1)
+#define HTS_DEPRECATED(message) __attribute__ ((__deprecated__))
+#else
+#define HTS_DEPRECATED(message)
+#endif
+
+#if HTS_COMPILER_HAS(__deprecated__) || HTS_GCC_AT_LEAST(6,4)
+#define HTS_DEPRECATED_ENUM(message) __attribute__ ((__deprecated__ (message)))
+#else
+#define HTS_DEPRECATED_ENUM(message)
+#endif
+
+// On mingw the "printf" format type doesn't work.  It needs "gnu_printf"
+// in order to check %lld and %z, otherwise it defaults to checking against
+// the Microsoft library printf format options despite linking against the
+// GNU posix implementation of printf.  The __MINGW_PRINTF_FORMAT macro
+// expands to printf or gnu_printf as required, but obviously may not
+// exist
+#ifdef __MINGW_PRINTF_FORMAT
+#define HTS_PRINTF_FMT __MINGW_PRINTF_FORMAT
+#else
+#define HTS_PRINTF_FMT printf
+#endif
+
+#if HTS_COMPILER_HAS(__format__) || HTS_GCC_AT_LEAST(3,0)
+#define HTS_FORMAT(type, idx, first) __attribute__((__format__ (type, idx, first)))
+#else
+#define HTS_FORMAT(type, idx, first)
+#endif
+
+#if defined(_WIN32) || defined(__CYGWIN__)
+#define HTS_DLL_EXPORT __declspec(dllexport)
+#elif HTS_COMPILER_HAS(__visibility__) || HTS_GCC_AT_LEAST(4,0)
+#define HTS_DLL_EXPORT __attribute__((__visibility__("default")))
+#elif defined(__SUNPRO_C) && __SUNPRO_C >= 0x550
+#define HTS_DLL_EXPORT __global
+#else
+#define HTS_DLL_EXPORT
+#endif
+
+#if !(defined(_WIN32) || defined(__CYGWIN__)) || defined(HTS_BUILDING_LIBRARY)
+#define HTSLIB_EXPORT HTS_DLL_EXPORT
+#else
+#define HTSLIB_EXPORT
+#endif
+
+#endif


=====================================
debian/missing-sources/htslib/kstring.h
=====================================
@@ -0,0 +1,408 @@
+/* The MIT License
+
+   Copyright (C) 2011 by Attractive Chaos <attractor at live.co.uk>
+   Copyright (C) 2013-2014, 2016, 2018-2019 Genome Research Ltd.
+
+   Permission is hereby granted, free of charge, to any person obtaining
+   a copy of this software and associated documentation files (the
+   "Software"), to deal in the Software without restriction, including
+   without limitation the rights to use, copy, modify, merge, publish,
+   distribute, sublicense, and/or sell copies of the Software, and to
+   permit persons to whom the Software is furnished to do so, subject to
+   the following conditions:
+
+   The above copyright notice and this permission notice shall be
+   included in all copies or substantial portions of the Software.
+
+   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+   BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+   SOFTWARE.
+*/
+
+#ifndef KSTRING_H
+#define KSTRING_H
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <limits.h>
+#include <sys/types.h>
+
+#include "hts_defs.h"
+
+#ifndef kroundup32
+#define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x))
+#endif
+
+#ifndef kroundup_size_t
+#define kroundup_size_t(x) (--(x),                                       \
+                            (x)|=(x)>>(sizeof(size_t)/8), /*  0 or  1 */ \
+                            (x)|=(x)>>(sizeof(size_t)/4), /*  1 or  2 */ \
+                            (x)|=(x)>>(sizeof(size_t)/2), /*  2 or  4 */ \
+                            (x)|=(x)>>(sizeof(size_t)),   /*  4 or  8 */ \
+                            (x)|=(x)>>(sizeof(size_t)*2), /*  8 or 16 */ \
+                            (x)|=(x)>>(sizeof(size_t)*4), /* 16 or 32 */ \
+                            ++(x))
+#endif
+
+#if defined __GNUC__ && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4))
+#ifdef __MINGW_PRINTF_FORMAT
+#define KS_ATTR_PRINTF(fmt, arg) __attribute__((__format__ (__MINGW_PRINTF_FORMAT, fmt, arg)))
+#else
+#define KS_ATTR_PRINTF(fmt, arg) __attribute__((__format__ (__printf__, fmt, arg)))
+#endif // __MINGW_PRINTF_FORMAT
+#else
+#define KS_ATTR_PRINTF(fmt, arg)
+#endif
+
+#ifndef HAVE___BUILTIN_CLZ
+#if defined __GNUC__ && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#define HAVE___BUILTIN_CLZ 1
+#endif
+#endif
+
+/* kstring_t is a simple non-opaque type whose fields are likely to be
+ * used directly by user code (but see also ks_str() and ks_len() below)..
+ * A kstring_t object is initialised by either of
+ *       kstring_t str = KS_INITIALIZE;
+ *       kstring_t str; ...; ks_initialize(&str);
+ * and either ownership of the underlying buffer should be given away before
+ * the object disappears (see ks_release() below) or the kstring_t should be
+ * destroyed with  ks_free(&str) or free(str.s) */
+#ifndef KSTRING_T
+#define KSTRING_T kstring_t
+typedef struct kstring_t {
+	size_t l, m;
+	char *s;
+} kstring_t;
+#endif
+
+typedef struct {
+	uint64_t tab[4];
+	int sep, finished;
+	const char *p; // end of the current token
+} ks_tokaux_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+    HTSLIB_EXPORT
+	int kvsprintf(kstring_t *s, const char *fmt, va_list ap) KS_ATTR_PRINTF(2,0);
+
+    HTSLIB_EXPORT
+	int ksprintf(kstring_t *s, const char *fmt, ...) KS_ATTR_PRINTF(2,3);
+
+    HTSLIB_EXPORT
+    int kputd(double d, kstring_t *s); // custom %g only handler
+
+    HTSLIB_EXPORT
+	int ksplit_core(char *s, int delimiter, int *_max, int **_offsets);
+
+    HTSLIB_EXPORT
+	char *kstrstr(const char *str, const char *pat, int **_prep);
+
+    HTSLIB_EXPORT
+	char *kstrnstr(const char *str, const char *pat, int n, int **_prep);
+
+    HTSLIB_EXPORT
+	void *kmemmem(const void *_str, int n, const void *_pat, int m, int **_prep);
+
+	/* kstrtok() is similar to strtok_r() except that str is not
+	 * modified and both str and sep can be NULL. For efficiency, it is
+	 * actually recommended to set both to NULL in the subsequent calls
+	 * if sep is not changed. */
+    HTSLIB_EXPORT
+	char *kstrtok(const char *str, const char *sep, ks_tokaux_t *aux);
+
+	/* kgetline() uses the supplied fgets()-like function to read a "\n"-
+	 * or "\r\n"-terminated line from fp.  The line read is appended to the
+	 * kstring without its terminator and 0 is returned; EOF is returned at
+	 * EOF or on error (determined by querying fp, as per fgets()). */
+	typedef char *kgets_func(char *, int, void *);
+    HTSLIB_EXPORT
+	int kgetline(kstring_t *s, kgets_func *fgets, void *fp);
+
+    // This matches the signature of hgetln(), apart from the last pointer
+	typedef ssize_t kgets_func2(char *, size_t, void *);
+    HTSLIB_EXPORT
+	int kgetline2(kstring_t *s, kgets_func2 *fgets, void *fp);
+
+#ifdef __cplusplus
+}
+#endif
+
+/// kstring initializer for structure assignment
+#define KS_INITIALIZE { 0, 0, NULL }
+
+/// kstring initializer for pointers
+/**
+   @note Not to be used if the buffer has been allocated.  Use ks_release()
+   or ks_clear() instead.
+*/
+
+static inline void ks_initialize(kstring_t *s)
+{
+    s->l = s->m = 0;
+    s->s = NULL;
+}
+
+/// Resize a kstring to a given capacity
+static inline int ks_resize(kstring_t *s, size_t size)
+{
+	if (s->m < size) {
+		char *tmp;
+		kroundup_size_t(size);
+		tmp = (char*)realloc(s->s, size);
+		if (!tmp && size)
+		    return -1;
+		s->s = tmp;
+		s->m = size;
+	}
+	return 0;
+}
+
+/// Increase kstring capacity by a given number of bytes
+static inline int ks_expand(kstring_t *s, size_t expansion)
+{
+    size_t new_size = s->l + expansion;
+
+    if (new_size < s->l) // Overflow check
+        return -1;
+    return ks_resize(s, new_size);
+}
+
+/// Returns the kstring buffer
+static inline char *ks_str(kstring_t *s)
+{
+	return s->s;
+}
+
+/// Returns the kstring buffer, or an empty string if l == 0
+/**
+ * Unlike ks_str(), this function will never return NULL.  If the kstring is
+ * empty it will return a read-only empty string.  As the returned value
+ * may be read-only, the caller should not attempt to modify it.
+ */
+static inline const char *ks_c_str(kstring_t *s)
+{
+    return s->l && s->s ? s->s : "";
+}
+
+static inline size_t ks_len(kstring_t *s)
+{
+	return s->l;
+}
+
+/// Reset kstring length to zero
+/**
+   @return The kstring itself
+
+   Example use: kputsn(string, len, ks_clear(s))
+*/
+static inline kstring_t *ks_clear(kstring_t *s)
+{
+    s->l = 0;
+    return s;
+}
+
+// Give ownership of the underlying buffer away to something else (making
+// that something else responsible for freeing it), leaving the kstring_t
+// empty and ready to be used again, or ready to go out of scope without
+// needing  free(str.s)  to prevent a memory leak.
+static inline char *ks_release(kstring_t *s)
+{
+	char *ss = s->s;
+	s->l = s->m = 0;
+	s->s = NULL;
+	return ss;
+}
+
+/// Safely free the underlying buffer in a kstring.
+static inline void ks_free(kstring_t *s)
+{
+    if (s) {
+        free(s->s);
+        ks_initialize(s);
+    }
+}
+
+static inline int kputsn(const char *p, size_t l, kstring_t *s)
+{
+	size_t new_sz = s->l + l + 2;
+	if (new_sz <= s->l || ks_resize(s, new_sz) < 0)
+		return EOF;
+	memcpy(s->s + s->l, p, l);
+	s->l += l;
+	s->s[s->l] = 0;
+	return l;
+}
+
+static inline int kputs(const char *p, kstring_t *s)
+{
+	return kputsn(p, strlen(p), s);
+}
+
+static inline int kputc(int c, kstring_t *s)
+{
+	if (ks_resize(s, s->l + 2) < 0)
+		return EOF;
+	s->s[s->l++] = c;
+	s->s[s->l] = 0;
+	return (unsigned char)c;
+}
+
+static inline int kputc_(int c, kstring_t *s)
+{
+	if (ks_resize(s, s->l + 1) < 0)
+		return EOF;
+	s->s[s->l++] = c;
+	return 1;
+}
+
+static inline int kputsn_(const void *p, size_t l, kstring_t *s)
+{
+	size_t new_sz = s->l + l;
+	if (new_sz < s->l || ks_resize(s, new_sz ? new_sz : 1) < 0)
+		return EOF;
+	memcpy(s->s + s->l, p, l);
+	s->l += l;
+	return l;
+}
+
+static inline int kputuw(unsigned x, kstring_t *s)
+{
+#if HAVE___BUILTIN_CLZ && UINT_MAX == 4294967295U
+    static const unsigned int kputuw_num_digits[32] = {
+        10, 10, 10,  9,  9,  9,  8,  8,
+        8,   7,  7,  7,  7,  6,  6,  6,
+        5,   5,  5,  4,  4,  4,  4,  3,
+        3,   3,  2,  2,  2,  1,  1,  1
+    };
+    static const unsigned int kputuw_thresholds[32] = {
+        0,        0, 1000000000U, 0,       0, 100000000U,   0,      0,
+        10000000, 0,          0,  0, 1000000,         0,    0, 100000,
+        0,        0,      10000,  0,       0,         0, 1000,      0,
+        0,      100,          0,  0,      10,         0,    0,      0
+    };
+#else
+    uint64_t m;
+#endif
+    static const char kputuw_dig2r[] =
+        "00010203040506070809"
+        "10111213141516171819"
+        "20212223242526272829"
+        "30313233343536373839"
+        "40414243444546474849"
+        "50515253545556575859"
+        "60616263646566676869"
+        "70717273747576777879"
+        "80818283848586878889"
+        "90919293949596979899";
+    unsigned int l, j;
+    char *cp;
+
+    // Trivial case - also prevents __builtin_clz(0), which is undefined
+    if (x < 10) {
+        if (ks_resize(s, s->l + 2) < 0)
+            return EOF;
+        s->s[s->l++] = '0'+x;
+        s->s[s->l] = 0;
+        return 0;
+    }
+
+    // Find out how many digits are to be printed.
+#if HAVE___BUILTIN_CLZ && UINT_MAX == 4294967295U
+    /*
+     * Table method - should be quick if clz can be done in hardware.
+     * Find the most significant bit of the value to print and look
+     * up in a table to find out how many decimal digits are needed.
+     * This number needs to be adjusted by 1 for cases where the decimal
+     * length could vary for a given number of bits (for example,
+     * a four bit number could be between 8 and 15).
+     */
+
+    l = __builtin_clz(x);
+    l = kputuw_num_digits[l] - (x < kputuw_thresholds[l]);
+#else
+    // Fallback for when clz is not available
+    m = 1;
+    l = 0;
+    do {
+        l++;
+        m *= 10;
+    } while (x >= m);
+#endif
+
+    if (ks_resize(s, s->l + l + 2) < 0)
+        return EOF;
+
+    // Add digits two at a time
+    j = l;
+    cp = s->s + s->l;
+    while (x >= 10) {
+        const char *d = &kputuw_dig2r[2*(x%100)];
+        x /= 100;
+        memcpy(&cp[j-=2], d, 2);
+    }
+
+    // Last one (if necessary).  We know that x < 10 by now.
+    if (j == 1)
+        cp[0] = x + '0';
+
+    s->l += l;
+    s->s[s->l] = 0;
+    return 0;
+}
+
+static inline int kputw(int c, kstring_t *s)
+{
+    unsigned int x = c;
+    if (c < 0) {
+        x = -x;
+        if (ks_resize(s, s->l + 3) < 0)
+            return EOF;
+        s->s[s->l++] = '-';
+    }
+
+    return kputuw(x, s);
+}
+
+static inline int kputll(long long c, kstring_t *s)
+{
+	char buf[32];
+	int i, l = 0;
+	unsigned long long x = c;
+	if (c < 0) x = -x;
+	do { buf[l++] = x%10 + '0'; x /= 10; } while (x > 0);
+	if (c < 0) buf[l++] = '-';
+	if (ks_resize(s, s->l + l + 2) < 0)
+		return EOF;
+	for (i = l - 1; i >= 0; --i) s->s[s->l++] = buf[i];
+	s->s[s->l] = 0;
+	return 0;
+}
+
+static inline int kputl(long c, kstring_t *s) {
+    return kputll(c, s);
+}
+
+/*
+ * Returns 's' split by delimiter, with *n being the number of components;
+ *         NULL on failue.
+ */
+static inline int *ksplit(kstring_t *s, int delimiter, int *n)
+{
+	int max = 0, *offsets = 0;
+	*n = ksplit_core(s->s, delimiter, &max, &offsets);
+	return offsets;
+}
+
+#endif


=====================================
debian/missing-sources/htslib/tbx.h
=====================================
@@ -0,0 +1,142 @@
+/// @file htslib/tbx.h
+/// Tabix API functions.
+/*
+    Copyright (C) 2009, 2012-2015, 2019 Genome Research Ltd.
+    Copyright (C) 2010, 2012 Broad Institute.
+
+    Author: Heng Li <lh3 at sanger.ac.uk>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.  */
+
+#ifndef HTSLIB_TBX_H
+#define HTSLIB_TBX_H
+
+#include "hts.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define TBX_MAX_SHIFT 31
+
+#define TBX_GENERIC 0
+#define TBX_SAM     1
+#define TBX_VCF     2
+#define TBX_UCSC    0x10000
+
+typedef struct {
+    int32_t preset;
+    int32_t sc, bc, ec; // seq col., beg col. and end col.
+    int32_t meta_char, line_skip;
+} tbx_conf_t;
+
+typedef struct {
+    tbx_conf_t conf;
+    hts_idx_t *idx;
+    void *dict;
+} tbx_t;
+
+extern const tbx_conf_t tbx_conf_gff, tbx_conf_bed, tbx_conf_psltbl, tbx_conf_sam, tbx_conf_vcf;
+
+    #define tbx_itr_destroy(iter) hts_itr_destroy(iter)
+    #define tbx_itr_queryi(tbx, tid, beg, end) hts_itr_query((tbx)->idx, (tid), (beg), (end), tbx_readrec)
+    #define tbx_itr_querys(tbx, s) hts_itr_querys((tbx)->idx, (s), (hts_name2id_f)(tbx_name2id), (tbx), hts_itr_query, tbx_readrec)
+    #define tbx_itr_next(htsfp, tbx, itr, r) hts_itr_next(hts_get_bgzfp(htsfp), (itr), (r), (tbx))
+    #define tbx_bgzf_itr_next(bgzfp, tbx, itr, r) hts_itr_next((bgzfp), (itr), (r), (tbx))
+
+    HTSLIB_EXPORT
+    int tbx_name2id(tbx_t *tbx, const char *ss);
+
+    /* Internal helper function used by tbx_itr_next() */
+    HTSLIB_EXPORT
+    BGZF *hts_get_bgzfp(htsFile *fp);
+
+    HTSLIB_EXPORT
+    int tbx_readrec(BGZF *fp, void *tbxv, void *sv, int *tid, hts_pos_t *beg, hts_pos_t *end);
+
+/// Build an index of the lines in a BGZF-compressed file
+/** The index struct returned by a successful call should be freed
+    via tbx_destroy() when it is no longer needed.
+*/
+    HTSLIB_EXPORT
+    tbx_t *tbx_index(BGZF *fp, int min_shift, const tbx_conf_t *conf);
+/*
+ * All tbx_index_build* methods return: 0 (success), -1 (general failure) or -2 (compression not BGZF)
+ */
+    HTSLIB_EXPORT
+    int tbx_index_build(const char *fn, int min_shift, const tbx_conf_t *conf);
+
+    HTSLIB_EXPORT
+    int tbx_index_build2(const char *fn, const char *fnidx, int min_shift, const tbx_conf_t *conf);
+
+    HTSLIB_EXPORT
+    int tbx_index_build3(const char *fn, const char *fnidx, int min_shift, int n_threads, const tbx_conf_t *conf);
+
+
+/// Load or stream a .tbi or .csi index
+/** @param fn     Name of the data file corresponding to the index
+
+    Equivalent to tbx_index_load3(fn, NULL, HTS_IDX_SAVE_REMOTE);
+*/
+    HTSLIB_EXPORT
+    tbx_t *tbx_index_load(const char *fn);
+
+/// Load or stream a .tbi or .csi index
+/** @param fn     Name of the data file corresponding to the index
+    @param fnidx  Name of the indexed file
+    @return The index, or NULL if an error occurred
+
+    If @p fnidx is NULL, the index name will be derived from @p fn.
+
+    Equivalent to tbx_index_load3(fn, fnidx, HTS_IDX_SAVE_REMOTE);
+*/
+    HTSLIB_EXPORT
+    tbx_t *tbx_index_load2(const char *fn, const char *fnidx);
+
+/// Load or stream a .tbi or .csi index
+/** @param fn     Name of the data file corresponding to the index
+    @param fnidx  Name of the indexed file
+    @param flags  Flags to alter behaviour (see description)
+    @return The index, or NULL if an error occurred
+
+    If @p fnidx is NULL, the index name will be derived from @p fn.
+
+    The @p flags parameter can be set to a combination of the following
+    values:
+
+        HTS_IDX_SAVE_REMOTE   Save a local copy of any remote indexes
+        HTS_IDX_SILENT_FAIL   Fail silently if the index is not present
+
+    The index struct returned by a successful call should be freed
+    via tbx_destroy() when it is no longer needed.
+*/
+    HTSLIB_EXPORT
+    tbx_t *tbx_index_load3(const char *fn, const char *fnidx, int flags);
+
+    HTSLIB_EXPORT
+    const char **tbx_seqnames(tbx_t *tbx, int *n);  // free the array but not the values
+
+    HTSLIB_EXPORT
+    void tbx_destroy(tbx_t *tbx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif


=====================================
debian/patches/series
=====================================
@@ -1,2 +1,3 @@
 use_debian_packaged_libs.patch
 dynamic_linking.patch
+use_debian_packages_libs_in_test.patch


=====================================
debian/patches/use_debian_packages_libs_in_test.patch
=====================================
@@ -0,0 +1,43 @@
+Author: Andreas Tille <tille at debian.org>
+Last-Update: Fri, 05 Jun 2020 17:53:54 +0200
+Description: Use Debian packaged libraries also in tests
+
+--- a/test/CMakeLists.txt
++++ b/test/CMakeLists.txt
+@@ -11,6 +11,7 @@ project(iitii)
+ INCLUDE(ExternalProject)
+ include_directories(${PROJECT_SOURCE_DIR}/..)
+ 
++if(!DEBIAN_BUILD)
+ # After build, double-check external/src/htslib-stamp/htslib-build-out.log
+ # to make sure CFLAGS were set as expected
+ ExternalProject_Add(htslib
+@@ -44,6 +45,9 @@ ExternalProject_Add(CTPL
+ ExternalProject_Get_Property(CTPL source_dir)
+ set(CTPL_INCLUDE_DIR ${source_dir})
+ include_directories(${CTPL_INCLUDE_DIR})
++else()
++include_directories(/usr/include/htslib)
++endif()
+ 
+ ExternalProject_Add(catch
+   URL https://github.com/philsquared/Catch/archive/v2.9.1.zip
+@@ -59,15 +63,15 @@ include_directories(${source_dir}/single
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -std=c++17 -Wall -Werror=return-type -Wno-reorder -fdiagnostics-color=auto")
+ 
+ add_executable(test_iitii util.h test_iitii.cc)
+-add_dependencies(test_iitii catch libhts)
++#add_dependencies(test_iitii catch libhts)
+ target_link_libraries(test_iitii libhts libz.a libbz2.a liblzma.a)
+ 
+ add_executable(dumb_benchmark util.h dumb_benchmark.cc)
+-add_dependencies(dumb_benchmark libhts)
++#add_dependencies(dumb_benchmark libhts)
+ target_link_libraries(dumb_benchmark libhts libz.a libbz2.a liblzma.a)
+ 
+ add_executable(gnomad_benchmark util.h gnomad_benchmark.cc)
+-add_dependencies(gnomad_benchmark libhts)
++# add_dependencies(gnomad_benchmark libhts)
+ target_link_libraries(gnomad_benchmark libhts libz.a libbz2.a liblzma.a)
+ 
+ include(CTest)


=====================================
debian/rules
=====================================
@@ -13,8 +13,8 @@ CMAKE_EXTRA_FLAGS += -DDEBIAN_BUILD=1
 %:
 	dh $@
 
-### When overriding auto_test make sure DEB_BUILD_OPTIONS will be respected
-#override_dh_auto_test:
-#ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
-#	do_stuff_for_testing
-#endif
+override_dh_auto_test:
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+	cp $(CURDIR)/debian/missing-sources/htslib/* test
+	cd test && cmake . && make
+endif



View it on GitLab: https://salsa.debian.org/med-team/iitii/-/commit/544fee73310d478b6b1226a0f8783f6fed3a3f37

-- 
View it on GitLab: https://salsa.debian.org/med-team/iitii/-/commit/544fee73310d478b6b1226a0f8783f6fed3a3f37
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20200608/4e2736d2/attachment-0001.html>


More information about the debian-med-commit mailing list