From f17302769055ad0c4b2e10e3de544f6593865e89 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Tue, 1 Nov 2016 17:26:22 -0700 Subject: moved cmake and debian directories to contrib (#245) --- Makefile | 2 +- NEWS | 7 +- cmake_unofficial/CMakeLists.txt | 114 -------------------------------- contrib/cmake_unofficial/.gitignore | 7 ++ contrib/cmake_unofficial/CMakeLists.txt | 110 ++++++++++++++++++++++++++++++ contrib/debian/changelog | 10 +++ contrib/debian/compat | 1 + contrib/debian/control | 23 +++++++ contrib/debian/copyright | 9 +++ contrib/debian/dirs | 1 + contrib/debian/docs | 0 contrib/debian/liblz4-dev.install | 2 + contrib/debian/liblz4.install | 2 + contrib/debian/rules | 8 +++ debian/changelog | 8 --- debian/compat | 1 - debian/control | 23 ------- debian/copyright | 9 --- debian/dirs | 1 - debian/docs | 0 debian/liblz4-dev.install | 2 - debian/liblz4.install | 2 - debian/rules | 8 --- programs/lz4io.c | 10 +-- 24 files changed, 183 insertions(+), 177 deletions(-) delete mode 100644 cmake_unofficial/CMakeLists.txt create mode 100644 contrib/cmake_unofficial/.gitignore create mode 100644 contrib/cmake_unofficial/CMakeLists.txt create mode 100644 contrib/debian/changelog create mode 100644 contrib/debian/compat create mode 100644 contrib/debian/control create mode 100644 contrib/debian/copyright create mode 100644 contrib/debian/dirs create mode 100644 contrib/debian/docs create mode 100644 contrib/debian/liblz4-dev.install create mode 100644 contrib/debian/liblz4.install create mode 100755 contrib/debian/rules delete mode 100644 debian/changelog delete mode 100644 debian/compat delete mode 100644 debian/control delete mode 100644 debian/copyright delete mode 100644 debian/dirs delete mode 100644 debian/docs delete mode 100644 debian/liblz4-dev.install delete mode 100644 debian/liblz4.install delete mode 100755 debian/rules diff --git a/Makefile b/Makefile index 930922d..518ffbd 100644 --- a/Makefile +++ b/Makefile @@ -91,7 +91,7 @@ test: $(MAKE) -C $(PRGDIR) test cmake: - @cd cmake_unofficial; cmake CMakeLists.txt; $(MAKE) + @cd contrib/cmake_unofficial; cmake CMakeLists.txt; $(MAKE) gpptest: clean $(MAKE) all CC=g++ CFLAGS="-O3 -I../lib -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror" diff --git a/NEWS b/NEWS index a1baead..b676d86 100644 --- a/NEWS +++ b/NEWS @@ -1,9 +1,10 @@ -r132 +v1.7.2 +Changed : moved to versioning; package, cli and library have same version number Improved: Small decompression speed boost (+4%) 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 +Makefile: Generates object files (*.o) for faster (re)compilation on low power systems +Fix : cli : crash on some invalid inputs r131 New : Dos/DJGPP target, thanks to Louis Santillan (#114) diff --git a/cmake_unofficial/CMakeLists.txt b/cmake_unofficial/CMakeLists.txt deleted file mode 100644 index c7f1dab..0000000 --- a/cmake_unofficial/CMakeLists.txt +++ /dev/null @@ -1,114 +0,0 @@ -PROJECT(LZ4 C) -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LZ4 compression library") -set(CPACK_PACKAGE_VERSION_MAJOR 1) -set(CPACK_PACKAGE_VERSION_MINOR 7) -set(CPACK_PACKAGE_VERSION_PATCH r132) -set(VERSION_STRING " \"${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}\" ") -include(CPack) - -cmake_minimum_required (VERSION 2.6) -INCLUDE (CheckTypeSize) -check_type_size("void *" SIZEOF_VOID_P) -IF(SIZEOF_VOID_P STREQUAL "8") - set (CMAKE_SYSTEM_PROCESSOR "64bit") - MESSAGE( STATUS "64 bit architecture detected size of void * is " ${SIZEOF_VOID_P}) -ENDIF() - -option(BUILD_TOOLS "Build the command line tools" ON) -option(BUILD_LIBS "Build the libraries in addition to the tools" ON) -option(LINK_TOOLS_WITH_LIB "Link the command line tools with the (shared) library" OFF) - -IF(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR - CMAKE_C_COMPILER_ID STREQUAL "Clang") - SET(GNU_COMPATIBLE_COMPILER 1) -ENDIF() - - -set(LZ4_DIR ../lib/) -set(PRG_DIR ../programs/) -set(LZ4_SRCS_LIB ${LZ4_DIR}lz4.c ${LZ4_DIR}lz4hc.c ${LZ4_DIR}lz4.h ${LZ4_DIR}lz4hc.h ${LZ4_DIR}lz4frame.c ${LZ4_DIR}lz4frame.h ${LZ4_DIR}xxhash.c) -set(LZ4_SRCS ${LZ4_DIR}lz4frame.c ${LZ4_DIR}xxhash.c ${PRG_DIR}bench.c ${PRG_DIR}lz4cli.c ${PRG_DIR}lz4io.c) - -if(BUILD_TOOLS AND NOT (LINK_TOOLS_WITH_LIB AND BUILD_LIBS)) - set(LZ4_SRCS ${LZ4_SRCS} ${LZ4_SRCS_LIB}) -endif() - -if(BUILD_TOOLS) - add_executable(lz4 ${LZ4_SRCS}) - install(TARGETS lz4 RUNTIME DESTINATION "bin/") -endif() - -if(BUILD_LIBS) - - - SET(LIBS_TARGETS "") - IF(WIN32) - add_library(liblz4 STATIC ${LZ4_SRCS_LIB}) - SET(LIBS_TARGETS liblz4) - ELSE(WIN32) - add_library(liblz4 SHARED ${LZ4_SRCS_LIB}) - add_library(liblz4_static STATIC ${LZ4_SRCS_LIB}) - SET_TARGET_PROPERTIES(liblz4_static PROPERTIES OUTPUT_NAME lz4) - SET(LIBS_TARGETS liblz4 liblz4_static) - ENDIF(WIN32) - - set_target_properties(liblz4 PROPERTIES - OUTPUT_NAME lz4 - SOVERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}" - ) - - install(TARGETS ${LIBS_TARGETS} - RUNTIME DESTINATION lib #on Windows: cmake considers dlls as runtime component - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - ) - - install(FILES - ${LZ4_DIR}/lz4.h - ${LZ4_DIR}/lz4hc.h - ${LZ4_DIR}/lz4frame.h - DESTINATION include - ) - - set(PREFIX ${CMAKE_INSTALL_PREFIX}) - set(LIBDIR ${CMAKE_INSTALL_PREFIX}/lib) - set(INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/include) - string(SUBSTRING ${CPACK_PACKAGE_VERSION_PATCH} 1 -1 VERSION) - configure_file(${LZ4_DIR}/liblz4.pc.in liblz4.pc @ONLY) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblz4.pc - DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig" - ) - - if(BUILD_TOOLS AND LINK_TOOLS_WITH_LIB) - target_link_libraries(lz4 liblz4) - endif() -endif() - - -#warnings - -if(MSVC) - ADD_DEFINITIONS("-W4") -endif() -if(GNU_COMPATIBLE_COMPILER) - ADD_DEFINITIONS("-Wall") -endif() -if(CMAKE_COMPILER_IS_GNUCXX) - ADD_DEFINITIONS("-Wextra") - ADD_DEFINITIONS("-Wundef") - ADD_DEFINITIONS("-Wshadow") - ADD_DEFINITIONS("-Wcast-align") - ADD_DEFINITIONS("-Wstrict-prototypes") -endif(CMAKE_COMPILER_IS_GNUCXX) -if(GNU_COMPATIBLE_COMPILER) - # we need gnu99 instead of c99 on Linux and Solaris - # to get C99 and POSIX definitions - # an alternative with cmake >= 3.1/3.2 is the C_STANDARD property - ADD_DEFINITIONS("-std=gnu99") -endif() -ADD_DEFINITIONS("-DLZ4_VERSION=\"${CPACK_PACKAGE_VERSION_PATCH}\"") -INCLUDE_DIRECTORIES (${LZ4_DIR}) - - - - diff --git a/contrib/cmake_unofficial/.gitignore b/contrib/cmake_unofficial/.gitignore new file mode 100644 index 0000000..0f81929 --- /dev/null +++ b/contrib/cmake_unofficial/.gitignore @@ -0,0 +1,7 @@ +# cmake artefact + +CMakeCache.txt +CMakeFiles +*.cmake +Makefile +liblz4.pc diff --git a/contrib/cmake_unofficial/CMakeLists.txt b/contrib/cmake_unofficial/CMakeLists.txt new file mode 100644 index 0000000..6edec98 --- /dev/null +++ b/contrib/cmake_unofficial/CMakeLists.txt @@ -0,0 +1,110 @@ +PROJECT(LZ4 C) +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LZ4 compression library") +set(CPACK_PACKAGE_VERSION_MAJOR 1) +set(CPACK_PACKAGE_VERSION_MINOR 7) +set(CPACK_PACKAGE_VERSION_PATCH 2) +set(VERSION_STRING " \"${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}\" ") +include(CPack) + +cmake_minimum_required (VERSION 2.6) +INCLUDE (CheckTypeSize) +check_type_size("void *" SIZEOF_VOID_P) +IF(SIZEOF_VOID_P STREQUAL "8") + set (CMAKE_SYSTEM_PROCESSOR "64bit") + MESSAGE( STATUS "64 bit architecture detected size of void * is " ${SIZEOF_VOID_P}) +ENDIF() + +option(BUILD_TOOLS "Build the command line tools" ON) +option(BUILD_LIBS "Build the libraries in addition to the tools" ON) +option(LINK_TOOLS_WITH_LIB "Link the command line tools with the (shared) library" OFF) + +IF(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR + CMAKE_C_COMPILER_ID STREQUAL "Clang") + SET(GNU_COMPATIBLE_COMPILER 1) +ENDIF() + + +set(LZ4_DIR ../../lib/) +set(PRG_DIR ../../programs/) +set(LZ4_SRCS_LIB ${LZ4_DIR}lz4.c ${LZ4_DIR}lz4hc.c ${LZ4_DIR}lz4.h ${LZ4_DIR}lz4hc.h ${LZ4_DIR}lz4frame.c ${LZ4_DIR}lz4frame.h ${LZ4_DIR}xxhash.c) +set(LZ4_SRCS ${LZ4_DIR}lz4frame.c ${LZ4_DIR}xxhash.c ${PRG_DIR}bench.c ${PRG_DIR}lz4cli.c ${PRG_DIR}lz4io.c) + +if(BUILD_TOOLS AND NOT (LINK_TOOLS_WITH_LIB AND BUILD_LIBS)) + set(LZ4_SRCS ${LZ4_SRCS} ${LZ4_SRCS_LIB}) +endif() + +if(BUILD_TOOLS) + add_executable(lz4 ${LZ4_SRCS}) + install(TARGETS lz4 RUNTIME DESTINATION "bin/") +endif() + +if(BUILD_LIBS) + + + SET(LIBS_TARGETS "") + IF(WIN32) + add_library(liblz4 STATIC ${LZ4_SRCS_LIB}) + SET(LIBS_TARGETS liblz4) + ELSE(WIN32) + add_library(liblz4 SHARED ${LZ4_SRCS_LIB}) + add_library(liblz4_static STATIC ${LZ4_SRCS_LIB}) + SET_TARGET_PROPERTIES(liblz4_static PROPERTIES OUTPUT_NAME lz4) + SET(LIBS_TARGETS liblz4 liblz4_static) + ENDIF(WIN32) + + set_target_properties(liblz4 PROPERTIES + OUTPUT_NAME lz4 + SOVERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}" + ) + + install(TARGETS ${LIBS_TARGETS} + RUNTIME DESTINATION lib #on Windows: cmake considers dlls as runtime component + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + ) + + install(FILES + ${LZ4_DIR}/lz4.h + ${LZ4_DIR}/lz4hc.h + ${LZ4_DIR}/lz4frame.h + DESTINATION include + ) + + set(PREFIX ${CMAKE_INSTALL_PREFIX}) + set(LIBDIR ${CMAKE_INSTALL_PREFIX}/lib) + set(INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/include) + string(SUBSTRING ${CPACK_PACKAGE_VERSION_PATCH} 1 -1 VERSION) + configure_file(${LZ4_DIR}/liblz4.pc.in liblz4.pc @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblz4.pc + DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig" + ) + + if(BUILD_TOOLS AND LINK_TOOLS_WITH_LIB) + target_link_libraries(lz4 liblz4) + endif() +endif() + + +#warnings + +if(MSVC) + ADD_DEFINITIONS("-W4") +endif() +if(GNU_COMPATIBLE_COMPILER) + ADD_DEFINITIONS("-Wall") +endif() +if(CMAKE_COMPILER_IS_GNUCXX) + ADD_DEFINITIONS("-Wextra") + ADD_DEFINITIONS("-Wundef") + ADD_DEFINITIONS("-Wshadow") + ADD_DEFINITIONS("-Wcast-align") + ADD_DEFINITIONS("-Wstrict-prototypes") +endif(CMAKE_COMPILER_IS_GNUCXX) +if(GNU_COMPATIBLE_COMPILER) + # we need gnu99 instead of c99 on Linux and Solaris + # to get C99 and POSIX definitions + # an alternative with cmake >= 3.1/3.2 is the C_STANDARD property + ADD_DEFINITIONS("-std=gnu99") +endif() +ADD_DEFINITIONS("-DLZ4_VERSION=\"${CPACK_PACKAGE_VERSION_PATCH}\"") +INCLUDE_DIRECTORIES (${LZ4_DIR}) diff --git a/contrib/debian/changelog b/contrib/debian/changelog new file mode 100644 index 0000000..87ac016 --- /dev/null +++ b/contrib/debian/changelog @@ -0,0 +1,10 @@ +liblz4 (1.7.2) unstable; urgency=low + + * Changed : moved to versioning; package, cli and library have same version number + * Improved: Small decompression speed boost (+4%) + * Improved: Performance on ARMv6 and ARMv7 + * Added : Debianization, by Evgeniy Polyakov + * Makefile: Generates object files (*.o) for faster (re)compilation on low power systems + * Fix : cli : crash on some invalid inputs + + -- Yann Collet Sun, 28 Jun 2015 01:00:00 +0000 diff --git a/contrib/debian/compat b/contrib/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/contrib/debian/compat @@ -0,0 +1 @@ +7 diff --git a/contrib/debian/control b/contrib/debian/control new file mode 100644 index 0000000..ac3b460 --- /dev/null +++ b/contrib/debian/control @@ -0,0 +1,23 @@ +Source: liblz4 +Section: devel +Priority: optional +Maintainer: Evgeniy Polyakov +Build-Depends: + cmake (>= 2.6), + debhelper (>= 7.0.50~), + cdbs +Standards-Version: 3.8.0 +Homepage: http://www.lz4.org/ +Vcs-Git: git://github.com/lz4/lz4.git +Vcs-Browser: https://github.com/lz4/lz4 + +Package: liblz4 +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Extremely Fast Compression algorithm http://www.lz4.org + +Package: liblz4-dev +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Extremely Fast Compression algorithm http://www.lz4.org + Development files. diff --git a/contrib/debian/copyright b/contrib/debian/copyright new file mode 100644 index 0000000..18a7f48 --- /dev/null +++ b/contrib/debian/copyright @@ -0,0 +1,9 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: liblz4 +Upstream-Contact: Yann Collet +Source: https://github.com/lz4/lz4 + +Files: * +Copyright: (C) 2011+ Yann Collet +License: GPL-2+ + The full text of license: https://github.com/Cyan4973/lz4/blob/master/lib/LICENSE diff --git a/contrib/debian/dirs b/contrib/debian/dirs new file mode 100644 index 0000000..e772481 --- /dev/null +++ b/contrib/debian/dirs @@ -0,0 +1 @@ +usr/bin diff --git a/contrib/debian/docs b/contrib/debian/docs new file mode 100644 index 0000000..e69de29 diff --git a/contrib/debian/liblz4-dev.install b/contrib/debian/liblz4-dev.install new file mode 100644 index 0000000..3a02909 --- /dev/null +++ b/contrib/debian/liblz4-dev.install @@ -0,0 +1,2 @@ +usr/include/lz4* +usr/lib/liblz4.so diff --git a/contrib/debian/liblz4.install b/contrib/debian/liblz4.install new file mode 100644 index 0000000..e444956 --- /dev/null +++ b/contrib/debian/liblz4.install @@ -0,0 +1,2 @@ +usr/lib/liblz4.so.* +usr/bin/* diff --git a/contrib/debian/rules b/contrib/debian/rules new file mode 100755 index 0000000..748e68d --- /dev/null +++ b/contrib/debian/rules @@ -0,0 +1,8 @@ +#!/usr/bin/make -f + +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/cmake.mk + + +DEB_CMAKE_EXTRA_FLAGS := -DCMAKE_BUILD_TYPE=RelWithDebInfo ../cmake_unofficial + diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index 7a4bac6..0000000 --- a/debian/changelog +++ /dev/null @@ -1,8 +0,0 @@ -liblz4 (0.131) unstable; urgency=low - - * New : Dos/DJGPP target, thanks to Louis Santillan (#114) - * Added : Example using lz4frame library, by Zbigniew Jędrzejewski-Szmek (#118) - * Changed: xxhash symbols are modified (namespace emulation) within liblz4 - - -- Yann Collet Sun, 28 Jun 2015 01:00:00 +0000 - diff --git a/debian/compat b/debian/compat deleted file mode 100644 index 7f8f011..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/debian/control b/debian/control deleted file mode 100644 index 1a5a077..0000000 --- a/debian/control +++ /dev/null @@ -1,23 +0,0 @@ -Source: liblz4 -Section: devel -Priority: optional -Maintainer: Evgeniy Polyakov -Build-Depends: - cmake (>= 2.6), - debhelper (>= 7.0.50~), - cdbs -Standards-Version: 3.8.0 -Homepage: https://code.google.com/p/lz4/ -Vcs-Git: git://github.com/Cyan4973/lz4.git -Vcs-Browser: https://github.com/Cyan4973/lz4 - -Package: liblz4 -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: Extremely Fast Compression algorithm http://www.lz4.org - -Package: liblz4-dev -Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: Extremely Fast Compression algorithm http://www.lz4.org - Development files. diff --git a/debian/copyright b/debian/copyright deleted file mode 100644 index da22555..0000000 --- a/debian/copyright +++ /dev/null @@ -1,9 +0,0 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: liblz4 -Upstream-Contact: Yann Collet -Source: https://github.com/Cyan4973/lz4 - -Files: * -Copyright: (C) 2011+ Yann Collet -License: GPL-2+ - The full text of license: https://github.com/Cyan4973/lz4/blob/master/lib/LICENSE diff --git a/debian/dirs b/debian/dirs deleted file mode 100644 index e772481..0000000 --- a/debian/dirs +++ /dev/null @@ -1 +0,0 @@ -usr/bin diff --git a/debian/docs b/debian/docs deleted file mode 100644 index e69de29..0000000 diff --git a/debian/liblz4-dev.install b/debian/liblz4-dev.install deleted file mode 100644 index 3a02909..0000000 --- a/debian/liblz4-dev.install +++ /dev/null @@ -1,2 +0,0 @@ -usr/include/lz4* -usr/lib/liblz4.so diff --git a/debian/liblz4.install b/debian/liblz4.install deleted file mode 100644 index e444956..0000000 --- a/debian/liblz4.install +++ /dev/null @@ -1,2 +0,0 @@ -usr/lib/liblz4.so.* -usr/bin/* diff --git a/debian/rules b/debian/rules deleted file mode 100755 index 748e68d..0000000 --- a/debian/rules +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/make -f - -include /usr/share/cdbs/1/rules/debhelper.mk -include /usr/share/cdbs/1/class/cmake.mk - - -DEB_CMAKE_EXTRA_FLAGS := -DCMAKE_BUILD_TYPE=RelWithDebInfo ../cmake_unofficial - diff --git a/programs/lz4io.c b/programs/lz4io.c index 7293d77..f90cb50 100644 --- a/programs/lz4io.c +++ b/programs/lz4io.c @@ -697,12 +697,12 @@ static unsigned long long LZ4IO_decodeLegacyStream(FILE* finput, FILE* foutput) /* Main Loop */ while (1) { int decodeSize; - size_t sizeCheck; unsigned int blockSize; /* Block Size */ - sizeCheck = fread(in_buff, 1, 4, finput); - if (sizeCheck==0) break; /* Nothing to read : file read is completed */ + { size_t const sizeCheck = fread(in_buff, 1, 4, finput); + if (sizeCheck == 0) break; /* Nothing to read : file read is completed */ + if (sizeCheck != 4) EXM_THROW(52, "Read error : cannot access block size "); } blockSize = LZ4IO_readLE32(in_buff); /* Convert to Little Endian */ if (blockSize > LZ4_COMPRESSBOUND(LEGACY_BLOCKSIZE)) { /* Cannot read next block : maybe new stream ? */ @@ -711,8 +711,8 @@ static unsigned long long LZ4IO_decodeLegacyStream(FILE* finput, FILE* foutput) } /* Read Block */ - sizeCheck = fread(in_buff, 1, blockSize, finput); - if (sizeCheck!=blockSize) EXM_THROW(52, "Read error : cannot access compressed block !"); + { size_t const sizeCheck = fread(in_buff, 1, blockSize, finput); + if (sizeCheck!=blockSize) EXM_THROW(52, "Read error : cannot access compressed block !"); } /* Decode Block */ decodeSize = LZ4_decompress_safe(in_buff, out_buff, blockSize, LEGACY_BLOCKSIZE); -- cgit v0.12