summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2014-07-13 20:24:29 (GMT)
committerBrad King <brad.king@kitware.com>2014-07-23 14:34:55 (GMT)
commitb2a07ca49c66665f5b51b592f44ecc4f66c7556b (patch)
treede0cd056692b88088e1b21f5bdf96afd781d52e2
parentd44ad1612bfe01891bb16b4289f5fa5a2e29a546 (diff)
downloadCMake-b2a07ca49c66665f5b51b592f44ecc4f66c7556b.zip
CMake-b2a07ca49c66665f5b51b592f44ecc4f66c7556b.tar.gz
CMake-b2a07ca49c66665f5b51b592f44ecc4f66c7556b.tar.bz2
liblzma: Add CMake build system
Modify sources just enough to build without the full xz common directory.
-rw-r--r--Utilities/cmliblzma/CMakeLists.txt195
-rw-r--r--Utilities/cmliblzma/common/sysdefs.h4
-rw-r--r--Utilities/cmliblzma/common/tuklib_integer.h10
-rw-r--r--Utilities/cmliblzma/config.h.in283
-rw-r--r--Utilities/cmliblzma/liblzma/common/common.h1
-rw-r--r--Utilities/cmliblzma/liblzma/liblzma_w32res.rc2
-rw-r--r--Utilities/cmliblzma/liblzma/rangecoder/range_common.h4
7 files changed, 491 insertions, 8 deletions
diff --git a/Utilities/cmliblzma/CMakeLists.txt b/Utilities/cmliblzma/CMakeLists.txt
new file mode 100644
index 0000000..85efa8c
--- /dev/null
+++ b/Utilities/cmliblzma/CMakeLists.txt
@@ -0,0 +1,195 @@
+PROJECT(CMLIBLZMA C)
+
+include(CheckCSourceCompiles)
+include(CheckIncludeFile)
+include(CheckSymbolExists)
+include(CheckTypeSize)
+include(TestBigEndian)
+
+CHECK_C_SOURCE_COMPILES(
+ "int test (void *restrict x);\nint main (void) {return 0;}"
+ HAVE_RESTRICT)
+
+CHECK_C_SOURCE_COMPILES(
+"typedef struct abc *d;\nint test (d __restrict x);\nint main (void) {return 0;}"
+ HAVE___RESTRICT)
+
+CHECK_C_SOURCE_COMPILES(
+ "inline int test (void) {return 0;}\nint main (void) {return test();}"
+ HAVE_INLINE)
+
+CHECK_C_SOURCE_COMPILES (
+ "__inline int test (void) {return 0;}\nint main (void) {return test();}"
+ HAVE___INLINE)
+
+CHECK_INCLUDE_FILE(byteswap.h HAVE_BYTESWAP_H)
+CHECK_INCLUDE_FILE(inttypes.h HAVE_INTTYPES_H)
+CHECK_INCLUDE_FILE(limits.h HAVE_LIMITS_H)
+CHECK_INCLUDE_FILE(memory.h HAVE_MEMORY_H)
+CHECK_INCLUDE_FILE(stdbool.h HAVE_STDBOOL_H)
+CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H)
+CHECK_INCLUDE_FILE(string.h HAVE_STRING_H)
+CHECK_INCLUDE_FILE(sys/sysctl.h HAVE_SYS_SYSCTL_H)
+
+CHECK_SYMBOL_EXISTS(bswap_16 byteswap.h HAVE_BSWAP_16)
+CHECK_SYMBOL_EXISTS(bswap_32 byteswap.h HAVE_BSWAP_32)
+CHECK_SYMBOL_EXISTS(bswap_64 byteswap.h HAVE_BSWAP_64)
+
+TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
+
+set(HAVE_CHECK_CRC64 1)
+set(HAVE_CHECK_SHA256 1)
+
+set(HAVE_DECODER_ARM 1)
+set(HAVE_DECODER_ARMTHUMB 1)
+set(HAVE_DECODER_DELTA 1)
+set(HAVE_DECODER_IA64 1)
+set(HAVE_DECODER_LZMA1 1)
+set(HAVE_DECODER_LZMA2 1)
+set(HAVE_DECODER_POWERPC 1)
+set(HAVE_DECODER_SPARC 1)
+set(HAVE_DECODER_X86 1)
+
+set(HAVE_ENCODER_ARM 1)
+set(HAVE_ENCODER_ARMTHUMB 1)
+set(HAVE_ENCODER_DELTA 1)
+set(HAVE_ENCODER_IA64 1)
+set(HAVE_ENCODER_LZMA1 1)
+set(HAVE_ENCODER_LZMA2 1)
+set(HAVE_ENCODER_POWERPC 1)
+set(HAVE_ENCODER_SPARC 1)
+set(HAVE_ENCODER_X86 1)
+
+set(HAVE_MF_BT2 1)
+set(HAVE_MF_BT3 1)
+set(HAVE_MF_BT4 1)
+set(HAVE_MF_HC3 1)
+set(HAVE_MF_HC4 1)
+
+CHECK_TYPE_SIZE(int16_t INT16_T)
+CHECK_TYPE_SIZE(int32_t INT32_T)
+CHECK_TYPE_SIZE(int64_t INT64_T)
+CHECK_TYPE_SIZE(intmax_t INTMAX_T)
+CHECK_TYPE_SIZE(uint8_t UINT8_T)
+CHECK_TYPE_SIZE(uint16_t UINT16_T)
+CHECK_TYPE_SIZE(uint32_t UINT32_T)
+CHECK_TYPE_SIZE(uint64_t UINT64_T)
+CHECK_TYPE_SIZE(uintmax_t UINTMAX_T)
+
+CHECK_TYPE_SIZE("short" SIZE_OF_SHORT)
+CHECK_TYPE_SIZE("int" SIZE_OF_INT)
+CHECK_TYPE_SIZE("long" SIZE_OF_LONG)
+CHECK_TYPE_SIZE("long long" SIZE_OF_LONG_LONG)
+
+CHECK_TYPE_SIZE("unsigned short" SIZE_OF_UNSIGNED_SHORT)
+CHECK_TYPE_SIZE("unsigned" SIZE_OF_UNSIGNED)
+CHECK_TYPE_SIZE("unsigned long" SIZE_OF_UNSIGNED_LONG)
+CHECK_TYPE_SIZE("unsigned long long" SIZE_OF_UNSIGNED_LONG_LONG)
+
+CHECK_TYPE_SIZE("__int64" __INT64)
+CHECK_TYPE_SIZE("unsigned __int64" UNSIGNED___INT64)
+
+CHECK_TYPE_SIZE(uintptr_t UINTPTR_T)
+IF(NOT HAVE_UINTPTR_T)
+ IF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
+ SET(uintptr_t "uint64_t")
+ ELSE()
+ SET(uintptr_t "uint32_t")
+ ENDIF()
+ENDIF()
+
+
+SET(LZMA_SRCS
+ common/sysdefs.h
+ common/tuklib_integer.h
+ liblzma/check/check.c
+ liblzma/check/crc32_fast.c
+ liblzma/check/crc32_table.c
+ liblzma/check/crc64_fast.c
+ liblzma/check/crc64_table.c
+ liblzma/check/sha256.c
+ liblzma/common/alone_decoder.c
+ liblzma/common/alone_encoder.c
+ liblzma/common/auto_decoder.c
+ liblzma/common/block_buffer_decoder.c
+ liblzma/common/block_buffer_encoder.c
+ liblzma/common/block_decoder.c
+ liblzma/common/block_encoder.c
+ liblzma/common/block_header_decoder.c
+ liblzma/common/block_header_encoder.c
+ liblzma/common/block_util.c
+ liblzma/common/common.c
+ liblzma/common/easy_buffer_encoder.c
+ liblzma/common/easy_decoder_memusage.c
+ liblzma/common/easy_encoder.c
+ liblzma/common/easy_encoder_memusage.c
+ liblzma/common/easy_preset.c
+ liblzma/common/filter_buffer_decoder.c
+ liblzma/common/filter_buffer_encoder.c
+ liblzma/common/filter_common.c
+ liblzma/common/filter_decoder.c
+ liblzma/common/filter_encoder.c
+ liblzma/common/filter_flags_decoder.c
+ liblzma/common/filter_flags_encoder.c
+ liblzma/common/index.c
+ liblzma/common/index_decoder.c
+ liblzma/common/index_encoder.c
+ liblzma/common/index_hash.c
+ liblzma/common/stream_buffer_decoder.c
+ liblzma/common/stream_buffer_encoder.c
+ liblzma/common/stream_decoder.c
+ liblzma/common/stream_encoder.c
+ liblzma/common/stream_flags_common.c
+ liblzma/common/stream_flags_decoder.c
+ liblzma/common/stream_flags_encoder.c
+ liblzma/common/vli_decoder.c
+ liblzma/common/vli_encoder.c
+ liblzma/common/vli_size.c
+ liblzma/delta/delta_common.c
+ liblzma/delta/delta_decoder.c
+ liblzma/delta/delta_encoder.c
+ liblzma/lz/lz_decoder.c
+ liblzma/lz/lz_encoder.c
+ liblzma/lz/lz_encoder_mf.c
+ liblzma/lzma/fastpos_table.c
+ liblzma/lzma/lzma2_decoder.c
+ liblzma/lzma/lzma2_encoder.c
+ liblzma/lzma/lzma_decoder.c
+ liblzma/lzma/lzma_encoder.c
+ liblzma/lzma/lzma_encoder_optimum_fast.c
+ liblzma/lzma/lzma_encoder_optimum_normal.c
+ liblzma/lzma/lzma_encoder_presets.c
+ liblzma/rangecoder/price_table.c
+ liblzma/simple/arm.c
+ liblzma/simple/armthumb.c
+ liblzma/simple/ia64.c
+ liblzma/simple/powerpc.c
+ liblzma/simple/simple_coder.c
+ liblzma/simple/simple_decoder.c
+ liblzma/simple/simple_encoder.c
+ liblzma/simple/sparc.c
+ liblzma/simple/x86.c
+ )
+
+IF(WIN32 AND BUILD_SHARED_LIBS)
+ SET(LZMA_SRCS ${LZMA_SRCS} liblzma/liblzma_w32res.rc)
+ENDIF()
+
+CONFIGURE_FILE(config.h.in config.h @ONLY)
+
+INCLUDE_DIRECTORIES(
+ "${CMLIBLZMA_SOURCE_DIR}/common"
+ "${CMLIBLZMA_SOURCE_DIR}/liblzma/api"
+ "${CMLIBLZMA_SOURCE_DIR}/liblzma/check"
+ "${CMLIBLZMA_SOURCE_DIR}/liblzma/common"
+ "${CMLIBLZMA_SOURCE_DIR}/liblzma/delta"
+ "${CMLIBLZMA_SOURCE_DIR}/liblzma/lz"
+ "${CMLIBLZMA_SOURCE_DIR}/liblzma/lzma"
+ "${CMLIBLZMA_SOURCE_DIR}/liblzma/rangecoder"
+ "${CMLIBLZMA_SOURCE_DIR}/liblzma/simple"
+ "${CMLIBLZMA_BINARY_DIR}"
+ )
+
+ADD_LIBRARY(cmliblzma ${LZMA_SRCS})
+
+INSTALL(FILES COPYING DESTINATION ${CMAKE_DOC_DIR}/cmliblzma)
diff --git a/Utilities/cmliblzma/common/sysdefs.h b/Utilities/cmliblzma/common/sysdefs.h
index 5ea6bda..5beda5c 100644
--- a/Utilities/cmliblzma/common/sysdefs.h
+++ b/Utilities/cmliblzma/common/sysdefs.h
@@ -20,9 +20,7 @@
// Includes //
//////////////
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include "config.h"
// Get standard-compliant stdio functions under MinGW and MinGW-w64.
#ifdef __MINGW32__
diff --git a/Utilities/cmliblzma/common/tuklib_integer.h b/Utilities/cmliblzma/common/tuklib_integer.h
index e6daa77..1897438 100644
--- a/Utilities/cmliblzma/common/tuklib_integer.h
+++ b/Utilities/cmliblzma/common/tuklib_integer.h
@@ -41,7 +41,15 @@
#ifndef TUKLIB_INTEGER_H
#define TUKLIB_INTEGER_H
-#include "tuklib_common.h"
+#include "sysdefs.h"
+
+#if defined(__GNUC__) && defined(__GNUC_MINOR__)
+# define TUKLIB_GNUC_REQ(major, minor) \
+ ((__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)) \
+ || __GNUC__ > (major))
+#else
+# define TUKLIB_GNUC_REQ(major, minor) 0
+#endif
////////////////////////////////////////
diff --git a/Utilities/cmliblzma/config.h.in b/Utilities/cmliblzma/config.h.in
new file mode 100644
index 0000000..391bb87
--- /dev/null
+++ b/Utilities/cmliblzma/config.h.in
@@ -0,0 +1,283 @@
+
+/*
+ * Ensure we have C99-style int64_t, etc, all defined.
+ */
+
+/* First, we need to know if the system has already defined them. */
+#cmakedefine HAVE_INT16_T
+#cmakedefine HAVE_INT32_T
+#cmakedefine HAVE_INT64_T
+#cmakedefine HAVE_INTMAX_T
+
+#cmakedefine HAVE_UINT8_T
+#cmakedefine HAVE_UINT16_T
+#cmakedefine HAVE_UINT32_T
+#cmakedefine HAVE_UINT64_T
+#cmakedefine HAVE_UINTMAX_T
+
+/* We might have the types we want under other spellings. */
+#cmakedefine HAVE___INT64
+#cmakedefine HAVE_U_INT64_T
+#cmakedefine HAVE_UNSIGNED___INT64
+
+/* The sizes of various standard integer types. */
+@SIZE_OF_SHORT_CODE@
+@SIZE_OF_INT_CODE@
+@SIZE_OF_LONG_CODE@
+@SIZE_OF_LONG_LONG_CODE@
+@SIZE_OF_UNSIGNED_SHORT_CODE@
+@SIZE_OF_UNSIGNED_CODE@
+@SIZE_OF_UNSIGNED_LONG_CODE@
+@SIZE_OF_UNSIGNED_LONG_LONG_CODE@
+
+/*
+ * If we lack int64_t, define it to the first of __int64, int, long, and long long
+ * that exists and is the right size.
+ */
+#if !defined(HAVE_INT64_T) && defined(HAVE___INT64)
+typedef __int64 int64_t;
+#define HAVE_INT64_T
+#endif
+
+#if !defined(HAVE_INT64_T) && SIZE_OF_INT == 8
+typedef int int64_t;
+#define HAVE_INT64_T
+#endif
+
+#if !defined(HAVE_INT64_T) && SIZE_OF_LONG == 8
+typedef long int64_t;
+#define HAVE_INT64_T
+#endif
+
+#if !defined(HAVE_INT64_T) && SIZE_OF_LONG_LONG == 8
+typedef long long int64_t;
+#define HAVE_INT64_T
+#endif
+
+#if !defined(HAVE_INT64_T)
+#error No 64-bit integer type was found.
+#endif
+
+/*
+ * Similarly for int32_t
+ */
+#if !defined(HAVE_INT32_T) && SIZE_OF_INT == 4
+typedef int int32_t;
+#define HAVE_INT32_T
+#endif
+
+#if !defined(HAVE_INT32_T) && SIZE_OF_LONG == 4
+typedef long int32_t;
+#define HAVE_INT32_T
+#endif
+
+#if !defined(HAVE_INT32_T)
+#error No 32-bit integer type was found.
+#endif
+
+/*
+ * Similarly for int16_t
+ */
+#if !defined(HAVE_INT16_T) && SIZE_OF_INT == 2
+typedef int int16_t;
+#define HAVE_INT16_T
+#endif
+
+#if !defined(HAVE_INT16_T) && SIZE_OF_SHORT == 2
+typedef short int16_t;
+#define HAVE_INT16_T
+#endif
+
+#if !defined(HAVE_INT16_T)
+#error No 16-bit integer type was found.
+#endif
+
+/*
+ * Similarly for uint64_t
+ */
+#if !defined(HAVE_UINT64_T) && defined(HAVE_UNSIGNED___INT64)
+typedef unsigned __int64 uint64_t;
+#define HAVE_UINT64_T
+#endif
+
+#if !defined(HAVE_UINT64_T) && SIZE_OF_UNSIGNED == 8
+typedef unsigned uint64_t;
+#define HAVE_UINT64_T
+#endif
+
+#if !defined(HAVE_UINT64_T) && SIZE_OF_UNSIGNED_LONG == 8
+typedef unsigned long uint64_t;
+#define HAVE_UINT64_T
+#endif
+
+#if !defined(HAVE_UINT64_T) && SIZE_OF_UNSIGNED_LONG_LONG == 8
+typedef unsigned long long uint64_t;
+#define HAVE_UINT64_T
+#endif
+
+#if !defined(HAVE_UINT64_T)
+#error No 64-bit unsigned integer type was found.
+#endif
+
+/*
+ * Similarly for uint32_t
+ */
+#if !defined(HAVE_UINT32_T) && SIZE_OF_UNSIGNED == 4
+typedef unsigned uint32_t;
+#define HAVE_UINT32_T
+#endif
+
+#if !defined(HAVE_UINT32_T) && SIZE_OF_UNSIGNED_LONG == 4
+typedef unsigned long uint32_t;
+#define HAVE_UINT32_T
+#endif
+
+#if !defined(HAVE_UINT32_T)
+#error No 32-bit unsigned integer type was found.
+#endif
+
+/*
+ * Similarly for uint16_t
+ */
+#if !defined(HAVE_UINT16_T) && SIZE_OF_UNSIGNED == 2
+typedef unsigned uint16_t;
+#define HAVE_UINT16_T
+#endif
+
+#if !defined(HAVE_UINT16_T) && SIZE_OF_UNSIGNED_SHORT == 2
+typedef unsigned short uint16_t;
+#define HAVE_UINT16_T
+#endif
+
+#if !defined(HAVE_UINT16_T)
+#error No 16-bit unsigned integer type was found.
+#endif
+
+/*
+ * Similarly for uint8_t
+ */
+#if !defined(HAVE_UINT8_T)
+typedef unsigned char uint8_t;
+#define HAVE_UINT8_T
+#endif
+
+#if !defined(HAVE_UINT16_T)
+#error No 8-bit unsigned integer type was found.
+#endif
+
+/* Define intmax_t and uintmax_t if they are not already defined. */
+#if !defined(HAVE_INTMAX_T)
+typedef int64_t intmax_t;
+#define INTMAX_MIN INT64_MIN
+#define INTMAX_MAX INT64_MAX
+#endif
+
+#if !defined(HAVE_UINTMAX_T)
+typedef uint64_t uintmax_t;
+#endif
+
+
+#cmakedefine uintptr_t @uintptr_t@
+
+
+#cmakedefine HAVE_RESTRICT
+#cmakedefine HAVE___RESTRICT
+
+#cmakedefine HAVE_INLINE
+#cmakedefine HAVE___INLINE
+
+#ifndef HAVE_RESTRICT
+# ifdef HAVE___RESTRICT
+# define restrict __restrict
+# else
+# define restrict
+# endif
+#endif /* HAVE_RESTRICT */
+
+#ifndef HAVE_INLINE
+# ifdef HAVE___INLINE
+# define inline __inline
+# else
+# define inline
+# endif
+#endif /* HAVE_INLINE */
+
+
+#cmakedefine WORDS_BIGENDIAN 1
+
+#cmakedefine HAVE_BYTESWAP_H 1
+#cmakedefine HAVE_BSWAP_16 1
+#cmakedefine HAVE_BSWAP_32 1
+#cmakedefine HAVE_BSWAP_64 1
+
+
+#define HAVE_CHECK_CRC32 1
+#define HAVE_CHECK_CRC64 1
+#define HAVE_CHECK_SHA256 1
+
+#define HAVE_DECODER_ARM 1
+#define HAVE_DECODER_ARMTHUMB 1
+#define HAVE_DECODER_DELTA 1
+#define HAVE_DECODER_IA64 1
+#define HAVE_DECODER_LZMA1 1
+#define HAVE_DECODER_LZMA2 1
+#define HAVE_DECODER_POWERPC 1
+#define HAVE_DECODER_SPARC 1
+#define HAVE_DECODER_X86 1
+
+#define HAVE_ENCODER_ARM 1
+#define HAVE_ENCODER_ARMTHUMB 1
+#define HAVE_ENCODER_DELTA 1
+#define HAVE_ENCODER_IA64 1
+#define HAVE_ENCODER_LZMA1 1
+#define HAVE_ENCODER_LZMA2 1
+#define HAVE_ENCODER_POWERPC 1
+#define HAVE_ENCODER_SPARC 1
+#define HAVE_ENCODER_X86 1
+
+#define HAVE_MF_BT2 1
+#define HAVE_MF_BT3 1
+#define HAVE_MF_BT4 1
+#define HAVE_MF_HC3 1
+#define HAVE_MF_HC4 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#cmakedefine HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <limits.h> header file. */
+#cmakedefine HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#cmakedefine HAVE_MEMORY_H 1
+
+/* Define to 1 if stdbool.h conforms to C99. */
+#cmakedefine HAVE_STDBOOL_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#cmakedefine HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#cmakedefine HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#cmakedefine HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/byteorder.h> header file. */
+#cmakedefine HAVE_SYS_BYTEORDER_H 1
+
+/* Define to 1 if you have the <sys/endian.h> header file. */
+#cmakedefine HAVE_SYS_ENDIAN_H 1
+
+/* Define to 1 or 0, depending whether the compiler supports simple visibility
+ declarations. */
+#cmakedefine HAVE_VISIBILITY 1
+
+/* Define to 1 if the system has the type `_Bool'. */
+#cmakedefine HAVE__BOOL 1
+
+/* The size of `size_t', as computed by sizeof. */
+#cmakedefine SIZEOF_SIZE_T @SIZEOF_SIZE_T@
+
+/* Define to 1 if the system supports fast unaligned access to 16-bit and
+ 32-bit integers. */
+#define TUKLIB_FAST_UNALIGNED_ACCESS 1
diff --git a/Utilities/cmliblzma/liblzma/common/common.h b/Utilities/cmliblzma/liblzma/common/common.h
index 45aba4f..6d7412f 100644
--- a/Utilities/cmliblzma/liblzma/common/common.h
+++ b/Utilities/cmliblzma/liblzma/common/common.h
@@ -14,7 +14,6 @@
#define LZMA_COMMON_H
#include "sysdefs.h"
-#include "mythread.h"
#include "tuklib_integer.h"
#if defined(_WIN32) || defined(__CYGWIN__)
diff --git a/Utilities/cmliblzma/liblzma/liblzma_w32res.rc b/Utilities/cmliblzma/liblzma/liblzma_w32res.rc
index d4d8159..773caf8 100644
--- a/Utilities/cmliblzma/liblzma/liblzma_w32res.rc
+++ b/Utilities/cmliblzma/liblzma/liblzma_w32res.rc
@@ -9,4 +9,6 @@
#define MY_NAME "liblzma"
#define MY_SUFFIX ".dll"
#define MY_DESC "liblzma data compression library"
+#define PACKAGE_NAME "XZ Utils"
+#define PACKAGE_URL "http://tukaani.org/xz/"
#include "common_w32res.rc"
diff --git a/Utilities/cmliblzma/liblzma/rangecoder/range_common.h b/Utilities/cmliblzma/liblzma/rangecoder/range_common.h
index 0e64241..2c74dc1 100644
--- a/Utilities/cmliblzma/liblzma/rangecoder/range_common.h
+++ b/Utilities/cmliblzma/liblzma/rangecoder/range_common.h
@@ -14,9 +14,7 @@
#ifndef LZMA_RANGE_COMMON_H
#define LZMA_RANGE_COMMON_H
-#ifdef HAVE_CONFIG_H
-# include "common.h"
-#endif
+#include "common.h"
///////////////