diff options
author | kientzle <kientzle@FreeBSD.org> | 2004-08-07 03:09:28 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2004-08-07 03:09:28 +0000 |
commit | 237a0ce1f8117c40c606f8734ead347261516646 (patch) | |
tree | 8e493d11e47f8de67e525de4be33da2d37f8f1d2 | |
parent | 1f65e2392cd4804c7a7ee4f02c81dbb21584e642 (diff) | |
download | FreeBSD-src-237a0ce1f8117c40c606f8734ead347261516646.zip FreeBSD-src-237a0ce1f8117c40c606f8734ead347261516646.tar.gz |
libarchive now has two complete build systems. The usual "Makefile"
is present for FreeBSD. If you "make distfile" on FreeBSD, you will
soon have a tar.gz file suitable for deploying to other systems
(complete with the expected "configure" script, etc). This latter
relies (at least for now) on the GNU auto??? tools. (I like autoconf
okay, but someday I hope to write a custom Makefile.in and dispense
with automake, which is somewhat odious.)
As part of this, I've cleaned up some of the conditional
compilation options, added make-foo to construct archive.h dynamically
(it now contains some version constants), and added some useful
informational files.
-rw-r--r-- | lib/libarchive/COPYING | 37 | ||||
-rw-r--r-- | lib/libarchive/INSTALL | 39 | ||||
-rw-r--r-- | lib/libarchive/Makefile | 218 | ||||
-rw-r--r-- | lib/libarchive/Makefile.am | 59 | ||||
-rw-r--r-- | lib/libarchive/Makefile.freebsd | 160 | ||||
-rw-r--r-- | lib/libarchive/archive.h | 309 | ||||
-rw-r--r-- | lib/libarchive/archive.h.in | 4 | ||||
-rw-r--r-- | lib/libarchive/archive_entry.c | 6 | ||||
-rw-r--r-- | lib/libarchive/archive_platform.h | 25 | ||||
-rw-r--r-- | lib/libarchive/archive_read_extract.c | 17 | ||||
-rw-r--r-- | lib/libarchive/configure.ac.in | 76 |
11 files changed, 444 insertions, 506 deletions
diff --git a/lib/libarchive/COPYING b/lib/libarchive/COPYING new file mode 100644 index 0000000..0d9c216 --- /dev/null +++ b/lib/libarchive/COPYING @@ -0,0 +1,37 @@ +All of the C source code, header files, and documentation in this +package are covered by the following: + +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. + +=========================================================================== + +Shell scripts, makefiles, and certain other files may be covered by +other licenses. In particular, some distributions of this library +contain Makefiles and/or shell scripts that are generated +automatically by GNU autoconf and GNU automake. Those generated files +are controlled by the relevant licenses. + +$FreeBSD$ + diff --git a/lib/libarchive/INSTALL b/lib/libarchive/INSTALL new file mode 100644 index 0000000..7da94c1 --- /dev/null +++ b/lib/libarchive/INSTALL @@ -0,0 +1,39 @@ +How you install this depends on which distribution you +are using and what target you're compiling for: + +FROM A PACKAGED DISTRIBUTION TO ANY SYSTEM + +If you unpacked this from a tar.gz archive and have a "configure" +file, then you should be able to install it using the following common +steps: + ./configure + make + make install + +If you need to customize the target directories, use + ./configure --help +to list the configure options. + +FROM CVS TO FreeBSD + +The source code from the FreeBSD CVS server can be +compiled as-is on any FreeBSD system, just use: + make + make install + +FROM CVS TO A PACKAGED DISTRIBUTION + +The source code from the FreeBSD CVS server can be used +to build a tar.gz archive suitable for later installation on +any system. You'll need the following GNU tools installed: + autoconf (including aclocal and autoheader) + automake + +You should be able to use the following command to build a distribution: + make distfile + +The result will be a file named libarchive-<version>.tar.gz in +the object directory. + +$FreeBSD$ + diff --git a/lib/libarchive/Makefile b/lib/libarchive/Makefile index c605001..d2e57d6 100644 --- a/lib/libarchive/Makefile +++ b/lib/libarchive/Makefile @@ -1,2 +1,218 @@ # $FreeBSD$ -.include "Makefile.freebsd" + +# +# Use "make distfile" to build a conventional tar.gz archive +# complete with autoconf/automake-generated build system. +# + + +LIB= archive +SHLIB_MAJOR= 1 +VERSION= 1.00.007 +ARCHIVE_API_FEATURE= 1 +CFLAGS+= -DPACKAGE_NAME=\"lib${LIB}\" +CFLAGS+= -DPACKAGE_VERSION=\"${VERSION}\" +CFLAGS+= -I${.OBJDIR} + +.if ${MACHINE_ARCH} == "arm" +WARNS?= 3 +.else +WARNS?= 6 +.endif + +# I'm not yet ready for a shared version of this library, as +# there are a couple of API changes still in the works. +NOPIC= 1 + +INCS= archive.h archive_entry.h + +SRCS= archive_check_magic.c \ + archive_entry.c \ + archive_read.c \ + archive_read_data_into_buffer.c \ + archive_read_data_into_fd.c \ + archive_read_extract.c \ + archive_read_open_fd.c \ + archive_read_open_file.c \ + 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_format_all.c \ + archive_read_support_format_cpio.c \ + archive_read_support_format_tar.c \ + archive_string.c \ + archive_string_sprintf.c \ + archive_util.c \ + archive_write.c \ + archive_write_open_fd.c \ + archive_write_open_file.c \ + archive_write_set_compression_bzip2.c \ + archive_write_set_compression_gzip.c \ + archive_write_set_compression_none.c \ + archive_write_set_format.c \ + archive_write_set_format_by_name.c \ + archive_write_set_format_cpio.c \ + archive_write_set_format_pax.c \ + archive_write_set_format_shar.c \ + archive_write_set_format_ustar.c + +MAN= archive_entry.3 \ + archive_read.3 \ + archive_util.3 \ + archive_write.3 \ + libarchive.3 \ + libarchive-formats.5 \ + tar.5 + +MLINKS+= archive_entry.3 archive_entry_acl_add_entry.3 +MLINKS+= archive_entry.3 archive_entry_acl_add_entry_w.3 +MLINKS+= archive_entry.3 archive_entry_acl_clear.3 +MLINKS+= archive_entry.3 archive_entry_acl_count.3 +MLINKS+= archive_entry.3 archive_entry_acl_next.3 +MLINKS+= archive_entry.3 archive_entry_acl_next_w.3 +MLINKS+= archive_entry.3 archive_entry_acl_reset.3 +MLINKS+= archive_entry.3 archive_entry_acl_text_w.3 +MLINKS+= archive_entry.3 archive_entry_clear.3 +MLINKS+= archive_entry.3 archive_entry_clone.3 +MLINKS+= archive_entry.3 archive_entry_copy_fflags_text_w.3 +MLINKS+= archive_entry.3 archive_entry_copy_gname_w.3 +MLINKS+= archive_entry.3 archive_entry_copy_hardlink_w.3 +MLINKS+= archive_entry.3 archive_entry_copy_pathname_w.3 +MLINKS+= archive_entry.3 archive_entry_copy_stat.3 +MLINKS+= archive_entry.3 archive_entry_copy_symlink_w.3 +MLINKS+= archive_entry.3 archive_entry_copy_uname_w.3 +MLINKS+= archive_entry.3 archive_entry_fflags.3 +MLINKS+= archive_entry.3 archive_entry_fflags_text.3 +MLINKS+= archive_entry.3 archive_entry_free.3 +MLINKS+= archive_entry.3 archive_entry_gid.3 +MLINKS+= archive_entry.3 archive_entry_gname.3 +MLINKS+= archive_entry.3 archive_entry_gname_w.3 +MLINKS+= archive_entry.3 archive_entry_hardlink.3 +MLINKS+= archive_entry.3 archive_entry_ino.3 +MLINKS+= archive_entry.3 archive_entry_mode.3 +MLINKS+= archive_entry.3 archive_entry_mtime.3 +MLINKS+= archive_entry.3 archive_entry_mtime_nsec.3 +MLINKS+= archive_entry.3 archive_entry_new.3 +MLINKS+= archive_entry.3 archive_entry_pathname.3 +MLINKS+= archive_entry.3 archive_entry_pathname_w.3 +MLINKS+= archive_entry.3 archive_entry_rdev.3 +MLINKS+= archive_entry.3 archive_entry_rdevmajor.3 +MLINKS+= archive_entry.3 archive_entry_rdevminor.3 +MLINKS+= archive_entry.3 archive_entry_set_fflags.3 +MLINKS+= archive_entry.3 archive_entry_set_gid.3 +MLINKS+= archive_entry.3 archive_entry_set_gname.3 +MLINKS+= archive_entry.3 archive_entry_set_hardlink.3 +MLINKS+= archive_entry.3 archive_entry_set_link.3 +MLINKS+= archive_entry.3 archive_entry_set_mode.3 +MLINKS+= archive_entry.3 archive_entry_set_pathname.3 +MLINKS+= archive_entry.3 archive_entry_set_rdevmajor.3 +MLINKS+= archive_entry.3 archive_entry_set_rdevminor.3 +MLINKS+= archive_entry.3 archive_entry_set_size.3 +MLINKS+= archive_entry.3 archive_entry_set_symlink.3 +MLINKS+= archive_entry.3 archive_entry_set_uid.3 +MLINKS+= archive_entry.3 archive_entry_set_uname.3 +MLINKS+= archive_entry.3 archive_entry_size.3 +MLINKS+= archive_entry.3 archive_entry_stat.3 +MLINKS+= archive_entry.3 archive_entry_symlink.3 +MLINKS+= archive_entry.3 archive_entry_uid.3 +MLINKS+= archive_entry.3 archive_entry_uname.3 +MLINKS+= archive_entry.3 archive_entry_uname_w.3 +MLINKS+= archive_read.3 archive_read_data.3 +MLINKS+= archive_read.3 archive_read_data_block.3 +MLINKS+= archive_read.3 archive_read_data_into_buffer.3 +MLINKS+= archive_read.3 archive_read_data_into_fd.3 +MLINKS+= archive_read.3 archive_read_data_skip.3 +MLINKS+= archive_read.3 archive_read_extract.3 +MLINKS+= archive_read.3 archive_read_extract_set_progress_callback.3 +MLINKS+= archive_read.3 archive_read_finish.3 +MLINKS+= archive_read.3 archive_read_new.3 +MLINKS+= archive_read.3 archive_read_next_header.3 +MLINKS+= archive_read.3 archive_read_open.3 +MLINKS+= archive_read.3 archive_read_open_fd.3 +MLINKS+= archive_read.3 archive_read_open_file.3 +MLINKS+= archive_read.3 archive_read_set_bytes_per_block.3 +MLINKS+= archive_read.3 archive_read_support_compression_all.3 +MLINKS+= archive_read.3 archive_read_support_compression_bzip2.3 +MLINKS+= archive_read.3 archive_read_support_compression_compress.3 +MLINKS+= archive_read.3 archive_read_support_compression_gzip.3 +MLINKS+= archive_read.3 archive_read_support_compression_none.3 +MLINKS+= archive_read.3 archive_read_support_format_all.3 +MLINKS+= archive_read.3 archive_read_support_format_cpio.3 +MLINKS+= archive_read.3 archive_read_support_format_tar.3 +MLINKS+= archive_util.3 archive_compression.3 +MLINKS+= archive_util.3 archive_compression_name.3 +MLINKS+= archive_util.3 archive_errno.3 +MLINKS+= archive_util.3 archive_error_string.3 +MLINKS+= archive_util.3 archive_format.3 +MLINKS+= archive_util.3 archive_format_name.3 +MLINKS+= archive_write.3 archive_write_data.3 +MLINKS+= archive_write.3 archive_write_finish.3 +MLINKS+= archive_write.3 archive_write_header.3 +MLINKS+= archive_write.3 archive_write_new.3 +MLINKS+= archive_write.3 archive_write_open.3 +MLINKS+= archive_write.3 archive_write_open_fd.3 +MLINKS+= archive_write.3 archive_write_open_file.3 +MLINKS+= archive_write.3 archive_write_prepare.3 +MLINKS+= archive_write.3 archive_write_set_bytes_per_block.3 +MLINKS+= archive_write.3 archive_write_set_bytes_in_last_block.3 +MLINKS+= archive_write.3 archive_write_set_callbacks.3 +MLINKS+= archive_write.3 archive_write_set_compression_bzip2.3 +MLINKS+= archive_write.3 archive_write_set_compression_gzip.3 +MLINKS+= archive_write.3 archive_write_set_format_pax.3 +MLINKS+= archive_write.3 archive_write_set_format_shar.3 +MLINKS+= archive_write.3 archive_write_set_format_ustar.3 +MLINKS+= libarchive.3 archive.3 + +# +# archive.h is built dynamically, which has a number of implications... +# + +# Ensure archive.h gets built before we compute dependencies. +beforedepend: archive.h +afterdepend: + echo "archive.h: Makefile" >> ${DEPENDFILE} +# Ensure archive.h gets built before we compile anything. +${SRCS:S/.c$/.o/}: archive.h + +# archive.h needs to be cleaned +CLEANFILES+= archive.h + +# Build archive.h from archive.h.in +archive.h: archive.h.in + cat ${.CURDIR}/archive.h.in | \ + sed 's/@ARCHIVE_API_VERSION@/${SHLIB_MAJOR}/' | \ + sed 's/@ARCHIVE_API_FEATURE@/${ARCHIVE_API_FEATURE}/' | \ + cat > archive.h + +# Files that just get copied to the distfile build directory +DIST_WORK_DIR= ${.OBJDIR}/lib${LIB}-${VERSION} +DISTFILE= lib${LIB}-${VERSION}.tar.gz +DIST_FILES= ${SRCS} +DIST_FILES+= ${MAN} +DIST_FILES+= archive.h.in +DIST_FILES+= archive_entry.h archive_platform.h +DIST_FILES+= archive_private.h archive_string.h +DIST_FILES+= Makefile.am + +CLEANDIRS+= ${DIST_WORK_DIR} + +distfile: + rm -rf ${DIST_WORK_DIR} + mkdir ${DIST_WORK_DIR} + for f in ${DIST_FILES}; \ + do \ + cat ${.CURDIR}/$$f >${DIST_WORK_DIR}/$$f; \ + done + cat ${.CURDIR}/configure.ac.in | \ + sed 's/@VERSION@/${VERSION}/' | \ + cat > ${DIST_WORK_DIR}/configure.ac + (cd ${DIST_WORK_DIR} && aclocal && autoheader && autoconf && automake -a --foreign) + (cd ${DIST_WORK_DIR} && ./configure && make distcheck && make dist) + mv ${DIST_WORK_DIR}/${DISTFILE} ${.OBJDIR} + @echo ================================================== + @echo Created ${.OBJDIR}/${DISTFILE} + @echo ================================================== + +.include <bsd.lib.mk> diff --git a/lib/libarchive/Makefile.am b/lib/libarchive/Makefile.am new file mode 100644 index 0000000..ac14a41 --- /dev/null +++ b/lib/libarchive/Makefile.am @@ -0,0 +1,59 @@ +# $FreeBSD$ + +lib_LIBRARIES= libarchive.a + +# Note: archive.h is built from archive.h.in, so don't +# include archive.h in the distfile. +include_HEADERS= archive_entry.h + +libarchive_a_SOURCES= \ + archive_check_magic.c \ + archive_entry.c \ + archive_entry.h \ + archive_platform.h \ + archive_private.h \ + archive_read.c \ + archive_read_data_into_buffer.c \ + archive_read_data_into_fd.c \ + archive_read_extract.c \ + archive_read_open_fd.c \ + archive_read_open_file.c \ + 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_format_all.c \ + archive_read_support_format_cpio.c \ + archive_read_support_format_tar.c \ + archive_string.c \ + archive_string.h \ + archive_string_sprintf.c \ + archive_util.c \ + archive_write.c \ + archive_write_open_fd.c \ + archive_write_open_file.c \ + archive_write_set_compression_bzip2.c \ + archive_write_set_compression_gzip.c \ + archive_write_set_compression_none.c \ + archive_write_set_format.c \ + archive_write_set_format_by_name.c \ + archive_write_set_format_cpio.c \ + archive_write_set_format_pax.c \ + archive_write_set_format_shar.c \ + archive_write_set_format_ustar.c + +dist_man_MANS= archive_entry.3 \ + archive_read.3 \ + archive_util.3 \ + archive_write.3 \ + libarchive.3 \ + libarchive-formats.5 \ + tar.5 + +distclean-local: + -rm -rf autom4te.cache/ + -rm -f *~ + +maintainer-clean-local: + make -f Makefile.freebsd maintainer-clean diff --git a/lib/libarchive/Makefile.freebsd b/lib/libarchive/Makefile.freebsd deleted file mode 100644 index 7c72f95..0000000 --- a/lib/libarchive/Makefile.freebsd +++ /dev/null @@ -1,160 +0,0 @@ -# $FreeBSD$ - -LIB= archive -SHLIB_MAJOR= 1 -VERSION= 1.00.002 -CFLAGS+= -DPACKAGE_NAME=\"lib${LIB}\" -CFLAGS+= -DPACKAGE_VERSION=\"${VERSION}\" - -.if ${MACHINE_ARCH} == "arm" -WARNS?= 3 -.else -WARNS?= 6 -.endif - -# I'm not yet ready for a shared version of this library, as -# there are a couple of API changes still in the works. -NOPIC= 1 - -INCS= archive.h archive_entry.h - -SRCS= archive_check_magic.c \ - archive_entry.c \ - archive_read.c \ - archive_read_data_into_buffer.c \ - archive_read_data_into_fd.c \ - archive_read_extract.c \ - archive_read_open_fd.c \ - archive_read_open_file.c \ - 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_format_all.c \ - archive_read_support_format_cpio.c \ - archive_read_support_format_tar.c \ - archive_string.c \ - archive_string_sprintf.c \ - archive_util.c \ - archive_write.c \ - archive_write_open_fd.c \ - archive_write_open_file.c \ - archive_write_set_compression_bzip2.c \ - archive_write_set_compression_gzip.c \ - archive_write_set_compression_none.c \ - archive_write_set_format.c \ - archive_write_set_format_by_name.c \ - archive_write_set_format_cpio.c \ - archive_write_set_format_pax.c \ - archive_write_set_format_shar.c \ - archive_write_set_format_ustar.c - -MAN= archive_entry.3 \ - archive_read.3 \ - archive_util.3 \ - archive_write.3 \ - libarchive.3 \ - libarchive-formats.5 \ - tar.5 - -MLINKS+= archive_entry.3 archive_entry_acl_add_entry.3 -MLINKS+= archive_entry.3 archive_entry_acl_add_entry_w.3 -MLINKS+= archive_entry.3 archive_entry_acl_clear.3 -MLINKS+= archive_entry.3 archive_entry_acl_count.3 -MLINKS+= archive_entry.3 archive_entry_acl_next.3 -MLINKS+= archive_entry.3 archive_entry_acl_next_w.3 -MLINKS+= archive_entry.3 archive_entry_acl_reset.3 -MLINKS+= archive_entry.3 archive_entry_acl_text_w.3 -MLINKS+= archive_entry.3 archive_entry_clear.3 -MLINKS+= archive_entry.3 archive_entry_clone.3 -MLINKS+= archive_entry.3 archive_entry_copy_fflags_text_w.3 -MLINKS+= archive_entry.3 archive_entry_copy_gname_w.3 -MLINKS+= archive_entry.3 archive_entry_copy_hardlink_w.3 -MLINKS+= archive_entry.3 archive_entry_copy_pathname_w.3 -MLINKS+= archive_entry.3 archive_entry_copy_stat.3 -MLINKS+= archive_entry.3 archive_entry_copy_symlink_w.3 -MLINKS+= archive_entry.3 archive_entry_copy_uname_w.3 -MLINKS+= archive_entry.3 archive_entry_fflags.3 -MLINKS+= archive_entry.3 archive_entry_fflags_text.3 -MLINKS+= archive_entry.3 archive_entry_free.3 -MLINKS+= archive_entry.3 archive_entry_gid.3 -MLINKS+= archive_entry.3 archive_entry_gname.3 -MLINKS+= archive_entry.3 archive_entry_gname_w.3 -MLINKS+= archive_entry.3 archive_entry_hardlink.3 -MLINKS+= archive_entry.3 archive_entry_ino.3 -MLINKS+= archive_entry.3 archive_entry_mode.3 -MLINKS+= archive_entry.3 archive_entry_mtime.3 -MLINKS+= archive_entry.3 archive_entry_mtime_nsec.3 -MLINKS+= archive_entry.3 archive_entry_new.3 -MLINKS+= archive_entry.3 archive_entry_pathname.3 -MLINKS+= archive_entry.3 archive_entry_pathname_w.3 -MLINKS+= archive_entry.3 archive_entry_rdev.3 -MLINKS+= archive_entry.3 archive_entry_rdevmajor.3 -MLINKS+= archive_entry.3 archive_entry_rdevminor.3 -MLINKS+= archive_entry.3 archive_entry_set_fflags.3 -MLINKS+= archive_entry.3 archive_entry_set_gid.3 -MLINKS+= archive_entry.3 archive_entry_set_gname.3 -MLINKS+= archive_entry.3 archive_entry_set_hardlink.3 -MLINKS+= archive_entry.3 archive_entry_set_link.3 -MLINKS+= archive_entry.3 archive_entry_set_mode.3 -MLINKS+= archive_entry.3 archive_entry_set_pathname.3 -MLINKS+= archive_entry.3 archive_entry_set_rdevmajor.3 -MLINKS+= archive_entry.3 archive_entry_set_rdevminor.3 -MLINKS+= archive_entry.3 archive_entry_set_size.3 -MLINKS+= archive_entry.3 archive_entry_set_symlink.3 -MLINKS+= archive_entry.3 archive_entry_set_uid.3 -MLINKS+= archive_entry.3 archive_entry_set_uname.3 -MLINKS+= archive_entry.3 archive_entry_size.3 -MLINKS+= archive_entry.3 archive_entry_stat.3 -MLINKS+= archive_entry.3 archive_entry_symlink.3 -MLINKS+= archive_entry.3 archive_entry_uid.3 -MLINKS+= archive_entry.3 archive_entry_uname.3 -MLINKS+= archive_entry.3 archive_entry_uname_w.3 -MLINKS+= archive_read.3 archive_read_data.3 -MLINKS+= archive_read.3 archive_read_data_block.3 -MLINKS+= archive_read.3 archive_read_data_into_buffer.3 -MLINKS+= archive_read.3 archive_read_data_into_fd.3 -MLINKS+= archive_read.3 archive_read_data_skip.3 -MLINKS+= archive_read.3 archive_read_extract.3 -MLINKS+= archive_read.3 archive_read_extract_set_progress_callback.3 -MLINKS+= archive_read.3 archive_read_finish.3 -MLINKS+= archive_read.3 archive_read_new.3 -MLINKS+= archive_read.3 archive_read_next_header.3 -MLINKS+= archive_read.3 archive_read_open.3 -MLINKS+= archive_read.3 archive_read_open_fd.3 -MLINKS+= archive_read.3 archive_read_open_file.3 -MLINKS+= archive_read.3 archive_read_set_bytes_per_block.3 -MLINKS+= archive_read.3 archive_read_support_compression_all.3 -MLINKS+= archive_read.3 archive_read_support_compression_bzip2.3 -MLINKS+= archive_read.3 archive_read_support_compression_compress.3 -MLINKS+= archive_read.3 archive_read_support_compression_gzip.3 -MLINKS+= archive_read.3 archive_read_support_compression_none.3 -MLINKS+= archive_read.3 archive_read_support_format_all.3 -MLINKS+= archive_read.3 archive_read_support_format_cpio.3 -MLINKS+= archive_read.3 archive_read_support_format_tar.3 -MLINKS+= archive_util.3 archive_compression.3 -MLINKS+= archive_util.3 archive_compression_name.3 -MLINKS+= archive_util.3 archive_errno.3 -MLINKS+= archive_util.3 archive_error_string.3 -MLINKS+= archive_util.3 archive_format.3 -MLINKS+= archive_util.3 archive_format_name.3 -MLINKS+= archive_write.3 archive_write_data.3 -MLINKS+= archive_write.3 archive_write_finish.3 -MLINKS+= archive_write.3 archive_write_header.3 -MLINKS+= archive_write.3 archive_write_new.3 -MLINKS+= archive_write.3 archive_write_open.3 -MLINKS+= archive_write.3 archive_write_open_fd.3 -MLINKS+= archive_write.3 archive_write_open_file.3 -MLINKS+= archive_write.3 archive_write_prepare.3 -MLINKS+= archive_write.3 archive_write_set_bytes_per_block.3 -MLINKS+= archive_write.3 archive_write_set_bytes_in_last_block.3 -MLINKS+= archive_write.3 archive_write_set_callbacks.3 -MLINKS+= archive_write.3 archive_write_set_compression_bzip2.3 -MLINKS+= archive_write.3 archive_write_set_compression_gzip.3 -MLINKS+= archive_write.3 archive_write_set_format_pax.3 -MLINKS+= archive_write.3 archive_write_set_format_shar.3 -MLINKS+= archive_write.3 archive_write_set_format_ustar.3 -MLINKS+= libarchive.3 archive.3 - -.include <bsd.lib.mk> diff --git a/lib/libarchive/archive.h b/lib/libarchive/archive.h deleted file mode 100644 index d374eec..0000000 --- a/lib/libarchive/archive.h +++ /dev/null @@ -1,309 +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. - * - * $FreeBSD$ - */ - -#ifndef ARCHIVE_H_INCLUDED -#define ARCHIVE_H_INCLUDED - -/* - * If ARCHIVE_API_VERSION != archive_api_version(), then the library you - * were linked with is using an incompatible API. This is almost - * certainly a fatal problem. - * - * ARCHIVE_API_FEATURE is incremented with each significant feature - * addition, so you can test (at compile or run time) if a particular - * feature is implemented. It's no big deal if ARCHIVE_API_FEATURE != - * archive_api_feature(), as long as both are high enough to include - * the features you're relying on. Specific values of FEATURE are - * documented here: - * - * 1 - Version test is available. - */ -#define ARCHIVE_API_VERSION 1 -int archive_api_version(void); -#define ARCHIVE_API_FEATURE 1 -int archive_api_feature(void); -/* Textual name/version of the library. */ -const char * archive_version(void); - -#include <sys/types.h> /* Linux requires this for off_t */ -#include <inttypes.h> /* For int64_t */ -#include <unistd.h> /* For ssize_t and size_t */ - -#define ARCHIVE_BYTES_PER_RECORD 512 -#define ARCHIVE_DEFAULT_BYTES_PER_BLOCK 10240 - -/* Declare our basic types. */ -struct archive; -struct archive_entry; - -/* - * Error codes: Use archive_errno() and archive_error_string() - * to retrieve details. Unless specified otherwise, all functions - * that return 'int' use these codes. - */ -#define ARCHIVE_EOF 1 /* Found end of archive. */ -#define ARCHIVE_OK 0 /* Operation was successful. */ -#define ARCHIVE_RETRY (-10) /* Retry might succeed. */ -#define ARCHIVE_WARN (-20) /* Partial sucess. */ -#define ARCHIVE_FATAL (-30) /* No more operations are possible. */ - -/* - * As far as possible, archive_errno returns standard platform errno codes. - * Of course, the details vary by platform, so the actual definitions - * here are stored in "archive_platform.h". The symbols are listed here - * for reference; as a rule, clients should not need to know the exact - * platform-dependent error code. - */ -/* Unrecognized or invalid file format. */ -/* #define ARCHIVE_ERRNO_FILE_FORMAT */ -/* Illegal usage of the library. */ -/* #define ARCHIVE_ERRNO_PROGRAMMER_ERROR */ -/* Unknown or unclassified error. */ -/* #define ARCHIVE_ERRNO_MISC */ - -/* - * Callbacks are invoked to automatically read/write/open/close the archive. - * You can provide your own for complex tasks (like breaking archives - * across multiple tapes) or use standard ones built into the library. - */ - -/* Returns pointer and size of next block of data from archive. */ -typedef ssize_t archive_read_callback(struct archive *, void *_client_data, - const void **_buffer); -/* Returns size actually written, zero on EOF, -1 on error. */ -typedef ssize_t archive_write_callback(struct archive *, void *_client_data, - void *_buffer, size_t _length); -typedef int archive_open_callback(struct archive *, void *_client_data); -typedef int archive_close_callback(struct archive *, void *_client_data); - -/* - * Codes for archive_compression. - */ -#define ARCHIVE_COMPRESSION_NONE 0 -#define ARCHIVE_COMPRESSION_GZIP 1 -#define ARCHIVE_COMPRESSION_BZIP2 2 -#define ARCHIVE_COMPRESSION_COMPRESS 3 - -/* - * Codes returned by archive_format. - * - * Top 16 bits identifies the format family (e.g., "tar"); lower - * 16 bits indicate the variant. This is updated by read_next_header. - * Note that the lower 16 bits will often vary from entry to entry. - */ -#define ARCHIVE_FORMAT_BASE_MASK 0xff0000U -#define ARCHIVE_FORMAT_CPIO 0x10000 -#define ARCHIVE_FORMAT_CPIO_POSIX (ARCHIVE_FORMAT_CPIO | 1) -#define ARCHIVE_FORMAT_SHAR 0x20000 -#define ARCHIVE_FORMAT_SHAR_BASE (ARCHIVE_FORMAT_SHAR | 1) -#define ARCHIVE_FORMAT_SHAR_DUMP (ARCHIVE_FORMAT_SHAR | 2) -#define ARCHIVE_FORMAT_TAR 0x30000 -#define ARCHIVE_FORMAT_TAR_USTAR (ARCHIVE_FORMAT_TAR | 1) -#define ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE (ARCHIVE_FORMAT_TAR | 2) -#define ARCHIVE_FORMAT_TAR_PAX_RESTRICTED (ARCHIVE_FORMAT_TAR | 3) -#define ARCHIVE_FORMAT_TAR_GNUTAR (ARCHIVE_FORMAT_TAR | 4) - -/*- - * Basic outline for reading an archive: - * 1) Ask archive_read_new for an archive reader object. - * 2) Update any global properties as appropriate. - * In particular, you'll certainly want to call appropriate - * archive_read_support_XXX functions. - * 3) Call archive_read_open_XXX to open the archive - * 4) Repeatedly call archive_read_next_header to get information about - * successive archive entries. Call archive_read_data to extract - * data for entries of interest. - * 5) Call archive_read_finish to destroy the object. - */ -struct archive *archive_read_new(void); - -/* - * The archive_read_support_XXX calls enable auto-detect for this - * archive handle. They also link in the necessary support code. - * For example, if you don't want bzlib linked in, don't invoke - * support_compression_bzip2(). The "all" functions provide the - * obvious shorthand. - */ -int archive_read_support_compression_all(struct archive *); -int archive_read_support_compression_bzip2(struct archive *); -int archive_read_support_compression_compress(struct archive *); -int archive_read_support_compression_gzip(struct archive *); -int archive_read_support_compression_none(struct archive *); - -int archive_read_support_format_all(struct archive *); -int archive_read_support_format_cpio(struct archive *); -int archive_read_support_format_gnutar(struct archive *); -int archive_read_support_format_tar(struct archive *); - - -/* Open the archive using callbacks for archive I/O. */ -int archive_read_open(struct archive *, void *_client_data, - archive_open_callback *, archive_read_callback *, - archive_close_callback *); - -/* - * The archive_read_open_file function is a convenience function built - * on archive_read_open that uses a canned callback suitable for - * common situations. Note that a NULL filename indicates stdin. - */ -int archive_read_open_file(struct archive *, const char *_file, - size_t _block_size); -int archive_read_open_fd(struct archive *, int _fd, - size_t _block_size); - -/* Parses and returns next entry header. */ -int archive_read_next_header(struct archive *, - struct archive_entry **); - -/* - * Retrieve the byte offset in UNCOMPRESSED data where last-read - * header started. - */ -int64_t archive_read_header_position(struct archive *); - -/* Read data from the body of an entry. Similar to read(2). */ -ssize_t archive_read_data(struct archive *, void *, size_t); -/* - * A zero-copy version of archive_read_data that also exposes the file offset - * of each returned block. Note that the client has no way to specify - * the desired size of the block. The API does gaurantee that offsets will - * be strictly increasing and that returned blocks will not overlap. - */ -int archive_read_data_block(struct archive *a, - const void **buff, size_t *size, off_t *offset); - -/*- - * Some convenience functions that are built on archive_read_data: - * 'skip': skips entire entry - * 'into_buffer': writes data into memory buffer that you provide - * 'into_fd': writes data to specified filedes - */ -int archive_read_data_skip(struct archive *); -int archive_read_data_into_buffer(struct archive *, void *buffer, - ssize_t len); -int archive_read_data_into_fd(struct archive *, int fd); - -/*- - * Convenience function to recreate the current entry (whose header - * has just been read) on disk. - * - * This does quite a bit more than just copy data to disk. It also: - * - Creates intermediate directories as required. - * - Manages directory permissions: non-writable directories will - * be initially created with write permission enabled; when the - * archive is closed, dir permissions are edited to the values specified - * in the archive. - * - Checks hardlinks: hardlinks will not be extracted unless the - * linked-to file was also extracted within the same session. (TODO) - */ - -/* The "flags" argument selects optional behavior, 'OR' the flags you want. */ -/* TODO: The 'Default' comments here are not quite correct; clean this up. */ -#define ARCHIVE_EXTRACT_OWNER (1) /* Default: owner/group not restored */ -#define ARCHIVE_EXTRACT_PERM (2) /* Default: restore perm only for reg file*/ -#define ARCHIVE_EXTRACT_TIME (4) /* Default: mod time not restored */ -#define ARCHIVE_EXTRACT_NO_OVERWRITE (8) /* Default: Replace files on disk */ -#define ARCHIVE_EXTRACT_UNLINK (16) /* Default: don't unlink existing files */ -#define ARCHIVE_EXTRACT_ACL (32) /* Default: don't restore ACLs */ -#define ARCHIVE_EXTRACT_FFLAGS (64) /* Default: don't restore fflags */ - -int archive_read_extract(struct archive *, struct archive_entry *, - int flags); -void archive_read_extract_set_progress_callback(struct archive *, - void (*_progress_func)(void *), void *_user_data); - -/* Close the file, release any resources, and destroy the object. */ -void archive_read_finish(struct archive *); - -/*- - * To create an archive: - * 1) Ask archive_write_new for a archive writer object. - * 2) Set any global properties. In particular, you should register - * open/write/close callbacks. - * 3) Call archive_write_open to open the file - * 4) For each entry: - * - construct an appropriate struct archive_entry structure - * - archive_write_header to write the header - * - archive_write_data to write the entry data - * 5) archive_write_finish to close the output and cleanup the writer - */ -struct archive *archive_write_new(void); -int archive_write_set_bytes_per_block(struct archive *, - int bytes_per_block); -/* XXX This is badly misnamed; suggestions appreciated. XXX */ -int archive_write_set_bytes_in_last_block(struct archive *, - int bytes_in_last_block); - -int archive_write_set_compression_bzip2(struct archive *); -int archive_write_set_compression_gzip(struct archive *); -int archive_write_set_compression_none(struct archive *); -/* A convenience function to set the format based on the code or name. */ -int archive_write_set_format(struct archive *, int format_code); -int archive_write_set_format_by_name(struct archive *, - const char *name); -/* To minimize link pollution, use one or more of the following. */ -int archive_write_set_format_cpio(struct archive *); -/* TODO: int archive_write_set_format_old_tar(struct archive *); */ -int archive_write_set_format_pax(struct archive *); -int archive_write_set_format_pax_restricted(struct archive *); -int archive_write_set_format_shar(struct archive *); -int archive_write_set_format_shar_dump(struct archive *); -int archive_write_set_format_ustar(struct archive *); -int archive_write_open(struct archive *, void *, - archive_open_callback *, archive_write_callback *, - archive_close_callback *); -int archive_write_open_fd(struct archive *, int _fd); -int archive_write_open_file(struct archive *, const char *_file); - -/* - * Note that the library will truncate writes beyond the size provided - * to archive_write_header or pad if the provided data is short. - */ -int archive_write_header(struct archive *, - struct archive_entry *); -int archive_write_data(struct archive *, const void *, size_t); -void archive_write_finish(struct archive *); - -/* - * Accessor functions to read/set various information in - * the struct archive object: - */ -/* Bytes written after compression or read before decompression. */ -int64_t archive_position_compressed(struct archive *); -/* Bytes written to compressor or read from decompressor. */ -int64_t archive_position_uncompressed(struct archive *); - -const char *archive_compression_name(struct archive *); -int archive_compression(struct archive *); -int archive_errno(struct archive *); -const char *archive_error_string(struct archive *); -const char *archive_format_name(struct archive *); -int archive_format(struct archive *); -void archive_set_error(struct archive *, int _err, const char *fmt, ...); - -#endif /* !ARCHIVE_H_INCLUDED */ diff --git a/lib/libarchive/archive.h.in b/lib/libarchive/archive.h.in index d374eec..0a79200 100644 --- a/lib/libarchive/archive.h.in +++ b/lib/libarchive/archive.h.in @@ -43,9 +43,9 @@ * * 1 - Version test is available. */ -#define ARCHIVE_API_VERSION 1 +#define ARCHIVE_API_VERSION @ARCHIVE_API_VERSION@ int archive_api_version(void); -#define ARCHIVE_API_FEATURE 1 +#define ARCHIVE_API_FEATURE @ARCHIVE_API_FEATURE@ int archive_api_feature(void); /* Textual name/version of the library. */ const char * archive_version(void); diff --git a/lib/libarchive/archive_entry.c b/lib/libarchive/archive_entry.c index a88950a..f669430 100644 --- a/lib/libarchive/archive_entry.c +++ b/lib/libarchive/archive_entry.c @@ -29,15 +29,15 @@ __FBSDID("$FreeBSD$"); #include <sys/stat.h> #include <sys/types.h> +#ifdef HAVE_EXT2FS_EXT2_FS_H +#include <ext2fs/ext2_fs.h> /* for Linux file flags */ +#endif #include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <wchar.h> -#ifdef HAVE_EXT2FS_EXT2_FS_H -#include <ext2fs/ext2_fs.h> /* for Linux file flags */ -#endif #include "archive.h" #include "archive_entry.h" diff --git a/lib/libarchive/archive_platform.h b/lib/libarchive/archive_platform.h index 6e70084..490bcba 100644 --- a/lib/libarchive/archive_platform.h +++ b/lib/libarchive/archive_platform.h @@ -51,7 +51,6 @@ #define HAVE_ERRNO_H 1 #define HAVE_FCHDIR 1 #define HAVE_FCNTL_H 1 -#define HAVE_INT64_T 1 #define HAVE_INTTYPES_H 1 #define HAVE_LCHMOD 1 #define HAVE_LCHOWN 1 @@ -83,9 +82,7 @@ #define HAVE_SYS_TIME_H 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_WAIT_H 1 -#define HAVE_UINT64_T 1 #define HAVE_UNISTD_H 1 -#define HAVE_U_INT64_T 1 #define HAVE_WCHAR_H 1 #define HAVE_ZLIB_H 1 #define STDC_HEADERS 1 @@ -108,28 +105,6 @@ #include <inttypes.h> #endif -/* Try to figure out which type on this system is a 64-bit int. */ -#ifndef HAVE_INT64_T -#if HAVE_64_BIT_LONG_LONG -#define int64_t long long -#else -#error No 64-bit integer type was found. -#endif -#endif - -/* Ditto for unsigned 64-bit types. */ -#ifndef HAVE_UINT64_T -#if HAVE_U_INT64_T -#define uint64_t u_int64_t -#else -#if HAVE_64_BIT_UNSIGNED_LONG_LONG -#define uint64_t unsigned long long -#else -#error No 64-bit integer type was found. -#endif -#endif -#endif - /* TODO: Test for the functions we use as well... */ #if HAVE_SYS_ACL_H #define HAVE_POSIX_ACLS 1 diff --git a/lib/libarchive/archive_read_extract.c b/lib/libarchive/archive_read_extract.c index e91a744..a8d6961 100644 --- a/lib/libarchive/archive_read_extract.c +++ b/lib/libarchive/archive_read_extract.c @@ -27,26 +27,31 @@ #include "archive_platform.h" __FBSDID("$FreeBSD$"); -#include <sys/stat.h> #include <sys/types.h> -#ifdef HAVE_POSIX_ACL +#ifdef HAVE_SYS_ACL_H #include <sys/acl.h> #endif +#ifdef HAVE_SYS_IOCTL_H +#include <sys/ioctl.h> +#endif +#include <sys/stat.h> #include <sys/time.h> +#ifdef HAVE_EXT2FS_EXT2_FS_H +#include <ext2fs/ext2_fs.h> /* for Linux file flags */ +#endif #include <errno.h> #include <fcntl.h> #include <grp.h> +#ifdef HAVE_LINUX_EXT2_FS_H +#include <linux/ext2_fs.h> /* for Linux file flags */ +#endif #include <limits.h> #include <pwd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> -#ifdef linux -#include <ext2fs/ext2_fs.h> -#include <sys/ioctl.h> -#endif #include "archive.h" #include "archive_string.h" diff --git a/lib/libarchive/configure.ac.in b/lib/libarchive/configure.ac.in new file mode 100644 index 0000000..f74f2fd --- /dev/null +++ b/lib/libarchive/configure.ac.in @@ -0,0 +1,76 @@ +# $FreeBSD$ + +#Process this file with autoconf to produce a configure script. +AC_INIT(libarchive, @VERSION@, kientzle@freebsd.org) +AM_INIT_AUTOMAKE(libarchive, @VERSION@) +AC_CONFIG_SRCDIR([archive_write_set_format_ustar.c]) +AM_CONFIG_HEADER([config.h]) + +# Checks for programs. +AC_PROG_CC +AC_PROG_RANLIB +AC_CHECK_TOOL([STRIP],[strip]) + +# Checks for libraries. + +# Checks for header files. +AC_HEADER_STDC +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS([bzlib.h errno.h ext2fs/ext2_fs.h fcntl.h]) +AC_CHECK_HEADERS([inttypes.h limits.h linux/ext2_fs.h paths.h]) +AC_CHECK_HEADERS([stdint.h stdlib.h string.h sys/acl.h sys/ioctl.h]) +AC_CHECK_HEADERS([sys/time.h unistd.h wchar.h zlib.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_TYPE_UID_T +AC_TYPE_MODE_T +AC_CHECK_TYPE(off_t, [int64_t]) +AC_TYPE_SIZE_T +AC_CHECK_TYPE(id_t, [unsigned long]) + +# +# If any of the common 64-bit types is defined, set "int64_t" +# +AC_CHECK_TYPE(__int64_t, [long long]) +AC_CHECK_TYPE(_int64_t, [__int64_t]) +AC_CHECK_TYPE(int64_t, [_int64_t]) + +# +# If any of the common 64-bit unsigned types is defined, set "uint64_t" +# +AC_CHECK_TYPE(__uint64_t, [unsigned long long]) +AC_CHECK_TYPE(_uint64_t, [__uint64_t]) +AC_CHECK_TYPE(u_int64_t, [_uint64_t]) +AC_CHECK_TYPE(uint64_t, [u_int64_t]) + +AC_CHECK_MEMBERS([struct stat.st_rdev, struct stat.st_mtimespec.tv_nsec, struct stat.st_mtim.tv_nsec]) + +AC_CHECK_DECL([EFTYPE], + [AC_DEFINE(HAVE_EFTYPE, 1, [A possible errno value for invalid file format errors])], + [], + [#include <errno.h>]) +AC_CHECK_DECL([EILSEQ], + [AC_DEFINE(HAVE_EILSEQ, 1, [A possible errno value for invalid file format errors])], + [], + [#include <errno.h>]) +AC_HEADER_TIME + +# Checks for library functions. +AC_PROG_GCC_TRADITIONAL +AC_HEADER_MAJOR +AC_FUNC_MALLOC +AC_FUNC_MEMCMP +AC_FUNC_STAT +AC_FUNC_STRERROR_R +AC_CHECK_FUNCS([chflags fchdir lchmod lchown lutimes memmove]) +AC_CHECK_FUNCS([memset mkdir mkfifo strchr strdup strerror strrchr]) + +# Additional requirements +AC_SYS_LARGEFILE +AC_SUBST(ARCHIVE_API_VERSION,[1]) +AC_SUBST(ARCHIVE_API_FEATURE,[1]) + +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([archive.h]) +AC_OUTPUT |