The libarchive library provides a single interface for reading/writing various compression formats.
Install libarchive by running the following commands:
./configure --prefix=/usr \
--host=$LFS_TGT \
--build=$(build/autoconf/config.guess) \
--without-xml2Compile the package:
make
Install the package and remove some harmful libtool archive and static library files:
make DESTDIR=$LFS install &&
rm -v $LFS/usr/lib/libarchive.{a,la}Create some necessary symlinks:
ln -sv bsdtar $LFS/bin/tar && ln -sv bsdcpio $LFS/bin/cpio && ln -sv bsdunzip $LFS/bin/unzip && ln -sv bsdtar.1 $LFS/usr/share/man/man1/tar.1 && ln -sv bsdcpio.1 $LFS/usr/share/man/man1/cpio.1 && ln -sv bsdunzip.1 $LFS/usr/share/man/man1/unzip.1
![[Note]](../images/note.png)
As discussed in locale-wrong-filename-encoding,
if the Zip archive to be extracted contains any file with a name
containing any non-Latin characters, you need to manually specify
the encoding of those characters or they will be turned into
unreadable sequences in the extracted file name. For example, if a
Zip archive created with WinZip, archive.zip,
contains a file named with Simplified Chinese characters, the
encoding should be CP936 and the -I cp936
option should be used. I.e. the command to extract the archive
should be unzip -I cp936 archive.zip.
--without-xml2: This switch sets expat for xar archive
format support instead of preferred libxml2 if both packages are installed.