Skip to content

Commit

Permalink
Port libarchive to CMake
Browse files Browse the repository at this point in the history
This port also dynamically links bsdtar and bsdcpio to libarchive.
Therefore bsdtar and bsdcpio now depend on libarchive.
  • Loading branch information
ongun-kanat committed Aug 13, 2021
1 parent c88ba5c commit a21ba29
Showing 1 changed file with 36 additions and 32 deletions.
68 changes: 36 additions & 32 deletions libarchive/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

pkgname=('libarchive' 'libarchive-devel' 'bsdcpio' 'bsdtar')
pkgver=3.5.1
pkgrel=1
pkgrel=2
pkgdesc="library that can create and read several streaming archive formats"
arch=('i686' 'x86_64')
url="https://libarchive.org/"
license=('BSD')
groups=('libraries')
depends=('gcc-libs' 'libbz2' 'libiconv' 'libexpat' 'liblzma' 'liblz4' 'libnettle' 'libxml2' 'libzstd' 'zlib')
makedepends=('libbz2-devel' 'libiconv-devel' 'libexpat-devel' 'liblzma-devel' 'liblz4-devel' 'libnettle-devel' 'libxml2-devel' 'libzstd-devel' 'zlib-devel')
options=('!strip' 'debug' 'libtool')
makedepends=('libbz2-devel' 'libiconv-devel' 'libexpat-devel' 'liblzma-devel' 'liblz4-devel' 'libnettle-devel' \
'libxml2-devel' 'libzstd-devel' 'zlib-devel' 'cmake')
source=("https://github.com/libarchive/libarchive/releases/download/${pkgver}/${pkgname}-${pkgver}.tar.xz"
'libarchive-3.3.2-bcrypt-fix.patch'
'libarchive-3.3.1-msys2.patch')
Expand All @@ -24,46 +24,34 @@ prepare() {
# msysize patch
#patch -Np1 -i "${srcdir}/libarchive-3.3.1-msys2.patch"
patch -Np1 -i "${srcdir}/libarchive-3.3.2-bcrypt-fix.patch"
autoreconf -ivf
}

build() {
export lt_cv_deplibs_check_method='pass_all'
cd "${pkgname}-${pkgver}"
local build_type=Release
if check_option "debug" "y"; then
build_type=Debug
fi

#export lt_cv_deplibs_check_method='pass_all'

./configure \
--prefix=/usr \
--enable-shared \
--enable-static \
--without-libiconv-prefix \
--without-xml2 \
--without-cng \
--without-lzo2
mkdir -p "${pkgname}-${pkgver}/build-${CHOST}"
cd "${pkgname}-${pkgver}/build-${CHOST}"

# CNG breaks pacman on Vista due to BCryptDeriveKeyPBKDF2
cmake \
-G"Unix Makefiles" \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=$build_type \
-DENABLE_TAR_SHARED=ON \
-DENABLE_CPIO_SHARED=ON \
-DENABLE_CAT_SHARED=ON \
..

make
make DESTDIR="${srcdir}/dest" install
}

check() {
cd "${pkgname}-${pkgver}"

make check || true
}

package_bsdcpio() {
mkdir -p ${pkgdir}/usr/bin
mkdir -p ${pkgdir}/usr/share/man/man1/
cp -f ${srcdir}/dest/usr/bin/bsdcpio.exe ${pkgdir}/usr/bin/
cp -f ${srcdir}/dest/usr/share/man/man1/bsdcpio.* ${pkgdir}/usr/share/man/man1/
}

package_bsdtar() {
mkdir -p ${pkgdir}/usr/bin
mkdir -p ${pkgdir}/usr/share/man/man1/
cp -f ${srcdir}/dest/usr/bin/bsdtar.exe ${pkgdir}/usr/bin/
cp -f ${srcdir}/dest/usr/share/man/man1/bsdtar.* ${pkgdir}/usr/share/man/man1/
cd "${pkgname}-${pkgver}/build-${CHOST}"
}

package_libarchive() {
Expand All @@ -82,3 +70,19 @@ package_libarchive-devel() {
cp -rf ${srcdir}/dest/usr/include ${pkgdir}/usr/
cp -rf ${srcdir}/dest/usr/lib ${pkgdir}/usr/
}

package_bsdcpio() {
depends=("libarchive=${pkgver}")
mkdir -p ${pkgdir}/usr/bin
mkdir -p ${pkgdir}/usr/share/man/man1/
cp -f ${srcdir}/dest/usr/bin/bsdcpio.exe ${pkgdir}/usr/bin/
cp -f ${srcdir}/dest/usr/share/man/man1/bsdcpio.* ${pkgdir}/usr/share/man/man1/
}

package_bsdtar() {
depends=("libarchive=${pkgver}")
mkdir -p ${pkgdir}/usr/bin
mkdir -p ${pkgdir}/usr/share/man/man1/
cp -f ${srcdir}/dest/usr/bin/bsdtar.exe ${pkgdir}/usr/bin/
cp -f ${srcdir}/dest/usr/share/man/man1/bsdtar.* ${pkgdir}/usr/share/man/man1/
}

0 comments on commit a21ba29

Please sign in to comment.