pkgs/zstd/PKGBUILD

42 lines
1.2 KiB
Bash

# Maintainer: Daryl Ronningen <relms@relms.dev>
pkgname=zstd
pkgver=1.5.5
pkgrel=1
pkgdesc='Zstandard - Fast real-time compression algorithm'
url='https://facebook.github.io/zstd/'
arch=(x86_64)
license=(BSD GPL2)
source=(https://github.com/facebook/zstd/releases/download/v${pkgver}/zstd-${pkgver}.tar.gz)
sha256sums=('9c4396cc829cfae319a6e2615202e82aad41372073482fce286fac78646d3ee4')
prepare() {
cd ${pkgname}-${pkgver}
# avoid error on tests without static libs, we use LD_LIBRARY_PATH
sed '/build static library to build tests/d' -i build/cmake/CMakeLists.txt
sed 's/libzstd_static/libzstd_shared/g' -i build/cmake/tests/CMakeLists.txt
}
build() {
cd ${pkgname}-${pkgver}
export CFLAGS+=' -ffat-lto-objects'
export CXXFLAGS+=' -ffat-lto-objects'
cmake -S build/cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=None \
-DCMAKE_INSTALL_PREFIX=/usr \
-DZSTD_ZLIB_SUPPORT=ON \
-DZSTD_BUILD_CONTRIB=ON \
-DZSTD_BUILD_STATIC=OFF \
-DZSTD_BUILD_TESTS=ON \
-DZSTD_PROGRAMS_LINK_SHARED=ON
cmake --build build
}
package() {
cd ${pkgname}-${pkgver}
DESTDIR="${pkgdir}" cmake --install build
install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
mv $pkgdir/usr/lib64 $pkgdir/usr/lib
}