diff options
Diffstat (limited to 'vcpkg/ports/htslib')
| -rw-r--r-- | vcpkg/ports/htslib/0001-set-linkage.patch | 29 | ||||
| -rw-r--r-- | vcpkg/ports/htslib/0002-pthread-flag.patch | 78 | ||||
| -rw-r--r-- | vcpkg/ports/htslib/0003-no-tests.patch | 13 | ||||
| -rw-r--r-- | vcpkg/ports/htslib/0004-fix-find-htscodecs.patch | 22 | ||||
| -rw-r--r-- | vcpkg/ports/htslib/bzip2-use-pkgconfig.diff | 31 | ||||
| -rw-r--r-- | vcpkg/ports/htslib/portfile.cmake | 54 | ||||
| -rw-r--r-- | vcpkg/ports/htslib/vcpkg.json | 32 |
7 files changed, 259 insertions, 0 deletions
diff --git a/vcpkg/ports/htslib/0001-set-linkage.patch b/vcpkg/ports/htslib/0001-set-linkage.patch new file mode 100644 index 0000000..066b145 --- /dev/null +++ b/vcpkg/ports/htslib/0001-set-linkage.patch @@ -0,0 +1,29 @@ +diff --git a/Makefile b/Makefile +index 0bbb078..e98f287 100644 +--- a/Makefile ++++ b/Makefile +@@ -958,11 +958,10 @@ $(srcprefix)htslib.map: libhts.so + rm -f $@.tmp ; \ + fi + +-install: libhts.a $(BUILT_PROGRAMS) $(BUILT_PLUGINS) $(REF_CACHE_PROGRAMS) installdirs install-$(SHLIB_FLAVOUR) install-pkgconfig ++install: $(BUILT_PROGRAMS) $(BUILT_PLUGINS) installdirs install-pkgconfig + $(INSTALL_PROGRAM) $(BUILT_PROGRAMS) $(REF_CACHE_PROGRAMS) $(DESTDIR)$(bindir) + if test -n "$(BUILT_PLUGINS)"; then $(INSTALL_PROGRAM) $(BUILT_PLUGINS) $(DESTDIR)$(plugindir); fi + $(INSTALL_DATA) $(SRC)htslib/*.h $(DESTDIR)$(includedir)/htslib +- $(INSTALL_DATA) libhts.a $(DESTDIR)$(libdir)/libhts.a + $(INSTALL_MAN) $(SRC)annot-tsv.1 $(SRC)bgzip.1 $(SRC)htsfile.1 $(SRC)tabix.1 $(DESTDIR)$(man1dir) + if test "x$(REF_CACHE_PROGRAMS)" != "x" ; then \ + $(INSTALL_MAN) $(SRC)ref_cache/ref-cache.1 $(DESTDIR)$(man1dir) ; \ +@@ -970,6 +969,11 @@ install: libhts.a $(BUILT_PROGRAMS) $(BUILT_PLUGINS) $(REF_CACHE_PROGRAMS) insta + $(INSTALL_MAN) $(SRC)faidx.5 $(SRC)sam.5 $(SRC)vcf.5 $(DESTDIR)$(man5dir) + $(INSTALL_MAN) $(SRC)htslib-s3-plugin.7 $(DESTDIR)$(man7dir) + ++install-static: install ++ $(INSTALL_DATA) libhts.a $(DESTDIR)$(libdir)/libhts.a ++ ++install-dynamic: install install-$(SHLIB_FLAVOUR) ++ + installdirs: + $(INSTALL_DIR) $(DESTDIR)$(bindir) $(DESTDIR)$(includedir) $(DESTDIR)$(includedir)/htslib $(DESTDIR)$(libdir) $(DESTDIR)$(man1dir) $(DESTDIR)$(man5dir) $(DESTDIR)$(man7dir) $(DESTDIR)$(pkgconfigdir) + if test -n "$(plugindir)"; then $(INSTALL_DIR) $(DESTDIR)$(plugindir); fi diff --git a/vcpkg/ports/htslib/0002-pthread-flag.patch b/vcpkg/ports/htslib/0002-pthread-flag.patch new file mode 100644 index 0000000..d94dd0a --- /dev/null +++ b/vcpkg/ports/htslib/0002-pthread-flag.patch @@ -0,0 +1,78 @@ +diff --git a/Makefile b/Makefile +index e98f287..ab3fdc1 100644 +--- a/Makefile ++++ b/Makefile +@@ -145,6 +145,8 @@ HTS_BUILD_AVX2 = + HTS_BUILD_AVX512 = + HTS_BUILD_SSE4 = + ++PTHREAD = -pthread ++ + include htslib_vars.mk + include htscodecs.mk + +@@ -191,10 +193,10 @@ config_vars.h: + .SUFFIXES: .bundle .c .cygdll .dll .o .pico .so + + .c.o: +- $(CC) $(CFLAGS) $(TARGET_CFLAGS) $(ALL_CPPFLAGS) -c -o $@ $< ++ $(CC) $(CFLAGS) $(TARGET_CFLAGS) $(ALL_CPPFLAGS) $(PTHREAD) -c -o $@ $< + + .c.pico: +- $(CC) $(CFLAGS) $(TARGET_CFLAGS) $(ALL_CPPFLAGS) $(EXTRA_CFLAGS_PIC) -c -o $@ $< ++ $(CC) $(CFLAGS) $(TARGET_CFLAGS) $(ALL_CPPFLAGS) $(PTHREAD) $(EXTRA_CFLAGS_PIC) -c -o $@ $< + + ref_cache/%.o: ref_cache/%.c + $(CC) $(CFLAGS) $(REF_CACHE_EXTRA_C_FLAGS) $(TARGET_CFLAGS) $(ALL_CPPFLAGS) -c -o $@ $< +@@ -409,7 +411,7 @@ print-config: + # file used at runtime (when $LD_LIBRARY_PATH includes the build directory). + + libhts.so: $(LIBHTS_OBJS:.o=.pico) +- $(CC) -shared -Wl,-soname,libhts.so.$(LIBHTS_SOVERSION) $(VERSION_SCRIPT_LDFLAGS) $(LDFLAGS) -o $@ $(LIBHTS_OBJS:.o=.pico) $(LIBS) -lpthread ++ $(CC) -shared -Wl,-soname,libhts.so.$(LIBHTS_SOVERSION) $(VERSION_SCRIPT_LDFLAGS) $(LDFLAGS) -o $@ $(LIBHTS_OBJS:.o=.pico) $(LIBS) $(PTHREAD) + ln -sf $@ libhts.so.$(LIBHTS_SOVERSION) + + # Similarly this also creates libhts.NN.dylib as a byproduct, so that programs +@@ -421,10 +423,10 @@ libhts.dylib: $(LIBHTS_OBJS) + ln -sf $@ libhts.$(LIBHTS_SOVERSION).dylib + + cyghts-$(LIBHTS_SOVERSION).dll libhts.dll.a: $(LIBHTS_OBJS) +- $(CC) -shared -Wl,--out-implib=libhts.dll.a -Wl,--enable-auto-import $(LDFLAGS) -o $@ -Wl,--whole-archive $(LIBHTS_OBJS) -Wl,--no-whole-archive $(LIBS) -lpthread ++ $(CC) -shared -Wl,--out-implib=libhts.dll.a -Wl,--enable-auto-import $(LDFLAGS) -o $@ -Wl,--whole-archive $(LIBHTS_OBJS) -Wl,--no-whole-archive $(LIBS) $(PTHREAD) + + hts-$(LIBHTS_SOVERSION).dll hts.dll.a: $(LIBHTS_OBJS) +- $(CC) -shared -Wl,--out-implib=hts.dll.a -Wl,--enable-auto-import -Wl,--exclude-all-symbols $(LDFLAGS) -o $@ -Wl,--whole-archive $(LIBHTS_OBJS) -Wl,--no-whole-archive $(LIBS) -lpthread ++ $(CC) -shared -Wl,--out-implib=hts.dll.a -Wl,--enable-auto-import -Wl,--exclude-all-symbols $(LDFLAGS) -o $@ -Wl,--whole-archive $(LIBHTS_OBJS) -Wl,--no-whole-archive $(LIBS) $(PTHREAD) + + hts-$(LIBHTS_SOVERSION).def: hts-$(LIBHTS_SOVERSION).dll + gendef hts-$(LIBHTS_SOVERSION).dll +@@ -471,7 +473,7 @@ hts-object-files: $(LIBHTS_OBJS) + # may not be able to access libhts symbols via the main program's libhts + # if that was dynamically loaded without an explicit RTLD_GLOBAL. + %.so: %.pico libhts.so +- $(CC) -shared -Wl,-E $(LDFLAGS) -o $@ $< libhts.so $(LIBS) -lpthread ++ $(CC) -shared -Wl,-E $(LDFLAGS) -o $@ $< libhts.so $(LIBS) $(PTHREAD) + + # For programs *statically* linked to libhts.a, on macOS loading a plugin + # linked to a shared libhts.NN.dylib would lead to conflicting duplicate +@@ -553,16 +555,16 @@ htscodecs/htscodecs/rANS_static32x16pr_avx512.o htscodecs/htscodecs/rANS_static3 + htscodecs/htscodecs/rANS_static32x16pr_sse4.o htscodecs/htscodecs/rANS_static32x16pr_sse4.pico: TARGET_CFLAGS = $(HTS_CFLAGS_SSE4) + + annot-tsv: annot-tsv.o libhts.a +- $(CC) $(LDFLAGS) -o $@ annot-tsv.o libhts.a $(LIBS) -lpthread ++ $(CC) $(LDFLAGS) -o $@ annot-tsv.o libhts.a $(LIBS) $(PTHREAD) + + bgzip: bgzip.o libhts.a +- $(CC) $(LDFLAGS) -o $@ bgzip.o libhts.a $(LIBS) -lpthread ++ $(CC) $(LDFLAGS) -o $@ bgzip.o libhts.a $(LIBS) $(PTHREAD) + + htsfile: htsfile.o libhts.a +- $(CC) $(LDFLAGS) -o $@ htsfile.o libhts.a $(LIBS) -lpthread ++ $(CC) $(LDFLAGS) -o $@ htsfile.o libhts.a $(LIBS) $(PTHREAD) + + tabix: tabix.o libhts.a +- $(CC) $(LDFLAGS) -o $@ tabix.o libhts.a $(LIBS) -lpthread ++ $(CC) $(LDFLAGS) -o $@ tabix.o libhts.a $(LIBS) $(PTHREAD) + + ref_cache/ref-cache: $(REF_CACHE_OBJS) + $(CC) $(LDFLAGS) $(REF_CACHE_EXTRA_LD_FLAGS) -o $@ $(REF_CACHE_OBJS) -lcurl diff --git a/vcpkg/ports/htslib/0003-no-tests.patch b/vcpkg/ports/htslib/0003-no-tests.patch new file mode 100644 index 0000000..1e8e49d --- /dev/null +++ b/vcpkg/ports/htslib/0003-no-tests.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile b/Makefile +index fb4f527..751df4b 100644 +--- a/Makefile ++++ b/Makefile +@@ -111,7 +111,7 @@ BUILT_THRASH_PROGRAMS = \ + test/thrash_threads6 \ + test/thrash_threads7 + + all: lib-static lib-shared $(BUILT_PROGRAMS) plugins \ +- $(BUILT_TEST_PROGRAMS) htslib_static.mk htslib-uninstalled.pc ++ htslib_static.mk htslib-uninstalled.pc + + # Report compiler and version diff --git a/vcpkg/ports/htslib/0004-fix-find-htscodecs.patch b/vcpkg/ports/htslib/0004-fix-find-htscodecs.patch new file mode 100644 index 0000000..4fc6e2d --- /dev/null +++ b/vcpkg/ports/htslib/0004-fix-find-htscodecs.patch @@ -0,0 +1,22 @@ +diff --git a/configure.ac b/configure.ac +index 49f2cbc..434086f 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -156,7 +156,7 @@ m4_ifdef([PKG_PROG_PKG_CONFIG], [PKG_PROG_PKG_CONFIG], [PKG_CONFIG=""]) + need_crypto=no + pc_requires= + static_LDFLAGS=$LDFLAGS +-static_LIBS='-lpthread -lz -lm' ++static_LIBS='-pthread -lz -lm' + private_LIBS=$LDFLAGS + + AC_ARG_ENABLE([versioned-symbols], +@@ -404,7 +404,7 @@ AS_IF([test "x$with_external_htscodecs" != "xno"], + AC_CHECK_HEADER([htscodecs/rANS_static4x16.h],[], + [libhtscodecs='missing header'],[;]) + AC_CHECK_LIB([htscodecs],[rans_compress_bound_4x16], +- [:],[libhtscodecs='missing library']) ++ [:],[libhtscodecs='missing library'], ["$static_LIBS"]) + AS_IF([test "$libhtscodecs" = "ok"], + [AC_DEFINE([HAVE_EXTERNAL_LIBHTSCODECS], 1, [Define if using an external libhtscodecs]) + LIBS="-lhtscodecs $LIBS" diff --git a/vcpkg/ports/htslib/bzip2-use-pkgconfig.diff b/vcpkg/ports/htslib/bzip2-use-pkgconfig.diff new file mode 100644 index 0000000..34d7bc8 --- /dev/null +++ b/vcpkg/ports/htslib/bzip2-use-pkgconfig.diff @@ -0,0 +1,31 @@ +diff --git a/configure.ac b/configure.ac +index 593a664..5fcca0d 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -412,8 +412,11 @@ fi], + + if test "$enable_bz2" != no; then + bz2_devel=ok +- AC_CHECK_HEADER([bzlib.h], [], [bz2_devel=missing], [;]) +- AC_CHECK_LIB([bz2], [BZ2_bzBuffToBuffCompress], [], [bz2_devel=missing]) ++ PKG_CHECK_MODULES([BZ2_PKG], [bzip2], [ ++ AC_DEFINE([HAVE_LIBBZ2], 1, [Define if libbzip2 is available.]) ++ LIBS="$LIBS $BZ2_PKG_LIBS" ++ CFLAGS="$CFLAGS $BZ2_PKG_CFLAGS" ++ ], [bz2_devel=missing]) + if test $bz2_devel != ok; then + MSG_ERROR([libbzip2 development files not found + +@@ -430,12 +433,7 @@ produced elsewhere unreadable) or resolve this error to build HTSlib.]) + fi + dnl Unfortunately the 'bzip2' package-cfg module is not standard. + dnl Redhat/Fedora has it; Debian/Ubuntu does not. +- if test -n "$PKG_CONFIG" && "$PKG_CONFIG" --exists bzip2; then + pc_requires="$pc_requires bzip2" +- else +- private_LIBS="$private_LIBS -lbz2" +- fi +- static_LIBS="$static_LIBS -lbz2" + fi + + if test "$enable_lzma" != no; then diff --git a/vcpkg/ports/htslib/portfile.cmake b/vcpkg/ports/htslib/portfile.cmake new file mode 100644 index 0000000..736bd3f --- /dev/null +++ b/vcpkg/ports/htslib/portfile.cmake @@ -0,0 +1,54 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO samtools/htslib + REF "${VERSION}" + SHA512 3537149d4118bf27424845a44fdfdb5ffce2376bf956ba15cd61686b84efa320c66fed76eab2fc381f344d61607f7e63494fdd6ef8cf4e40cdb3ac6fe29f86ad + HEAD_REF develop + PATCHES + 0001-set-linkage.patch + 0002-pthread-flag.patch + 0003-no-tests.patch + 0004-fix-find-htscodecs.patch + bzip2-use-pkgconfig.diff +) + +set(FEATURE_OPTIONS "") + +macro(enable_feature feature switch) + if("${feature}" IN_LIST FEATURES) + list(APPEND FEATURE_OPTIONS "--enable-${switch}") + else() + list(APPEND FEATURE_OPTIONS "--disable-${switch}") + endif() +endmacro() + +enable_feature("bzip2" "bz2") +enable_feature("lzma" "lzma") + +if("deflate" IN_LIST FEATURES) + list(APPEND FEATURE_OPTIONS "--with-libdeflate") +else() + list(APPEND FEATURE_OPTIONS "--without-libdeflate") +endif() + +vcpkg_configure_make( + AUTOCONFIG + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + --with-external-htscodecs + --disable-libcurl + --disable-gcs + --disable-s3 + --disable-plugins + ${FEATURE_OPTIONS} +) + +vcpkg_install_make( + INSTALL_TARGET install-${VCPKG_LIBRARY_LINKAGE} +) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +vcpkg_fixup_pkgconfig() + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/vcpkg/ports/htslib/vcpkg.json b/vcpkg/ports/htslib/vcpkg.json new file mode 100644 index 0000000..a958019 --- /dev/null +++ b/vcpkg/ports/htslib/vcpkg.json @@ -0,0 +1,32 @@ +{ + "name": "htslib", + "version": "1.22.1", + "description": "C library for high-throughput sequencing data formats", + "homepage": "https://github.com/samtools/htslib", + "license": "MIT", + "supports": "!windows", + "dependencies": [ + "htscodecs", + "zlib" + ], + "features": { + "bzip2": { + "description": "Enable support for BZ2-compressed CRAM files", + "dependencies": [ + "bzip2" + ] + }, + "deflate": { + "description": "Use libdeflate for faster crc and deflate algorithms", + "dependencies": [ + "libdeflate" + ] + }, + "lzma": { + "description": "Enable support for LZMA-compressed CRAM files", + "dependencies": [ + "liblzma" + ] + } + } +} |