From: "Michael R. Crusoe" <crusoe@debian.org>
Date: Fri, 6 Sep 2019 14:16:07 +0900
Subject: Attempt to use the Debian version of vcflib

Forwarded: not-needed
---
 Makefile                 | 39 +--------------------------------------
 src/aligner.hpp          |  2 +-
 src/clip.cpp             |  2 +-
 src/constructor.cpp      |  2 +-
 src/constructor.hpp      |  2 +-
 src/deconstructor.hpp    |  2 +-
 src/readfilter.hpp       |  2 +-
 src/utility.hpp          |  2 +-
 src/vcf_buffer.hpp       |  2 +-
 src/vg.hpp               |  2 +-
 test/Makefile            | 10 +---------
 test/t/02_vg_construct.t |  2 +-
 12 files changed, 12 insertions(+), 57 deletions(-)

diff --git a/Makefile b/Makefile
index 848d221..38f82c8 100644
--- a/Makefile
+++ b/Makefile
@@ -334,7 +334,6 @@ GBWT_DIR:=deps/gbwt
 GBWTGRAPH_DIR=deps/gbwtgraph
 KFF_DIR=deps/kff-cpp-api
 PROGRESS_BAR_DIR:=deps/progress_bar
-VCFLIB_DIR:=deps/vcflib
 TABIXPP_DIR:=deps/tabixpp
 HTSLIB_DIR:=deps/htslib
 GSSW_DIR:=deps/gssw
@@ -375,7 +374,6 @@ LIB_DEPS += $(LIB_DIR)/libgbwtgraph.a
 LIB_DEPS += $(LIB_DIR)/libkff.a
 LIB_DEPS += $(LIB_DIR)/libhts.a
 LIB_DEPS += $(LIB_DIR)/libtabixpp.a
-LIB_DEPS += $(LIB_DIR)/libvcflib.a
 LIB_DEPS += $(LIB_DIR)/libgssw.a
 LIB_DEPS += $(LIB_DIR)/libsonlib.a
 LIB_DEPS += $(LIB_DIR)/libpinchesandcacti.a
@@ -620,37 +618,6 @@ $(LIB_DIR)/libhts%a $(LIB_DIR)/pkgconfig/htslib%pc: $(HTSLIB_DIR)/*.c $(HTSLIB_D
 	+. ./source_me.sh && cd $(HTSLIB_DIR) && (./configure -n 2>&1 || true) | grep "build system type" | rev | cut -f1 -d' ' | rev >systype.txt
 	+. ./source_me.sh && cd $(HTSLIB_DIR) && CFLAGS="-I$(CWD)/$(HTSLIB_DIR) -isystem $(CWD)/$(HTSLIB_DIR) -I$(CWD)/$(INC_DIR) $(CFLAGS)" LDFLAGS="$(LDFLAGS) -L$(CWD)/$(LIB_DIR) $(LD_UTIL_RPATH_FLAGS)" ./configure --with-libdeflate --disable-s3 --disable-gcs --disable-libcurl --disable-plugins --prefix=$(CWD) --host=$$(cat systype.txt) $(FILTER) && $(MAKE) clean && $(MAKE) $(FILTER) && $(MAKE) install
 
-# Build and install tabixpp for vcflib.
-$(LIB_DIR)/libtabixpp.a: $(LIB_DIR)/libhts.a $(TABIXPP_DIR)/*.cpp $(TABIXPP_DIR)/*.hpp
-	+. ./source_me.sh && cd $(TABIXPP_DIR) && rm -f tabix.o libtabixpp.a && INCLUDES="-I$(CWD)/$(INC_DIR)" HTS_HEADERS="" $(MAKE) tabix.o $(FILTER) && ar rcs libtabixpp.a tabix.o
-	+cp $(TABIXPP_DIR)/libtabixpp.a $(LIB_DIR) && cp $(TABIXPP_DIR)/tabix.hpp $(INC_DIR)
-	+echo "Name: tabixpp" > $(LIB_DIR)/pkgconfig/tabixpp.pc
-	+echo "Description: Self-packaged tabixpp" >> $(LIB_DIR)/pkgconfig/tabixpp.pc
-	+echo "Version: 1.0" >> $(LIB_DIR)/pkgconfig/tabixpp.pc
-	+echo "Cflags: -I$(CWD)/$(INC_DIR)" >> $(LIB_DIR)/pkgconfig/tabixpp.pc
-	+echo "Libs: -L$(CWD)/$(LIB_DIR) -ltabixpp" >> $(LIB_DIR)/pkgconfig/tabixpp.pc
-
-# Build vcflib. Install the library and headers but not binaries or man pages.
-# We need to build as RelWithDebInfo to avoid vcflib using its own
-# -march=native, which would conflict with the -march that comes in through
-# CXXFLAGS from the vg Dockerfile.
-# We also need to use the magic path hint to let CMake find Mac OpenMP.
-# We need to use /usr first for CMake search or Ubuntu 22.04 will decide pybind11 is installed in / when actually it is only fully installed in /usr.
-$(LIB_DIR)/libvcflib.a: $(LIB_DIR)/libhts.a $(LIB_DIR)/libtabixpp.a $(VCFLIB_DIR)/src/*.cpp $(VCFLIB_DIR)/src/*.hpp $(VCFLIB_DIR)/contrib/*/*.cpp $(VCFLIB_DIR)/contrib/*/*.h
-	+rm -f $(VCFLIB_DIR)/contrib/WFA2-lib/VERSION
-	+. ./source_me.sh && cd $(VCFLIB_DIR) && rm -Rf build && mkdir build && cd build && PKG_CONFIG_PATH="$(CWD)/$(LIB_DIR)/pkgconfig:$(PKG_CONFIG_PATH)" cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DZIG=OFF -DCMAKE_C_FLAGS="$(CFLAGS)" -DCMAKE_CXX_FLAGS="$(CXXFLAGS) ${CPPFLAGS}" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=$(CWD) -DCMAKE_PREFIX_PATH="/usr;$(OMP_PREFIXES)" .. && cmake --build .
-	+cp $(VCFLIB_DIR)/contrib/filevercmp/*.h* $(INC_DIR)
-	+cp $(VCFLIB_DIR)/contrib/fastahack/*.h* $(INC_DIR)
-	+cp $(VCFLIB_DIR)/contrib/smithwaterman/*.h* $(INC_DIR)
-	+cp $(VCFLIB_DIR)/contrib/intervaltree/*.h* $(INC_DIR)
-	+cp $(VCFLIB_DIR)/contrib/multichoose/*.h* $(INC_DIR)
-	+cp $(VCFLIB_DIR)/src/*.h* $(INC_DIR)
-	+cp $(VCFLIB_DIR)/build/libvcflib.a $(LIB_DIR)
-
-# vcflib binaries are all automatically built. We need this one.
-$(BIN_DIR)/vcf2tsv: $(VCFLIB_DIR)/src/*.cpp $(VCFLIB_DIR)/src/*.h $(LIB_DIR)/libvcflib.a
-	+cp $(VCFLIB_DIR)/build/vcf2tsv $(BIN_DIR)
-
 $(LIB_DIR)/libgssw.a: $(GSSW_DIR)/src/gssw.c $(GSSW_DIR)/src/gssw.h
 	+. ./source_me.sh && cd $(GSSW_DIR) && $(MAKE) $(FILTER) && cp lib/libgssw.a $(CWD)/$(LIB_DIR)/ && cp src/gssw.h $(CWD)/$(INC_DIR)/
 
@@ -896,7 +863,7 @@ clean-vg:
 	$(RM) -f $(IO_SHARED_OBJ_DIR)/*.o $(IO_SHARED_OBJ_DIR)/*.d
 	$(RM) -f $(INC_DIR)/vg_git_version.hpp
 
-clean: clean-vcflib
+clean:
 	$(RM) -r $(UNITTEST_BIN_DIR)
 	$(RM) -r $(BIN_DIR)
 	$(RM) -r $(LIB_DIR)
@@ -922,7 +889,6 @@ clean: clean-vcflib
 	cd $(DEP_DIR) && cd ssw && cd src && $(MAKE) clean
 	cd $(DEP_DIR) && cd progress_bar && $(MAKE) clean
 	cd $(DEP_DIR) && cd sdsl-lite && ./uninstall.sh || true
-	cd $(DEP_DIR) && cd vcflib && $(MAKE) clean
 	cd $(DEP_DIR) && cd sha1 && $(MAKE) clean
 	cd $(DEP_DIR) && cd structures && $(MAKE) clean
 	cd $(DEP_DIR) && cd sublinear-Li-Stephens && $(MAKE) clean
@@ -931,6 +897,3 @@ clean: clean-vcflib
 	# lru_cache is never built because it is header-only
 	# bash-tap is never built either
 
-clean-vcflib:
-	cd $(DEP_DIR) && cd vcflib && $(MAKE) clean
-	cd $(INC_DIR) && rm -f BedReader.h convert.h join.h mt19937ar.h split.h Variant.h vec128int.h veclib_types.h
diff --git a/src/aligner.hpp b/src/aligner.hpp
index 04a080f..d1a396f 100644
--- a/src/aligner.hpp
+++ b/src/aligner.hpp
@@ -11,7 +11,7 @@
 #include <vg/vg.pb.h>
 
 #include "gssw.h"
-#include "Variant.h"
+#include <vcflib/Variant.h>
 #include "Fasta.h"
 #include "handle.hpp"
 #include "path.hpp"
diff --git a/src/clip.cpp b/src/clip.cpp
index 4b0934f..d023dce 100644
--- a/src/clip.cpp
+++ b/src/clip.cpp
@@ -1,7 +1,7 @@
 #include "clip.hpp"
 #include "traversal_finder.hpp"
 #include <unordered_map>
-#include <IntervalTree.h>
+#include <intervaltree/IntervalTree.h>
 #include <structures/rank_pairing_heap.hpp>
 #include <BooPHF.h>
 #include "bdsg/internal/hash_map.hpp"
diff --git a/src/constructor.cpp b/src/constructor.cpp
index 127a9a3..30d8880 100644
--- a/src/constructor.cpp
+++ b/src/constructor.cpp
@@ -8,7 +8,7 @@
 #include "crash.hpp"
 #include "io/load_proto_to_graph.hpp"
 
-#include <IntervalTree.h>
+#include <intervaltree/IntervalTree.h>
 
 #include <cstdlib>
 #include <set>
diff --git a/src/constructor.hpp b/src/constructor.hpp
index 9b682a4..4089b68 100644
--- a/src/constructor.hpp
+++ b/src/constructor.hpp
@@ -22,7 +22,7 @@
 #include <vg/vg.pb.h>
 
 // We need vcflib
-#include <Variant.h>
+#include <vcflib/Variant.h>
 // And fastahack
 #include <Fasta.h>
 
diff --git a/src/deconstructor.hpp b/src/deconstructor.hpp
index ee53749..0cfb442 100644
--- a/src/deconstructor.hpp
+++ b/src/deconstructor.hpp
@@ -7,7 +7,7 @@
 #include <algorithm>
 #include <atomic>
 #include "genotypekit.hpp"
-#include "Variant.h"
+#include <vcflib/Variant.h>
 #include "handle.hpp"
 #include "traversal_finder.hpp"
 #include "graph_caller.hpp"
diff --git a/src/readfilter.hpp b/src/readfilter.hpp
index 0716721..acb47a4 100644
--- a/src/readfilter.hpp
+++ b/src/readfilter.hpp
@@ -11,7 +11,7 @@
 
 #include "vg.hpp"
 #include "handle.hpp"
-#include "IntervalTree.h"
+#include <intervaltree/IntervalTree.h>
 #include "annotation.hpp"
 #include "multipath_alignment_emitter.hpp"
 #include <vg/io/alignment_emitter.hpp>
diff --git a/src/utility.hpp b/src/utility.hpp
index 434b026..6c681af 100644
--- a/src/utility.hpp
+++ b/src/utility.hpp
@@ -19,7 +19,7 @@
 #include <vg/vg.pb.h>
 #include "types.hpp"
 #include "sha1.hpp"
-#include "Variant.h"
+#include <vcflib/Variant.h>
 
 namespace vg {
 
diff --git a/src/vcf_buffer.hpp b/src/vcf_buffer.hpp
index 0dc61e4..1cdeb53 100644
--- a/src/vcf_buffer.hpp
+++ b/src/vcf_buffer.hpp
@@ -10,7 +10,7 @@
 #include <tuple>
 
 // We need vcflib
-#include "Variant.h"
+#include <vcflib/Variant.h>
 
 
 namespace vg {
diff --git a/src/vg.hpp b/src/vg.hpp
index 3e8652f..1a1ba9b 100644
--- a/src/vg.hpp
+++ b/src/vg.hpp
@@ -33,7 +33,7 @@
 #include "progressive.hpp"
 #include "lru_cache.h"
 
-#include "Variant.h"
+#include <vcflib/Variant.h>
 #include "Fasta.h"
 
 #include "swap_remove.hpp"
diff --git a/test/Makefile b/test/Makefile
index a469867..3e3e305 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -3,19 +3,11 @@
 CXX:=g++
 CXXFLAGS:=-O3 -std=c++11 -fopenmp -g
 
-vg:=../bin/vg
-
 all: test clean
 
-test: build_graph $(vg) vcf2tsv
+test: build_graph 
 	prove -v t
 
-vcf2tsv:
-	cd ../deps/vcflib && $(MAKE) bin/vcf2tsv
-
-$(vg):
-	cd .. && $(MAKE) bin/vg
-
 build_graph: build_graph.cpp
 	cd .. && . ./source_me.sh && $(MAKE) test/build_graph
 
diff --git a/test/t/02_vg_construct.t b/test/t/02_vg_construct.t
index d858cec..90a9fa7 100644
--- a/test/t/02_vg_construct.t
+++ b/test/t/02_vg_construct.t
@@ -80,7 +80,7 @@ rm -f fail.vg
 # check that we produce a full graph
 
 refbp=$(fastahack -r x small/x.fa | tr -d '\n' | wc -c)
-variantbp=$(zcat < small/x.vcf.gz | ../bin/vcf2tsv \
+variantbp=$(zcat < small/x.vcf.gz | vcf2tsv \
     | cut -f 5,4 | tail -n+2 \
     | awk '{ x=length($2)-length($1); if (x > 0) { print x; } else if (x == 0) { print length($2); } }' \
         | awk '{ sum += $1 } END { print sum }')
