summaryrefslogtreecommitdiffstats
path: root/lib/libarchive
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2005-10-13 05:51:38 +0000
committerkientzle <kientzle@FreeBSD.org>2005-10-13 05:51:38 +0000
commite137eb325c5fe1b68df3dbf629341e4de93f69cc (patch)
tree7effef2f40c9e72fa2fffb833a7b7002978ddeeb /lib/libarchive
parent75636d760ef9dfeea1ff608215631fb5aba8ef4a (diff)
downloadFreeBSD-src-e137eb325c5fe1b68df3dbf629341e4de93f69cc.zip
FreeBSD-src-e137eb325c5fe1b68df3dbf629341e4de93f69cc.tar.gz
1) Use GNU libtool to build shared libraries on non-FreeBSD
systems (or on FreeBSD systems when using ports). 2) Overhaul the versioning logic. In particular, SHLIB_MAJOR number is now computed as "major+minor", which ensures library versions are the same for the FreeBSD build system and the portable libtool/autoconf/automake build system.
Diffstat (limited to 'lib/libarchive')
-rw-r--r--lib/libarchive/COPYING2
-rw-r--r--lib/libarchive/Makefile86
-rw-r--r--lib/libarchive/Makefile.am7
-rw-r--r--lib/libarchive/archive.h.in10
-rw-r--r--lib/libarchive/configure.ac.in10
5 files changed, 86 insertions, 29 deletions
diff --git a/lib/libarchive/COPYING b/lib/libarchive/COPYING
index 0d9c216..5a02bcc 100644
--- a/lib/libarchive/COPYING
+++ b/lib/libarchive/COPYING
@@ -1,7 +1,7 @@
All of the C source code, header files, and documentation in this
package are covered by the following:
-Copyright (c) 2003-2004 Tim Kientzle
+Copyright (c) 2003-2005 Tim Kientzle
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/lib/libarchive/Makefile b/lib/libarchive/Makefile
index 82d99968..1793a6c 100644
--- a/lib/libarchive/Makefile
+++ b/lib/libarchive/Makefile
@@ -1,31 +1,55 @@
# $FreeBSD$
-#
-# Use "make distfile" to build a conventional tar.gz archive
-# complete with autoconf/automake-generated build system.
-#
-
+# This Makefile is for use with the FreeBSD buid system. For
+# non-FreeBSD systems, you should first "make distfile" on FreeBSD,
+# then use the resulting tar.gz archive--which contains a portable
+# autoconf/automake-generated build system--on the other system.
LIB= archive
-VERSION= 1.02.033
-ARCHIVE_API_FEATURE= 2
-ARCHIVE_API_VERSION= 2
-SHLIB_MAJOR= ${ARCHIVE_API_VERSION}
+
+# Versioning <sigh>. There are three distinct sets of version
+# numbers:
+# * libarchive version
+# * libtool version (for shared libs built using configure script)
+# * FreeBSD SHLIB_MAJOR
+# The following logic helps ensure that there is some consistency across
+# these three:
+
+# First, the libarchive version is in three parts:
+# Bumped ONLY when API/ABI breakage happens (non-backwards-compatible change).
+ARCHIVE_API_MAJOR= 1
+# Bumped when significant new features are added.
+# Also used to bump SHLIB_MAJOR for reasons other than API/ABI breakage.
+# Note: Do NOT reset this to zero after bumping ARCHIVE_API_MAJOR!
+ARCHIVE_API_MINOR= 2
+# Bumped often. ;-)
+ARCHIVE_API_REVISION= 36
+# Full libarchive version combines the above three numbers.
+VERSION!=printf "%d.%02d.%03d" ${ARCHIVE_API_MAJOR} ${ARCHIVE_API_MINOR} ${ARCHIVE_API_REVISION}
+
+# The FreeBSD SHLIB_MAJOR is computed from the above values.
+SHLIB_MAJOR!= expr ${ARCHIVE_API_MAJOR} + ${ARCHIVE_API_MINOR}
+
+# The SHLIB_MAJOR computation above helps ensure that the libtool
+# version (computed in configure.ac.in) provides the same
+# shared library number as is used on FreeBSD.
+
CFLAGS+= -DPACKAGE_NAME=\"lib${LIB}\"
CFLAGS+= -DPACKAGE_VERSION=\"${VERSION}\"
CFLAGS+= -I${.OBJDIR}
+# FreeBSD/arm has some limitations.
.if ${MACHINE_ARCH} == "arm"
WARNS?= 3
.else
WARNS?= 6
.endif
+# Headers to be installed in /usr/include
INCS= archive.h archive_entry.h
-# Note: archive.h does need to be listed here, since it's built
-SRCS= archive.h \
- archive_check_magic.c \
+# C sources to be compiled. This is one part of SRCS below.
+BASE_SRCS= archive_check_magic.c \
archive_entry.c \
archive_read.c \
archive_read_data_into_buffer.c \
@@ -59,6 +83,12 @@ SRCS= archive.h \
archive_write_set_format_shar.c \
archive_write_set_format_ustar.c
+# Note: archive.h does need to be in SRCS, since it is built
+# from archive.h.in. But it does not get included in DIST_FILES
+# below, so I build up SRCS in two steps.
+SRCS= ${BASE_SRCS} archive.h
+
+# Man pages to be installed.
MAN= archive_entry.3 \
archive_read.3 \
archive_util.3 \
@@ -67,6 +97,7 @@ MAN= archive_entry.3 \
libarchive-formats.5 \
tar.5
+# Symlink the man pages under each function name.
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
@@ -169,11 +200,14 @@ 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
-# Build archive.h from archive.h.in
+# Build archive.h from archive.h.in by substituting version information.
archive.h: archive.h.in Makefile
cat ${.CURDIR}/archive.h.in | \
- sed 's/@ARCHIVE_API_VERSION@/${ARCHIVE_API_VERSION}/' | \
- sed 's/@ARCHIVE_API_FEATURE@/${ARCHIVE_API_FEATURE}/' | \
+ sed 's/@VERSION@/${VERSION}/g' | \
+ sed 's/@SHLIB_MAJOR@/${SHLIB_MAJOR}/g' | \
+ sed 's/@ARCHIVE_API_MAJOR@/${ARCHIVE_API_MAJOR}/g' | \
+ sed 's/@ARCHIVE_API_MINOR@/${ARCHIVE_API_MINOR}/g' | \
+ sed 's/@ARCHIVE_API_REVISION@/${ARCHIVE_API_REVISION}/g' | \
cat > archive.h
# archive.h needs to be cleaned
@@ -187,7 +221,8 @@ CLEANFILES+= archive.h
DIST_WORK_DIR= ${.OBJDIR}/lib${LIB}-${VERSION}
CLEANDIRS+= ${DIST_WORK_DIR}
DISTFILE= lib${LIB}-${VERSION}.tar.gz
-DIST_FILES= ${SRCS}
+# DIST_FILES is the list of files to include in the distribution.
+DIST_FILES= ${BASE_SRCS}
DIST_FILES+= ${MAN}
DIST_FILES+= archive.h.in
DIST_FILES+= archive_entry.h archive_platform.h
@@ -197,15 +232,24 @@ DIST_FILES+= Makefile.am
distfile:
rm -rf ${DIST_WORK_DIR}
mkdir ${DIST_WORK_DIR}
- for f in ${DIST_FILES}; \
- do \
- cat ${.CURDIR}/$$f >${DIST_WORK_DIR}/$$f || true; \
+ # Copy the DIST_FILES; ignore errors, don't preserve permissions.
+ for f in ${DIST_FILES}; do \
+ cat ${.CURDIR}/$$f >${DIST_WORK_DIR}/$$f || true; \
done
- cat ${.CURDIR}/configure.ac.in | \
- sed 's/@VERSION@/${VERSION}/' | \
+ # Build configure.ac from configure.ac.in
+ cat ${.CURDIR}/configure.ac.in | \
+ sed 's/@VERSION@/${VERSION}/g' | \
+ sed 's/@SHLIB_MAJOR@/${SHLIB_MAJOR}/g' | \
+ sed 's/@ARCHIVE_API_MAJOR@/${ARCHIVE_API_MAJOR}/g' | \
+ sed 's/@ARCHIVE_API_MINOR@/${ARCHIVE_API_MINOR}/g' | \
+ sed 's/@ARCHIVE_API_REVISION@/${ARCHIVE_API_REVISION}/g' | \
cat > ${DIST_WORK_DIR}/configure.ac
+ # Prepare some auxiliary files.
+ (cd ${DIST_WORK_DIR} && libtoolize)
(cd ${DIST_WORK_DIR} && aclocal && autoheader)
+ # Build the configure script and portable Makefile
(cd ${DIST_WORK_DIR} && autoconf && automake -a --foreign)
+ # Now, use automake-generated Makefile to build the final dist file.
(cd ${DIST_WORK_DIR} && ./configure && make distcheck && make dist)
mv ${DIST_WORK_DIR}/${DISTFILE} ${.OBJDIR}
@echo ==================================================
diff --git a/lib/libarchive/Makefile.am b/lib/libarchive/Makefile.am
index 5ad7361..b000f29 100644
--- a/lib/libarchive/Makefile.am
+++ b/lib/libarchive/Makefile.am
@@ -1,13 +1,13 @@
# $FreeBSD$
-lib_LIBRARIES= libarchive.a
+lib_LTLIBRARIES= libarchive.la
include_HEADERS= archive_entry.h
# Note: archive.h is built from archive.h.in, so don't
# include archive.h in the distfile, but do install it.
nodist_include_HEADERS= archive.h
-libarchive_a_SOURCES= \
+libarchive_la_SOURCES= \
archive_check_magic.c \
archive_entry.c \
archive_entry.h \
@@ -46,6 +46,9 @@ libarchive_a_SOURCES= \
archive_write_set_format_shar.c \
archive_write_set_format_ustar.c
+libarchive_la_LIBADD=-lz -lbz2
+libarchive_la_LDFLAGS= -version-info $(LIBTOOL_VERSION)
+
dist_man_MANS= archive_entry.3 \
archive_read.3 \
archive_util.3 \
diff --git a/lib/libarchive/archive.h.in b/lib/libarchive/archive.h.in
index ac310e1..61a076c 100644
--- a/lib/libarchive/archive.h.in
+++ b/lib/libarchive/archive.h.in
@@ -29,6 +29,11 @@
#ifndef ARCHIVE_H_INCLUDED
#define ARCHIVE_H_INCLUDED
+/*
+ * This header file corresponds to:
+ * Library version @VERSION@
+ * Shared library version @SHLIB_MAJOR@
+ */
#include <sys/types.h> /* Linux requires this for off_t */
#include <inttypes.h> /* For int64_t */
@@ -54,11 +59,12 @@ extern "C" {
* 1 - Version tests are available.
* 2 - archive_{read,write}_close available separately from _finish.
*/
-#define ARCHIVE_API_VERSION @ARCHIVE_API_VERSION@
+#define ARCHIVE_API_VERSION @ARCHIVE_API_MAJOR@
int archive_api_version(void);
-#define ARCHIVE_API_FEATURE @ARCHIVE_API_FEATURE@
+#define ARCHIVE_API_FEATURE @ARCHIVE_API_MINOR@
int archive_api_feature(void);
/* Textual name/version of the library. */
+#define ARCHIVE_LIBRARY_VERSION "libarchive @VERSION@"
const char * archive_version(void);
#define ARCHIVE_BYTES_PER_RECORD 512
diff --git a/lib/libarchive/configure.ac.in b/lib/libarchive/configure.ac.in
index 882af11..8b597ca 100644
--- a/lib/libarchive/configure.ac.in
+++ b/lib/libarchive/configure.ac.in
@@ -6,9 +6,13 @@ AM_INIT_AUTOMAKE(libarchive, @VERSION@)
AC_CONFIG_SRCDIR([archive_write_set_format_ustar.c])
AM_CONFIG_HEADER([config.h])
+# Yes, libtool version numbering is somewhat strange.
+LIBTOOL_VERSION=@SHLIB_MAJOR@:@ARCHIVE_API_REVISION@:@ARCHIVE_API_MINOR@
+AC_SUBST(LIBTOOL_VERSION)
+
# Checks for programs.
AC_PROG_CC
-AC_PROG_RANLIB
+AC_PROG_LIBTOOL
AC_CHECK_TOOL([STRIP],[strip])
# Checks for libraries.
@@ -87,8 +91,8 @@ AC_CHECK_DECL([ACL_USER],
# Additional requirements
AC_SYS_LARGEFILE
-AC_SUBST(ARCHIVE_API_VERSION,[1])
-AC_SUBST(ARCHIVE_API_FEATURE,[1])
+AC_SUBST(ARCHIVE_API_MAJOR,[@ARCHIVE_API_MAJOR@])
+AC_SUBST(ARCHIVE_API_MINOR,[@ARCHIVE_API_MINOR@])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([archive.h])
OpenPOWER on IntegriCloud