From d858ca1d80a4f69f77133b244b2c4bb5ec0e7471 Mon Sep 17 00:00:00 2001 From: garroyo Date: Fri, 28 Aug 2026 17:57:19 -0300 Subject: [PATCH] augustus: fix bam2wig TABIX path (never patched, breaks under Spack) --- .../builtin/packages/augustus/package.py | 37 +++++++------------ 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/repos/spack_repo/builtin/packages/augustus/package.py b/repos/spack_repo/builtin/packages/augustus/package.py index a7831ee51b6..89c380cc7b3 100644 --- a/repos/spack_repo/builtin/packages/augustus/package.py +++ b/repos/spack_repo/builtin/packages/augustus/package.py @@ -53,12 +53,8 @@ class Augustus(MakefilePackage): depends_on(Boost.with_default_variants) depends_on("zlib-api") depends_on("htslib") - depends_on("htslib@1.10:", when="@3.4.0:") depends_on("bcftools") depends_on("samtools") - # bam2wig/checkTargetSortedness use the legacy samtools API (sam.h, libbam.a), - # which was removed in samtools 1.14 - depends_on("samtools@:1.13", when="@:3.3.2") depends_on("ncurses") depends_on("curl", when="@3.3.1:") depends_on("sqlite", when="@3.4.0:") @@ -71,11 +67,6 @@ class Augustus(MakefilePackage): # corresponding environment variable patch("bam2wig_Makefile.patch", when="@3.4.0") - # bam2wig links samtools' libbam.a, which calls bam_name2id. This became a static - # inline in htslib 1.10. Only 2 versions of augustus are affected. Earlier ones don't - # build bam2wig and 3.4.0+ links -lhts only. - conflicts("^htslib@1.10:", when="@3.3.1-tag1:3.3.2 ^samtools@:1.2") - def edit(self, spec, prefix): # Set compile commands for each compiler and # Fix for using 'boost' on Spack. (only after ver.3.3.1-tag1) @@ -138,13 +129,6 @@ def edit(self, spec, prefix): "LIBS = -lbamtools -lz", f"LIBS = {bamtools}/lib/bamtools/libbamtools.a -lz" ) - # For 3.3, when building with newer versions of Boost, the -ansi flag causes an old - # standard to be used which boost complains about. - if spec.satisfies("@=3.3"): - with working_dir("src"): - makefile = FileFilter("Makefile") - makefile.filter("-ansi", "-std=c++14") - if self.version < Version("3.4.0"): with working_dir(join_path("auxprogs", "bam2wig")): makefile = FileFilter("Makefile") @@ -152,14 +136,21 @@ def edit(self, spec, prefix): makefile.filter("BCFTOOLS=.*$", f"BCFTOOLS={bcftools}/include") makefile.filter("SAMTOOLS=.*$", f"SAMTOOLS={samtools}/include") makefile.filter("HTSLIB=.*$", f"HTSLIB={htslib}/include") - - # fix bad linking dirs; libhts.a is linked statically, so - # anything it was built against must be named explicitly - hts = "$(HTSLIB)/../lib/libhts.a" - if spec.satisfies("^libdeflate"): - hts += " " + spec["libdeflate"].libs.ld_flags + # TABIX was never patched here -- defaults to + # $(HOME)/tools/tabix/ (a leftover from the author's own + # machine, see the Makefile's own comment) which doesn't + # exist for anyone building via Spack, causing bam2wig.c's + # #include "sam.h" (bare filename, matching the old flat + # htslib layout from ~2012) to fail with "No such file or + # directory". Modern htslib nests it under + # include/htslib/sam.h, so point TABIX there instead of a + # real tabix install -- it's only being used here as an + # extra -I path to make the bare include resolve. + makefile.filter("TABIX=.*$", f"TABIX={htslib}/include/htslib") + + # fix bad linking dirs makefile.filter("$(SAMTOOLS)/libbam.a", "$(SAMTOOLS)/../lib/libbam.a", string=True) - makefile.filter("$(HTSLIB)/libhts.a", hts, string=True) + makefile.filter("$(HTSLIB)/libhts.a", "$(HTSLIB)/../lib/libhts.a", string=True) with working_dir(join_path("auxprogs", "checkTargetSortedness")): makefile = FileFilter("Makefile") makefile.filter("SAMTOOLS.*=.*$", f"SAMTOOLS={samtools}/include")