From: "Michael R. Crusoe" <crusoe@debian.org>
Date: Fri, 6 Sep 2019 14:16:07 +0900
Subject: Make build system more flexible

Forwarded: https://github.com/benedictpaten/sonLib/pull/46
https://github.com/benedictpaten/sonLib/pull/42
https://github.com/vgteam/gfakluge/pull/6
https://github.com/yoheirosen/sublinear-Li-Stephens/pull/7
https://github.com/vgteam/vg/pull/3168
https://github.com/vgteam/cpp_progress_bar/pull/2

So that Debian can pass hardening flags
Assisted-By: scaleway/deepseek-v4-flash-0731
---
 deps/libvgio/CMakeLists.txt                      |  2 +-
 deps/progress_bar/makefile                       |  2 +-
 deps/sdsl-lite/CMakeLists.txt                    |  1 -
 deps/sdsl-lite/install.sh                        |  5 ---
 deps/sdsl-lite/lib/CMakeLists.txt                |  1 -
 deps/sdsl-lite/lib/structure_tree.cpp.cmake      |  2 +-
 deps/sonLib/C/Makefile                           |  4 +-
 deps/sonLib/externalTools/quicktree_1.1/Makefile |  2 +-
 deps/sublinear-Li-Stephens/makefile              | 54 ++++++++++++------------
 deps/xg/deps/gfakluge/Makefile                   |  6 +--
 10 files changed, 36 insertions(+), 43 deletions(-)

--- a/deps/libvgio/CMakeLists.txt
+++ b/deps/libvgio/CMakeLists.txt
@@ -6,7 +6,7 @@ OPTION(USE_INSTALLED_LIBHANDLEGRAPH_ONLY
 
 
 # Optimize by default, but also include debug info
-set(CMAKE_CXX_FLAGS "-O3 -g ${CMAKE_CXX_FLAGS}")
+#set(CMAKE_CXX_FLAGS "-O3 -g ${CMAKE_CXX_FLAGS}")
 # Don't allow any -std= flags in
 string(REGEX REPLACE " *-std=[^ ]*" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
 find_package(OpenMP REQUIRED)
--- a/deps/progress_bar/makefile
+++ b/deps/progress_bar/makefile
@@ -1,5 +1,5 @@
 CC = g++
-CPPFLAGS = -std=c++11
+CPPFLAGS += -std=c++11
 TARGET = progress_bar
 OBJ = main.o progress_bar.o
 
--- a/deps/sdsl-lite/CMakeLists.txt
+++ b/deps/sdsl-lite/CMakeLists.txt
@@ -116,7 +116,6 @@ else()
     message(WARNING "git not found. Cloning of submodules will not work.")
 endif()
 
-add_subdirectory(external)
 add_subdirectory(include)
 add_subdirectory(lib)
 
--- a/deps/sdsl-lite/install.sh
+++ b/deps/sdsl-lite/install.sh
@@ -101,11 +101,6 @@ echo "The sdsl include files are located
 echo "The library files are located in '${SDSL_INSTALL_PREFIX}/lib'."
 echo " "
 echo "Sample programs can be found in the examples-directory."
-echo "A program 'example.cpp' can be compiled with the command: "
-echo "g++ -std=c++17 -DNDEBUG -O3 [-msse4.2] \\"
-echo "   -I${SDSL_INSTALL_PREFIX}/include -L${SDSL_INSTALL_PREFIX}/lib \\"
-echo "   example.cpp -lsdsl -ldivsufsort -ldivsufsort64"
-echo " "
 echo "Tests in the test-directory"
 echo "A cheat sheet in the extras/cheatsheet-directory."
 echo "Have fun!"
--- a/deps/sdsl-lite/lib/CMakeLists.txt
+++ b/deps/sdsl-lite/lib/CMakeLists.txt
@@ -1,6 +1,5 @@
 include_directories(#"${CMAKE_CURRENT_SOURCE_DIR}/../include"
         "${CMAKE_CURRENT_BINARY_DIR}/../include"
-        "${CMAKE_CURRENT_BINARY_DIR}/../external/libdivsufsort/include"
         )
 
 
--- a/deps/sdsl-lite/lib/structure_tree.cpp.cmake
+++ b/deps/sdsl-lite/lib/structure_tree.cpp.cmake
@@ -45,7 +45,7 @@ std::string create_html_header(const cha
             << "   <head>\n"
             << "    <meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">\n"
             << "    <title>" << file_name << "</title>\n"
-            << "    <script src=\"file://@PROJECT_SOURCE_DIR@/external/d3/d3.min.js\"></script>"
+            << "    <script src=\"file:///usr/share/javascript/d3/d3.min.js\"></script>"
             << "    <script src=\"http://d3js.org/d3.v2.js\"></script>\n"
             << "    <style type=\"text/css\">\n"
             << "      path { stroke: #000; stroke-width: 0.8; cursor: pointer; }\n"
--- a/deps/sonLib/C/Makefile
+++ b/deps/sonLib/C/Makefile
@@ -52,8 +52,8 @@ ${libPath}/%.h: inc/%.h
 
 ${libPath}/sonLib.a : ${libSources} ${cppSources} $(foreach l, ${libHeaders}, ${libPath}/$(notdir $l)) ${libInternalHeaders}
 	@mkdir -p $(dir $@)
-	${cxx} $(CPPFLAGS) ${cflags} -I inc -I ${libPath}/  -c ${libSources}
-	${cpp} $(CPPFLAGS) ${cppflags} -I inc -I ${libPath}/ -c ${cppSources}
+	${cxx} $(CPPFLAGS) ${cflags} $(CXXFLAGS) -I inc -I ${libPath}/  -c ${libSources}
+	${cpp} $(CPPFLAGS) ${cppflags} $(CXXFLAGS) $(LDFLAGS) -I inc -I ${libPath}/ -c ${cppSources}
 	ar rc sonLib.a *.o ${quickTreeObjects}
 	ranlib sonLib.a 
 	rm *.o
--- a/deps/sonLib/externalTools/quicktree_1.1/Makefile
+++ b/deps/sonLib/externalTools/quicktree_1.1/Makefile
@@ -22,7 +22,7 @@ all: $(BIN)/quicktree
 quicktree : $(BIN)/quicktree
 
 $(BIN)/quicktree : $(QUICKTREEOBJ)
-	$(CC) $(DLFLAGS) -o $@ $(QUICKTREEOBJ) -lm
+	$(CC) $(LDFLAGS) -o $@ $(QUICKTREEOBJ) -lm
 
 $(OBJ)/quicktree.o : $(SRC)/quicktree.c 
 	$(CC) $(CFLAGS) $(CPPFLAGS) -o $(OBJ)/quicktree.o $(SRC)/quicktree.c
--- a/deps/xg/deps/gfakluge/Makefile
+++ b/deps/xg/deps/gfakluge/Makefile
@@ -1,5 +1,5 @@
 CXX?=g++
-CXXFLAGS:=-O3 -pipe -fPIC -march=native -mtune=native -std=c++11 -g -ggdb
+CXXFLAGS += -O3 -pipe -fPIC  -std=c++11 -g -ggdb
 PREFIX=/usr/local
 
 # We want to pass -Wa,-q to GCC use the Clang assembler, but Apple Clang can't take that
@@ -21,10 +21,10 @@ LD_LIB_FLAGS=-L./src/ -L./
 LD_INC_FLAGS=-I./src/ -I./ -I./src/tinyFA -I./$(BUILD_DIR)
 
 gfak: $(BUILD_DIR)/main.o src/gfakluge.hpp src/tinyFA/pliib.hpp src/tinyFA/tinyfa.hpp | $(BUILD_DIR) $(BIN_DIR)
-	+$(CXX) $(CXXFLAGS) -o $@ $< $(LD_LIB_FLAGS) $(LD_INC_FLAGS)
+	+$(CXX) $(LDFLAGS) $(CPPFLAGS) $(CXXFLAGS) -o $@ $< $(LD_LIB_FLAGS) $(LD_INC_FLAGS)
 
 $(BUILD_DIR)/main.o: src/main.cpp src/gfakluge.hpp src/tinyFA/pliib.hpp src/tinyFA/tinyfa.hpp | $(BUILD_DIR) $(BIN_DIR)
-	+$(CXX) $(CXXFLAGS) -c -o $@ $< $(LD_LIB_FLAGS) $(LD_INC_FLAGS)
+	+$(CXX) $(LDFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< $(LD_LIB_FLAGS) $(LD_INC_FLAGS)
 
 $(BUILD_DIR):
 	mkdir -p $(BUILD_DIR)
