diff --git a/ports/htscodecs/0001-no-tests.patch b/ports/htscodecs/0001-no-tests.patch new file mode 100644 index 00000000000000..e18dd508ae15c6 --- /dev/null +++ b/ports/htscodecs/0001-no-tests.patch @@ -0,0 +1,13 @@ +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 873ad3e..0ab3638 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -31,7 +31,7 @@ + # + + # Standalone test programs +-noinst_PROGRAMS = rans4x16pr tokenise_name3 arith_dynamic rans4x8 rans4x16pr fqzcomp_qual varint entropy ++check_PROGRAMS = rans4x16pr tokenise_name3 arith_dynamic rans4x8 rans4x16pr fqzcomp_qual varint entropy + + LDADD = $(top_builddir)/htscodecs/libhtscodecs.la + AM_CPPFLAGS = -I$(top_srcdir) diff --git a/ports/htscodecs/portfile.cmake b/ports/htscodecs/portfile.cmake new file mode 100644 index 00000000000000..bb7cb4e83427b9 --- /dev/null +++ b/ports/htscodecs/portfile.cmake @@ -0,0 +1,36 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO samtools/htscodecs + REF "v${VERSION}" + SHA512 7533570b8b1cad0b9ed118170e5a9ff34fdde40b090f4ba3756f7899e2cd7230f8172425ecf6bd7b83b0b0b1a2a24f3d21795db7f0bc2c3add0a55342b970d1a + HEAD_REF master + PATCHES + 0001-no-tests.patch # https://github.com/samtools/htscodecs/pull/120 +) + +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") + +vcpkg_configure_make( + AUTOCONFIG + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${FEATURE_OPTIONS} +) + +vcpkg_install_make() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +vcpkg_fixup_pkgconfig() + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md") diff --git a/ports/htscodecs/vcpkg.json b/ports/htscodecs/vcpkg.json new file mode 100644 index 00000000000000..3493a21ac81d29 --- /dev/null +++ b/ports/htscodecs/vcpkg.json @@ -0,0 +1,16 @@ +{ + "name": "htscodecs", + "version": "1.6.0", + "description": "Custom compression for CRAM and others.", + "homepage": "https://github.com/samtools/htscodecs", + "license": "MIT", + "supports": "!windows", + "features": { + "bzip2": { + "description": "Enable support for BZ2 within Arith streams", + "dependencies": [ + "bzip2" + ] + } + } +} diff --git a/ports/htslib/0001-set-linkage.patch b/ports/htslib/0001-set-linkage.patch new file mode 100644 index 00000000000000..d28886a806aece --- /dev/null +++ b/ports/htslib/0001-set-linkage.patch @@ -0,0 +1,26 @@ +diff --git a/Makefile b/Makefile +index 99142c8..97cd369 100644 +--- a/Makefile ++++ b/Makefile +@@ -857,15 +857,19 @@ $(srcprefix)htslib.map: libhts.so + rm -f $@.tmp ; \ + fi + +-install: libhts.a $(BUILT_PROGRAMS) $(BUILT_PLUGINS) installdirs install-$(SHLIB_FLAVOUR) install-pkgconfig ++install: $(BUILT_PROGRAMS) $(BUILT_PLUGINS) installdirs install-pkgconfig + $(INSTALL_PROGRAM) $(BUILT_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) + $(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/ports/htslib/0002-pthread-flag.patch b/ports/htslib/0002-pthread-flag.patch new file mode 100644 index 00000000000000..7318c8984fdbc3 --- /dev/null +++ b/ports/htslib/0002-pthread-flag.patch @@ -0,0 +1,78 @@ +diff --git a/Makefile b/Makefile +index f6e154f..fb4f527 100644 +--- a/Makefile ++++ b/Makefile +@@ -137,6 +137,8 @@ HTS_BUILD_AVX2 = + HTS_BUILD_AVX512 = + HTS_BUILD_SSE4 = + ++PTHREAD = -pthread ++ + include htslib_vars.mk + include htscodecs.mk + +@@ -183,10 +185,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 $@ $< + + + LIBHTS_OBJS = \ +@@ -358,7 +360,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 +@@ -370,10 +372,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 +@@ -420,7 +422,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 +@@ -501,16 +503,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) + + annot-tsv.o: annot-tsv.c config.h $(htslib_hts_h) $(htslib_hts_defs_h) $(htslib_khash_str2int_h) $(htslib_kstring_h) $(htslib_kseq_h) $(htslib_bgzf_h) $(htslib_regidx_h) + bgzip.o: bgzip.c config.h $(htslib_bgzf_h) $(htslib_hts_h) $(htslib_hfile_h) diff --git a/ports/htslib/0003-no-tests.patch b/ports/htslib/0003-no-tests.patch new file mode 100644 index 00000000000000..9c4a9f9937894a --- /dev/null +++ b/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) \ ++all: lib-static lib-shared $(BUILT_PROGRAMS) plugins \ + htslib_static.mk htslib-uninstalled.pc + + ALL_CPPFLAGS = -I. $(CPPFLAGS) diff --git a/ports/htslib/0004-fix-find-htscodecs.patch b/ports/htslib/0004-fix-find-htscodecs.patch new file mode 100644 index 00000000000000..4fc6e2d7a59173 --- /dev/null +++ b/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/ports/htslib/portfile.cmake b/ports/htslib/portfile.cmake new file mode 100644 index 00000000000000..84969d2ef01ff7 --- /dev/null +++ b/ports/htslib/portfile.cmake @@ -0,0 +1,53 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO samtools/htslib + REF "${VERSION}" + SHA512 b9de3769db6153f66348c7c4ffbfc5ac7cd4a4d4450c9d1c5ea8fdd8f4f9d38d1d0ba5b4ac9c53f1a754d3985dc483fe22e76f93a8bbe8ae29ef3b98136e7d2e + HEAD_REF develop + PATCHES + 0001-set-linkage.patch + 0002-pthread-flag.patch + 0003-no-tests.patch + 0004-fix-find-htscodecs.patch +) + +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/ports/htslib/vcpkg.json b/ports/htslib/vcpkg.json new file mode 100644 index 00000000000000..c271cbe1760e7f --- /dev/null +++ b/ports/htslib/vcpkg.json @@ -0,0 +1,32 @@ +{ + "name": "htslib", + "version": "1.20", + "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" + ] + } + } +} diff --git a/versions/baseline.json b/versions/baseline.json index be9186476dbf5b..73d71be271a31b 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3468,6 +3468,14 @@ "baseline": "1.10.0", "port-version": 1 }, + "htscodecs": { + "baseline": "1.6.0", + "port-version": 0 + }, + "htslib": { + "baseline": "1.20", + "port-version": 0 + }, "http-parser": { "baseline": "2.9.4", "port-version": 3 diff --git a/versions/h-/htscodecs.json b/versions/h-/htscodecs.json new file mode 100644 index 00000000000000..cb26d564a08ee8 --- /dev/null +++ b/versions/h-/htscodecs.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "9475b0327f2fedd60e7c2d71351fed598c9ba3f9", + "version": "1.6.0", + "port-version": 0 + } + ] +} diff --git a/versions/h-/htslib.json b/versions/h-/htslib.json new file mode 100644 index 00000000000000..99735b716a4163 --- /dev/null +++ b/versions/h-/htslib.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "94372bcc6471960499da89e7ca144bb90b43a235", + "version": "1.20", + "port-version": 0 + } + ] +}