# URL: http://people.freebsd.org/~kientzle/libarchive/
# Maintainer: CRUX System Team, core-ports at crux dot nu
# Arch Maintainer: CRUX-ARM System Team, devel at crux-arm dot nu
-# Depends on: bzip2 zlib
+# Depends on: bzip2 xz zlib acl lzo
name=libarchive
-version=2.7.1
-release=1
-source=(http://$name.googlecode.com/files/$name-$version.tar.gz)
+version=3.1.2
+release=2
+source=(http://www.libarchive.org/downloads/$name-$version.tar.gz)
build() {
- cd libarchive-$version
+ cd $name-$version
+ # We're passing --without-lzmadec, because we want to use xz for
+ # LZMA support, not the obsolete lzmadec library.
+ #
+ # We're passing --without-xml2 and --without-expat to avoid linking
+ # to libraries which are only available in opt. XML support is only
+ # needed for the xar format which we can live without.
+
+ # Fix libtool linking with host forcing our library path
+ sed -e "s|-rpath \$(libdir)|-rpath $CLFS/usr/lib|g" \
+ -e "s|\$(libarchive_la_LIBADD) \$(LIBS)|-L$CLFS/usr/lib|g" -i Makefile.in
+
./configure --build=$CHOST \
--host=$CTARGET \
--prefix=/usr \
- --mandir=/usr/man \
- --disable-xattr
+ --without-lzmadec \
+ --without-xml2 \
+ --without-expat \
+ --without-openssl
+
+ # Forcing libtool to prioritize our sysroot
+ sed "s|lt_sysroot=|lt_sysroot=$CLFS|g" -i libtool
+
make
make DESTDIR=$PKG install
}