spack/var/spack/repos/builtin/packages/bcftools/makefile_12.patch
Glenn Johnson 9f6ac938b7 Update and fix bcftools package (#14505)
* Update and fix bcftools package

This PR updates bcftools to 1.10.2 and is dependent on PR #14504.

This PR also fixes builds of other versions. Versions 1.2-1.4 did not
use autotools so when the packaeg was converted to use autotools with
version 1.6 those older versions could no longer build. Also, those
versions needed to be patched to use an external htsllib. The method of
finding the external htslib is also different for those older versions.

In addition, this PR adds two variants to bcftools:

- libgsl
- perl-filters

Finally, dependencies for perl and python are added, and an unused
dependency for libzip was removed.

* Do not use '@' in variant description

The '@' character in a variant description will cause a problem with
`spack info`.

```
==> Error: Incomplete color format: '@' in
expressions, for @1.8:
```

* Fix error with python2 processing this package
2020-01-14 22:04:47 -06:00

110 lines
6.0 KiB
Diff

--- a/Makefile 2015-02-03 10:27:19.000000000 -0600
+++ b/Makefile 2020-01-13 21:22:54.554904229 -0600
@@ -30,10 +30,11 @@
# Adjust $(HTSDIR) to point to your top-level htslib directory
HTSDIR = htslib-1.2.1
-include $(HTSDIR)/htslib.mk
-HTSLIB = $(HTSDIR)/libhts.a
-BGZIP = $(HTSDIR)/bgzip
-TABIX = $(HTSDIR)/tabix
+#include $(HTSDIR)/htslib.mk
+HTSINC = $(HTSDIR)/include
+HTSLIB = -L$(HTSDIR)/lib -lhts
+BGZIP = $(HTSDIR)/bin/bgzip
+TABIX = $(HTSDIR)/bin/tabix
CC = gcc
CFLAGS = -g -Wall -Wc++-compat -O2
@@ -44,7 +45,7 @@
vcfcall.o mcall.o vcmp.o gvcf.o reheader.o convert.o vcfconvert.o tsv2vcf.o \
vcfcnv.o HMM.o vcfplugin.o consensus.o ploidy.o version.o \
ccall.o em.o prob1.o kmin.o # the original samtools calling
-INCLUDES = -I. -I$(HTSDIR)
+INCLUDES = -I. -I$(HTSINC)
# The polysomy command is not compiled by default because it brings dependency
# on libgsl. The command can be compiled wth `make USE_GPL=1`. See the INSTALL
@@ -52,7 +53,7 @@
ifdef USE_GPL
CFLAGS += -DUSE_GPL
OBJS += polysomy.o
- LDLIBS = -lgsl -lcblas
+ LDLIBS = -lgsl -lgslcblas
endif
prefix = /usr/local
@@ -102,8 +103,8 @@
PLUGINS = $(PLUGINC:.c=.so)
PLUGINM = $(PLUGINC:.c=.mk)
-%.so: %.c version.h version.c $(HTSDIR)/libhts.so
- $(CC) $(CFLAGS) $(INCLUDES) -fPIC -shared -o $@ version.c $< -L$(HTSDIR) -lhts
+%.so: %.c version.h version.c
+ $(CC) $(CFLAGS) $(INCLUDES) -fPIC -shared -o $@ version.c $< $(HTSLIB)
-include $(PLUGINM)
@@ -116,20 +117,20 @@
tsv2vcf_h = tsv2vcf.h $(htslib_vcf_h)
filter_h = filter.h $(htslib_vcf_h)
prob1_h = prob1.h $(htslib_vcf_h) $(call_h)
-roh_h = HMM.h $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(HTSDIR)/htslib/kstring.h $(HTSDIR)/htslib/kseq.h $(bcftools_h)
+roh_h = HMM.h $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(HTSINC)/htslib/kstring.h $(HTSINC)/htslib/kseq.h $(bcftools_h)
cnv_h = HMM.h $(htslib_vcf_h) $(htslib_synced_bcf_reader_h)
main.o: main.c $(htslib_hts_h) version.h $(bcftools_h)
-vcfannotate.o: vcfannotate.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(HTSDIR)/htslib/kseq.h $(bcftools_h) vcmp.h $(filter_h)
-vcfplugin.o: vcfplugin.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(HTSDIR)/htslib/kseq.h $(bcftools_h) vcmp.h $(filter_h)
-vcfcall.o: vcfcall.c $(htslib_vcf_h) $(HTSDIR)/htslib/kfunc.h $(htslib_synced_bcf_reader_h) $(bcftools_h) $(call_h) $(prob1_h)
-vcfconcat.o: vcfconcat.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(HTSDIR)/htslib/kseq.h $(bcftools_h)
+vcfannotate.o: vcfannotate.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(HTSINC)/htslib/kseq.h $(bcftools_h) vcmp.h $(filter_h)
+vcfplugin.o: vcfplugin.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(HTSINC)/htslib/kseq.h $(bcftools_h) vcmp.h $(filter_h)
+vcfcall.o: vcfcall.c $(htslib_vcf_h) $(HTSINC)/htslib/kfunc.h $(htslib_synced_bcf_reader_h) $(bcftools_h) $(call_h) $(prob1_h)
+vcfconcat.o: vcfconcat.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(HTSINC)/htslib/kseq.h $(bcftools_h)
vcfconvert.o: vcfconvert.c $(htslib_vcf_h) $(htslib_bgzf_h) $(htslib_synced_bcf_reader_h) $(htslib_vcfutils_h) $(bcftools_h) $(filter_h) $(convert_h) $(tsv2vcf_h)
vcffilter.o: vcffilter.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(htslib_vcfutils_h) $(bcftools_h) $(filter_h) rbuf.h
vcfgtcheck.o: vcfgtcheck.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(htslib_vcfutils_h) $(bcftools_h)
vcfindex.o: vcfindex.c $(htslib_vcf_h) $(htslib_tbx_h)
vcfisec.o: vcfisec.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(htslib_vcfutils_h) $(bcftools_h) $(filter_h)
-vcfmerge.o: vcfmerge.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(htslib_vcfutils_h) $(bcftools_h) vcmp.h $(HTSDIR)/htslib/khash.h
+vcfmerge.o: vcfmerge.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(htslib_vcfutils_h) $(bcftools_h) vcmp.h $(HTSINC)/htslib/khash.h
vcfnorm.o: vcfnorm.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(htslib_faidx_h) $(bcftools_h) rbuf.h
vcfquery.o: vcfquery.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(htslib_vcfutils_h) $(bcftools_h) $(filter_h) $(convert_h)
vcfroh.o: vcfroh.c $(roh_h)
@@ -137,20 +138,20 @@
vcfsom.o: vcfsom.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(htslib_vcfutils_h) $(bcftools_h)
vcfstats.o: vcfstats.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(htslib_vcfutils_h) $(htslib_faidx_h) $(bcftools_h)
vcfview.o: vcfview.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(htslib_vcfutils_h) $(bcftools_h) $(filter_h)
-reheader.o: reheader.c $(htslib_vcf_h) $(htslib_bgzf_h) $(HTSDIR)/htslib/kseq.h $(bcftools_h)
+reheader.o: reheader.c $(htslib_vcf_h) $(htslib_bgzf_h) $(HTSINC)/htslib/kseq.h $(bcftools_h)
tabix.o: tabix.c $(htslib_bgzf_h) $(htslib_tbx_h)
-ccall.o: ccall.c $(HTSDIR)/htslib/kfunc.h $(call_h) kmin.h $(prob1_h)
+ccall.o: ccall.c $(HTSINC)/htslib/kfunc.h $(call_h) kmin.h $(prob1_h)
convert.o: convert.c $(htslib_vcf_h) $(htslib_synced_bcf_reader_h) $(htslib_vcfutils_h) $(bcftools_h) $(convert_h)
tsv2vcf.o: tsv2vcf.c $(tsv2vcf_h)
em.o: em.c $(htslib_vcf_h) kmin.h $(call_h)
-filter.o: filter.c $(HTSDIR)/htslib/khash_str2int.h $(filter_h) $(bcftools_h) $(htslib_hts_defs_h) $(htslib_vcfutils_h)
+filter.o: filter.c $(HTSINC)/htslib/khash_str2int.h $(filter_h) $(bcftools_h) $(htslib_hts_defs_h) $(htslib_vcfutils_h)
gvcf.o: gvcf.c $(call_h)
kmin.o: kmin.c kmin.h
-mcall.o: mcall.c $(HTSDIR)/htslib/kfunc.h $(call_h)
+mcall.o: mcall.c $(HTSINC)/htslib/kfunc.h $(call_h)
prob1.o: prob1.c $(prob1_h)
vcmp.o: vcmp.c $(htslib_hts_h) vcmp.h
polysomy.o: polysomy.c $(htslib_hts_h)
-consensus.o: consensus.c $(htslib_hts_h) $(HTSDIR)/htslib/kseq.h rbuf.h $(bcftools_h) $(HTSDIR)/htslib/regidx.h
+consensus.o: consensus.c $(htslib_hts_h) $(HTSINC)/htslib/kseq.h rbuf.h $(bcftools_h) $(HTSINC)/htslib/regidx.h
version.o: version.h version.c
test/test-rbuf.o: test/test-rbuf.c rbuf.h
@@ -158,7 +159,7 @@
test/test-rbuf: test/test-rbuf.o
$(CC) $(CFLAGS) -o $@ -lm -ldl $<
-bcftools: $(HTSLIB) $(OBJS)
+bcftools: $(OBJS)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(HTSLIB) -lpthread -lz -lm -ldl $(LDLIBS)
doc/bcftools.1: doc/bcftools.txt