diff options
author | Steven G. Johnson <stevenj@alum.mit.edu> | 2015-03-07 21:49:54 -0500 |
---|---|---|
committer | Steven G. Johnson <stevenj@alum.mit.edu> | 2015-03-07 21:49:54 -0500 |
commit | 2d636a56865baddd9ab79f8689f3e9a5ce44c1fe (patch) | |
tree | 5d8549a41136e2cbecd2cfb2fe8f8e676720cca4 | |
parent | bf230db3a3c86eb227ed8290315d8d2b991c3e2d (diff) | |
download | libutf8proc-2d636a56865baddd9ab79f8689f3e9a5ce44c1fe.tar.gz libutf8proc-2d636a56865baddd9ab79f8689f3e9a5ce44c1fe.tar.bz2 |
version the shared library (fix #24)
-rw-r--r-- | .travis.yml | 3 | ||||
-rw-r--r-- | Makefile | 55 |
2 files changed, 44 insertions, 14 deletions
diff --git a/.travis.yml b/.travis.yml index 1f2780a..df424ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,5 +5,6 @@ compiler: notifications: email: false script: - - make && make check + - make prefix=`pwd`/local install + - make check - make utf8proc_data.c.new && (diff utf8proc_data.c.new utf8proc_data.c > /dev/null) @@ -1,23 +1,39 @@ # libutf8proc Makefile +# programs CURL=curl RUBY=ruby PERL=perl MAKE=make +AR=ar +INSTALL=install -# settings - +# compiler settings cflags = -O2 -std=c99 -pedantic -Wall -fpic -DUTF8PROC_EXPORTS $(CFLAGS) cc = $(CC) $(cflags) -AR = ar + +# shared-library version MAJOR.MINOR.RELEASE ... this may be *different* +# from the utf8proc version number because it indicates ABI compatibility, +# not API compatibility: MAJOR should be incremented whenever *binary* +# compatibility is broken, even if the API is backward-compatibile +MAJOR=1 +MINOR=2 +RELEASE=0 OS := $(shell uname) -ifeq ($(OS),Darwin) - SHLIB_EXT = dylib -else #TODO Windows - SHLIB_EXT = so +ifeq ($(OS),Darwin) # MacOS X + SHLIB_EXT = dylib + SHLIB_VERS_EXT = $(MAJOR).dylib +else # GNU/Linux, at least (Windows should probably use cmake) + SHLIB_EXT = so + SHLIB_VERS_EXT = so.$(MAJOR).$(MINOR).$(REVISION) endif +# installation directories (for 'make install') +prefix=/usr/local +libdir=$(prefix)/lib +includedir=$(prefix)/include + # meta targets all: c-library @@ -25,7 +41,7 @@ all: c-library c-library: libutf8proc.a libutf8proc.$(SHLIB_EXT) clean: - rm -f utf8proc.o libutf8proc.a libutf8proc.$(SHLIB_EXT) test/normtest test/graphemetest data/UnicodeData.txt data/DerivedCoreProperties.txt data/CompositionExclusions.txt data/CaseFolding.txt data/NormalizationTest.txt data/GraphemeBreakTest.txt + rm -f utf8proc.o libutf8proc.a libutf8proc.$(SHLIB_VERS_EXT) libutf8proc.$(SHLIB_EXT) test/normtest test/graphemetest data/UnicodeData.txt data/DerivedCoreProperties.txt data/CompositionExclusions.txt data/CaseFolding.txt data/NormalizationTest.txt data/GraphemeBreakTest.txt $(MAKE) -C bench clean update: utf8proc_data.c.new @@ -58,13 +74,26 @@ libutf8proc.a: utf8proc.o rm -f libutf8proc.a $(AR) rs libutf8proc.a utf8proc.o -libutf8proc.so: utf8proc.o - $(cc) -shared -o libutf8proc.$(SHLIB_EXT) utf8proc.o - chmod a-x libutf8proc.$(SHLIB_EXT) +libutf8proc.so.$(MAJOR).$(MINOR).$(REVISION): utf8proc.o + $(cc) -shared -o $@ -soname libutf8proc.so.$(MAJOR) utf8proc.o + chmod a-x $@ + +libutf8proc.so: libutf8proc.so.$(MAJOR).$(MINOR).$(REVISION) + ln -s libutf8proc.so.$(MAJOR).$(MINOR).$(REVISION) $@ + +libutf8proc.$(MAJOR).dylib: utf8proc.o + $(cc) -dynamiclib -o $@ $^ -install_name $(libdir)/$@ -Wl,-compatibility_version -Wl,$(MAJOR) -Wl,-current_version -Wl,$(MAJOR).$(MINOR).$(REVISION) -libutf8proc.dylib: utf8proc.o - $(cc) -dynamiclib -o $@ $^ -install_name $(libdir)/$@ +libutf8proc.dylib: libutf8proc.$(MAJOR).dylib + ln -s libutf8proc.$(MAJOR).dylib $@ +install: libutf8proc.a libutf8proc.$(SHLIB_EXT) libutf8proc.$(SHLIB_VERS_EXT) + mkdir -m 755 -p $(includedir) + $(INSTALL) -m 644 utf8proc.h $(includedir) + mkdir -m 755 -p $(libdir) + $(INSTALL) -m 644 libutf8proc.a $(libdir) + $(INSTALL) -m 755 libutf8proc.$(SHLIB_VERS_EXT) $(libdir) + ln -f -s $(libdir)/libutf8proc.$(SHLIB_VERS_EXT) $(libdir)/libutf8proc.$(SHLIB_EXT) # Test programs |