git » snappy.git » main » tree

[main] / PKGBUILD

# Maintainer: Dave Reisner <dreisner@archlinux.org>
# Contributor: Antony Male <antony dot male at geemail dot com>>

pkgname=snappy
pkgver=1.1.10
pkgrel=1
pkgdesc='A fast compressor/decompressor library'
arch=(armv7h 'aarch64')
url="https://google.github.io/snappy/"
license=('BSD')
depends=('glibc' 'gcc-libs')
#checkdepends=('zlib')
makedepends=('cmake' 'clang' 'gtest' 'benchmark')
source=("https://github.com/google/snappy/archive/$pkgver/$pkgname-$pkgver.tar.gz"
        snappy.pc.in
        cmake_add_pkgconfig.patch
        system_gtest.patch::https://github.com/google/snappy/commit/114df35e84ad95b6d5afbcf69aa85a14ff029000.patch
        reenable_rtti.patch::https://github.com/google/snappy/commit/516fdcca6606502e2d562d20c01b225c8d066739.patch)
sha256sums=('49d831bffcc5f3d01482340fe5af59852ca2fe76c3e05df0e67203ebbe0f1d90'
            '134f06ca0584a1026538d0fb972fc141c008390ecae1806184b721eca1abbc75'
            '2a204d7d35509ffc290d80c641fcb7e8488c67ca550aa1695493cff12c53156b'
            '1bb8a37b377620f6c1adc2bb572ccd0570edbf825da087cd6eda3d24f7acb8eb'
            'bae38a49c9c7c05e7655479559200c3e94d9d6f2b4d6bb46cd22985298f51019')

prepare() {
  cd "$pkgname-$pkgver"
  cp ../snappy.pc.in .
  patch -p1 < ../cmake_add_pkgconfig.patch # https://bugs.archlinux.org/task/71246
  patch -p1 < ../system_gtest.patch # https://github.com/google/snappy/pull/132
  patch -p1 < ../reenable_rtti.patch # https://bugs.archlinux.org/task/72058
}

build() {
  cd "$pkgname-$pkgver"

  # NEON breakage (fails to build)
  [[ $CARCH == "armv7h" ]] && CFLAGS=`echo $CFLAGS | sed -e 's/neon-vfpv4/vfpv3/'` && CXXFLAGS="$CFLAGS"

  # compile without assertions
  CXXFLAGS+=\ -DNDEBUG

  # export CXX=clang++

  cmake \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=/usr/lib \
    -DCMAKE_CXX_STANDARD=23 \
    -DBUILD_SHARED_LIBS=yes \
    -DSNAPPY_USE_BUNDLED_GTEST=OFF \
    -DSNAPPY_USE_BUNDLED_BENCHMARK_LIB=OFF \
    .

  make
}

#check() {
  # compile without assertions
#  CXXFLAGS+=\ -DNDEBUG

#  make -C "$pkgname-$pkgver" test
#}

package() {
  cd "$pkgname-$pkgver"

  make DESTDIR="$pkgdir" install
  install -m644 -D COPYING "$pkgdir/usr/share/licenses/snappy/LICENSE"
}

# vim:set ts=2 sw=2 et: