summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd>2014-01-07 18:47:50 (GMT)
committeryann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd>2014-01-07 18:47:50 (GMT)
commit648678788c751c0d89737dbb8b3144fa9d2c1592 (patch)
treee0e85353deca4f11bab61c46d94783a81c9e2ec5
parentfb38ddaacb150e05b9d73c2a08d052ce746e37ba (diff)
downloadlz4-648678788c751c0d89737dbb8b3144fa9d2c1592.zip
lz4-648678788c751c0d89737dbb8b3144fa9d2c1592.tar.gz
lz4-648678788c751c0d89737dbb8b3144fa9d2c1592.tar.bz2
Makefile : added capability to install libraries
Modified Directory tree, to better separate libraries from programs. git-svn-id: https://lz4.googlecode.com/svn/trunk@111 650e7d94-2a16-8b24-b05c-7c0b3f6821cd
-rw-r--r--LICENSE24
-rw-r--r--Makefile144
-rw-r--r--NEWS4
-rw-r--r--cmake/pack/CMakeLists.txt82
-rw-r--r--cmake/pack/release_COPYING.txt21
-rw-r--r--cmake_unofficial/CMakeLists.txt (renamed from cmake/CMakeLists.txt)161
-rw-r--r--lz4_format_description.txt240
-rw-r--r--programs/COPYING (renamed from COPYING)0
-rw-r--r--programs/Makefile100
-rw-r--r--programs/bench.c (renamed from bench.c)0
-rw-r--r--programs/bench.h (renamed from bench.h)0
-rw-r--r--programs/fullbench.c (renamed from fullbench.c)0
-rw-r--r--programs/fuzzer.c (renamed from fuzzer.c)0
-rw-r--r--programs/lz4.1 (renamed from lz4.1)0
-rw-r--r--programs/lz4cli.c (renamed from lz4cli.c)0
-rw-r--r--programs/xxhash.c (renamed from xxhash.c)0
-rw-r--r--programs/xxhash.h (renamed from xxhash.h)0
17 files changed, 401 insertions, 375 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..04403e4
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,24 @@
+LZ4 Library
+Copyright (c) 2013, Yann Collet
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice, this
+ list of conditions and the following disclaimer in the documentation and/or
+ other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file
diff --git a/Makefile b/Makefile
index 7625941..fd2b9be 100644
--- a/Makefile
+++ b/Makefile
@@ -1,110 +1,110 @@
# ################################################################
-# LZ4 Makefile
-# Copyright (C) Yann Collet 2011-2013
-# GPL v2 License
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
+# LZ4 library - Makefile
+# Copyright (C) Yann Collet 2011-2014
+# All rights reserved.
+#
+# BSD license
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright notice, this
+# list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
# You can contact the author at :
# - LZ4 source repository : http://code.google.com/p/lz4/
# - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c
# ################################################################
-# lz4 : Command Line Utility, supporting gzip-like arguments
-# lz4c : CLU, supporting also legacy lz4demo arguments
-# lz4c32: Same as lz4c, but forced to compile in 32-bits mode
-# fuzzer : Test tool, to check lz4 integrity on target platform
-# fuzzer32: Same as fuzzer, but forced to compile in 32-bits mode
-# fullbench : Precisely measure speed for each LZ4 function variant
-# fullbench32: Same as fullbench, but forced to compile in 32-bits mode
-# ################################################################
-RELEASE=r110
+RELEASE=r111
DESTDIR=
-PREFIX=${DESTDIR}/usr
-BINDIR=$(PREFIX)/bin
-MANDIR=$(PREFIX)/share/man/man1
-DISTRIBNAME=lz4-$(RELEASE).tar.gz
+PREFIX=/usr
CC=gcc
-CFLAGS=-I. -std=c99 -Wall -W -Wundef -DLZ4_VERSION=\"$(RELEASE)\"
+CFLAGS+= -I. -std=c99 -Wall -W -Wundef -DLZ4_VERSION=\"$(RELEASE)\"
+
+LIBDIR=$(PREFIX)/lib
+INCLUDEDIR=$(PREFIX)/include
+PRGDIR=programs
+DISTRIBNAME=lz4-$(RELEASE).tar.gz
+
# Define *.exe as extension for Windows systems
-# ifeq ($(OS),Windows_NT)
ifneq (,$(filter Windows%,$(OS)))
EXT =.exe
else
EXT =
endif
-TEXT = bench.c bench.h fullbench.c fuzzer.c lz4.1 lz4.c lz4cli.c \
- lz4_format_description.txt lz4.h lz4hc.c lz4hc.h \
- Makefile xxhash.c xxhash.h \
- NEWS COPYING \
- cmake/CMakeLists.txt cmake/pack/release_COPYING.txt \
- cmake/pack/CMakeLists.txt
+TEXT = lz4.c lz4.h lz4hc.c lz4hc.h \
+ lz4_format_description.txt Makefile NEWS LICENSE \
+ cmake_unofficial/CMakeLists.txt \
+ $(PRGDIR)/fullbench.c $(PRGDIR)/fuzzer.c $(PRGDIR)/lz4cli.c \
+ $(PRGDIR)/bench.c $(PRGDIR)/bench.h \
+ $(PRGDIR)/xxhash.c $(PRGDIR)/xxhash.h \
+ $(PRGDIR)/lz4.1 $(PRGDIR)/Makefile $(PRGDIR)/COPYING
NONTEXT = LZ4_Streaming_Format.odt
SOURCES = $(TEXT) $(NONTEXT)
-default: lz4 lz4c
-
-all: lz4 lz4c lz4c32 fuzzer fuzzer32 fullbench fullbench32
-
-lz4: lz4.c lz4hc.c bench.c xxhash.c lz4cli.c
- $(CC) -O3 $(CFLAGS) -DDISABLE_LZ4C_LEGACY_OPTIONS $^ -o $@$(EXT)
-
-lz4c : lz4.c lz4hc.c bench.c xxhash.c lz4cli.c
- $(CC) -O3 $(CFLAGS) $^ -o $@$(EXT)
+default: liblz4
-lz4c32: lz4.c lz4hc.c bench.c xxhash.c lz4cli.c
- $(CC) -m32 -O3 $(CFLAGS) $^ -o $@$(EXT)
+all: liblz4 lz4programs
-fuzzer : lz4.c lz4hc.c fuzzer.c
- @echo fuzzer is a test tool to check lz4 integrity on target platform
- $(CC) -O3 $(CFLAGS) $^ -o $@$(EXT)
+liblz4: liblz4.a liblz4.so
-fuzzer32: lz4.c lz4hc.c fuzzer.c
- $(CC) -m32 -O3 $(CFLAGS) $^ -o $@$(EXT)
+lz4programs: lz4.c lz4hc.c
+ @cd $(PRGDIR); make all
-fullbench : lz4.c lz4hc.c xxhash.c fullbench.c
- $(CC) -O3 $(CFLAGS) $^ -o $@$(EXT)
+liblz4.a: lz4.c lz4hc.c
+ $(CC) -O3 -c $(CFLAGS) $^
+ ar rcs liblz4.a lz4.o lz4hc.o
-fullbench32: lz4.c lz4hc.c xxhash.c fullbench.c
- $(CC) -m32 -O3 $(CFLAGS) $^ -o $@$(EXT)
+liblz4.so: lz4.c lz4hc.c lz4.h
+ $(CC) -shared -fPIC -Wl,--soname=liblz4.so.1 $(CFLAGS) -o $@
clean:
- @rm -f core *.o lz4$(EXT) lz4c$(EXT) lz4c32$(EXT) \
- fuzzer$(EXT) fuzzer32$(EXT) fullbench$(EXT) fullbench32$(EXT) \
- $(DISTRIBNAME)
+ @rm -f core *.o *.a *.so $(DISTRIBNAME)
+ @cd $(PRGDIR); make clean
@echo Cleaning completed
-ifeq ($(shell uname),Linux)
+#ifeq ($(shell uname),Linux)
+ifneq (,$(filter $(shell uname),Linux Darwin))
-install: lz4 lz4c
- @install -d -m 755 $(BINDIR)/ $(MANDIR)/
- @install -m 755 lz4 $(BINDIR)/lz4
- @install -m 755 lz4c $(BINDIR)/lz4c
- @install -m 644 lz4.1 $(MANDIR)/lz4.1
+install: liblz4
+ @install -d -m 755 $(DESTDIR)$(LIBDIR)/ $(DESTDIR)$(INCLUDEDIR)/
+ @install -m 755 liblz4.a $(DESTDIR)$(LIBDIR)/liblz4.a
+ @install -m 755 liblz4.so $(DESTDIR)$(LIBDIR)/liblz4.so
+ @install -m 755 lz4.h $(DESTDIR)$(INCLUDEDIR)/lz4.h
+ @install -m 755 lz4hc.h $(DESTDIR)$(INCLUDEDIR)/lz4hc.h
+ @echo lz4 static and shared library installed
+ @cd $(PRGDIR); make install
uninstall:
- [ -x $(BINDIR)/lz4 ] && rm -f $(BINDIR)/lz4
- [ -x $(BINDIR)/lz4c ] && rm -f $(BINDIR)/lz4c
- [ -f $(MANDIR)/lz4.1 ] && rm -f $(MANDIR)/lz4.1
+ [ -x $(DESTDIR)$(LIBDIR)/liblz4.a ] && rm -f $(DESTDIR)$(LIBDIR)/liblz4.a
+ [ -x $(DESTDIR)$(LIBDIR)/liblz4.so ] && rm -f $(DESTDIR)$(LIBDIR)/liblz4.so
+ [ -f $(DESTDIR)$(INCLUDEDIR)/lz4.h ] && rm -f lz4.h $(DESTDIR)$(INCLUDEDIR)/lz4.h
+ [ -f $(DESTDIR)$(INCLUDEDIR)/lz4hc.h ] && rm -f lz4.h $(DESTDIR)$(INCLUDEDIR)/lz4hc.h
+ @echo lz4 libraries successfully uninstalled
+ @cd $(PRGDIR); make uninstall
dist: clean
- @install -dD -m 700 lz4-$(RELEASE)/cmake/pack/
+ @install -dD -m 700 lz4-$(RELEASE)/programs/
+ @install -dD -m 700 lz4-$(RELEASE)/cmake_unofficial/
@for f in $(TEXT); do \
tr -d '\r' < $$f > .tmp; \
install -m 600 .tmp lz4-$(RELEASE)/$$f; \
diff --git a/NEWS b/NEWS
index 40a9377..8090f71 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+r111 :
+Makefile : added capability to install libraries
+Modified Directory tree, to better separate libraries from programs.
+
r110 :
lz4 & lz4hc : added capability to allocate state & stream state with custom allocator (issue 99)
fuzzer & fullbench : updated to test new functions
diff --git a/cmake/pack/CMakeLists.txt b/cmake/pack/CMakeLists.txt
deleted file mode 100644
index 7b93cba..0000000
--- a/cmake/pack/CMakeLists.txt
+++ /dev/null
@@ -1,82 +0,0 @@
-cmake_minimum_required (VERSION 2.8)
-PROJECT(LZ4)
-
-############################## CPACK
-set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../)
-set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LZ4 Packer")
-set(CPACK_PACKAGE_VERSION_MAJOR 0)
-set(CPACK_PACKAGE_VERSION_MINOR 0)
-set(CPACK_PACKAGE_VERSION_PATCH r107)
-#set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_BINARY_DIR}/COPYING_LGPL)
-##############################
-FIND_PACKAGE(Subversion)
-IF(SUBVERSION_FOUND)
- Subversion_WC_INFO(${SRC_DIR} revision)
- set(revision_MY_WC_STATUS "LZ4 has revision ${revision_WC_REVISION} at ${revision_WC_LAST_CHANGED_DATE}")
- message(STATUS ${revision_MY_WC_STATUS})
- if(NOT ${revision_WC_REVISION})
- else(NOT ${revision_WC_REVISION})
- set(CPACK_PACKAGE_VERSION_PATCH "r${revision_WC_REVISION}")
- endif(NOT ${revision_WC_REVISION})
-ELSE(SUBVERSION_FOUND)
- message(WARNING "NO Subversion FOUND!!!")
-ENDIF(SUBVERSION_FOUND)
-set(VERSION_STRING " \"${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}\" ")
-##############################
-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()
-############################### warnings
-
-ADD_DEFINITIONS("-Wall")
-ADD_DEFINITIONS("-W")
-ADD_DEFINITIONS("-Wundef")
-ADD_DEFINITIONS("-Wcast-align")
-ADD_DEFINITIONS("-Wno-implicit-function-declaration")
-ADD_DEFINITIONS("-O3 -march=native -std=c99")
-INCLUDE_DIRECTORIES (${SRC_DIR})
-
-
-
-set(LZ4_SRCS_LIB ${SRC_DIR}lz4.c ${SRC_DIR}lz4hc.c ${SRC_DIR}lz4.h ${SRC_DIR}lz4_format_description.txt)
-set(LZ4_SRCS ${LZ4_SRCS_LIB} ${SRC_DIR}xxhash.c ${SRC_DIR}bench.c ${SRC_DIR}lz4cli.c )
-set(FUZZER_SRCS ${SRC_DIR}lz4.c ${SRC_DIR}lz4hc.c ${SRC_DIR}lz4.h ${SRC_DIR}fuzzer.c)
-
-# EXECUTABLES FOR 32 Bit and 64 versions
-if(CMAKE_SYSTEM_PROCESSOR STREQUAL "64bit")
- add_executable(lz4c32 ${LZ4_SRCS})
- install(TARGETS lz4c32 RUNTIME DESTINATION "bin/")
-SET_TARGET_PROPERTIES(lz4c32 PROPERTIES
- COMPILE_FLAGS PROPERTIES COMPILE_FLAGS "-m32 -Os" LINK_FLAGS "-m32")
-endif()
-
-add_executable(lz4c ${LZ4_SRCS})
-install(TARGETS lz4c RUNTIME DESTINATION "bin/")
-
-add_executable(fuzzer ${FUZZER_SRCS})
-install(TARGETS fuzzer RUNTIME DESTINATION "bin/")
-
-#target_link_libraries(lz4 ${LZ4_SRCS_LIB})
-####################### CPACK PACKAGING ###################
-install(FILES ${SRC_DIR}lz4_format_description.txt DESTINATION "./")
-
-set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
-set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_LIST_DIR}/release_COPYING.txt")
-set(CPACK_PACKAGE_VENDOR "Yann Collet")
-set(CPACK_WWW_SITE "http://fastcompression.blogspot.com/p/lz4.html")
-set(CPACK_NSIS_URL_INFO_ABOUT "${CPACK_WWW_SITE}")
-set(CPACK_NSIS_HELP_LINK "${CPACK_WWW_SITE}")
-
-set(CPACK_NSIS_DISPLAY_NAME ${CPACK_PACKAGE_NAME})
-set(CPACK_NSIS_COMPRESSOR "/SOLID lzma \r\n SetCompressorDictSize 32")
-
-set(CPACK_NSIS_MENU_LINKS
- "${CPACK_WWW_SITE}" "${CPACK_PACKAGE_NAME} homepage"
- "/lz4_format_description.txt " "lz4 format description"
- "/" "LZ4 directory "
-)
-
-include (CPack)
diff --git a/cmake/pack/release_COPYING.txt b/cmake/pack/release_COPYING.txt
deleted file mode 100644
index 32cec0d..0000000
--- a/cmake/pack/release_COPYING.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-
- lz4demo and fuzzer is an open-source demo compression algorithm LZ4 programs
- Copyright (C) Yann Collet 2012
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
- You can contact the author at :
- - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html
- - LZ4 source repository : http://code.google.com/p/lz4/
diff --git a/cmake/CMakeLists.txt b/cmake_unofficial/CMakeLists.txt
index b922641..356f18a 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake_unofficial/CMakeLists.txt
@@ -1,80 +1,81 @@
-PROJECT(LZ4 C)
-set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LZ4 compression library")
-set(CPACK_PACKAGE_VERSION_MAJOR 0)
-set(CPACK_PACKAGE_VERSION_MINOR 0)
-set(CPACK_PACKAGE_VERSION_PATCH r110)
-#set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_BINARY_DIR}/COPYING_LGPL)
-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" OFF)
-
-if(UNIX AND BUILD_LIBS)
- if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
- add_definitions(-fPIC)
- endif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
-endif()
-
-set(SRC_DIR ../)
-set(LZ4_SRCS_LIB ${SRC_DIR}lz4.c ${SRC_DIR}lz4hc.c ${SRC_DIR}lz4.h )
-set(LZ4_SRCS ${SRC_DIR}xxhash.c ${SRC_DIR}bench.c ${SRC_DIR}lz4cli.c)
-
-if(BUILD_TOOLS AND NOT BUILD_LIBS)
- set(LZ4_SRCS ${LZ4_SRCS} ${LZ4_SRCS_LIB})
-endif()
-
-if(BUILD_TOOLS)
- add_executable(lz4 ${LZ4_SRCS})
- set_target_properties(lz4 PROPERTIES COMPILE_DEFINITIONS DISABLE_LZ4C_LEGACY_OPTIONS)
- install(TARGETS lz4 RUNTIME DESTINATION "bin/")
- add_executable(lz4c ${LZ4_SRCS})
- install(TARGETS lz4c RUNTIME DESTINATION "bin/")
-endif()
-
-if(BUILD_LIBS)
- add_library(liblz4 ${LZ4_SRCS_LIB})
-
- set_target_properties(liblz4 PROPERTIES
- OUTPUT_NAME lz4
- SOVERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}"
- )
-
- install(TARGETS liblz4
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib
- )
-
- install(FILES
- ${SRC_DIR}/lz4.h
- ${SRC_DIR}/lz4hc.h
- DESTINATION include
- )
-
- if(BUILD_TOOLS)
- target_link_libraries(lz4 liblz4)
- target_link_libraries(lz4c liblz4)
- endif()
-endif()
-
-
-#warnings
-
-ADD_DEFINITIONS("-Wall")
-ADD_DEFINITIONS("-W")
-ADD_DEFINITIONS("-Wundef")
-ADD_DEFINITIONS("-Wcast-align")
-ADD_DEFINITIONS("-std=c99")
-ADD_DEFINITIONS("-DLZ4_VERSION=\"${CPACK_PACKAGE_VERSION_PATCH}\"")
-INCLUDE_DIRECTORIES (${SRC_DIR})
-
-
-
+PROJECT(LZ4 C)
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LZ4 compression library")
+set(CPACK_PACKAGE_VERSION_MAJOR 0)
+set(CPACK_PACKAGE_VERSION_MINOR 0)
+set(CPACK_PACKAGE_VERSION_PATCH r111)
+#set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_BINARY_DIR}/COPYING_LGPL)
+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" OFF)
+
+if(UNIX AND BUILD_LIBS)
+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
+ add_definitions(-fPIC)
+ endif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
+endif()
+
+set(LZ4_DIR ../)
+set(PRG_DIR ../programs/)
+set(LZ4_SRCS_LIB ${LZ4_DIR}lz4.c ${LZ4_DIR}lz4hc.c ${LZ4_DIR}lz4.h ${LZ4_DIR}lz4hc.h)
+set(LZ4_SRCS ${PRG_DIR}xxhash.c ${PRG_DIR}bench.c ${PRG_DIR}lz4cli.c)
+
+if(BUILD_TOOLS AND NOT BUILD_LIBS)
+ set(LZ4_SRCS ${LZ4_SRCS} ${LZ4_SRCS_LIB})
+endif()
+
+if(BUILD_TOOLS)
+ add_executable(lz4 ${LZ4_SRCS})
+ set_target_properties(lz4 PROPERTIES COMPILE_DEFINITIONS DISABLE_LZ4C_LEGACY_OPTIONS)
+ install(TARGETS lz4 RUNTIME DESTINATION "bin/")
+ add_executable(lz4c ${LZ4_SRCS})
+ install(TARGETS lz4c RUNTIME DESTINATION "bin/")
+endif()
+
+if(BUILD_LIBS)
+ add_library(liblz4 ${LZ4_SRCS_LIB})
+
+ set_target_properties(liblz4 PROPERTIES
+ OUTPUT_NAME lz4
+ SOVERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}"
+ )
+
+ install(TARGETS liblz4
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+ )
+
+ install(FILES
+ ${LZ4_DIR}/lz4.h
+ ${LZ4_DIR}/lz4hc.h
+ DESTINATION include
+ )
+
+ if(BUILD_TOOLS)
+ target_link_libraries(lz4 liblz4)
+ target_link_libraries(lz4c liblz4)
+ endif()
+endif()
+
+
+#warnings
+
+ADD_DEFINITIONS("-Wall")
+ADD_DEFINITIONS("-W")
+ADD_DEFINITIONS("-Wundef")
+ADD_DEFINITIONS("-Wcast-align")
+ADD_DEFINITIONS("-std=c99")
+ADD_DEFINITIONS("-DLZ4_VERSION=\"${CPACK_PACKAGE_VERSION_PATCH}\"")
+INCLUDE_DIRECTORIES (${LZ4_DIR})
+
+
+
diff --git a/lz4_format_description.txt b/lz4_format_description.txt
index 888c57b..2c424c5 100644
--- a/lz4_format_description.txt
+++ b/lz4_format_description.txt
@@ -1,120 +1,120 @@
-LZ4 Format Description
-Last revised: 2012-02-27
-Author : Y. Collet
-
-
-
-This small specification intents to provide enough information
-to anyone willing to produce LZ4-compatible compressed data blocks
-using any programming language.
-
-LZ4 is an LZ77-type compressor with a fixed, byte-oriented encoding.
-The most important design principle behind LZ4 is simplicity.
-It helps to create an easy to read and maintain source code.
-It also helps later on for optimisations, compactness, and speed.
-There is no entropy encoder backend nor framing layer.
-The latter is assumed to be handled by other parts of the system.
-
-This document only describes the format,
-not how the LZ4 compressor nor decompressor actually work.
-The correctness of the decompressor should not depend
-on implementation details of the compressor, and vice versa.
-
-
-
--- Compressed block format --
-
-An LZ4 compressed block is composed of sequences.
-Schematically, a sequence is a suite of literals, followed by a match copy.
-
-Each sequence starts with a token.
-The token is a one byte value, separated into two 4-bits fields.
-Therefore each field ranges from 0 to 15.
-
-
-The first field uses the 4 high-bits of the token.
-It provides the length of literals to follow.
-(Note : a literal is a not-compressed byte).
-If the field value is 0, then there is no literal.
-If it is 15, then we need to add some more bytes to indicate the full length.
-Each additionnal byte then represent a value from 0 to 255,
-which is added to the previous value to produce a total length.
-When the byte value is 255, another byte is output.
-There can be any number of bytes following the token. There is no "size limit".
-(Sidenote this is why a not-compressible input block is expanded by 0.4%).
-
-Example 1 : A length of 48 will be represented as :
-- 15 : value for the 4-bits High field
-- 33 : (=48-15) remaining length to reach 48
-
-Example 2 : A length of 280 will be represented as :
-- 15 : value for the 4-bits High field
-- 255 : following byte is maxed, since 280-15 >= 255
-- 10 : (=280 - 15 - 255) ) remaining length to reach 280
-
-Example 3 : A length of 15 will be represented as :
-- 15 : value for the 4-bits High field
-- 0 : (=15-15) yes, the zero must be output
-
-Following the token and optional length bytes, are the literals themselves.
-They are exactly as numerous as previously decoded (length of literals).
-It's possible that there are zero literal.
-
-
-Following the literals is the match copy operation.
-
-It starts by the offset.
-This is a 2 bytes value, in little endian format.
-
-The offset represents the position of the match to be copied from.
-1 means "current position - 1 byte".
-The maximum offset value is 65535, 65536 cannot be coded.
-Note that 0 is an invalid value, not used.
-
-Then we need to extract the match length.
-For this, we use the second token field, the low 4-bits.
-Value, obviously, ranges from 0 to 15.
-However here, 0 means that the copy operation will be minimal.
-The minimum length of a match, called minmatch, is 4.
-As a consequence, a 0 value means 4 bytes, and a value of 15 means 19+ bytes.
-Similar to literal length, on reaching the highest possible value (15),
-we output additional bytes, one at a time, with values ranging from 0 to 255.
-They are added to total to provide the final match length.
-A 255 value means there is another byte to read and add.
-There is no limit to the number of optional bytes that can be output this way.
-(This points towards a maximum achievable compression ratio of ~250).
-
-With the offset and the matchlength,
-the decoder can now proceed to copy the data from the already decoded buffer.
-On decoding the matchlength, we reach the end of the compressed sequence,
-and therefore start another one.
-
-
--- Parsing restrictions --
-
-There are specific parsing rules to respect in order to remain compatible
-with assumptions made by the decoder :
-1) The last 5 bytes are always literals
-2) The last match must start at least 12 bytes before end of block
-Consequently, a block with less than 13 bytes cannot be compressed.
-These rules are in place to ensure that the decoder
-will never read beyond the input buffer, nor write beyond the output buffer.
-
-Note that the last sequence is also incomplete,
-and stops right after literals.
-
-
--- Additional notes --
-
-There is no assumption nor limits to the way the compressor
-searches and selects matches within the source data block.
-It could be a fast scan, a multi-probe, a full search using BST,
-standard hash chains or MMC, well whatever.
-
-Advanced parsing strategies can also be implemented, such as lazy match,
-or full optimal parsing.
-
-All these trade-off offer distinctive speed/memory/compression advantages.
-Whatever the method used by the compressor, its result will be decodable
-by any LZ4 decoder if it follows the format specification described above.
-
+LZ4 Format Description
+Last revised: 2012-02-27
+Author : Y. Collet
+
+
+
+This small specification intents to provide enough information
+to anyone willing to produce LZ4-compatible compressed data blocks
+using any programming language.
+
+LZ4 is an LZ77-type compressor with a fixed, byte-oriented encoding.
+The most important design principle behind LZ4 is simplicity.
+It helps to create an easy to read and maintain source code.
+It also helps later on for optimisations, compactness, and speed.
+There is no entropy encoder backend nor framing layer.
+The latter is assumed to be handled by other parts of the system.
+
+This document only describes the format,
+not how the LZ4 compressor nor decompressor actually work.
+The correctness of the decompressor should not depend
+on implementation details of the compressor, and vice versa.
+
+
+
+-- Compressed block format --
+
+An LZ4 compressed block is composed of sequences.
+Schematically, a sequence is a suite of literals, followed by a match copy.
+
+Each sequence starts with a token.
+The token is a one byte value, separated into two 4-bits fields.
+Therefore each field ranges from 0 to 15.
+
+
+The first field uses the 4 high-bits of the token.
+It provides the length of literals to follow.
+(Note : a literal is a not-compressed byte).
+If the field value is 0, then there is no literal.
+If it is 15, then we need to add some more bytes to indicate the full length.
+Each additionnal byte then represent a value from 0 to 255,
+which is added to the previous value to produce a total length.
+When the byte value is 255, another byte is output.
+There can be any number of bytes following the token. There is no "size limit".
+(Sidenote this is why a not-compressible input block is expanded by 0.4%).
+
+Example 1 : A length of 48 will be represented as :
+- 15 : value for the 4-bits High field
+- 33 : (=48-15) remaining length to reach 48
+
+Example 2 : A length of 280 will be represented as :
+- 15 : value for the 4-bits High field
+- 255 : following byte is maxed, since 280-15 >= 255
+- 10 : (=280 - 15 - 255) ) remaining length to reach 280
+
+Example 3 : A length of 15 will be represented as :
+- 15 : value for the 4-bits High field
+- 0 : (=15-15) yes, the zero must be output
+
+Following the token and optional length bytes, are the literals themselves.
+They are exactly as numerous as previously decoded (length of literals).
+It's possible that there are zero literal.
+
+
+Following the literals is the match copy operation.
+
+It starts by the offset.
+This is a 2 bytes value, in little endian format.
+
+The offset represents the position of the match to be copied from.
+1 means "current position - 1 byte".
+The maximum offset value is 65535, 65536 cannot be coded.
+Note that 0 is an invalid value, not used.
+
+Then we need to extract the match length.
+For this, we use the second token field, the low 4-bits.
+Value, obviously, ranges from 0 to 15.
+However here, 0 means that the copy operation will be minimal.
+The minimum length of a match, called minmatch, is 4.
+As a consequence, a 0 value means 4 bytes, and a value of 15 means 19+ bytes.
+Similar to literal length, on reaching the highest possible value (15),
+we output additional bytes, one at a time, with values ranging from 0 to 255.
+They are added to total to provide the final match length.
+A 255 value means there is another byte to read and add.
+There is no limit to the number of optional bytes that can be output this way.
+(This points towards a maximum achievable compression ratio of ~250).
+
+With the offset and the matchlength,
+the decoder can now proceed to copy the data from the already decoded buffer.
+On decoding the matchlength, we reach the end of the compressed sequence,
+and therefore start another one.
+
+
+-- Parsing restrictions --
+
+There are specific parsing rules to respect in order to remain compatible
+with assumptions made by the decoder :
+1) The last 5 bytes are always literals
+2) The last match must start at least 12 bytes before end of block
+Consequently, a block with less than 13 bytes cannot be compressed.
+These rules are in place to ensure that the decoder
+will never read beyond the input buffer, nor write beyond the output buffer.
+
+Note that the last sequence is also incomplete,
+and stops right after literals.
+
+
+-- Additional notes --
+
+There is no assumption nor limits to the way the compressor
+searches and selects matches within the source data block.
+It could be a fast scan, a multi-probe, a full search using BST,
+standard hash chains or MMC, well whatever.
+
+Advanced parsing strategies can also be implemented, such as lazy match,
+or full optimal parsing.
+
+All these trade-off offer distinctive speed/memory/compression advantages.
+Whatever the method used by the compressor, its result will be decodable
+by any LZ4 decoder if it follows the format specification described above.
+
diff --git a/COPYING b/programs/COPYING
index d159169..d159169 100644
--- a/COPYING
+++ b/programs/COPYING
diff --git a/programs/Makefile b/programs/Makefile
new file mode 100644
index 0000000..2bc2902
--- /dev/null
+++ b/programs/Makefile
@@ -0,0 +1,100 @@
+# ################################################################
+# LZ4 programs - Makefile
+# Copyright (C) Yann Collet 2011-2014
+# GPL v2 License
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# You can contact the author at :
+# - LZ4 source repository : http://code.google.com/p/lz4/
+# - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c
+# ################################################################
+# lz4 : Command Line Utility, supporting gzip-like arguments
+# lz4c : CLU, supporting also legacy lz4demo arguments
+# lz4c32: Same as lz4c, but forced to compile in 32-bits mode
+# fuzzer : Test tool, to check lz4 integrity on target platform
+# fuzzer32: Same as fuzzer, but forced to compile in 32-bits mode
+# fullbench : Precisely measure speed for each LZ4 function variant
+# fullbench32: Same as fullbench, but forced to compile in 32-bits mode
+# ################################################################
+
+RELEASE=r111
+DESTDIR=
+PREFIX=/usr
+CC=gcc
+CFLAGS+= -I. -std=c99 -Wall -W -Wundef -DLZ4_VERSION=\"$(RELEASE)\"
+
+BINDIR=$(PREFIX)/bin
+MANDIR=$(PREFIX)/share/man/man1
+LZ4DIR=..
+
+
+# Define *.exe as extension for Windows systems
+ifneq (,$(filter Windows%,$(OS)))
+EXT =.exe
+else
+EXT =
+endif
+
+
+default: lz4 lz4c
+
+all: lz4 lz4c lz4c32 fuzzer fuzzer32 fullbench fullbench32
+
+lz4: $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c bench.c xxhash.c lz4cli.c
+ $(CC) -O3 $(CFLAGS) -DDISABLE_LZ4C_LEGACY_OPTIONS $^ -o $@$(EXT)
+
+lz4c : $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c bench.c xxhash.c lz4cli.c
+ $(CC) -O3 $(CFLAGS) $^ -o $@$(EXT)
+
+lz4c32: $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c bench.c xxhash.c lz4cli.c
+ $(CC) -m32 -O3 $(CFLAGS) $^ -o $@$(EXT)
+
+fuzzer : $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c fuzzer.c
+ @echo fuzzer is a test tool to check lz4 integrity on target platform
+ $(CC) -O3 $(CFLAGS) $^ -o $@$(EXT)
+
+fuzzer32: $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c fuzzer.c
+ $(CC) -m32 -O3 $(CFLAGS) $^ -o $@$(EXT)
+
+fullbench : $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c xxhash.c fullbench.c
+ $(CC) -O3 $(CFLAGS) $^ -o $@$(EXT)
+
+fullbench32: $(LZ4DIR)/lz4.c $(LZ4DIR)/lz4hc.c xxhash.c fullbench.c
+ $(CC) -m32 -O3 $(CFLAGS) $^ -o $@$(EXT)
+
+clean:
+ @rm -f core *.o \
+ lz4$(EXT) lz4c$(EXT) lz4c32$(EXT) \
+ fuzzer$(EXT) fuzzer32$(EXT) fullbench$(EXT) fullbench32$(EXT)
+ @echo Cleaning completed
+
+
+ifneq (,$(filter $(shell uname),Linux Darwin))
+
+install: lz4 lz4c
+ @install -d -m 755 $(DESTDIR)$(BINDIR)/ $(DESTDIR)$(MANDIR)/
+ @install -m 755 lz4 $(DESTDIR)$(BINDIR)/lz4
+ @install -m 755 lz4c $(DESTDIR)$(BINDIR)/lz4c
+ @install -m 644 lz4.1 $(DESTDIR)$(MANDIR)/lz4.1
+ @echo lz4 installation completed
+
+uninstall:
+ [ -x $(DESTDIR)$(BINDIR)/lz4 ] && rm -f $(DESTDIR)$(BINDIR)/lz4
+ [ -x $(DESTDIR)$(BINDIR)/lz4c ] && rm -f $(DESTDIR)$(BINDIR)/lz4c
+ [ -f $(DESTDIR)$(MANDIR)/lz4.1 ] && rm -f $(DESTDIR)$(MANDIR)/lz4.1
+ @echo lz4 successfully uninstalled
+
+endif
diff --git a/bench.c b/programs/bench.c
index df3c44a..df3c44a 100644
--- a/bench.c
+++ b/programs/bench.c
diff --git a/bench.h b/programs/bench.h
index ed801d4..ed801d4 100644
--- a/bench.h
+++ b/programs/bench.h
diff --git a/fullbench.c b/programs/fullbench.c
index c465c88..c465c88 100644
--- a/fullbench.c
+++ b/programs/fullbench.c
diff --git a/fuzzer.c b/programs/fuzzer.c
index 4513ebe..4513ebe 100644
--- a/fuzzer.c
+++ b/programs/fuzzer.c
diff --git a/lz4.1 b/programs/lz4.1
index 69c58c3..69c58c3 100644
--- a/lz4.1
+++ b/programs/lz4.1
diff --git a/lz4cli.c b/programs/lz4cli.c
index f69c8a0..f69c8a0 100644
--- a/lz4cli.c
+++ b/programs/lz4cli.c
diff --git a/xxhash.c b/programs/xxhash.c
index 8304ec2..8304ec2 100644
--- a/xxhash.c
+++ b/programs/xxhash.c
diff --git a/xxhash.h b/programs/xxhash.h
index a319bcc..a319bcc 100644
--- a/xxhash.h
+++ b/programs/xxhash.h