version the shared library (fix #24)

This commit is contained in:
Steven G. Johnson 2015-03-07 21:49:54 -05:00
parent bf230db3a3
commit 2d636a5686
2 changed files with 44 additions and 14 deletions

View File

@ -5,5 +5,6 @@ compiler:
notifications: notifications:
email: false email: false
script: 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) - make utf8proc_data.c.new && (diff utf8proc_data.c.new utf8proc_data.c > /dev/null)

View File

@ -1,23 +1,39 @@
# libutf8proc Makefile # libutf8proc Makefile
# programs
CURL=curl CURL=curl
RUBY=ruby RUBY=ruby
PERL=perl PERL=perl
MAKE=make MAKE=make
AR=ar
INSTALL=install
# settings # compiler settings
cflags = -O2 -std=c99 -pedantic -Wall -fpic -DUTF8PROC_EXPORTS $(CFLAGS) cflags = -O2 -std=c99 -pedantic -Wall -fpic -DUTF8PROC_EXPORTS $(CFLAGS)
cc = $(CC) $(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) OS := $(shell uname)
ifeq ($(OS),Darwin) ifeq ($(OS),Darwin) # MacOS X
SHLIB_EXT = dylib SHLIB_EXT = dylib
else #TODO Windows SHLIB_VERS_EXT = $(MAJOR).dylib
else # GNU/Linux, at least (Windows should probably use cmake)
SHLIB_EXT = so SHLIB_EXT = so
SHLIB_VERS_EXT = so.$(MAJOR).$(MINOR).$(REVISION)
endif endif
# installation directories (for 'make install')
prefix=/usr/local
libdir=$(prefix)/lib
includedir=$(prefix)/include
# meta targets # meta targets
all: c-library all: c-library
@ -25,7 +41,7 @@ all: c-library
c-library: libutf8proc.a libutf8proc.$(SHLIB_EXT) c-library: libutf8proc.a libutf8proc.$(SHLIB_EXT)
clean: 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 $(MAKE) -C bench clean
update: utf8proc_data.c.new update: utf8proc_data.c.new
@ -58,13 +74,26 @@ libutf8proc.a: utf8proc.o
rm -f libutf8proc.a rm -f libutf8proc.a
$(AR) rs libutf8proc.a utf8proc.o $(AR) rs libutf8proc.a utf8proc.o
libutf8proc.so: utf8proc.o libutf8proc.so.$(MAJOR).$(MINOR).$(REVISION): utf8proc.o
$(cc) -shared -o libutf8proc.$(SHLIB_EXT) utf8proc.o $(cc) -shared -o $@ -soname libutf8proc.so.$(MAJOR) utf8proc.o
chmod a-x libutf8proc.$(SHLIB_EXT) chmod a-x $@
libutf8proc.dylib: utf8proc.o libutf8proc.so: libutf8proc.so.$(MAJOR).$(MINOR).$(REVISION)
$(cc) -dynamiclib -o $@ $^ -install_name $(libdir)/$@ 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: 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 # Test programs