Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor patches for easier porting and packaging #895

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# (c) 2009 Aaron Quinlan
# ==========================

SHELL := /bin/bash -e
# Use sh for portability and avoid bash extensions in shell commands
SHELL := /bin/sh -e

VERSION_FILE=./src/utils/version/version_git.h
RELEASED_VERSION_FILE=./src/utils/version/version_release.txt
Expand All @@ -21,7 +22,8 @@ OBJ_DIR = obj
BIN_DIR = bin
SRC_DIR = src

CXX = g++
# Default if not provided via the environment or make args
CXX ?= g++

ifeq ($(DEBUG),1)
BT_CPPFLAGS = -DDEBUG -D_DEBUG -D_FILE_OFFSET_BITS=64 -DWITH_HTS_CB_API $(INCLUDES)
Expand All @@ -41,7 +43,8 @@ endif
BT_LDFLAGS =
BT_LIBS = -lz -lm -lbz2 -llzma -lpthread

prefix ?= /usr/local
# Default if not provided via the environment or make args
PREFIX ?= /usr/local

SUBDIRS = $(SRC_DIR)/annotateBed \
$(SRC_DIR)/bamToBed \
Expand Down Expand Up @@ -197,9 +200,9 @@ $(BIN_DIR)/intersectBed: | $(BIN_DIR)
.PHONY: all

install: all
mkdir -p $(DESTDIR)$(prefix)/bin
mkdir -p $(DESTDIR)$(PREFIX)/bin
for file in bin/* ; do \
cp -f $$file $(DESTDIR)$(prefix)/bin; \
cp -f $$file $(DESTDIR)$(PREFIX)/bin; \
done

print_banner:
Expand Down
7 changes: 6 additions & 1 deletion src/utils/BamTools/include/SamHeader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <string.h>
#include <api/BamAux.h>
#include <stdlib.h>
#include <sysexits.h>


#ifdef WITH_HTS_CB_API
Expand All @@ -29,7 +30,11 @@ namespace htslib_future {
ops.cb_data = buffer;
samFile* fp = hts_open_callback(NULL, &ops, "w");

sam_hdr_write(fp, hdr);
if ( sam_hdr_write(fp, hdr) != 0 )
{
fputs("sam_hdr_rebuild: Error: sam_hdr_write() failed.\n", stderr);
exit(EX_IOERR);
}

hts_close(fp);

Expand Down
15 changes: 9 additions & 6 deletions src/utils/htslib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,23 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

CC = gcc
AR = ar
RANLIB = ranlib
# Defaults if not provided by the environment or make args
CC ?= gcc
AR ?= ar
RANLIB ?= ranlib

# Default libraries to link if configure is not used
htslib_default_libs = -lz -lm -lbz2 -llzma

CPPFLAGS =
# Defaults if not provided by the environment or make args
CPPFLAGS ?=
CFLAGS ?= -g -Wall -O2
LDFLAGS ?=

# TODO: probably update cram code to make it compile cleanly with -Wc++-compat
# For testing strict C99 support add -std=c99 -D_XOPEN_SOURCE=600
#CFLAGS = -g -Wall -O2 -pedantic -std=c99 -D_XOPEN_SOURCE=600 -D__FUNCTION__=__func__
CFLAGS = -g -Wall -O2
EXTRA_CFLAGS_PIC = -fpic
LDFLAGS =
LIBS = $(htslib_default_libs)

prefix = /usr/local
Expand Down