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
Assisted-By: scaleway/deepseek-v4-flash-0731
---
 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(-)

--- a/Makefile
+++ b/Makefile
@@ -408,7 +408,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
@@ -452,7 +451,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
@@ -783,48 +781,6 @@ $(LIB_DIR)/libhts%a $(LIB_DIR)/pkgconfig
 	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)
 	cd $(HTSLIB_DIR) && $(MAKE) --assume-old=htscodecs.mk clean && $(MAKE) --assume-old=htscodecs.mk $(FILTER) && $(MAKE) --assume-old=htscodecs.mk install
 
-# Build and install tabixpp for vcflib.
-$(LIB_DIR)/libtabixpp.a: $(LIB_DIR)/libhts.a $(TABIXPP_DIR)/*.cpp $(TABIXPP_DIR)/*.hpp
-	cd $(TABIXPP_DIR) && rm -f tabix.o libtabixpp.a
-	cd $(TABIXPP_DIR) && CFLAGS="-fPIC $(CFLAGS)" CXXFLAGS="-fPIC $(CXXFLAGS)" INCLUDES="$(INCLUDE_FLAGS)" HTS_HEADERS="" $(MAKE) tabix.o $(FILTER)
-	cd $(TABIXPP_DIR) && 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. Build the library and any needed binaries. 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.
-# We also have to make sure to point at a Python that probably has its headers,
-# because there's no way to turn off vcflib's pybind11 build and pybind11 will
-# try and use the latest installed Python over the default one that probably
-# has headers.
-# We now need to tell it to build in static mode so we get a static library.
-# And we also now need to tell it to actually build its bundled WFA.
-#
-# Note that on MacOS we rely on the Makefile putting GNU coreutils on the PATH
-# in order to avoid the dreaded "Could NOT find Threads".
-$(LIB_DIR)/libvcflib%a $(LIB_DIR)/libwfa2%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 $(LIB_DIR)/cleaned_old_catch
-	rm -f $(VCFLIB_DIR)/contrib/WFA2-lib/VERSION
-	env
-	cd $(VCFLIB_DIR) && rm -Rf build && mkdir build && cd build && PKG_CONFIG_PATH="$(CWD)/$(LIB_DIR)/pkgconfig:$(PKG_CONFIG_PATH)" cmake -DCMAKE_C_COMPILER="$(CC)" -DCMAKE_CXX_COMPILER="$(CXX)" -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DZIG=OFF -DCMAKE_C_FLAGS="$(CFLAGS)" -DCMAKE_CXX_FLAGS="$(CXXFLAGS)" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=$(CWD) -DCMAKE_PREFIX_PATH="/usr;$(OMP_PREFIXES)" -DPYTHON_EXECUTABLE="$(shell which python3)" -DBUILD_STATIC=ON -DWFA_GITMODULE=ON .. && cmake --build . --target vcflib wfa2_static
-	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/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)
-	cp $(VCFLIB_DIR)/build/contrib/WFA2-lib/libwfa2.a $(LIB_DIR)
-
 $(LIB_DIR)/libgssw.a: $(GSSW_DIR)/src/gssw.c $(GSSW_DIR)/src/gssw.h
 	cd $(GSSW_DIR) && $(MAKE) clean && CFLAGS="-fPIC $(CFLAGS)" CXXFLAGS="-fPIC $(CXXFLAGS)" $(MAKE) $(FILTER)
 	cd $(GSSW_DIR) && cp lib/libgssw.a $(CWD)/$(LIB_DIR)/ && cp src/gssw.h $(CWD)/$(INC_DIR)/
@@ -1107,7 +1063,7 @@ clean-vg:
 	$(RM) -f $(IO_SHARED_OBJ_DIR)/*.o $(IO_SHARED_OBJ_DIR)/*.d
 	$(RM) -f $(SRC_DIR)/vg_git_version.hpp $(SRC_DIR)/vg_environment_version.hpp
 
-clean: clean-vcflib
+clean:
 	$(RM) -r $(UNITTEST_BIN_DIR)
 	$(RM) -r $(BIN_DIR)
 	$(RM) -r $(LIB_DIR)
@@ -1141,8 +1097,4 @@ clean: clean-vcflib
 	cd $(DEP_DIR) && cd structures && $(MAKE) clean
 	cd $(DEP_DIR) && cd sublinear-Li-Stephens && $(MAKE) clean
 	cd $(DEP_DIR) && cd tabixpp && rm -f tabix.o libtabixpp.a
-	cd $(DEP_DIR) && cd vcflib && $(MAKE) clean
 
-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
--- a/src/aligner.hpp
+++ b/src/aligner.hpp
@@ -12,7 +12,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"
--- 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"
--- 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>
--- 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>
 
--- a/src/deconstructor.hpp
+++ b/src/deconstructor.hpp
@@ -8,7 +8,7 @@
 #include <atomic>
 #include <memory>
 #include "genotypekit.hpp"
-#include "Variant.h"
+#include <vcflib/Variant.h>
 #include "handle.hpp"
 #include "traversal_finder.hpp"
 #include "graph_caller.hpp"
--- 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 "progressive.hpp"
--- 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>
 #include "log.hpp"
 
 namespace vg {
--- 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 {
--- 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"
