Skip to content
Commits on Source (2)
......@@ -14,13 +14,10 @@ Architecture: any
Depends: ${shlibs:Depends},
${misc:Depends}
Description: Genomic C(++) library of reusable code for bioinformatics projects
This is an eclectic gathering of (mostly) C++ code which I am using for
This is an eclectic gathering of (mostly) C++ code which used for
some of my bioinformatics projects. The main idea is to provide lean
code and efficient data structures, trying to avoid too many code
dependencies of heavy libraries while minimizing production cycles (and
this also implies a decent compile/build time -- I am looking at you,
bloated configure scripts and lengthy compile times of Boost code or
other heavy C++ template code..).
dependencies of heavy libraries while minimizing production cycles.
.
This code was gathered even before the C++ STL had been fully adopted as
a cross-platform "standard". Since STL by itself is a bit heavier for
......
Author: Andreas Tille <tille@debian.org>
Last-Update: Thu, 18 Apr 2019 12:54:42 +0200
Descriptions: Build proper libraries via automake
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,29 @@
+lib_LTLIBRARIES = libgclib.la
+
+libgclibdir=$(includedir)
+libgclib_HEADERS= *.h *.hh
+libgclib_la_SOURCES = codons.cpp \
+ GAlnExtend.cpp \
+ GapAssem.cpp \
+ GArgs.cpp \
+ GBam.cpp \
+ GBase.cpp \
+ gcdb.cpp \
+ GCdbYank.cpp \
+ gdimg.cpp \
+ gdna.cpp \
+ GFaSeqGet.cpp \
+ GFastaIndex.cpp \
+ gff.cpp \
+ gsocket.cpp \
+ gstopwatch.cpp \
+ GStr.cpp \
+ gtest.cpp \
+ GThreads.cpp
+libgclib_la_LDFLAGS = -version-info @LIB_VERSION@
+
+libgclib_la_CPPFLAGS = $(INCLUDES)
+
+pkgconfigdir=$(libdir)/pkgconfig
+pkgconfig_DATA = libgclib.pc
+
--- /dev/null
+++ b/libgclib.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+
+Name: libgclib
+Version: @VERSION@
+Description: Genomic C(++) library of reusable code for bioinformatics projects
+Libs: -L${libdir} -lgclib
+Cflags: -I${includedir}
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,61 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_INIT(gclib, 1, geo.pertea@gmail.com)
+AC_CONFIG_HEADERS([config.h])
+
+AC_PREREQ(2.57)
+
+# Directory that contains install-sh and other auxiliary files
+AC_CONFIG_AUX_DIR([config])
+
+################################################################################
+# According to (http://www.mail-archive.com/autoconf@gnu.org/msg14232.html)
+# this macro should be after AC_INIT but before AM_INIT_AUTOMAKE
+################################################################################
+AC_CONFIG_MACRO_DIR(config)
+
+AM_INIT_AUTOMAKE([1.6 foreign dist-zip tar-ustar filename-length-max=299])
+
+LIB_VERSION=1:1
+
+AC_SUBST([VERSION])
+AC_SUBST([LIB_VERSION])
+
+AC_SUBST([VERSION])
+
+# Checks for programs.
+AC_PROG_LN_S
+AC_PROG_INSTALL
+AC_PROG_LIBTOOL
+
+################################################################################
+# calling AC_PROG_CXX resets CXXFLAGS, we use our own flags set in the
+# the AX_CXXFLAGS macro below.
+# So we cache the argument to configure
+# here in ARG_CXX_FLAGS (so that our macro does not override them)
+################################################################################
+ARG_CXX_FLAGS="$CXXFLAGS"
+AC_PROG_CXX
+
+#Ranlib handled by check for libtool
+CXXFLAGS="$ARG_CXX_FLAGS"
+AX_CXXFLAGS
+
+AC_SUBST(CXXFLAGS)
+
+CPPFLAGS="-I\$(top_srcdir) $CPPFLAGS"
+# Checks for libraries.
+
+# Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([stdlib.h])
+
+AC_PROG_MAKE_SET
+
+AC_CONFIG_FILES([
+ Makefile
+ libgclib.pc
+ ])
+AC_OUTPUT
+
--- a/Makefile
+++ /dev/null
@@ -1,114 +0,0 @@
-INCDIRS := -I. -I${GDIR} -I${BAM}
-
-CXX := $(if $(CXX),$(CXX),g++)
-
-LINKER := $(if $(LINKER),$(LINKER),g++)
-
-LDFLAGS := $(if $(LDFLAGS),$(LDFLAGS),-g)
-
-LIBS :=
-
-
-# A simple hack to check if we are on Windows or not (i.e. are we using mingw32-make?)
-ifeq ($(findstring mingw32, $(MAKE)), mingw32)
-WINDOWS=1
-endif
-
-# Compiler settings
-TLIBS =
-# Non-windows systems need pthread
-ifndef WINDOWS
-TLIBS += -lpthread
-endif
-
-
-
-DMACH := $(shell ${CXX} -dumpmachine)
-
-# MinGW32 GCC 4.5 link problem fix
-ifdef WINDOWS
-DMACH := windows
-ifeq ($(findstring 4.5.,$(shell g++ -dumpversion)), 4.5.)
-LDFLAGS += -static-libstdc++ -static-libgcc
-endif
-endif
-
-# Misc. system commands
-ifdef WINDOWS
-RM = del /Q
-else
-RM = rm -f
-endif
-
-# File endings
-ifdef WINDOWS
-EXE = .exe
-else
-EXE =
-endif
-
-CC := g++
-
-BASEFLAGS := -Wall -Wextra ${INCDIRS} $(MARCH) \
- -D_REENTRANT -fno-exceptions -fno-rtti
-
-GCCVER5 := $(shell expr `g++ -dumpversion | cut -f1 -d.` \>= 5)
-ifeq "$(GCCVER5)" "1"
- BASEFLAGS += -Wno-implicit-fallthrough
-endif
-
-GCCVER8 := $(shell expr `g++ -dumpversion | cut -f1 -d.` \>= 8)
-ifeq "$(GCCVER8)" "1"
- BASEFLAGS += -Wno-class-memaccess
-endif
-
-#add the link-time optimization flag if gcc version > 4.5
-GCC_VERSION:=$(subst ., ,$(shell gcc -dumpversion))
-GCC_MAJOR:=$(word 1,$(GCC_VERSION))
-GCC_MINOR:=$(word 2,$(GCC_VERSION))
-#GCC_SUB:=$(word 3,$(GCC_VERSION))
-GCC_SUB:=x
-
-GCC45OPTS :=
-GCC45OPTMAIN :=
-
-ifneq (,$(filter %release %nodebug, $(MAKECMDGOALS)))
- # -- release build
- CXXFLAGS := $(if $(CXXFLAGS),$(CXXFLAGS),-g -O3)
- CXXFLAGS += -DNDEBUG $(BASEFLAGS)
- ifeq ($(shell expr $(GCC_MAJOR).$(GCC_MINOR) '>=' 4.5),1)
- CXXFLAGS += -flto
- GCC45OPTS := -flto
- GCC45OPTMAIN := -fwhole-program
- endif
-else
- # -- debug build
- CXXFLAGS := $(if $(CXXFLAGS),$(CXXFLAGS),-g -O0)
- ifneq (, $(findstring darwin, $(DMACH)))
- CXXFLAGS += -gdwarf-3
- endif
- CXXFLAGS += -DDEBUG -D_DEBUG -DGDEBUG $(BASEFLAGS)
-endif
-
-%.o : %.cpp
- ${CXX} ${CXXFLAGS} -c $< -o $@
-
-
-.PHONY : all
-all: mdtest
-nodebug: all
-release: all
-debug: all
-
-OBJS := GBase.o GStr.o GArgs.o
-
-version: ; @echo "GCC Version is: "$(GCC_MAJOR)":"$(GCC_MINOR)":"$(GCC_SUB)
- @echo "> GCC Opt. string is: "$(GCC45OPTS)
-mdtest: $(OBJS) mdtest.o
- ${LINKER} ${LDFLAGS} $(GCC45OPTS) $(GCC45OPTMAIN) -o $@ ${filter-out %.a %.so, $^} ${LIBS}
-# target for removing all object files
-
-.PHONY : clean
-clean::
- @${RM} $(OBJS) *.o mdtest$(EXE)
- @${RM} core.*