summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 2d1cd702bcb66523f0575261927fda472ea74d0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Maintainer: Gonzalo Exequiel Pedone <hipersayan DOT x AT gmail DOT com>
# Contributor: Dave Reisner <dreisner@archlinux.org>
# Contributor: Antony Male <antony dot male at geemail dot com>>

_android_arch=x86-64

pkgname=android-${_android_arch}-snappy
pkgver=1.2.1
pkgrel=1
arch=('any')
pkgdesc="A fast compressor/decompressor library (Android ${_android_arch})"
url="https://google.github.io/snappy/"
license=('BSD')
groups=('android-snappy')
depends=('android-ndk')
makedepends=('android-cmake')
options=(!strip !buildflags staticlibs !emptydirs)
source=("https://github.com/google/snappy/archive/${pkgver}/snappy-${pkgver}.tar.gz"
        'snappy.pc.in'
        '0001-Add-pkgconfig.patch'
        '0002-Disable-neon.patch')
md5sums=('dd6f9b667e69491e1dbf7419bdf68823'
         '52264b05925281c591daea10f937424d'
         'de6ce2e289d166971edd67748eedaf3f'
         '8714d144e2b3e3cf9727fcee26b751f7')

prepare() {
    cd "${srcdir}/snappy-${pkgver}"
    source android-env ${_android_arch}

    cp ../snappy.pc.in .
    patch -Np1 -i ../0001-Add-pkgconfig.patch
    patch -Np1 -i ../0002-Disable-neon.patch
    sed -i 's|cmake_minimum_required(VERSION 3.1)|cmake_minimum_required(VERSION 3.6)|g' CMakeLists.txt
}

build() {
    cd "${srcdir}/snappy-${pkgver}"
    source android-env ${_android_arch}

    # compile without assertions
    export CFLAGS="${CFLAGS} -DNDEBUG"
    export CXXFLAGS="${CXXFLAGS} -DNDEBUG"

    android-${_android_arch}-cmake \
        -S . \
        -B build-shared \
        -DBUILD_SHARED_LIBS=ON \
        -DSNAPPY_BUILD_TESTS=OFF \
        -DSNAPPY_BUILD_BENCHMARKS=OFF \
        -DSNAPPY_USE_BUNDLED_GTEST=OFF \
        -DSNAPPY_USE_BUNDLED_BENCHMARK_LIB=OFF \
        -Wno-dev
    make -C build-shared $MAKEFLAGS

    android-${_android_arch}-cmake \
        -S . \
        -B build-static \
        -DBUILD_SHARED_LIBS=OFF \
        -DSNAPPY_BUILD_TESTS=OFF \
        -DSNAPPY_BUILD_BENCHMARKS=OFF \
        -DSNAPPY_USE_BUNDLED_GTEST=OFF \
        -DSNAPPY_USE_BUNDLED_BENCHMARK_LIB=OFF \
        -Wno-dev
    make -C build-static $MAKEFLAGS
}

package() {
    cd "${srcdir}/snappy-${pkgver}"
    source android-env ${_android_arch}

    make -C build-shared DESTDIR="${pkgdir}" install
    make -C build-static DESTDIR="${pkgdir}" install
    ${ANDROID_STRIP} -g --strip-unneeded "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.so
    ${ANDROID_STRIP} -g "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.a
}