Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Port libarchive to CMake #2602

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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' \
ongun-kanat marked this conversation as resolved.
Show resolved Hide resolved
'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
Biswa96 marked this conversation as resolved.
Show resolved Hide resolved
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" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried using Ninja?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't since I wasn't sure DESTDIR worked with Ninja. Apparently it works and now PKGBUILD uses Ninja. However this issue with Ninja is annoying: ninja-build/ninja#1482

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is. CMAKE_BUILD_PARALLEL_LEVEL can be used with cmake --build (instead of calling ninja directly)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I should amend the commit with that. Thanks for the info @jeremyd2019

-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/
}