[libmseed] 01/04: - added install rule - fixed a bug for passing the test suite when building shared lib - added a linker version script to only export useful symbols
Pierre Duperray
zulu-guest at moszumanska.debian.org
Mon Feb 27 22:18:05 UTC 2017
This is an automated email from the git hooks/post-receive script.
zulu-guest pushed a commit to branch master
in repository libmseed.
commit e3b96def86c869eea3e3d4258dbee5dce1815e85
Author: Pierre Duperray <pierreduperray at free.fr>
Date: Mon Feb 27 22:51:10 2017 +0100
- added install rule
- fixed a bug for passing the test suite when building shared lib
- added a linker version script to only export useful symbols
---
Makefile | 40 ++++++++++++++++++++++++++++++++--------
libmseed.sym | 8 ++++++++
mseed.pc.in | 12 ++++++++++++
test/Makefile | 4 +++-
4 files changed, 55 insertions(+), 9 deletions(-)
diff --git a/Makefile b/Makefile
index 2cb7c9a..b74f6b4 100644
--- a/Makefile
+++ b/Makefile
@@ -3,12 +3,23 @@
# environment variables:
# CC : Specify the C compiler to use
# CFLAGS : Specify compiler options to use
+# LDFLAGS : Specify linker options to use
+# CPPFLAGS : Specify c-preprocessor options to use
MAJOR_VER = 2
MINOR_VER = 18
CURRENT_VER = $(MAJOR_VER).$(MINOR_VER)
COMPAT_VER = $(MAJOR_VER).$(MINOR_VER)
+PREFIX ?= /usr/local
+EXEC_PREFIX ?= $(PREFIX)
+LIBDIR ?= $(EXEC_PREFIX)/lib
+INCLUDEDIR ?= $(PREFIX)/include
+DATAROOTDIR ?= $(PREFIX)/share
+DOCDIR ?= $(DATAROOTDIR)/doc/libmseed
+MANDIR ?= $(DATAROOTDIR)/man
+MAN3DIR ?= $(MANDIR)/man3
+
LIB_SRCS = fileutils.c genutils.c gswap.c lmplatform.c lookup.c \
msrutils.c pack.c packdata.c traceutils.c tracelist.c \
parseutils.c unpack.c unpackdata.c selection.c logging.c
@@ -39,7 +50,7 @@ $(LIB_A): $(LIB_OBJS)
# Build shared library using GCC-style options
$(LIB_SO): $(LIB_DOBJS)
rm -f $(LIB_SO) $(LIB_SO_FILENAME)
- $(CC) $(CFLAGS) -shared -Wl,-soname -Wl,$(LIB_SO_ALIAS) -o $(LIB_SO) $(LIB_DOBJS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,--version-script=libmseed.sym -Wl,-soname -Wl,$(LIB_SO_ALIAS) -o $(LIB_SO) $(LIB_DOBJS)
ln -s $(LIB_SO) $(LIB_SO_ALIAS)
ln -s $(LIB_SO) $(LIB_SO_FILENAME)
@@ -57,20 +68,33 @@ clean:
@$(MAKE) -C test clean
@echo "All clean."
-install:
- @echo
- @echo "No install target, copy the library and header as needed"
- @echo
-
+install: shared
+ mkdir -p $(DESTDIR)$(PREFIX)/include
+ cp libmseed.h lmplatform.h $(DESTDIR)$(PREFIX)/include
+ mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
+ cp -d libmseed.so* $(DESTDIR)$(LIBDIR)
+ cp mseed.pc.in $(DESTDIR)$(LIBDIR)/pkgconfig/mseed.pc
+ sed -i 's|@prefix@|$(PREFIX)|g' $(DESTDIR)$(LIBDIR)/pkgconfig/mseed.pc
+ sed -i 's|@exec_prefix@|$(EXEC_PREFIX)|g' $(DESTDIR)$(LIBDIR)/pkgconfig/mseed.pc
+ sed -i 's|@libdir@|$(LIBDIR)|g' $(DESTDIR)$(LIBDIR)/pkgconfig/mseed.pc
+ sed -i 's|@includedir@|$(PREFIX)/include|g' $(DESTDIR)$(LIBDIR)/pkgconfig/mseed.pc
+ sed -i 's|@PACKAGE_NAME@|libmseed|g' $(DESTDIR)$(LIBDIR)/pkgconfig/mseed.pc
+ sed -i 's|@PACKAGE_URL@|http://ds.iris.edu/ds/nodes/dmc/software/downloads/libmseed/|g' $(DESTDIR)$(LIBDIR)/pkgconfig/mseed.pc
+ sed -i 's|@VERSION@|$(CURRENT_VER)|g' $(DESTDIR)$(LIBDIR)/pkgconfig/mseed.pc
+ mkdir -p $(DESTDIR)$(DOCDIR)/example
+ cp -r example/ $(DESTDIR)$(DOCDIR)/example
+ cp doc/libmseed-UsersGuide $(DESTDIR)$(DOCDIR)
+ mkdir -p $(DESTDIR)$(MAN3DIR)
+ cp -d doc/ms*.3 $(DESTDIR)$(MAN3DIR)
.SUFFIXES: .c .o .lo
# Standard object building
.c.o:
- $(CC) $(CFLAGS) -c $< -o $@
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
# Standard object building for dynamic library components using -fPIC
.c.lo:
- $(CC) $(CFLAGS) -fPIC -c $< -o $@
+ $(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -c $< -o $@
FORCE:
diff --git a/libmseed.sym b/libmseed.sym
new file mode 100644
index 0000000..d7ba10e
--- /dev/null
+++ b/libmseed.sym
@@ -0,0 +1,8 @@
+{
+ global:
+ ms_*; msr_*; mst_*; mstl_*;
+
+ local:
+ *;
+};
+
\ No newline at end of file
diff --git a/mseed.pc.in b/mseed.pc.in
new file mode 100644
index 0000000..7fcac74
--- /dev/null
+++ b/mseed.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: @PACKAGE_NAME@
+Description: The Mini-SEED library provides a framework for manipulation of SEED
+ (Standard for the Exchange of Earthquake Data) data records.
+URL: @PACKAGE_URL@
+Version: @VERSION@
+Cflags: -I${includedir}
+Libs: -L${libdir} -lmseed
diff --git a/test/Makefile b/test/Makefile
index fe67726..3c47e39 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -26,6 +26,8 @@ FAILED := \033[0;31mFAILED\033[0m
TESTCOUNT := 0
+export LD_LIBRARY_PATH=..
+
test all: $(BINS) $(TESTOUTS)
@printf '%d tests conducted\n' $(TESTCOUNT)
@@ -41,7 +43,7 @@ $(BINS) : % : %.c
# Run test scripts, create %.test.out files and compare to %.test.ref references
$(TESTOUTS) : %.test.out : %.test $(BINS) FORCE
@$(eval TESTCOUNT=$(shell echo $$(($(TESTCOUNT)+1))))
- @$(shell ./$< > $@ 2>&1)
+ @$(shell LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) ./$< > $@ 2>&1)
@diff $<.ref $@ >/dev/null; \
if [ $$? -eq 0 ]; \
then printf '$(PASSED) Test $<\n'; \
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/libmseed.git
More information about the debian-science-commits
mailing list