From 76c1e34f2e36c351b12e6e3c51ff9927f804e711 Mon Sep 17 00:00:00 2001 From: Martin Matuska Date: Wed, 21 Dec 2011 11:18:49 +0000 Subject: [PATCH] Strip unnecessary files and directories from contrib/libarchive according to FREEBSD-Xlist MFC after: 2 weeks --- contrib/libarchive/CMakeLists.txt | 873 ------------ contrib/libarchive/CTestConfig.cmake | 11 - contrib/libarchive/INSTALL | 30 - contrib/libarchive/Makefile.am | 630 --------- .../build/autoconf/check_stdcall_func.m4 | 51 - contrib/libarchive/build/autoconf/la_uid_t.m4 | 20 - contrib/libarchive/build/autogen.sh | 68 - contrib/libarchive/build/bump-version.sh | 36 - contrib/libarchive/build/clean.sh | 81 -- .../libarchive/build/cmake/AddTest28.cmake | 107 -- .../build/cmake/CheckFileOffsetBits.c | 14 - .../build/cmake/CheckFileOffsetBits.cmake | 44 - .../libarchive/build/cmake/CheckFuncs.cmake | 49 - .../build/cmake/CheckFuncs_stub.c.in | 16 - .../build/cmake/CheckHeaderDirent.cmake | 32 - .../build/cmake/CheckStructMember.cmake | 43 - .../build/cmake/CheckTypeExists.cmake | 42 - contrib/libarchive/build/cmake/FindLZMA.cmake | 52 - contrib/libarchive/build/cmake/config.h.in | 759 ---------- .../build/pkgconfig/libarchive.pc.in | 10 - contrib/libarchive/build/version | 1 - contrib/libarchive/configure.ac | 508 ------- contrib/libarchive/contrib/README | 32 - .../libarchive/contrib/libarchive.1aix53.spec | 160 --- contrib/libarchive/contrib/libarchive.spec | 147 -- .../libarchive_autodetect-st_lib_archive.m4 | 154 -- .../contrib/psota-benchmark/results.txt | 122 -- .../libarchive/contrib/psota-benchmark/tcp.sh | 104 -- contrib/libarchive/contrib/shar/Makefile | 14 - contrib/libarchive/contrib/shar/shar.1 | 128 -- contrib/libarchive/contrib/shar/shar.c | 314 ----- contrib/libarchive/contrib/shar/tree.c | 542 -------- contrib/libarchive/contrib/shar/tree.h | 115 -- contrib/libarchive/contrib/shar/tree_config.h | 78 -- contrib/libarchive/contrib/untar.c | 225 --- contrib/libarchive/cpio/CMakeLists.txt | 51 - contrib/libarchive/cpio/cpio_windows.c | 338 ----- contrib/libarchive/cpio/cpio_windows.h | 72 - contrib/libarchive/cpio/test/CMakeLists.txt | 79 -- contrib/libarchive/doc/mdoc2man.awk | 391 ------ contrib/libarchive/doc/mdoc2wiki.awk | 448 ------ contrib/libarchive/doc/update.sh | 117 -- contrib/libarchive/examples/minitar/Makefile | 34 - contrib/libarchive/examples/minitar/README | 12 - contrib/libarchive/examples/minitar/minitar.c | 421 ------ contrib/libarchive/examples/minitar/tree.c | 423 ------ contrib/libarchive/examples/minitar/tree.h | 78 -- contrib/libarchive/examples/tarfilter.c | 113 -- contrib/libarchive/examples/untar.c | 262 ---- contrib/libarchive/libarchive/CMakeLists.txt | 139 -- .../libarchive/libarchive/archive_windows.c | 1236 ----------------- .../libarchive/libarchive/archive_windows.h | 347 ----- .../libarchive/filter_fork_windows.c | 113 -- contrib/libarchive/libarchive/test/.cvsignore | 10 - .../libarchive/libarchive/test/CMakeLists.txt | 159 --- contrib/libarchive/tar/CMakeLists.txt | 55 - contrib/libarchive/tar/bsdtar_windows.c | 298 ---- contrib/libarchive/tar/bsdtar_windows.h | 60 - contrib/libarchive/tar/test/CMakeLists.txt | 67 - contrib/libarchive/tar/test/test_windows.c | 323 ----- 60 files changed, 11258 deletions(-) delete mode 100644 contrib/libarchive/CMakeLists.txt delete mode 100644 contrib/libarchive/CTestConfig.cmake delete mode 100644 contrib/libarchive/INSTALL delete mode 100644 contrib/libarchive/Makefile.am delete mode 100644 contrib/libarchive/build/autoconf/check_stdcall_func.m4 delete mode 100644 contrib/libarchive/build/autoconf/la_uid_t.m4 delete mode 100755 contrib/libarchive/build/autogen.sh delete mode 100644 contrib/libarchive/build/bump-version.sh delete mode 100644 contrib/libarchive/build/clean.sh delete mode 100644 contrib/libarchive/build/cmake/AddTest28.cmake delete mode 100644 contrib/libarchive/build/cmake/CheckFileOffsetBits.c delete mode 100644 contrib/libarchive/build/cmake/CheckFileOffsetBits.cmake delete mode 100644 contrib/libarchive/build/cmake/CheckFuncs.cmake delete mode 100644 contrib/libarchive/build/cmake/CheckFuncs_stub.c.in delete mode 100644 contrib/libarchive/build/cmake/CheckHeaderDirent.cmake delete mode 100644 contrib/libarchive/build/cmake/CheckStructMember.cmake delete mode 100644 contrib/libarchive/build/cmake/CheckTypeExists.cmake delete mode 100644 contrib/libarchive/build/cmake/FindLZMA.cmake delete mode 100644 contrib/libarchive/build/cmake/config.h.in delete mode 100644 contrib/libarchive/build/pkgconfig/libarchive.pc.in delete mode 100644 contrib/libarchive/build/version delete mode 100644 contrib/libarchive/configure.ac delete mode 100644 contrib/libarchive/contrib/README delete mode 100644 contrib/libarchive/contrib/libarchive.1aix53.spec delete mode 100644 contrib/libarchive/contrib/libarchive.spec delete mode 100644 contrib/libarchive/contrib/libarchive_autodetect-st_lib_archive.m4 delete mode 100644 contrib/libarchive/contrib/psota-benchmark/results.txt delete mode 100644 contrib/libarchive/contrib/psota-benchmark/tcp.sh delete mode 100644 contrib/libarchive/contrib/shar/Makefile delete mode 100644 contrib/libarchive/contrib/shar/shar.1 delete mode 100644 contrib/libarchive/contrib/shar/shar.c delete mode 100644 contrib/libarchive/contrib/shar/tree.c delete mode 100644 contrib/libarchive/contrib/shar/tree.h delete mode 100644 contrib/libarchive/contrib/shar/tree_config.h delete mode 100644 contrib/libarchive/contrib/untar.c delete mode 100644 contrib/libarchive/cpio/CMakeLists.txt delete mode 100644 contrib/libarchive/cpio/cpio_windows.c delete mode 100644 contrib/libarchive/cpio/cpio_windows.h delete mode 100644 contrib/libarchive/cpio/test/CMakeLists.txt delete mode 100644 contrib/libarchive/doc/mdoc2man.awk delete mode 100644 contrib/libarchive/doc/mdoc2wiki.awk delete mode 100644 contrib/libarchive/doc/update.sh delete mode 100644 contrib/libarchive/examples/minitar/Makefile delete mode 100644 contrib/libarchive/examples/minitar/README delete mode 100644 contrib/libarchive/examples/minitar/minitar.c delete mode 100644 contrib/libarchive/examples/minitar/tree.c delete mode 100644 contrib/libarchive/examples/minitar/tree.h delete mode 100644 contrib/libarchive/examples/tarfilter.c delete mode 100644 contrib/libarchive/examples/untar.c delete mode 100644 contrib/libarchive/libarchive/CMakeLists.txt delete mode 100644 contrib/libarchive/libarchive/archive_windows.c delete mode 100644 contrib/libarchive/libarchive/archive_windows.h delete mode 100644 contrib/libarchive/libarchive/filter_fork_windows.c delete mode 100644 contrib/libarchive/libarchive/test/.cvsignore delete mode 100644 contrib/libarchive/libarchive/test/CMakeLists.txt delete mode 100644 contrib/libarchive/tar/CMakeLists.txt delete mode 100644 contrib/libarchive/tar/bsdtar_windows.c delete mode 100644 contrib/libarchive/tar/bsdtar_windows.h delete mode 100644 contrib/libarchive/tar/test/CMakeLists.txt delete mode 100644 contrib/libarchive/tar/test/test_windows.c diff --git a/contrib/libarchive/CMakeLists.txt b/contrib/libarchive/CMakeLists.txt deleted file mode 100644 index 04aa9a6f40f3..000000000000 --- a/contrib/libarchive/CMakeLists.txt +++ /dev/null @@ -1,873 +0,0 @@ -# -# -PROJECT(libarchive C) -# -CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3 FATAL_ERROR) -SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake") -if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${libarchive_BINARY_DIR}/bin) -endif() - -# -# Version - read from 'version' file. -# -FILE(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/build/version _version) -STRING(REGEX REPLACE - "^([0-9])[0-9][0-9][0-9][0-9][0-9][0-9][a-z]?$" "\\1" _major ${_version}) -STRING(REGEX REPLACE - "^[0-9]([0-9][0-9][0-9])[0-9][0-9][0-9][a-z]?$" "\\1" _minor ${_version}) -STRING(REGEX REPLACE - "^[0-9][0-9][0-9][0-9]([0-9][0-9][0-9])[a-z]?$" "\\1" _revision ${_version}) -STRING(REGEX REPLACE - "^[0-9][0-9][0-9][0-9][0-9][0-9][0-9]([a-z]?)$" "\\1" _quality ${_version}) -SET(_version_number ${_major}${_minor}${_revision}) -STRING(REGEX REPLACE "[0]*([^0][0-9]*)$" "\\1" _minor ${_minor}) -STRING(REGEX REPLACE "[0]*([^0][0-9]*)$" "\\1" _revision ${_revision}) -# -SET(VERSION "${_major}.${_minor}.${_revision}${_quality}") -SET(BSDCPIO_VERSION_STRING "${VERSION}") -SET(BSDTAR_VERSION_STRING "${VERSION}") -SET(LIBARCHIVE_VERSION_NUMBER "${_version_number}") -SET(LIBARCHIVE_VERSION_STRING "${VERSION}") -# Shared library number -SET(SOVERSION 8) - -# Enable CTest/CDash support -include(CTest) - -# Provide ADD_TEST_28 macro to approximate CMake 2.8 ADD_TEST(NAME). -# TODO: Require CMake 2.8 and drop this workaround (perhaps late 2010). -INCLUDE(AddTest28) - -OPTION(ENABLE_OPENSSL "Enable use of OpenSSL" ON) -OPTION(ENABLE_TAR "Enable tar building" ON) -OPTION(ENABLE_TAR_SHARED "Enable dynamic build of tar" OFF) -OPTION(ENABLE_CPIO "Enable cpio building" ON) -OPTION(ENABLE_CPIO_SHARED "Enable dynamic build of cpio" OFF) -OPTION(ENABLE_XATTR "Enable extended attribute support" ON) -OPTION(ENABLE_ACL "Enable ACL support" ON) -OPTION(ENABLE_TEST "Enable unit and regression tests" ON) - -IF(ENABLE_TEST) - ENABLE_TESTING() -ENDIF(ENABLE_TEST) -IF(WIN32 AND NOT CYGWIN) - # Currently, dynamic build only. - SET(ENABLE_TAR_SHARED ON) - SET(ENABLE_CPIO_SHARED ON) -ENDIF(WIN32 AND NOT CYGWIN) - -IF(WIN32) - SET(_WIN32_WINNT 0x0500 CACHE INTERNAL "Setting _WIN32_WINNT to 0x0500 for Windows 2000 APIs") - SET(WINVER 0x0500 CACHE INTERNAL "Setting WINVER to 0x0500 for Windows 2000 APIs") -ENDIF(WIN32) - -# -INCLUDE(CheckCSourceRuns) -INCLUDE(CheckFileOffsetBits) -INCLUDE(CheckFuncs) -INCLUDE(CheckHeaderDirent) -INCLUDE(CheckIncludeFile) -INCLUDE(CheckIncludeFiles) -INCLUDE(CheckLibraryExists) -INCLUDE(CheckStructMember) -INCLUDE(CheckSymbolExists) -INCLUDE(CheckTypeExists) -INCLUDE(CheckTypeSize) - -# -# Generate list.h -# -MACRO (GENERATE_LIST_H _listfile _cmlist __list_sources) - SET(_argv ${ARGV}) - # Remove _listfile and _cmlist from _argv - LIST(REMOVE_AT _argv 0 1) - IF (NOT EXISTS "${_listfile}" OR - ${_cmlist} IS_NEWER_THAN "${_listfile}") - - MESSAGE(STATUS "Generating ${_listfile}") - FILE(WRITE ${_listfile} "") - FOREACH (testfile ${_argv}) - IF (testfile MATCHES "^test_[^/]+[.]c$") - FILE(STRINGS ${testfile} testvar REGEX "^DEFINE_TEST") - FOREACH (deftest ${testvar}) - FILE(APPEND ${_listfile} "${deftest}\n") - ENDFOREACH (deftest) - ENDIF (testfile MATCHES "^test_[^/]+[.]c$") - ENDFOREACH (testfile) - - ENDIF (NOT EXISTS "${_listfile}" OR - ${_cmlist} IS_NEWER_THAN "${_listfile}") -ENDMACRO (GENERATE_LIST_H) -# -# Generate installation rules for man pages. -# -MACRO (INSTALL_MAN __mans) - FOREACH (_man ${ARGV}) - STRING(REGEX REPLACE "^.+[.]([1-9])" "\\1" _mansect ${_man}) - INSTALL(FILES ${_man} DESTINATION "share/man/man${_mansect}") - ENDFOREACH (_man) -ENDMACRO (INSTALL_MAN __mans) - -# -# Check compress/decompress libraries -# -IF(WIN32 AND NOT CMAKE_CL_64 AND NOT CYGWIN) - # GnuWin32 is only for Win32, not Win64. - SET(__GNUWIN32PATH "C:/Program Files/GnuWin32") -ENDIF(WIN32 AND NOT CMAKE_CL_64 AND NOT CYGWIN) -IF(DEFINED __GNUWIN32PATH AND EXISTS "${__GNUWIN32PATH}") - # You have to add a path availabel DLL file into PATH environment variable. - # Maybe DLL path is "C:/Program Files/GnuWin32/bin". - # The zlib and the bzip2 Setup program have installed programs and DLLs into - # "C:/Program Files/GnuWin32" by default. - # This is convenience setting for Windows. - SET(CMAKE_PREFIX_PATH ${__GNUWIN32PATH} $(CMAKE_PREFIX_PATH)) - # - # If you didn't use Setup program or installed into nonstandard path, - # cmake cannot find out your zlib or bzip2 libraries and include files, - # you should execute cmake with -DCMAKE_PREFIX_PATH option. - # e.g. - # cmake -DCMAKE_PREFIX_PATH= - # - # If compiling error occured in zconf.h, You may need patch to zconf.h. - #--- zconf.h.orig 2005-07-21 00:40:26.000000000 - #+++ zconf.h 2009-01-19 11:39:10.093750000 - #@@ -286,7 +286,7 @@ - # - # #if 1 /* HAVE_UNISTD_H -- this line is updated by ./configure */ - # # include /* for off_t */ - #-# include /* for SEEK_* and off_t */ - #+# include /* for SEEK_* and off_t */ - # # ifdef VMS - # # include /* for off_t */ - # # endif -ENDIF(DEFINED __GNUWIN32PATH AND EXISTS "${__GNUWIN32PATH}") - -SET(ADDITIONAL_LIBS "") -# -# Find ZLIB -# -FIND_PACKAGE(ZLIB) -IF(ZLIB_FOUND) - SET(HAVE_LIBZ 1) - SET(HAVE_ZLIB_H 1) - INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) - LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES}) - IF(WIN32 AND NOT CYGWIN) - SET(CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIR}) - SET(CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARIES}) - CHECK_C_SOURCE_Runs( - "#ifndef ZLIB_WINAPI\n#define ZLIB_WINAPI\n#endif\n#include \nint main() {uLong f = zlibCompileFlags(); return (f&(1U<<10))?0:-1; }" - ZLIB_WINAPI) - ENDIF(WIN32 AND NOT CYGWIN) -ENDIF(ZLIB_FOUND) -MARK_AS_ADVANCED(CLEAR ZLIB_INCLUDE_DIR) -MARK_AS_ADVANCED(CLEAR ZLIB_LIBRARY) -# -# Find BZip2 -# -FIND_PACKAGE(BZip2) -IF(BZIP2_FOUND) - SET(HAVE_LIBBZ2 1) - SET(HAVE_BZLIB_H 1) - INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIR}) - LIST(APPEND ADDITIONAL_LIBS ${BZIP2_LIBRARIES}) -ENDIF(BZIP2_FOUND) -MARK_AS_ADVANCED(CLEAR BZIP2_INCLUDE_DIR) -MARK_AS_ADVANCED(CLEAR BZIP2_LIBRARY) -# -# Find LZMA -# -FIND_PACKAGE(LZMA) -IF(LZMA_FOUND) - SET(HAVE_LIBLZMA 1) - SET(HAVE_LZMA_H 1) - INCLUDE_DIRECTORIES(${LZMA_INCLUDE_DIR}) - LIST(APPEND ADDITIONAL_LIBS ${LZMA_LIBRARIES}) - MARK_AS_ADVANCED(CLEAR LZMA_INCLUDE_DIR) - MARK_AS_ADVANCED(CLEAR LZMA_LIBRARY) -ELSEIF(LZMADEC_FOUND) - SET(HAVE_LIBLZMADEC 1) - SET(HAVE_LZMADEC_H 1) - INCLUDE_DIRECTORIES(${LZMADEC_INCLUDE_DIR}) - LIST(APPEND ADDITIONAL_LIBS ${LZMADEC_LIBRARIES}) - MARK_AS_ADVANCED(CLEAR LZMADEC_INCLUDE_DIR) - MARK_AS_ADVANCED(CLEAR LZMADEC_LIBRARY) -ELSE(LZMA_FOUND) - MARK_AS_ADVANCED(CLEAR LZMA_INCLUDE_DIR) - MARK_AS_ADVANCED(CLEAR LZMA_LIBRARY) -ENDIF(LZMA_FOUND) - -# -# Check headers -# -CHECK_HEADER_DIRENT() - -SET(INCLUDES "") -MACRO (LA_CHECK_INCLUDE_FILE header var) - CHECK_INCLUDE_FILES("${INCLUDES};${header}" ${var}) - IF (${var}) - SET(INCLUDES ${INCLUDES} ${header}) - ENDIF (${var}) -ENDMACRO (LA_CHECK_INCLUDE_FILE) - -# Some FreeBSD headers assume sys/types.h was already included. -LA_CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H) - -# Alphabetize the rest unless there's a compelling reason -LA_CHECK_INCLUDE_FILE("acl/libacl.h" HAVE_ACL_LIBACL_H) -LA_CHECK_INCLUDE_FILE("ctype.h" HAVE_CTYPE_H) -LA_CHECK_INCLUDE_FILE("direct.h" HAVE_DIRECT_H) -LA_CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H) -LA_CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H) -LA_CHECK_INCLUDE_FILE("ext2fs/ext2_fs.h" HAVE_EXT2FS_EXT2_FS_H) -LA_CHECK_INCLUDE_FILE("fcntl.h" HAVE_FCNTL_H) -LA_CHECK_INCLUDE_FILE("grp.h" HAVE_GRP_H) -LA_CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H) -LA_CHECK_INCLUDE_FILE("io.h" HAVE_IO_H) -LA_CHECK_INCLUDE_FILE("langinfo.h" HAVE_LANGINFO_H) -LA_CHECK_INCLUDE_FILE("limits.h" HAVE_LIMITS_H) -LA_CHECK_INCLUDE_FILE("linux/fs.h" HAVE_LINUX_FS_H) -LA_CHECK_INCLUDE_FILE("locale.h" HAVE_LOCALE_H) -LA_CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H) -LA_CHECK_INCLUDE_FILE("paths.h" HAVE_PATHS_H) -LA_CHECK_INCLUDE_FILE("poll.h" HAVE_POLL_H) -LA_CHECK_INCLUDE_FILE("process.h" HAVE_PROCESS_H) -LA_CHECK_INCLUDE_FILE("pwd.h" HAVE_PWD_H) -LA_CHECK_INCLUDE_FILE("regex.h" HAVE_REGEX_H) -LA_CHECK_INCLUDE_FILE("signal.h" HAVE_SIGNAL_H) -LA_CHECK_INCLUDE_FILE("stdarg.h" HAVE_STDARG_H) -LA_CHECK_INCLUDE_FILE("stdint.h" HAVE_STDINT_H) -LA_CHECK_INCLUDE_FILE("stdlib.h" HAVE_STDLIB_H) -LA_CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H) -LA_CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H) -LA_CHECK_INCLUDE_FILE("sys/acl.h" HAVE_SYS_ACL_H) -LA_CHECK_INCLUDE_FILE("sys/cdefs.h" HAVE_SYS_CDEFS_H) -LA_CHECK_INCLUDE_FILE("sys/ioctl.h" HAVE_SYS_IOCTL_H) -LA_CHECK_INCLUDE_FILE("sys/mkdev.h" HAVE_SYS_MKDEV_H) -LA_CHECK_INCLUDE_FILE("sys/param.h" HAVE_SYS_PARAM_H) -LA_CHECK_INCLUDE_FILE("sys/poll.h" HAVE_SYS_POLL_H) -LA_CHECK_INCLUDE_FILE("sys/select.h" HAVE_SYS_SELECT_H) -LA_CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H) -LA_CHECK_INCLUDE_FILE("sys/time.h" HAVE_SYS_TIME_H) -LA_CHECK_INCLUDE_FILE("sys/utime.h" HAVE_SYS_UTIME_H) -LA_CHECK_INCLUDE_FILE("sys/wait.h" HAVE_SYS_WAIT_H) -LA_CHECK_INCLUDE_FILE("time.h" HAVE_TIME_H) -LA_CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H) -LA_CHECK_INCLUDE_FILE("utime.h" HAVE_UTIME_H) -LA_CHECK_INCLUDE_FILE("wchar.h" HAVE_WCHAR_H) -LA_CHECK_INCLUDE_FILE("wctype.h" HAVE_WCTYPE_H) -LA_CHECK_INCLUDE_FILE("windows.h" HAVE_WINDOWS_H) - - -# -# Some headers require extra includes when they're available. -# - -# -# Find OpenSSL -# -IF(ENABLE_OPENSSL) - FIND_PACKAGE(OpenSSL) -ENDIF() - -# FreeBSD libmd -CHECK_LIBRARY_EXISTS(md "MD5Init" "" LIBMD_FOUND) -IF(LIBMD_FOUND) - SET(CMAKE_REQUIRED_LIBRARIES "md") - FIND_LIBRARY(LIBMD_LIBRARY NAMES md) - LIST(APPEND ADDITIONAL_LIBS ${LIBMD_LIBRARY}) -ENDIF(LIBMD_FOUND) - -# -# How to prove that HASH functions, which have several names on various -# platforms, can be mapped to archive_{hash name}_init, -# archive_{hash name}_update and archive_{hash name}_final through -# archive_hash.h -# -MACRO(CHECK_MD HASH IMPLEMENTATIONS) - IF(HAVE_SYS_TYPES_H) - SET(HASH_HEADER_CONFIG "#define HAVE_SYS_TYPES_H 1\n") - ELSE(HAVE_SYS_TYPES_H) - SET(HASH_HEADER_CONFIG "") - ENDIF(HAVE_SYS_TYPES_H) - - FOREACH(IMPLEMENTATION ${IMPLEMENTATIONS}) - IF(NOT DEFINED ARCHIVE_HASH_${HASH}_${IMPLEMENTATION}) - STRING(TOLOWER "${HASH}" lower_hash) - STRING(TOUPPER "${HASH}" hash) - - SET(HASH_REQUIRED_INCLUDES) - SET(TRY_HASH_REQUIRED_INCLUDES - "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_CURRENT_SOURCE_DIR}/libarchive") - SET(HASH_REQUIRED_LIBS) - SET(TRY_HASH_REQUIRED_LIBS) - IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) - SET(HASH_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) - SET(TRY_HASH_REQUIRED_INCLUDES - "${TRY_HASH_REQUIRED_INCLUDES};${OPENSSL_INCLUDE_DIR}") - SET(HASH_REQUIRED_LIBS ${OPENSSL_LIBRARIES}) - SET(TRY_HASH_REQUIRED_LIBS - "-DLINK_LIBRARIES:STRING=${OPENSSL_LIBRARIES}") - ELSEIF("${IMPLEMENTATION}" MATCHES "^LIBMD$" AND LIBMD_FOUND) - SET(TRY_HASH_REQUIRED_LIBS - "-DLINK_LIBRARIES:STRING=${LIBMD_LIBRARY}") - ENDIF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) - - SET(SOURCE "#define ${hash}_COMPILE_TEST -#define ARCHIVE_HASH_${hash}_${IMPLEMENTATION} -#define __LIBARCHIVE_BUILD -${HASH_HEADER_CONFIG} -#include \"archive_hash.h\" - -int -main(int argc, char **argv) -{ - archive_${lower_hash}_ctx ctx; - - archive_${lower_hash}_init(&ctx); - archive_${lower_hash}_update(&ctx, *argv, argc); - archive_${lower_hash}_final(&ctx, *argv); - return 0; -} -") - - FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_hash_md.c" "${SOURCE}") - MESSAGE(STATUS "Checking support for ARCHIVE_HASH_${HASH}_${IMPLEMENTATION}") - - TRY_COMPILE(ARCHIVE_HASH_${HASH}_${IMPLEMENTATION} - ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_hash_md.c - CMAKE_FLAGS - "${TRY_HASH_REQUIRED_LIBS}" - "${TRY_HASH_REQUIRED_INCLUDES}" - OUTPUT_VARIABLE OUTPUT) - - IF (ARCHIVE_HASH_${HASH}_${IMPLEMENTATION}) - MESSAGE(STATUS "Checking support for ARCHIVE_HASH_${HASH}_${IMPLEMENTATION} -- found") - IF (HASH_REQUIRED_INCLUDES) - INCLUDE_DIRECTORIES(${HASH_REQUIRED_INCLUDES}) - ENDIF (HASH_REQUIRED_INCLUDES) - IF (HASH_REQUIRED_LIBS) - LIST(APPEND ADDITIONAL_LIBS ${HASH_REQUIRED_LIBS}) - LIST(REMOVE_DUPLICATES ADDITIONAL_LIBS) - ENDIF (HASH_REQUIRED_LIBS) - BREAK() - ENDIF (ARCHIVE_HASH_${HASH}_${IMPLEMENTATION}) - - MESSAGE(STATUS "Checking support for ARCHIVE_HASH_${HASH}_${IMPLEMENTATION} -- not found") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Checking support for ARCHIVE_HASH_${HASH}_${IMPLEMENTATION} failed with the following output:\n" - "${OUTPUT}\n" - "Source file was:\n${SOURCE}\n") - ELSE(NOT DEFINED ARCHIVE_HASH_${HASH}_${IMPLEMENTATION}) - IF(ARCHIVE_HASH_${HASH}_${IMPLEMENTATION}) - BREAK() - ENDIF(ARCHIVE_HASH_${HASH}_${IMPLEMENTATION}) - ENDIF(NOT DEFINED ARCHIVE_HASH_${HASH}_${IMPLEMENTATION}) - ENDFOREACH(IMPLEMENTATION) -ENDMACRO(CHECK_MD HASH IMPLEMENTATIONS) - -# -# HASH functions on Windows is defined at archive_windows.c, thus we do not -# need the test what the functions can be mapped to archive_{hash name}_init, -# archive_{hash name}_update and archive_{hash name}_final. -# The functions on Windows use CALG_{hash name} macro to create a crypt object -# and then we need to know what CALG_{hash name} macros is available to show -# ARCHIVE_HASH_{hash name}_WIN macros because Windows 2000 and earlier version -# of Windows XP do not support SHA256, SHA384 and SHA512. -# -MACRO(CHECK_HASH_WIN HASH_LIST) - IF(WIN32 AND NOT CYGWIN) - FOREACH(HASH ${HASH_LIST}) - IF(NOT DEFINED ARCHIVE_HASH_${HASH}_WIN) - STRING(TOUPPER "${HASH}" hash) - SET(ALGID "") - IF ("${HASH}" MATCHES "^MD5$") - SET(ALGID "CALG_MD5") - ENDIF ("${HASH}" MATCHES "^MD5$") - IF ("${HASH}" MATCHES "^SHA1$") - SET(ALGID "CALG_SHA1") - ENDIF ("${HASH}" MATCHES "^SHA1$") - IF ("${HASH}" MATCHES "^SHA256$") - SET(ALGID "CALG_SHA_256") - ENDIF ("${HASH}" MATCHES "^SHA256$") - IF ("${HASH}" MATCHES "^SHA384$") - SET(ALGID "CALG_SHA_384") - ENDIF ("${HASH}" MATCHES "^SHA384$") - IF ("${HASH}" MATCHES "^SHA512$") - SET(ALGID "CALG_SHA_512") - ENDIF ("${HASH}" MATCHES "^SHA512$") - - SET(SOURCE "#define ${hash}_COMPILE_TEST -#define _WIN32_WINNT ${_WIN32_WINNT} -#define WINVER ${WINVER} -#include -#include - -int -main(int argc, char **argv) -{ - return ${ALGID}; -} -") - SET(SOURCE_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_hash_win.c") - - FILE(WRITE "${SOURCE_FILE}" "${SOURCE}") - MESSAGE(STATUS "Checking support for ARCHIVE_HASH_${HASH}_WIN") - - TRY_COMPILE(ARCHIVE_HASH_${HASH}_WIN - ${CMAKE_BINARY_DIR} - ${SOURCE_FILE} - CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_CURRENT_SOURCE_DIR}/libarchive" - OUTPUT_VARIABLE OUTPUT) - - IF (ARCHIVE_HASH_${HASH}_WIN) - MESSAGE(STATUS - "Checking support for ARCHIVE_HASH_${HASH}_WIN -- found") - ELSE (ARCHIVE_HASH_${HASH}_WIN) - MESSAGE(STATUS - "Checking support for ARCHIVE_HASH_${HASH}_WIN -- not found") - FILE(APPEND - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Checking support for ARCHIVE_HASH_${HASH}_WIN failed with the following output:\n" - "${OUTPUT}\n" - "Source file was:\n${SOURCE}\n") - ENDIF (ARCHIVE_HASH_${HASH}_WIN) - - ENDIF(NOT DEFINED ARCHIVE_HASH_${HASH}_WIN) - ENDFOREACH(HASH) - ENDIF(WIN32 AND NOT CYGWIN) -ENDMACRO(CHECK_HASH_WIN HASH_LIST) - -# -# Check MD5/RMD160/SHA support -# -CHECK_MD(MD5 "LIBC;LIBMD;LIBSYSTEM;OPENSSL") -CHECK_MD(RMD160 "LIBC;OPENSSL") -CHECK_MD(SHA1 "LIBC;LIBMD;LIBSYSTEM;OPENSSL") -CHECK_MD(SHA256 "LIBC;LIBC2;LIBC3;LIBMD;LIBSYSTEM;OPENSSL") -CHECK_MD(SHA384 "LIBC;LIBC2;LIBC3;LIBSYSTEM;OPENSSL") -CHECK_MD(SHA512 "LIBC;LIBC2;LIBC3;LIBMD;LIBSYSTEM;OPENSSL") -CHECK_HASH_WIN("MD5;SHA1;SHA256;SHA384;SHA512") - -# -# Find Libxml2 -# -FIND_PACKAGE(LibXml2) -IF(LIBXML2_FOUND) - INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) - LIST(APPEND ADDITIONAL_LIBS ${LIBXML2_LIBRARIES}) - SET(HAVE_LIBXML2 1) - # libxml2's include files use iconv.h - # We need a directory path of iconv.h so that it won't fail to check - # "libxml/xmlreader.h". - FIND_PATH(ICONV_INCLUDE_DIR iconv.h) - INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR}) - SET(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR}) - CHECK_INCLUDE_FILES("libxml/xmlreader.h" HAVE_LIBXML_XMLREADER_H) - SET(CMAKE_REQUIRED_INCLUDES "") -ELSE(LIBXML2_FOUND) - # - # Find Expat - # - FIND_PACKAGE(EXPAT) - IF(EXPAT_FOUND) - INCLUDE_DIRECTORIES(${EXPAT_INCLUDE_DIR}) - LIST(APPEND ADDITIONAL_LIBS ${EXPAT_LIBRARIES}) - SET(HAVE_LIBEXPAT 1) - LA_CHECK_INCLUDE_FILE("expat.h" HAVE_EXPAT_H) - ENDIF(EXPAT_FOUND) -ENDIF(LIBXML2_FOUND) - -# -# Check functions -# -CHECK_SYMBOL_EXISTS(CreateHardLinkA "windows.h" HAVE_CREATEHARDLINKA) -CHECK_SYMBOL_EXISTS(CreateHardLinkW "windows.h" HAVE_CREATEHARDLINKW) -CHECK_SYMBOL_EXISTS(_CrtSetReportMode "crtdbg.h" HAVE__CrtSetReportMode) -CHECK_FUNCTION_EXISTS_GLIBC(chflags HAVE_CHFLAGS) -CHECK_FUNCTION_EXISTS_GLIBC(chown HAVE_CHOWN) -CHECK_FUNCTION_EXISTS_GLIBC(chroot HAVE_CHROOT) -CHECK_FUNCTION_EXISTS_GLIBC(fchdir HAVE_FCHDIR) -CHECK_FUNCTION_EXISTS_GLIBC(fchflags HAVE_FCHFLAGS) -CHECK_FUNCTION_EXISTS_GLIBC(fchmod HAVE_FCHMOD) -CHECK_FUNCTION_EXISTS_GLIBC(fchown HAVE_FCHOWN) -CHECK_FUNCTION_EXISTS_GLIBC(fcntl HAVE_FCNTL) -CHECK_FUNCTION_EXISTS_GLIBC(fork HAVE_FORK) -CHECK_FUNCTION_EXISTS_GLIBC(fstat HAVE_FSTAT) -CHECK_FUNCTION_EXISTS_GLIBC(ftruncate HAVE_FTRUNCATE) -CHECK_FUNCTION_EXISTS_GLIBC(futimens HAVE_FUTIMENS) -CHECK_FUNCTION_EXISTS_GLIBC(futimes HAVE_FUTIMES) -CHECK_FUNCTION_EXISTS_GLIBC(geteuid HAVE_GETEUID) -CHECK_FUNCTION_EXISTS_GLIBC(getgrgid_r HAVE_GETGRGID_R) -CHECK_FUNCTION_EXISTS_GLIBC(getgrnam_r HAVE_GETGRNAM_R) -CHECK_FUNCTION_EXISTS_GLIBC(getpwnam_r HAVE_GETPWNAM_R) -CHECK_FUNCTION_EXISTS_GLIBC(getpwuid_r HAVE_GETPWUID_R) -CHECK_FUNCTION_EXISTS_GLIBC(getpid HAVE_GETPID) -CHECK_FUNCTION_EXISTS_GLIBC(lchflags HAVE_LCHFLAGS) -CHECK_FUNCTION_EXISTS_GLIBC(lchmod HAVE_LCHMOD) -CHECK_FUNCTION_EXISTS_GLIBC(lchown HAVE_LCHOWN) -CHECK_FUNCTION_EXISTS_GLIBC(link HAVE_LINK) -CHECK_FUNCTION_EXISTS_GLIBC(lstat HAVE_LSTAT) -CHECK_FUNCTION_EXISTS_GLIBC(lutimes HAVE_LUTIMES) -CHECK_FUNCTION_EXISTS_GLIBC(memmove HAVE_MEMMOVE) -CHECK_FUNCTION_EXISTS_GLIBC(mkdir HAVE_MKDIR) -CHECK_FUNCTION_EXISTS_GLIBC(mkfifo HAVE_MKFIFO) -CHECK_FUNCTION_EXISTS_GLIBC(mknod HAVE_MKNOD) -CHECK_FUNCTION_EXISTS_GLIBC(nl_langinfo HAVE_NL_LANGINFO) -CHECK_FUNCTION_EXISTS_GLIBC(pipe HAVE_PIPE) -CHECK_FUNCTION_EXISTS_GLIBC(poll HAVE_POLL) -CHECK_FUNCTION_EXISTS_GLIBC(readlink HAVE_READLINK) -CHECK_FUNCTION_EXISTS_GLIBC(select HAVE_SELECT) -CHECK_FUNCTION_EXISTS_GLIBC(setenv HAVE_SETENV) -CHECK_FUNCTION_EXISTS_GLIBC(setlocale HAVE_SETLOCALE) -CHECK_FUNCTION_EXISTS_GLIBC(sigaction HAVE_SIGACTION) -CHECK_FUNCTION_EXISTS_GLIBC(strchr HAVE_STRCHR) -CHECK_FUNCTION_EXISTS_GLIBC(strdup HAVE_STRDUP) -CHECK_FUNCTION_EXISTS_GLIBC(strerror HAVE_STRERROR) -CHECK_FUNCTION_EXISTS_GLIBC(strncpy_s HAVE_STRNCPY_S) -CHECK_FUNCTION_EXISTS_GLIBC(strrchr HAVE_STRRCHR) -CHECK_FUNCTION_EXISTS_GLIBC(symlink HAVE_SYMLINK) -CHECK_FUNCTION_EXISTS_GLIBC(timegm HAVE_TIMEGM) -CHECK_FUNCTION_EXISTS_GLIBC(tzset HAVE_TZSET) -CHECK_FUNCTION_EXISTS_GLIBC(unsetenv HAVE_UNSETENV) -CHECK_FUNCTION_EXISTS_GLIBC(utime HAVE_UTIME) -CHECK_FUNCTION_EXISTS_GLIBC(utimes HAVE_UTIMES) -CHECK_FUNCTION_EXISTS_GLIBC(utimensat HAVE_UTIMENSAT) -CHECK_FUNCTION_EXISTS_GLIBC(vfork HAVE_VFORK) -CHECK_FUNCTION_EXISTS_GLIBC(wcrtomb HAVE_WCRTOMB) -CHECK_FUNCTION_EXISTS_GLIBC(wcscmp HAVE_WCSCMP) -CHECK_FUNCTION_EXISTS_GLIBC(wcscpy HAVE_WCSCPY) -CHECK_FUNCTION_EXISTS_GLIBC(wcslen HAVE_WCSLEN) -CHECK_FUNCTION_EXISTS_GLIBC(wctomb HAVE_WCTOMB) -CHECK_SYMBOL_EXISTS(wmemcmp "wchar.h" HAVE_WMEMCMP) -CHECK_SYMBOL_EXISTS(wmemcpy "wchar.h" HAVE_WMEMCPY) - -SET(CMAKE_REQUIRED_LIBRARIES "") -CHECK_SYMBOL_EXISTS(fseeko "stdio.h" HAVE_FSEEKO) -CHECK_SYMBOL_EXISTS(strerror_r "string.h" HAVE_STRERROR_R) -CHECK_SYMBOL_EXISTS(strftime "time.h" HAVE_STRFTIME) -CHECK_SYMBOL_EXISTS(vprintf "stdio.h" HAVE_VPRINTF) -CHECK_SYMBOL_EXISTS(cygwin_conv_path "sys/cygwin.h" HAVE_CYGWIN_CONV_PATH) - -CHECK_SYMBOL_EXISTS(major "sys/mkdev.h" MAJOR_IN_MKDEV) -CHECK_SYMBOL_EXISTS(major "sys/sysmacros.h" MAJOR_IN_SYSMACROS) - -IF(HAVE_STRERROR_R) - SET(HAVE_DECL_STRERROR_R 1) -ENDIF(HAVE_STRERROR_R) - -# -# Check defines -# -SET(headers "limits.h") -IF(HAVE_STDINT_H) - LIST(APPEND headers "stdint.h") -ENDIF(HAVE_STDINT_H) -IF(HAVE_INTTYPES_H) - LIST(APPEND headers "inttypes.h") -ENDIF(HAVE_INTTYPES_H) -CHECK_SYMBOL_EXISTS(EFTYPE "errno.h" HAVE_EFTYPE) -CHECK_SYMBOL_EXISTS(EILSEQ "errno.h" HAVE_EILSEQ) -CHECK_SYMBOL_EXISTS(D_MD_ORDER "langinfo.h" HAVE_D_MD_ORDER) -CHECK_SYMBOL_EXISTS(optarg "unistd.h" HAVE_DECL_OPTARG) -CHECK_SYMBOL_EXISTS(optind "unistd.h" HAVE_DECL_OPTIND) -CHECK_SYMBOL_EXISTS(INT64_MAX "${headers}" HAVE_DECL_INT64_MAX) -CHECK_SYMBOL_EXISTS(INT64_MIN "${headers}" HAVE_DECL_INT64_MIN) -CHECK_SYMBOL_EXISTS(UINT32_MAX "${headers}" HAVE_DECL_UINT32_MAX) -CHECK_SYMBOL_EXISTS(UINT64_MAX "${headers}" HAVE_DECL_UINT64_MAX) -CHECK_SYMBOL_EXISTS(SIZE_MAX "${headers}" HAVE_DECL_SIZE_MAX) -CHECK_SYMBOL_EXISTS(SSIZE_MAX "limits.h" HAVE_DECL_SSIZE_MAX) - -# -# Check struct members -# -# Check for birthtime in struct stat -CHECK_STRUCT_MEMBER("struct stat" st_birthtime - "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_BIRTHTIME) - -# Check for high-resolution timestamps in struct stat -CHECK_STRUCT_MEMBER("struct stat" st_birthtimespec.tv_nsec - "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC) -CHECK_STRUCT_MEMBER("struct stat" st_mtimespec.tv_nsec - "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC) -CHECK_STRUCT_MEMBER("struct stat" st_mtim.tv_nsec - "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC) -CHECK_STRUCT_MEMBER("struct stat" st_mtime_n - "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIME_N) -CHECK_STRUCT_MEMBER("struct stat" st_umtime - "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_UMTIME) -CHECK_STRUCT_MEMBER("struct stat" st_mtime_usec - "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIME_USEC) -# Check for block size support in struct stat -CHECK_STRUCT_MEMBER("struct stat" st_blksize - "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_BLKSIZE) -# Check for st_flags in struct stat (BSD fflags) -CHECK_STRUCT_MEMBER("struct stat" st_flags - "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_FLAGS) -# -# -CHECK_STRUCT_MEMBER("struct tm" tm_sec - "sys/types.h;sys/time.h;time.h" TIME_WITH_SYS_TIME) - -# -# Check for integer types -# -# XXX There must be a way to make this simpler XXXX -# -CHECK_TYPE_SIZE("long long int" LONG_LONG_INT) -CHECK_TYPE_SIZE("unsigned long long" UNSIGNED_LONG_LONG) -CHECK_TYPE_SIZE("unsigned long long int" UNSIGNED_LONG_LONG_INT) - -# -CHECK_TYPE_SIZE(dev_t DEV_T) -IF(NOT HAVE_DEV_T) - IF(MSVC) - SET(dev_t "unsigned int") - ENDIF(MSVC) -ENDIF(NOT HAVE_DEV_T) -# -CHECK_TYPE_SIZE(gid_t GID_T) -IF(NOT HAVE_GID_T) - IF(WIN32) - SET(gid_t "short") - ELSE(WIN32) - SET(gid_t "unsigned int") - ENDIF(WIN32) -ENDIF(NOT HAVE_GID_T) -# -CHECK_TYPE_SIZE(id_t ID_T) -IF(NOT HAVE_ID_T) - IF(WIN32) - SET(id_t "short") - ELSE(WIN32) - SET(id_t "unsigned int") - ENDIF(WIN32) -ENDIF(NOT HAVE_ID_T) -# -CHECK_TYPE_SIZE(int32_t INT32_T) -IF(NOT HAVE_INT32_T) - SET(int32_t "int") -ENDIF(NOT HAVE_INT32_T) -# -CHECK_TYPE_SIZE(int64_t INT64_T) -IF(NOT HAVE_INT64_T) - IF(WIN32) - SET(int64_t __int64) - ENDIF(WIN32) -ENDIF(NOT HAVE_INT64_T) -# -CHECK_TYPE_SIZE(intmax_t INTMAX_T) -IF(NOT HAVE_INTMAX_T) - SET(intmax_t "int64_t") -ENDIF(NOT HAVE_INTMAX_T) -# -CHECK_TYPE_SIZE(mode_t MODE_T) -IF(NOT HAVE_MODE_T) - IF(WIN32) - SET(mode_t "unsigned short") - ELSE(WIN32) - SET(mode_t "int") - ENDIF(WIN32) -ENDIF(NOT HAVE_MODE_T) -# -CHECK_TYPE_SIZE(off_t OFF_T) -IF(NOT HAVE_OFF_T) - SET(off_t "__int64") -ENDIF(NOT HAVE_OFF_T) -# -CHECK_TYPE_SIZE(size_t SIZE_T) -IF(NOT HAVE_SIZE_T) - IF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) - SET(size_t "uint64_t") - ELSE("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) - SET(size_t "uint32_t") - ENDIF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) -ENDIF(NOT HAVE_SIZE_T) -# -CHECK_TYPE_SIZE(ssize_t SSIZE_T) -IF(NOT HAVE_SSIZE_T) - IF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) - SET(ssize_t "int64_t") - ELSE("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) - SET(ssize_t "long") - ENDIF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) -ENDIF(NOT HAVE_SSIZE_T) -# -CHECK_TYPE_SIZE(uid_t UID_T) -IF(NOT HAVE_UID_T) - IF(WIN32) - SET(uid_t "short") - ELSE(WIN32) - SET(uid_t "unsigned int") - ENDIF(WIN32) -ENDIF(NOT HAVE_UID_T) -# -CHECK_TYPE_SIZE(pid_t PID_T) -IF(NOT HAVE_PID_T) - IF(WIN32) - SET(pid_t "int") - ELSE(WIN32) - MESSAGE(FATAL_ERROR "pid_t doesn't exist on this platform?") - ENDIF(WIN32) -ENDIF(NOT HAVE_PID_T) -# -CHECK_TYPE_SIZE(uint16_t UINT16_T) -IF(NOT HAVE_UINT16_T) - SET(uint16_t "unsigned short") -ENDIF(NOT HAVE_UINT16_T) -# -CHECK_TYPE_SIZE(uint32_t UINT32_T) -IF(NOT HAVE_UINT32_T) - SET(uint32_t "unsigned int") -ENDIF(NOT HAVE_UINT32_T) -# -CHECK_TYPE_SIZE(uint64_t UINT64_T) -IF(NOT HAVE_UINT64_T) - IF(WIN32) - SET(uint64_t "unsigned __int64") - ENDIF(WIN32) -ENDIF(NOT HAVE_UINT64_T) -# -CHECK_TYPE_SIZE(uintmax_t UINTMAX_T) -IF(NOT HAVE_UINTMAX_T) - SET(uintmax_t "uint64_t") -ENDIF(NOT HAVE_UINTMAX_T) -# -CHECK_TYPE_SIZE(intptr_t INTPTR_T) -IF(NOT HAVE_INTPTR_T) - IF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) - SET(intptr_t "int64_t") - ELSE() - SET(intptr_t "int32_t") - ENDIF() -ENDIF(NOT HAVE_INTPTR_T) -# -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(NOT HAVE_UINTPTR_T) -# -CHECK_TYPE_SIZE(wchar_t SIZEOF_WCHAR_T) -IF(HAVE_SIZEOF_WCHAR_T) - SET(HAVE_WCHAR_T 1) -ENDIF(HAVE_SIZEOF_WCHAR_T) -# -# Check if _FILE_OFFSET_BITS macro needed for large files -# -CHECK_FILE_OFFSET_BITS() - - - -# -# Check for Extended Attribute libraries, headers, and functions -# -IF(ENABLE_XATTR) - LA_CHECK_INCLUDE_FILE(attr/xattr.h HAVE_ATTR_XATTR_H) - LA_CHECK_INCLUDE_FILE(sys/xattr.h HAVE_SYS_XATTR_H) - LA_CHECK_INCLUDE_FILE(sys/extattr.h HAVE_SYS_EXTATTR_H) - CHECK_LIBRARY_EXISTS(attr "setxattr" "" HAVE_ATTR_LIB) - IF(HAVE_ATTR_LIB) - SET(CMAKE_REQUIRED_LIBRARIES "attr") - ENDIF(HAVE_ATTR_LIB) - CHECK_SYMBOL_EXISTS(EXTATTR_NAMESPACE_USER "sys/types.h;sys/extattr.h" HAVE_DECL_EXTATTR_NAMESPACE_USER) - CHECK_FUNCTION_EXISTS_GLIBC(extattr_get_file HAVE_EXTATTR_GET_FILE) - CHECK_FUNCTION_EXISTS_GLIBC(extattr_list_file HAVE_EXTATTR_LIST_FILE) - CHECK_FUNCTION_EXISTS_GLIBC(extattr_set_fd HAVE_EXTATTR_SET_FD) - CHECK_FUNCTION_EXISTS_GLIBC(extattr_set_file HAVE_EXTATTR_SET_FILE) - CHECK_FUNCTION_EXISTS_GLIBC(fsetxattr HAVE_FSETXATTR) - CHECK_FUNCTION_EXISTS_GLIBC(getxattr HAVE_GETXATTR) - CHECK_FUNCTION_EXISTS_GLIBC(lgetxattr HAVE_LGETXATTR) - CHECK_FUNCTION_EXISTS_GLIBC(listxattr HAVE_LISTXATTR) - CHECK_FUNCTION_EXISTS_GLIBC(llistxattr HAVE_LLISTXATTR) - CHECK_FUNCTION_EXISTS_GLIBC(lsetxattr HAVE_LSETXATTR) -ENDIF(ENABLE_XATTR) - -# -# Check for ACL libraries, headers, and functions -# -# The ACL support in libarchive is written against the POSIX1e draft, -# which was never officially approved and varies quite a bit across -# platforms. Worse, some systems have completely non-POSIX acl functions, -# which makes the following checks rather more complex than I would like. -# -IF(ENABLE_ACL) - CHECK_LIBRARY_EXISTS(acl "acl_get_file" "" HAVE_ACL_LIB) - IF(HAVE_ACL_LIB) - SET(CMAKE_REQUIRED_LIBRARIES "acl") - FIND_LIBRARY(ACL_LIBRARY NAMES acl) - LIST(APPEND ADDITIONAL_LIBS ${ACL_LIBRARY}) - ENDIF(HAVE_ACL_LIB) - # - CHECK_FUNCTION_EXISTS_GLIBC(acl_create_entry HAVE_ACL_CREATE_ENTRY) - CHECK_FUNCTION_EXISTS_GLIBC(acl_init HAVE_ACL_INIT) - CHECK_FUNCTION_EXISTS_GLIBC(acl_set_fd HAVE_ACL_SET_FD) - CHECK_FUNCTION_EXISTS_GLIBC(acl_set_fd_np HAVE_ACL_SET_FD_NP) - CHECK_FUNCTION_EXISTS_GLIBC(acl_set_file HAVE_ACL_SET_FILE) - CHECK_TYPE_EXISTS(acl_permset_t "${INCLUDES}" HAVE_ACL_PERMSET_T) - - # The "acl_get_perm()" function was omitted from the POSIX draft. - # (It's a pretty obvious oversight; otherwise, there's no way to - # test for specific permissions in a permset.) Linux uses the obvious - # name, FreeBSD adds _np to mark it as "non-Posix extension." - # Test for both as a double-check that we really have POSIX-style ACL support. - CHECK_SYMBOL_EXISTS(acl_get_perm "${INCLUDES}" HAVE_ACL_GET_PERM) - CHECK_SYMBOL_EXISTS(acl_get_perm_np "${INCLUDES}" HAVE_ACL_GET_PERM_NP) - CHECK_SYMBOL_EXISTS(acl_get_link "${INCLUDES}" HAVE_ACL_GET_LINK) - CHECK_SYMBOL_EXISTS(acl_get_link_np "${INCLUDES}" HAVE_ACL_GET_LINK_NP) - - # MacOS has an acl.h that isn't POSIX. It can be detected by - # checking for ACL_USER - CHECK_SYMBOL_EXISTS(ACL_USER "${INCLUDES}" HAVE_ACL_USER) -ENDIF(ENABLE_ACL) - -# Generate "config.h" from "build/cmake/config.h.in" -CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in - ${CMAKE_CURRENT_BINARY_DIR}/config.h) -INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) -ADD_DEFINITIONS(-DHAVE_CONFIG_H) - -# -# Register installation of PDF documents. -# -IF(WIN32 AND NOT CYGWIN) - # - # On Windows platform, It's better that we install PDF documents - # on one's computer. - # These PDF documents are available in the release package. - # - IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/doc/pdf) - INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc/pdf - DESTINATION share/man - FILES_MATCHING PATTERN "*.pdf" - ) - ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/doc/pdf) -ENDIF(WIN32 AND NOT CYGWIN) -# -# -# -INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/libarchive) -# -IF(MSVC) - ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE) -ENDIF(MSVC) -# Especially for early development, we want to be a little -# aggressive about diagnosing build problems; this can get -# relaxed somewhat in final shipping versions. -IF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") - ADD_DEFINITIONS(-Wall -Werror) -ENDIF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") - -IF(ENABLE_TEST) -ADD_CUSTOM_TARGET(run_all_tests) -ENDIF(ENABLE_TEST) - -add_subdirectory(libarchive) -add_subdirectory(tar) -add_subdirectory(cpio) diff --git a/contrib/libarchive/CTestConfig.cmake b/contrib/libarchive/CTestConfig.cmake deleted file mode 100644 index 7a09742db098..000000000000 --- a/contrib/libarchive/CTestConfig.cmake +++ /dev/null @@ -1,11 +0,0 @@ -# TODO: This file should be moved into the build/cmake directory... - -# The libarchive CDash page appears at -# http://my.cdash.org/index.php?project=libarchive -set(CTEST_PROJECT_NAME "libarchive") -set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") - -set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "my.cdash.org") -set(CTEST_DROP_LOCATION "/submit.php?project=libarchive") -set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/contrib/libarchive/INSTALL b/contrib/libarchive/INSTALL deleted file mode 100644 index d91cc0691f43..000000000000 --- a/contrib/libarchive/INSTALL +++ /dev/null @@ -1,30 +0,0 @@ -More complete build documentation is available on the libarchive -Wiki: http://libarchive.googlecode.com/ - -On most Unix-like systems, you should be able to install libarchive, -bsdtar, and bsdcpio using the following common steps: - ./configure - make - make install - -If you need to customize the target directories or otherwise adjust -the build setting, use - ./configure --help -to list the configure options. - -If you are developing libarchive and need to update the -configure script and other build files: - /bin/sh build/autogen.sh - -To create a distribution, please use the 'distcheck' target: - /bin/sh build/autogen.sh && ./configure && make distcheck - -On non-Unix-like systems, use the "cmake" utility (available from -http://cmake.org/) to generate suitable build files for your platform. -Cmake requires the name of the directory containing CmakeLists.txt and -the "generator" to use for your build environment. For example, to -build with Xcode on Mac OS, you can use the following command: - cmake -G "Xcode" ~/libarchive-download-dir/ -The result will be appropriate makefiles, solution files, or project -files that can be used with the corresponding development tool. -See the libarchive Wiki or the cmake site for further documentation. \ No newline at end of file diff --git a/contrib/libarchive/Makefile.am b/contrib/libarchive/Makefile.am deleted file mode 100644 index 100ce9f34665..000000000000 --- a/contrib/libarchive/Makefile.am +++ /dev/null @@ -1,630 +0,0 @@ -## Process this file with automake to produce Makefile.in - -AUTOMAKE_OPTIONS= foreign subdir-objects -ACLOCAL_AMFLAGS = -I build/autoconf - -# -# What to build and install -# -lib_LTLIBRARIES= libarchive.la -noinst_LTLIBRARIES= libarchive_fe.la -bin_PROGRAMS= $(bsdtar_programs) $(bsdcpio_programs) -man_MANS= $(libarchive_man_MANS) $(bsdtar_man_MANS) $(bsdcpio_man_MANS) -BUILT_SOURCES= libarchive/test/list.h tar/test/list.h cpio/test/list.h - -# -# What to test: We always test libarchive, test bsdtar and bsdcpio only -# if we built them. -# -check_PROGRAMS= libarchive_test $(bsdtar_test_programs) $(bsdcpio_test_programs) -TESTS= libarchive_test $(bsdtar_test_programs) $(bsdcpio_test_programs) -TESTS_ENVIRONMENT= $(libarchive_TESTS_ENVIRONMENT) $(bsdtar_TESTS_ENVIRONMENT) $(bsdcpio_TESTS_ENVIRONMENT) -# Always build and test both bsdtar and bsdcpio as part of 'distcheck' -DISTCHECK_CONFIGURE_FLAGS = --enable-bsdtar --enable-bsdcpio -# Uncommenting this line can help diagnose some errors. This is ordinarily -# enabled in the libarchive development branch but is disabled -# for libarchive production releases. -#AM_CFLAGS=-Wall -Werror -PLATFORMCPPFLAGS = @PLATFORMCPPFLAGS@ -AM_CPPFLAGS=$(PLATFORMCPPFLAGS) - -# -# What to include in the distribution -# -EXTRA_DIST= \ - CMakeLists.txt \ - build/autogen.sh \ - build/bump-version.sh \ - build/clean.sh \ - build/cmake \ - build/version \ - contrib \ - doc \ - examples \ - $(libarchive_EXTRA_DIST) \ - $(libarchive_test_EXTRA_DIST) \ - $(bsdtar_EXTRA_DIST) \ - $(bsdtar_test_EXTRA_DIST) \ - $(bsdcpio_EXTRA_DIST) \ - $(bsdcpio_test_EXTRA_DIST) - -# a) Clean out some unneeded files and directories -# b) Collect all documentation and format it for distribution. -dist-hook: - rm -rf `find $(distdir) -name CVS -type d` - rm -rf `find $(distdir) -name .svn -type d` - rm -f `find $(distdir) -name '*~'` - rm -f `find $(distdir) -name '*.out'` - rm -f `find $(distdir) -name '*.core'` - -rm -f $(distdir)/*/Makefile $(distdir)/*/*/Makefile - cd $(distdir)/doc && /bin/sh update.sh - -# Verify cmake builds as part of the acceptance -distcheck-hook: - mkdir $(distdir)/_build/cmtest - cd $(distdir)/_build/cmtest && cmake ../.. && make && make test - rm -rf $(distdir)/_build/cmtest - -# -# Extra rules for cleanup -# -DISTCLEANFILES= \ - libarchive/test/list.h \ - tar/test/list.h \ - cpio/test/list.h - -distclean-local: - -rm -rf .ref - -rm -rf autom4te.cache/ - -rm -f *~ - -[ -f libarchive/Makefile ] && cd libarchive && make clean - -[ -f libarchive/test/Makefile ] && cd libarchive/test && make clean - -[ -f tar/Makefile ] && cd tar && make clean - -[ -f tar/test/Makefile ] && cd tar/test && make clean - -[ -f cpio/Makefile ] && cd cpio && make clean - -[ -f cpio/test/Makefile ] && cd cpio/test && make clean - -# -# Libarchive headers, source, etc. -# -# - -include_HEADERS= libarchive/archive.h libarchive/archive_entry.h - -libarchive_la_SOURCES= \ - libarchive/archive_check_magic.c \ - libarchive/archive_crc32.h \ - libarchive/archive_endian.h \ - libarchive/archive_entry.c \ - libarchive/archive_entry.h \ - libarchive/archive_entry_copy_stat.c \ - libarchive/archive_entry_link_resolver.c \ - libarchive/archive_entry_private.h \ - libarchive/archive_entry_stat.c \ - libarchive/archive_entry_strmode.c \ - libarchive/archive_entry_xattr.c \ - libarchive/archive_hash.h \ - libarchive/archive_platform.h \ - libarchive/archive_private.h \ - libarchive/archive_read.c \ - libarchive/archive_read_data_into_fd.c \ - libarchive/archive_read_disk.c \ - libarchive/archive_read_disk_entry_from_file.c \ - libarchive/archive_read_disk_private.h \ - libarchive/archive_read_disk_set_standard_lookup.c \ - libarchive/archive_read_extract.c \ - libarchive/archive_read_open_fd.c \ - libarchive/archive_read_open_file.c \ - libarchive/archive_read_open_filename.c \ - libarchive/archive_read_open_memory.c \ - libarchive/archive_read_private.h \ - libarchive/archive_read_support_compression_all.c \ - libarchive/archive_read_support_compression_bzip2.c \ - libarchive/archive_read_support_compression_compress.c \ - libarchive/archive_read_support_compression_gzip.c \ - libarchive/archive_read_support_compression_none.c \ - libarchive/archive_read_support_compression_program.c \ - libarchive/archive_read_support_compression_rpm.c \ - libarchive/archive_read_support_compression_uu.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 \ - libarchive/archive_read_support_format_empty.c \ - libarchive/archive_read_support_format_iso9660.c \ - libarchive/archive_read_support_format_mtree.c \ - libarchive/archive_read_support_format_raw.c \ - libarchive/archive_read_support_format_tar.c \ - libarchive/archive_read_support_format_xar.c \ - libarchive/archive_read_support_format_zip.c \ - libarchive/archive_string.c \ - libarchive/archive_string.h \ - libarchive/archive_string_sprintf.c \ - libarchive/archive_util.c \ - libarchive/archive_virtual.c \ - libarchive/archive_write.c \ - libarchive/archive_write_disk.c \ - libarchive/archive_write_disk_private.h \ - libarchive/archive_write_disk_set_standard_lookup.c \ - libarchive/archive_write_open_fd.c \ - libarchive/archive_write_open_file.c \ - libarchive/archive_write_open_filename.c \ - libarchive/archive_write_open_memory.c \ - libarchive/archive_write_private.h \ - libarchive/archive_write_set_compression_bzip2.c \ - libarchive/archive_write_set_compression_compress.c \ - 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 \ - libarchive/archive_write_set_format_cpio.c \ - libarchive/archive_write_set_format_cpio_newc.c \ - libarchive/archive_write_set_format_mtree.c \ - libarchive/archive_write_set_format_pax.c \ - libarchive/archive_write_set_format_shar.c \ - libarchive/archive_write_set_format_ustar.c \ - libarchive/archive_write_set_format_zip.c \ - libarchive/config_freebsd.h \ - libarchive/filter_fork.c \ - libarchive/filter_fork.h - -if INC_WINDOWS_FILES -libarchive_la_SOURCES+= \ - libarchive/archive_entry_copy_bhfi.c \ - libarchive/archive_windows.h \ - libarchive/archive_windows.c \ - libarchive/filter_fork_windows.c -endif - -# -no-undefined marks that libarchive doesn't rely on symbols -# defined in the application. This is mandatory for cygwin. -libarchive_la_LDFLAGS= -no-undefined -version-info $(ARCHIVE_LIBTOOL_VERSION) - -# Manpages to install -libarchive_man_MANS= \ - libarchive/archive_entry.3 \ - libarchive/archive_read.3 \ - libarchive/archive_read_disk.3 \ - libarchive/archive_util.3 \ - libarchive/archive_write.3 \ - libarchive/archive_write_disk.3 \ - libarchive/cpio.5 \ - libarchive/libarchive.3 \ - libarchive/libarchive_internals.3 \ - libarchive/libarchive-formats.5 \ - libarchive/mtree.5 \ - libarchive/tar.5 - -# Additional libarchive files to include in the distribution -libarchive_EXTRA_DIST= \ - libarchive/test/list.h \ - libarchive/archive_windows.c \ - libarchive/archive_windows.h \ - libarchive/filter_fork_windows.c \ - libarchive/CMakeLists.txt \ - $(libarchive_man_MANS) - -# pkgconfig -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = build/pkgconfig/libarchive.pc - -# -# -# libarchive_test program -# -# -libarchive_test_SOURCES= \ - $(libarchive_la_SOURCES) \ - libarchive/test/main.c \ - libarchive/test/read_open_memory.c \ - libarchive/test/test.h \ - libarchive/test/test_acl_basic.c \ - libarchive/test/test_acl_freebsd.c \ - libarchive/test/test_acl_pax.c \ - libarchive/test/test_archive_api_feature.c \ - libarchive/test/test_bad_fd.c \ - libarchive/test/test_compat_bzip2.c \ - libarchive/test/test_compat_cpio.c \ - libarchive/test/test_compat_gtar.c \ - libarchive/test/test_compat_gzip.c \ - libarchive/test/test_compat_lzma.c \ - libarchive/test/test_compat_solaris_tar_acl.c \ - libarchive/test/test_compat_tar_hardlink.c \ - libarchive/test/test_compat_xz.c \ - libarchive/test/test_compat_zip.c \ - libarchive/test/test_empty_write.c \ - libarchive/test/test_entry.c \ - libarchive/test/test_extattr_freebsd.c \ - libarchive/test/test_fuzz.c \ - libarchive/test/test_entry_strmode.c \ - libarchive/test/test_link_resolver.c \ - libarchive/test/test_open_failure.c \ - libarchive/test/test_open_fd.c \ - libarchive/test/test_open_file.c \ - libarchive/test/test_open_filename.c \ - libarchive/test/test_pax_filename_encoding.c \ - libarchive/test/test_read_compress_program.c \ - libarchive/test/test_read_data_large.c \ - libarchive/test/test_read_disk.c \ - libarchive/test/test_read_disk_entry_from_file.c \ - libarchive/test/test_read_extract.c \ - libarchive/test/test_read_file_nonexistent.c \ - libarchive/test/test_read_format_ar.c \ - libarchive/test/test_read_format_cpio_bin.c \ - libarchive/test/test_read_format_cpio_bin_Z.c \ - libarchive/test/test_read_format_cpio_bin_be.c \ - libarchive/test/test_read_format_cpio_bin_bz2.c \ - libarchive/test/test_read_format_cpio_bin_gz.c \ - libarchive/test/test_read_format_cpio_bin_lzma.c \ - libarchive/test/test_read_format_cpio_bin_xz.c \ - libarchive/test/test_read_format_cpio_odc.c \ - libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c \ - libarchive/test/test_read_format_cpio_svr4_gzip.c \ - libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c \ - libarchive/test/test_read_format_cpio_svr4c_Z.c \ - libarchive/test/test_read_format_empty.c \ - libarchive/test/test_read_format_gtar_gz.c \ - libarchive/test/test_read_format_gtar_lzma.c \ - libarchive/test/test_read_format_gtar_sparse.c \ - libarchive/test/test_read_format_iso_Z.c \ - libarchive/test/test_read_format_iso_multi_extent.c \ - libarchive/test/test_read_format_isojoliet_bz2.c \ - libarchive/test/test_read_format_isojoliet_long.c \ - libarchive/test/test_read_format_isojoliet_rr.c \ - libarchive/test/test_read_format_isorr_bz2.c \ - libarchive/test/test_read_format_isorr_ce.c \ - libarchive/test/test_read_format_isorr_new_bz2.c \ - libarchive/test/test_read_format_isorr_rr_moved.c \ - libarchive/test/test_read_format_isozisofs_bz2.c \ - libarchive/test/test_read_format_mtree.c \ - libarchive/test/test_read_format_pax_bz2.c \ - libarchive/test/test_read_format_raw.c \ - libarchive/test/test_read_format_tar.c \ - libarchive/test/test_read_format_tar_empty_filename.c \ - libarchive/test/test_read_format_tbz.c \ - libarchive/test/test_read_format_tgz.c \ - libarchive/test/test_read_format_tlz.c \ - libarchive/test/test_read_format_txz.c \ - libarchive/test/test_read_format_tz.c \ - libarchive/test/test_read_format_xar.c \ - libarchive/test/test_read_format_zip.c \ - libarchive/test/test_read_large.c \ - libarchive/test/test_read_pax_truncated.c \ - libarchive/test/test_read_position.c \ - libarchive/test/test_read_truncated.c \ - libarchive/test/test_read_uu.c \ - libarchive/test/test_tar_filenames.c \ - libarchive/test/test_tar_large.c \ - libarchive/test/test_ustar_filenames.c \ - libarchive/test/test_write_compress.c \ - libarchive/test/test_write_compress_bzip2.c \ - libarchive/test/test_write_compress_gzip.c \ - libarchive/test/test_write_compress_lzma.c \ - libarchive/test/test_write_compress_program.c \ - libarchive/test/test_write_compress_xz.c \ - libarchive/test/test_write_disk.c \ - libarchive/test/test_write_disk_failures.c \ - libarchive/test/test_write_disk_hardlink.c \ - libarchive/test/test_write_disk_perms.c \ - libarchive/test/test_write_disk_secure.c \ - libarchive/test/test_write_disk_sparse.c \ - libarchive/test/test_write_disk_symlink.c \ - libarchive/test/test_write_disk_times.c \ - libarchive/test/test_write_format_ar.c \ - libarchive/test/test_write_format_cpio.c \ - libarchive/test/test_write_format_cpio_empty.c \ - libarchive/test/test_write_format_cpio_odc.c \ - libarchive/test/test_write_format_cpio_newc.c \ - libarchive/test/test_write_format_mtree.c \ - libarchive/test/test_write_format_pax.c \ - libarchive/test/test_write_format_shar_empty.c \ - libarchive/test/test_write_format_tar.c \ - libarchive/test/test_write_format_tar_empty.c \ - libarchive/test/test_write_format_tar_ustar.c \ - libarchive/test/test_write_format_zip.c \ - libarchive/test/test_write_format_zip_empty.c \ - libarchive/test/test_write_format_zip_no_compression.c \ - libarchive/test/test_write_open_memory.c - -libarchive_test_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_builddir)/libarchive/test -DLIBARCHIVE_STATIC $(PLATFORMCPPFLAGS) - -# The "list.h" file just lists all of the tests defined in all of the sources. -# Building it automatically provides a sanity-check on libarchive_test_SOURCES -# above. -libarchive/test/list.h: Makefile - cat $(top_srcdir)/libarchive/test/test_*.c | grep DEFINE_TEST > libarchive/test/list.h - -libarchive_TESTS_ENVIRONMENT= LIBARCHIVE_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/libarchive/test - -libarchive_test_EXTRA_DIST=\ - libarchive/test/test_compat_bzip2_1.tbz.uu \ - libarchive/test/test_compat_bzip2_2.tbz.uu \ - libarchive/test/test_compat_cpio_1.cpio.uu \ - libarchive/test/test_compat_gtar_1.tar.uu \ - libarchive/test/test_compat_gzip_1.tgz.uu \ - libarchive/test/test_compat_gzip_2.tgz.uu \ - libarchive/test/test_compat_lzma_1.tlz.uu \ - libarchive/test/test_compat_lzma_2.tlz.uu \ - libarchive/test/test_compat_lzma_3.tlz.uu \ - libarchive/test/test_compat_solaris_tar_acl.tar.uu \ - libarchive/test/test_compat_tar_hardlink_1.tar.uu \ - libarchive/test/test_compat_xz_1.txz.uu \ - libarchive/test/test_compat_zip_1.zip.uu \ - libarchive/test/test_fuzz_1.iso.Z.uu \ - libarchive/test/test_pax_filename_encoding.tar.uu \ - libarchive/test/test_read_format_ar.ar.uu \ - libarchive/test/test_read_format_cpio_bin_be.cpio.uu \ - libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.rpm.uu \ - libarchive/test/test_read_format_cpio_svr4_gzip_rpm.rpm.uu \ - libarchive/test/test_read_format_gtar_sparse_1_13.tar.uu \ - libarchive/test/test_read_format_gtar_sparse_1_17.tar.uu \ - libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tar.uu \ - libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tar.uu \ - libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tar.uu \ - libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu \ - libarchive/test/test_read_format_iso.iso.Z.uu \ - libarchive/test/test_read_format_iso_2.iso.Z.uu \ - libarchive/test/test_read_format_iso_joliet.iso.Z.uu \ - libarchive/test/test_read_format_iso_joliet_long.iso.Z.uu \ - libarchive/test/test_read_format_iso_joliet_rockridge.iso.Z.uu \ - libarchive/test/test_read_format_iso_multi_extent.iso.Z.uu \ - libarchive/test/test_read_format_iso_rockridge.iso.Z.uu \ - libarchive/test/test_read_format_iso_rockridge_ce.iso.Z.uu \ - libarchive/test/test_read_format_iso_rockridge_new.iso.Z.uu \ - libarchive/test/test_read_format_iso_rockridge_rr_moved.iso.Z.uu\ - libarchive/test/test_read_format_iso_zisofs.iso.Z.uu \ - libarchive/test/test_read_format_mtree.mtree.uu \ - libarchive/test/test_read_format_raw.data.Z.uu \ - libarchive/test/test_read_format_raw.data.uu \ - libarchive/test/test_read_format_tar_empty_filename.tar.uu \ - libarchive/test/test_read_format_zip.zip.uu \ - libarchive/test/CMakeLists.txt \ - libarchive/test/README - -# -# Common code for libarchive frontends (cpio, tar) -# -libarchive_fe_la_SOURCES= \ - libarchive_fe/err.c \ - libarchive_fe/err.h \ - libarchive_fe/lafe_platform.h \ - libarchive_fe/line_reader.c \ - libarchive_fe/line_reader.h \ - libarchive_fe/matching.c \ - libarchive_fe/matching.h \ - libarchive_fe/pathmatch.c \ - libarchive_fe/pathmatch.h - -# -# -# bsdtar source, docs, etc. -# -# - -bsdtar_SOURCES= \ - tar/bsdtar.c \ - tar/bsdtar.h \ - tar/bsdtar_platform.h \ - tar/cmdline.c \ - tar/getdate.c \ - tar/read.c \ - tar/subst.c \ - tar/tree.c \ - tar/tree.h \ - tar/util.c \ - tar/write.c - -if INC_WINDOWS_FILES -bsdtar_SOURCES+= \ - tar/bsdtar_windows.h \ - tar/bsdtar_windows.c -endif - -bsdtar_DEPENDENCIES= libarchive.la libarchive_fe.la - -if STATIC_BSDTAR -bsdtar_ldstatic= -static -bsdtar_ccstatic= -DLIBARCHIVE_STATIC -else -bsdtar_ldstatic= -bsdtar_ccstatic= -endif - -bsdtar_LDADD= libarchive.la libarchive_fe.la -bsdtar_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdtar_ccstatic) $(PLATFORMCPPFLAGS) -bsdtar_LDFLAGS= $(bsdtar_ldstatic) - -bsdtar_EXTRA_DIST= \ - tar/bsdtar.1 \ - tar/bsdtar_windows.h \ - tar/bsdtar_windows.c \ - tar/CMakeLists.txt \ - tar/config_freebsd.h \ - tar/test/list.h - - -if BUILD_BSDTAR -bsdtar_man_MANS= tar/bsdtar.1 -bsdtar_programs= bsdtar -else -bsdtar_man_MANS= -bsdtar_programs= -endif - -# -# bsdtar_test -# - -bsdtar_test_SOURCES= \ - tar/getdate.c \ - tar/test/main.c \ - tar/test/test.h \ - tar/test/test_0.c \ - tar/test/test_basic.c \ - tar/test/test_copy.c \ - tar/test/test_empty_mtree.c \ - tar/test/test_getdate.c \ - tar/test/test_help.c \ - tar/test/test_option_T_upper.c \ - tar/test/test_option_q.c \ - tar/test/test_option_r.c \ - tar/test/test_option_s.c \ - tar/test/test_patterns.c \ - tar/test/test_stdio.c \ - tar/test/test_strip_components.c \ - tar/test/test_symlink_dir.c \ - tar/test/test_version.c \ - tar/test/test_windows.c - -# For now, bsdtar_test uses Windows shims from tar/bsdtar_windows.* -if INC_WINDOWS_FILES -bsdtar_test_SOURCES+= \ - tar/bsdtar_windows.h \ - tar/bsdtar_windows.c -endif - -bsdtar_test_CPPFLAGS=\ - -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe \ - -I$(top_srcdir)/tar -I$(top_builddir)/tar/test \ - $(PLATFORMCPPFLAGS) - -tar/test/list.h: Makefile - cat $(top_srcdir)/tar/test/test_*.c | grep DEFINE_TEST > tar/test/list.h - -if BUILD_BSDTAR -bsdtar_test_programs= bsdtar_test -bsdtar_TESTS_ENVIRONMENT= BSDTAR=`cd $(top_builddir);/bin/pwd`/bsdtar$(EXEEXT) BSDTAR_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/tar/test -else -bsdtar_test_programs= -bsdtar_TESTS_ENVIRONMENT= -endif - -bsdtar_test_EXTRA_DIST= \ - tar/test/test_patterns_2.tar.uu \ - tar/test/test_patterns_3.tar.uu \ - tar/test/test_patterns_4.tar.uu \ - tar/test/CMakeLists.txt - - -# -# -# bsdcpio source, docs, etc. -# -# - -bsdcpio_SOURCES= \ - cpio/cmdline.c \ - cpio/cpio.c \ - cpio/cpio.h \ - cpio/cpio_platform.h - -if INC_WINDOWS_FILES -bsdcpio_SOURCES+= \ - cpio/cpio_windows.h \ - cpio/cpio_windows.c -endif - -bsdcpio_DEPENDENCIES = libarchive.la libarchive_fe.la - - -if STATIC_BSDCPIO -bsdcpio_ldstatic= -static -bsdcpio_ccstatic= -DLIBARCHIVE_STATIC -else -bsdcpio_ldstatic= -bsdcpio_ccstatic= -endif - -bsdcpio_LDADD= libarchive_fe.la libarchive.la -bsdcpio_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdcpio_ccstatic) $(PLATFORMCPPFLAGS) -bsdcpio_LDFLAGS= $(bsdcpio_ldstatic) - -bsdcpio_EXTRA_DIST= \ - cpio/test/list.h \ - cpio/bsdcpio.1 \ - cpio/cpio_windows.h \ - cpio/cpio_windows.c \ - cpio/CMakeLists.txt \ - cpio/config_freebsd.h - - -if BUILD_BSDCPIO -# Manpages to install -bsdcpio_man_MANS= cpio/bsdcpio.1 -bsdcpio_programs= bsdcpio -else -bsdcpio_man_MANS= -bsdcpio_programs= -endif - -# -# bsdcpio_test -# - -bsdcpio_test_SOURCES= \ - cpio/cmdline.c \ - cpio/test/main.c \ - cpio/test/test.h \ - cpio/test/test_0.c \ - cpio/test/test_basic.c \ - cpio/test/test_cmdline.c \ - cpio/test/test_format_newc.c \ - cpio/test/test_gcpio_compat.c \ - cpio/test/test_option_B_upper.c \ - cpio/test/test_option_C_upper.c \ - cpio/test/test_option_J_upper.c \ - cpio/test/test_option_L_upper.c \ - cpio/test/test_option_Z_upper.c \ - cpio/test/test_option_a.c \ - cpio/test/test_option_c.c \ - cpio/test/test_option_d.c \ - cpio/test/test_option_f.c \ - cpio/test/test_option_help.c \ - cpio/test/test_option_l.c \ - cpio/test/test_option_lzma.c \ - cpio/test/test_option_m.c \ - cpio/test/test_option_t.c \ - cpio/test/test_option_u.c \ - cpio/test/test_option_version.c \ - cpio/test/test_option_y.c \ - cpio/test/test_option_z.c \ - cpio/test/test_owner_parse.c \ - cpio/test/test_passthrough_dotdot.c \ - cpio/test/test_passthrough_reverse.c \ - cpio/test/test_pathmatch.c - -bsdcpio_test_CPPFLAGS= \ - -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe \ - -I$(top_srcdir)/cpio -I$(top_builddir)/cpio/test \ - $(PLATFORMCPPFLAGS) -bsdcpio_test_LDADD=libarchive_fe.la - -cpio/test/list.h: Makefile - cat $(top_srcdir)/cpio/test/test_*.c | grep DEFINE_TEST > cpio/test/list.h - -if BUILD_BSDCPIO -bsdcpio_test_programs= bsdcpio_test -bsdcpio_TESTS_ENVIRONMENT= BSDCPIO=`cd $(top_builddir);/bin/pwd`/bsdcpio$(EXEEXT) BSDCPIO_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/cpio/test -else -bsdcpio_test_programs= -bsdcpio_TESTS_ENVIRONMENT= -endif - -bsdcpio_test_EXTRA_DIST= \ - cpio/test/test_gcpio_compat_ref.bin.uu \ - cpio/test/test_gcpio_compat_ref.crc.uu \ - cpio/test/test_gcpio_compat_ref.newc.uu \ - cpio/test/test_gcpio_compat_ref.ustar.uu \ - cpio/test/test_gcpio_compat_ref_nosym.bin.uu \ - cpio/test/test_gcpio_compat_ref_nosym.crc.uu \ - cpio/test/test_gcpio_compat_ref_nosym.newc.uu \ - cpio/test/test_gcpio_compat_ref_nosym.ustar.uu \ - cpio/test/test_option_f.cpio.uu \ - cpio/test/test_option_m.cpio.uu \ - cpio/test/test_option_t.cpio.uu \ - cpio/test/test_option_t.stdout.uu \ - cpio/test/test_option_tv.stdout.uu \ - cpio/test/CMakeLists.txt diff --git a/contrib/libarchive/build/autoconf/check_stdcall_func.m4 b/contrib/libarchive/build/autoconf/check_stdcall_func.m4 deleted file mode 100644 index 926b046c5330..000000000000 --- a/contrib/libarchive/build/autoconf/check_stdcall_func.m4 +++ /dev/null @@ -1,51 +0,0 @@ -# AC_LANG_STDCALL_FUNC_LINK_TRY(FUNCTION, SIGNATURE) -# ------------------------------- -# Produce a source which links correctly iff the FUNCTION exists. -AC_DEFUN([AC_LANG_STDCALL_FUNC_LINK_TRY], -[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)]) - -# AC_CHECK_STDCALL_FUNC(FUNCTION, SIGNATURE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# ----------------------------------------------------------------- -AC_DEFUN([AC_CHECK_STDCALL_FUNC], -[AS_VAR_PUSHDEF([ac_var], [ac_cv_func_$1])dnl -AC_CACHE_CHECK([for $1], ac_var, -[AC_LINK_IFELSE([AC_LANG_STDCALL_FUNC_LINK_TRY([$1],[$2])], - [AS_VAR_SET(ac_var, yes)], - [AS_VAR_SET(ac_var, no)])]) -AS_IF([test AS_VAR_GET(ac_var) = yes], [$3], [$4])dnl -AS_VAR_POPDEF([ac_var])dnl -])# AC_CHECK_FUNC - -# AC_LANG_STDCALL_FUNC_LINK_TRY(C)(FUNCTION, SIGNATURE) -# ---------------------------------- -# Don't include because on OSF/1 3.0 it includes -# which includes which contains a -# prototype for select. Similarly for bzero. -m4_define([AC_LANG_STDCALL_FUNC_LINK_TRY(C)], -[AC_LANG_PROGRAM( -[/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char __stdcall $1 ( $2 ) below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char __stdcall $1 ( $2 ); -char (*f) ( $2 ); -], -[/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$1) || defined (__stub___$1) -choke me -#else -f = $1; -#endif -])]) - -# AC_LANG_STDCALL_FUNC_LINK_TRY(C++)(FUNCTION) -# ------------------------------------ -m4_copy([AC_LANG_STDCALL_FUNC_LINK_TRY(C)], [AC_LANG_STDCALL_FUNC_LINK_TRY(C++)]) - diff --git a/contrib/libarchive/build/autoconf/la_uid_t.m4 b/contrib/libarchive/build/autoconf/la_uid_t.m4 deleted file mode 100644 index 31eef5e96fcb..000000000000 --- a/contrib/libarchive/build/autoconf/la_uid_t.m4 +++ /dev/null @@ -1,20 +0,0 @@ -# la_TYPE_UID_T -# ------------- -AC_DEFUN([la_TYPE_UID_T], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_CACHE_CHECK(for uid_t in sys/types.h, la_cv_type_uid_t, -[AC_EGREP_HEADER(uid_t, sys/types.h, - la_cv_type_uid_t=yes, la_cv_type_uid_t=no)]) -if test $la_cv_type_uid_t = no; then - case $host in - *mingw*) def_uid_t=short ;; - *) def_uid_t=int ;; - esac - AC_DEFINE_UNQUOTED(uid_t, [$def_uid_t], - [Define to match typeof st_uid field of struct stat if doesn't define.]) - AC_DEFINE_UNQUOTED(gid_t, [$def_uid_t], - [Define to match typeof st_gid field of struct stat if doesn't define.]) -fi -]) -AU_ALIAS([AC_TYPE_UID_T], [la_TYPE_UID_T]) - diff --git a/contrib/libarchive/build/autogen.sh b/contrib/libarchive/build/autogen.sh deleted file mode 100755 index ad7d245b794a..000000000000 --- a/contrib/libarchive/build/autogen.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh - -PATH=/usr/local/gnu-autotools/bin/:$PATH -export PATH - -# Start from one level above the build directory -if [ -f version ]; then - cd .. -fi - -if [ \! -f build/version ]; then - echo "Can't find source directory" - exit 1 -fi - -# BSD make's "OBJDIR" support freaks out the automake-generated -# Makefile. Effectively disable it. -export MAKEOBJDIRPREFIX=/junk - -# Start from the build directory, where the version file is located -if [ -f build/version ]; then - cd build -fi - -if [ \! -f version ]; then - echo "Can't find version file" - exit 1 -fi - -# Update the build number in the 'version' file. -# Separate number from additional alpha/beta/etc marker -MARKER=`cat version | sed 's/[0-9.]//g'` -# Bump the number -VN=`cat version | sed 's/[^0-9.]//g'` -# Build out the string. -VS="$(($VN/1000000)).$(( ($VN/1000)%1000 )).$(( $VN%1000 ))$MARKER" - -cd .. - -# Clean up the source dir as much as we can. -/bin/sh build/clean.sh - -# Substitute the integer version into Libarchive's archive.h -perl -p -i -e "s/^(#define\tARCHIVE_VERSION_NUMBER).*/\$1 $VN/" libarchive/archive.h -perl -p -i -e "s/^(#define\tARCHIVE_VERSION_STRING).*/\$1 \"libarchive $VS\"/" libarchive/archive.h -# Substitute versions into configure.ac as well -perl -p -i -e 's/(m4_define\(\[LIBARCHIVE_VERSION_S\]),.*\)/$1,['"$VS"'])/' configure.ac -perl -p -i -e 's/(m4_define\(\[LIBARCHIVE_VERSION_N\]),.*\)/$1,['"$VN"'])/' configure.ac - -set -xe -aclocal -I build/autoconf - -# Note: --automake flag needed only for libtoolize from -# libtool 1.5.x; in libtool 2.2.x it is a synonym for --quiet -case `uname` in -Darwin) glibtoolize --automake -c;; -*) libtoolize --automake -c;; -esac -autoconf -autoheader -automake -a -c - -curl 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' > build/autoconf/config.guess -curl 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' > build/autoconf/config.sub - -./configure -make distcheck -make dist-zip diff --git a/contrib/libarchive/build/bump-version.sh b/contrib/libarchive/build/bump-version.sh deleted file mode 100644 index 0304cf3fb329..000000000000 --- a/contrib/libarchive/build/bump-version.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh +v - -# Start from the build directory, where the version file is located -if [ -f build/version ]; then - cd build -fi - -if [ \! -f version ]; then - echo "Can't find version file" - exit 1 -fi - -# Update the build number in the 'version' file. -# Separate number from additional alpha/beta/etc marker -MARKER=`cat version | sed 's/[0-9.]//g'` -# Bump the number -VN=`cat version | sed 's/[^0-9.]//g'` -# Reassemble and write back out -VN=$(($VN + 1)) -rm -f version.old -mv version version.old -chmod +w version.old -echo $VN$MARKER > version -VS="$(($VN/1000000)).$(( ($VN/1000)%1000 )).$(( $VN%1000 ))$MARKER" -cd .. - -ANNOUNCE=`date +"%b %d, %Y:"`" libarchive $VS released" - -echo $ANNOUNCE - -# Add a version notice to NEWS -mv NEWS NEWS.bak -chmod +w NEWS.bak -echo > NEWS -echo $ANNOUNCE >> NEWS -cat NEWS.bak >> NEWS diff --git a/contrib/libarchive/build/clean.sh b/contrib/libarchive/build/clean.sh deleted file mode 100644 index 5b4c5624a60d..000000000000 --- a/contrib/libarchive/build/clean.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/sh - -if [ \! -f build/version ]; then - echo 'Must run the clean script from the top-level dir of the libarchive distribution' 1>&2 - exit 1 -fi - -# -# The automake-generated 'maintainer-clean' target does clean up a -# lot. If that fails, try plain 'clean' in case we're using the cmake -# or other makefile. But don't worry if we can't... -# -make maintainer-clean || make clean || true - -# If we're on BSD, blow away the build dir under /usr/obj -rm -rf /usr/obj`pwd` - -# -# Try to clean up a bit more... -# - -find . -name '*.So' | xargs rm -find . -name '*.a' | xargs rm -find . -name '*.la' | xargs rm -find . -name '*.lo' | xargs rm -find . -name '*.o' | xargs rm -find . -name '*.orig' | xargs rm -find . -name '*.po' | xargs rm -find . -name '*.rej' | xargs rm -find . -name '*~' | xargs rm -find . -name '.depend' | xargs rm -find . -name '.deps' | xargs rm -rf -find . -name '.dirstamp' | xargs rm -find . -name '.libs' | xargs rm -rf - -rm -rf autom4te.cache - -rm -f Makefile.in -rm -f aclocal.m4 -rm -f bsdcpio -rm -f bsdcpio_test -rm -f bsdtar -rm -f bsdtar_test -rm -f build/autoconf/compile -rm -f build/autoconf/config.* -rm -f build/autoconf/depcomp -rm -f build/autoconf/install-sh -rm -f build/autoconf/libtool.m4 -rm -f build/autoconf/ltmain.sh -rm -f build/autoconf/ltoptions.m4 -rm -f build/autoconf/ltsugar.m4 -rm -f build/autoconf/ltversion.m4 -rm -f build/autoconf/lt~obsolete.m4 -rm -f build/autoconf/missing -rm -f build/pkgconfig/libarchive.pc -rm -f build/version.old -rm -f config.h -rm -f config.h.in -rm -f config.log -rm -f config.status -rm -f configure -rm -f cpio/*.1.gz -rm -f cpio/bsdcpio -rm -f cpio/test/bsdcpio_test -rm -f cpio/test/list.h -rm -f doc/html/* -rm -f doc/man/* -rm -f doc/pdf/* -rm -f doc/text/* -rm -f doc/wiki/* -rm -f libarchive/*.[35].gz -rm -f libarchive/libarchive.so* -rm -f libarchive/test/libarchive_test -rm -f libarchive/test/list.h -rm -f libarchive_test -rm -f libtool -rm -f stamp-h1 -rm -f tar/*.1.gz -rm -f tar/bsdtar -rm -f tar/test/bsdtar_test -rm -f tar/test/list.h diff --git a/contrib/libarchive/build/cmake/AddTest28.cmake b/contrib/libarchive/build/cmake/AddTest28.cmake deleted file mode 100644 index ab26a9a9b8bf..000000000000 --- a/contrib/libarchive/build/cmake/AddTest28.cmake +++ /dev/null @@ -1,107 +0,0 @@ -# - Macro approximating the CMake 2.8 ADD_TEST(NAME) signature. -# ADD_TEST_28(NAME COMMAND [arg1 [arg2 ...]]) -# - The name of the test -# - The test executable -# [argN...] - Arguments to the test executable -# This macro approximates the ADD_TEST(NAME) signature provided in -# CMake 2.8 but works with CMake 2.6 too. See CMake 2.8 documentation -# of ADD_TEST()for details. -# -# This macro automatically replaces a that names an -# executable target with the target location. A generator expression -# of the form "$" is supported in both the command -# and arguments of the test. Howerver, this macro only works for -# targets without per-config output name properties set. -# -# Example usage: -# add_test(NAME mytest COMMAND testDriver --exe $) -# This creates a test "mytest" whose command runs a testDriver tool -# passing the full path to the executable file produced by target -# "myexe". - -#============================================================================= -# Copyright 2009 Kitware, Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer -# in this position and unchanged. -# 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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. -#============================================================================= - -CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3) - -# CMake 2.8 supports ADD_TEST(NAME) natively. -IF(NOT "${CMAKE_VERSION}" VERSION_LESS "2.8") - MACRO(ADD_TEST_28) - ADD_TEST(${ARGV}) - ENDMACRO() - RETURN() -ENDIF() - -# Simulate ADD_TEST(NAME) signature from CMake 2.8. -MACRO(ADD_TEST_28 NAME name COMMAND command) - # Enforce the signature. - IF(NOT "x${NAME}" STREQUAL "xNAME") - MESSAGE(FATAL_ERROR "First ADD_TEST_28 argument must be \"NAME\"") - ENDIF() - IF(NOT "x${COMMAND}" STREQUAL "xCOMMAND") - MESSAGE(FATAL_ERROR "Third ADD_TEST_28 argument must be \"COMMAND\"") - ENDIF() - - # Perform "COMMAND myexe ..." substitution. - SET(cmd "${command}") - IF(TARGET "${cmd}") - _ADD_TEST_28_GET_EXE(${cmd} cmd) - ENDIF() - - # Perform "COMMAND ... $ ..." substitution. - SET(target_file "\\$") - SET(args) - FOREACH(ARG ${cmd} ${ARGN}) - SET(arg "${ARG}") - IF("${arg}" MATCHES "${target_file}") - STRING(REGEX REPLACE "${target_file}" "\\1" tgt "${arg}") - IF(TARGET "${tgt}") - _ADD_TEST_28_GET_EXE(${tgt} exe) - STRING(REGEX REPLACE "${target_file}" "${exe}" arg "${arg}") - ENDIF() - ENDIF() - LIST(APPEND args "${arg}") - ENDFOREACH() - - # Invoke old ADD_TEST() signature with transformed arguments. - ADD_TEST(${name} ${args}) -ENDMACRO() - -# Get the test-time location of an executable target. -MACRO(_ADD_TEST_28_GET_EXE tgt exe_var) - # The LOCATION property gives a build-time location. - GET_TARGET_PROPERTY(${exe_var} ${tgt} LOCATION) - - # In single-configuration generatrs the build-time and test-time - # locations are the same because there is no per-config variable - # reference. In multi-configuration generators the following - # substitution converts the build-time configuration variable - # reference to a test-time configuration variable reference. - IF(CMAKE_CONFIGURATION_TYPES) - STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CTEST_CONFIGURATION_TYPE}" - ${exe_var} "${${exe_var}}") - ENDIF(CMAKE_CONFIGURATION_TYPES) -ENDMACRO() diff --git a/contrib/libarchive/build/cmake/CheckFileOffsetBits.c b/contrib/libarchive/build/cmake/CheckFileOffsetBits.c deleted file mode 100644 index d948fecf2b4e..000000000000 --- a/contrib/libarchive/build/cmake/CheckFileOffsetBits.c +++ /dev/null @@ -1,14 +0,0 @@ -#include - -#define KB ((off_t)1024) -#define MB ((off_t)1024 * KB) -#define GB ((off_t)1024 * MB) -#define TB ((off_t)1024 * GB) -int t2[(((64 * GB -1) % 671088649) == 268434537) - && (((TB - (64 * GB -1) + 255) % 1792151290) == 305159546)? 1: -1]; - -int main() -{ - ; - return 0; -} diff --git a/contrib/libarchive/build/cmake/CheckFileOffsetBits.cmake b/contrib/libarchive/build/cmake/CheckFileOffsetBits.cmake deleted file mode 100644 index 4132b387e178..000000000000 --- a/contrib/libarchive/build/cmake/CheckFileOffsetBits.cmake +++ /dev/null @@ -1,44 +0,0 @@ -# - Check if _FILE_OFFSET_BITS macro needed for large files -# CHECK_FILE_OFFSET_BITS () -# -# The following variables may be set before calling this macro to -# modify the way the check is run: -# -# CMAKE_REQUIRED_FLAGS = string of compile command line flags -# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) -# CMAKE_REQUIRED_INCLUDES = list of include directories -# Copyright (c) 2009, Michihiro NAKAJIMA -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -#INCLUDE(CheckCXXSourceCompiles) - -GET_FILENAME_COMPONENT(_selfdir_CheckFileOffsetBits - "${CMAKE_CURRENT_LIST_FILE}" PATH) - -MACRO (CHECK_FILE_OFFSET_BITS) - IF(NOT DEFINED _FILE_OFFSET_BITS) - MESSAGE(STATUS "Cheking _FILE_OFFSET_BITS for large files") - TRY_COMPILE(__WITHOUT_FILE_OFFSET_BITS_64 - ${CMAKE_CURRENT_BINARY_DIR} - ${_selfdir_CheckFileOffsetBits}/CheckFileOffsetBits.c - COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}) - IF(NOT __WITHOUT_FILE_OFFSET_BITS_64) - TRY_COMPILE(__WITH_FILE_OFFSET_BITS_64 - ${CMAKE_CURRENT_BINARY_DIR} - ${_selfdir_CheckFileOffsetBits}/CheckFileOffsetBits.c - COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_FILE_OFFSET_BITS=64) - ENDIF(NOT __WITHOUT_FILE_OFFSET_BITS_64) - - IF(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64) - SET(_FILE_OFFSET_BITS 64 CACHE INTERNAL "_FILE_OFFSET_BITS macro needed for large files") - MESSAGE(STATUS "Cheking _FILE_OFFSET_BITS for large files - needed") - ELSE(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64) - SET(_FILE_OFFSET_BITS "" CACHE INTERNAL "_FILE_OFFSET_BITS macro needed for large files") - MESSAGE(STATUS "Cheking _FILE_OFFSET_BITS for large files - not needed") - ENDIF(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64) - ENDIF(NOT DEFINED _FILE_OFFSET_BITS) - -ENDMACRO (CHECK_FILE_OFFSET_BITS) - diff --git a/contrib/libarchive/build/cmake/CheckFuncs.cmake b/contrib/libarchive/build/cmake/CheckFuncs.cmake deleted file mode 100644 index 0670df97f869..000000000000 --- a/contrib/libarchive/build/cmake/CheckFuncs.cmake +++ /dev/null @@ -1,49 +0,0 @@ -# Check if the system has the specified function; treat glibc "stub" -# functions as nonexistent: -# CHECK_FUNCTION_EXISTS_GLIBC (FUNCTION FUNCVAR) -# -# FUNCTION - the function(s) where the prototype should be declared -# FUNCVAR - variable to define if the function does exist -# -# In particular, this understands the glibc convention of -# defining macros __stub_XXXX or __stub___XXXX if the function -# does appear in the library but is merely a stub that does nothing. -# By detecting this case, we can select alternate behavior on -# platforms that don't support this functionality. -# -# The following variables may be set before calling this macro to -# modify the way the check is run: -# -# CMAKE_REQUIRED_FLAGS = string of compile command line flags -# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) -# CMAKE_REQUIRED_INCLUDES = list of include directories -# Copyright (c) 2009, Michihiro NAKAJIMA -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -INCLUDE(CheckFunctionExists) -GET_FILENAME_COMPONENT(_selfdir_CheckFunctionExistsGlibc - "${CMAKE_CURRENT_LIST_FILE}" PATH) - -MACRO (CHECK_FUNCTION_EXISTS_GLIBC _FUNC _FUNCVAR) - IF(NOT DEFINED ${_FUNCVAR}) - SET(CHECK_STUB_FUNC_1 "__stub_${_FUNC}") - SET(CHECK_STUB_FUNC_2 "__stub___${_FUNC}") - CONFIGURE_FILE( ${_selfdir_CheckFunctionExistsGlibc}/CheckFuncs_stub.c.in - ${CMAKE_CURRENT_BINARY_DIR}/cmake.tmp/CheckFuncs_stub.c IMMEDIATE) - TRY_COMPILE(__stub - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_BINARY_DIR}/cmake.tmp/CheckFuncs_stub.c - COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} - CMAKE_FLAGS - -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILE_FLAGS} - "${CHECK_INCLUDE_FILE_C_INCLUDE_DIRS}") - IF (__stub) - SET("${_FUNCVAR}" "" CACHE INTERNAL "Have function ${_FUNC}") - ELSE (__stub) - CHECK_FUNCTION_EXISTS("${_FUNC}" "${_FUNCVAR}") - ENDIF (__stub) - ENDIF(NOT DEFINED ${_FUNCVAR}) -ENDMACRO (CHECK_FUNCTION_EXISTS_GLIBC) - diff --git a/contrib/libarchive/build/cmake/CheckFuncs_stub.c.in b/contrib/libarchive/build/cmake/CheckFuncs_stub.c.in deleted file mode 100644 index 50da414b5f51..000000000000 --- a/contrib/libarchive/build/cmake/CheckFuncs_stub.c.in +++ /dev/null @@ -1,16 +0,0 @@ -#ifdef __STDC__ -#include -#else -#include -#endif - -int -main() -{ -#if defined ${CHECK_STUB_FUNC_1} || defined ${CHECK_STUB_FUNC_2} - return 0; -#else -this system have stub - return 0; -#endif -} diff --git a/contrib/libarchive/build/cmake/CheckHeaderDirent.cmake b/contrib/libarchive/build/cmake/CheckHeaderDirent.cmake deleted file mode 100644 index e9a7ea855326..000000000000 --- a/contrib/libarchive/build/cmake/CheckHeaderDirent.cmake +++ /dev/null @@ -1,32 +0,0 @@ -# - Check if the system has the specified type -# CHECK_HEADER_DIRENT (HEADER1 HEARDER2 ...) -# -# HEADER - the header(s) where the prototype should be declared -# -# The following variables may be set before calling this macro to -# modify the way the check is run: -# -# CMAKE_REQUIRED_FLAGS = string of compile command line flags -# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) -# CMAKE_REQUIRED_INCLUDES = list of include directories -# Copyright (c) 2009, Michihiro NAKAJIMA -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - - -INCLUDE(CheckTypeExists) - -MACRO (CHECK_HEADER_DIRENT) - CHECK_TYPE_EXISTS("DIR *" dirent.h HAVE_DIRENT_H) - IF(NOT HAVE_DIRENT_H) - CHECK_TYPE_EXISTS("DIR *" sys/ndir.h HAVE_SYS_NDIR_H) - IF(NOT HAVE_SYS_NDIR_H) - CHECK_TYPE_EXISTS("DIR *" ndir.h HAVE_NDIR_H) - IF(NOT HAVE_NDIR_H) - CHECK_TYPE_EXISTS("DIR *" sys/dir.h HAVE_SYS_DIR_H) - ENDIF(NOT HAVE_NDIR_H) - ENDIF(NOT HAVE_SYS_NDIR_H) - ENDIF(NOT HAVE_DIRENT_H) -ENDMACRO (CHECK_HEADER_DIRENT) - diff --git a/contrib/libarchive/build/cmake/CheckStructMember.cmake b/contrib/libarchive/build/cmake/CheckStructMember.cmake deleted file mode 100644 index 05ddb3a11f20..000000000000 --- a/contrib/libarchive/build/cmake/CheckStructMember.cmake +++ /dev/null @@ -1,43 +0,0 @@ -# - Check if the given struct or class has the specified member variable -# CHECK_STRUCT_MEMBER (STRUCT MEMBER HEADER VARIABLE) -# -# STRUCT - the name of the struct or class you are interested in -# MEMBER - the member which existence you want to check -# HEADER - the header(s) where the prototype should be declared -# VARIABLE - variable to store the result -# -# The following variables may be set before calling this macro to -# modify the way the check is run: -# -# CMAKE_REQUIRED_FLAGS = string of compile command line flags -# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) -# CMAKE_REQUIRED_INCLUDES = list of include directories - -# Copyright (c) 2006, Alexander Neundorf, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - - -INCLUDE(CheckCSourceCompiles) - -MACRO (CHECK_STRUCT_MEMBER _STRUCT _MEMBER _HEADER _RESULT) - SET(_INCLUDE_FILES) - FOREACH (it ${_HEADER}) - SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") - ENDFOREACH (it) - - SET(_CHECK_STRUCT_MEMBER_SOURCE_CODE " -${_INCLUDE_FILES} -int main() -{ - static ${_STRUCT} tmp; - if (sizeof(tmp.${_MEMBER})) - return 0; - return 0; -} -") - CHECK_C_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT}) - -ENDMACRO (CHECK_STRUCT_MEMBER) - diff --git a/contrib/libarchive/build/cmake/CheckTypeExists.cmake b/contrib/libarchive/build/cmake/CheckTypeExists.cmake deleted file mode 100644 index b05234fd8753..000000000000 --- a/contrib/libarchive/build/cmake/CheckTypeExists.cmake +++ /dev/null @@ -1,42 +0,0 @@ -# - Check if the system has the specified type -# CHECK_TYPE_EXISTS (TYPE HEADER VARIABLE) -# -# TYPE - the name of the type or struct or class you are interested in -# HEADER - the header(s) where the prototype should be declared -# VARIABLE - variable to store the result -# -# The following variables may be set before calling this macro to -# modify the way the check is run: -# -# CMAKE_REQUIRED_FLAGS = string of compile command line flags -# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) -# CMAKE_REQUIRED_INCLUDES = list of include directories -# Copyright (c) 2009, Michihiro NAKAJIMA -# Copyright (c) 2006, Alexander Neundorf, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - - -INCLUDE(CheckCSourceCompiles) - -MACRO (CHECK_TYPE_EXISTS _TYPE _HEADER _RESULT) - SET(_INCLUDE_FILES) - FOREACH (it ${_HEADER}) - SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") - ENDFOREACH (it) - - SET(_CHECK_TYPE_EXISTS_SOURCE_CODE " -${_INCLUDE_FILES} -int main() -{ - static ${_TYPE} tmp; - if (sizeof(tmp)) - return 0; - return 0; -} -") - CHECK_C_SOURCE_COMPILES("${_CHECK_TYPE_EXISTS_SOURCE_CODE}" ${_RESULT}) - -ENDMACRO (CHECK_TYPE_EXISTS) - diff --git a/contrib/libarchive/build/cmake/FindLZMA.cmake b/contrib/libarchive/build/cmake/FindLZMA.cmake deleted file mode 100644 index 1d065c4abcc7..000000000000 --- a/contrib/libarchive/build/cmake/FindLZMA.cmake +++ /dev/null @@ -1,52 +0,0 @@ -# - Find lzma and lzmadec -# Find the native LZMA includes and library -# -# 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 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 -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZMA DEFAULT_MSG LZMA_LIBRARY LZMA_INCLUDE_DIR) - -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 - LZMADEC_LIBRARY LZMADEC_INCLUDE_DIR ) diff --git a/contrib/libarchive/build/cmake/config.h.in b/contrib/libarchive/build/cmake/config.h.in deleted file mode 100644 index d2f14b4e464e..000000000000 --- a/contrib/libarchive/build/cmake/config.h.in +++ /dev/null @@ -1,759 +0,0 @@ -/* config.h. Generated from config.h.cmake by cmake configure */ - -/* Define ZLIB_WINAPI if zlib was built on Visual Studio. */ -#cmakedefine ZLIB_WINAPI 1 - -/* MD5 via ARCHIVE_HASH_MD5_LIBC supported. */ -#cmakedefine ARCHIVE_HASH_MD5_LIBC - -/* MD5 via ARCHIVE_HASH_MD5_LIBSYSTEM supported. */ -#cmakedefine ARCHIVE_HASH_MD5_LIBSYSTEM - -/* MD5 via ARCHIVE_HASH_MD5_OPENSSL supported. */ -#cmakedefine ARCHIVE_HASH_MD5_OPENSSL - -/* MD5 via ARCHIVE_HASH_MD5_WIN supported. */ -#cmakedefine ARCHIVE_HASH_MD5_WIN - -/* RMD160 via ARCHIVE_HASH_RMD160_LIBC supported. */ -#cmakedefine ARCHIVE_HASH_RMD160_LIBC - -/* RMD160 via ARCHIVE_HASH_RMD160_OPENSSL supported. */ -#cmakedefine ARCHIVE_HASH_RMD160_OPENSSL - -/* SHA1 via ARCHIVE_HASH_SHA1_LIBC supported. */ -#cmakedefine ARCHIVE_HASH_SHA1_LIBC - -/* SHA1 via ARCHIVE_HASH_SHA1_LIBSYSTEM supported. */ -#cmakedefine ARCHIVE_HASH_SHA1_LIBSYSTEM - -/* SHA1 via ARCHIVE_HASH_SHA1_OPENSSL supported. */ -#cmakedefine ARCHIVE_HASH_SHA1_OPENSSL - -/* SHA1 via ARCHIVE_HASH_SHA1_WIN supported. */ -#cmakedefine ARCHIVE_HASH_SHA1_WIN - -/* SHA256 via ARCHIVE_HASH_SHA256_LIBC supported. */ -#cmakedefine ARCHIVE_HASH_SHA256_LIBC - -/* SHA256 via ARCHIVE_HASH_SHA256_LIBC2 supported. */ -#cmakedefine ARCHIVE_HASH_SHA256_LIBC2 - -/* SHA256 via ARCHIVE_HASH_SHA256_LIBC3 supported. */ -#cmakedefine ARCHIVE_HASH_SHA256_LIBC3 - -/* SHA256 via ARCHIVE_HASH_SHA256_LIBSYSTEM supported. */ -#cmakedefine ARCHIVE_HASH_SHA256_LIBSYSTEM - -/* SHA256 via ARCHIVE_HASH_SHA256_OPENSSL supported. */ -#cmakedefine ARCHIVE_HASH_SHA256_OPENSSL - -/* SHA256 via ARCHIVE_HASH_SHA256_WIN supported. */ -#cmakedefine ARCHIVE_HASH_SHA256_WIN - -/* SHA384 via ARCHIVE_HASH_SHA384_LIBC supported. */ -#cmakedefine ARCHIVE_HASH_SHA384_LIBC - -/* SHA384 via ARCHIVE_HASH_SHA384_LIBC2 supported. */ -#cmakedefine ARCHIVE_HASH_SHA384_LIBC2 - -/* SHA384 via ARCHIVE_HASH_SHA384_LIBC3 supported. */ -#cmakedefine ARCHIVE_HASH_SHA384_LIBC3 - -/* SHA384 via ARCHIVE_HASH_SHA384_LIBSYSTEM supported. */ -#cmakedefine ARCHIVE_HASH_SHA384_LIBSYSTEM - -/* SHA384 via ARCHIVE_HASH_SHA384_OPENSSL supported. */ -#cmakedefine ARCHIVE_HASH_SHA384_OPENSSL - -/* SHA384 via ARCHIVE_HASH_SHA384_WIN supported. */ -#cmakedefine ARCHIVE_HASH_SHA384_WIN - -/* SHA512 via ARCHIVE_HASH_SHA512_LIBC supported. */ -#cmakedefine ARCHIVE_HASH_SHA512_LIBC - -/* SHA512 via ARCHIVE_HASH_SHA512_LIBC2 supported. */ -#cmakedefine ARCHIVE_HASH_SHA512_LIBC2 - -/* SHA512 via ARCHIVE_HASH_SHA512_LIBC3 supported. */ -#cmakedefine ARCHIVE_HASH_SHA512_LIBC3 - -/* SHA512 via ARCHIVE_HASH_SHA512_LIBSYSTEM supported. */ -#cmakedefine ARCHIVE_HASH_SHA512_LIBSYSTEM - -/* SHA512 via ARCHIVE_HASH_SHA512_OPENSSL supported. */ -#cmakedefine ARCHIVE_HASH_SHA512_OPENSSL - -/* SHA512 via ARCHIVE_HASH_SHA512_WIN supported. */ -#cmakedefine ARCHIVE_HASH_SHA512_WIN - -/* Version number of bsdcpio */ -#cmakedefine BSDCPIO_VERSION_STRING "${BSDCPIO_VERSION_STRING}" - -/* Version number of bsdtar */ -#cmakedefine BSDTAR_VERSION_STRING "${BSDTAR_VERSION_STRING}" - -/* Define to 1 if you have the `acl_create_entry' function. */ -#cmakedefine HAVE_ACL_CREATE_ENTRY 1 - -/* Define to 1 if you have the `acl_get_link' function. */ -#cmakedefine HAVE_ACL_GET_LINK 1 - -/* Define to 1 if you have the `acl_get_link_np' function. */ -#cmakedefine HAVE_ACL_GET_LINK_NP 1 - -/* Define to 1 if you have the `acl_get_perm' function. */ -#cmakedefine HAVE_ACL_GET_PERM 1 - -/* Define to 1 if you have the `acl_get_perm_np' function. */ -#cmakedefine HAVE_ACL_GET_PERM_NP 1 - -/* Define to 1 if you have the `acl_init' function. */ -#cmakedefine HAVE_ACL_INIT 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_ACL_LIBACL_H 1 - -/* Define to 1 if the system has the type `acl_permset_t'. */ -#cmakedefine HAVE_ACL_PERMSET_T 1 - -/* Define to 1 if you have the `acl_set_fd' function. */ -#cmakedefine HAVE_ACL_SET_FD 1 - -/* Define to 1 if you have the `acl_set_fd_np' function. */ -#cmakedefine HAVE_ACL_SET_FD_NP 1 - -/* Define to 1 if you have the `acl_set_file' function. */ -#cmakedefine HAVE_ACL_SET_FILE 1 - -/* True for systems with POSIX ACL support */ -#cmakedefine HAVE_ACL_USER 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_ATTR_XATTR_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_BSDXML_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_BZLIB_H 1 - -/* Define to 1 if you have the `chflags' function. */ -#cmakedefine HAVE_CHFLAGS 1 - -/* Define to 1 if you have the `chown' function. */ -#cmakedefine HAVE_CHOWN 1 - -/* Define to 1 if you have the `chroot' function. */ -#cmakedefine HAVE_CHROOT 1 - -/* Define to 1 if you have the `CreateHardLinkA' function. */ -#cmakedefine HAVE_CREATEHARDLINKA 1 - -/* Define to 1 if you have the `CreateHardLinkW' function. */ -#cmakedefine HAVE_CREATEHARDLINKW 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_CTYPE_H 1 - -/* Define to 1 if you have the `cygwin_conv_path' function. */ -#cmakedefine HAVE_CYGWIN_CONV_PATH 1 - -/* Define to 1 if you have the declaration of `INT64_MAX', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_INT64_MAX 1 - -/* Define to 1 if you have the declaration of `INT64_MIN', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_INT64_MIN 1 - -/* Define to 1 if you have the declaration of `optarg', and to 0 if you don't. - */ -#cmakedefine HAVE_DECL_OPTARG 1 - -/* Define to 1 if you have the declaration of `optind', and to 0 if you don't. - */ -#cmakedefine HAVE_DECL_OPTIND 1 - -/* Define to 1 if you have the declaration of `SIZE_MAX', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_SIZE_MAX 1 - -/* Define to 1 if you have the declaration of `SSIZE_MAX', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_SSIZE_MAX 1 - -/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_STRERROR_R 1 - -/* Define to 1 if you have the declaration of `UINT32_MAX', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_UINT32_MAX 1 - -/* Define to 1 if you have the declaration of `UINT64_MAX', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_UINT64_MAX 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_DIRECT_H 1 - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#cmakedefine HAVE_DIRENT_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_DLFCN_H 1 - -/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ -#cmakedefine HAVE_DOPRNT 1 - -/* Define to 1 if nl_langinfo supports D_MD_ORDER */ -#cmakedefine HAVE_D_MD_ORDER 1 - -/* A possible errno value for invalid file format errors */ -#cmakedefine HAVE_EFTYPE 1 - -/* A possible errno value for invalid file format errors */ -#cmakedefine HAVE_EILSEQ 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_ERRNO_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_EXPAT_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_EXT2FS_EXT2_FS_H 1 - -/* Define to 1 if you have the `extattr_get_file' function. */ -#cmakedefine HAVE_EXTATTR_GET_FILE 1 - -/* Define to 1 if you have the `extattr_list_file' function. */ -#cmakedefine HAVE_EXTATTR_LIST_FILE 1 - -/* Define to 1 if you have the `extattr_set_fd' function. */ -#cmakedefine HAVE_EXTATTR_SET_FD 1 - -/* Define to 1 if you have the `extattr_set_file' function. */ -#cmakedefine HAVE_EXTATTR_SET_FILE 1 - -/* Define to 1 if you have the `fchdir' function. */ -#cmakedefine HAVE_FCHDIR 1 - -/* Define to 1 if you have the `fchflags' function. */ -#cmakedefine HAVE_FCHFLAGS 1 - -/* Define to 1 if you have the `fchmod' function. */ -#cmakedefine HAVE_FCHMOD 1 - -/* Define to 1 if you have the `fchown' function. */ -#cmakedefine HAVE_FCHOWN 1 - -/* Define to 1 if you have the `fcntl' function. */ -#cmakedefine HAVE_FCNTL 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_FCNTL_H 1 - -/* Define to 1 if you have the `fork' function. */ -#cmakedefine HAVE_FORK 1 - -/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ -#cmakedefine HAVE_FSEEKO 1 - -/* Define to 1 if you have the `fsetxattr' function. */ -#cmakedefine HAVE_FSETXATTR 1 - -/* Define to 1 if you have the `fstat' function. */ -#cmakedefine HAVE_FSTAT 1 - -/* Define to 1 if you have the `ftruncate' function. */ -#cmakedefine HAVE_FTRUNCATE 1 - -/* Define to 1 if you have the `futimens' function. */ -#cmakedefine HAVE_FUTIMENS 1 - -/* Define to 1 if you have the `futimes' function. */ -#cmakedefine HAVE_FUTIMES 1 - -/* Define to 1 if you have the `geteuid' function. */ -#cmakedefine HAVE_GETEUID 1 - -/* Define to 1 if you have the `getgrgid_r' function. */ -#cmakedefine HAVE_GETGRGID_R 1 - -/* Define to 1 if you have the `getgrnam_r' function. */ -#cmakedefine HAVE_GETGRNAM_R 1 - -/* Define to 1 if you have the `getpwnam_r' function. */ -#cmakedefine HAVE_GETPWNAM_R 1 - -/* Define to 1 if you have the `getpwuid_r' function. */ -#cmakedefine HAVE_GETPWUID_R 1 - -/* Define to 1 if you have the `getpid' function. */ -#cmakedefine HAVE_GETPID 1 - -/* Define to 1 if you have the `getxattr' function. */ -#cmakedefine HAVE_GETXATTR 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_GRP_H 1 - -/* Define to 1 if the system has the type `intmax_t'. */ -#cmakedefine HAVE_INTMAX_T 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_IO_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LANGINFO_H 1 - -/* Define to 1 if you have the `lchflags' function. */ -#cmakedefine HAVE_LCHFLAGS 1 - -/* Define to 1 if you have the `lchmod' function. */ -#cmakedefine HAVE_LCHMOD 1 - -/* Define to 1 if you have the `lchown' function. */ -#cmakedefine HAVE_LCHOWN 1 - -/* Define to 1 if you have the `lgetxattr' function. */ -#cmakedefine HAVE_LGETXATTR 1 - -/* Define to 1 if you have the `acl' library (-lacl). */ -#cmakedefine HAVE_LIBACL 1 - -/* Define to 1 if you have the `attr' library (-lattr). */ -#cmakedefine HAVE_LIBATTR 1 - -/* Define to 1 if you have the `bsdxml' library (-lbsdxml). */ -#cmakedefine HAVE_LIBBSDXML 1 - -/* Define to 1 if you have the `bz2' library (-lbz2). */ -#cmakedefine HAVE_LIBBZ2 1 - -/* Define to 1 if you have the `expat' library (-lexpat). */ -#cmakedefine HAVE_LIBEXPAT 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 - -/* Define to 1 if you have the `xml2' library (-lxml2). */ -#cmakedefine HAVE_LIBXML2 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LIBXML_XMLREADER_H 1 - -/* Define to 1 if you have the `z' library (-lz). */ -#cmakedefine HAVE_LIBZ 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LIMITS_H 1 - -/* Define to 1 if you have the link() function. */ -#cmakedefine HAVE_LINK 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LINUX_FS_H 1 - -/* Define to 1 if you have the `listxattr' function. */ -#cmakedefine HAVE_LISTXATTR 1 - -/* Define to 1 if you have the `llistxattr' function. */ -#cmakedefine HAVE_LLISTXATTR 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LOCALE_H 1 - -/* Define to 1 if the system has the type `long long int'. */ -#cmakedefine HAVE_LONG_LONG_INT 1 - -/* Define to 1 if you have the `lsetxattr' function. */ -#cmakedefine HAVE_LSETXATTR 1 - -/* Define to 1 if you have the `lstat' function. */ -#cmakedefine HAVE_LSTAT 1 - -/* Define to 1 if `lstat' has the bug that it succeeds when given the - zero-length file name argument. */ -#cmakedefine HAVE_LSTAT_EMPTY_STRING_BUG 1 - -/* Define to 1 if you have the `lutimes' function. */ -#cmakedefine HAVE_LUTIMES 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LZMADEC_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LZMA_H 1 - -/* Define to 1 if you have the `memmove' function. */ -#cmakedefine HAVE_MEMMOVE 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `mkdir' function. */ -#cmakedefine HAVE_MKDIR 1 - -/* Define to 1 if you have the `mkfifo' function. */ -#cmakedefine HAVE_MKFIFO 1 - -/* Define to 1 if you have the `mknod' function. */ -#cmakedefine HAVE_MKNOD 1 - -/* Define to 1 if you have the header file, and it defines `DIR'. */ -#cmakedefine HAVE_NDIR_H 1 - -/* Define to 1 if you have the `nl_langinfo' function. */ -#cmakedefine HAVE_NL_LANGINFO 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_PATHS_H 1 - -/* Define to 1 if you have the `pipe' function. */ -#cmakedefine HAVE_PIPE 1 - -/* Define to 1 if you have the `poll' function. */ -#cmakedefine HAVE_POLL 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_POLL_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_PROCESS_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_PWD_H 1 - -/* Define to 1 if you have the `readlink' function. */ -#cmakedefine HAVE_READLINK 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_REGEX_H 1 - -/* Define to 1 if you have the `select' function. */ -#cmakedefine HAVE_SELECT 1 - -/* Define to 1 if you have the `setenv' function. */ -#cmakedefine HAVE_SETENV 1 - -/* Define to 1 if you have the `setlocale' function. */ -#cmakedefine HAVE_SETLOCALE 1 - -/* Define to 1 if you have the `sigaction' function. */ -#cmakedefine HAVE_SIGACTION 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SIGNAL_H 1 - -/* Define to 1 if `stat' has the bug that it succeeds when given the - zero-length file name argument. */ -#cmakedefine HAVE_STAT_EMPTY_STRING_BUG 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STDARG_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strchr' function. */ -#cmakedefine HAVE_STRCHR 1 - -/* Define to 1 if you have the `strdup' function. */ -#cmakedefine HAVE_STRDUP 1 - -/* Define to 1 if you have the `strerror' function. */ -#cmakedefine HAVE_STRERROR 1 - -/* Define to 1 if you have the `strerror_r' function. */ -#cmakedefine HAVE_STRERROR_R 1 - -/* Define to 1 if you have the `strftime' function. */ -#cmakedefine HAVE_STRFTIME 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STRING_H 1 - -/* Define to 1 if you have the `strrchr' function. */ -#cmakedefine HAVE_STRRCHR 1 - -/* Define to 1 if `st_birthtime' is member of `struct stat'. */ -#cmakedefine HAVE_STRUCT_STAT_ST_BIRTHTIME 1 - -/* Define to 1 if `st_birthtimespec.tv_nsec' is member of `struct stat'. */ -#cmakedefine HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 1 - -/* Define to 1 if `st_blksize' is member of `struct stat'. */ -#cmakedefine HAVE_STRUCT_STAT_ST_BLKSIZE 1 - -/* Define to 1 if `st_flags' is member of `struct stat'. */ -#cmakedefine HAVE_STRUCT_STAT_ST_FLAGS 1 - -/* Define to 1 if `st_mtimespec.tv_nsec' is member of `struct stat'. */ -#cmakedefine HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1 - -/* Define to 1 if `st_mtime_n' is member of `struct stat'. */ -#cmakedefine HAVE_STRUCT_STAT_ST_MTIME_N 1 - -/* Define to 1 if `st_mtime_usec' is member of `struct stat'. */ -#cmakedefine HAVE_STRUCT_STAT_ST_MTIME_USEC 1 - -/* Define to 1 if `st_mtim.tv_nsec' is member of `struct stat'. */ -#cmakedefine HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1 - -/* Define to 1 if `st_umtime' is member of `struct stat'. */ -#cmakedefine HAVE_STRUCT_STAT_ST_UMTIME 1 - -/* Define to 1 if you have the symlink() function. */ -#cmakedefine HAVE_SYMLINK 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_ACL_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_CDEFS_H 1 - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#cmakedefine HAVE_SYS_DIR_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_EXTATTR_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_IOCTL_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_MKDEV_H 1 - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#cmakedefine HAVE_SYS_NDIR_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_PARAM_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_POLL_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_SELECT_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_UTIME_H 1 - -/* Define to 1 if you have that is POSIX.1 compatible. */ -#cmakedefine HAVE_SYS_WAIT_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_XATTR_H 1 - -/* Define to 1 if you have the `timegm' function. */ -#cmakedefine HAVE_TIMEGM 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_TIME_H 1 - -/* Define to 1 if you have the `tzset' function. */ -#cmakedefine HAVE_TZSET 1 - -/* Define to 1 if the system has the type `uintmax_t'. */ -#cmakedefine HAVE_UINTMAX_T 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_UNISTD_H 1 - -/* Define to 1 if you have the `unsetenv' function. */ -#cmakedefine HAVE_UNSETENV 1 - -/* Define to 1 if the system has the type `unsigned long long'. */ -#cmakedefine HAVE_UNSIGNED_LONG_LONG 1 - -/* Define to 1 if the system has the type `unsigned long long int'. */ -#cmakedefine HAVE_UNSIGNED_LONG_LONG_INT 1 - -/* Define to 1 if you have the `utime' function. */ -#cmakedefine HAVE_UTIME 1 - -/* Define to 1 if you have the `utimensat' function. */ -#cmakedefine HAVE_UTIMENSAT 1 - -/* Define to 1 if you have the `utimes' function. */ -#cmakedefine HAVE_UTIMES 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_UTIME_H 1 - -/* Define to 1 if you have the `vfork' function. */ -#cmakedefine HAVE_VFORK 1 - -/* Define to 1 if you have the `vprintf' function. */ -#cmakedefine HAVE_VPRINTF 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_WCHAR_H 1 - -/* Define to 1 if the system has the type `wchar_t'. */ -#cmakedefine HAVE_WCHAR_T 1 - -/* Define to 1 if you have the `wcrtomb' function. */ -#cmakedefine HAVE_WCRTOMB 1 - -/* Define to 1 if you have the `wcscmp' function. */ -#cmakedefine HAVE_WCSCMP 1 - -/* Define to 1 if you have the `wcscpy' function. */ -#cmakedefine HAVE_WCSCPY 1 - -/* Define to 1 if you have the `wcslen' function. */ -#cmakedefine HAVE_WCSLEN 1 - -/* Define to 1 if you have the `wctomb' function. */ -#cmakedefine HAVE_WCTOMB 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_WCTYPE_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_WINDOWS_H 1 - -/* Define to 1 if you have _CrtSetReportMode in */ -#cmakedefine HAVE__CrtSetReportMode 1 - -/* Define to 1 if you have the `wmemcmp' function. */ -#cmakedefine HAVE_WMEMCMP 1 - -/* Define to 1 if you have the `wmemcpy' function. */ -#cmakedefine HAVE_WMEMCPY 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_ZLIB_H 1 - -/* Version number of libarchive as a single integer */ -#cmakedefine LIBARCHIVE_VERSION_NUMBER "${LIBARCHIVE_VERSION_NUMBER}" - -/* Version number of libarchive */ -#cmakedefine LIBARCHIVE_VERSION_STRING "${LIBARCHIVE_VERSION_STRING}" - -/* Define to 1 if `lstat' dereferences a symlink specified with a trailing - slash. */ -#cmakedefine LSTAT_FOLLOWS_SLASHED_SYMLINK 1 - -/* Define to 1 if `major', `minor', and `makedev' are declared in . - */ -#cmakedefine MAJOR_IN_MKDEV 1 - -/* Define to 1 if `major', `minor', and `makedev' are declared in - . */ -#cmakedefine MAJOR_IN_SYSMACROS 1 - -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -#cmakedefine NO_MINUS_C_MINUS_O 1 - -/* The size of `wchar_t', as computed by sizeof. */ -#cmakedefine SIZEOF_WCHAR_T ${SIZEOF_WCHAR_T} - -/* Define to 1 if strerror_r returns char *. */ -#cmakedefine STRERROR_R_CHAR_P 1 - -/* Define to 1 if you can safely include both and . */ -#cmakedefine TIME_WITH_SYS_TIME 1 - -/* Version number of package */ -#cmakedefine VERSION "${VERSION}" - -/* Number of bits in a file offset, on hosts where this is settable. */ -#cmakedefine _FILE_OFFSET_BITS ${_FILE_OFFSET_BITS} - -/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ -#cmakedefine _LARGEFILE_SOURCE 1 - -/* Define for large files, on AIX-style hosts. */ -#cmakedefine _LARGE_FILES ${_LARGE_FILES} - -/* Define for Solaris 2.5.1 so the uint64_t typedef from , - , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ -#cmakedefine _UINT64_T - -/* Define to empty if `const' does not conform to ANSI C. */ -#cmakedefine const ${const} - -/* Define to `int' if doesn't define. */ -#cmakedefine gid_t ${gid_t} - -/* Define to `unsigned long' if does not define. */ -#cmakedefine id_t ${id_t} - -/* Define to `int' if doesn't define. */ -#cmakedefine int32_t ${int32_t} - -/* Define to the type of a signed integer type of width exactly 64 bits if - such a type exists and the standard includes do not define it. */ -#cmakedefine int64_t ${int64_t} - -/* Define to the widest signed integer type if and do - not define. */ -#cmakedefine intmax_t ${intmax_t} - -/* Define to `int' if does not define. */ -#cmakedefine mode_t ${mode_t} - -/* Define to `long long' if does not define. */ -#cmakedefine off_t ${off_t} - -/* Define to `int' if doesn't define. */ -#cmakedefine pid_t ${pid_t} - -/* Define to `unsigned int' if does not define. */ -#cmakedefine size_t ${size_t} - -/* Define to `int' if does not define. */ -#cmakedefine ssize_t ${ssize_t} - -/* Define to `int' if doesn't define. */ -#cmakedefine uid_t ${uid_t} - -/* Define to `unsigned short' if doesn't define. */ -#cmakedefine uint16_t ${uint16_t} - -/* Define to `unsigned int' if doesn't define. */ -#cmakedefine uint32_t ${uint32_t} - -/* Define to the type of an unsigned integer type of width exactly 64 bits if - such a type exists and the standard includes do not define it. */ -#cmakedefine uint64_t ${uint64_t} - -/* Define to the widest unsigned integer type if and - do not define. */ -#cmakedefine uintmax_t ${uintmax_t} - -/* Define to `int' if does not define. */ -#cmakedefine intptr_t ${intptr_t} - -/* Define to `unsigned int' if does not define. */ -#cmakedefine uintptr_t ${uintptr_t} diff --git a/contrib/libarchive/build/pkgconfig/libarchive.pc.in b/contrib/libarchive/build/pkgconfig/libarchive.pc.in deleted file mode 100644 index 5f1d6a63d03c..000000000000 --- a/contrib/libarchive/build/pkgconfig/libarchive.pc.in +++ /dev/null @@ -1,10 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: libarchive -Description: library that can create and read several streaming archive formats -Version: @VERSION@ -Libs: -larchive -Libs.private: @LIBS@ diff --git a/contrib/libarchive/build/version b/contrib/libarchive/build/version deleted file mode 100644 index 4f810f734517..000000000000 --- a/contrib/libarchive/build/version +++ /dev/null @@ -1 +0,0 @@ -2008005 diff --git a/contrib/libarchive/configure.ac b/contrib/libarchive/configure.ac deleted file mode 100644 index 5a93cd674e6f..000000000000 --- a/contrib/libarchive/configure.ac +++ /dev/null @@ -1,508 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. - -dnl First, define all of the version numbers up front. -dnl In particular, this allows the version macro to be used in AC_INIT - -dnl These first two version numbers are updated automatically on each release. -m4_define([LIBARCHIVE_VERSION_S],[2.8.5]) -m4_define([LIBARCHIVE_VERSION_N],[2008005]) - -dnl bsdtar and bsdcpio versioning tracks libarchive -m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S()) -m4_define([BSDCPIO_VERSION_S],LIBARCHIVE_VERSION_S()) - -# -# Now starts the "real" configure script. -# - -AC_INIT([libarchive],LIBARCHIVE_VERSION_S(),[kientzle@freebsd.org]) -# Make sure the srcdir contains "libarchive" directory -AC_CONFIG_SRCDIR([libarchive]) -# Use auxiliary subscripts from this subdirectory (cleans up root) -AC_CONFIG_AUX_DIR([build/autoconf]) -# M4 scripts -AC_CONFIG_MACRO_DIR([build/autoconf]) -# Must follow AC_CONFIG macros above... -AM_INIT_AUTOMAKE() - -# Libtool versioning uses different conventions on different -# platforms. At least on FreeBSD, libtool uses an overly complex -# convention that attempts to solve problems that most people just -# don't have and which just causes confusion for most end users. -ARCHIVE_MAJOR=$(( LIBARCHIVE_VERSION_N() / 1000000 )) -ARCHIVE_MINOR=$(( (LIBARCHIVE_VERSION_N() / 1000) % 1000 )) -ARCHIVE_REVISION=$(( LIBARCHIVE_VERSION_N() % 1000 )) -ARCHIVE_LIBTOOL_MAJOR=`echo $((${ARCHIVE_MAJOR} + ${ARCHIVE_MINOR}))` -ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_LIBTOOL_MAJOR:$ARCHIVE_REVISION:$ARCHIVE_MINOR - -# Stick the version numbers into config.h -AC_DEFINE([LIBARCHIVE_VERSION_STRING],"LIBARCHIVE_VERSION_S()", - [Version number of libarchive]) -AC_DEFINE_UNQUOTED([LIBARCHIVE_VERSION_NUMBER],"LIBARCHIVE_VERSION_N()", - [Version number of libarchive as a single integer]) -AC_DEFINE([BSDCPIO_VERSION_STRING],"BSDCPIO_VERSION_S()", - [Version number of bsdcpio]) -AC_DEFINE([BSDTAR_VERSION_STRING],"BSDTAR_VERSION_S()", - [Version number of bsdtar]) - -# The shell variables here must be the same as the AC_SUBST() variables -# below, but the shell variable names apparently cannot be the same as -# the m4 macro names above. Why? Ask autoconf. -BSDCPIO_VERSION_STRING=BSDCPIO_VERSION_S() -BSDTAR_VERSION_STRING=BSDTAR_VERSION_S() -LIBARCHIVE_VERSION_STRING=LIBARCHIVE_VERSION_S() -LIBARCHIVE_VERSION_NUMBER=LIBARCHIVE_VERSION_N() - -# Substitute the above version numbers into the various files below. -# Yes, I believe this is the fourth time we define what are essentially -# the same symbols. Why? Ask autoconf. -AC_SUBST(ARCHIVE_LIBTOOL_VERSION) -AC_SUBST(BSDCPIO_VERSION_STRING) -AC_SUBST(BSDTAR_VERSION_STRING) -AC_SUBST(LIBARCHIVE_VERSION_STRING) -AC_SUBST(LIBARCHIVE_VERSION_NUMBER) - -AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_FILES([Makefile]) -AC_CONFIG_FILES([build/pkgconfig/libarchive.pc]) - -# Check for host type -AC_CANONICAL_HOST - -dnl Compilation on mingw and Cygwin needs special Makefile rules -inc_windows_files=no -inc_cygwin_files=no -case "$host_os" in - *mingw* ) inc_windows_files=yes ;; - *cygwin*) inc_cygwin_files=yes ;; -esac -AM_CONDITIONAL([INC_WINDOWS_FILES], [test $inc_windows_files = yes]) -AM_CONDITIONAL([INC_CYGWIN_FILES], [test $inc_cygwin_files = yes]) - -dnl Defines that are required for specific platforms (e.g. -D_POSIX_SOURCE, etc) -PLATFORMCPPFLAGS= -case "$host_os" in - *mingw* ) PLATFORMCPPFLAGS=-D__USE_MINGW_ANSI_STDIO ;; -esac -AC_SUBST(PLATFORMCPPFLAGS) - -# Checks for programs. -AC_PROG_CC -AM_PROG_CC_C_O -AC_USE_SYSTEM_EXTENSIONS -AC_LIBTOOL_WIN32_DLL -AC_PROG_LIBTOOL -AC_CHECK_TOOL([STRIP],[strip]) - -# -# Options for building bsdtar. -# -# Default is to build bsdtar, but allow people to override that. -# -AC_ARG_ENABLE([bsdtar], - [AS_HELP_STRING([--enable-bsdtar], [enable build of bsdtar (default)]) - AS_HELP_STRING([--enable-bsdtar=static], [force static build of bsdtar]) - AS_HELP_STRING([--enable-bsdtar=shared], [force dynamic build of bsdtar]) -AS_HELP_STRING([--disable-bsdtar], [disable build of bsdtar])], - [], [enable_bsdtar=yes]) - -case "$enable_bsdtar" in -yes) - if test "$enable_static" = "no"; then - static_bsdtar=no - else - static_bsdtar=yes - fi - build_bsdtar=yes - ;; -dynamic|shared) - if test "$enable_shared" = "no"; then - AC_MSG_FAILURE([Shared linking of bsdtar requires shared libarchive]) - fi - build_bsdtar=yes - static_bsdtar=no - ;; -static) - build_bsdtar=yes - static_bsdtar=yes - ;; -no) - build_bsdtar=no - static_bsdtar=no - ;; -*) - AC_MSG_FAILURE([Unsupported value for --enable-bsdtar]) - ;; -esac - -AM_CONDITIONAL([BUILD_BSDTAR], [ test "$build_bsdtar" = yes ]) -AM_CONDITIONAL([STATIC_BSDTAR], [ test "$static_bsdtar" = yes ]) - -# -# Options for building bsdcpio. -# -# Default is not to build bsdcpio, but that can be overridden. -# -AC_ARG_ENABLE([bsdcpio], - [AS_HELP_STRING([--enable-bsdcpio], [enable build of bsdcpio (default)]) - AS_HELP_STRING([--enable-bsdcpio=static], [static build of bsdcpio]) - AS_HELP_STRING([--enable-bsdcpio=shared], [dynamic build of bsdcpio]) -AS_HELP_STRING([--disable-bsdcpio], [disable build of bsdcpio])], - [], [enable_bsdcpio=yes]) - -case "$enable_bsdcpio" in -yes) - if test "$enable_static" = "no"; then - static_bsdcpio=no - else - static_bsdcpio=yes - fi - build_bsdcpio=yes - ;; -dynamic|shared) - if test "$enabled_shared" = "no"; then - AC_MSG_FAILURE([Shared linking of bsdcpio requires shared libarchive]) - fi - build_bsdcpio=yes - ;; -static) - build_bsdcpio=yes - static_bsdcpio=yes - ;; -no) - build_bsdcpio=no - static_bsdcpio=no - ;; -*) - AC_MSG_FAILURE([Unsupported value for --enable-bsdcpio]) - ;; -esac - -AM_CONDITIONAL([BUILD_BSDCPIO], [ test "$build_bsdcpio" = yes ]) -AM_CONDITIONAL([STATIC_BSDCPIO], [ test "$static_bsdcpio" = yes ]) - -# Set up defines needed before including any headers -case $host in - *mingw* | *cygwin* ) - AC_DEFINE([_WIN32_WINNT], 0x0500, [Define to '0x0500' for Windows 2000 APIs.]) - AC_DEFINE([WINVER], 0x0500, [Define to '0x0500' for Windows 2000 APIs.]) - ;; -esac - -# Checks for header files. -AC_HEADER_DIRENT -AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS([acl/libacl.h attr/xattr.h ctype.h errno.h]) -AC_CHECK_HEADERS([ext2fs/ext2_fs.h fcntl.h grp.h]) -AC_CHECK_HEADERS([inttypes.h io.h langinfo.h limits.h linux/fs.h]) -AC_CHECK_HEADERS([locale.h paths.h poll.h pwd.h regex.h signal.h stdarg.h]) -AC_CHECK_HEADERS([stdint.h stdlib.h string.h]) -AC_CHECK_HEADERS([sys/acl.h sys/cdefs.h sys/extattr.h sys/ioctl.h sys/mkdev.h]) -AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/select.h sys/time.h sys/utime.h]) -AC_CHECK_HEADERS([time.h unistd.h utime.h wchar.h wctype.h windows.h]) - -# Checks for libraries. -AC_ARG_WITH([zlib], - AS_HELP_STRING([--without-zlib], [Don't build support for gzip through zlib])) - -if test "x$with_zlib" != "xno"; then - AC_CHECK_HEADERS([zlib.h]) - AC_CHECK_LIB(z,inflate) -fi - -AC_ARG_WITH([bz2lib], - AS_HELP_STRING([--without-bz2lib], [Don't build support for bzip2 through bz2lib])) - -if test "x$with_bz2lib" != "xno"; then - AC_CHECK_HEADERS([bzlib.h]) - AC_CHECK_LIB(bz2,BZ2_bzDecompressInit) -fi - -AC_ARG_WITH([lzmadec], - AS_HELP_STRING([--without-lzmadec], [Don't build support for lzma through lzmadec])) - -if test "x$with_lzmadec" != "xno"; then - AC_CHECK_HEADERS([lzmadec.h]) - 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_ARG_WITH([openssl], - AS_HELP_STRING([--without-openssl], [Don't build support for mtree and xar hashes through openssl])) - -AC_ARG_WITH([xml2], - AS_HELP_STRING([--without-xml2], [Don't build support for xar through libxml2])) -AC_ARG_WITH([expat], - AS_HELP_STRING([--without-expat], [Don't build support for xar through expat])) - -if test "x$with_xml2" != "xno"; then - AC_PATH_PROG([XML2_CONFIG], [xml2-config],, [${PATH}]) - if test "x$XML2_CONFIG" != "x"; then - CPPFLAGS="${CPPFLAGS} `${XML2_CONFIG} --cflags`" - LIBS="${LIBS} `${XML2_CONFIG} --libs`" - fi - AC_CHECK_HEADERS([libxml/xmlreader.h]) - AC_CHECK_LIB(xml2,xmlInitParser) -fi -if test "x$ac_cv_header_libxml_xmlreader_h" != "xyes"; then - if test "x$with_expat" != "xno"; then - AC_CHECK_HEADERS([expat.h]) - AC_CHECK_LIB(expat,XML_ParserCreate) - fi -fi - -AC_DEFUN([MD_CHECK], [ - if test "$found_$1" != yes; then - saved_LIBS="$LIBS" - saved_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I$srcdir/libarchive" - if test $ac_cv_header_sys_types_h = yes; then - CPPFLAGS="$CPPFLAGS -DHAVE_SYS_TYPES_H=1" - fi - LIBS="$LIBS $4" - AC_MSG_CHECKING([support for ARCHIVE_HASH_$1_$2]) - AC_LINK_IFELSE([ -#define $1_COMPILE_TEST -#define ARCHIVE_HASH_$1_$2 -#define __LIBARCHIVE_BUILD -#include "archive_hash.h" - -int -main(int argc, char **argv) -{ - archive_$3_ctx ctx; - - archive_$3_init(&ctx); - archive_$3_update(&ctx, *argv, argc); - archive_$3_final(&ctx, *argv); - return 0; -} -], - [ AC_MSG_RESULT([yes]) - found_$1=yes - mdLIBS="$mdLIBS $4" - AC_DEFINE(ARCHIVE_HASH_$1_$2, 1, [ $1 via ARCHIVE_HASH_$1_$2 supported.]) - ], - [ AC_MSG_RESULT([no])]) - LIBS="$saved_LIBS" - CPPFLAGS="$saved_CPPFLAGS" - fi -]) - -MD_CHECK(MD5, LIBC, md5) -MD_CHECK(MD5, LIBSYSTEM, md5) -MD_CHECK(RMD160, LIBC, rmd160) -MD_CHECK(SHA1, LIBC, sha1) -MD_CHECK(SHA1, LIBSYSTEM, sha1) -MD_CHECK(SHA256, LIBC, sha256) -MD_CHECK(SHA256, LIBC2, sha256) -MD_CHECK(SHA256, LIBC3, sha256) -MD_CHECK(SHA256, LIBSYSTEM, sha256) -MD_CHECK(SHA384, LIBC, sha384) -MD_CHECK(SHA384, LIBC2, sha384) -MD_CHECK(SHA384, LIBC3, sha384) -MD_CHECK(SHA384, LIBSYSTEM, sha384) -MD_CHECK(SHA512, LIBC, sha512) -MD_CHECK(SHA512, LIBC2, sha512) -MD_CHECK(SHA512, LIBC3, sha512) -MD_CHECK(SHA512, LIBSYSTEM, sha512) - -if test "x$with_openssl" != "xno"; then - MD_CHECK(MD5, OPENSSL, md5, -lcrypto) - MD_CHECK(RMD160, OPENSSL, rmd160, -lcrypto) - MD_CHECK(SHA1, OPENSSL, sha1, -lcrypto) - MD_CHECK(SHA256, OPENSSL, sha256, -lcrypto) - MD_CHECK(SHA384, OPENSSL, sha384, -lcrypto) - MD_CHECK(SHA512, OPENSSL, sha512, -lcrypto) -fi -LIBS="$LIBS $mdLIBS" - -# TODO: Give the user the option of using a pre-existing system -# libarchive. This will define HAVE_LIBARCHIVE which will cause -# bsdtar_platform.h to use #include <...> for the libarchive headers. -# Need to include Makefile.am magic to link against system -# -larchive in that case. -#AC_CHECK_LIB(archive,archive_version) - -# Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -# AC_TYPE_UID_T defaults to "int", which is incorrect for MinGW -# and MSVC. Use a customized version. -la_TYPE_UID_T -AC_TYPE_MODE_T -# AC_TYPE_OFF_T defaults to "long", which limits us to 4GB files on -# most systems... default to "long long" instead. -AC_CHECK_TYPE(off_t, [long long]) -AC_TYPE_SIZE_T -AC_CHECK_TYPE(id_t, [unsigned long]) -AC_CHECK_TYPE(uintptr_t, [unsigned int]) - -# Check for birthtime in struct stat -AC_CHECK_MEMBERS([struct stat.st_birthtime]) - -# Check for high-resolution timestamps in struct stat -AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec]) -AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec]) -AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec]) -AC_CHECK_MEMBERS([struct stat.st_mtime_n]) # AIX -AC_CHECK_MEMBERS([struct stat.st_umtime]) # Tru64 -AC_CHECK_MEMBERS([struct stat.st_mtime_usec]) # Hurd -# Check for block size support in struct stat -AC_CHECK_MEMBERS([struct stat.st_blksize]) -# Check for st_flags in struct stat (BSD fflags) -AC_CHECK_MEMBERS([struct stat.st_flags]) - -# If you have uintmax_t, we assume printf supports %ju -# If you have unsigned long long, we assume printf supports %llu -# TODO: Check for %ju and %llu support directly. -AC_CHECK_TYPES([uintmax_t, unsigned long long]) - -# We need int64_t, uint64_t, intmax_t, and uintmax_t -AC_TYPE_INTMAX_T -AC_TYPE_INT64_T -AC_TYPE_UINTMAX_T -AC_TYPE_UINT64_T - -# TODO: If any of these are missing, define them right here. -AC_CHECK_DECLS([SIZE_MAX, SSIZE_MAX, INT64_MAX, INT64_MIN, UINT64_MAX, UINT32_MAX]) - -AC_CHECK_DECL([EFTYPE], - [AC_DEFINE(HAVE_EFTYPE, 1, [A possible errno value for invalid file format errors])], - [], - [#include ]) -AC_CHECK_DECL([EILSEQ], - [AC_DEFINE(HAVE_EILSEQ, 1, [A possible errno value for invalid file format errors])], - [], - [#include ]) -AC_CHECK_TYPE([wchar_t], - [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]wchar_t), 1, [Define to 1 if the system has the type `wchar_t'.])dnl - AC_CHECK_SIZEOF([wchar_t])], - []) - -AC_HEADER_TIME - -# Checks for library functions. -AC_PROG_GCC_TRADITIONAL -AC_HEADER_MAJOR -AC_FUNC_FSEEKO -AC_FUNC_MEMCMP -AC_FUNC_LSTAT -AC_FUNC_STAT -AC_FUNC_STRERROR_R -AC_FUNC_STRFTIME -AC_FUNC_VPRINTF -# check for: -# CreateHardLinkA(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES) -# To avoid necessity for including windows.h or special forward declaration -# workarounds, we use 'void *' for 'struct SECURITY_ATTRIBUTES *' -AC_CHECK_STDCALL_FUNC([CreateHardLinkA],[const char *, const char *, void *]) -AC_CHECK_FUNCS([chflags chown chroot]) -AC_CHECK_FUNCS([fchdir fchflags fchmod fchown fcntl fork]) -AC_CHECK_FUNCS([fstat ftruncate futimens futimes geteuid getpid]) -AC_CHECK_FUNCS([getgrgid_r getgrnam_r getpwnam_r getpwuid_r ]) -AC_CHECK_FUNCS([lchflags lchmod lchown link lstat]) -AC_CHECK_FUNCS([lutimes memmove memset mkdir mkfifo mknod]) -AC_CHECK_FUNCS([nl_langinfo pipe poll readlink]) -AC_CHECK_FUNCS([select setenv setlocale sigaction]) -AC_CHECK_FUNCS([strchr strdup strerror strncpy_s strrchr symlink timegm]) -AC_CHECK_FUNCS([tzset unsetenv utime utimensat utimes vfork]) -AC_CHECK_FUNCS([wcrtomb wcscmp wcscpy wcslen wctomb wmemcmp wmemcpy]) -# detects cygwin-1.7, as opposed to older versions -AC_CHECK_FUNCS([cygwin_conv_path]) - -# FreeBSD's nl_langinfo supports an option to specify whether the -# current locale uses month/day or day/month ordering. It makes the -# output a little prettier... -AC_CHECK_DECL([D_MD_ORDER], -[AC_DEFINE(HAVE_D_MD_ORDER, 1, [Define to 1 if nl_langinfo supports D_MD_ORDER])], -[], -[#if HAVE_LANGINFO_H -#include -#endif -]) - -# Check for dirent.d_namlen field explicitly -# (This is a bit more straightforward than, if not quite as portable as, -# the recipe given by the autoconf maintainers.) -AC_CHECK_MEMBER(struct dirent.d_namlen,,, -[#if HAVE_DIRENT_H -#include -#endif -]) - -# Check for Extended Attributes support -AC_ARG_ENABLE([xattr], - AS_HELP_STRING([--disable-xattr], - [Enable Extended Attributes support (default: check)])) - -if test "x$enable_xattr" != "xno"; then - AC_CHECK_HEADERS([attr/xattr.h]) - AC_CHECK_HEADERS([sys/xattr.h]) - AC_CHECK_LIB(attr,setxattr) - AC_CHECK_FUNCS([extattr_get_file extattr_list_file]) - AC_CHECK_FUNCS([extattr_set_fd extattr_set_file]) - AC_CHECK_FUNCS([fsetxattr getxattr]) - AC_CHECK_FUNCS([lgetxattr listxattr llistxattr lsetxattr]) - AC_CHECK_DECLS([EXTATTR_NAMESPACE_USER], [], [], [#include -#include -]) -fi - -# Check for ACL support -# -# The ACL support in libarchive is written against the POSIX1e draft, -# which was never officially approved and varies quite a bit across -# platforms. Worse, some systems have completely non-POSIX acl functions, -# which makes the following checks rather more complex than I would like. -# -AC_ARG_ENABLE([acl], - AS_HELP_STRING([--disable-acl], - [Enable ACL support (default: check)])) - -if test "x$enable_acl" != "xno"; then - AC_CHECK_HEADERS([sys/acl.h]) - AC_CHECK_LIB([acl],[acl_get_file]) - AC_CHECK_FUNCS([acl_create_entry acl_init acl_set_fd acl_set_fd_np acl_set_file]) - - AC_CHECK_TYPES(acl_permset_t,,, - [#if HAVE_SYS_TYPES_H - #include - #endif - #if HAVE_SYS_ACL_H - #include - #endif - ]) - - # The "acl_get_perm()" function was omitted from the POSIX draft. - # (It's a pretty obvious oversight; otherwise, there's no way to - # test for specific permissions in a permset.) Linux uses the obvious - # name, FreeBSD adds _np to mark it as "non-Posix extension." - # Test for both as a double-check that we really have POSIX-style ACL support. - AC_CHECK_FUNCS(acl_get_perm_np acl_get_perm acl_get_link acl_get_link_np,,, - [#if HAVE_SYS_TYPES_H - #include - #endif - #if HAVE_SYS_ACL_H - #include - #endif - ]) - - # MacOS has an acl.h that isn't POSIX. It can be detected by - # checking for ACL_USER - AC_CHECK_DECL([ACL_USER], - [AC_DEFINE(HAVE_ACL_USER, 1, [True for systems with POSIX ACL support])], - [], - [#include ]) -fi - -# Additional requirements -AC_SYS_LARGEFILE - -AC_OUTPUT diff --git a/contrib/libarchive/contrib/README b/contrib/libarchive/contrib/README deleted file mode 100644 index 2eb0114ff569..000000000000 --- a/contrib/libarchive/contrib/README +++ /dev/null @@ -1,32 +0,0 @@ -Many people have graciously sent me configuration -files and other useful tidbits for use with libarchive. - -I do not support or use any of these; but if you can use them, enjoy! - -====================================================================== - -From: Andre Stechert - -libarchive_autodetect-st_lib_archive.m4 - -M4 macros for use with autoconf to detect whether a suitable -version of libarchive is installed on this system. - - -====================================================================== - -libarchive.spec - -An RPM ".spec" file for building libarchive on most systems. -This apparently was originally developed by a group at pld-linux.org. -Several people have sent me different versions of this file. - -====================================================================== - -From: Robert Meier - -libarchive.1aix53.spec - -As above, for use on AIX5.3. - -====================================================================== diff --git a/contrib/libarchive/contrib/libarchive.1aix53.spec b/contrib/libarchive/contrib/libarchive.1aix53.spec deleted file mode 100644 index 1c3bb7d1ed61..000000000000 --- a/contrib/libarchive/contrib/libarchive.1aix53.spec +++ /dev/null @@ -1,160 +0,0 @@ -# $LastChangedRevision: 8 $, $LastChangedDate: 2008-05-01 00:11:33 +0200 (Å¡t , 01 máj 2008) $ -Summary: Library to create and read several different archive formats -Summary(pl): Biblioteka do tworzenia i odczytu ró¿nych formatów archiwów -Name: libarchive -Version: 2.0a3 -Release: 1aix53 -License: BSD -Group: Libraries -Source0: http://people.freebsd.org/~kientzle/libarchive/src/%{name}-%{version}.tar.gz -Patch: %{name}-0123457890.patch -URL: http://people.freebsd.org/~kientzle/libarchive/ -Requires: glibc -Requires: zlib -Requires: bzip2 -BuildRequires: gcc -BuildRequires: gcc-c++ -BuildRequires: gawk -BuildRequires: zlib-devel -BuildRequires: bzip2 -BuildRoot: %{_tmppath}/%{name}-%{version}-build - -%description -Libarchive is a programming library that can create and read several -different streaming archive formats, including most popular TAR -variants and several CPIO formats. It can also write SHAR archives. - -%description -l pl -Libarchive jest bibliotek± s³u¿ac± to tworzenia i odczytu wielu -ró¿nych strumieniowych formatów archiwów, w³±czaj±c w to popularne -odmiany TAR oraz wiele formatów CPIO. Biblioteka ta potrafi tak¿e -zapisywaæ archiwa SHAR. - -%package devel -Summary: Header files for libarchive library -Summary(pl): Pliki nag³ówkowe biblioteki libarchive -Group: Development/Libraries -Requires: %{name} = %{version}-%{release} - -%description devel -Header files for libarchive library. - -%description devel -l pl -Pliki nag³ówkowe biblioteki libarchive. - -%package static -Summary: Static libarchive library -Summary(pl): Statyczna biblioteka libarchive -Group: Development/Libraries -Requires: %{name}-devel = %{version}-%{release} - -%description static -Static libarchive library. - -%description static -l pl -Statyczna biblioteka libarchive. - -%package -n bsdtar -Summary: bsdtar - tar(1) implementation based on libarchive -Summary(pl): bsdtar - implementacja programu tar(1) oparta na libarchive -Group: Applications/Archiving -Requires: %{name} = %{version}-%{release} - -%description -n bsdtar -bsdtar - tar(1) implementation based on libarchive. - -%description -n bsdtar -l pl -bsdtar - implementacja programu tar(1), oparta na libarchive. - -%prep -%setup -q -%patch0 -p1 - -%build -# Specify paths to avoid use of vacpp -# -maix64 - required to use large files with aix-5.3 -# -static - required for interoperability without copying libraries -# -D_BSD - required to include definition of makedev -# -X64 - required to assemble 64-bit COFF files -mkdir -p %{buildroot} -PATH=/opt/freeware/libexec:/opt/freeware/bin:/usr/local/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:. \ -CPATH=/opt/freeware/include:/usr/local/include \ -LIBPATH=/opt/freeware/lib:/usr/local/lib:/usr/share/lib \ -LD_LIBRARY_PATH=/opt/freeware/lib:/usr/local/lib:/usr/share/lib \ -CFLAGS="$RPM_OPT_FLAGS -maix64 -static -D_BSD" \ -CXXFLAGS="$RPM_OPT_FLAGS -maix64 -static -D_BSD" \ -AR="ar -X64" \ -./configure \ ---prefix=%{_prefix} \ ---libexecdir=%{_libexecdir} \ ---mandir=%{_mandir} \ ---infodir=%{_infodir} \ ---enable-shared=yes \ ---enable-static=yes \ -| tee %{buildroot}/config.log -make | tee %{buildroot}/make.log - -%install -[ "%buildroot" != "/" ] && [ -d %buildroot ] && rm -rf %buildroot; -make DESTDIR=%buildroot install -# original install builds, but does install bsdtar -cp .libs/%{name}.a %{buildroot}%{_libdir} -cp bsdtar %{buildroot}%{_bindir} -cp tar/bsdtar.1 %{buildroot}%{_mandir}/man1 - -%clean -rm -fr %buildroot - -%files -%defattr(644,root,root,755) -%{_libdir}/libarchive.a - -%files devel -%defattr(644,root,root,755) -%{_libdir}/libarchive.la -%{_includedir}/*.h -%doc %{_mandir}/man3/* -%doc %{_mandir}/man5/* - -%files -n bsdtar -%defattr(644,root,root,755) -%attr(755,root,root) %{_bindir}/bsdtar -%doc %{_mandir}/man1/bsdtar.1* - -%define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`) -%changelog -* %{date} PLD Team -All persons listed below can be reached at @pld-linux.org - -$Log: libarchive.spec,v $ -Release 1aix53 2006/12/12 rm1023@dcx.com -- tweak for aix-5.3 -- added libarchive-0123457890.patch for "0123457890" error -- replaced libarchive-1.3.1.tar.gz with libarchive-2.0a3.tar.gz -- removed obsolete -CVE-2006-5680.patch and -man_progname.patch - -Revision 1.6 2006/11/15 10:41:28 qboosh -- BR: acl-devel,attr-devel -- devel deps - -Revision 1.5 2006/11/08 22:22:25 twittner -- up to 1.3.1 -- added BR: e2fsprogs-devel -- added -CVE-2006-5680.patch agains entering in infinite -loop in corrupt archives -- added bsdtar package (bsdtar is included now in libarchive -sources) -- rel. 0.1 for testing - -Revision 1.4 2005/12/15 18:26:36 twittner -- up to 1.2.37 -- removed -shared.patch (no longer needed) - -Revision 1.3 2005/10/05 17:00:12 arekm -- up to 1.02.034 - -Revision 1.2 2005/07/27 20:17:21 qboosh -- typo - -Revision 1.1 2005/07/27 08:36:03 adamg -- new diff --git a/contrib/libarchive/contrib/libarchive.spec b/contrib/libarchive/contrib/libarchive.spec deleted file mode 100644 index 1b81f6dc964a..000000000000 --- a/contrib/libarchive/contrib/libarchive.spec +++ /dev/null @@ -1,147 +0,0 @@ -# $LastChangedRevision: 8 $, $LastChangedDate: 2008-05-01 00:11:33 +0200 (Å¡t , 01 máj 2008) $ -Summary: Library to create and read several different archive formats -Summary(pl): Biblioteka do tworzenia i odczytu ró¿nych formatów archiwów -Name: libarchive -Version: 2.0a3 -Release: 1 -License: BSD -Group: Libraries -Source0: http://people.freebsd.org/~kientzle/libarchive/src/%{name}-%{version}.tar.gz -Patch: %{name}-0123457890.patch -URL: http://people.freebsd.org/~kientzle/libarchive/ -Requires: glibc -Requires: zlib -Requires: bzip2 -BuildRequires: gcc -BuildRequires: gcc-c++ -BuildRequires: gawk -BuildRequires: zlib-devel -BuildRequires: bzip2 -BuildRoot: %{_tmppath}/%{name}-%{version}-build - -%description -Libarchive is a programming library that can create and read several -different streaming archive formats, including most popular TAR -variants and several CPIO formats. It can also write SHAR archives. - -%description -l pl -Libarchive jest bibliotek± s³u¿ac± to tworzenia i odczytu wielu -ró¿nych strumieniowych formatów archiwów, w³±czaj±c w to popularne -odmiany TAR oraz wiele formatów CPIO. Biblioteka ta potrafi tak¿e -zapisywaæ archiwa SHAR. - -%package devel -Summary: Header files for libarchive library -Summary(pl): Pliki nag³ówkowe biblioteki libarchive -Group: Development/Libraries -Requires: %{name} = %{version}-%{release} - -%description devel -Header files for libarchive library. - -%description devel -l pl -Pliki nag³ówkowe biblioteki libarchive. - -%package static -Summary: Static libarchive library -Summary(pl): Statyczna biblioteka libarchive -Group: Development/Libraries -Requires: %{name}-devel = %{version}-%{release} - -%description static -Static libarchive library. - -%description static -l pl -Statyczna biblioteka libarchive. - -%package -n bsdtar -Summary: bsdtar - tar(1) implementation based on libarchive -Summary(pl): bsdtar - implementacja programu tar(1) oparta na libarchive -Group: Applications/Archiving -Requires: %{name} = %{version}-%{release} - -%description -n bsdtar -bsdtar - tar(1) implementation based on libarchive. - -%description -n bsdtar -l pl -bsdtar - implementacja programu tar(1), oparta na libarchive. - -%prep -%setup -q -%patch0 -p1 - -%build -mkdir -p %{buildroot} -./configure \ ---prefix=%{_prefix} \ ---libexecdir=%{_libexecdir} \ ---mandir=%{_mandir} \ ---infodir=%{_infodir} \ ---enable-shared=yes \ ---enable-static=yes \ -| tee %{buildroot}/config.log -make | tee %{buildroot}/make.log - -%install -[ "%buildroot" != "/" ] && [ -d %buildroot ] && rm -rf %buildroot; -make DESTDIR=%buildroot install -# original install builds, but does install bsdtar -cp .libs/%{name}.a %{buildroot}%{_libdir} -cp bsdtar %{buildroot}%{_bindir} -cp tar/bsdtar.1 %{buildroot}%{_mandir}/man1 - -%clean -rm -fr %buildroot - -%files -%defattr(644,root,root,755) -%{_libdir}/libarchive.a - -%files devel -%defattr(644,root,root,755) -%{_libdir}/libarchive.la -%{_includedir}/*.h -%doc %{_mandir}/man3/* -%doc %{_mandir}/man5/* - -%files -n bsdtar -%defattr(644,root,root,755) -%attr(755,root,root) %{_bindir}/bsdtar -%doc %{_mandir}/man1/bsdtar.1* - -%define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`) -%changelog -* %{date} PLD Team -All persons listed below can be reached at @pld-linux.org - -$Log: libarchive.spec,v $ -Release 1 2006/12/12 rm1023@dcx.com -- added libarchive-0123457890.patch for "0123457890" error -- replaced libarchive-1.3.1.tar.gz with libarchive-2.0a3.tar.gz -- removed obsolete -CVE-2006-5680.patch and -man_progname.patch - -Revision 1.6 2006/11/15 10:41:28 qboosh -- BR: acl-devel,attr-devel -- devel deps - -Revision 1.5 2006/11/08 22:22:25 twittner -- up to 1.3.1 -- added BR: e2fsprogs-devel -- added -CVE-2006-5680.patch agains entering in infinite -loop in corrupt archives -- added bsdtar package (bsdtar is included now in libarchive -sources) -- rel. 0.1 for testing - -Revision 1.4 2005/12/15 18:26:36 twittner -- up to 1.2.37 -- removed -shared.patch (no longer needed) - -Revision 1.3 2005/10/05 17:00:12 arekm -- up to 1.02.034 - -Revision 1.2 2005/07/27 20:17:21 qboosh -- typo - -Revision 1.1 2005/07/27 08:36:03 adamg -- new diff --git a/contrib/libarchive/contrib/libarchive_autodetect-st_lib_archive.m4 b/contrib/libarchive/contrib/libarchive_autodetect-st_lib_archive.m4 deleted file mode 100644 index 4419e888f240..000000000000 --- a/contrib/libarchive/contrib/libarchive_autodetect-st_lib_archive.m4 +++ /dev/null @@ -1,154 +0,0 @@ -dnl -dnl @synopsis ST_LIB_ARCHIVE([ENABLED-DEFAULT]) -dnl -dnl This macro figures out what's necessary to link a program against an -dnl instance of the BSD libarchive package by Tim Kientzle. -dnl -dnl See http://people.freebsd.org/~kientzle/libarchive/ for more info. -dnl -dnl It exports and substitutes the variables LIBARCHIVE_LIBS, LIBARCHIVE_LDFLAGS, -dnl and LIBARCHIVE_CPPFLAGS to appropriate values for the identified instance of -dnl libarchive. The values are AC_SUBST'd, so a user could, for example, simply -dnl include @LIBARCHIVE_CPPFLAGS@ in the definition of AM_CPPFLAGS in a Makefile.am. -dnl -dnl ENABLED-DEFAULT is either "yes" or "no" and determines whether the default value -dnl is --with-libarchive or --without-libarchive. It is not possible to specify a -dnl default directory. More simply, any reasonable choice for a default should just -dnl go into the auto-detect list. -dnl -dnl The macro defines the symbol HAVE_LIBARCHIVE if the library is found. You -dnl should use autoheader to include a definition for this symbol in a config.h -dnl file. Sample usage in a C/C++ source is as follows: -dnl -dnl #ifdef HAVE_LIBARCHIVE -dnl #include -dnl #endif /* HAVE_LIBARCHIVE */ -dnl -dnl @category InstalledPackages -dnl @author Andre Stechert -dnl @version 2006-04-20 -dnl @license GPLWithACException - -AC_DEFUN([ST_LIB_ARCHIVE], -[ -# -# Handle input from the configurer and blend with the requirements from the maintainer. -# We go through the trouble of creating a second set of variables other than the with_foo -# variables in order to be sure that error/corner cases have been cleaned up. -# -# After this statement, three trusted variable are defined. -# -# st_lib_archive_ENABLED will be either "yes" or "no". its value determines whether -# or not we bother with the rest of the checks and whether or not we export a -# bunch of variables. -# -# st_lib_archive_LOCATION will be either "auto" or "defined". if it is "auto", then -# we try a bunch of standard locations. if it is "defined", then we just try the value -# provided in st_lib_archive_DIR. -# -# st_lib_archive_DIR will contain the string provided by the user, provided that it's -# actually a directory. -# -AC_MSG_CHECKING([if libarchive is wanted]) -AC_ARG_WITH([libarchive], - AS_HELP_STRING([--with-libarchive=DIR], [libarchive installation directory]), - [if test "x$with_libarchive" = "xno" ; then - st_lib_archive_ENABLED=no - elif test "x$with_libarchive" = "xyes" ; then - st_lib_archive_ENABLED=yes - st_lib_archive_LOCATION=auto - else - st_lib_archive_ENABLED=yes - st_lib_archive_LOCATION=defined - if test -d "$with_libarchive" ; then - st_lib_archive_DIR="$with_libarchive" - else - AC_MSG_ERROR([$with_libarchive is not a directory]) - fi - fi], - [if test "x$1" = "xno" ; then - st_lib_archive_ENABLED=no - elif test "x$1" = "xyes" ; then - st_lib_archive_ENABLED=yes - else - st_lib_archive_ENABLED=yes - fi]) - -if test "$st_lib_archive_ENABLED" = "yes" ; then - AC_MSG_RESULT([yes]) -# -# After this statement, one trusted variable is defined. -# -# st_lib_archive_LIB will be either "lib" or "lib64", depending on whether the configurer -# specified 32, 64. The default is "lib". -# - AC_MSG_CHECKING([whether to use lib or lib64]) - AC_ARG_WITH([libarchive-bits], - AS_HELP_STRING([--with-libarchive-bits=32/64], [if 64, look in /lib64 on hybrid systems]), - [if test "x$with_libarchive_bits" = "x32" ; then - st_lib_archive_LIB=lib - elif test "x$with_libarchive_bits" = "x64" ; then - st_lib_archive_LIB=lib64 - else - AC_MSG_ERROR([the argument must be either 32 or 64]) - fi], - [st_lib_archive_LIB=lib]) - AC_MSG_RESULT($st_lib_archive_LIB) -# -# Save the environment before verifying libarchive availability -# - st_lib_archive_SAVECPPFLAGS="$CPPFLAGS" - st_lib_archive_SAVELDFLAGS="$LDFLAGS" - AC_LANG_SAVE - AC_LANG_C - - if test "x$st_lib_archive_LOCATION" = "xdefined" ; then - CPPFLAGS="-I$st_lib_archive_DIR/include $st_lib_archive_SAVECPPFLAGS" - LDFLAGS="-L$st_lib_archive_DIR/$st_lib_archive_LIB $st_lib_archive_SAVELDFLAGS" - AC_CHECK_LIB(archive, archive_read_new, [st_lib_archive_found_lib=yes], [st_lib_archive_found_lib=no]) - AC_CHECK_HEADER(archive.h, [st_lib_archive_found_hdr=yes], [st_lib_archive_found_hdr=no]) - if test "x$st_lib_archive_found_lib" = "xyes" && test "x$st_lib_archive_found_hdr" = "xyes"; then - LIBARCHIVE_CPPFLAGS="-I$dir/include" - LIBARCHIVE_LDFLAGS="-L$dir/$st_lib_archive_LIB" - else - AC_MSG_ERROR([could not find libarchive in the requested location]) - fi - else - # - # These are the common install directories for Linux, FreeBSD, Solaris, and Mac. - # - for dir in /usr /usr/local /usr/sfw /opt/csw /opt/local /sw - do - if test -d "$dir" ; then - CPPFLAGS="-I$dir/include $st_lib_archive_SAVECPPFLAGS" - LDFLAGS="-L$dir/$st_lib_archive_LIB $st_lib_archive_SAVELDFLAGS" - AC_CHECK_LIB(archive, archive_read_new, [st_lib_archive_found_lib=yes], [st_lib_archive_found_lib=no]) - AC_CHECK_HEADER(archive.h, [st_lib_archive_found_hdr=yes], [st_lib_archive_found_hdr=no]) - if test "x$st_lib_archive_found_lib" = "xyes" && test "x$st_lib_archive_found_hdr" = "xyes"; then - LIBARCHIVE_CPPFLAGS="-I$dir/include" - LIBARCHIVE_LDFLAGS="-L$dir/$st_lib_archive_LIB" - break - fi - fi - done - fi - - if test "x$st_lib_archive_found_hdr" = "xyes" && test "x$st_lib_archive_found_lib" = "xyes" ; then - LIBARCHIVE_LIBS="-larchive" - AC_DEFINE([HAVE_LIBARCHIVE], [1], [Defined to 1 if libarchive is available for use.]) - AC_SUBST(LIBARCHIVE_LIBS) - AC_SUBST(LIBARCHIVE_CPPFLAGS) - AC_SUBST(LIBARCHIVE_LDFLAGS) - fi - -# -# Restore the environment now that we're done. -# - AC_LANG_RESTORE - CPPFLAGS="$st_lib_archive_SAVECPPFLAGS" - LDFLAGS="$st_lib_archive_SAVELDFLAGS" -else - AC_MSG_RESULT([no]) -fi -AM_CONDITIONAL(LIBARCHIVE, test "x$st_lib_archive_found_lib" = "xyes" && test "x$st_lib_archive_found_hdr" = "xyes") -]) diff --git a/contrib/libarchive/contrib/psota-benchmark/results.txt b/contrib/libarchive/contrib/psota-benchmark/results.txt deleted file mode 100644 index 8197b28f7eae..000000000000 --- a/contrib/libarchive/contrib/psota-benchmark/results.txt +++ /dev/null @@ -1,122 +0,0 @@ -ODP: [Bug-tar] GNU tar, star and BSD tar speed comparision +new script - -Jan Psota -Thu, 25 Oct 2007 06:51:13 -0700 - -Latest TCP script at the bottom (3180 bytes). -4 tests: 64bit dual core Athlon tmpfs / disk (reiserfs) - 60MB/s, - 32bit Athlon tmpfs / disk (reiserfs) - 55MB/s -Both machines were idle -- used for testing only. -Tarball and extracted files were on different physical devices. -Test data: linux 2.6.22/3 kernel sources for memory operations, -for the other data average file size should bring enough info. - -2 x [...] processor means 1 processor with 2 cores (2 entries in cpuinfo). -Archive format is set to pax (Joerg). -Let's end with it. I only wanted to send You a new version of TCP script :-). - --- -Jan Psota - -TCP, version 2007-10-25 -Linux 2.6.22-suspend2-r2 / Gentoo Base System release 2.0.0_rc5 -2012MB of memory, 2 x AMD Athlon(tm) 64 X2 Dual Core Processor 4200+ 2211.348 -512 KB 4426.24 bmips -gcc (GCC) 4.2.2 (Gentoo 4.2.2 p1.0) -CFLAGS="-O2 -march=k8 -pipe" - -bsdtar: bsdtar 2.3.4 - libarchive 2.3.4 -gnutar: tar (GNU tar) 1.19 -star: star: star 1.5a85 (x86_64-unknown-linux-gnu) - -best time of 5 repetitions, - src=linux-2.6.23, 291M in 23867 files, avg 13KB/file, - archive=/tmp/tcp.tar, extract to /tmp/tcptmp -program operation real user system %CPU speed -bsdtar create 0.764 0.232 0.532 99.96 370308 KB/s -gnutar create 0.743 0.200 0.512 95.87 380775 KB/s -star create 0.587 0.040 0.820 100.00 441247 KB/s - -bsdtar list 0.164 0.096 0.068 99.84 1579341 KB/s -gnutar list 0.218 0.064 0.152 98.92 1188128 KB/s -star list 0.359 0.044 0.240 79.09 721481 KB/s - -bsdtar extract 0.733 0.200 0.504 96.02 353358 KB/s -gnutar extract 0.625 0.092 0.508 96.02 414419 KB/s -star extract 0.875 0.096 0.980 100.00 296013 KB/s - -bsdtar compare 0.001 0.000 0.000 0.00 259012000 KB/s -gnutar compare 0.719 0.288 0.400 95.66 360239 KB/s -star compare 0.695 0.224 0.636 100.00 372679 KB/s - -[...] -best time of 3 repetitions, - src=/home, 3.2G in 7447 files, avg 554KB/file, - archive=/var/tcp.tar, extract to /mnt/a/tcptmp -program operation real user system %CPU speed -bsdtar create 184.680 0.552 13.365 7.53 17958 KB/s -gnutar create 159.240 0.256 12.417 7.95 20827 KB/s -star create 181.779 0.140 14.789 8.21 18203 KB/s - -bsdtar list 0.053 0.032 0.016 91.41 62435471 KB/s -gnutar list 56.535 0.136 3.764 6.89 58531 KB/s -star list 56.652 0.080 5.236 9.38 58410 KB/s - -bsdtar extract 78.914 0.820 15.149 20.23 41932 KB/s -gnutar extract 78.480 0.196 14.197 18.33 42164 KB/s -star extract 79.439 0.132 12.973 16.49 41655 KB/s - -bsdtar compare 0.001 0.000 0.000 0.00 3309080000 KB/s -gnutar compare 61.771 3.464 8.905 20.02 53570 KB/s -star compare 57.561 1.728 9.897 20.19 57488 KB/s - - -Linux 2.6.22-suspend2-smp / Gentoo Base System release 2.0.0_rc5 -504MB of memory, 1 x AMD Athlon(tm) Processor 1500.033 256 KB 3002.55 bmips -gcc (GCC) 4.2.2 (Gentoo 4.2.2 p1.0) -CFLAGS="-O2 -march=athlon-xp -mfpmath=sse -frename-registers -pipe" - -bsdtar: bsdtar 2.3.4 - libarchive 2.3.4 -gnutar: tar (GNU tar) 1.19 -star: star: star 1.5a85 (i686-pc-linux-gnu) - -best time of 3 repetitions, - src=/usr/src/linux-2.6.22-suspend2/drivers, 119M in 5900 files, - avg 21KB/file, archive=/tmp/tcp.tar, extract to /tmp/tcptmp -program operation real user system %CPU speed -bsdtar create 1.329 0.192 1.132 99.63 89784 KB/s -gnutar create 1.223 0.124 1.092 99.46 97566 KB/s -star create 1.848 0.036 1.708 94.36 61372 KB/s - -bsdtar list 0.167 0.060 0.108 100.00 679137 KB/s -gnutar list 0.161 0.040 0.124 100.00 704447 KB/s -star list 0.859 0.044 0.716 88.51 132032 KB/s - -bsdtar extract 1.186 0.172 1.012 99.87 95629 KB/s -gnutar extract 1.064 0.056 1.004 99.63 106593 KB/s -star extract 1.920 0.088 1.724 94.40 59070 KB/s - -bsdtar compare 0.002 0.000 0.000 0.00 56708000 KB/s -gnutar compare 0.925 0.232 0.692 99.90 122611 KB/s -star compare 1.569 0.376 1.096 93.79 72285 KB/s - -[...] -best time of 3 repetitions, - src=/home/jasiu, 2.1G in 8416 files, avg 277KB/file, - archive=/home/j2/tcp.tar, extract to /mnt/a/tar/tcptmp -program operation real user system %CPU speed -bsdtar create 182.171 1.692 29.130 16.91 11584 KB/s -gnutar create 174.999 0.632 27.450 16.04 12059 KB/s -star create 180.004 0.360 41.795 23.41 11677 KB/s - -bsdtar list 0.214 0.076 0.136 99.04 9822294 KB/s -gnutar list 0.210 0.076 0.136 100.00 10009385 KB/s -star list 43.462 0.148 18.109 42.00 48363 KB/s - -bsdtar extract 94.912 4.476 31.574 37.98 22146 KB/s -gnutar extract 94.657 0.396 29.462 31.54 22206 KB/s -star extract 100.814 0.400 39.906 39.98 20849 KB/s - -bsdtar compare 0.003 0.000 0.004 100.00 700657000 KB/s -gnutar compare 80.174 3.932 20.365 30.30 26217 KB/s -star compare 73.911 8.341 27.670 48.72 28439 KB/s diff --git a/contrib/libarchive/contrib/psota-benchmark/tcp.sh b/contrib/libarchive/contrib/psota-benchmark/tcp.sh deleted file mode 100644 index 6c0e4b5e92e5..000000000000 --- a/contrib/libarchive/contrib/psota-benchmark/tcp.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/sh -# tar comparision program -# 2007-10-25 Jan Psota - -n=3 # number of repetitions -TAR=(bsdtar gnutar star) # TApeArchivers to compare -OPT=("" "--seek" "-no-fsync") -pax="--format=pax" # comment out for defaults -OPN=(create list extract compare) # operations -version="2007-10-25" -TIMEFORMAT=$'%R\t%U\t%S\t%P' -LC_ALL=C - -test $# -ge 2 || { - echo -e "usage:\t$0 source_dir where_to_place_archive -[where_to_extract_it] - -TCP, version $version -TCP stands for Tar Comparision Program here. -It currently compares: BSD tar (bsdtar), GNU tar (gnutar) and star in archive -creation, listing, extraction and archive-to-extracted comparision. -Tcp prints out best time of n=$n repetitions. - -Tcp creates temporary archive named tcp.tar with $pax and some native -(--seek/-no-fsync) options and extracts it to [\$3]/tcptmp/. -If unset, third argument defaults to [\$2]. -After normal exit tcp removes tarball and extracted files. -Tcp does not check filesystems destination directories are on for free space, -so make sure there is enough space (a bit more than source_dir uses) for both: -archive and extracted files. -Do not use white space in arguments. - Jan Psota, $version" - exit 0 -} -src=$1 -dst=$2/tcp.tar -dst_path=${3:-$2}/tcptmp -test -e $dst -o -e /tmp/tcp \ - && { echo "$dst or /tmp/tcp exists, exiting"; exit 1; } -mkdir $dst_path || exit 2 - -use_times () -{ - awk -F"\t" -vN=$n -vL="`du -k $dst`" -vOFS="\t" -vORS="" ' - { if (NF==4) { printf "\t%s\t%10.1d KB/s\n", $0, ($1+0>0 ? -(L+0)/($1+0) : 0) } }' \ - /tmp/tcp | sort | head -1 - > /tmp/tcp -} - -test -d $src || { echo "'$src' is not a directory"; exit 3; } - -# system information: type, release, memory, cpu(s), compiler and flags -echo -e "TCP, version $version\n"`uname -sr`" / "`head -1 /etc/*-release` -free -m | awk '/^Mem/ { printf "%dMB of memory, ", $2 }' -test -e /proc/cpuinfo \ - && awk -F: '/name|cache size|MHz|mips/ { if (!a) b=b $2 } - /^$/ { a++ } END { print a" x"b" bmips" }' /proc/cpuinfo -test -e /etc/gentoo-release \ - && gcc --version | head -1 && grep ^CFLAGS /etc/make.conf - -# tar versions -echo -for tar in [EMAIL PROTECTED]; do echo -ne "$tar:\t"; $tar --version | head -1; -done - -echo -e "\nbest time of $n repetitions,\n"\ -" src=$src, "\ -`du -sh $src | awk '{print $1}'`" in "`find $src | wc -l`" files, "\ -"avg "$((`du -sk $src | awk '{print $1}'`/`find $src -type f | wc --l`))"KB/file,\n"\ -" archive=$dst, extract to $dst_path" - -echo -e "program\toperation\treal\tuser\tsystem\t%CPU\t speed" -> /tmp/tcp -let op_num=0 -for op in "cf $dst $pax -C $src ." "tf $dst" "xf $dst -C $dst_path" \ - "f $dst -C $dst_path --diff"; do - let tar_num=0 - for tar in [EMAIL PROTECTED]; do - echo -en "$tar\t${OPN[op_num]}\t" - for ((i=1; i<=$n; i++)); do - echo $op | grep -q ^cf && rm -f $dst - echo $op | grep -q ^xf && - { chmod -R u+w $dst_path - rm -rf $dst_path; mkdir $dst_path; } - sync - if echo $op | grep -q ^f; then # op == compare - time $tar $op ${OPT[$tar_num]} > /dev/null - else # op in (create | list | extract) - time $tar $op ${OPT[$tar_num]} > /dev/null \ - || break 3 - fi 2>> /tmp/tcp - done - use_times - let tar_num++ - done - let op_num++ - echo -done -rm -rf $dst_path $dst -echo -cat /tmp/tcp -rm -f /tmp/tcp diff --git a/contrib/libarchive/contrib/shar/Makefile b/contrib/libarchive/contrib/shar/Makefile deleted file mode 100644 index 3bd94d4192cb..000000000000 --- a/contrib/libarchive/contrib/shar/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# $FreeBSD$ - -PROG= shar -SRCS= shar.c tree.c - -WARNS?= 6 - -DPADD= ${LIBARCHIVE} -LDADD= -larchive - -LINKS= ${BINDIR}/shar -MLINKS= shar.1 - -.include diff --git a/contrib/libarchive/contrib/shar/shar.1 b/contrib/libarchive/contrib/shar/shar.1 deleted file mode 100644 index e3152f299ebe..000000000000 --- a/contrib/libarchive/contrib/shar/shar.1 +++ /dev/null @@ -1,128 +0,0 @@ -.\" Copyright (c) 1990, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. 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. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. -.\" -.\" @(#)shar.1 8.1 (Berkeley) 6/6/93 -.\" $FreeBSD$ -.\" -.Dd April 17, 2008 -.Dt SHAR 1 -.Os -.Sh NAME -.Nm shar -.Nd create a shell archive of files -.Sh SYNOPSIS -.Nm -.Op Fl br -.Op Fl o Ar archive-file -.Ar -.Sh DESCRIPTION -The -.Nm -command writes a -.Xr sh 1 -shell script which will recreate the file hierarchy specified by the command -line operands. -.Pp -The -.Nm -command is normally used for distributing files by -.Xr ftp 1 -or -.Xr mail 1 . -.Pp -The following options are available: -.Bl -tag -width indent -.It Fl b -Use an alternative binary format. Content of files will be uuencoded. -This option should be used to archive binary files correctly. -In this mode also file permissions will be stored to the archive. -uudecode(1) is needed to extract archives created with this option. -.It Fl o Ar archive-file -Redirect output to -.Ar archive-file . -.It Fl r -If -.Ar file -given on command line is a directory the entire subtree will be archived. -Symbolic links given on command line are followed. Other symbolic links will -be archived as such. -.El -.Sh EXAMPLES -To create a shell archive of the program -.Xr ls 1 -and mail it to Rick: -.Bd -literal -offset indent -cd ls -shar -r . \&| mail -s "ls source" rick -.Ed -.Pp -To recreate the program directory: -.Bd -literal -offset indent -mkdir ls -cd ls -\&... - -\&... -sh archive -.Ed -.Sh SEE ALSO -.Xr compress 1 , -.Xr mail 1 , -.Xr tar 1 , -.Xr uuencode 1 , -.Xr uuencode 5 -.Sh HISTORY -The -.Nm -command appeared in -.Bx 4.4 . -This is a re-implementation based on the libarchive(3) library. -.Sh BUGS -The -.Nm -command makes no provisions for hard links. -.Pp -Files containing magic characters or files without a newline ('\\n') as the -last character are not handled correctly with the default format. Use the -b -option for binary files. -.Pp -It is easy to insert trojan horses into -.Nm -files. -It is strongly recommended that all shell archive files be examined -before running them through -.Xr sh 1 . -Archives produced using this implementation of -.Nm -may be easily examined with the command: -.Bd -literal -offset indent -egrep -v '^[X#]' shar.file -.Ed diff --git a/contrib/libarchive/contrib/shar/shar.c b/contrib/libarchive/contrib/shar/shar.c deleted file mode 100644 index 12c84255309f..000000000000 --- a/contrib/libarchive/contrib/shar/shar.c +++ /dev/null @@ -1,314 +0,0 @@ -/*- - * Copyright (c) 2008 Jaakko Heinonen - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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. - */ - -#include -#ifdef __FBSDID -__FBSDID("$FreeBSD$"); -#endif - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "tree.h" - -/* command line options */ -static int b_opt; /* use alternative shar binary format */ -static int r_opt; /* recurse into subdirectories */ -static char *o_arg; /* output file name */ - -static void -usage(void) -{ - fprintf(stderr, "Usage: shar [-br] [-o filename] file ...\n"); - exit(EX_USAGE); -} - -/* - * Initialize archive structure and create a shar archive. - */ -static struct archive * -shar_create(void) -{ - struct archive *a; - - if ((a = archive_write_new()) == NULL) - errx(EXIT_FAILURE, "%s", archive_error_string(a)); - - if (b_opt) - archive_write_set_format_shar_dump(a); - else - archive_write_set_format_shar(a); - archive_write_set_compression_none(a); - - if (archive_write_open_filename(a, o_arg) != ARCHIVE_OK) - errx(EX_CANTCREAT, "%s", archive_error_string(a)); - - return (a); -} - -/* buffer for file data */ -static char buffer[32768]; - -/* - * Write file data to an archive entry. - */ -static int -shar_write_entry_data(struct archive *a, const int fd) -{ - ssize_t bytes_read, bytes_written; - - assert(a != NULL); - assert(fd >= 0); - - bytes_read = read(fd, buffer, sizeof(buffer)); - while (bytes_read != 0) { - if (bytes_read < 0) { - archive_set_error(a, errno, "Read failed"); - return (ARCHIVE_WARN); - } - bytes_written = archive_write_data(a, buffer, bytes_read); - if (bytes_written < 0) - return (ARCHIVE_WARN); - bytes_read = read(fd, buffer, sizeof(buffer)); - } - - return (ARCHIVE_OK); -} - -/* - * Write a file to the archive. We have special handling for symbolic links. - */ -static int -shar_write_entry(struct archive *a, const char *pathname, const char *accpath, - const struct stat *st) -{ - struct archive_entry *entry; - int fd = -1; - int ret = ARCHIVE_OK; - - assert(a != NULL); - assert(pathname != NULL); - assert(accpath != NULL); - assert(st != NULL); - - entry = archive_entry_new(); - - if (S_ISREG(st->st_mode) && st->st_size > 0) { - /* regular file */ - if ((fd = open(accpath, O_RDONLY)) == -1) { - warn("%s", accpath); - ret = ARCHIVE_WARN; - goto out; - } - } else if (S_ISLNK(st->st_mode)) { - /* symbolic link */ - char lnkbuff[PATH_MAX + 1]; - int lnklen; - if ((lnklen = readlink(accpath, lnkbuff, PATH_MAX)) == -1) { - warn("%s", accpath); - ret = ARCHIVE_WARN; - goto out; - } - lnkbuff[lnklen] = '\0'; - archive_entry_set_symlink(entry, lnkbuff); - } - archive_entry_copy_stat(entry, st); - archive_entry_set_pathname(entry, pathname); - if (!S_ISREG(st->st_mode) || st->st_size == 0) - archive_entry_set_size(entry, 0); - if (archive_write_header(a, entry) != ARCHIVE_OK) { - warnx("%s: %s", pathname, archive_error_string(a)); - ret = ARCHIVE_WARN; - goto out; - } - if (fd >= 0) { - if ((ret = shar_write_entry_data(a, fd)) != ARCHIVE_OK) - warnx("%s: %s", accpath, archive_error_string(a)); - } -out: - archive_entry_free(entry); - if (fd >= 0) - close(fd); - - return (ret); -} - -/* - * Write singe path to the archive. The path can be a regular file, directory - * or device. Symbolic links are followed. - */ -static int -shar_write_path(struct archive *a, const char *pathname) -{ - struct stat st; - - assert(a != NULL); - assert(pathname != NULL); - - if ((stat(pathname, &st)) == -1) { - warn("%s", pathname); - return (ARCHIVE_WARN); - } - - return (shar_write_entry(a, pathname, pathname, &st)); -} - -/* - * Write tree to the archive. If pathname is a symbolic link it will be - * followed. Other symbolic links are stored as such to the archive. - */ -static int -shar_write_tree(struct archive *a, const char *pathname) -{ - struct tree *t; - const struct stat *lst, *st; - int error = 0; - int tree_ret; - int first; - - assert(a != NULL); - assert(pathname != NULL); - - t = tree_open(pathname); - for (first = 1; (tree_ret = tree_next(t)); first = 0) { - if (tree_ret == TREE_ERROR_DIR) { - warnx("%s: %s", tree_current_path(t), - strerror(tree_errno(t))); - error = 1; - continue; - } else if (tree_ret != TREE_REGULAR) - continue; - if ((lst = tree_current_lstat(t)) == NULL) { - warn("%s", tree_current_path(t)); - error = 1; - continue; - } - /* - * If the symlink was given on command line then - * follow it rather than write it as symlink. - */ - if (first && S_ISLNK(lst->st_mode)) { - if ((st = tree_current_stat(t)) == NULL) { - warn("%s", tree_current_path(t)); - error = 1; - continue; - } - } else - st = lst; - - if (shar_write_entry(a, tree_current_path(t), - tree_current_access_path(t), st) != ARCHIVE_OK) - error = 1; - - tree_descend(t); - } - - tree_close(t); - - return ((error != 0) ? ARCHIVE_WARN : ARCHIVE_OK); -} - -/* - * Create a shar archive and write files/trees into it. - */ -static int -shar_write(char **fn, size_t nfn) -{ - struct archive *a; - size_t i; - int error = 0; - - assert(fn != NULL); - assert(nfn > 0); - - a = shar_create(); - - for (i = 0; i < nfn; i++) { - if (r_opt) { - if (shar_write_tree(a, fn[i]) != ARCHIVE_OK) - error = 1; - } else { - if (shar_write_path(a, fn[i]) != ARCHIVE_OK) - error = 1; - } - } - - if (archive_write_finish(a) != ARCHIVE_OK) - errx(EXIT_FAILURE, "%s", archive_error_string(a)); - - if (error != 0) - warnx("Error exit delayed from previous errors."); - - return (error); -} - -int -main(int argc, char **argv) -{ - int opt; - - while ((opt = getopt(argc, argv, "bro:")) != -1) { - switch (opt) { - case 'b': - b_opt = 1; - break; - case 'o': - o_arg = optarg; - break; - case 'r': - r_opt = 1; - break; - default: - usage(); - /* NOTREACHED */ - } - } - argc -= optind; - argv += optind; - - if(argc < 1) - usage(); - - if (shar_write(argv, argc) != 0) - exit(EXIT_FAILURE); - else - exit(EXIT_SUCCESS); - /* NOTREACHED */ -} - diff --git a/contrib/libarchive/contrib/shar/tree.c b/contrib/libarchive/contrib/shar/tree.c deleted file mode 100644 index d5a04abf5f4b..000000000000 --- a/contrib/libarchive/contrib/shar/tree.c +++ /dev/null @@ -1,542 +0,0 @@ -/*- - * Copyright (c) 2003-2007 Tim Kientzle - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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. - */ - -/*- - * This is a new directory-walking system that addresses a number - * of problems I've had with fts(3). In particular, it has no - * pathname-length limits (other than the size of 'int'), handles - * deep logical traversals, uses considerably less memory, and has - * an opaque interface (easier to modify in the future). - * - * Internally, it keeps a single list of "tree_entry" items that - * represent filesystem objects that require further attention. - * Non-directories are not kept in memory: they are pulled from - * readdir(), returned to the client, then freed as soon as possible. - * Any directory entry to be traversed gets pushed onto the stack. - * - * There is surprisingly little information that needs to be kept for - * each item on the stack. Just the name, depth (represented here as the - * string length of the parent directory's pathname), and some markers - * indicating how to get back to the parent (via chdir("..") for a - * regular dir or via fchdir(2) for a symlink). - */ -#include "tree_config.h" -__FBSDID("$FreeBSD$"); - -#ifdef HAVE_SYS_STAT_H -#include -#endif -#ifdef HAVE_DIRENT_H -#include -#endif -#ifdef HAVE_ERRNO_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_STRING_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif - -#include "tree.h" - -/* - * TODO: - * 1) Loop checking. - * 3) Arbitrary logical traversals by closing/reopening intermediate fds. - */ - -struct tree_entry { - struct tree_entry *next; - struct tree_entry *parent; - char *name; - size_t dirname_length; - dev_t dev; - ino_t ino; - int fd; - int flags; -}; - -/* Definitions for tree_entry.flags bitmap. */ -#define isDir 1 /* This entry is a regular directory. */ -#define isDirLink 2 /* This entry is a symbolic link to a directory. */ -#define needsPreVisit 4 /* This entry needs to be previsited. */ -#define needsPostVisit 8 /* This entry needs to be postvisited. */ - -/* - * Local data for this package. - */ -struct tree { - struct tree_entry *stack; - struct tree_entry *current; - DIR *d; - int initialDirFd; - int flags; - int visit_type; - int tree_errno; /* Error code from last failed operation. */ - - char *buff; - const char *basename; - size_t buff_length; - size_t path_length; - size_t dirname_length; - - int depth; - int openCount; - int maxOpenCount; - - struct stat lst; - struct stat st; -}; - -/* Definitions for tree.flags bitmap. */ -#define needsReturn 8 /* Marks first entry as not having been returned yet. */ -#define hasStat 16 /* The st entry is set. */ -#define hasLstat 32 /* The lst entry is set. */ - - -#ifdef HAVE_DIRENT_D_NAMLEN -/* BSD extension; avoids need for a strlen() call. */ -#define D_NAMELEN(dp) (dp)->d_namlen -#else -#define D_NAMELEN(dp) (strlen((dp)->d_name)) -#endif - -#if 0 -#include -void -tree_dump(struct tree *t, FILE *out) -{ - struct tree_entry *te; - - fprintf(out, "\tdepth: %d\n", t->depth); - fprintf(out, "\tbuff: %s\n", t->buff); - fprintf(out, "\tpwd: "); fflush(stdout); system("pwd"); - fprintf(out, "\taccess: %s\n", t->basename); - fprintf(out, "\tstack:\n"); - for (te = t->stack; te != NULL; te = te->next) { - fprintf(out, "\t\tte->name: %s%s%s\n", te->name, - te->flags & needsPreVisit ? "" : " *", - t->current == te ? " (current)" : ""); - } -} -#endif - -/* - * Add a directory path to the current stack. - */ -static void -tree_push(struct tree *t, const char *path) -{ - struct tree_entry *te; - - te = malloc(sizeof(*te)); - memset(te, 0, sizeof(*te)); - te->next = t->stack; - t->stack = te; - te->fd = -1; - te->name = strdup(path); - te->flags = needsPreVisit | needsPostVisit; - te->dirname_length = t->dirname_length; -} - -/* - * Append a name to the current path. - */ -static void -tree_append(struct tree *t, const char *name, size_t name_length) -{ - char *p; - - if (t->buff != NULL) - t->buff[t->dirname_length] = '\0'; - /* Strip trailing '/' from name, unless entire name is "/". */ - while (name_length > 1 && name[name_length - 1] == '/') - name_length--; - - /* Resize pathname buffer as needed. */ - while (name_length + 1 + t->dirname_length >= t->buff_length) { - t->buff_length *= 2; - if (t->buff_length < 1024) - t->buff_length = 1024; - t->buff = realloc(t->buff, t->buff_length); - } - p = t->buff + t->dirname_length; - t->path_length = t->dirname_length + name_length; - /* Add a separating '/' if it's needed. */ - if (t->dirname_length > 0 && p[-1] != '/') { - *p++ = '/'; - t->path_length ++; - } - strncpy(p, name, name_length); - p[name_length] = '\0'; - t->basename = p; -} - -/* - * Open a directory tree for traversal. - */ -struct tree * -tree_open(const char *path) -{ - struct tree *t; - - t = malloc(sizeof(*t)); - memset(t, 0, sizeof(*t)); - tree_append(t, path, strlen(path)); - t->initialDirFd = open(".", O_RDONLY); - /* - * During most of the traversal, items are set up and then - * returned immediately from tree_next(). That doesn't work - * for the very first entry, so we set a flag for this special - * case. - */ - t->flags = needsReturn; - return (t); -} - -/* - * We've finished a directory; ascend back to the parent. - */ -static void -tree_ascend(struct tree *t) -{ - struct tree_entry *te; - - te = t->stack; - t->depth--; - if (te->flags & isDirLink) { - fchdir(te->fd); - close(te->fd); - t->openCount--; - } else { - chdir(".."); - } -} - -/* - * Pop the working stack. - */ -static void -tree_pop(struct tree *t) -{ - struct tree_entry *te; - - t->buff[t->dirname_length] = '\0'; - if (t->stack == t->current && t->current != NULL) - t->current = t->current->parent; - te = t->stack; - t->stack = te->next; - t->dirname_length = te->dirname_length; - t->basename = t->buff + t->dirname_length; - /* Special case: starting dir doesn't skip leading '/'. */ - if (t->dirname_length > 0) - t->basename++; - free(te->name); - free(te); -} - -/* - * Get the next item in the tree traversal. - */ -int -tree_next(struct tree *t) -{ - struct dirent *de = NULL; - - /* Handle the startup case by returning the initial entry. */ - if (t->flags & needsReturn) { - t->flags &= ~needsReturn; - return (t->visit_type = TREE_REGULAR); - } - - while (t->stack != NULL) { - /* If there's an open dir, get the next entry from there. */ - while (t->d != NULL) { - de = readdir(t->d); - if (de == NULL) { - closedir(t->d); - t->d = NULL; - } else if (de->d_name[0] == '.' - && de->d_name[1] == '\0') { - /* Skip '.' */ - } else if (de->d_name[0] == '.' - && de->d_name[1] == '.' - && de->d_name[2] == '\0') { - /* Skip '..' */ - } else { - /* - * Append the path to the current path - * and return it. - */ - tree_append(t, de->d_name, D_NAMELEN(de)); - t->flags &= ~hasLstat; - t->flags &= ~hasStat; - return (t->visit_type = TREE_REGULAR); - } - } - - /* If the current dir needs to be visited, set it up. */ - if (t->stack->flags & needsPreVisit) { - t->current = t->stack; - tree_append(t, t->stack->name, strlen(t->stack->name)); - t->stack->flags &= ~needsPreVisit; - /* If it is a link, set up fd for the ascent. */ - if (t->stack->flags & isDirLink) { - t->stack->fd = open(".", O_RDONLY); - t->openCount++; - if (t->openCount > t->maxOpenCount) - t->maxOpenCount = t->openCount; - } - t->dirname_length = t->path_length; - if (chdir(t->stack->name) != 0) { - /* chdir() failed; return error */ - tree_pop(t); - t->tree_errno = errno; - return (t->visit_type = TREE_ERROR_DIR); - } - t->depth++; - t->d = opendir("."); - if (t->d == NULL) { - tree_ascend(t); /* Undo "chdir" */ - tree_pop(t); - t->tree_errno = errno; - return (t->visit_type = TREE_ERROR_DIR); - } - t->flags &= ~hasLstat; - t->flags &= ~hasStat; - t->basename = "."; - return (t->visit_type = TREE_POSTDESCENT); - } - - /* We've done everything necessary for the top stack entry. */ - if (t->stack->flags & needsPostVisit) { - tree_ascend(t); - tree_pop(t); - t->flags &= ~hasLstat; - t->flags &= ~hasStat; - return (t->visit_type = TREE_POSTASCENT); - } - } - return (t->visit_type = 0); -} - -/* - * Return error code. - */ -int -tree_errno(struct tree *t) -{ - return (t->tree_errno); -} - -/* - * Called by the client to mark the directory just returned from - * tree_next() as needing to be visited. - */ -void -tree_descend(struct tree *t) -{ - if (t->visit_type != TREE_REGULAR) - return; - - if (tree_current_is_physical_dir(t)) { - tree_push(t, t->basename); - t->stack->flags |= isDir; - } else if (tree_current_is_dir(t)) { - tree_push(t, t->basename); - t->stack->flags |= isDirLink; - } -} - -/* - * Get the stat() data for the entry just returned from tree_next(). - */ -const struct stat * -tree_current_stat(struct tree *t) -{ - if (!(t->flags & hasStat)) { - if (stat(t->basename, &t->st) != 0) - return NULL; - t->flags |= hasStat; - } - return (&t->st); -} - -/* - * Get the lstat() data for the entry just returned from tree_next(). - */ -const struct stat * -tree_current_lstat(struct tree *t) -{ - if (!(t->flags & hasLstat)) { - if (lstat(t->basename, &t->lst) != 0) - return NULL; - t->flags |= hasLstat; - } - return (&t->lst); -} - -/* - * Test whether current entry is a dir or link to a dir. - */ -int -tree_current_is_dir(struct tree *t) -{ - const struct stat *st; - - /* - * If we already have lstat() info, then try some - * cheap tests to determine if this is a dir. - */ - if (t->flags & hasLstat) { - /* If lstat() says it's a dir, it must be a dir. */ - if (S_ISDIR(tree_current_lstat(t)->st_mode)) - return 1; - /* Not a dir; might be a link to a dir. */ - /* If it's not a link, then it's not a link to a dir. */ - if (!S_ISLNK(tree_current_lstat(t)->st_mode)) - return 0; - /* - * It's a link, but we don't know what it's a link to, - * so we'll have to use stat(). - */ - } - - st = tree_current_stat(t); - /* If we can't stat it, it's not a dir. */ - if (st == NULL) - return 0; - /* Use the definitive test. Hopefully this is cached. */ - return (S_ISDIR(st->st_mode)); -} - -/* - * Test whether current entry is a physical directory. Usually, we - * already have at least one of stat() or lstat() in memory, so we - * use tricks to try to avoid an extra trip to the disk. - */ -int -tree_current_is_physical_dir(struct tree *t) -{ - const struct stat *st; - - /* - * If stat() says it isn't a dir, then it's not a dir. - * If stat() data is cached, this check is free, so do it first. - */ - if ((t->flags & hasStat) - && (!S_ISDIR(tree_current_stat(t)->st_mode))) - return 0; - - /* - * Either stat() said it was a dir (in which case, we have - * to determine whether it's really a link to a dir) or - * stat() info wasn't available. So we use lstat(), which - * hopefully is already cached. - */ - - st = tree_current_lstat(t); - /* If we can't stat it, it's not a dir. */ - if (st == NULL) - return 0; - /* Use the definitive test. Hopefully this is cached. */ - return (S_ISDIR(st->st_mode)); -} - -/* - * Test whether current entry is a symbolic link. - */ -int -tree_current_is_physical_link(struct tree *t) -{ - const struct stat *st = tree_current_lstat(t); - if (st == NULL) - return 0; - return (S_ISLNK(st->st_mode)); -} - -/* - * Return the access path for the entry just returned from tree_next(). - */ -const char * -tree_current_access_path(struct tree *t) -{ - return (t->basename); -} - -/* - * Return the full path for the entry just returned from tree_next(). - */ -const char * -tree_current_path(struct tree *t) -{ - return (t->buff); -} - -/* - * Return the length of the path for the entry just returned from tree_next(). - */ -size_t -tree_current_pathlen(struct tree *t) -{ - return (t->path_length); -} - -/* - * Return the nesting depth of the entry just returned from tree_next(). - */ -int -tree_current_depth(struct tree *t) -{ - return (t->depth); -} - -/* - * Terminate the traversal and release any resources. - */ -void -tree_close(struct tree *t) -{ - /* Release anything remaining in the stack. */ - while (t->stack != NULL) - tree_pop(t); - if (t->buff) - free(t->buff); - /* chdir() back to where we started. */ - if (t->initialDirFd >= 0) { - fchdir(t->initialDirFd); - close(t->initialDirFd); - t->initialDirFd = -1; - } - free(t); -} diff --git a/contrib/libarchive/contrib/shar/tree.h b/contrib/libarchive/contrib/shar/tree.h deleted file mode 100644 index ff38f5346c1c..000000000000 --- a/contrib/libarchive/contrib/shar/tree.h +++ /dev/null @@ -1,115 +0,0 @@ -/*- - * Copyright (c) 2003-2007 Tim Kientzle - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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. - * - * $FreeBSD$ - */ - -/*- - * A set of routines for traversing directory trees. - * Similar in concept to the fts library, but with a few - * important differences: - * * Uses less memory. In particular, fts stores an entire directory - * in memory at a time. This package only keeps enough subdirectory - * information in memory to track the traversal. Information - * about non-directories is discarded as soon as possible. - * * Supports very deep logical traversals. The fts package - * uses "non-chdir" approach for logical traversals. This - * package does use a chdir approach for logical traversals - * and can therefore handle pathnames much longer than - * PATH_MAX. - * * Supports deep physical traversals "out of the box." - * Due to the memory optimizations above, there's no need to - * limit dir names to 32k. - */ - -#include -#include - -struct tree; - -/* Initiate/terminate a tree traversal. */ -struct tree *tree_open(const char * /* pathname */); -void tree_close(struct tree *); - -/* - * tree_next() returns Zero if there is no next entry, non-zero if there is. - * Note that directories are potentially visited three times. The first - * time as "regular" file. If tree_descend() is invoked at that time, - * the directory is added to a work list and will be visited two more - * times: once just after descending into the directory and again - * just after ascending back to the parent. - * - * TREE_ERROR is returned if the descent failed (because the - * directory couldn't be opened, for instance). This is returned - * instead of TREE_PREVISIT/TREE_POSTVISIT. - */ -#define TREE_REGULAR 1 -#define TREE_POSTDESCENT 2 -#define TREE_POSTASCENT 3 -#define TREE_ERROR_DIR -1 -int tree_next(struct tree *); - -int tree_errno(struct tree *); - -/* - * Request that current entry be visited. If you invoke it on every - * directory, you'll get a physical traversal. This is ignored if the - * current entry isn't a directory or a link to a directory. So, if - * you invoke this on every returned path, you'll get a full logical - * traversal. - */ -void tree_descend(struct tree *); - -/* - * Return information about the current entry. - */ - -int tree_current_depth(struct tree *); -/* - * The current full pathname, length of the full pathname, - * and a name that can be used to access the file. - * Because tree does use chdir extensively, the access path is - * almost never the same as the full current path. - */ -const char *tree_current_path(struct tree *); -size_t tree_current_pathlen(struct tree *); -const char *tree_current_access_path(struct tree *); -/* - * Request the lstat() or stat() data for the current path. Since the - * tree package needs to do some of this anyway, and caches the - * results, you should take advantage of it here if you need it rather - * than make a redundant stat() or lstat() call of your own. - */ -const struct stat *tree_current_stat(struct tree *); -const struct stat *tree_current_lstat(struct tree *); -/* The following tests may use mechanisms much faster than stat()/lstat(). */ -/* "is_physical_dir" is equivalent to S_ISDIR(tree_current_lstat()->st_mode) */ -int tree_current_is_physical_dir(struct tree *); -/* "is_physical_link" is equivalent to S_ISLNK(tree_current_lstat()->st_mode) */ -int tree_current_is_physical_link(struct tree *); -/* "is_dir" is equivalent to S_ISDIR(tree_current_stat()->st_mode) */ -int tree_current_is_dir(struct tree *); - -/* For testing/debugging: Dump the internal status to the given filehandle. */ -void tree_dump(struct tree *, FILE *); diff --git a/contrib/libarchive/contrib/shar/tree_config.h b/contrib/libarchive/contrib/shar/tree_config.h deleted file mode 100644 index 8dfd90baf685..000000000000 --- a/contrib/libarchive/contrib/shar/tree_config.h +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * Copyright (c) 2003-2007 Tim Kientzle - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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. - * - * $FreeBSD$ - */ -#ifndef TREE_CONFIG_H_INCLUDED -#define TREE_CONFIG_H_INCLUDED - -#if defined(PLATFORM_CONFIG_H) -/* - * Use hand-built config.h in environments that need it. - */ -#include PLATFORM_CONFIG_H -#elif defined(HAVE_CONFIG_H) -/* - * Most POSIX platforms use the 'configure' script to build config.h - */ -#include "../config.h" -#elif defined(__FreeBSD__) -/* - * Built-in definitions for FreeBSD. - */ -#define HAVE_DIRENT_D_NAMLEN 1 -#define HAVE_DIRENT_H 1 -#define HAVE_ERRNO_H 1 -#define HAVE_FCNTL_H 1 -#define HAVE_LIBARCHIVE 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STRING_H 1 -#define HAVE_SYS_STAT_H 1 -#define HAVE_UNISTD_H 1 -#else -/* - * Warn if there's no platform configuration. - */ -#error Oops: No config.h and no built-in configuration in bsdtar_platform.h. -#endif /* !HAVE_CONFIG_H */ - -/* No non-FreeBSD platform will have __FBSDID, so just define it here. */ -#ifdef __FreeBSD__ -#include /* For __FBSDID */ -#else -/* Just leaving this macro replacement empty leads to a dangling semicolon. */ -#define __FBSDID(a) struct _undefined_hack -#endif - -#ifdef HAVE_LIBARCHIVE -/* If we're using the platform libarchive, include system headers. */ -#include -#include -#else -/* Otherwise, include user headers. */ -#include "archive.h" -#include "archive_entry.h" -#endif - -#endif /* !TREE_CONFIG_H_INCLUDED */ diff --git a/contrib/libarchive/contrib/untar.c b/contrib/libarchive/contrib/untar.c deleted file mode 100644 index dc092d325e02..000000000000 --- a/contrib/libarchive/contrib/untar.c +++ /dev/null @@ -1,225 +0,0 @@ -/* - * "untar" is an extremely simple tar extractor: - * * A single C source file, so it should be easy to compile - * and run on any system with a C compiler. - * * Extremely portable standard C. The only non-ANSI function - * used is mkdir(). - * * Reads basic ustar tar archives. - * * Does not require libarchive or any other special library. - * - * To compile: cc -o untar untar.c - * - * Usage: untar - * - * In particular, this program should be sufficient to extract the - * distribution for libarchive, allowing people to bootstrap - * libarchive on systems that do not already have a tar program. - * - * To unpack libarchive-x.y.z.tar.gz: - * * gunzip libarchive-x.y.z.tar.gz - * * untar libarchive-x.y.z.tar - * - * Written by Tim Kientzle, March 2009. - * - * Released into the public domain. - */ - -/* These are all highly standard and portable headers. */ -#include -#include -#include - -/* This is for mkdir(); this may need to be changed for some platforms. */ -#include /* For mkdir() */ - -/* Parse an octal number, ignoring leading and trailing nonsense. */ -static int -parseoct(const char *p, size_t n) -{ - int i = 0; - - while (*p < '0' || *p > '7') { - ++p; - --n; - } - while (*p >= '0' && *p <= '7' && n > 0) { - i *= 8; - i += *p - '0'; - ++p; - --n; - } - return (i); -} - -/* Returns true if this is 512 zero bytes. */ -static int -is_end_of_archive(const char *p) -{ - int n; - for (n = 511; n >= 0; --n) - if (p[n] != '\0') - return (0); - return (1); -} - -/* Create a directory, including parent directories as necessary. */ -static void -create_dir(char *pathname, int mode) -{ - char *p; - int r; - - /* Strip trailing '/' */ - if (pathname[strlen(pathname) - 1] == '/') - pathname[strlen(pathname) - 1] = '\0'; - - /* Try creating the directory. */ - r = mkdir(pathname, mode); - - if (r != 0) { - /* On failure, try creating parent directory. */ - p = strrchr(pathname, '/'); - if (p != NULL) { - *p = '\0'; - create_dir(pathname, 0755); - *p = '/'; - r = mkdir(pathname, mode); - } - } - if (r != 0) - fprintf(stderr, "Could not create directory %s\n", pathname); -} - -/* Create a file, including parent directory as necessary. */ -static FILE * -create_file(char *pathname, int mode) -{ - FILE *f; - f = fopen(pathname, "w+"); - if (f == NULL) { - /* Try creating parent dir and then creating file. */ - char *p = strrchr(pathname, '/'); - if (p != NULL) { - *p = '\0'; - create_dir(pathname, 0755); - *p = '/'; - f = fopen(pathname, "w+"); - } - } - return (f); -} - -/* Verify the tar checksum. */ -static int -verify_checksum(const char *p) -{ - int n, u = 0; - for (n = 0; n < 512; ++n) { - if (n < 148 || n > 155) - /* Standard tar checksum adds unsigned bytes. */ - u += ((unsigned char *)p)[n]; - else - u += 0x20; - - } - return (u == parseoct(p + 148, 8)); -} - -/* Extract a tar archive. */ -static void -untar(FILE *a, const char *path) -{ - char buff[512]; - FILE *f = NULL; - size_t bytes_read; - int filesize; - - printf("Extracting from %s\n", path); - for (;;) { - bytes_read = fread(buff, 1, 512, a); - if (bytes_read < 512) { - fprintf(stderr, - "Short read on %s: expected 512, got %d\n", - path, bytes_read); - return; - } - if (is_end_of_archive(buff)) { - printf("End of %s\n", path); - return; - } - if (!verify_checksum(buff)) { - fprintf(stderr, "Checksum failure\n"); - return; - } - filesize = parseoct(buff + 124, 12); - switch (buff[156]) { - case '1': - printf(" Ignoring hardlink %s\n", buff); - break; - case '2': - printf(" Ignoring symlink %s\n", buff); - break; - case '3': - printf(" Ignoring character device %s\n", buff); - break; - case '4': - printf(" Ignoring block device %s\n", buff); - break; - case '5': - printf(" Extracting dir %s\n", buff); - create_dir(buff, parseoct(buff + 100, 8)); - filesize = 0; - break; - case '6': - printf(" Ignoring FIFO %s\n", buff); - break; - default: - printf(" Extracting file %s\n", buff); - f = create_file(buff, parseoct(buff + 100, 8)); - break; - } - while (filesize > 0) { - bytes_read = fread(buff, 1, 512, a); - if (bytes_read < 512) { - fprintf(stderr, - "Short read on %s: Expected 512, got %d\n", - path, bytes_read); - return; - } - if (filesize < 512) - bytes_read = filesize; - if (f != NULL) { - if (fwrite(buff, 1, bytes_read, f) - != bytes_read) - { - fprintf(stderr, "Failed write\n"); - fclose(f); - f = NULL; - } - } - filesize -= bytes_read; - } - if (f != NULL) { - fclose(f); - f = NULL; - } - } -} - -int -main(int argc, char **argv) -{ - FILE *a; - - ++argv; /* Skip program name */ - for ( ;*argv != NULL; ++argv) { - a = fopen(*argv, "r"); - if (a == NULL) - fprintf(stderr, "Unable to open %s\n", *argv); - else { - untar(a, *argv); - fclose(a); - } - } - return (0); -} diff --git a/contrib/libarchive/cpio/CMakeLists.txt b/contrib/libarchive/cpio/CMakeLists.txt deleted file mode 100644 index ce500b1cc6b4..000000000000 --- a/contrib/libarchive/cpio/CMakeLists.txt +++ /dev/null @@ -1,51 +0,0 @@ -############################################ -# -# How to build bsdcpio -# -############################################ -IF(ENABLE_CPIO) - - SET(bsdcpio_SOURCES - cmdline.c - cpio.c - cpio.h - cpio_platform.h - ../libarchive_fe/err.c - ../libarchive_fe/err.h - ../libarchive_fe/lafe_platform.h - ../libarchive_fe/line_reader.c - ../libarchive_fe/line_reader.h - ../libarchive_fe/matching.c - ../libarchive_fe/matching.h - ../libarchive_fe/pathmatch.c - ../libarchive_fe/pathmatch.h - ) - INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../libarchive_fe) - IF(WIN32 AND NOT CYGWIN) - LIST(APPEND bsdcpio_SOURCES cpio_windows.c) - LIST(APPEND bsdcpio_SOURCES cpio_windows.h) - ENDIF(WIN32 AND NOT CYGWIN) - - # bsdcpio documentation - SET(bsdcpio_MANS bsdcpio.1) - - # How to build bsdcpio - ADD_EXECUTABLE(bsdcpio ${bsdcpio_SOURCES}) - IF(ENABLE_CPIO_SHARED) - TARGET_LINK_LIBRARIES(bsdcpio archive ${ADDITIONAL_LIBS}) - ELSE(ENABLE_CPIO_SHARED) - TARGET_LINK_LIBRARIES(bsdcpio archive_static ${ADDITIONAL_LIBS}) - SET_TARGET_PROPERTIES(bsdcpio PROPERTIES COMPILE_DEFINITIONS - LIBARCHIVE_STATIC) - ENDIF(ENABLE_CPIO_SHARED) - # Full path to the compiled executable (used by test suite) - GET_TARGET_PROPERTY(BSDCPIO bsdcpio LOCATION) - - # Installation rules - INSTALL(TARGETS bsdcpio RUNTIME DESTINATION bin) - INSTALL_MAN(${bsdcpio_MANS}) - -ENDIF(ENABLE_CPIO) - -# Test suite -add_subdirectory(test) diff --git a/contrib/libarchive/cpio/cpio_windows.c b/contrib/libarchive/cpio/cpio_windows.c deleted file mode 100644 index 420e01d5e192..000000000000 --- a/contrib/libarchive/cpio/cpio_windows.c +++ /dev/null @@ -1,338 +0,0 @@ -/*- - * Copyright (c) 2009 Michihiro NAKAJIMA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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. - * - * $FreeBSD$ - */ - -#if defined(_WIN32) && !defined(__CYGWIN__) - -#include "cpio_platform.h" -#include -#include -#include -#include -#include -#ifdef HAVE_SYS_UTIME_H -#include -#endif -#include -#include -#include -#include -#include -#include - -#include "cpio.h" -#include "err.h" - -#define EPOC_TIME (116444736000000000ULL) - -static void cpio_dosmaperr(unsigned long); - -/* - * Prepend "\\?\" to the path name and convert it to unicode to permit - * an extended-length path for a maximum total path length of 32767 - * characters. - * see also http://msdn.microsoft.com/en-us/library/aa365247.aspx - */ -static wchar_t * -permissive_name(const char *name) -{ - wchar_t *wn, *wnp; - wchar_t *ws, *wsp; - DWORD l, len, slen, alloclen; - int unc; - - len = (DWORD)strlen(name); - wn = malloc((len + 1) * sizeof(wchar_t)); - if (wn == NULL) - return (NULL); - l = MultiByteToWideChar(CP_ACP, 0, name, len, wn, len); - if (l == 0) { - free(wn); - return (NULL); - } - wn[l] = L'\0'; - - /* Get a full path names */ - l = GetFullPathNameW(wn, 0, NULL, NULL); - if (l == 0) { - free(wn); - return (NULL); - } - wnp = malloc(l * sizeof(wchar_t)); - if (wnp == NULL) { - free(wn); - return (NULL); - } - len = GetFullPathNameW(wn, l, wnp, NULL); - free(wn); - wn = wnp; - - if (wnp[0] == L'\\' && wnp[1] == L'\\' && - wnp[2] == L'?' && wnp[3] == L'\\') - /* We have already permissive names. */ - return (wn); - - if (wnp[0] == L'\\' && wnp[1] == L'\\' && - wnp[2] == L'.' && wnp[3] == L'\\') { - /* Device names */ - if (((wnp[4] >= L'a' && wnp[4] <= L'z') || - (wnp[4] >= L'A' && wnp[4] <= L'Z')) && - wnp[5] == L':' && wnp[6] == L'\\') - wnp[2] = L'?';/* Not device names. */ - return (wn); - } - - unc = 0; - if (wnp[0] == L'\\' && wnp[1] == L'\\' && wnp[2] != L'\\') { - wchar_t *p = &wnp[2]; - - /* Skip server-name letters. */ - while (*p != L'\\' && *p != L'\0') - ++p; - if (*p == L'\\') { - wchar_t *rp = ++p; - /* Skip share-name letters. */ - while (*p != L'\\' && *p != L'\0') - ++p; - if (*p == L'\\' && p != rp) { - /* Now, match patterns such as - * "\\server-name\share-name\" */ - wnp += 2; - len -= 2; - unc = 1; - } - } - } - - alloclen = slen = 4 + (unc * 4) + len + 1; - ws = wsp = malloc(slen * sizeof(wchar_t)); - if (ws == NULL) { - free(wn); - return (NULL); - } - /* prepend "\\?\" */ - wcsncpy(wsp, L"\\\\?\\", 4); - wsp += 4; - slen -= 4; - if (unc) { - /* append "UNC\" ---> "\\?\UNC\" */ - wcsncpy(wsp, L"UNC\\", 4); - wsp += 4; - slen -= 4; - } - wcsncpy(wsp, wnp, slen); - free(wn); - ws[alloclen - 1] = L'\0'; - return (ws); -} - -static HANDLE -cpio_CreateFile(const char *path, DWORD dwDesiredAccess, DWORD dwShareMode, - LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, - DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) -{ - wchar_t *wpath; - HANDLE handle; - - handle = CreateFileA(path, dwDesiredAccess, dwShareMode, - lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, - hTemplateFile); - if (handle != INVALID_HANDLE_VALUE) - return (handle); - if (GetLastError() != ERROR_PATH_NOT_FOUND) - return (handle); - wpath = permissive_name(path); - if (wpath == NULL) - return (handle); - handle = CreateFileW(wpath, dwDesiredAccess, dwShareMode, - lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, - hTemplateFile); - free(wpath); - return (handle); -} - -#define WINTIME(sec, usec) ((Int32x32To64(sec, 10000000) + EPOC_TIME) + (usec * 10)) -static int -__hutimes(HANDLE handle, const struct __timeval *times) -{ - ULARGE_INTEGER wintm; - FILETIME fatime, fmtime; - - wintm.QuadPart = WINTIME(times[0].tv_sec, times[0].tv_usec); - fatime.dwLowDateTime = wintm.LowPart; - fatime.dwHighDateTime = wintm.HighPart; - wintm.QuadPart = WINTIME(times[1].tv_sec, times[1].tv_usec); - fmtime.dwLowDateTime = wintm.LowPart; - fmtime.dwHighDateTime = wintm.HighPart; - if (SetFileTime(handle, NULL, &fatime, &fmtime) == 0) { - errno = EINVAL; - return (-1); - } - return (0); -} - -int -futimes(int fd, const struct __timeval *times) -{ - - return (__hutimes((HANDLE)_get_osfhandle(fd), times)); -} - -int -utimes(const char *name, const struct __timeval *times) -{ - int ret; - HANDLE handle; - - handle = cpio_CreateFile(name, GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS, NULL); - if (handle == INVALID_HANDLE_VALUE) { - cpio_dosmaperr(GetLastError()); - return (-1); - } - ret = __hutimes(handle, times); - CloseHandle(handle); - return (ret); -} - -/* - * The following function was modified from PostgreSQL sources and is - * subject to the copyright below. - */ -/*------------------------------------------------------------------------- - * - * win32error.c - * Map win32 error codes to errno values - * - * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group - * - * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/win32error.c,v 1.4 2008/01/01 19:46:00 momjian Exp $ - * - *------------------------------------------------------------------------- - */ -/* -PostgreSQL Database Management System -(formerly known as Postgres, then as Postgres95) - -Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group - -Portions Copyright (c) 1994, The Regents of the University of California - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose, without fee, and without a written agreement -is hereby granted, provided that the above copyright notice and this -paragraph and the following two paragraphs appear in all copies. - -IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR -DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING -LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS -DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS -ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO -PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -*/ - -static const struct { - DWORD winerr; - int doserr; -} doserrors[] = -{ - { ERROR_INVALID_FUNCTION, EINVAL }, - { ERROR_FILE_NOT_FOUND, ENOENT }, - { ERROR_PATH_NOT_FOUND, ENOENT }, - { ERROR_TOO_MANY_OPEN_FILES, EMFILE }, - { ERROR_ACCESS_DENIED, EACCES }, - { ERROR_INVALID_HANDLE, EBADF }, - { ERROR_ARENA_TRASHED, ENOMEM }, - { ERROR_NOT_ENOUGH_MEMORY, ENOMEM }, - { ERROR_INVALID_BLOCK, ENOMEM }, - { ERROR_BAD_ENVIRONMENT, E2BIG }, - { ERROR_BAD_FORMAT, ENOEXEC }, - { ERROR_INVALID_ACCESS, EINVAL }, - { ERROR_INVALID_DATA, EINVAL }, - { ERROR_INVALID_DRIVE, ENOENT }, - { ERROR_CURRENT_DIRECTORY, EACCES }, - { ERROR_NOT_SAME_DEVICE, EXDEV }, - { ERROR_NO_MORE_FILES, ENOENT }, - { ERROR_LOCK_VIOLATION, EACCES }, - { ERROR_SHARING_VIOLATION, EACCES }, - { ERROR_BAD_NETPATH, ENOENT }, - { ERROR_NETWORK_ACCESS_DENIED, EACCES }, - { ERROR_BAD_NET_NAME, ENOENT }, - { ERROR_FILE_EXISTS, EEXIST }, - { ERROR_CANNOT_MAKE, EACCES }, - { ERROR_FAIL_I24, EACCES }, - { ERROR_INVALID_PARAMETER, EINVAL }, - { ERROR_NO_PROC_SLOTS, EAGAIN }, - { ERROR_DRIVE_LOCKED, EACCES }, - { ERROR_BROKEN_PIPE, EPIPE }, - { ERROR_DISK_FULL, ENOSPC }, - { ERROR_INVALID_TARGET_HANDLE, EBADF }, - { ERROR_INVALID_HANDLE, EINVAL }, - { ERROR_WAIT_NO_CHILDREN, ECHILD }, - { ERROR_CHILD_NOT_COMPLETE, ECHILD }, - { ERROR_DIRECT_ACCESS_HANDLE, EBADF }, - { ERROR_NEGATIVE_SEEK, EINVAL }, - { ERROR_SEEK_ON_DEVICE, EACCES }, - { ERROR_DIR_NOT_EMPTY, ENOTEMPTY }, - { ERROR_NOT_LOCKED, EACCES }, - { ERROR_BAD_PATHNAME, ENOENT }, - { ERROR_MAX_THRDS_REACHED, EAGAIN }, - { ERROR_LOCK_FAILED, EACCES }, - { ERROR_ALREADY_EXISTS, EEXIST }, - { ERROR_FILENAME_EXCED_RANGE, ENOENT }, - { ERROR_NESTING_NOT_ALLOWED, EAGAIN }, - { ERROR_NOT_ENOUGH_QUOTA, ENOMEM } -}; - -static void -cpio_dosmaperr(unsigned long e) -{ - int i; - - if (e == 0) { - errno = 0; - return; - } - - for (i = 0; i < sizeof(doserrors); i++) { - if (doserrors[i].winerr == e) { - errno = doserrors[i].doserr; - return; - } - } - - /* fprintf(stderr, "unrecognized win32 error code: %lu", e); */ - errno = EINVAL; - return; -} -#endif diff --git a/contrib/libarchive/cpio/cpio_windows.h b/contrib/libarchive/cpio/cpio_windows.h deleted file mode 100644 index 105bf69991de..000000000000 --- a/contrib/libarchive/cpio/cpio_windows.h +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * Copyright (c) 2009 Michihiro NAKAJIMA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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. - * - * $FreeBSD$ - */ -#ifndef CPIO_WINDOWS_H -#define CPIO_WINDOWS_H 1 - -#include -#include - -#define getgrgid(id) NULL -#define getgrnam(name) NULL -#define getpwnam(name) NULL -#define getpwuid(id) NULL - -#ifdef _MSC_VER -#define snprintf sprintf_s -#define strdup _strdup -#define open _open -#define read _read -#define close _close -#endif - -struct passwd { - char *pw_name; - uid_t pw_uid; - gid_t pw_gid; -}; - -struct group { - char *gr_name; - gid_t gr_gid; -}; - -struct _timeval64i32 { - time_t tv_sec; - long tv_usec; -}; -#define __timeval _timeval64i32 - -extern int futimes(int fd, const struct __timeval *times); -#ifndef HAVE_FUTIMES -#define HAVE_FUTIMES 1 -#endif -extern int utimes(const char *name, const struct __timeval *times); -#ifndef HAVE_UTIMES -#define HAVE_UTIMES 1 -#endif - -#endif /* CPIO_WINDOWS_H */ diff --git a/contrib/libarchive/cpio/test/CMakeLists.txt b/contrib/libarchive/cpio/test/CMakeLists.txt deleted file mode 100644 index a822bcdfba5b..000000000000 --- a/contrib/libarchive/cpio/test/CMakeLists.txt +++ /dev/null @@ -1,79 +0,0 @@ -############################################ -# -# How to build bsdcpio_test -# -############################################ -IF(ENABLE_CPIO AND ENABLE_TEST) - SET(bsdcpio_test_SOURCES - ../cmdline.c - ../../libarchive_fe/err.c - ../../libarchive_fe/pathmatch.c - main.c - test.h - test_0.c - test_basic.c - test_cmdline.c - test_format_newc.c - test_gcpio_compat.c - test_option_B_upper.c - test_option_C_upper.c - test_option_J_upper.c - test_option_L_upper.c - test_option_Z_upper.c - test_option_a.c - test_option_c.c - test_option_d.c - test_option_f.c - test_option_help.c - test_option_l.c - test_option_lzma.c - test_option_m.c - test_option_t.c - test_option_u.c - test_option_version.c - test_option_y.c - test_option_z.c - test_owner_parse.c - test_passthrough_dotdot.c - test_passthrough_reverse.c - test_pathmatch.c - ) - IF(WIN32 AND NOT CYGWIN) - LIST(APPEND bsdcpio_test_SOURCES ../cpio_windows.h) - ENDIF(WIN32 AND NOT CYGWIN) - - # - # Register target - # - ADD_EXECUTABLE(bsdcpio_test ${bsdcpio_test_SOURCES}) - SET_PROPERTY(TARGET bsdcpio_test PROPERTY COMPILE_DEFINITIONS LIST_H) - - # - # Generate list.h by grepping DEFINE_TEST() lines out of the C sources. - # - GENERATE_LIST_H(${CMAKE_CURRENT_BINARY_DIR}/list.h - ${CMAKE_CURRENT_LIST_FILE} ${bsdcpio_test_SOURCES}) - SET_PROPERTY(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES - ${CMAKE_CURRENT_BINARY_DIR}) - - # list.h has a line DEFINE_TEST(testname) for every - # test. We can use that to define the tests for cmake by - # defining a DEFINE_TEST macro and reading list.h in. - MACRO (DEFINE_TEST _testname) - ADD_TEST_28( - NAME bsdcpio_${_testname} - COMMAND bsdcpio_test -vv - -p $ - -r ${CMAKE_CURRENT_SOURCE_DIR} - ${_testname}) - ENDMACRO (DEFINE_TEST _testname) - - INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/list.h) - - # Experimental new test handling - ADD_CUSTOM_TARGET(run_bsdcpio_test - COMMAND bsdcpio_test -p ${BSDCPIO} -r ${CMAKE_CURRENT_SOURCE_DIR}) - ADD_DEPENDENCIES(run_bsdcpio_test bsdcpio) - ADD_DEPENDENCIES(run_all_tests run_bsdcpio_test) -ENDIF(ENABLE_CPIO AND ENABLE_TEST) - diff --git a/contrib/libarchive/doc/mdoc2man.awk b/contrib/libarchive/doc/mdoc2man.awk deleted file mode 100644 index c55b953ee607..000000000000 --- a/contrib/libarchive/doc/mdoc2man.awk +++ /dev/null @@ -1,391 +0,0 @@ -#!/usr/bin/awk -# -# Copyright (c) 2003 Peter Stuge -# -# Permission to use, copy, modify, and distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -# Dramatically overhauled by Tim Kientzle. This version almost -# handles library-style pages with Fn, Ft, etc commands. Still -# a lot of problems... - -BEGIN { - displaylines = 0 - trailer = "" - out = "" - sep = "" - nextsep = " " -} - -# Add a word with appropriate preceding whitespace -# Maintain a short queue of the expected upcoming word separators. -function add(str) { - out=out sep str - sep = nextsep - nextsep = " " -} - -# Add a word with no following whitespace -# Use for opening punctuation such as '(' -function addopen(str) { - add(str) - sep = "" -} - -# Add a word with no preceding whitespace -# Use for closing punctuation such as ')' or '.' -function addclose(str) { - sep = "" - add(str) -} - -# Add a word with no space before or after -# Use for separating punctuation such as '=' -function addpunct(str) { - sep = "" - add(str) - sep = "" -} - -# Emit the current line so far -function endline() { - addclose(trailer) - trailer = "" - if(length(out) > 0) { - print out - out="" - } - if(displaylines > 0) { - displaylines = displaylines - 1 - if (displaylines == 0) - dispend() - } - # First word on next line has no preceding whitespace - sep = "" -} - -function linecmd(cmd) { - endline() - add(cmd) - endline() -} - -function breakline() { - linecmd(".br") -} - -# Start an indented display -function dispstart() { - linecmd(".RS 4") -} - -# End an indented display -function dispend() { - linecmd(".RE") -} - -# Collect rest of input line -function wtail() { - retval="" - while(w 0) { - sub("^[ \t]*", "", l) - if (match(l, "^\"")) { - l = substr(l, 2) - o = index(l, "\"") - if (o > 0) { - w = substr(l, 1, o-1) - l = substr(l, o+1) - dest[n++] = w - } else { - dest[n++] = l - l = "" - } - } else { - o = match(l, "[ \t]") - if (o > 0) { - w = substr(l, 1, o-1) - l = substr(l, o+1) - dest[n++] = w - } else { - dest[n++] = l - l = "" - } - } - } - return n-1 -} - -! /^\./ { - out = $0 - endline() - next -} - -/^\.\\"/ { next } - -{ - sub("^\\.","") - nwords=splitwords($0, words) - # TODO: Instead of iterating 'w' over the array, have a separate - # function that returns 'next word' and use that. This will allow - # proper handling of double-quoted arguments as well. - for(w=1;w<=nwords;w++) { - if(match(words[w],"^Li$")) { # Literal; rest of line is unformatted - dispstart() - displaylines = 1 - } else if(match(words[w],"^Dl$")) { # Display literal - dispstart() - displaylines = 1 - } else if(match(words[w],"^Bd$")) { # Begin display - if(match(words[w+1],"-literal")) { - dispstart() - linecmd(".nf") - displaylines=10000 - w=nwords - } - } else if(match(words[w],"^Ed$")) { # End display - displaylines = 0 - dispend() - } else if(match(words[w],"^Ns$")) { # Suppress space after next word - nextsep = "" - } else if(match(words[w],"^No$")) { # Normal text - add(words[++w]) - } else if(match(words[w],"^Dq$")) { # Quote - addopen("``") - add(words[++w]) - while(w") - } else if(match(words[w],"^Dd$")) { - date=wtail() - next - } else if(match(words[w],"^Dt$")) { - id=wtail() - next - } else if(match(words[w],"^Ox$")) { - add("OpenBSD") - } else if(match(words[w],"^Fx$")) { - add("FreeBSD") - } else if(match(words[w],"^Nx$")) { - add("NetBSD") - } else if(match(words[w],"^St$")) { - if (match(words[w+1], "^-p1003.1$")) { - w++ - add("IEEE Std 1003.1 (``POSIX.1'')") - } else if(match(words[w+1], "^-p1003.1-96$")) { - w++ - add("ISO/IEC 9945-1:1996 (``POSIX.1'')") - } else if(match(words[w+1], "^-p1003.1-88$")) { - w++ - add("IEEE Std 1003.1-1988 (``POSIX.1'')") - } else if(match(words[w+1], "^-p1003.1-2001$")) { - w++ - add("IEEE Std 1003.1-2001 (``POSIX.1'')") - } else if(match(words[w+1], "^-susv2$")) { - w++ - add("Version 2 of the Single UNIX Specification (``SUSv2'')") - } - } else if(match(words[w],"^Ex$")) { - if (match(words[w+1], "^-std$")) { - w++ - add("The \\fB" name "\\fP utility exits 0 on success, and >0 if an error occurs.") - } - } else if(match(words[w],"^Os$")) { - add(".TH " id " \"" date "\" \"" wtail() "\"") - } else if(match(words[w],"^Sh$")) { - section=wtail() - add(".SH " section) - linecmd(".ad l") - } else if(match(words[w],"^Xr$")) { - add("\\fB" words[++w] "\\fP(" words[++w] ")" words[++w]) - } else if(match(words[w],"^Nm$")) { - if(match(section,"SYNOPSIS")) - breakline() - if(w >= nwords) - n=name - else if (match(words[w+1], "^[A-Z][a-z]$")) - n=name - else if (match(words[w+1], "^[.,;:]$")) - n=name - else { - n=words[++w] - if(!length(name)) - name=n - } - if(!length(n)) - n=name - add("\\fB\\%" n "\\fP") - } else if(match(words[w],"^Nd$")) { - add("\\- " wtail()) - } else if(match(words[w],"^Fl$")) { - add("\\fB\\-" words[++w] "\\fP") - } else if(match(words[w],"^Ar$")) { - addopen("\\fI") - if(w==nwords) - add("file ...\\fP") - else - add(words[++w] "\\fP") - } else if(match(words[w],"^Cm$")) { - add("\\fB" words[++w] "\\fP") - } else if(match(words[w],"^Op$")) { - addopen("[") - option=1 - trailer="]" trailer - } else if(match(words[w],"^Pp$")) { - linecmd(".PP") - } else if(match(words[w],"^An$")) { - endline() - } else if(match(words[w],"^Ss$")) { - add(".SS") - } else if(match(words[w],"^Ft$")) { - if (match(section, "SYNOPSIS")) { - breakline() - } - add("\\fI" wtail() "\\fP") - if (match(section, "SYNOPSIS")) { - breakline() - } - } else if(match(words[w],"^Fn$")) { - ++w - F = "\\fB\\%" words[w] "\\fP(" - Fsep = "" - while(w\\fP") - } else if(match(words[w],"^Pa$")) { - addopen("\\fI") - w++ - if(match(words[w],"^\\.")) - add("\\&") - add(words[w] "\\fP") - } else if(match(words[w],"^Dv$")) { - add(".BR") - } else if(match(words[w],"^Em|Ev$")) { - add(".IR") - } else if(match(words[w],"^Pq$")) { - addopen("(") - trailer=")" trailer - } else if(match(words[w],"^Aq$")) { - addopen("\\%<") - trailer=">" trailer - } else if(match(words[w],"^Brq$")) { - addopen("{") - trailer="}" trailer - } else if(match(words[w],"^S[xy]$")) { - add(".B " wtail()) - } else if(match(words[w],"^Ic$")) { - add("\\fB") - trailer="\\fP" trailer - } else if(match(words[w],"^Bl$")) { - oldoptlist=optlist - linecmd(".RS 5") - if(match(words[w+1],"-bullet")) - optlist=1 - else if(match(words[w+1],"-enum")) { - optlist=2 - enum=0 - } else if(match(words[w+1],"-tag")) - optlist=3 - else if(match(words[w+1],"-item")) - optlist=4 - else if(match(words[w+1],"-bullet")) - optlist=1 - w=nwords - } else if(match(words[w],"^El$")) { - linecmd(".RE") - optlist=oldoptlist - } else if(match(words[w],"^It$")&&optlist) { - if(optlist==1) - add(".IP \\(bu") - else if(optlist==2) - add(".IP " ++enum ".") - else if(optlist==3) { - add(".TP") - endline() - if(match(words[w+1],"^Pa$|^Ev$")) { - add(".B") - w++ - } - } else if(optlist==4) - add(".IP") - } else if(match(words[w],"^Xo$")) { - # TODO: Figure out how to handle this - } else if(match(words[w],"^Xc$")) { - # TODO: Figure out how to handle this - } else if(match(words[w],"^[=]$")) { - addpunct(words[w]) - } else if(match(words[w],"^[\[{(]$")) { - addopen(words[w]) - } else if(match(words[w],"^[\\\])}.,;:]$")) { - addclose(words[w]) - } else { - add(words[w]) - } - } - if(match(out,"^\\.[^a-zA-Z]")) - sub("^\\.","",out) - endline() -} diff --git a/contrib/libarchive/doc/mdoc2wiki.awk b/contrib/libarchive/doc/mdoc2wiki.awk deleted file mode 100644 index 146d9619824f..000000000000 --- a/contrib/libarchive/doc/mdoc2wiki.awk +++ /dev/null @@ -1,448 +0,0 @@ -#!/usr/bin/awk -# -# Copyright (c) 2003 Peter Stuge -# -# Permission to use, copy, modify, and distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -# Dramatically overhauled by Tim Kientzle. This version almost -# handles library-style pages with Fn, Ft, etc commands. Still -# a lot of problems... - -BEGIN { - displaylines = 0 - listdepth = 0 - trailer = "" - out = "" - sep = "" - nextsep = " " - spaces = " " -} - -# Add a word with appropriate preceding whitespace -# Maintain a short queue of the expected upcoming word separators. -function add(str) { - out=out sep str - sep = nextsep - nextsep = " " -} - -# Add a word with no following whitespace -# Use for opening punctuation such as '(' -function addopen(str) { - add(str) - sep = "" -} - -# Add a word with no preceding whitespace -# Use for closing punctuation such as ')' or '.' -function addclose(str) { - sep = "" - add(str) -} - -# Add a word with no space before or after -# Use for separating punctuation such as '=' -function addpunct(str) { - sep = "" - add(str) - sep = "" -} - -# Emit the current line so far -function endline() { - addclose(trailer) - trailer = "" - if(length(out) > 0) { - print out - out="" - } - if(displaylines > 0) { - displaylines = displaylines - 1 - if (displaylines == 0) - dispend() - } - # First word on next line has no preceding whitespace - sep = "" -} - -function linecmd(cmd) { - endline() - add(cmd) - endline() -} - -function breakline() { - linecmd("
") -} - -# Start an indented display -function dispstart() { - linecmd("{{{") -} - -# End an indented display -function dispend() { - linecmd("}}}") -} - -# Collect rest of input line -function wtail() { - retval="" - while(w 0) { - sub("^[ \t]*", "", l) - if (match(l, "^\"")) { - l = substr(l, 2) - o = index(l, "\"") - if (o > 0) { - w = substr(l, 1, o-1) - l = substr(l, o+1) - dest[n++] = w - } else { - dest[n++] = l - l = "" - } - } else { - o = match(l, "[ \t]") - if (o > 0) { - w = substr(l, 1, o-1) - l = substr(l, o+1) - dest[n++] = w - } else { - dest[n++] = l - l = "" - } - } - } - return n-1 -} - -! /^\./ { - out = $0 - endline() - next -} - -/^\.\\"/ { next } - -{ - sub("^\\.","") - nwords=splitwords($0, words) - # TODO: Instead of iterating 'w' over the array, have a separate - # function that returns 'next word' and use that. This will allow - # proper handling of double-quoted arguments as well. - for(w=1;w<=nwords;w++) { - if(match(words[w],"^Li$")) { # Literal; rest of line is unformatted - dispstart() - displaylines = 1 - } else if(match(words[w],"^Dl$")) { # Display literal - dispstart() - displaylines = 1 - } else if(match(words[w],"^Bd$")) { # Begin display - if(match(words[w+1],"-literal")) { - dispstart() - displaylines=10000 - w=nwords - } - } else if(match(words[w],"^Ed$")) { # End display - displaylines = 0 - dispend() - } else if(match(words[w],"^Ns$")) { # Suppress space before next word - sep="" - } else if(match(words[w],"^No$")) { # Normal text - add(words[++w]) - } else if(match(words[w],"^Dq$")) { # Quote - addopen("\"") - add(words[++w]) - while(w`") - } else if(match(words[w],"^Dd$")) { - date=wtail() - next - } else if(match(words[w],"^Dt$")) { - id=wtail() - next - } else if(match(words[w],"^Ox$")) { - add("OpenBSD") - } else if(match(words[w],"^Fx$")) { - add("FreeBSD") - } else if(match(words[w],"^Bx$")) { - add("BSD") - } else if(match(words[w],"^Nx$")) { - add("NetBSD") - } else if(match(words[w],"^St$")) { - if (match(words[w+1], "^-p1003.1$")) { - w++ - add("IEEE Std 1003.1 (``POSIX.1'')") - } else if(match(words[w+1], "^-p1003.1-96$")) { - w++ - add("ISO/IEC 9945-1:1996 (``POSIX.1'')") - } else if(match(words[w+1], "^-p1003.1-88$")) { - w++ - add("IEEE Std 1003.1-1988 (``POSIX.1'')") - } else if(match(words[w+1], "^-p1003.1-2001$")) { - w++ - add("IEEE Std 1003.1-2001 (``POSIX.1'')") - } else if(match(words[w+1], "^-susv2$")) { - w++ - add("Version 2 of the Single UNIX Specification (``SUSv2'')") - } - } else if(match(words[w],"^Ex$")) { - if (match(words[w+1], "^-std$")) { - w++ - add("The *" name "* utility exits 0 on success, and >0 if an error occurs.") - } - } else if(match(words[w],"^Os$")) { - add("#summary " id " manual page") - } else if(match(words[w],"^Sh$")) { - section=wtail() - linecmd("== " section " ==") - } else if(match(words[w],"^Xr$")) { - add("*" words[++w] "*(" words[++w] ")" words[++w]) - } else if(match(words[w],"^Nm$")) { - if(match(section,"SYNOPSIS")) - breakline() - if(w >= nwords) - n=name - else if (match(words[w+1], "^[A-Z][a-z]$")) - n=name - else if (match(words[w+1], "^[.,;:]$")) - n=name - else { - n=words[++w] - if(!length(name)) - name=n - } - if(!length(n)) - n=name - if (displaylines == 0) - add("*" n "*") - else - add(n) - } else if(match(words[w],"^Nd$")) { - add("- " wtail()) - } else if(match(words[w],"^Fl$")) { - if (displaylines == 0) - add("*-" words[++w] "*") - else - add("-" words[++w]) - } else if(match(words[w],"^Ar$")) { - if(w==nwords) - add("_file ..._") - else { - ++w - gsub("<", "`<`", words[w]) - add("_" words[w] "_") - } - } else if(match(words[w],"^Cm$")) { - ++w - if (displaylines == 0) { - gsub("^_", "`_`", words[w]) - gsub("\\*$", "`*`", words[w]) - add("*" words[w] "*") - } else - add(words[w]) - } else if(match(words[w],"^Op$")) { - addopen("`[`") - option=1 - trailer="`]`" trailer - } else if(match(words[w],"^Pp$")) { - ++w - endline() - print "" - } else if(match(words[w],"^An$")) { - if (match(words[w+1],"-nosplit")) - ++w - endline() - } else if(match(words[w],"^Ss$")) { - add("===") - trailer="===" - } else if(match(words[w],"^Ft$")) { - if (match(section, "SYNOPSIS")) { - breakline() - } - l = wtail() - gsub("\\*", "`*`", l) - - add("*" l "*") - if (match(section, "SYNOPSIS")) { - breakline() - } - } else if(match(words[w],"^Fn$")) { - ++w - F = "*" words[w] "*(" - Fsep = "" - while(w*") - } else if(match(words[w],"^Pa$")) { - w++ -# if(match(words[w],"^\\.")) -# add("\\&") - if (displaylines == 0) - add("_" words[w] "_") - else - add(words[w]) - } else if(match(words[w],"^Dv$")) { - linecmd() - } else if(match(words[w],"^Em|Ev$")) { - add(".IR") - } else if(match(words[w],"^Pq$")) { - addopen("(") - trailer=")" trailer - } else if(match(words[w],"^Aq$")) { - addopen(" <") - trailer=">" trailer - } else if(match(words[w],"^Brq$")) { - addopen("{") - trailer="}" trailer - } else if(match(words[w],"^S[xy]$")) { - add(".B " wtail()) - } else if(match(words[w],"^Tn$")) { - n=wtail() - gsub("\\*$", "`*`", n) - add("*" n "*") - } else if(match(words[w],"^Ic$")) { - add("\\fB") - trailer="\\fP" trailer - } else if(match(words[w],"^Bl$")) { - ++listdepth - listnext[listdepth]="" - if(match(words[w+1],"-bullet")) { - optlist[listdepth]=1 - addopen("
    ") - listclose[listdepth]="
" - } else if(match(words[w+1],"-enum")) { - optlist[listdepth]=2 - enum=0 - addopen("
    ") - listclose[listdepth]="
" - } else if(match(words[w+1],"-tag")) { - optlist[listdepth]=3 - addopen("
") - listclose[listdepth]="
" - } else if(match(words[w+1],"-item")) { - optlist[listdepth]=4 - addopen("
    ") - listclose[listdepth]="
" - } - w=nwords - } else if(match(words[w],"^El$")) { - addclose(listnext[listdepth]) - addclose(listclose[listdepth]) - listclose[listdepth]="" - listdepth-- - } else if(match(words[w],"^It$")) { - addclose(listnext[listdepth]) - if(optlist[listdepth]==1) { - addpunct("
  • ") - listnext[listdepth] = "
  • " - } else if(optlist[listdepth]==2) { - addpunct("
  • ") - listnext[listdepth] = "
  • " - } else if(optlist[listdepth]==3) { - addpunct("
    ") - listnext[listdepth] = "
    " - if(match(words[w+1],"^Xo$")) { - # Suppress trailer - w++ - } else if(match(words[w+1],"^Pa$|^Ev$")) { - addopen("*") - w++ - add(words[++w] "*") - } else { - trailer = listnext[listdepth] "
    " trailer - listnext[listdepth] = "
    " - } - } else if(optlist[listdepth]==4) { - addpunct("
  • ") - listnext[listdepth] = "
  • " - } - } else if(match(words[w],"^Xo$")) { - # TODO: Figure out how to handle this - } else if(match(words[w],"^Xc$")) { - # TODO: Figure out how to handle this - if (optlist[listdepth] == 3) { - addclose(listnext[listdepth]) - addopen("
    ") - listnext[listdepth] = "
    " - } - } else if(match(words[w],"^[=]$")) { - addpunct(words[w]) - } else if(match(words[w],"^[\[{(]$")) { - addopen(words[w]) - } else if(match(words[w],"^[\\\])}.,;:]$")) { - addclose(words[w]) - } else { - sub("\\\\&", "", words[w]) - add(words[w]) - } - } - if(match(out,"^\\.[^a-zA-Z]")) - sub("^\\.","",out) - endline() -} diff --git a/contrib/libarchive/doc/update.sh b/contrib/libarchive/doc/update.sh deleted file mode 100644 index 9526d95ac9b3..000000000000 --- a/contrib/libarchive/doc/update.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/sh - -# -# Simple script to repopulate the 'doc' tree from -# the mdoc man pages stored in each project. -# - -# Collect list of man pages, relative to my subdirs -test -d man || mkdir man -cd man -MANPAGES=`for d in libarchive tar cpio;do ls ../../$d/*.[135];done | grep -v '\.so\.'` -cd .. - -# Build Makefile in 'man' directory -cd man -chmod +w . -rm -f *.[135] Makefile -echo > Makefile -echo "default: all" >>Makefile -echo >>Makefile -all="all:" -for f in $MANPAGES; do - outname="`basename $f`" - echo >> Makefile - echo $outname: ../mdoc2man.awk $f >> Makefile - echo " awk -f ../mdoc2man.awk < $f > $outname" >> Makefile - all="$all $outname" -done -echo $all >>Makefile -cd .. - -# Rebuild Makefile in 'text' directory -test -d text || mkdir text -cd text -chmod +w . -rm -f *.txt Makefile -echo > Makefile -echo "default: all" >>Makefile -echo >>Makefile -all="all:" -for f in $MANPAGES; do - outname="`basename $f`.txt" - echo >> Makefile - echo $outname: $f >> Makefile - echo " nroff -mdoc $f | col -b > $outname" >> Makefile - all="$all $outname" -done -echo $all >>Makefile -cd .. - -# Rebuild Makefile in 'pdf' directory -test -d pdf || mkdir pdf -cd pdf -chmod +w . -rm -f *.pdf Makefile -echo > Makefile -echo "default: all" >>Makefile -echo >>Makefile -all="all:" -for f in $MANPAGES; do - outname="`basename $f`.pdf" - echo >> Makefile - echo $outname: $f >> Makefile - echo " groff -mdoc -T ps $f | ps2pdf - - > $outname" >> Makefile - all="$all $outname" -done -echo $all >>Makefile -cd .. - -# Build Makefile in 'html' directory -test -d html || mkdir html -cd html -chmod +w . -rm -f *.html Makefile -echo > Makefile -echo "default: all" >>Makefile -echo >>Makefile -all="all:" -for f in $MANPAGES; do - outname="`basename $f`.html" - echo >> Makefile - echo $outname: $f >> Makefile - echo " groff -mdoc2html $f > $outname" >> Makefile - all="$all $outname" -done -echo $all >>Makefile -cd .. - -# Build Makefile in 'wiki' directory -test -d wiki || mkdir wiki -cd wiki -chmod +w . -rm -f *.wiki Makefile -echo > Makefile -echo "default: all" >>Makefile -echo >>Makefile -all="all:" -for f in $MANPAGES; do - outname="`basename $f | awk '{ac=split($0,a,"[_.-]");o="ManPage";for(w=0;w<=ac;++w){o=o toupper(substr(a[w],1,1)) substr(a[w],2)};print o}'`.wiki" - echo >> Makefile - echo $outname: ../mdoc2wiki.awk $f >> Makefile - echo " awk -f ../mdoc2wiki.awk < $f > $outname" >> Makefile - all="$all $outname" -done -echo $all >>Makefile -cd .. - -# Convert all of the manpages to -man format -(cd man && make) -# Format all of the manpages to text -(cd text && make) -# Format all of the manpages to PDF -(cd pdf && make) -# Format all of the manpages to HTML -(cd html && make) -# Format all of the manpages to Google Wiki syntax -(cd wiki && make) diff --git a/contrib/libarchive/examples/minitar/Makefile b/contrib/libarchive/examples/minitar/Makefile deleted file mode 100644 index 3cd61f36e7e0..000000000000 --- a/contrib/libarchive/examples/minitar/Makefile +++ /dev/null @@ -1,34 +0,0 @@ - -# -# Adjust the following to control which options minitar gets -# built with. See comments in minitar.c for details. -# -CFLAGS= \ - -DNO_BZIP2_CREATE \ - -DNO_BZIP2_EXTRACT \ - -DNO_COMPRESS_EXTRACT \ - -DNO_CPIO_EXTRACT \ - -DNO_CREATE \ - -DNO_GZIP_CREATE \ - -DNO_GZIP_EXTRACT \ - -DNO_LOOKUP - -# Omit 'tree.o' if you're not including create support -#OBJS= minitar.o tree.o -OBJS= minitar.o - -all: minitar - -minitar: $(OBJS) - cc -o minitar -static $(OBJS) -larchive -lz -lbz2 - strip minitar - ls -l minitar - -minitar.o: minitar.c - -tree.o: tree.c - -clean:: - rm -f *.o - rm -f minitar - rm -f *~ diff --git a/contrib/libarchive/examples/minitar/README b/contrib/libarchive/examples/minitar/README deleted file mode 100644 index 83f646cdb313..000000000000 --- a/contrib/libarchive/examples/minitar/README +++ /dev/null @@ -1,12 +0,0 @@ -"minitar" is a minimal example of a program that uses libarchive to -read/write various archive formats. It's a more ambitious version of -'untar.c' that includes compile-time options to enable/disable various -features, including non-tar formats, archive creation, and automatic -decompression support. - -I use this as a test bed to check for "link pollution," ensuring that -a program using libarchive does not pull in unnecessary code. - -The "minitar" program is also a good starting point for anyone who -wants to use libarchive for their own purposes, as it demonstrates -basic usage of the library. diff --git a/contrib/libarchive/examples/minitar/minitar.c b/contrib/libarchive/examples/minitar/minitar.c deleted file mode 100644 index 7e9011183774..000000000000 --- a/contrib/libarchive/examples/minitar/minitar.c +++ /dev/null @@ -1,421 +0,0 @@ -/*- - * This file is in the public domain. - * Do with it as you will. - */ - -/*- - * This is a compact "tar" program whose primary goal is small size. - * Statically linked, it can be very small indeed. This serves a number - * of goals: - * o a testbed for libarchive (to check for link pollution), - * o a useful tool for space-constrained systems (boot floppies, etc), - * o a place to experiment with new implementation ideas for bsdtar, - * o a small program to demonstrate libarchive usage. - * - * Use the following macros to suppress features: - * NO_BZIP2 - Implies NO_BZIP2_CREATE and NO_BZIP2_EXTRACT - * NO_BZIP2_CREATE - Suppress bzip2 compression support. - * NO_BZIP2_EXTRACT - Suppress bzip2 auto-detection and decompression. - * NO_COMPRESS - Implies NO_COMPRESS_CREATE and NO_COMPRESS_EXTRACT - * NO_COMPRESS_CREATE - Suppress compress(1) compression support - * NO_COMPRESS_EXTRACT - Suppress compress(1) auto-detect and decompression. - * NO_CREATE - Suppress all archive creation support. - * NO_CPIO_EXTRACT - Suppress auto-detect and dearchiving of cpio archives. - * NO_GZIP - Implies NO_GZIP_CREATE and NO_GZIP_EXTRACT - * NO_GZIP_CREATE - Suppress gzip compression support. - * NO_GZIP_EXTRACT - Suppress gzip auto-detection and decompression. - * NO_LOOKUP - Try to avoid getpw/getgr routines, which can be very large - * NO_TAR_EXTRACT - Suppress tar extraction - * - * With all of the above macros defined (except NO_TAR_EXTRACT), you - * get a very small program that can recognize and extract essentially - * any uncompressed tar archive. On FreeBSD 5.1, this minimal program - * is under 64k, statically linked, which compares rather favorably to - * main(){printf("hello, world");} - * which is over 60k statically linked on the same operating system. - * Without any of the above macros, you get a static executable of - * about 180k with a lot of very sophisticated modern features. - * Obviously, it's trivial to add support for ISO, Zip, mtree, - * lzma/xz, etc. Just fill in the appropriate setup calls. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include - -#include -#include -#include -#include -#include -#include -#include - -#ifndef NO_CREATE -#include "tree.h" -#endif - -/* - * NO_CREATE implies NO_BZIP2_CREATE and NO_GZIP_CREATE and NO_COMPRESS_CREATE. - */ -#ifdef NO_CREATE -#undef NO_BZIP2_CREATE -#define NO_BZIP2_CREATE -#undef NO_COMPRESS_CREATE -#define NO_COMPRESS_CREATE -#undef NO_GZIP_CREATE -#define NO_GZIP_CREATE -#endif - -/* - * The combination of NO_BZIP2_CREATE and NO_BZIP2_EXTRACT is - * equivalent to NO_BZIP2. - */ -#ifdef NO_BZIP2_CREATE -#ifdef NO_BZIP2_EXTRACT -#undef NO_BZIP2 -#define NO_BZIP2 -#endif -#endif - -#ifdef NO_BZIP2 -#undef NO_BZIP2_EXTRACT -#define NO_BZIP2_EXTRACT -#undef NO_BZIP2_CREATE -#define NO_BZIP2_CREATE -#endif - -/* - * The combination of NO_COMPRESS_CREATE and NO_COMPRESS_EXTRACT is - * equivalent to NO_COMPRESS. - */ -#ifdef NO_COMPRESS_CREATE -#ifdef NO_COMPRESS_EXTRACT -#undef NO_COMPRESS -#define NO_COMPRESS -#endif -#endif - -#ifdef NO_COMPRESS -#undef NO_COMPRESS_EXTRACT -#define NO_COMPRESS_EXTRACT -#undef NO_COMPRESS_CREATE -#define NO_COMPRESS_CREATE -#endif - -/* - * The combination of NO_GZIP_CREATE and NO_GZIP_EXTRACT is - * equivalent to NO_GZIP. - */ -#ifdef NO_GZIP_CREATE -#ifdef NO_GZIP_EXTRACT -#undef NO_GZIP -#define NO_GZIP -#endif -#endif - -#ifdef NO_GZIP -#undef NO_GZIP_EXTRACT -#define NO_GZIP_EXTRACT -#undef NO_GZIP_CREATE -#define NO_GZIP_CREATE -#endif - -#ifndef NO_CREATE -static void create(const char *filename, int compress, const char **argv); -#endif -static void errmsg(const char *); -static void extract(const char *filename, int do_extract, int flags); -static int copy_data(struct archive *, struct archive *); -static void msg(const char *); -static void usage(void); - -static int verbose = 0; - -int -main(int argc, const char **argv) -{ - const char *filename = NULL; - int compress, flags, mode, opt; - - (void)argc; - mode = 'x'; - verbose = 0; - compress = '\0'; - flags = ARCHIVE_EXTRACT_TIME; - - /* Among other sins, getopt(3) pulls in printf(3). */ - while (*++argv != NULL && **argv == '-') { - const char *p = *argv + 1; - - while ((opt = *p++) != '\0') { - switch (opt) { -#ifndef NO_CREATE - case 'c': - mode = opt; - break; -#endif - case 'f': - if (*p != '\0') - filename = p; - else - filename = *++argv; - p += strlen(p); - break; -#ifndef NO_BZIP2_CREATE - case 'j': - compress = opt; - break; -#endif - case 'p': - flags |= ARCHIVE_EXTRACT_PERM; - flags |= ARCHIVE_EXTRACT_ACL; - flags |= ARCHIVE_EXTRACT_FFLAGS; - break; - case 't': - mode = opt; - break; - case 'v': - verbose++; - break; - case 'x': - mode = opt; - break; -#ifndef NO_BZIP2_CREATE - case 'y': - compress = opt; - break; -#endif -#ifndef NO_COMPRESS_CREATE - case 'Z': - compress = opt; - break; -#endif -#ifndef NO_GZIP_CREATE - case 'z': - compress = opt; - break; -#endif - default: - usage(); - } - } - } - - switch (mode) { -#ifndef NO_CREATE - case 'c': - create(filename, compress, argv); - break; -#endif - case 't': - extract(filename, 0, flags); - break; - case 'x': - extract(filename, 1, flags); - break; - } - - return (0); -} - - -#ifndef NO_CREATE -static char buff[16384]; - -static void -create(const char *filename, int compress, const char **argv) -{ - struct archive *a; - struct archive *disk; - struct archive_entry *entry; - ssize_t len; - int fd; - - a = archive_write_new(); - switch (compress) { -#ifndef NO_BZIP2_CREATE - case 'j': case 'y': - archive_write_set_compression_bzip2(a); - break; -#endif -#ifndef NO_COMPRESS_CREATE - case 'Z': - archive_write_set_compression_compress(a); - break; -#endif -#ifndef NO_GZIP_CREATE - case 'z': - archive_write_set_compression_gzip(a); - break; -#endif - default: - archive_write_set_compression_none(a); - break; - } - archive_write_set_format_ustar(a); - if (strcmp(filename, "-") == 0) - filename = NULL; - archive_write_open_file(a, filename); - - disk = archive_read_disk_new(); -#ifndef NO_LOOKUP - archive_read_disk_set_standard_lookup(disk); -#endif - while (*argv != NULL) { - struct tree *t = tree_open(*argv); - while (tree_next(t)) { - entry = archive_entry_new(); - archive_entry_set_pathname(entry, tree_current_path(t)); - archive_read_disk_entry_from_file(disk, entry, -1, - tree_current_stat(t)); - if (verbose) { - msg("a "); - msg(tree_current_path(t)); - } - archive_write_header(a, entry); - fd = open(tree_current_access_path(t), O_RDONLY); - len = read(fd, buff, sizeof(buff)); - while (len > 0) { - archive_write_data(a, buff, len); - len = read(fd, buff, sizeof(buff)); - } - close(fd); - archive_entry_free(entry); - if (verbose) - msg("\n"); - } - argv++; - } - archive_write_close(a); - archive_write_finish(a); -} -#endif - -static void -extract(const char *filename, int do_extract, int flags) -{ - struct archive *a; - struct archive *ext; - struct archive_entry *entry; - int r; - - a = archive_read_new(); - ext = archive_write_disk_new(); - archive_write_disk_set_options(ext, flags); -#ifndef NO_BZIP2_EXTRACT - archive_read_support_compression_bzip2(a); -#endif -#ifndef NO_GZIP_EXTRACT - archive_read_support_compression_gzip(a); -#endif -#ifndef NO_COMPRESS_EXTRACT - archive_read_support_compression_compress(a); -#endif -#ifndef NO_TAR_EXTRACT - archive_read_support_format_tar(a); -#endif -#ifndef NO_CPIO_EXTRACT - archive_read_support_format_cpio(a); -#endif -#ifndef NO_LOOKUP - archive_write_disk_set_standard_lookup(ext); -#endif - if (filename != NULL && strcmp(filename, "-") == 0) - filename = NULL; - if ((r = archive_read_open_file(a, filename, 10240))) { - errmsg(archive_error_string(a)); - errmsg("\n"); - exit(r); - } - for (;;) { - r = archive_read_next_header(a, &entry); - if (r == ARCHIVE_EOF) - break; - if (r != ARCHIVE_OK) { - errmsg(archive_error_string(a)); - errmsg("\n"); - exit(1); - } - if (verbose && do_extract) - msg("x "); - if (verbose || !do_extract) - msg(archive_entry_pathname(entry)); - if (do_extract) { - r = archive_write_header(ext, entry); - if (r != ARCHIVE_OK) - errmsg(archive_error_string(a)); - else - copy_data(a, ext); - } - if (verbose || !do_extract) - msg("\n"); - } - archive_read_close(a); - archive_read_finish(a); - exit(0); -} - -static int -copy_data(struct archive *ar, struct archive *aw) -{ - int r; - const void *buff; - size_t size; - off_t offset; - - for (;;) { - r = archive_read_data_block(ar, &buff, &size, &offset); - if (r == ARCHIVE_EOF) { - errmsg(archive_error_string(ar)); - return (ARCHIVE_OK); - } - if (r != ARCHIVE_OK) - return (r); - r = archive_write_data_block(aw, buff, size, offset); - if (r != ARCHIVE_OK) { - errmsg(archive_error_string(ar)); - return (r); - } - } -} - -static void -msg(const char *m) -{ - write(1, m, strlen(m)); -} - -static void -errmsg(const char *m) -{ - write(2, m, strlen(m)); -} - -static void -usage(void) -{ -/* Many program options depend on compile options. */ - const char *m = "Usage: minitar [-" -#ifndef NO_CREATE - "c" -#endif -#ifndef NO_BZIP2 - "j" -#endif - "tvx" -#ifndef NO_BZIP2 - "y" -#endif -#ifndef NO_COMPRESS - "Z" -#endif -#ifndef NO_GZIP - "z" -#endif - "] [-f file] [file]\n"; - - errmsg(m); - exit(1); -} diff --git a/contrib/libarchive/examples/minitar/tree.c b/contrib/libarchive/examples/minitar/tree.c deleted file mode 100644 index 8af0b4d88e71..000000000000 --- a/contrib/libarchive/examples/minitar/tree.c +++ /dev/null @@ -1,423 +0,0 @@ -/*- - * Copyright (c) 2003-2004 Tim Kientzle - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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. - */ - -/*- - * There is a single list of "tree_entry" items that represent - * filesystem objects that require further attention. Non-directories - * are not kept in memory: they are pulled from readdir(), returned to - * the client, then freed as soon as possible. Any directory entry to - * be traversed gets pushed onto the stack. - * - * There is surprisingly little information that needs to be kept for - * each item on the stack. Just the name, depth (represented here as the - * string length of the parent directory's pathname), and some markers - * indicating how to get back to the parent (via chdir("..") for a - * regular dir or via fchdir(2) for a symlink). - */ - -#include -#include -#include -#include -#include -#include - -#include "tree.h" - -/* - * TODO: - * 1) Loop checking. - * 3) Arbitrary logical traversals by closing/reopening intermediate fds. - */ - -struct tree_entry { - struct tree_entry *next; - char *name; - size_t dirname_length; - int fd; - int flags; -}; - -/* Definitions for tree_entry.flags bitmap. */ -#define isDir 1 /* This entry is a regular directory. */ -#define isDirLink 2 /* This entry is a symbolic link to a directory. */ -#define needsTraversal 4 /* This entry hasn't yet been traversed. */ - -/* - * Local data for this package. - */ -struct tree { - struct tree_entry *stack; - DIR *d; - int initialDirFd; - int flags; - - char *buff; - char *basename; - size_t buff_length; - size_t path_length; - size_t dirname_length; - - int depth; - int openCount; - int maxOpenCount; - - struct stat lst; - struct stat st; -}; - -/* Definitions for tree.flags bitmap. */ -#define needsReturn 8 /* Marks first entry as not having been returned yet. */ -#define hasStat 16 /* The st entry is set. */ -#define hasLstat 32 /* The lst entry is set. */ - - -#define HAVE_DIRENT_D_NAMLEN 1 -#ifdef HAVE_DIRENT_D_NAMLEN -/* BSD extension; avoids need for a strlen() call. */ -#define D_NAMELEN(dp) (dp)->d_namlen -#else -#define D_NAMELEN(dp) (strlen((dp)->d_name)) -#endif - -#if 0 -static void -dumpStack(struct tree *t) -{ - struct tree_entry *te; - - printf("\tbuff: %s\n", t->buff); - printf("\tpwd: "); fflush(stdout); system("pwd"); - printf("\tstack:\n"); - for (te = t->stack; te != NULL; te = te->next) { - printf("\t\tte->name: %s %s\n", te->name, te->flags & needsTraversal ? "" : "*"); - } -} -#endif - -/* - * Add a directory path to the current stack. - */ -static void -tree_add(struct tree *t, const char *path) -{ - struct tree_entry *te; - - te = malloc(sizeof(*te)); - memset(te, 0, sizeof(*te)); - te->next = t->stack; - t->stack = te; - te->fd = -1; - te->name = strdup(path); - te->flags = needsTraversal; - te->dirname_length = t->dirname_length; -} - -/* - * Append a name to the current path. - */ -static void -tree_append(struct tree *t, const char *name, size_t name_length) -{ - if (t->buff != NULL) - t->buff[t->dirname_length] = '\0'; - - /* Resize pathname buffer as needed. */ - while (name_length + 1 + t->dirname_length >= t->buff_length) { - t->buff_length *= 2; - if (t->buff_length < 1024) - t->buff_length = 1024; - t->buff = realloc(t->buff, t->buff_length); - } - t->basename = t->buff + t->dirname_length; - t->path_length = t->dirname_length + name_length; - if (t->dirname_length > 0) { - *t->basename++ = '/'; - t->path_length ++; - } - strcpy(t->basename, name); -} - -/* - * Open a directory tree for traversal. - */ -struct tree * -tree_open(const char *path) -{ - struct tree *t; - - t = malloc(sizeof(*t)); - memset(t, 0, sizeof(*t)); - tree_append(t, path, strlen(path)); - t->initialDirFd = open(".", O_RDONLY); - /* - * During most of the traversal, items are set up and then - * returned immediately from tree_next(). That doesn't work - * for the very first entry, so we set a flag for this special - * case. - */ - t->flags = needsReturn; - return (t); -} - -/* - * We've finished a directory; ascend back to the parent. - */ -static void -tree_ascend(struct tree *t) -{ - struct tree_entry *te; - - te = t->stack; - t->depth--; - if (te->flags & isDirLink) { - fchdir(te->fd); - close(te->fd); - t->openCount--; - } else { - chdir(".."); - } -} - -/* - * Pop the working stack. - */ -static void -tree_pop(struct tree *t) -{ - struct tree_entry *te; - - te = t->stack; - t->stack = te->next; - t->dirname_length = te->dirname_length; - free(te->name); - free(te); -} - -/* - * Get the next item in the tree traversal. - */ -int -tree_next(struct tree *t) -{ - struct dirent *de = NULL; - - /* Handle the startup case by returning the initial entry. */ - if (t->flags & needsReturn) { - t->flags &= ~needsReturn; - return (1); - } - - while (t->stack != NULL) { - /* If there's an open dir, get the next entry from there. */ - while (t->d != NULL) { - de = readdir(t->d); - if (de == NULL) { - closedir(t->d); - t->d = NULL; - } else if (de->d_name[0] == '.' - && de->d_name[1] == '\0') { - /* Skip '.' */ - } else if (de->d_name[0] == '.' - && de->d_name[1] == '.' - && de->d_name[2] == '\0') { - /* Skip '..' */ - } else { - /* - * Append the path to the current path - * and return it. - */ - tree_append(t, de->d_name, D_NAMELEN(de)); - t->flags &= ~hasLstat; - t->flags &= ~hasStat; - return (1); - } - } - - /* If the current dir needs to be traversed, set it up. */ - if (t->stack->flags & needsTraversal) { - tree_append(t, t->stack->name, strlen(t->stack->name)); - t->stack->flags &= ~needsTraversal; - /* If it is a link, set up fd for the ascent. */ - if (t->stack->flags & isDirLink) { - t->stack->fd = open(".", O_RDONLY); - t->openCount++; - if (t->openCount > t->maxOpenCount) - t->maxOpenCount = t->openCount; - } - if (chdir(t->stack->name) == 0) { - t->depth++; - t->dirname_length = t->path_length; - t->d = opendir("."); - } else - tree_pop(t); - continue; - } - - /* We've done everything necessary for the top stack entry. */ - tree_ascend(t); - tree_pop(t); - } - return (0); -} - -/* - * Called by the client to mark the directory just returned from - * tree_next() as needing to be visited. - */ -void -tree_descend(struct tree *t) -{ - const struct stat *s = tree_current_lstat(t); - - if (S_ISDIR(s->st_mode)) { - tree_add(t, t->basename); - t->stack->flags |= isDir; - } - - if (S_ISLNK(s->st_mode) && S_ISDIR(tree_current_stat(t)->st_mode)) { - tree_add(t, t->basename); - t->stack->flags |= isDirLink; - } -} - -/* - * Get the stat() data for the entry just returned from tree_next(). - */ -const struct stat * -tree_current_stat(struct tree *t) -{ - if (!(t->flags & hasStat)) { - stat(t->basename, &t->st); - t->flags |= hasStat; - } - return (&t->st); -} - -/* - * Get the lstat() data for the entry just returned from tree_next(). - */ -const struct stat * -tree_current_lstat(struct tree *t) -{ - if (!(t->flags & hasLstat)) { - lstat(t->basename, &t->lst); - t->flags |= hasLstat; - } - return (&t->lst); -} - -/* - * Return the access path for the entry just returned from tree_next(). - */ -const char * -tree_current_access_path(struct tree *t) -{ - return (t->basename); -} - -/* - * Return the full path for the entry just returned from tree_next(). - */ -const char * -tree_current_path(struct tree *t) -{ - return (t->buff); -} - -/* - * Return the length of the path for the entry just returned from tree_next(). - */ -size_t -tree_current_pathlen(struct tree *t) -{ - return (t->path_length); -} - -/* - * Return the nesting depth of the entry just returned from tree_next(). - */ -int -tree_current_depth(struct tree *t) -{ - return (t->depth); -} - -/* - * Terminate the traversal and release any resources. - */ -void -tree_close(struct tree *t) -{ - /* Release anything remaining in the stack. */ - while (t->stack != NULL) - tree_pop(t); - if (t->buff) - free(t->buff); - /* chdir() back to where we started. */ - if (t->initialDirFd >= 0) { - fchdir(t->initialDirFd); - close(t->initialDirFd); - t->initialDirFd = -1; - } - free(t); -} - - -#if 0 -/* Main function for testing. */ -#include - -int main(int argc, char **argv) -{ - size_t max_path_len = 0; - int max_depth = 0; - - system("pwd"); - while (*++argv) { - struct tree *t = tree_open(*argv); - while (tree_next(t)) { - size_t path_len = tree_current_pathlen(t); - int depth = tree_current_depth(t); - if (path_len > max_path_len) - max_path_len = path_len; - if (depth > max_depth) - max_depth = depth; - printf("%s\n", tree_current_path(t)); - if (S_ISDIR(tree_current_lstat(t)->st_mode)) - tree_descend(t); /* Descend into every dir. */ - } - tree_close(t); - printf("Max path length: %d\n", max_path_len); - printf("Max depth: %d\n", max_depth); - printf("Final open count: %d\n", t->openCount); - printf("Max open count: %d\n", t->maxOpenCount); - fflush(stdout); - system("pwd"); - } - return (0); -} -#endif diff --git a/contrib/libarchive/examples/minitar/tree.h b/contrib/libarchive/examples/minitar/tree.h deleted file mode 100644 index 554e6c2da219..000000000000 --- a/contrib/libarchive/examples/minitar/tree.h +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * Copyright (c) 2003-2004 Tim Kientzle - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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. - */ - -/*- - * A set of routines for traversing directory trees. - * Similar in concept to the fts library, but with a few - * important differences: - * * Uses less memory. In particular, fts stores an entire directory - * in memory at a time. This package only keeps enough subdirectory - * information in memory to track the traversal. Information - * about non-directories is discarded as soon as possible. - * * Supports very deep logical traversals. The fts package - * uses "non-chdir" approach for logical traversals. This - * package does use a chdir approach for logical traversals - * and can therefore handle pathnames much longer than - * PATH_MAX. - * * Supports deep physical traversals "out of the box." - * Due to the memory optimizations above, there's no need to - * limit dir names to 32k. - */ - -#include - -struct tree; - -struct tree *tree_open(const char *); -/* Returns TRUE if there is a next entry. Zero if there is no next entry. */ -int tree_next(struct tree *); -/* Return information about the current entry. */ -int tree_current_depth(struct tree *); -/* - * The current full pathname, length of the full pathname, - * and a name that can be used to access the file. - * Because tree does use chdir extensively, the access path is - * almost never the same as the full current path. - */ -const char *tree_current_path(struct tree *); -size_t tree_current_pathlen(struct tree *); -const char *tree_current_access_path(struct tree *); -/* - * Request the lstat() or stat() data for the current path. - * Since the tree package needs to do some of this anyway, - * you should take advantage of it here if you need it. - */ -const struct stat *tree_current_stat(struct tree *); -const struct stat *tree_current_lstat(struct tree *); -/* - * Request that current entry be visited. If you invoke it on every - * directory, you'll get a physical traversal. This is ignored if the - * current entry isn't a directory or a link to a directory. So, if - * you invoke this on every returned path, you'll get a full logical - * traversal. - */ -void tree_descend(struct tree *); -void tree_close(struct tree *); diff --git a/contrib/libarchive/examples/tarfilter.c b/contrib/libarchive/examples/tarfilter.c deleted file mode 100644 index b7e08cfc1dac..000000000000 --- a/contrib/libarchive/examples/tarfilter.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * This file is in the public domain. - * - * Feel free to use it as you wish. - */ - -/* - * This example program reads an archive from stdin (which can be in - * any format recognized by libarchive) and writes certain entries to - * an uncompressed ustar archive on stdout. This is a template for - * many kinds of archive manipulation: converting formats, resetting - * ownership, inserting entries, removing entries, etc. - * - * To compile: - * gcc -Wall -o tarfilter tarfilter.c -larchive -lz -lbz2 - */ - -#include -#include -#include -#include -#include -#include - -static void -die(char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - fprintf(stderr, "\n"); - exit(1); -} - -int -main(int argc, char **argv) -{ - char buff[8192]; - ssize_t len; - int r; - mode_t m; - struct archive *ina; - struct archive *outa; - struct archive_entry *entry; - - /* Read an archive from stdin, with automatic format detection. */ - ina = archive_read_new(); - if (ina == NULL) - die("Couldn't create archive reader."); - if (archive_read_support_compression_all(ina) != ARCHIVE_OK) - die("Couldn't enable decompression"); - if (archive_read_support_format_all(ina) != ARCHIVE_OK) - die("Couldn't enable read formats"); - if (archive_read_open_fd(ina, 0, 10240) != ARCHIVE_OK) - die("Couldn't open input archive"); - - /* Write an uncompressed ustar archive to stdout. */ - outa = archive_write_new(); - if (outa == NULL) - die("Couldn't create archive writer."); - if (archive_write_set_compression_none(outa) != ARCHIVE_OK) - die("Couldn't enable compression"); - if (archive_write_set_format_ustar(outa) != ARCHIVE_OK) - die("Couldn't set output format"); - if (archive_write_open_fd(outa, 1) != ARCHIVE_OK) - die("Couldn't open output archive"); - - /* Examine each entry in the input archive. */ - while ((r = archive_read_next_header(ina, &entry)) == ARCHIVE_OK) { - fprintf(stderr, "%s: ", archive_entry_pathname(entry)); - - /* Skip anything that isn't a regular file. */ - if (!S_ISREG(archive_entry_mode(entry))) { - fprintf(stderr, "skipped\n"); - continue; - } - - /* Make everything owned by root/wheel. */ - archive_entry_set_uid(entry, 0); - archive_entry_set_uname(entry, "root"); - archive_entry_set_gid(entry, 0); - archive_entry_set_gname(entry, "wheel"); - - /* Make everything permission 0744, strip SUID, etc. */ - m = archive_entry_mode(entry); - archive_entry_set_mode(entry, (m & ~07777) | 0744); - - /* Copy input entries to output archive. */ - if (archive_write_header(outa, entry) != ARCHIVE_OK) - die("Error writing output archive"); - if (archive_entry_size(entry) > 0) { - len = archive_read_data(ina, buff, sizeof(buff)); - while (len > 0) { - if (archive_write_data(outa, buff, len) != len) - die("Error writing output archive"); - len = archive_read_data(ina, buff, sizeof(buff)); - } - if (len < 0) - die("Error reading input archive"); - } - fprintf(stderr, "copied\n"); - } - if (r != ARCHIVE_EOF) - die("Error reading archive"); - /* Close the archives. */ - if (archive_read_finish(ina) != ARCHIVE_OK) - die("Error closing input archive"); - if (archive_write_finish(outa) != ARCHIVE_OK) - die("Error closing output archive"); - return (0); -} diff --git a/contrib/libarchive/examples/untar.c b/contrib/libarchive/examples/untar.c deleted file mode 100644 index e77adf701257..000000000000 --- a/contrib/libarchive/examples/untar.c +++ /dev/null @@ -1,262 +0,0 @@ -/* - * This file is in the public domain. - * Use it as you wish. - */ - -/* - * This is a compact tar extraction program using libarchive whose - * primary goal is small executable size. Statically linked, it can - * be very small, depending in large part on how cleanly factored your - * system libraries are. Note that this uses the standard libarchive, - * without any special recompilation. The only functional concession - * is that this program uses the uid/gid from the archive instead of - * doing uname/gname lookups. (Add a call to - * archive_write_disk_set_standard_lookup() to enable uname/gname - * lookups, but be aware that this can add 500k or more to a static - * executable, depending on the system libraries, since user/group - * lookups frequently pull in password, YP/LDAP, networking, and DNS - * resolver libraries.) - * - * To build: - * $ gcc -static -Wall -o untar untar.c -larchive - * $ strip untar - * - * NOTE: On some systems, you may need to add additional flags - * to ensure that untar.c is compiled the same way as libarchive - * was compiled. In particular, Linux users will probably - * have to add -D_FILE_OFFSET_BITS=64 to the command line above. - * - * For fun, statically compile the following simple hello.c program - * using the same flags as for untar and compare the size: - * - * #include - * int main(int argc, char **argv) { - * printf("hello, world\n"); - * return(0); - * } - * - * You may be even more surprised by the compiled size of true.c listed here: - * - * int main(int argc, char **argv) { - * return (0); - * } - * - * On a slightly customized FreeBSD 5 system that I used around - * 2005, hello above compiled to 89k compared to untar of 69k. So at - * that time, libarchive's tar reader and extract-to-disk routines - * compiled to less code than printf(). - * - * On my FreeBSD development system today (August, 2009): - * hello: 195024 bytes - * true: 194912 bytes - * untar: 259924 bytes - */ - -#include -__FBSDID("$FreeBSD$"); - -#include - -#include -#include -#include -#include -#include -#include -#include - -static void errmsg(const char *); -static void extract(const char *filename, int do_extract, int flags); -static void fail(const char *, const char *, int); -static int copy_data(struct archive *, struct archive *); -static void msg(const char *); -static void usage(void); -static void warn(const char *, const char *); - -static int verbose = 0; - -int -main(int argc, const char **argv) -{ - const char *filename = NULL; - int compress, flags, mode, opt; - - (void)argc; - mode = 'x'; - verbose = 0; - compress = '\0'; - flags = ARCHIVE_EXTRACT_TIME; - - /* Among other sins, getopt(3) pulls in printf(3). */ - while (*++argv != NULL && **argv == '-') { - const char *p = *argv + 1; - - while ((opt = *p++) != '\0') { - switch (opt) { - case 'f': - if (*p != '\0') - filename = p; - else - filename = *++argv; - p += strlen(p); - break; - case 'p': - flags |= ARCHIVE_EXTRACT_PERM; - flags |= ARCHIVE_EXTRACT_ACL; - flags |= ARCHIVE_EXTRACT_FFLAGS; - break; - case 't': - mode = opt; - break; - case 'v': - verbose++; - break; - case 'x': - mode = opt; - break; - default: - usage(); - } - } - } - - switch (mode) { - case 't': - extract(filename, 0, flags); - break; - case 'x': - extract(filename, 1, flags); - break; - } - - return (0); -} - - -static void -extract(const char *filename, int do_extract, int flags) -{ - struct archive *a; - struct archive *ext; - struct archive_entry *entry; - int r; - - a = archive_read_new(); - ext = archive_write_disk_new(); - archive_write_disk_set_options(ext, flags); - /* - * Note: archive_write_disk_set_standard_lookup() is useful - * here, but it requires library routines that can add 500k or - * more to a static executable. - */ - archive_read_support_format_tar(a); - /* - * On my system, enabling other archive formats adds 20k-30k - * each. Enabling gzip decompression adds about 20k. - * Enabling bzip2 is more expensive because the libbz2 library - * isn't very well factored. - */ - if (filename != NULL && strcmp(filename, "-") == 0) - filename = NULL; - if ((r = archive_read_open_file(a, filename, 10240))) - fail("archive_read_open_file()", - archive_error_string(a), r); - for (;;) { - r = archive_read_next_header(a, &entry); - if (r == ARCHIVE_EOF) - break; - if (r != ARCHIVE_OK) - fail("archive_read_next_header()", - archive_error_string(a), 1); - if (verbose && do_extract) - msg("x "); - if (verbose || !do_extract) - msg(archive_entry_pathname(entry)); - if (do_extract) { - r = archive_write_header(ext, entry); - if (r != ARCHIVE_OK) - warn("archive_write_header()", - archive_error_string(ext)); - else { - copy_data(a, ext); - r = archive_write_finish_entry(ext); - if (r != ARCHIVE_OK) - fail("archive_write_finish_entry()", - archive_error_string(ext), 1); - } - - } - if (verbose || !do_extract) - msg("\n"); - } - archive_read_close(a); - archive_read_finish(a); - exit(0); -} - -static int -copy_data(struct archive *ar, struct archive *aw) -{ - int r; - const void *buff; - size_t size; - off_t offset; - - for (;;) { - r = archive_read_data_block(ar, &buff, &size, &offset); - if (r == ARCHIVE_EOF) - return (ARCHIVE_OK); - if (r != ARCHIVE_OK) - return (r); - r = archive_write_data_block(aw, buff, size, offset); - if (r != ARCHIVE_OK) { - warn("archive_write_data_block()", - archive_error_string(aw)); - return (r); - } - } -} - -/* - * These reporting functions use low-level I/O; on some systems, this - * is a significant code reduction. Of course, on many server and - * desktop operating systems, malloc() and even crt rely on printf(), - * which in turn pulls in most of the rest of stdio, so this is not an - * optimization at all there. (If you're going to pay 100k or more - * for printf() anyway, you may as well use it!) - */ -static void -msg(const char *m) -{ - write(1, m, strlen(m)); -} - -static void -errmsg(const char *m) -{ - write(2, m, strlen(m)); -} - -static void -warn(const char *f, const char *m) -{ - errmsg(f); - errmsg(" failed: "); - errmsg(m); - errmsg("\n"); -} - -static void -fail(const char *f, const char *m, int r) -{ - warn(f, m); - exit(r); -} - -static void -usage(void) -{ - const char *m = "Usage: untar [-tvx] [-f file] [file]\n"; - errmsg(m); - exit(1); -} diff --git a/contrib/libarchive/libarchive/CMakeLists.txt b/contrib/libarchive/libarchive/CMakeLists.txt deleted file mode 100644 index 459a5ddbb903..000000000000 --- a/contrib/libarchive/libarchive/CMakeLists.txt +++ /dev/null @@ -1,139 +0,0 @@ - -############################################ -# -# How to build libarchive -# -############################################ - -# Public headers -SET(include_HEADERS - archive.h - archive_entry.h -) - -# Sources and private headers -SET(libarchive_SOURCES - archive_check_magic.c - archive_endian.h - archive_entry.c - archive_entry.h - archive_entry_copy_stat.c - archive_entry_link_resolver.c - archive_entry_private.h - archive_entry_stat.c - archive_entry_strmode.c - archive_entry_xattr.c - archive_hash.h - archive_platform.h - archive_private.h - archive_read.c - archive_read_data_into_fd.c - archive_read_disk.c - archive_read_disk_entry_from_file.c - archive_read_disk_private.h - archive_read_disk_set_standard_lookup.c - archive_read_extract.c - archive_read_open_fd.c - archive_read_open_file.c - archive_read_open_filename.c - archive_read_open_memory.c - archive_read_private.h - archive_read_support_compression_all.c - archive_read_support_compression_bzip2.c - archive_read_support_compression_compress.c - archive_read_support_compression_gzip.c - archive_read_support_compression_none.c - archive_read_support_compression_program.c - archive_read_support_compression_rpm.c - archive_read_support_compression_uu.c - archive_read_support_compression_xz.c - archive_read_support_format_all.c - archive_read_support_format_ar.c - archive_read_support_format_cpio.c - archive_read_support_format_empty.c - archive_read_support_format_iso9660.c - archive_read_support_format_mtree.c - archive_read_support_format_raw.c - archive_read_support_format_tar.c - archive_read_support_format_xar.c - archive_read_support_format_zip.c - archive_string.c - archive_string.h - archive_string_sprintf.c - archive_util.c - archive_virtual.c - archive_write.c - archive_write_disk.c - archive_write_disk_private.h - archive_write_disk_set_standard_lookup.c - archive_write_private.h - archive_write_open_fd.c - archive_write_open_file.c - archive_write_open_filename.c - archive_write_open_memory.c - archive_write_set_compression_bzip2.c - archive_write_set_compression_compress.c - archive_write_set_compression_gzip.c - archive_write_set_compression_none.c - archive_write_set_compression_program.c - archive_write_set_compression_xz.c - archive_write_set_format.c - archive_write_set_format_ar.c - archive_write_set_format_by_name.c - archive_write_set_format_cpio.c - archive_write_set_format_cpio_newc.c - archive_write_set_format_mtree.c - archive_write_set_format_pax.c - archive_write_set_format_shar.c - archive_write_set_format_ustar.c - archive_write_set_format_zip.c - filter_fork.c - filter_fork.h -) - -# Man pages -SET(libarchive_MANS - archive_entry.3 - archive_read.3 - archive_read_disk.3 - archive_util.3 - archive_write.3 - archive_write_disk.3 - cpio.5 - libarchive.3 - libarchive_internals.3 - libarchive-formats.5 - mtree.5 - tar.5 -) - -IF(WIN32 AND NOT CYGWIN) - LIST(APPEND libarchive_SOURCES archive_entry_copy_bhfi.c) - LIST(APPEND libarchive_SOURCES archive_windows.c) - LIST(APPEND libarchive_SOURCES archive_windows.h) - LIST(APPEND libarchive_SOURCES filter_fork_windows.c) -ENDIF(WIN32 AND NOT CYGWIN) - -# Libarchive is a shared library -ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS}) -TARGET_LINK_LIBRARIES(archive ${ADDITIONAL_LIBS}) -SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION}) - -# archive_static is a static library -ADD_LIBRARY(archive_static STATIC ${libarchive_SOURCES} ${include_HEADERS}) -SET_TARGET_PROPERTIES(archive_static PROPERTIES COMPILE_DEFINITIONS - LIBARCHIVE_STATIC) -# On Posix systems, libarchive.so and libarchive.a can co-exist. -IF(NOT WIN32 OR CYGWIN) - SET_TARGET_PROPERTIES(archive_static PROPERTIES OUTPUT_NAME archive) -ENDIF(NOT WIN32 OR CYGWIN) - -# How to install the libraries -INSTALL(TARGETS archive archive_static - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) -INSTALL_MAN(${libarchive_MANS}) -INSTALL(FILES ${include_HEADERS} DESTINATION include) - -add_subdirectory(test) diff --git a/contrib/libarchive/libarchive/archive_windows.c b/contrib/libarchive/libarchive/archive_windows.c deleted file mode 100644 index d9f29b72aff5..000000000000 --- a/contrib/libarchive/libarchive/archive_windows.c +++ /dev/null @@ -1,1236 +0,0 @@ -/*- - * Copyright (c) 2009 Michihiro NAKAJIMA - * Copyright (c) 2003-2007 Kees Zeelenberg - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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. - * - * $FreeBSD$ - */ - -/* - * A set of compatibility glue for building libarchive on Windows platforms. - * - * Originally created as "libarchive-nonposix.c" by Kees Zeelenberg - * for the GnuWin32 project, trimmed significantly by Tim Kientzle. - * - * Much of the original file was unnecessary for libarchive, because - * many of the features it emulated were not strictly necessary for - * libarchive. I hope for this to shrink further as libarchive - * internals are gradually reworked to sit more naturally on both - * POSIX and Windows. Any ideas for this are greatly appreciated. - * - * The biggest remaining issue is the dev/ino emulation; libarchive - * has a couple of public APIs that rely on dev/ino uniquely - * identifying a file. This doesn't match well with Windows. I'm - * considering alternative APIs. - */ - -#if defined(_WIN32) && !defined(__CYGWIN__) - -#include "archive_platform.h" -#include "archive_private.h" -#include "archive_hash.h" -#include -#include -#include -#ifdef HAVE_SYS_UTIME_H -#include -#endif -#include -#include -#include -#include -#include - -#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000) - -#if defined(_MSC_VER) && _MSC_VER < 1300 -/* VS 6 does not provide SetFilePointerEx, so define it here. */ -static BOOL SetFilePointerEx(HANDLE hFile, - LARGE_INTEGER liDistanceToMove, - PLARGE_INTEGER lpNewFilePointer, - DWORD dwMoveMethod) -{ - LARGE_INTEGER li; - li.QuadPart = liDistanceToMove.QuadPart; - li.LowPart = SetFilePointer( - hFile, li.LowPart, &li.HighPart, dwMoveMethod); - if(lpNewFilePointer) { - lpNewFilePointer->QuadPart = li.QuadPart; - } - return li.LowPart != -1 || GetLastError() == NO_ERROR; -} -#endif - -struct ustat { - int64_t st_atime; - uint32_t st_atime_nsec; - int64_t st_ctime; - uint32_t st_ctime_nsec; - int64_t st_mtime; - uint32_t st_mtime_nsec; - gid_t st_gid; - /* 64bits ino */ - int64_t st_ino; - mode_t st_mode; - uint32_t st_nlink; - uint64_t st_size; - uid_t st_uid; - dev_t st_dev; - dev_t st_rdev; -}; - -/* Local replacement for undocumented Windows CRT function. */ -static void la_dosmaperr(unsigned long e); - -/* Transform 64-bits ino into 32-bits by hashing. - * You do not forget that really unique number size is 64-bits. - */ -#define INOSIZE (8*sizeof(ino_t)) /* 32 */ -static __inline ino_t -getino(struct ustat *ub) -{ - ULARGE_INTEGER ino64; - ino64.QuadPart = ub->st_ino; - /* I don't know this hashing is correct way */ - return (ino64.LowPart ^ (ino64.LowPart >> INOSIZE)); -} - -/* - * Prepend "\\?\" to the path name and convert it to unicode to permit - * an extended-length path for a maximum total path length of 32767 - * characters. - * see also http://msdn.microsoft.com/en-us/library/aa365247.aspx - */ -static wchar_t * -permissive_name(const char *name) -{ - wchar_t *wn, *wnp; - wchar_t *ws, *wsp; - DWORD l, len, slen; - int unc; - - len = (DWORD)strlen(name); - wn = malloc((len + 1) * sizeof(wchar_t)); - if (wn == NULL) - return (NULL); - l = MultiByteToWideChar(CP_ACP, 0, name, (int)len, wn, (int)len); - if (l == 0) { - free(wn); - return (NULL); - } - wn[l] = L'\0'; - - /* Get a full path names */ - l = GetFullPathNameW(wn, 0, NULL, NULL); - if (l == 0) { - free(wn); - return (NULL); - } - wnp = malloc(l * sizeof(wchar_t)); - if (wnp == NULL) { - free(wn); - return (NULL); - } - len = GetFullPathNameW(wn, l, wnp, NULL); - free(wn); - wn = wnp; - - if (wnp[0] == L'\\' && wnp[1] == L'\\' && - wnp[2] == L'?' && wnp[3] == L'\\') - /* We have already permissive names. */ - return (wn); - - if (wnp[0] == L'\\' && wnp[1] == L'\\' && - wnp[2] == L'.' && wnp[3] == L'\\') { - /* Device names */ - if (((wnp[4] >= L'a' && wnp[4] <= L'z') || - (wnp[4] >= L'A' && wnp[4] <= L'Z')) && - wnp[5] == L':' && wnp[6] == L'\\') - wnp[2] = L'?';/* Not device names. */ - return (wn); - } - - unc = 0; - if (wnp[0] == L'\\' && wnp[1] == L'\\' && wnp[2] != L'\\') { - wchar_t *p = &wnp[2]; - - /* Skip server-name letters. */ - while (*p != L'\\' && *p != L'\0') - ++p; - if (*p == L'\\') { - wchar_t *rp = ++p; - /* Skip share-name letters. */ - while (*p != L'\\' && *p != L'\0') - ++p; - if (*p == L'\\' && p != rp) { - /* Now, match patterns such as - * "\\server-name\share-name\" */ - wnp += 2; - len -= 2; - unc = 1; - } - } - } - - slen = 4 + (unc * 4) + len + 1; - ws = wsp = malloc(slen * sizeof(wchar_t)); - if (ws == NULL) { - free(wn); - return (NULL); - } - /* prepend "\\?\" */ - wcsncpy(wsp, L"\\\\?\\", 4); - wsp += 4; - slen -= 4; - if (unc) { - /* append "UNC\" ---> "\\?\UNC\" */ - wcsncpy(wsp, L"UNC\\", 4); - wsp += 4; - slen -= 4; - } - wcsncpy(wsp, wnp, slen); - wsp[slen - 1] = L'\0'; /* Ensure null termination. */ - free(wn); - return (ws); -} - -static HANDLE -la_CreateFile(const char *path, DWORD dwDesiredAccess, DWORD dwShareMode, - LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, - DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) -{ - wchar_t *wpath; - HANDLE handle; - - handle = CreateFileA(path, dwDesiredAccess, dwShareMode, - lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, - hTemplateFile); - if (handle != INVALID_HANDLE_VALUE) - return (handle); - if (GetLastError() != ERROR_PATH_NOT_FOUND) - return (handle); - wpath = permissive_name(path); - if (wpath == NULL) - return (handle); - handle = CreateFileW(wpath, dwDesiredAccess, dwShareMode, - lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, - hTemplateFile); - free(wpath); - return (handle); -} - -static void * -la_GetFunctionKernel32(const char *name) -{ - static HINSTANCE lib; - static int set; - if (!set) { - set = 1; - lib = LoadLibrary("kernel32.dll"); - } - if (lib == NULL) { - fprintf(stderr, "Can't load kernel32.dll?!\n"); - exit(1); - } - return (void *)GetProcAddress(lib, name); -} - -static int -la_CreateHardLinkW(wchar_t *linkname, wchar_t *target) -{ - static BOOLEAN (WINAPI *f)(LPWSTR, LPWSTR, LPSECURITY_ATTRIBUTES); - static int set; - if (!set) { - set = 1; - f = la_GetFunctionKernel32("CreateHardLinkW"); - } - return f == NULL ? 0 : (*f)(linkname, target, NULL); -} - - -/* Make a link to src called dst. */ -static int -__link(const char *src, const char *dst) -{ - wchar_t *wsrc, *wdst; - int res, retval; - DWORD attr; - - if (src == NULL || dst == NULL) { - set_errno (EINVAL); - return -1; - } - - wsrc = permissive_name(src); - wdst = permissive_name(dst); - if (wsrc == NULL || wdst == NULL) { - free(wsrc); - free(wdst); - set_errno (EINVAL); - return -1; - } - - if ((attr = GetFileAttributesW(wsrc)) != (DWORD)-1) { - res = la_CreateHardLinkW(wdst, wsrc); - } else { - /* wsrc does not exist; try src prepend it with the dirname of wdst */ - wchar_t *wnewsrc, *slash; - int i, n, slen, wlen; - - if (strlen(src) >= 3 && isalpha((unsigned char)src[0]) && - src[1] == ':' && src[2] == '\\') { - /* Original src name is already full-path */ - retval = -1; - goto exit; - } - if (src[0] == '\\') { - /* Original src name is almost full-path - * (maybe src name is without drive) */ - retval = -1; - goto exit; - } - - wnewsrc = malloc ((wcslen(wsrc) + wcslen(wdst) + 1) * sizeof(wchar_t)); - if (wnewsrc == NULL) { - errno = ENOMEM; - retval = -1; - goto exit; - } - /* Copying a dirname of wdst */ - wcscpy(wnewsrc, wdst); - slash = wcsrchr(wnewsrc, L'\\'); - if (slash != NULL) - *++slash = L'\0'; - else - wcscat(wnewsrc, L"\\"); - /* Converting multi-byte src to wide-char src */ - wlen = (int)wcslen(wsrc); - slen = (int)strlen(src); - n = MultiByteToWideChar(CP_ACP, 0, src, slen, wsrc, wlen); - if (n == 0) { - free (wnewsrc); - retval = -1; - goto exit; - } - for (i = 0; i < n; i++) - if (wsrc[i] == L'/') - wsrc[i] = L'\\'; - wcsncat(wnewsrc, wsrc, n); - /* Check again */ - attr = GetFileAttributesW(wnewsrc); - if (attr == (DWORD)-1 || (attr & FILE_ATTRIBUTE_DIRECTORY) != 0) { - if (attr == (DWORD)-1) - la_dosmaperr(GetLastError()); - else - errno = EPERM; - free (wnewsrc); - retval = -1; - goto exit; - } - res = la_CreateHardLinkW(wdst, wnewsrc); - free (wnewsrc); - } - if (res == 0) { - la_dosmaperr(GetLastError()); - retval = -1; - } else - retval = 0; -exit: - free(wsrc); - free(wdst); - return (retval); -} - -/* Make a hard link to src called dst. */ -int -__la_link(const char *src, const char *dst) -{ - return __link(src, dst); -} - -int -__la_ftruncate(int fd, off_t length) -{ - LARGE_INTEGER distance; - HANDLE handle; - - if (fd < 0) { - errno = EBADF; - return (-1); - } - handle = (HANDLE)_get_osfhandle(fd); - if (GetFileType(handle) != FILE_TYPE_DISK) { - errno = EBADF; - return (-1); - } - distance.QuadPart = length; - if (!SetFilePointerEx(handle, distance, NULL, FILE_BEGIN)) { - la_dosmaperr(GetLastError()); - return (-1); - } - if (!SetEndOfFile(handle)) { - la_dosmaperr(GetLastError()); - return (-1); - } - return (0); -} - -#define WINTIME(sec, usec) ((Int32x32To64(sec, 10000000) + EPOC_TIME) + (usec * 10)) -static int -__hutimes(HANDLE handle, const struct __timeval *times) -{ - ULARGE_INTEGER wintm; - FILETIME fatime, fmtime; - - wintm.QuadPart = WINTIME(times[0].tv_sec, times[0].tv_usec); - fatime.dwLowDateTime = wintm.LowPart; - fatime.dwHighDateTime = wintm.HighPart; - wintm.QuadPart = WINTIME(times[1].tv_sec, times[1].tv_usec); - fmtime.dwLowDateTime = wintm.LowPart; - fmtime.dwHighDateTime = wintm.HighPart; - if (SetFileTime(handle, NULL, &fatime, &fmtime) == 0) { - errno = EINVAL; - return (-1); - } - return (0); -} - -int -__la_futimes(int fd, const struct __timeval *times) -{ - - return (__hutimes((HANDLE)_get_osfhandle(fd), times)); -} - -int -__la_utimes(const char *name, const struct __timeval *times) -{ - int ret; - HANDLE handle; - - handle = la_CreateFile(name, GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS, NULL); - if (handle == INVALID_HANDLE_VALUE) { - la_dosmaperr(GetLastError()); - return (-1); - } - ret = __hutimes(handle, times); - CloseHandle(handle); - return (ret); -} - -int -__la_chdir(const char *path) -{ - wchar_t *ws; - int r; - - r = SetCurrentDirectoryA(path); - if (r == 0) { - if (GetLastError() != ERROR_FILE_NOT_FOUND) { - la_dosmaperr(GetLastError()); - return (-1); - } - } else - return (0); - ws = permissive_name(path); - if (ws == NULL) { - errno = EINVAL; - return (-1); - } - r = SetCurrentDirectoryW(ws); - free(ws); - if (r == 0) { - la_dosmaperr(GetLastError()); - return (-1); - } - return (0); -} - -int -__la_chmod(const char *path, mode_t mode) -{ - wchar_t *ws; - DWORD attr; - BOOL r; - - ws = NULL; - attr = GetFileAttributesA(path); - if (attr == (DWORD)-1) { - if (GetLastError() != ERROR_FILE_NOT_FOUND) { - la_dosmaperr(GetLastError()); - return (-1); - } - ws = permissive_name(path); - if (ws == NULL) { - errno = EINVAL; - return (-1); - } - attr = GetFileAttributesW(ws); - if (attr == (DWORD)-1) { - free(ws); - la_dosmaperr(GetLastError()); - return (-1); - } - } - if (mode & _S_IWRITE) - attr &= ~FILE_ATTRIBUTE_READONLY; - else - attr |= FILE_ATTRIBUTE_READONLY; - if (ws == NULL) - r = SetFileAttributesA(path, attr); - else { - r = SetFileAttributesW(ws, attr); - free(ws); - } - if (r == 0) { - la_dosmaperr(GetLastError()); - return (-1); - } - return (0); -} - -/* - * This fcntl is limited implemention. - */ -int -__la_fcntl(int fd, int cmd, int val) -{ - HANDLE handle; - - handle = (HANDLE)_get_osfhandle(fd); - if (GetFileType(handle) == FILE_TYPE_PIPE) { - if (cmd == F_SETFL && val == 0) { - DWORD mode = PIPE_WAIT; - if (SetNamedPipeHandleState( - handle, &mode, NULL, NULL) != 0) - return (0); - } - } - errno = EINVAL; - return (-1); -} - -__int64 -__la_lseek(int fd, __int64 offset, int whence) -{ - LARGE_INTEGER distance; - LARGE_INTEGER newpointer; - HANDLE handle; - - if (fd < 0) { - errno = EBADF; - return (-1); - } - handle = (HANDLE)_get_osfhandle(fd); - if (GetFileType(handle) != FILE_TYPE_DISK) { - errno = EBADF; - return (-1); - } - distance.QuadPart = offset; - if (!SetFilePointerEx(handle, distance, &newpointer, whence)) { - DWORD lasterr; - - lasterr = GetLastError(); - if (lasterr == ERROR_BROKEN_PIPE) - return (0); - if (lasterr == ERROR_ACCESS_DENIED) - errno = EBADF; - else - la_dosmaperr(lasterr); - return (-1); - } - return (newpointer.QuadPart); -} - -int -__la_mkdir(const char *path, mode_t mode) -{ - wchar_t *ws; - int r; - - (void)mode;/* UNUSED */ - r = CreateDirectoryA(path, NULL); - if (r == 0) { - DWORD lasterr = GetLastError(); - if (lasterr != ERROR_FILENAME_EXCED_RANGE && - lasterr != ERROR_PATH_NOT_FOUND) { - la_dosmaperr(GetLastError()); - return (-1); - } - } else - return (0); - ws = permissive_name(path); - if (ws == NULL) { - errno = EINVAL; - return (-1); - } - r = CreateDirectoryW(ws, NULL); - free(ws); - if (r == 0) { - la_dosmaperr(GetLastError()); - return (-1); - } - return (0); -} - -/* Windows' mbstowcs is differrent error handling from other unix mbstowcs. - * That one is using MultiByteToWideChar function with MB_PRECOMPOSED and - * MB_ERR_INVALID_CHARS flags. - * This implements for only to pass libarchive_test. - */ -size_t -__la_mbstowcs(wchar_t *wcstr, const char *mbstr, size_t nwchars) -{ - - return (MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS, - mbstr, (int)strlen(mbstr), wcstr, - (int)nwchars)); -} - -int -__la_open(const char *path, int flags, ...) -{ - va_list ap; - wchar_t *ws; - int r, pmode; - DWORD attr; - - va_start(ap, flags); - pmode = va_arg(ap, int); - va_end(ap); - ws = NULL; - if ((flags & ~O_BINARY) == O_RDONLY) { - /* - * When we open a directory, _open function returns - * "Permission denied" error. - */ - attr = GetFileAttributesA(path); - if (attr == (DWORD)-1 && GetLastError() == ERROR_PATH_NOT_FOUND) { - ws = permissive_name(path); - if (ws == NULL) { - errno = EINVAL; - return (-1); - } - attr = GetFileAttributesW(ws); - } - if (attr == (DWORD)-1) { - la_dosmaperr(GetLastError()); - free(ws); - return (-1); - } - if (attr & FILE_ATTRIBUTE_DIRECTORY) { - HANDLE handle; - - if (ws != NULL) - handle = CreateFileW(ws, 0, 0, NULL, - OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS | - FILE_ATTRIBUTE_READONLY, - NULL); - else - handle = CreateFileA(path, 0, 0, NULL, - OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS | - FILE_ATTRIBUTE_READONLY, - NULL); - free(ws); - if (handle == INVALID_HANDLE_VALUE) { - la_dosmaperr(GetLastError()); - return (-1); - } - r = _open_osfhandle((intptr_t)handle, _O_RDONLY); - return (r); - } - } - if (ws == NULL) { -#if defined(__BORLANDC__) - /* Borland has no mode argument. - TODO: Fix mode of new file. */ - r = _open(path, flags); -#else - r = _open(path, flags, pmode); -#endif - if (r < 0 && errno == EACCES && (flags & O_CREAT) != 0) { - /* simular other POSIX system action to pass a test */ - attr = GetFileAttributesA(path); - if (attr == (DWORD)-1) - la_dosmaperr(GetLastError()); - else if (attr & FILE_ATTRIBUTE_DIRECTORY) - errno = EISDIR; - else - errno = EACCES; - return (-1); - } - if (r >= 0 || errno != ENOENT) - return (r); - ws = permissive_name(path); - if (ws == NULL) { - errno = EINVAL; - return (-1); - } - } - r = _wopen(ws, flags, pmode); - if (r < 0 && errno == EACCES && (flags & O_CREAT) != 0) { - /* simular other POSIX system action to pass a test */ - attr = GetFileAttributesW(ws); - if (attr == (DWORD)-1) - la_dosmaperr(GetLastError()); - else if (attr & FILE_ATTRIBUTE_DIRECTORY) - errno = EISDIR; - else - errno = EACCES; - } - free(ws); - return (r); -} - -ssize_t -__la_read(int fd, void *buf, size_t nbytes) -{ - HANDLE handle; - DWORD bytes_read, lasterr; - int r; - -#ifdef _WIN64 - if (nbytes > UINT32_MAX) - nbytes = UINT32_MAX; -#endif - if (fd < 0) { - errno = EBADF; - return (-1); - } - handle = (HANDLE)_get_osfhandle(fd); - if (GetFileType(handle) == FILE_TYPE_PIPE) { - DWORD sta; - if (GetNamedPipeHandleState( - handle, &sta, NULL, NULL, NULL, NULL, 0) != 0 && - (sta & PIPE_NOWAIT) == 0) { - DWORD avail = -1; - int cnt = 3; - - while (PeekNamedPipe( - handle, NULL, 0, NULL, &avail, NULL) != 0 && - avail == 0 && --cnt) - Sleep(100); - if (avail == 0) - return (0); - } - } - r = ReadFile(handle, buf, (uint32_t)nbytes, - &bytes_read, NULL); - if (r == 0) { - lasterr = GetLastError(); - if (lasterr == ERROR_NO_DATA) { - errno = EAGAIN; - return (-1); - } - if (lasterr == ERROR_BROKEN_PIPE) - return (0); - if (lasterr == ERROR_ACCESS_DENIED) - errno = EBADF; - else - la_dosmaperr(lasterr); - return (-1); - } - return ((ssize_t)bytes_read); -} - -/* Remove directory */ -int -__la_rmdir(const char *path) -{ - wchar_t *ws; - int r; - - r = _rmdir(path); - if (r >= 0 || errno != ENOENT) - return (r); - ws = permissive_name(path); - if (ws == NULL) { - errno = EINVAL; - return (-1); - } - r = _wrmdir(ws); - free(ws); - return (r); -} - -/* Convert Windows FILETIME to UTC */ -__inline static void -fileTimeToUTC(const FILETIME *filetime, time_t *time, long *ns) -{ - ULARGE_INTEGER utc; - - utc.HighPart = filetime->dwHighDateTime; - utc.LowPart = filetime->dwLowDateTime; - if (utc.QuadPart >= EPOC_TIME) { - utc.QuadPart -= EPOC_TIME; - *time = (time_t)(utc.QuadPart / 10000000); /* milli seconds base */ - *ns = (long)(utc.QuadPart % 10000000) * 100;/* nano seconds base */ - } else { - *time = 0; - *ns = 0; - } -} - -/* Stat by handle - * Windows' stat() does not accept path which is added "\\?\" especially "?" - * character. - * It means we cannot access a long name path(which is longer than MAX_PATH). - * So I've implemented simular Windows' stat() to access the long name path. - * And I've added some feature. - * 1. set st_ino by nFileIndexHigh and nFileIndexLow of - * BY_HANDLE_FILE_INFORMATION. - * 2. set st_nlink by nNumberOfLinks of BY_HANDLE_FILE_INFORMATION. - * 3. set st_dev by dwVolumeSerialNumber by BY_HANDLE_FILE_INFORMATION. - */ -static int -__hstat(HANDLE handle, struct ustat *st) -{ - BY_HANDLE_FILE_INFORMATION info; - ULARGE_INTEGER ino64; - DWORD ftype; - mode_t mode; - time_t time; - long ns; - - switch (ftype = GetFileType(handle)) { - case FILE_TYPE_UNKNOWN: - errno = EBADF; - return (-1); - case FILE_TYPE_CHAR: - case FILE_TYPE_PIPE: - if (ftype == FILE_TYPE_CHAR) { - st->st_mode = S_IFCHR; - st->st_size = 0; - } else { - DWORD avail; - - st->st_mode = S_IFIFO; - if (PeekNamedPipe(handle, NULL, 0, NULL, &avail, NULL)) - st->st_size = avail; - else - st->st_size = 0; - } - st->st_atime = 0; - st->st_atime_nsec = 0; - st->st_mtime = 0; - st->st_mtime_nsec = 0; - st->st_ctime = 0; - st->st_ctime_nsec = 0; - st->st_ino = 0; - st->st_nlink = 1; - st->st_uid = 0; - st->st_gid = 0; - st->st_rdev = 0; - st->st_dev = 0; - return (0); - case FILE_TYPE_DISK: - break; - default: - /* This ftype is undocumented type. */ - la_dosmaperr(GetLastError()); - return (-1); - } - - ZeroMemory(&info, sizeof(info)); - if (!GetFileInformationByHandle (handle, &info)) { - la_dosmaperr(GetLastError()); - return (-1); - } - - mode = S_IRUSR | S_IRGRP | S_IROTH; - if ((info.dwFileAttributes & FILE_ATTRIBUTE_READONLY) == 0) - mode |= S_IWUSR | S_IWGRP | S_IWOTH; - if (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - mode |= S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH; - else - mode |= S_IFREG; - st->st_mode = mode; - - fileTimeToUTC(&info.ftLastAccessTime, &time, &ns); - st->st_atime = time; - st->st_atime_nsec = ns; - fileTimeToUTC(&info.ftLastWriteTime, &time, &ns); - st->st_mtime = time; - st->st_mtime_nsec = ns; - fileTimeToUTC(&info.ftCreationTime, &time, &ns); - st->st_ctime = time; - st->st_ctime_nsec = ns; - st->st_size = - ((int64_t)(info.nFileSizeHigh) * ((int64_t)MAXDWORD + 1)) - + (int64_t)(info.nFileSizeLow); -#ifdef SIMULATE_WIN_STAT - st->st_ino = 0; - st->st_nlink = 1; - st->st_dev = 0; -#else - /* Getting FileIndex as i-node. We have to remove a sequence which - * is high-16-bits of nFileIndexHigh. */ - ino64.HighPart = info.nFileIndexHigh & 0x0000FFFFUL; - ino64.LowPart = info.nFileIndexLow; - st->st_ino = ino64.QuadPart; - st->st_nlink = info.nNumberOfLinks; - if (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - ++st->st_nlink;/* Add parent directory. */ - st->st_dev = info.dwVolumeSerialNumber; -#endif - st->st_uid = 0; - st->st_gid = 0; - st->st_rdev = 0; - return (0); -} - -static void -copy_stat(struct stat *st, struct ustat *us) -{ - st->st_atime = us->st_atime; - st->st_ctime = us->st_ctime; - st->st_mtime = us->st_mtime; - st->st_gid = us->st_gid; - st->st_ino = getino(us); - st->st_mode = us->st_mode; - st->st_nlink = us->st_nlink; - st->st_size = us->st_size; - st->st_uid = us->st_uid; - st->st_dev = us->st_dev; - st->st_rdev = us->st_rdev; -} - -int -__la_fstat(int fd, struct stat *st) -{ - struct ustat u; - int ret; - - if (fd < 0) { - errno = EBADF; - return (-1); - } - ret = __hstat((HANDLE)_get_osfhandle(fd), &u); - if (ret >= 0) { - copy_stat(st, &u); - if (u.st_mode & (S_IFCHR | S_IFIFO)) { - st->st_dev = fd; - st->st_rdev = fd; - } - } - return (ret); -} - -int -__la_stat(const char *path, struct stat *st) -{ - HANDLE handle; - struct ustat u; - int ret; - - handle = la_CreateFile(path, 0, 0, NULL, OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS | FILE_ATTRIBUTE_READONLY, - NULL); - if (handle == INVALID_HANDLE_VALUE) { - la_dosmaperr(GetLastError()); - return (-1); - } - ret = __hstat(handle, &u); - CloseHandle(handle); - if (ret >= 0) { - char *p; - - copy_stat(st, &u); - p = strrchr(path, '.'); - if (p != NULL && strlen(p) == 4) { - char exttype[4]; - - ++ p; - exttype[0] = toupper(*p++); - exttype[1] = toupper(*p++); - exttype[2] = toupper(*p++); - exttype[3] = '\0'; - if (!strcmp(exttype, "EXE") || !strcmp(exttype, "CMD") || - !strcmp(exttype, "BAT") || !strcmp(exttype, "COM")) - st->st_mode |= S_IXUSR | S_IXGRP | S_IXOTH; - } - } - return (ret); -} - -int -__la_unlink(const char *path) -{ - wchar_t *ws; - int r; - - r = _unlink(path); - if (r >= 0 || errno != ENOENT) - return (r); - ws = permissive_name(path); - if (ws == NULL) { - errno = EINVAL; - return (-1); - } - r = _wunlink(ws); - free(ws); - return (r); -} - -/* - * This waitpid is limited implemention. - */ -pid_t -__la_waitpid(pid_t wpid, int *status, int option) -{ - HANDLE child; - DWORD cs, ret; - - (void)option;/* UNUSED */ - child = OpenProcess(PROCESS_QUERY_INFORMATION | SYNCHRONIZE, FALSE, wpid); - if (child == NULL) { - la_dosmaperr(GetLastError()); - return (-1); - } - ret = WaitForSingleObject(child, INFINITE); - if (ret == WAIT_FAILED) { - CloseHandle(child); - la_dosmaperr(GetLastError()); - return (-1); - } - if (GetExitCodeProcess(child, &cs) == 0) { - CloseHandle(child); - la_dosmaperr(GetLastError()); - return (-1); - } - if (cs == STILL_ACTIVE) - *status = 0x100; - else - *status = (int)(cs & 0xff); - CloseHandle(child); - return (wpid); -} - -ssize_t -__la_write(int fd, const void *buf, size_t nbytes) -{ - DWORD bytes_written; - -#ifdef _WIN64 - if (nbytes > UINT32_MAX) - nbytes = UINT32_MAX; -#endif - if (fd < 0) { - errno = EBADF; - return (-1); - } - if (!WriteFile((HANDLE)_get_osfhandle(fd), buf, (uint32_t)nbytes, - &bytes_written, NULL)) { - DWORD lasterr; - - lasterr = GetLastError(); - if (lasterr == ERROR_ACCESS_DENIED) - errno = EBADF; - else - la_dosmaperr(lasterr); - return (-1); - } - return (bytes_written); -} - -/* - * The following function was modified from PostgreSQL sources and is - * subject to the copyright below. - */ -/*------------------------------------------------------------------------- - * - * win32error.c - * Map win32 error codes to errno values - * - * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group - * - * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/win32error.c,v 1.4 2008/01/01 19:46:00 momjian Exp $ - * - *------------------------------------------------------------------------- - */ -/* -PostgreSQL Database Management System -(formerly known as Postgres, then as Postgres95) - -Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group - -Portions Copyright (c) 1994, The Regents of the University of California - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose, without fee, and without a written agreement -is hereby granted, provided that the above copyright notice and this -paragraph and the following two paragraphs appear in all copies. - -IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR -DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING -LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS -DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS -ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO -PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -*/ - -static const struct { - DWORD winerr; - int doserr; -} doserrors[] = -{ - { ERROR_INVALID_FUNCTION, EINVAL }, - { ERROR_FILE_NOT_FOUND, ENOENT }, - { ERROR_PATH_NOT_FOUND, ENOENT }, - { ERROR_TOO_MANY_OPEN_FILES, EMFILE }, - { ERROR_ACCESS_DENIED, EACCES }, - { ERROR_INVALID_HANDLE, EBADF }, - { ERROR_ARENA_TRASHED, ENOMEM }, - { ERROR_NOT_ENOUGH_MEMORY, ENOMEM }, - { ERROR_INVALID_BLOCK, ENOMEM }, - { ERROR_BAD_ENVIRONMENT, E2BIG }, - { ERROR_BAD_FORMAT, ENOEXEC }, - { ERROR_INVALID_ACCESS, EINVAL }, - { ERROR_INVALID_DATA, EINVAL }, - { ERROR_INVALID_DRIVE, ENOENT }, - { ERROR_CURRENT_DIRECTORY, EACCES }, - { ERROR_NOT_SAME_DEVICE, EXDEV }, - { ERROR_NO_MORE_FILES, ENOENT }, - { ERROR_LOCK_VIOLATION, EACCES }, - { ERROR_SHARING_VIOLATION, EACCES }, - { ERROR_BAD_NETPATH, ENOENT }, - { ERROR_NETWORK_ACCESS_DENIED, EACCES }, - { ERROR_BAD_NET_NAME, ENOENT }, - { ERROR_FILE_EXISTS, EEXIST }, - { ERROR_CANNOT_MAKE, EACCES }, - { ERROR_FAIL_I24, EACCES }, - { ERROR_INVALID_PARAMETER, EINVAL }, - { ERROR_NO_PROC_SLOTS, EAGAIN }, - { ERROR_DRIVE_LOCKED, EACCES }, - { ERROR_BROKEN_PIPE, EPIPE }, - { ERROR_DISK_FULL, ENOSPC }, - { ERROR_INVALID_TARGET_HANDLE, EBADF }, - { ERROR_INVALID_HANDLE, EINVAL }, - { ERROR_WAIT_NO_CHILDREN, ECHILD }, - { ERROR_CHILD_NOT_COMPLETE, ECHILD }, - { ERROR_DIRECT_ACCESS_HANDLE, EBADF }, - { ERROR_NEGATIVE_SEEK, EINVAL }, - { ERROR_SEEK_ON_DEVICE, EACCES }, - { ERROR_DIR_NOT_EMPTY, ENOTEMPTY }, - { ERROR_NOT_LOCKED, EACCES }, - { ERROR_BAD_PATHNAME, ENOENT }, - { ERROR_MAX_THRDS_REACHED, EAGAIN }, - { ERROR_LOCK_FAILED, EACCES }, - { ERROR_ALREADY_EXISTS, EEXIST }, - { ERROR_FILENAME_EXCED_RANGE, ENOENT }, - { ERROR_NESTING_NOT_ALLOWED, EAGAIN }, - { ERROR_NOT_ENOUGH_QUOTA, ENOMEM } -}; - -static void -la_dosmaperr(unsigned long e) -{ - int i; - - if (e == 0) - { - errno = 0; - return; - } - - for (i = 0; i < sizeof(doserrors); i++) - { - if (doserrors[i].winerr == e) - { - errno = doserrors[i].doserr; - return; - } - } - - /* fprintf(stderr, "unrecognized win32 error code: %lu", e); */ - errno = EINVAL; - return; -} - -#if defined(ARCHIVE_HASH_MD5_WIN) ||\ - defined(ARCHIVE_HASH_SHA1_WIN) || defined(ARCHIVE_HASH_SHA256_WIN) ||\ - defined(ARCHIVE_HASH_SHA384_WIN) || defined(ARCHIVE_HASH_SHA512_WIN) -/* - * Message digest functions. - */ -void -__la_hash_Init(Digest_CTX *ctx, ALG_ID algId) -{ - - ctx->valid = 0; - if (!CryptAcquireContext(&ctx->cryptProv, NULL, NULL, - PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) { - if (GetLastError() != (DWORD)NTE_BAD_KEYSET) - return; - if (!CryptAcquireContext(&ctx->cryptProv, NULL, NULL, - PROV_RSA_FULL, CRYPT_NEWKEYSET)) - return; - } - - if (!CryptCreateHash(ctx->cryptProv, algId, 0, 0, &ctx->hash)) { - CryptReleaseContext(ctx->cryptProv, 0); - return; - } - - ctx->valid = 1; -} - -void -__la_hash_Update(Digest_CTX *ctx, const unsigned char *buf, size_t len) -{ - - if (!ctx->valid) - return; - - CryptHashData(ctx->hash, - (unsigned char *)(uintptr_t)buf, - (DWORD)len, 0); -} - -void -__la_hash_Final(unsigned char *buf, size_t bufsize, Digest_CTX *ctx) -{ - DWORD siglen = bufsize; - - if (!ctx->valid) - return; - - CryptGetHashParam(ctx->hash, HP_HASHVAL, buf, &siglen, 0); - CryptDestroyHash(ctx->hash); - CryptReleaseContext(ctx->cryptProv, 0); - ctx->valid = 0; -} - -#endif /* defined(ARCHIVE_HASH_*_WIN) */ - -#endif /* _WIN32 && !__CYGWIN__ */ diff --git a/contrib/libarchive/libarchive/archive_windows.h b/contrib/libarchive/libarchive/archive_windows.h deleted file mode 100644 index 86c9f4f6ba95..000000000000 --- a/contrib/libarchive/libarchive/archive_windows.h +++ /dev/null @@ -1,347 +0,0 @@ -/*- - * Copyright (c) 2009 Michihiro NAKAJIMA - * Copyright (c) 2003-2006 Tim Kientzle - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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. - * - * $FreeBSD$ - */ - -#ifndef __LIBARCHIVE_BUILD -#error This header is only to be used internally to libarchive. -#endif - -/* - * TODO: A lot of stuff in here isn't actually used by libarchive and - * can be trimmed out. Note that this file is used by libarchive and - * libarchive_test but nowhere else. (But note that it gets compiled - * with many different Windows environments, including MinGW, Visual - * Studio, and Cygwin. Significant changes should be tested in all three.) - */ - -/* - * TODO: Don't use off_t in here. Use __int64 instead. Note that - * Visual Studio and the Windows SDK define off_t as 32 bits; Win32's - * more modern file handling APIs all use __int64 instead of off_t. - */ - -#ifndef LIBARCHIVE_ARCHIVE_WINDOWS_H_INCLUDED -#define LIBARCHIVE_ARCHIVE_WINDOWS_H_INCLUDED - -/* Start of configuration for native Win32 */ - -#include -#define set_errno(val) ((errno)=val) -#include -#include //brings in NULL -#if defined(HAVE_STDINT_H) -#include -#endif -#include -#include -#include -#include -#include -#define NOCRYPT -#include -//#define EFTYPE 7 - -#if !defined(STDIN_FILENO) -#define STDIN_FILENO 0 -#endif - -#if !defined(STDOUT_FILENO) -#define STDOUT_FILENO 1 -#endif - -#if !defined(STDERR_FILENO) -#define STDERR_FILENO 2 -#endif - - -#if defined(_MSC_VER) -/* TODO: Fix the code, don't suppress the warnings. */ -#pragma warning(disable:4244) /* 'conversion' conversion from 'type1' to 'type2', possible loss of data */ -#endif -#if defined(__BORLANDC__) -#pragma warn -8068 /* Constant out of range in comparison. */ -#pragma warn -8072 /* Suspicious pointer arithmetic. */ -#endif - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - -/* Alias the Windows _function to the POSIX equivalent. */ -#define access _access -#define chdir __la_chdir -#define chmod __la_chmod -#define close _close -#define fcntl __la_fcntl -#ifndef fileno -#define fileno _fileno -#endif -#define fstat __la_fstat -#define ftruncate __la_ftruncate -#define futimes __la_futimes -#define getcwd _getcwd -#define link __la_link -#define lseek __la_lseek -#define lstat __la_stat -#define mbstowcs __la_mbstowcs -#define mkdir(d,m) __la_mkdir(d, m) -#define mktemp _mktemp -#define open __la_open -#define read __la_read -#define rmdir __la_rmdir -#if !defined(__BORLANDC__) -#define setmode _setmode -#endif -#define stat(path,stref) __la_stat(path,stref) -#if !defined(__BORLANDC__) -#define strdup _strdup -#endif -#define tzset _tzset -#if !defined(__BORLANDC__) -#define umask _umask -#endif -#define unlink __la_unlink -#define utimes __la_utimes -#define waitpid __la_waitpid -#define write __la_write - -#ifndef O_RDONLY -#define O_RDONLY _O_RDONLY -#define O_WRONLY _O_WRONLY -#define O_TRUNC _O_TRUNC -#define O_CREAT _O_CREAT -#define O_EXCL _O_EXCL -#define O_BINARY _O_BINARY -#endif - -#ifndef _S_IFIFO - #define _S_IFIFO 0010000 /* pipe */ -#endif -#ifndef _S_IFCHR - #define _S_IFCHR 0020000 /* character special */ -#endif -#ifndef _S_IFDIR - #define _S_IFDIR 0040000 /* directory */ -#endif -#ifndef _S_IFBLK - #define _S_IFBLK 0060000 /* block special */ -#endif -#ifndef _S_IFLNK - #define _S_IFLNK 0120000 /* symbolic link */ -#endif -#ifndef _S_IFSOCK - #define _S_IFSOCK 0140000 /* socket */ -#endif -#ifndef _S_IFREG - #define _S_IFREG 0100000 /* regular */ -#endif -#ifndef _S_IFMT - #define _S_IFMT 0170000 /* file type mask */ -#endif - -#ifndef S_IFIFO -#define S_IFIFO _S_IFIFO -#endif -//#define S_IFCHR _S_IFCHR -//#define S_IFDIR _S_IFDIR -#ifndef S_IFBLK -#define S_IFBLK _S_IFBLK -#endif -#ifndef S_IFLNK -#define S_IFLNK _S_IFLNK -#endif -#ifndef S_IFSOCK -#define S_IFSOCK _S_IFSOCK -#endif -//#define S_IFREG _S_IFREG -//#define S_IFMT _S_IFMT - -#ifndef S_ISBLK -#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) /* block special */ -#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) /* fifo or socket */ -#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) /* char special */ -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) /* directory */ -#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) /* regular file */ -#endif -#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) /* Symbolic link */ -#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) /* Socket */ - -#define _S_ISUID 0004000 /* set user id on execution */ -#define _S_ISGID 0002000 /* set group id on execution */ -#define _S_ISVTX 0001000 /* save swapped text even after use */ - -#define S_ISUID _S_ISUID -#define S_ISGID _S_ISGID -#define S_ISVTX _S_ISVTX - -#define _S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC) -#define _S_IXUSR _S_IEXEC /* read permission, user */ -#define _S_IWUSR _S_IWRITE /* write permission, user */ -#define _S_IRUSR _S_IREAD /* execute/search permission, user */ -#define _S_IRWXG (_S_IRWXU >> 3) -#define _S_IXGRP (_S_IXUSR >> 3) /* read permission, group */ -#define _S_IWGRP (_S_IWUSR >> 3) /* write permission, group */ -#define _S_IRGRP (_S_IRUSR >> 3) /* execute/search permission, group */ -#define _S_IRWXO (_S_IRWXG >> 3) -#define _S_IXOTH (_S_IXGRP >> 3) /* read permission, other */ -#define _S_IWOTH (_S_IWGRP >> 3) /* write permission, other */ -#define _S_IROTH (_S_IRGRP >> 3) /* execute/search permission, other */ - -#ifndef S_IRWXU -#define S_IRWXU _S_IRWXU -#define S_IXUSR _S_IXUSR -#define S_IWUSR _S_IWUSR -#define S_IRUSR _S_IRUSR -#endif -#define S_IRWXG _S_IRWXG -#define S_IXGRP _S_IXGRP -#define S_IWGRP _S_IWGRP -#define S_IRGRP _S_IRGRP -#define S_IRWXO _S_IRWXO -#define S_IXOTH _S_IXOTH -#define S_IWOTH _S_IWOTH -#define S_IROTH _S_IROTH - -#define F_DUPFD 0 /* Duplicate file descriptor. */ -#define F_GETFD 1 /* Get file descriptor flags. */ -#define F_SETFD 2 /* Set file descriptor flags. */ -#define F_GETFL 3 /* Get file status flags. */ -#define F_SETFL 4 /* Set file status flags. */ -#define F_GETOWN 5 /* Get owner (receiver of SIGIO). */ -#define F_SETOWN 6 /* Set owner (receiver of SIGIO). */ -#define F_GETLK 7 /* Get record locking info. */ -#define F_SETLK 8 /* Set record locking info (non-blocking). */ -#define F_SETLKW 9 /* Set record locking info (blocking). */ - -/* XXX missing */ -#define F_GETLK64 7 /* Get record locking info. */ -#define F_SETLK64 8 /* Set record locking info (non-blocking). */ -#define F_SETLKW64 9 /* Set record locking info (blocking). */ - -/* File descriptor flags used with F_GETFD and F_SETFD. */ -#define FD_CLOEXEC 1 /* Close on exec. */ - -//NOT SURE IF O_NONBLOCK is OK here but at least the 0x0004 flag is not used by anything else... -#define O_NONBLOCK 0x0004 /* Non-blocking I/O. */ -//#define O_NDELAY O_NONBLOCK - -/* Symbolic constants for the access() function */ -#if !defined(F_OK) - #define R_OK 4 /* Test for read permission */ - #define W_OK 2 /* Test for write permission */ - #define X_OK 1 /* Test for execute permission */ - #define F_OK 0 /* Test for existence of file */ -#endif - - -#ifdef _LARGEFILE_SOURCE -# define __USE_LARGEFILE 1 /* declare fseeko and ftello */ -#endif - -#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64 -# define __USE_FILE_OFFSET64 1 /* replace 32-bit functions by 64-bit ones */ -#endif - -#if __USE_LARGEFILE && __USE_FILE_OFFSET64 -/* replace stat and seek by their large-file equivalents */ -#undef stat -#define stat _stati64 - -#undef lseek -#define lseek _lseeki64 -#define lseek64 _lseeki64 -#define tell _telli64 -#define tell64 _telli64 - -#ifdef __MINGW32__ -# define fseek fseeko64 -# define fseeko fseeko64 -# define ftell ftello64 -# define ftello ftello64 -# define ftell64 ftello64 -#endif /* __MINGW32__ */ -#endif /* LARGE_FILES */ - -#ifdef USE_WINSOCK_TIMEVAL -/* Winsock timeval has long size tv_sec. */ -#define __timeval timeval -#else -struct _timeval64i32 { - time_t tv_sec; - long tv_usec; -}; -#define __timeval _timeval64i32 -#endif - -/* End of Win32 definitions. */ - -/* Tell libarchive code that we have simulations for these. */ -#ifndef HAVE_FTRUNCATE -#define HAVE_FTRUNCATE 1 -#endif -#ifndef HAVE_FUTIMES -#define HAVE_FUTIMES 1 -#endif -#ifndef HAVE_UTIMES -#define HAVE_UTIMES 1 -#endif -#ifndef HAVE_LINK -#define HAVE_LINK 1 -#endif - -/* Replacement POSIX function */ -extern int __la_chdir(const char *path); -extern int __la_chmod(const char *path, mode_t mode); -extern int __la_fcntl(int fd, int cmd, int val); -extern int __la_fstat(int fd, struct stat *st); -extern int __la_ftruncate(int fd, off_t length); -extern int __la_futimes(int fd, const struct __timeval *times); -extern int __la_link(const char *src, const char *dst); -extern __int64 __la_lseek(int fd, __int64 offset, int whence); -extern size_t __la_mbstowcs(wchar_t *wcstr, const char *mbstr, size_t nwchars); -extern int __la_mkdir(const char *path, mode_t mode); -extern int __la_open(const char *path, int flags, ...); -extern ssize_t __la_read(int fd, void *buf, size_t nbytes); -extern int __la_rmdir(const char *path); -extern int __la_stat(const char *path, struct stat *st); -extern int __la_unlink(const char *path); -extern int __la_utimes(const char *name, const struct __timeval *times); -extern pid_t __la_waitpid(pid_t wpid, int *status, int option); -extern ssize_t __la_write(int fd, const void *buf, size_t nbytes); - -#define _stat64i32(path, st) __la_stat(path, st) -#define _stat64(path, st) __la_stat(path, st) -/* for status returned by la_waitpid */ -#define WIFEXITED(sts) ((sts & 0x100) == 0) -#define WEXITSTATUS(sts) (sts & 0x0FF) - -#endif /* LIBARCHIVE_ARCHIVE_WINDOWS_H_INCLUDED */ diff --git a/contrib/libarchive/libarchive/filter_fork_windows.c b/contrib/libarchive/libarchive/filter_fork_windows.c deleted file mode 100644 index 38b7097ee996..000000000000 --- a/contrib/libarchive/libarchive/filter_fork_windows.c +++ /dev/null @@ -1,113 +0,0 @@ -/*- - * Copyright (c) 2009 Michihiro NAKAJIMA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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. - */ - -#include "archive_platform.h" - -#if defined(_WIN32) && !defined(__CYGWIN__) - -#include "filter_fork.h" - -pid_t -__archive_create_child(const char *path, int *child_stdin, int *child_stdout) -{ - HANDLE childStdout[2], childStdin[2], childStdinWr, childStdoutRd; - SECURITY_ATTRIBUTES secAtts; - STARTUPINFO staInfo; - PROCESS_INFORMATION childInfo; - char cmd[MAX_PATH]; - DWORD mode; - - secAtts.nLength = sizeof(SECURITY_ATTRIBUTES); - secAtts.bInheritHandle = TRUE; - secAtts.lpSecurityDescriptor = NULL; - if (CreatePipe(&childStdout[0], &childStdout[1], &secAtts, 0) == 0) - goto fail; - if (DuplicateHandle(GetCurrentProcess(), childStdout[0], - GetCurrentProcess(), &childStdoutRd, 0, FALSE, - DUPLICATE_SAME_ACCESS) == 0) { - CloseHandle(childStdout[0]); - CloseHandle(childStdout[1]); - goto fail; - } - CloseHandle(childStdout[0]); - - if (CreatePipe(&childStdin[0], &childStdin[1], &secAtts, 0) == 0) { - CloseHandle(childStdoutRd); - CloseHandle(childStdout[1]); - goto fail; - } - - if (DuplicateHandle(GetCurrentProcess(), childStdin[1], - GetCurrentProcess(), &childStdinWr, 0, FALSE, - DUPLICATE_SAME_ACCESS) == 0) { - CloseHandle(childStdoutRd); - CloseHandle(childStdout[1]); - CloseHandle(childStdin[0]); - CloseHandle(childStdin[1]); - goto fail; - } - CloseHandle(childStdin[1]); - - memset(&staInfo, 0, sizeof(staInfo)); - staInfo.cb = sizeof(staInfo); - staInfo.hStdOutput = childStdout[1]; - staInfo.hStdInput = childStdin[0]; - staInfo.wShowWindow = SW_HIDE; - staInfo.dwFlags = STARTF_USEFILLATTRIBUTE | STARTF_USECOUNTCHARS | - STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; - strncpy(cmd, path, sizeof(cmd)-1); - cmd[sizeof(cmd)-1] = '\0'; - if (CreateProcessA(NULL, cmd, NULL, NULL, TRUE, 0, NULL, NULL, - &staInfo, &childInfo) == 0) { - CloseHandle(childStdoutRd); - CloseHandle(childStdout[1]); - CloseHandle(childStdin[0]); - CloseHandle(childStdinWr); - goto fail; - } - WaitForInputIdle(childInfo.hProcess, INFINITE); - CloseHandle(childInfo.hProcess); - CloseHandle(childInfo.hThread); - - mode = PIPE_NOWAIT; - SetNamedPipeHandleState(childStdoutRd, &mode, NULL, NULL); - *child_stdout = _open_osfhandle((intptr_t)childStdoutRd, _O_RDONLY); - *child_stdin = _open_osfhandle((intptr_t)childStdinWr, _O_WRONLY); - - return (childInfo.dwProcessId); - -fail: - return (-1); -} - -void -__archive_check_child(int in, int out) -{ - (void)in; /* UNSED */ - (void)out; /* UNSED */ - Sleep(100); -} - -#endif /* _WIN32 && !__CYGWIN__ */ diff --git a/contrib/libarchive/libarchive/test/.cvsignore b/contrib/libarchive/libarchive/test/.cvsignore deleted file mode 100644 index b71f5a0dbd62..000000000000 --- a/contrib/libarchive/libarchive/test/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -*.tar -*.tar.gz -*.tgz -*.zip -.depend -.deps -.dirstamp -archive.h -libarchive_test -list.h diff --git a/contrib/libarchive/libarchive/test/CMakeLists.txt b/contrib/libarchive/libarchive/test/CMakeLists.txt deleted file mode 100644 index 07ee2e364b75..000000000000 --- a/contrib/libarchive/libarchive/test/CMakeLists.txt +++ /dev/null @@ -1,159 +0,0 @@ -############################################ -# -# How to build libarchive_test -# -############################################ -IF(ENABLE_TEST) - FOREACH (_src ${libarchive_SOURCES}) - LIST(APPEND parent_libarchive_SOURCES "../${_src}") - ENDFOREACH(_src) - - SET(libarchive_test_SOURCES - ${parent_libarchive_SOURCES} - main.c - read_open_memory.c - test.h - test_acl_basic.c - test_acl_freebsd.c - test_acl_pax.c - test_archive_api_feature.c - test_bad_fd.c - test_compat_bzip2.c - test_compat_cpio.c - test_compat_gtar.c - test_compat_gzip.c - test_compat_lzma.c - test_compat_solaris_tar_acl.c - test_compat_tar_hardlink.c - test_compat_xz.c - test_compat_zip.c - test_empty_write.c - test_entry.c - test_entry_strmode.c - test_extattr_freebsd.c - test_fuzz.c - test_link_resolver.c - test_open_failure.c - test_open_fd.c - test_open_file.c - test_open_filename.c - test_pax_filename_encoding.c - test_read_compress_program.c - test_read_data_large.c - test_read_disk.c - test_read_disk_entry_from_file.c - test_read_extract.c - test_read_file_nonexistent.c - test_read_format_ar.c - test_read_format_cpio_bin.c - test_read_format_cpio_bin_Z.c - test_read_format_cpio_bin_be.c - test_read_format_cpio_bin_bz2.c - test_read_format_cpio_bin_gz.c - test_read_format_cpio_bin_lzma.c - test_read_format_cpio_bin_xz.c - test_read_format_cpio_odc.c - test_read_format_cpio_svr4_bzip2_rpm.c - test_read_format_cpio_svr4_gzip.c - test_read_format_cpio_svr4_gzip_rpm.c - test_read_format_cpio_svr4c_Z.c - test_read_format_empty.c - test_read_format_gtar_gz.c - test_read_format_gtar_lzma.c - test_read_format_gtar_sparse.c - test_read_format_iso_Z.c - test_read_format_iso_multi_extent.c - test_read_format_isojoliet_bz2.c - test_read_format_isojoliet_long.c - test_read_format_isojoliet_rr.c - test_read_format_isorr_bz2.c - test_read_format_isorr_ce.c - test_read_format_isorr_new_bz2.c - test_read_format_isorr_rr_moved.c - test_read_format_isozisofs_bz2.c - test_read_format_mtree.c - test_read_format_pax_bz2.c - test_read_format_raw.c - test_read_format_tar.c - test_read_format_tar_empty_filename.c - test_read_format_tbz.c - test_read_format_tgz.c - test_read_format_tlz.c - test_read_format_txz.c - test_read_format_tz.c - test_read_format_xar.c - test_read_format_zip.c - test_read_large.c - test_read_pax_truncated.c - test_read_position.c - test_read_truncated.c - test_read_uu.c - test_tar_filenames.c - test_tar_large.c - test_ustar_filenames.c - test_write_compress.c - test_write_compress_bzip2.c - test_write_compress_gzip.c - test_write_compress_lzma.c - test_write_compress_program.c - test_write_compress_xz.c - test_write_disk.c - test_write_disk_failures.c - test_write_disk_hardlink.c - test_write_disk_perms.c - test_write_disk_secure.c - test_write_disk_sparse.c - test_write_disk_symlink.c - test_write_disk_times.c - test_write_format_ar.c - test_write_format_cpio.c - test_write_format_cpio_empty.c - test_write_format_cpio_odc.c - test_write_format_cpio_newc.c - test_write_format_mtree.c - test_write_format_pax.c - test_write_format_shar_empty.c - test_write_format_tar.c - test_write_format_tar_empty.c - test_write_format_tar_ustar.c - test_write_format_zip.c - test_write_format_zip_empty.c - test_write_format_zip_no_compression.c - test_write_open_memory.c - ) - - # - # Register target - # - ADD_EXECUTABLE(libarchive_test ${libarchive_test_SOURCES}) - TARGET_LINK_LIBRARIES(libarchive_test ${ADDITIONAL_LIBS}) - SET_PROPERTY(TARGET libarchive_test PROPERTY COMPILE_DEFINITIONS - LIBARCHIVE_STATIC LIST_H) - - # - # Generate list.h by grepping DEFINE_TEST() lines out of the C sources. - # - GENERATE_LIST_H(${CMAKE_CURRENT_BINARY_DIR}/list.h - ${CMAKE_CURRENT_LIST_FILE} ${libarchive_test_SOURCES}) - SET_PROPERTY(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES - ${CMAKE_CURRENT_BINARY_DIR}) - - # list.h has a line DEFINE_TEST(testname) for every - # test. We can use that to define the tests for cmake by - # defining a DEFINE_TEST macro and reading list.h in. - MACRO (DEFINE_TEST _testname) - ADD_TEST_28( - NAME libarchive_${_testname} - COMMAND libarchive_test -vv - -r ${CMAKE_CURRENT_SOURCE_DIR} - ${_testname}) - ENDMACRO (DEFINE_TEST _testname) - - INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/list.h) - - # Experimental new test handling - ADD_CUSTOM_TARGET(run_libarchive_test - COMMAND libarchive_test -r ${CMAKE_CURRENT_SOURCE_DIR}) - ADD_DEPENDENCIES(run_all_tests run_libarchive_test) -ENDIF(ENABLE_TEST) - diff --git a/contrib/libarchive/tar/CMakeLists.txt b/contrib/libarchive/tar/CMakeLists.txt deleted file mode 100644 index 2ed8161d9859..000000000000 --- a/contrib/libarchive/tar/CMakeLists.txt +++ /dev/null @@ -1,55 +0,0 @@ -############################################ -# -# How to build bsdtar -# -############################################ -IF (ENABLE_TAR) - - SET(bsdtar_SOURCES - bsdtar.c - bsdtar.h - bsdtar_platform.h - cmdline.c - getdate.c - read.c - subst.c - tree.c - tree.h - util.c - write.c - ../libarchive_fe/err.c - ../libarchive_fe/err.h - ../libarchive_fe/lafe_platform.h - ../libarchive_fe/line_reader.c - ../libarchive_fe/line_reader.h - ../libarchive_fe/matching.c - ../libarchive_fe/matching.h - ../libarchive_fe/pathmatch.c - ../libarchive_fe/pathmatch.h - ) - INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../libarchive_fe) - IF(WIN32 AND NOT CYGWIN) - LIST(APPEND bsdtar_SOURCES bsdtar_windows.c) - LIST(APPEND bsdtar_SOURCES bsdtar_windows.h) - ENDIF(WIN32 AND NOT CYGWIN) - - # bsdtar documentation - SET(bsdtar_MANS bsdtar.1) - - # How to build bsdtar - ADD_EXECUTABLE(bsdtar ${bsdtar_SOURCES}) - IF(ENABLE_TAR_SHARED) - TARGET_LINK_LIBRARIES(bsdtar archive ${ADDITIONAL_LIBS}) - ELSE(ENABLE_TAR_SHARED) - TARGET_LINK_LIBRARIES(bsdtar archive_static ${ADDITIONAL_LIBS}) - SET_TARGET_PROPERTIES(bsdtar PROPERTIES COMPILE_DEFINITIONS - LIBARCHIVE_STATIC) - ENDIF(ENABLE_TAR_SHARED) - GET_TARGET_PROPERTY(BSDTAR bsdtar LOCATION) - - # Installation rules - INSTALL(TARGETS bsdtar RUNTIME DESTINATION bin) - INSTALL_MAN(${bsdtar_MANS}) -ENDIF(ENABLE_TAR) - -add_subdirectory(test) diff --git a/contrib/libarchive/tar/bsdtar_windows.c b/contrib/libarchive/tar/bsdtar_windows.c deleted file mode 100644 index 4d1205028f3e..000000000000 --- a/contrib/libarchive/tar/bsdtar_windows.c +++ /dev/null @@ -1,298 +0,0 @@ -/*- - * Copyright (c) 2009 Michihiro NAKAJIMA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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. - * - * $FreeBSD$ - */ - -#if defined(_WIN32) && !defined(__CYGWIN__) - -#include "bsdtar_platform.h" -#include -#include -#include -#include -#include -#ifdef HAVE_SYS_UTIME_H -#include -#endif -#include -#include -#include -#include -#include -#include - -#include "bsdtar.h" -#include "err.h" - -/* This may actually not be needed anymore. - * TODO: Review the error handling for chdir() failures and - * simply dump this if it's not really needed. */ -static void __tar_dosmaperr(unsigned long); - -/* - * Prepend "\\?\" to the path name and convert it to unicode to permit - * an extended-length path for a maximum total path length of 32767 - * characters. - * see also http://msdn.microsoft.com/en-us/library/aa365247.aspx - */ -static wchar_t * -permissive_name(const char *name) -{ - wchar_t *wn, *wnp; - wchar_t *ws, *wsp; - DWORD l, len, slen, alloclen; - int unc; - - len = (DWORD)strlen(name); - wn = malloc((len + 1) * sizeof(wchar_t)); - if (wn == NULL) - return (NULL); - l = MultiByteToWideChar(CP_ACP, 0, name, len, wn, len); - if (l == 0) { - free(wn); - return (NULL); - } - wn[l] = L'\0'; - - /* Get a full path names */ - l = GetFullPathNameW(wn, 0, NULL, NULL); - if (l == 0) { - free(wn); - return (NULL); - } - wnp = malloc(l * sizeof(wchar_t)); - if (wnp == NULL) { - free(wn); - return (NULL); - } - len = GetFullPathNameW(wn, l, wnp, NULL); - free(wn); - wn = wnp; - - if (wnp[0] == L'\\' && wnp[1] == L'\\' && - wnp[2] == L'?' && wnp[3] == L'\\') - /* We have already permissive names. */ - return (wn); - - if (wnp[0] == L'\\' && wnp[1] == L'\\' && - wnp[2] == L'.' && wnp[3] == L'\\') { - /* Device names */ - if (((wnp[4] >= L'a' && wnp[4] <= L'z') || - (wnp[4] >= L'A' && wnp[4] <= L'Z')) && - wnp[5] == L':' && wnp[6] == L'\\') - wnp[2] = L'?';/* Not device names. */ - return (wn); - } - - unc = 0; - if (wnp[0] == L'\\' && wnp[1] == L'\\' && wnp[2] != L'\\') { - wchar_t *p = &wnp[2]; - - /* Skip server-name letters. */ - while (*p != L'\\' && *p != L'\0') - ++p; - if (*p == L'\\') { - wchar_t *rp = ++p; - /* Skip share-name letters. */ - while (*p != L'\\' && *p != L'\0') - ++p; - if (*p == L'\\' && p != rp) { - /* Now, match patterns such as - * "\\server-name\share-name\" */ - wnp += 2; - len -= 2; - unc = 1; - } - } - } - - alloclen = slen = 4 + (unc * 4) + len + 1; - ws = wsp = malloc(slen * sizeof(wchar_t)); - if (ws == NULL) { - free(wn); - return (NULL); - } - /* prepend "\\?\" */ - wcsncpy(wsp, L"\\\\?\\", 4); - wsp += 4; - slen -= 4; - if (unc) { - /* append "UNC\" ---> "\\?\UNC\" */ - wcsncpy(wsp, L"UNC\\", 4); - wsp += 4; - slen -= 4; - } - wcsncpy(wsp, wnp, slen); - free(wn); - ws[alloclen - 1] = L'\0'; - return (ws); -} - -int -__tar_chdir(const char *path) -{ - wchar_t *ws; - int r; - - r = SetCurrentDirectoryA(path); - if (r == 0) { - if (GetLastError() != ERROR_FILE_NOT_FOUND) { - __tar_dosmaperr(GetLastError()); - return (-1); - } - } else - return (0); - ws = permissive_name(path); - if (ws == NULL) { - errno = EINVAL; - return (-1); - } - r = SetCurrentDirectoryW(ws); - free(ws); - if (r == 0) { - __tar_dosmaperr(GetLastError()); - return (-1); - } - return (0); -} - -/* - * The following function was modified from PostgreSQL sources and is - * subject to the copyright below. - */ -/*------------------------------------------------------------------------- - * - * win32error.c - * Map win32 error codes to errno values - * - * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group - * - * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/win32error.c,v 1.4 2008/01/01 19:46:00 momjian Exp $ - * - *------------------------------------------------------------------------- - */ -/* -PostgreSQL Database Management System -(formerly known as Postgres, then as Postgres95) - -Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group - -Portions Copyright (c) 1994, The Regents of the University of California - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose, without fee, and without a written agreement -is hereby granted, provided that the above copyright notice and this -paragraph and the following two paragraphs appear in all copies. - -IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR -DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING -LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS -DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS -ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO -PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -*/ - -static const struct { - DWORD winerr; - int doserr; -} doserrors[] = -{ - { ERROR_INVALID_FUNCTION, EINVAL }, - { ERROR_FILE_NOT_FOUND, ENOENT }, - { ERROR_PATH_NOT_FOUND, ENOENT }, - { ERROR_TOO_MANY_OPEN_FILES, EMFILE }, - { ERROR_ACCESS_DENIED, EACCES }, - { ERROR_INVALID_HANDLE, EBADF }, - { ERROR_ARENA_TRASHED, ENOMEM }, - { ERROR_NOT_ENOUGH_MEMORY, ENOMEM }, - { ERROR_INVALID_BLOCK, ENOMEM }, - { ERROR_BAD_ENVIRONMENT, E2BIG }, - { ERROR_BAD_FORMAT, ENOEXEC }, - { ERROR_INVALID_ACCESS, EINVAL }, - { ERROR_INVALID_DATA, EINVAL }, - { ERROR_INVALID_DRIVE, ENOENT }, - { ERROR_CURRENT_DIRECTORY, EACCES }, - { ERROR_NOT_SAME_DEVICE, EXDEV }, - { ERROR_NO_MORE_FILES, ENOENT }, - { ERROR_LOCK_VIOLATION, EACCES }, - { ERROR_SHARING_VIOLATION, EACCES }, - { ERROR_BAD_NETPATH, ENOENT }, - { ERROR_NETWORK_ACCESS_DENIED, EACCES }, - { ERROR_BAD_NET_NAME, ENOENT }, - { ERROR_FILE_EXISTS, EEXIST }, - { ERROR_CANNOT_MAKE, EACCES }, - { ERROR_FAIL_I24, EACCES }, - { ERROR_INVALID_PARAMETER, EINVAL }, - { ERROR_NO_PROC_SLOTS, EAGAIN }, - { ERROR_DRIVE_LOCKED, EACCES }, - { ERROR_BROKEN_PIPE, EPIPE }, - { ERROR_DISK_FULL, ENOSPC }, - { ERROR_INVALID_TARGET_HANDLE, EBADF }, - { ERROR_INVALID_HANDLE, EINVAL }, - { ERROR_WAIT_NO_CHILDREN, ECHILD }, - { ERROR_CHILD_NOT_COMPLETE, ECHILD }, - { ERROR_DIRECT_ACCESS_HANDLE, EBADF }, - { ERROR_NEGATIVE_SEEK, EINVAL }, - { ERROR_SEEK_ON_DEVICE, EACCES }, - { ERROR_DIR_NOT_EMPTY, ENOTEMPTY }, - { ERROR_NOT_LOCKED, EACCES }, - { ERROR_BAD_PATHNAME, ENOENT }, - { ERROR_MAX_THRDS_REACHED, EAGAIN }, - { ERROR_LOCK_FAILED, EACCES }, - { ERROR_ALREADY_EXISTS, EEXIST }, - { ERROR_FILENAME_EXCED_RANGE, ENOENT }, - { ERROR_NESTING_NOT_ALLOWED, EAGAIN }, - { ERROR_NOT_ENOUGH_QUOTA, ENOMEM } -}; - -static void -__tar_dosmaperr(unsigned long e) -{ - int i; - - if (e == 0) { - errno = 0; - return; - } - - for (i = 0; i < sizeof(doserrors); i++) { - if (doserrors[i].winerr == e) { - errno = doserrors[i].doserr; - return; - } - } - - /* fprintf(stderr, "unrecognized win32 error code: %lu", e); */ - errno = EINVAL; - return; -} - -#endif diff --git a/contrib/libarchive/tar/bsdtar_windows.h b/contrib/libarchive/tar/bsdtar_windows.h deleted file mode 100644 index 092ea6959d83..000000000000 --- a/contrib/libarchive/tar/bsdtar_windows.h +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * Copyright (c) 2009 Michihiro NAKAJIMA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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. - * - * $FreeBSD$ - */ - -#ifndef BSDTAR_WINDOWS_H -#define BSDTAR_WINDOWS_H 1 -#include -#include - -#ifndef PRId64 -#define PRId64 "I64" -#endif -#define geteuid() 0 - -#ifndef S_IFIFO -#define S_IFIFO 0010000 /* pipe */ -#endif - -#include /* Must include before redefining 'strdup' */ -#if !defined(__BORLANDC__) -#define strdup _strdup -#endif -#if !defined(__BORLANDC__) -#define getcwd _getcwd -#endif - -#define chdir __tar_chdir -int __tar_chdir(const char *); - -#ifndef S_ISREG -#define S_ISREG(a) (a & _S_IFREG) -#endif -#ifndef S_ISBLK -#define S_ISBLK(a) (0) -#endif - -#endif /* BSDTAR_WINDOWS_H */ diff --git a/contrib/libarchive/tar/test/CMakeLists.txt b/contrib/libarchive/tar/test/CMakeLists.txt deleted file mode 100644 index 6064e1424073..000000000000 --- a/contrib/libarchive/tar/test/CMakeLists.txt +++ /dev/null @@ -1,67 +0,0 @@ -############################################ -# -# How to build bsdtar_test -# -############################################ -IF(ENABLE_TAR AND ENABLE_TEST) - SET(bsdtar_test_SOURCES - ../getdate.c - main.c - test.h - test_0.c - test_basic.c - test_copy.c - test_empty_mtree.c - test_getdate.c - test_help.c - test_option_T_upper.c - test_option_q.c - test_option_r.c - test_option_s.c - test_patterns.c - test_stdio.c - test_strip_components.c - test_symlink_dir.c - test_version.c - test_windows.c - ) - IF(WIN32 AND NOT CYGWIN) - LIST(APPEND bsdtar_test_SOURCES ../bsdtar_windows.c) - LIST(APPEND bsdtar_test_SOURCES ../bsdtar_windows.h) - ENDIF(WIN32 AND NOT CYGWIN) - - # - # Register target - # - ADD_EXECUTABLE(bsdtar_test ${bsdtar_test_SOURCES}) - SET_PROPERTY(TARGET bsdtar_test PROPERTY COMPILE_DEFINITIONS LIST_H) - - # - # Generate list.h by grepping DEFINE_TEST() lines out of the C sources. - # - GENERATE_LIST_H(${CMAKE_CURRENT_BINARY_DIR}/list.h - ${CMAKE_CURRENT_LIST_FILE} ${bsdtar_test_SOURCES}) - SET_PROPERTY(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES - ${CMAKE_CURRENT_BINARY_DIR}) - - # list.h has a line DEFINE_TEST(testname) for every - # test. We can use that to define the tests for cmake by - # defining a DEFINE_TEST macro and reading list.h in. - MACRO (DEFINE_TEST _testname) - ADD_TEST_28( - NAME bsdtar_${_testname} - COMMAND bsdtar_test -vv - -p $ - -r ${CMAKE_CURRENT_SOURCE_DIR} - ${_testname}) - ENDMACRO (DEFINE_TEST _testname) - - INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/list.h) - - # Experimental new test handling - ADD_CUSTOM_TARGET(run_bsdtar_test - COMMAND bsdtar_test -p ${BSDTAR} -r ${CMAKE_CURRENT_SOURCE_DIR}) - ADD_DEPENDENCIES(run_bsdtar_test bsdtar) - ADD_DEPENDENCIES(run_all_tests run_bsdtar_test) - -ENDIF (ENABLE_TAR AND ENABLE_TEST) diff --git a/contrib/libarchive/tar/test/test_windows.c b/contrib/libarchive/tar/test/test_windows.c deleted file mode 100644 index a2d0c214b956..000000000000 --- a/contrib/libarchive/tar/test/test_windows.c +++ /dev/null @@ -1,323 +0,0 @@ -/*- - * Copyright (c) 2009 Michihiro NAKAJIMA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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 AUTHOR(S) ``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 AUTHOR(S) 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. - */ -#include "test.h" - -#if defined(_WIN32) && !defined(__CYGWIN__) -#include - -static void -mkfile(const char *name) -{ - FILE *f; - - f = fopen(name, "wb"); - assert(f != NULL); - assertEqualInt(5, fwrite("01234", 1, 5, f)); - fclose(f); -} - -static void -mkfullpath(char **path1, char **path2, const char *tpath, int type) -{ - char *fp1 = NULL, *fp2 = NULL, *p1 = NULL, *p2 = NULL; - size_t l; - - /* - * Get full path name of "tpath" - */ - l = GetFullPathNameA(tpath, 0, NULL, NULL); - assert(0 != l); - fp1 = malloc(l); - assert(NULL != fp1); - fp2 = malloc(l*2); - assert(NULL != fp2); - l = GetFullPathNameA(tpath, l, fp1, NULL); - if ((type & 0x01) == 0) { - for (p1 = fp1; *p1 != '\0'; p1++) - if (*p1 == '\\') - *p1 = '/'; - } - - switch(type) { - case 0: /* start with "/" */ - case 1: /* start with "\" */ - /* strip "c:" */ - memmove(fp1, fp1 + 2, l - 2); - fp1[l -2] = '\0'; - p1 = fp1 + 1; - break; - case 2: /* start with "c:/" */ - case 3: /* start with "c:\" */ - p1 = fp1 + 3; - break; - case 4: /* start with "//./c:/" */ - case 5: /* start with "\\.\c:\" */ - case 6: /* start with "//?/c:/" */ - case 7: /* start with "\\?\c:\" */ - p1 = malloc(l + 4 + 1); - assert(NULL != p1); - if (type & 0x1) - memcpy(p1, "\\\\.\\", 4); - else - memcpy(p1, "//./", 4); - if (type == 6 || type == 7) - p1[2] = '?'; - memcpy(p1 + 4, fp1, l); - p1[l + 4] = '\0'; - free(fp1); - fp1 = p1; - p1 = fp1 + 7; - break; - } - - /* - * Strip leading drive names and converting "\" to "\\" - */ - p2 = fp2; - while (*p1 != '\0') { - if (*p1 == '\\') - *p2 = '/'; - else - *p2 = *p1; - ++p1; - ++p2; - } - *p2++ = '\r'; - *p2++ = '\n'; - *p2 = '\0'; - - *path1 = fp1; - *path2 = fp2; -} - -static const char *list1[] = {"aaa/", "aaa/file1", "aaa/xxa/", "aaa/xxb/", - "aaa/zzc/", "aaa/zzc/file1", "aaa/xxb/file1", "aaa/xxa/file1", - "aab/", "aac/", "abb/", "abc/", "abd/", NULL}; -static const char *list2[] = {"bbb/", "bbb/file1", "bbb/xxa/", "bbb/xxb/", - "bbb/zzc/", "bbb/zzc/file1", "bbb/xxb/file1", "bbb/xxa/file1", "bbc/", - "bbd/", "bcc/", "bcd/", "bce/", NULL}; -static const char *list3[] = {"aac/", "abc/", "bbc/", "bcc/", "ccc/", NULL}; -static const char *list4[] = {"fff/abca", "fff/acca", NULL}; -static const char *list5[] = {"aaa/file1", "aaa/xxa/", "aaa/xxa/file1", - "aaa/xxb/", "aaa/xxb/file1", "aaa/zzc/", "aaa/zzc/file1", NULL}; -static const char *list6[] = {"fff/abca", "fff/acca", "aaa/xxa/", - "aaa/xxa/file1", "aaa/xxb/", "aaa/xxb/file1", NULL}; -#endif /* _WIN32 && !__CYGWIN__ */ - -DEFINE_TEST(test_windows) -{ -#if defined(_WIN32) && !defined(__CYGWIN__) - char *fp1, *fp2; - - /* - * Preparre tests. - * Create directories and files. - */ - assertMakeDir("tmp", 0775); - assertChdir("tmp"); - - assertMakeDir("aaa", 0775); - assertMakeDir("aaa/xxa", 0775); - assertMakeDir("aaa/xxb", 0775); - assertMakeDir("aaa/zzc", 0775); - mkfile("aaa/file1"); - mkfile("aaa/xxa/file1"); - mkfile("aaa/xxb/file1"); - mkfile("aaa/zzc/file1"); - assertMakeDir("aab", 0775); - assertMakeDir("aac", 0775); - assertMakeDir("abb", 0775); - assertMakeDir("abc", 0775); - assertMakeDir("abd", 0775); - assertMakeDir("bbb", 0775); - assertMakeDir("bbb/xxa", 0775); - assertMakeDir("bbb/xxb", 0775); - assertMakeDir("bbb/zzc", 0775); - mkfile("bbb/file1"); - mkfile("bbb/xxa/file1"); - mkfile("bbb/xxb/file1"); - mkfile("bbb/zzc/file1"); - assertMakeDir("bbc", 0775); - assertMakeDir("bbd", 0775); - assertMakeDir("bcc", 0775); - assertMakeDir("bcd", 0775); - assertEqualInt(0, _mkdir("bce")); - assertEqualInt(0, _mkdir("ccc")); - assertEqualInt(0, _mkdir("fff")); - mkfile("fff/aaaa"); - mkfile("fff/abba"); - mkfile("fff/abca"); - mkfile("fff/acba"); - mkfile("fff/acca"); - - /* - * Test1: Command line pattern matching. - */ - assertEqualInt(0, - systemf("%s -cf ../archive1.tar a*", testprog)); - assertEqualInt(0, - systemf("%s -tf ../archive1.tar > ../list1", testprog)); - assertFileContainsLinesAnyOrder("../list1", list1); - - assertEqualInt(0, - systemf("%s -cf ../archive2.tar b*", testprog)); - assertEqualInt(0, - systemf("%s -tf ../archive2.tar > ../list2", testprog)); - assertFileContainsLinesAnyOrder("../list2", list2); - - assertEqualInt(0, - systemf("%s -cf ../archive3.tar ??c", testprog)); - assertEqualInt(0, - systemf("%s -tf ../archive3.tar > ../list3", testprog)); - assertFileContainsLinesAnyOrder("../list3", list3); - - assertEqualInt(0, - systemf("%s -cf ../archive3b.tar *c", testprog)); - assertEqualInt(0, - systemf("%s -tf ../archive3b.tar > ../list3b", testprog)); - assertFileContainsLinesAnyOrder("../list3b", list3); - - assertEqualInt(0, - systemf("%s -cf ../archive4.tar fff/a?ca", testprog)); - assertEqualInt(0, - systemf("%s -tf ../archive4.tar > ../list4", testprog)); - assertFileContainsLinesAnyOrder("../list4", list4); - - assertEqualInt(0, - systemf("%s -cf ../archive5.tar aaa\\*", testprog)); - assertEqualInt(0, - systemf("%s -tf ../archive5.tar > ../list5", testprog)); - assertFileContainsLinesAnyOrder("../list5", list5); - - assertEqualInt(0, - systemf("%s -cf ../archive6.tar fff\\a?ca aaa\\xx*", testprog)); - assertEqualInt(0, - systemf("%s -tf ../archive6.tar > ../list6", testprog)); - assertFileContainsLinesAnyOrder("../list6", list6); - - /* - * Test2: Archive the file start with drive letters. - */ - /* Test2a: start with "/" */ - mkfullpath(&fp1, &fp2, "aaa/file1", 0); - assertEqualInt(0, - systemf("%s -cf ../archive10.tar %s > ../out10 2> ../err10", - testprog, fp1)); - assertEqualInt(0, - systemf("%s -tf ../archive10.tar > ../list10", testprog)); - /* Check drive letters have been stripped. */ - assertFileContents(fp2, strlen(fp2), "../list10"); - free(fp1); - free(fp2); - - /* Test2b: start with "\" */ - mkfullpath(&fp1, &fp2, "aaa/file1", 1); - assertEqualInt(0, - systemf("%s -cf ../archive11.tar %s > ../out11 2> ../err11", - testprog, fp1)); - assertEqualInt(0, - systemf("%s -tf ../archive11.tar > ../list11", testprog)); - /* Check drive letters have been stripped. */ - assertFileContents(fp2, strlen(fp2), "../list11"); - free(fp1); - free(fp2); - - /* Test2c: start with "c:/" */ - mkfullpath(&fp1, &fp2, "aaa/file1", 2); - assertEqualInt(0, - systemf("%s -cf ../archive12.tar %s > ../out12 2> ../err12", - testprog, fp1)); - assertEqualInt(0, - systemf("%s -tf ../archive12.tar > ../list12", testprog)); - /* Check drive letters have been stripped. */ - assertFileContents(fp2, strlen(fp2), "../list12"); - free(fp1); - free(fp2); - - /* Test2d: start with "c:\" */ - mkfullpath(&fp1, &fp2, "aaa/file1", 3); - assertEqualInt(0, - systemf("%s -cf ../archive13.tar %s > ../out13 2> ../err13", - testprog, fp1)); - assertEqualInt(0, - systemf("%s -tf ../archive13.tar > ../list13", testprog)); - /* Check drive letters have been stripped. */ - assertFileContents(fp2, strlen(fp2), "../list13"); - free(fp1); - free(fp2); - - /* Test2e: start with "//./c:/" */ - mkfullpath(&fp1, &fp2, "aaa/file1", 4); - assertEqualInt(0, - systemf("%s -cf ../archive14.tar %s > ../out14 2> ../err14", - testprog, fp1)); - assertEqualInt(0, - systemf("%s -tf ../archive14.tar > ../list14", testprog)); - /* Check drive letters have been stripped. */ - assertFileContents(fp2, strlen(fp2), "../list14"); - free(fp1); - free(fp2); - - /* Test2f: start with "\\.\c:\" */ - mkfullpath(&fp1, &fp2, "aaa/file1", 5); - assertEqualInt(0, - systemf("%s -cf ../archive15.tar %s > ../out15 2> ../err15", - testprog, fp1)); - assertEqualInt(0, - systemf("%s -tf ../archive15.tar > ../list15", testprog)); - /* Check drive letters have been stripped. */ - assertFileContents(fp2, strlen(fp2), "../list15"); - free(fp1); - free(fp2); - - /* Test2g: start with "//?/c:/" */ - mkfullpath(&fp1, &fp2, "aaa/file1", 6); - failure("fp1=%s, fp2=%s", fp1, fp2); - assertEqualInt(0, - systemf("%s -cf ../archive16.tar %s > ../out16 2> ../err16", - testprog, fp1)); - assertEqualInt(0, - systemf("%s -tf ../archive16.tar > ../list16", testprog)); - /* Check drive letters have been stripped. */ - assertFileContents(fp2, strlen(fp2), "../list16"); - free(fp1); - free(fp2); - - /* Test2h: start with "\\?\c:\" */ - mkfullpath(&fp1, &fp2, "aaa/file1", 7); - failure("fp1=%s, fp2=%s", fp1, fp2); - assertEqualInt(0, - systemf("%s -cf ../archive17.tar %s > ../out17 2> ../err17", - testprog, fp1)); - assertEqualInt(0, - systemf("%s -tf ../archive17.tar > ../list17", testprog)); - /* Check drive letters have been stripped. */ - assertFileContents(fp2, strlen(fp2), "../list17"); - free(fp1); - free(fp2); -#else - skipping("Windows specific test"); -#endif /* _WIN32 && !__CYGWIN__ */ -}