Permalink
Browse files

Add support xz format and compressing lzma format.

SVN-Revision: 521
  • Loading branch information...
1 parent 0c4a6ac commit c25e0da2e8d6091bea7ff1c86940808a0bd79eef @ggcueroad ggcueroad committed Jan 31, 2009
View
@@ -154,10 +154,15 @@ ENDIF(BZIP2_FOUND)
#
FIND_PACKAGE(LZMA)
IF(LZMA_FOUND)
- SET(HAVE_LIBLZMADEC 1)
- SET(HAVE_LZMADEC_H 1)
+ SET(HAVE_LIBLZMA 1)
+ SET(HAVE_LZMA_H 1)
INCLUDE_DIRECTORIES(${LZMA_INCLUDE_DIR})
LIST(APPEND ADDITIONAL_LIBS ${LZMA_LIBRARIES})
+ELSEIF(LZMADEC_FOUND)
+ SET(HAVE_LIBLZMADEC 1)
+ SET(HAVE_LZMADEC_H 1)
+ INCLUDE_DIRECTORIES(${LZMADEC_INCLUDE_DIR})
+ LIST(APPEND ADDITIONAL_LIBS ${LZMADEC_LIBRARIES})
ENDIF(LZMA_FOUND)
#
View
@@ -103,6 +103,7 @@ libarchive_la_SOURCES= \
libarchive/archive_read_support_compression_none.c \
libarchive/archive_read_support_compression_program.c \
libarchive/archive_read_support_compression_lzma.c \
+ libarchive/archive_read_support_compression_xz.c \
libarchive/archive_read_support_format_all.c \
libarchive/archive_read_support_format_ar.c \
libarchive/archive_read_support_format_cpio.c \
@@ -130,6 +131,7 @@ libarchive_la_SOURCES= \
libarchive/archive_write_set_compression_gzip.c \
libarchive/archive_write_set_compression_none.c \
libarchive/archive_write_set_compression_program.c \
+ libarchive/archive_write_set_compression_xz.c \
libarchive/archive_write_set_format.c \
libarchive/archive_write_set_format_ar.c \
libarchive/archive_write_set_format_by_name.c \
View
@@ -1,17 +1,20 @@
-# - Find lzma
+# - Find lzma and lzmadec
# Find the native LZMA includes and library
#
-# LZMA_INCLUDE_DIR - where to find zlib.h, etc.
-# LZMA_LIBRARIES - List of libraries when using zlib.
-# LZMA_FOUND - True if zlib found.
+# LZMA_INCLUDE_DIR - where to find lzma.h, etc.
+# LZMA_LIBRARIES - List of libraries when using liblzma.
+# LZMA_FOUND - True if liblzma found.
+# LZMADEC_INCLUDE_DIR - where to find lzmadec.h, etc.
+# LZMADEC_LIBRARIES - List of libraries when using liblzmadec.
+# LZMADEC_FOUND - True if liblzmadec found.
IF (LZMA_INCLUDE_DIR)
# Already in cache, be silent
SET(LZMA_FIND_QUIETLY TRUE)
ENDIF (LZMA_INCLUDE_DIR)
-FIND_PATH(LZMA_INCLUDE_DIR lzmadec.h)
-FIND_LIBRARY(LZMA_LIBRARY NAMES lzmadec )
+FIND_PATH(LZMA_INCLUDE_DIR lzma.h)
+FIND_LIBRARY(LZMA_LIBRARY NAMES lzma )
# handle the QUIETLY and REQUIRED arguments and set LZMA_FOUND to TRUE if
# all listed variables are TRUE
@@ -22,6 +25,28 @@ IF(LZMA_FOUND)
SET( LZMA_LIBRARIES ${LZMA_LIBRARY} )
ELSE(LZMA_FOUND)
SET( LZMA_LIBRARIES )
+
+ IF (LZMADEC_INCLUDE_DIR)
+ # Already in cache, be silent
+ SET(LZMADEC_FIND_QUIETLY TRUE)
+ ENDIF (LZMADEC_INCLUDE_DIR)
+
+ FIND_PATH(LZMADEC_INCLUDE_DIR lzmadec.h)
+ FIND_LIBRARY(LZMADEC_LIBRARY NAMES lzmadec )
+
+ # handle the QUIETLY and REQUIRED arguments and set LZMADEC_FOUND to TRUE if
+ # all listed variables are TRUE
+ INCLUDE(FindPackageHandleStandardArgs)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZMADEC DEFAULT_MSG LZMADEC_LIBRARY
+ LZMADEC_INCLUDE_DIR)
+
+ IF(LZMADEC_FOUND)
+ SET( LZMADEC_LIBRARIES ${LZMADEC_LIBRARY} )
+ ELSE(LZMADEC_FOUND)
+ SET( LZMADEC_LIBRARIES )
+ ENDIF(LZMADEC_FOUND)
ENDIF(LZMA_FOUND)
-MARK_AS_ADVANCED( LZMA_LIBRARY LZMA_INCLUDE_DIR )
+
+MARK_AS_ADVANCED( LZMA_LIBRARY LZMA_INCLUDE_DIR
+ LZMADEC_LIBRARY LZMADEC_INCLUDE_DIR )
View
@@ -211,6 +211,9 @@
/* Define to 1 if you have the `bz2' library (-lbz2). */
#cmakedefine HAVE_LIBBZ2 1
+/* Define to 1 if you have the `lzma' library (-llzma). */
+#cmakedefine HAVE_LIBLZMA 1
+
/* Define to 1 if you have the `lzmadec' library (-llzmadec). */
#cmakedefine HAVE_LIBLZMADEC 1
@@ -248,6 +251,9 @@
/* Define to 1 if you have the <lzmadec.h> header file. */
#cmakedefine HAVE_LZMADEC_H 1
+/* Define to 1 if you have the <lzma.h> header file. */
+#cmakedefine HAVE_LZMA_H 1
+
/* Define to 1 if you have the `MD5' functions. */
#cmakedefine HAVE_MD5 1
View
@@ -195,6 +195,14 @@ if test "x$with_lzmadec" != "xno"; then
AC_CHECK_LIB(lzmadec,lzmadec_decode)
fi
+AC_ARG_WITH([lzma],
+ AS_HELP_STRING([--without-lzma], [Don't build support for xz through lzma]))
+
+if test "x$with_lzma" != "xno"; then
+ AC_CHECK_HEADERS([lzma.h])
+ AC_CHECK_LIB(lzma,lzma_stream_decoder)
+fi
+
AC_CHECK_HEADERS([openssl/md5.h openssl/ripemd.h openssl/sha.h])
AC_CHECK_HEADERS([md5.h md5global.h])
AC_CHECK_HEADERS([ripemd.h rmd160.h])
View
@@ -231,6 +231,7 @@ typedef int archive_close_callback(struct archive *, void *_client_data);
#define ARCHIVE_COMPRESSION_COMPRESS 3
#define ARCHIVE_COMPRESSION_PROGRAM 4
#define ARCHIVE_COMPRESSION_LZMA 5
+#define ARCHIVE_COMPRESSION_XZ 6
/*
* Codes returned by archive_format.
@@ -301,6 +302,7 @@ __LA_DECL int archive_read_support_compression_lzma(struct archive *);
__LA_DECL int archive_read_support_compression_none(struct archive *);
__LA_DECL int archive_read_support_compression_program(struct archive *,
const char *command);
+__LA_DECL int archive_read_support_compression_xz(struct archive *);
__LA_DECL int archive_read_support_format_all(struct archive *);
__LA_DECL int archive_read_support_format_ar(struct archive *);
@@ -496,9 +498,11 @@ __LA_DECL int archive_write_set_skip_file(struct archive *, dev_t, ino_t);
__LA_DECL int archive_write_set_compression_bzip2(struct archive *);
__LA_DECL int archive_write_set_compression_compress(struct archive *);
__LA_DECL int archive_write_set_compression_gzip(struct archive *);
+__LA_DECL int archive_write_set_compression_lzma(struct archive *);
__LA_DECL int archive_write_set_compression_none(struct archive *);
__LA_DECL int archive_write_set_compression_program(struct archive *,
const char *cmd);
+__LA_DECL int archive_write_set_compression_xz(struct archive *);
/* A convenience function to set the format based on the code or name. */
__LA_DECL int archive_write_set_format(struct archive *, int format_code);
__LA_DECL int archive_write_set_format_by_name(struct archive *,
@@ -44,6 +44,9 @@ archive_read_support_compression_all(struct archive *a)
* the LZMA file format has a very weak signature. It
* may not be feasible to include LZMA detection here. */
/* archive_read_support_compression_lzma(a); */
+#endif
+#if HAVE_LZMA_H
+ archive_read_support_compression_xz(a);
#endif
return (ARCHIVE_OK);
}
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
#include "archive_private.h"
#include "archive_read_private.h"
+#ifndef HAVE_LZMA_H
#if HAVE_LZMADEC_H
struct private_data {
lzmadec_stream stream;
@@ -352,3 +353,4 @@ lzma_filter_close(struct archive_read_filter *self)
}
#endif /* HAVE_LZMADEC_H */
+#endif /* HAVE_LZMA_H */
Oops, something went wrong.

0 comments on commit c25e0da

Please sign in to comment.