12710e4d1STim Kientzle# $FreeBSD$ 2bfe891b1STim Kientzle 3db38abe6STim Kientzle# This Makefile is for use with the FreeBSD buid system. For 4db38abe6STim Kientzle# non-FreeBSD systems, you should first "make distfile" on FreeBSD, 5db38abe6STim Kientzle# then use the resulting tar.gz archive--which contains a portable 6db38abe6STim Kientzle# autoconf/automake-generated build system--on the other system. 7bfe891b1STim Kientzle 8bfe891b1STim KientzleLIB= archive 9e4a93f1eSRuslan ErmilovDPADD= ${LIBBZ2} ${LIBZ} 10e4a93f1eSRuslan ErmilovLDADD= -lbz2 -lz 11db38abe6STim Kientzle 12db38abe6STim Kientzle# Versioning <sigh>. There are three distinct sets of version 13db38abe6STim Kientzle# numbers: 14db38abe6STim Kientzle# * libarchive version 15db38abe6STim Kientzle# * libtool version (for shared libs built using configure script) 16db38abe6STim Kientzle# * FreeBSD SHLIB_MAJOR 17db38abe6STim Kientzle# The following logic helps ensure that there is some consistency across 18db38abe6STim Kientzle# these three: 19db38abe6STim Kientzle 20db38abe6STim Kientzle# First, the libarchive version is in three parts: 21db38abe6STim Kientzle# Bumped ONLY when API/ABI breakage happens (non-backwards-compatible change). 22db38abe6STim KientzleARCHIVE_API_MAJOR= 1 23db38abe6STim Kientzle# Bumped when significant new features are added. 24db38abe6STim Kientzle# Also used to bump SHLIB_MAJOR for reasons other than API/ABI breakage. 25db38abe6STim Kientzle# Note: Do NOT reset this to zero after bumping ARCHIVE_API_MAJOR! 26db38abe6STim KientzleARCHIVE_API_MINOR= 2 27db38abe6STim Kientzle# Bumped often. ;-) 28bbf3318cSTim KientzleARCHIVE_API_REVISION= 37 29db38abe6STim Kientzle# Full libarchive version combines the above three numbers. 302d0d7187STim KientzleVERSION= ${ARCHIVE_API_MAJOR}.${ARCHIVE_API_MINOR}.${ARCHIVE_API_REVISION} 31db38abe6STim Kientzle 32db38abe6STim Kientzle# The FreeBSD SHLIB_MAJOR is computed from the above values. 332d0d7187STim KientzleSHLIB_MAJOR!= echo $$((${ARCHIVE_API_MAJOR} + ${ARCHIVE_API_MINOR})) 34db38abe6STim Kientzle 35db38abe6STim Kientzle# The SHLIB_MAJOR computation above helps ensure that the libtool 36db38abe6STim Kientzle# version (computed in configure.ac.in) provides the same 37db38abe6STim Kientzle# shared library number as is used on FreeBSD. 38db38abe6STim Kientzle 39bfe891b1STim KientzleCFLAGS+= -DPACKAGE_NAME=\"lib${LIB}\" 40bfe891b1STim KientzleCFLAGS+= -DPACKAGE_VERSION=\"${VERSION}\" 41bfe891b1STim KientzleCFLAGS+= -I${.OBJDIR} 42bfe891b1STim Kientzle 43db38abe6STim Kientzle# FreeBSD/arm has some limitations. 44bfe891b1STim Kientzle.if ${MACHINE_ARCH} == "arm" 45bfe891b1STim KientzleWARNS?= 3 46bfe891b1STim Kientzle.else 47bfe891b1STim KientzleWARNS?= 6 48bfe891b1STim Kientzle.endif 49bfe891b1STim Kientzle 50db38abe6STim Kientzle# Headers to be installed in /usr/include 51bfe891b1STim KientzleINCS= archive.h archive_entry.h 52bfe891b1STim Kientzle 53db38abe6STim Kientzle# C sources to be compiled. This is one part of SRCS below. 54db38abe6STim KientzleBASE_SRCS= archive_check_magic.c \ 55bfe891b1STim Kientzle archive_entry.c \ 56bfe891b1STim Kientzle archive_read.c \ 57bfe891b1STim Kientzle archive_read_data_into_buffer.c \ 58bfe891b1STim Kientzle archive_read_data_into_fd.c \ 59bfe891b1STim Kientzle archive_read_extract.c \ 60bfe891b1STim Kientzle archive_read_open_fd.c \ 61bfe891b1STim Kientzle archive_read_open_file.c \ 62bfe891b1STim Kientzle archive_read_support_compression_all.c \ 63bfe891b1STim Kientzle archive_read_support_compression_bzip2.c \ 64bfe891b1STim Kientzle archive_read_support_compression_compress.c \ 65bfe891b1STim Kientzle archive_read_support_compression_gzip.c \ 66bfe891b1STim Kientzle archive_read_support_compression_none.c \ 67bfe891b1STim Kientzle archive_read_support_format_all.c \ 68bfe891b1STim Kientzle archive_read_support_format_cpio.c \ 695d9e84daSTim Kientzle archive_read_support_format_iso9660.c \ 70bfe891b1STim Kientzle archive_read_support_format_tar.c \ 712cac97caSTim Kientzle archive_read_support_format_tp.c \ 725958ff08STim Kientzle archive_read_support_format_zip.c \ 73bfe891b1STim Kientzle archive_string.c \ 74bfe891b1STim Kientzle archive_string_sprintf.c \ 75bfe891b1STim Kientzle archive_util.c \ 76bfe891b1STim Kientzle archive_write.c \ 77bfe891b1STim Kientzle archive_write_open_fd.c \ 78bfe891b1STim Kientzle archive_write_open_file.c \ 79bfe891b1STim Kientzle archive_write_set_compression_bzip2.c \ 80bfe891b1STim Kientzle archive_write_set_compression_gzip.c \ 81bfe891b1STim Kientzle archive_write_set_compression_none.c \ 82bfe891b1STim Kientzle archive_write_set_format.c \ 83bfe891b1STim Kientzle archive_write_set_format_by_name.c \ 84bfe891b1STim Kientzle archive_write_set_format_cpio.c \ 85bfe891b1STim Kientzle archive_write_set_format_pax.c \ 86bfe891b1STim Kientzle archive_write_set_format_shar.c \ 87bfe891b1STim Kientzle archive_write_set_format_ustar.c 88bfe891b1STim Kientzle 89db38abe6STim Kientzle# Note: archive.h does need to be in SRCS, since it is built 90db38abe6STim Kientzle# from archive.h.in. But it does not get included in DIST_FILES 91db38abe6STim Kientzle# below, so I build up SRCS in two steps. 92db38abe6STim KientzleSRCS= ${BASE_SRCS} archive.h 93db38abe6STim Kientzle 94db38abe6STim Kientzle# Man pages to be installed. 95bfe891b1STim KientzleMAN= archive_entry.3 \ 96bfe891b1STim Kientzle archive_read.3 \ 97bfe891b1STim Kientzle archive_util.3 \ 98bfe891b1STim Kientzle archive_write.3 \ 99bfe891b1STim Kientzle libarchive.3 \ 100bfe891b1STim Kientzle libarchive-formats.5 \ 101bfe891b1STim Kientzle tar.5 102bfe891b1STim Kientzle 103db38abe6STim Kientzle# Symlink the man pages under each function name. 104bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_acl_add_entry.3 105bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_acl_add_entry_w.3 106bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_acl_clear.3 107bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_acl_count.3 108bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_acl_next.3 109bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_acl_next_w.3 110bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_acl_reset.3 111bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_acl_text_w.3 112bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_clear.3 113bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_clone.3 114bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_copy_fflags_text_w.3 115bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_copy_gname_w.3 116bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_copy_hardlink_w.3 117bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_copy_pathname_w.3 118bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_copy_stat.3 119bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_copy_symlink_w.3 120bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_copy_uname_w.3 121bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_fflags.3 122bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_fflags_text.3 123bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_free.3 124bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_gid.3 125bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_gname.3 126bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_gname_w.3 127bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_hardlink.3 128bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_ino.3 129bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_mode.3 130bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_mtime.3 131bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_mtime_nsec.3 132bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_new.3 133bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_pathname.3 134bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_pathname_w.3 135bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_rdev.3 136bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_rdevmajor.3 137bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_rdevminor.3 138bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_set_fflags.3 139bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_set_gid.3 140bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_set_gname.3 141bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_set_hardlink.3 142bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_set_link.3 143bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_set_mode.3 144bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_set_pathname.3 145bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_set_rdevmajor.3 146bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_set_rdevminor.3 147bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_set_size.3 148bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_set_symlink.3 149bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_set_uid.3 150bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_set_uname.3 151bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_size.3 152bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_stat.3 153bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_symlink.3 154bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_uid.3 155bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_uname.3 156bfe891b1STim KientzleMLINKS+= archive_entry.3 archive_entry_uname_w.3 157bfe891b1STim KientzleMLINKS+= archive_read.3 archive_read_data.3 158bfe891b1STim KientzleMLINKS+= archive_read.3 archive_read_data_block.3 159bfe891b1STim KientzleMLINKS+= archive_read.3 archive_read_data_into_buffer.3 160bfe891b1STim KientzleMLINKS+= archive_read.3 archive_read_data_into_fd.3 161bfe891b1STim KientzleMLINKS+= archive_read.3 archive_read_data_skip.3 162bfe891b1STim KientzleMLINKS+= archive_read.3 archive_read_extract.3 163bfe891b1STim KientzleMLINKS+= archive_read.3 archive_read_extract_set_progress_callback.3 164bfe891b1STim KientzleMLINKS+= archive_read.3 archive_read_finish.3 165bfe891b1STim KientzleMLINKS+= archive_read.3 archive_read_new.3 166bfe891b1STim KientzleMLINKS+= archive_read.3 archive_read_next_header.3 167bfe891b1STim KientzleMLINKS+= archive_read.3 archive_read_open.3 168bfe891b1STim KientzleMLINKS+= archive_read.3 archive_read_open_fd.3 169bfe891b1STim KientzleMLINKS+= archive_read.3 archive_read_open_file.3 170bfe891b1STim KientzleMLINKS+= archive_read.3 archive_read_set_bytes_per_block.3 171bfe891b1STim KientzleMLINKS+= archive_read.3 archive_read_support_compression_all.3 172bfe891b1STim KientzleMLINKS+= archive_read.3 archive_read_support_compression_bzip2.3 173bfe891b1STim KientzleMLINKS+= archive_read.3 archive_read_support_compression_compress.3 174bfe891b1STim KientzleMLINKS+= archive_read.3 archive_read_support_compression_gzip.3 175bfe891b1STim KientzleMLINKS+= archive_read.3 archive_read_support_compression_none.3 176bfe891b1STim KientzleMLINKS+= archive_read.3 archive_read_support_format_all.3 177bfe891b1STim KientzleMLINKS+= archive_read.3 archive_read_support_format_cpio.3 17809cad9b5STim KientzleMLINKS+= archive_read.3 archive_read_support_format_iso9660.3 179bfe891b1STim KientzleMLINKS+= archive_read.3 archive_read_support_format_tar.3 1805958ff08STim KientzleMLINKS+= archive_read.3 archive_read_support_format_zip.3 181bfe891b1STim KientzleMLINKS+= archive_util.3 archive_compression.3 182bfe891b1STim KientzleMLINKS+= archive_util.3 archive_compression_name.3 183bfe891b1STim KientzleMLINKS+= archive_util.3 archive_errno.3 184bfe891b1STim KientzleMLINKS+= archive_util.3 archive_error_string.3 185bfe891b1STim KientzleMLINKS+= archive_util.3 archive_format.3 186bfe891b1STim KientzleMLINKS+= archive_util.3 archive_format_name.3 187b772d06cSTim KientzleMLINKS+= archive_util.3 archive_set_error.3 188bfe891b1STim KientzleMLINKS+= archive_write.3 archive_write_data.3 189bfe891b1STim KientzleMLINKS+= archive_write.3 archive_write_finish.3 190bfe891b1STim KientzleMLINKS+= archive_write.3 archive_write_header.3 191bfe891b1STim KientzleMLINKS+= archive_write.3 archive_write_new.3 192bfe891b1STim KientzleMLINKS+= archive_write.3 archive_write_open.3 193bfe891b1STim KientzleMLINKS+= archive_write.3 archive_write_open_fd.3 194bfe891b1STim KientzleMLINKS+= archive_write.3 archive_write_open_file.3 195bfe891b1STim KientzleMLINKS+= archive_write.3 archive_write_prepare.3 196bfe891b1STim KientzleMLINKS+= archive_write.3 archive_write_set_bytes_per_block.3 197bfe891b1STim KientzleMLINKS+= archive_write.3 archive_write_set_bytes_in_last_block.3 198bfe891b1STim KientzleMLINKS+= archive_write.3 archive_write_set_callbacks.3 199bfe891b1STim KientzleMLINKS+= archive_write.3 archive_write_set_compression_bzip2.3 200bfe891b1STim KientzleMLINKS+= archive_write.3 archive_write_set_compression_gzip.3 201bfe891b1STim KientzleMLINKS+= archive_write.3 archive_write_set_format_pax.3 202bfe891b1STim KientzleMLINKS+= archive_write.3 archive_write_set_format_shar.3 203bfe891b1STim KientzleMLINKS+= archive_write.3 archive_write_set_format_ustar.3 204bfe891b1STim KientzleMLINKS+= libarchive.3 archive.3 205bfe891b1STim Kientzle 206db38abe6STim Kientzle# Build archive.h from archive.h.in by substituting version information. 20748cbe722STim Kientzlearchive.h: archive.h.in Makefile 208bfe891b1STim Kientzle cat ${.CURDIR}/archive.h.in | \ 209db38abe6STim Kientzle sed 's/@VERSION@/${VERSION}/g' | \ 210db38abe6STim Kientzle sed 's/@SHLIB_MAJOR@/${SHLIB_MAJOR}/g' | \ 211db38abe6STim Kientzle sed 's/@ARCHIVE_API_MAJOR@/${ARCHIVE_API_MAJOR}/g' | \ 212db38abe6STim Kientzle sed 's/@ARCHIVE_API_MINOR@/${ARCHIVE_API_MINOR}/g' | \ 213db38abe6STim Kientzle sed 's/@ARCHIVE_API_REVISION@/${ARCHIVE_API_REVISION}/g' | \ 214bfe891b1STim Kientzle cat > archive.h 215bfe891b1STim Kientzle 21600ccc351STim Kientzle# archive.h needs to be cleaned 21700ccc351STim KientzleCLEANFILES+= archive.h 21800ccc351STim Kientzle 21900ccc351STim Kientzle# 22000ccc351STim Kientzle# Voodoo for building a distfile that uses autoconf/automake/etc. 22100ccc351STim Kientzle# 22200ccc351STim Kientzle 223bfe891b1STim Kientzle# Files that just get copied to the distfile build directory 224bfe891b1STim KientzleDIST_WORK_DIR= ${.OBJDIR}/lib${LIB}-${VERSION} 22500ccc351STim KientzleCLEANDIRS+= ${DIST_WORK_DIR} 226bfe891b1STim KientzleDISTFILE= lib${LIB}-${VERSION}.tar.gz 227db38abe6STim Kientzle# DIST_FILES is the list of files to include in the distribution. 228db38abe6STim KientzleDIST_FILES= ${BASE_SRCS} 229bfe891b1STim KientzleDIST_FILES+= ${MAN} 230bfe891b1STim KientzleDIST_FILES+= archive.h.in 231bfe891b1STim KientzleDIST_FILES+= archive_entry.h archive_platform.h 232bfe891b1STim KientzleDIST_FILES+= archive_private.h archive_string.h 233bfe891b1STim KientzleDIST_FILES+= Makefile.am 234bfe891b1STim Kientzle 235bfe891b1STim Kientzledistfile: 236bfe891b1STim Kientzle rm -rf ${DIST_WORK_DIR} 237bfe891b1STim Kientzle mkdir ${DIST_WORK_DIR} 238db38abe6STim Kientzle # Copy the DIST_FILES; ignore errors, don't preserve permissions. 239db38abe6STim Kientzle for f in ${DIST_FILES}; do \ 240b772d06cSTim Kientzle cat ${.CURDIR}/$$f >${DIST_WORK_DIR}/$$f || true; \ 241bfe891b1STim Kientzle done 242db38abe6STim Kientzle # Build configure.ac from configure.ac.in 243bfe891b1STim Kientzle cat ${.CURDIR}/configure.ac.in | \ 244db38abe6STim Kientzle sed 's/@VERSION@/${VERSION}/g' | \ 245db38abe6STim Kientzle sed 's/@SHLIB_MAJOR@/${SHLIB_MAJOR}/g' | \ 246db38abe6STim Kientzle sed 's/@ARCHIVE_API_MAJOR@/${ARCHIVE_API_MAJOR}/g' | \ 247db38abe6STim Kientzle sed 's/@ARCHIVE_API_MINOR@/${ARCHIVE_API_MINOR}/g' | \ 248db38abe6STim Kientzle sed 's/@ARCHIVE_API_REVISION@/${ARCHIVE_API_REVISION}/g' | \ 249bfe891b1STim Kientzle cat > ${DIST_WORK_DIR}/configure.ac 250db38abe6STim Kientzle # Prepare some auxiliary files. 251db38abe6STim Kientzle (cd ${DIST_WORK_DIR} && libtoolize) 2528d8311c9STim Kientzle (cd ${DIST_WORK_DIR} && aclocal && autoheader) 253db38abe6STim Kientzle # Build the configure script and portable Makefile 2548d8311c9STim Kientzle (cd ${DIST_WORK_DIR} && autoconf && automake -a --foreign) 255db38abe6STim Kientzle # Now, use automake-generated Makefile to build the final dist file. 256bfe891b1STim Kientzle (cd ${DIST_WORK_DIR} && ./configure && make distcheck && make dist) 257bfe891b1STim Kientzle mv ${DIST_WORK_DIR}/${DISTFILE} ${.OBJDIR} 258bfe891b1STim Kientzle @echo ================================================== 259bfe891b1STim Kientzle @echo Created ${.OBJDIR}/${DISTFILE} 260bfe891b1STim Kientzle @echo ================================================== 261bfe891b1STim Kientzle 262bfe891b1STim Kientzle.include <bsd.lib.mk> 263