Skip to content

Commit

Permalink
Merge pull request #13 from Cyan4973/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Cyan4973 committed Jul 24, 2014
2 parents 28fd251 + f9e16d2 commit 3f607b5
Show file tree
Hide file tree
Showing 16 changed files with 1,294 additions and 858 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: c
compiler: gcc
script: make test
script: make test-travis
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq gcc-multilib
Expand Down
40 changes: 28 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,18 @@
# ################################################################

# Version numbers
export RELEASE=r119
LIBVER_MAJOR=1
LIBVER_MINOR=2
LIBVER_PATCH=0
VERSION=120
export RELEASE=r$(VERSION)
LIBVER_MAJOR=`sed -n '/LZ4_VERSION_MAJOR/s/.*\s\+\([0-9]\+\).*/\1/p' < lz4.h`
LIBVER_MINOR=`sed -n '/LZ4_VERSION_MINOR/s/.*\s\+\([0-9]\+\).*/\1/p' < lz4.h`
LIBVER_PATCH=`sed -n '/LZ4_VERSION_RELEASE/s/.*\s\+\([0-9]\+\).*/\1/p' < lz4.h`
LIBVER=$(LIBVER_MAJOR).$(LIBVER_MINOR).$(LIBVER_PATCH)

DESTDIR=
PREFIX = /usr
CC := $(CC)
CFLAGS+= -I. -std=c99 -O3 -Wall -W -Wundef -DLZ4_VERSION=\"$(RELEASE)\"
CFLAGS?= -O3
CFLAGS+= -I. -std=c99 -Wall -Wextra -Wundef -Wshadow -Wstrict-prototypes -DLZ4_VERSION=\"$(RELEASE)\"

LIBDIR?= $(PREFIX)/lib
INCLUDEDIR=$(PREFIX)/include
Expand All @@ -58,10 +60,10 @@ endif
# OS X linker doesn't support -soname, and use different extension
# see : https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryDesignGuidelines.html
ifeq ($(shell uname), Darwin)
SONAME_FLAGS =
SHARED_EXT = dylib
SHARED_EXT_MAJOR = $(LIBVER_MAJOR).$(SHARED_EXT)
SHARED_EXT_VER = $(LIBVER).$(SHARED_EXT)
SONAME_FLAGS = -install_name $(PREFIX)/lib/liblz4.$(SHARED_EXT_MAJOR) -compatibility_version $(LIBVER_MAJOR) -current_version $(LIBVER)
else
SONAME_FLAGS = -Wl,-soname=liblz4.$(SHARED_EXT).$(LIBVER_MAJOR)
SHARED_EXT = so
Expand Down Expand Up @@ -92,28 +94,38 @@ lz4programs: lz4.c lz4hc.c

liblz4: lz4.c lz4hc.c
@echo compiling static library
@$(CC) $(CFLAGS) -c $^
@$(CC) $(CPPFLAGS) $(CFLAGS) -c $^
@$(AR) rcs liblz4.a lz4.o lz4hc.o
@echo compiling dynamic library
@$(CC) $(CFLAGS) -shared $^ -fPIC $(SONAME_FLAGS) -o $@.$(SHARED_EXT_VER)
@$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -shared $^ -fPIC $(SONAME_FLAGS) -o $@.$(SHARED_EXT_VER)
@echo creating versioned links
@ln -sf $@.$(SHARED_EXT_VER) $@.$(SHARED_EXT_MAJOR)
@ln -sf $@.$(SHARED_EXT_VER) $@.$(SHARED_EXT)

clean:
@rm -f core *.o *.a *.$(SHARED_EXT) *.$(SHARED_EXT).* $(DISTRIBNAME) *.sha1
@rm -f core *.o *.a *.$(SHARED_EXT) *.$(SHARED_EXT).* $(DISTRIBNAME) *.sha1 liblz4.pc
@cd $(PRGDIR); $(MAKE) clean
@echo Cleaning completed


#------------------------------------------------------------------------
#make install option is designed for Linux & OSX targets only

ifneq (,$(filter $(shell uname),Linux Darwin))

install: liblz4
@install -d -m 755 $(DESTDIR)$(LIBDIR)/ $(DESTDIR)$(INCLUDEDIR)/
liblz4.pc: liblz4.pc.in Makefile
sed -e 's|@PREFIX@|$(PREFIX)|' \
-e 's|@LIBDIR@|$(LIBDIR)|' \
-e 's|@INCLUDEDIR@|$(INCLUDEDIR)|' \
-e 's|@VERSION@|$(VERSION)|' \
$< >$@

install: liblz4 liblz4.pc
@install -d -m 755 $(DESTDIR)$(LIBDIR)/pkgconfig/ $(DESTDIR)$(INCLUDEDIR)/
@install -m 755 liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT_VER)
@cp -a liblz4.$(SHARED_EXT_MAJOR) $(DESTDIR)$(LIBDIR)
@cp -a liblz4.$(SHARED_EXT) $(DESTDIR)$(LIBDIR)
@cp -a liblz4.pc $(DESTDIR)$(LIBDIR)/pkgconfig/
@install -m 644 liblz4.a $(DESTDIR)$(LIBDIR)/liblz4.a
@install -m 644 lz4.h $(DESTDIR)$(INCLUDEDIR)/lz4.h
@install -m 644 lz4hc.h $(DESTDIR)$(INCLUDEDIR)/lz4hc.h
Expand All @@ -123,6 +135,7 @@ install: liblz4
uninstall:
rm -f $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT)
rm -f $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT_MAJOR)
rm -f $(DESTDIR)$(LIBDIR)/pkgconfig/liblz4.pc
[ -x $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT_VER) ] && rm -f $(DESTDIR)$(LIBDIR)/liblz4.$(SHARED_EXT_VER)
[ -f $(DESTDIR)$(LIBDIR)/liblz4.a ] && rm -f $(DESTDIR)$(LIBDIR)/liblz4.a
[ -f $(DESTDIR)$(INCLUDEDIR)/lz4.h ] && rm -f $(DESTDIR)$(INCLUDEDIR)/lz4.h
Expand All @@ -146,7 +159,10 @@ dist: clean
@sha1sum $(DISTRIBNAME) > $(DISTRIBNAME).sha1
@echo Distribution $(DISTRIBNAME) built

test: lz4programs
test:
@cd $(PRGDIR); $(MAKE) -e $@

test-travis: lz4programs
@cd $(PRGDIR); $(MAKE) -e $@

endif
14 changes: 12 additions & 2 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
r120:
Modified : Streaming API, using strong types
Added : LZ4_versionNumber(), thanks to Takayuki Matsuoka
Fix : OS-X : library install name, thanks to Clemens Lang
Updated : Makefile : synchronize library version number with lz4.h, thanks to Takayuki Matsuoka
Updated : Makefile : stricter compilation flags
Added : pkg-config, thanks to Zbigniew Jędrzejewski-Szmek (issue 135)
Makefile : lz4-test only test native binaries, as suggested by Michał Górny (issue 136)
Updated : xxHash to r35

r119:
Fix : overflow address, 32-bits mode (issue 134)
Fix : Issue 134 : extended malicious address space overflow in 32-bits mode for some specific configurations

r118:
New : LZ4 Streaming API (Fast version), special thanks to Takayuki Matsuoka
New : datagen : parametrable synthetic data generator for tests
Improved : fuzzer, support more test cases, more parameters, ability to jump to specific test
fix : support ppc64le platform (issue 131)
fix : Issue 52 (malicious address space overflow in 32-bits mode when using custom format)
fix : Issue 52 (malicious address space overflow in 32-bits mode when using large custom format)
fix : Makefile : minor issue 130 : header files permissions

r117:
Expand Down
14 changes: 14 additions & 0 deletions liblz4.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# LZ4 - Fast LZ compression algorithm
# Copyright (C) 2011-2014, Yann Collet.
# BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)

prefix=@PREFIX@
libdir=@LIBDIR@
includedir=@INCLUDEDIR@

Name: lz4
Description: fast lossless compression algorithm library
URL: http://code.google.com/p/lz4/
Version: @VERSION@
Libs: -L@LIBDIR@ -llz4
Cflags: -I@INCLUDEDIR@

0 comments on commit 3f607b5

Please sign in to comment.