Updated Makefile and .travis
authorYann Collet <yann.collet.73@gmail.com>
Tue, 1 Sep 2015 14:59:24 +0000 (15:59 +0100)
committerYann Collet <yann.collet.73@gmail.com>
Tue, 1 Sep 2015 14:59:24 +0000 (15:59 +0100)
.travis.yml
Makefile
NEWS
lib/liblz4.pc.in
lib/lz4.c
lib/lz4frame.h
programs/Makefile
programs/lz4.1

index 87cb9a9..9ba2bc2 100644 (file)
@@ -1,6 +1,6 @@
 language: c
 compiler: gcc
-script: make test-travis
+script: make $LZ4_TRAVIS_CI_ENV
 before_install:
   - sudo apt-get update  -qq
   - sudo apt-get install -qq gcc-arm-linux-gnueabi
@@ -20,16 +20,16 @@ env:
   - LZ4_TRAVIS_CI_ENV=gpptest
   - LZ4_TRAVIS_CI_ENV=armtest
   - LZ4_TRAVIS_CI_ENV=versionsTest
-  - LZ4_TRAVIS_CI_ENV=test-lz4
-  - LZ4_TRAVIS_CI_ENV=test-lz4c
-  - LZ4_TRAVIS_CI_ENV=test-lz4c32
-  - LZ4_TRAVIS_CI_ENV=test-fullbench
-  - LZ4_TRAVIS_CI_ENV=test-fullbench32
-  - LZ4_TRAVIS_CI_ENV=test-fuzzer
-  - LZ4_TRAVIS_CI_ENV=test-fuzzer32
-  - LZ4_TRAVIS_CI_ENV=test-frametest
-  - LZ4_TRAVIS_CI_ENV=test-frametest32
-  - LZ4_TRAVIS_CI_ENV=test-mem
+  - LZ4_TRAVIS_CI_ENV="-C programs test-lz4"
+  - LZ4_TRAVIS_CI_ENV="-C programs test-lz4c"
+  - LZ4_TRAVIS_CI_ENV="-C programs test-lz4c32"
+  - LZ4_TRAVIS_CI_ENV="-C programs test-fullbench"
+  - LZ4_TRAVIS_CI_ENV="-C programs test-fullbench32"
+  - LZ4_TRAVIS_CI_ENV="-C programs test-fuzzer"
+  - LZ4_TRAVIS_CI_ENV="-C programs test-fuzzer32"
+  - LZ4_TRAVIS_CI_ENV="-C programs test-frametest"
+  - LZ4_TRAVIS_CI_ENV="-C programs test-frametest32"
+  - LZ4_TRAVIS_CI_ENV="-C programs test-mem"
 
 matrix:
   fast_finish: true
index 1f8c941..7def674 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -43,13 +43,6 @@ PRGDIR  = programs
 LZ4DIR  = lib
 
 
-# Select test target for Travis CI's Build Matrix
-ifneq (,$(filter test-%,$(LZ4_TRAVIS_CI_ENV)))
-TRAVIS_TARGET=prg-travis
-else
-TRAVIS_TARGET=$(LZ4_TRAVIS_CI_ENV)
-endif
-
 # Define nul output
 ifneq (,$(filter Windows%,$(OS)))
 VOID = nul
@@ -62,20 +55,19 @@ endif
 
 default: lz4programs
 
-all: lib
-       @cd $(PRGDIR); $(MAKE) all
+all: lib lz4programs
 
 lib:
-       @cd $(LZ4DIR); $(MAKE) all
+       @$(MAKE) -C $(LZ4DIR) all
 
 lz4programs:
-       @cd $(PRGDIR); $(MAKE)
+       @$(MAKE) -C $(PRGDIR)
 
 clean:
-       @cd $(PRGDIR); $(MAKE) clean > $(VOID)
-       @cd $(LZ4DIR); $(MAKE) clean > $(VOID)
-       @cd examples;  $(MAKE) clean > $(VOID)
-       @cd versionsTest; $(MAKE) clean > $(VOID)
+       @$(MAKE) -C $(PRGDIR) $@ > $(VOID)
+       @$(MAKE) -C $(LZ4DIR) $@ > $(VOID)
+       @$(MAKE) -C examples $@ > $(VOID)
+       @$(MAKE) -C versionsTest $@ > $(VOID)
        @echo Cleaning completed
 
 
@@ -84,20 +76,18 @@ clean:
 ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU))
 
 install:
-       @cd $(LZ4DIR); $(MAKE) install
-       @cd $(PRGDIR); $(MAKE) install
+       @$(MAKE) -C $(LZ4DIR) $@
+       @$(MAKE) -C $(PRGDIR) $@
 
 uninstall:
-       @cd $(LZ4DIR); $(MAKE) uninstall
-       @cd $(PRGDIR); $(MAKE) uninstall
+       @$(MAKE) -C $(LZ4DIR) $@
+       @$(MAKE) -C $(PRGDIR) $@
 
 travis-install:
        sudo $(MAKE) install
 
 test:
-       @cd $(PRGDIR); $(MAKE) test
-
-test-travis: $(TRAVIS_TARGET)
+       $(MAKE) -C $(PRGDIR) test
 
 cmake:
        @cd cmake_unofficial; cmake CMakeLists.txt; $(MAKE)
@@ -115,18 +105,15 @@ staticAnalyze: clean
        CFLAGS=-g scan-build --status-bugs -v $(MAKE) all
 
 armtest: clean
-       cd lib; CFLAGS="-O3 -Werror" $(MAKE) all CC=arm-linux-gnueabi-gcc
-       cd programs; CFLAGS="-O3 -Werror" $(MAKE) bins CC=arm-linux-gnueabi-gcc
+       CFLAGS="-O3 -Werror" $(MAKE) -C $(LZ4DIR) all CC=arm-linux-gnueabi-gcc
+       CFLAGS="-O3 -Werror" $(MAKE) -C $(PRGDIR) bins CC=arm-linux-gnueabi-gcc
 
 versionsTest: clean
-       @cd versionsTest; $(MAKE)
+       $(MAKE) -C versionsTest
 
 examples:
-       cd lib; $(MAKE)
-       cd programs; $(MAKE) lz4
-       cd examples; $(MAKE) test
-
-prg-travis:
-       @cd $(PRGDIR); $(MAKE) test-travis
+       $(MAKE) -C $(LZ4DIR)
+       $(MAKE) -C $(PRGDIR) lz4
+       $(MAKE) -C examples test
 
 endif
diff --git a/NEWS b/NEWS
index 3e8f68f..a1baead 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,9 @@
 r132
 Improved: Small decompression speed boost (+4%)
-Improved: Performance on ARMv6
-Makefile: Generate intermediate object files (*.o) for faster compilation on low power systems
+Improved: Performance on ARMv6 and ARMv7
+Added : Debianization, by Evgeniy Polyakov
+Makefile: Safely protects lz4 version when selecting custom CFLAGS
+Makefile: Generates intermediate object files (*.o) for faster compilation on low power systems
 
 r131
 New    : Dos/DJGPP target, thanks to Louis Santillan (#114)
index 0d05152..d9393c7 100644 (file)
@@ -8,7 +8,7 @@ includedir=@INCLUDEDIR@
 
 Name: lz4
 Description: fast lossless compression algorithm library
-URL: http://code.google.com/p/lz4/
+URL: http://lz4.org/
 Version: @VERSION@
 Libs: -L@LIBDIR@ -llz4
 Cflags: -I@INCLUDEDIR@
index b2d9293..d23d6b9 100644 (file)
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -206,7 +206,7 @@ static void LZ4_write16(void* memPtr, U16 value)
     memcpy(memPtr, &value, sizeof(value));
 }
 
-#endif // LZ4_FORCE_DIRECT_MEMORY_ACCESS
+#endif // LZ4_FORCE_MEMORY_ACCESS
 
 
 static U16 LZ4_readLE16(const void* memPtr)
@@ -247,6 +247,13 @@ static void LZ4_wildCopy(void* dstPtr, const void* srcPtr, void* dstEnd)
     BYTE* d = (BYTE*)dstPtr;
     const BYTE* s = (const BYTE*)srcPtr;
     BYTE* const e = (BYTE*)dstEnd;
+
+#if 1
+    const size_t l2 = 8 - (((size_t)d) & (sizeof(void*)-1));
+    LZ4_copy8(d,s); if (d>e-9) return;
+    d+=l2; s+=l2;
+#endif // join to align
+
     do { LZ4_copy8(d,s); d+=8; s+=8; } while (d<e);
 }
 
index 05fbc5f..47147b7 100644 (file)
@@ -33,8 +33,8 @@
 */
 
 /* LZ4F is a stand-alone API to create LZ4-compressed frames
- * fully conformant to specification v1.5.1.
- * All related operations, including memory management, are handled by the library.
+ * conformant with specification v1.5.1.
+ * All related operations, including memory management, are handled internally by the library.
  * You don't need lz4.h when using lz4frame.h.
  * */
 
@@ -51,8 +51,8 @@ extern "C" {
 
 
 /**************************************
- * Error management
- * ************************************/
+ Error management
+**************************************/
 typedef size_t LZ4F_errorCode_t;
 
 unsigned    LZ4F_isError(LZ4F_errorCode_t code);
@@ -60,8 +60,8 @@ const char* LZ4F_getErrorName(LZ4F_errorCode_t code);   /* return error code str
 
 
 /**************************************
- * Frame compression types
- * ************************************/
+ Frame compression types
+**************************************/
 //#define LZ4F_DISABLE_OBSOLETE_ENUMS
 #ifndef LZ4F_DISABLE_OBSOLETE_ENUMS
 #  define LZ4F_OBSOLETE_ENUM(x) ,x
@@ -126,8 +126,8 @@ typedef struct {
 
 
 /***********************************
- * Simple compression function
- * *********************************/
+ Simple compression function
+***********************************/
 size_t LZ4F_compressFrameBound(size_t srcSize, const LZ4F_preferences_t* preferencesPtr);
 
 size_t LZ4F_compressFrame(void* dstBuffer, size_t dstMaxSize, const void* srcBuffer, size_t srcSize, const LZ4F_preferences_t* preferencesPtr);
@@ -257,15 +257,15 @@ size_t LZ4F_getFrameInfo(LZ4F_decompressionContext_t dctx,
                          const void* srcBuffer, size_t* srcSizePtr);
 /* LZ4F_getFrameInfo()
  * This function decodes frame header information (such as max blockSize, frame checksum, etc.).
- * Its usage is optional : you can start by calling directly LZ4F_decompress() instead.
- * The objective is to extract frame header information, typically for allocation purposes.
- * LZ4F_getFrameInfo() can also be used anytime *after* starting decompression, on any valid LZ4F_decompressionContext_t.
- * The result is *copied* into an existing LZ4F_frameInfo_t structure which must be already allocated.
- * The number of bytes read from srcBuffer will be provided within *srcSizePtr (necessarily <= original value).
- * The function result is an hint of how many srcSize bytes LZ4F_decompress() expects for next call,
+ * Its usage is optional. The objective is to extract frame header information, typically for allocation purposes.
+ * A header size is variable and can be from 7 to 15 bytes. It's also possible to input more bytes than that. 
+ * The number of bytes read from srcBuffer will be updated within *srcSizePtr (necessarily <= original value).
+ * (note that LZ4F_getFrameInfo() can also be used anytime *after* starting decompression, in this case 0 input byte is enough)
+ * Frame header info is *copied into* an already allocated LZ4F_frameInfo_t structure.
+ * The function result is an hint about how many srcSize bytes LZ4F_decompress() expects for next call,
  *                        or an error code which can be tested using LZ4F_isError()
  *                        (typically, when there is not enough src bytes to fully decode the frame header)
- * You are expected to resume decompression from where it stopped (srcBuffer + *srcSizePtr)
+ * Decompression is expected to resume from where it stopped (srcBuffer + *srcSizePtr)
  */
 
 size_t LZ4F_decompress(LZ4F_decompressionContext_t dctx,
index 0a6f91a..332fd01 100644 (file)
@@ -38,7 +38,7 @@ RELEASE ?= r132
 
 DESTDIR ?=
 PREFIX  ?= /usr/local
-CFLAGS  ?= -O3 # can select your own settings, for example : CFLAGS="-O2 -g" make
+CFLAGS  ?= -O3   # can select customized flags instead, for example : CFLAGS="-O2 -g" make
 CFLAGS  += -I../lib -std=c99 -Wall -Wextra -Wundef -Wshadow -Wcast-qual -Wcast-align -Wstrict-prototypes -pedantic
 CPPFLAGS:= -DXXH_NAMESPACE=LZ4_ -DLZ4_VERSION=\"$(RELEASE)\"
 FLAGS   := $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
@@ -59,9 +59,7 @@ endif
 
 
 # Select test target for Travis CI's Build Matrix
-TRAVIS_TARGET:= $(LZ4_TRAVIS_CI_ENV)
 TEST_FILES   := COPYING
-TEST_TARGETS := test-native
 FUZZER_TIME  := -T9mn
 
 
@@ -148,8 +146,6 @@ test32: test-lz4c32 test-frametest32 test-fullbench32 test-fuzzer32 test-mem32
 
 test-all: test test32
 
-test-travis: $(TRAVIS_TARGET)
-
 test-lz4-sparse: lz4 datagen
        @echo "\n ---- test sparse file support ----"
        ./datagen -g5M  -P100 > tmpSrc
@@ -164,7 +160,7 @@ test-lz4-sparse: lz4 datagen
        ./lz4 tmpSrc | ./lz4 -dv --no-sparse > tmpNoSparse
        diff -s tmpSrc tmpNoSparse
        ls -ls tmp*
-       ./datagen -s1 -g1200007 -P100 | ./lz4 | ./lz4 -dv --sparse > tmpOdd   # Odd size file (to not finish on an exact nb of blocks)
+       ./datagen -s1 -g1200007 -P100 | ./lz4 | ./lz4 -dv --sparse > tmpOdd   # Odd size file (to generate non-full last block)
        ./datagen -s1 -g1200007 -P100 | diff -s - tmpOdd
        ls -ls tmpOdd
        @rm tmp*
@@ -182,8 +178,6 @@ test-lz4-sparse: lz4 datagen
        diff tmp2M tmpR
        @rm tmp*
 
-
-
 test-lz4-contentSize: lz4 datagen
        @echo "\n ---- test original size support ----"
        ./datagen -g15M > tmp
@@ -306,6 +300,6 @@ test-mem: lz4 datagen fuzzer frametest fullbench
        valgrind --leak-check=yes --error-exitcode=1 ./frametest -i256
 
 test-mem32: lz4c32 datagen
-# unfortunately, valgrind doesn't seem to work with non-native binary. If someone knows how to do a valgrind-test on a 32-bits exe with a 64-bits system...
+# unfortunately, valgrind doesn't seem to work with non-native binary...
 
 endif
index 414da48..5c6eb32 100644 (file)
@@ -1,6 +1,6 @@
 \"
 \" lz4.1: This is a manual page for 'lz4' program. This file is part of the
-\" lz4 <https://code.google.com/p/lz4/> project.
+\" lz4 <http://www.lz4.org/> project.
 \" Author: Yann Collet
 \"
 
@@ -215,7 +215,7 @@ This is default behavior anyway, so this option is just for compatibility with g
  iteration loops [1-9](default : 3), benchmark mode only
 
 .SH BUGS
-Report bugs at: https://github.com/Cyan4973/lz4
+Report bugs at: https://github.com/Cyan4973/lz4/issues
 
 .SH AUTHOR
 Yann Collet