summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: af98d3b03bb10b6dd451fcd13b80ff26b9508624 (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
# Maintainer: Gonzalo Exequiel Pedone <hipersayan DOT x AT gmail DOT com>
# Contributor: David Runge <dvzrv@archlinux.org>
# Contributor: Filipe LaĆ­ns (FFY00) <lains@archlinux.org>

_android_arch=armv7a-eabi

pkgname=android-${_android_arch}-liburing
pkgver=2.6
pkgrel=1
arch=('any')
pkgdesc="Linux-native io_uring I/O access library (Android ${_android_arch})"
url="https://git.kernel.dk/cgit/liburing"
license=('(GPL-2.0-only WITH Linux-syscall-note) OR MIT'
         'LGPL-2.0-or-later'
         'MIT')
depends=('android-ndk')
makedepends=('android-configure')
options=(!strip !buildflags staticlibs !emptydirs)
source=("https://github.com/axboe/liburing/archive/refs/tags/liburing-${pkgver}.tar.gz"
        '0001-Fix-libs-install.patch')
md5sums=('612e93b702a617e3d3e363311bef804d'
         'a0de03236c46346326adadb0139bc03d')

prepare() {
    cd "${srcdir}/liburing-liburing-${pkgver}"

    patch -Np1 -i ../0001-Fix-libs-install.patch
    sed -i 's|\$(QUIET_CC)||g' src/Makefile
}

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

    export CPPFLAGS="-D_FORTIFY_SOURCE=2 -D__USE_FORTIFY_LEVEL=2"
    export LDFLAGS="${LDFLAGS} -Wl,--undefined-version"

    ./configure \
        --prefix="${ANDROID_PREFIX}" \
        --includedir="${ANDROID_PREFIX_INCLUDE}" \
        --libdir="${ANDROID_PREFIX_LIB}" \
        --libdevdir="${ANDROID_PREFIX_LIB}" \
        --mandir="${ANDROID_PREFIX_SHARE}/man" \
        --datadir="${ANDROID_PREFIX_SHARE}" \
        --cc="${ANDROID_CC}" \
        --cxx="${ANDROID_CXX}" \
        --use-libc
    make -C "${PWD}/src" $MAKEFLAGS
}

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

    make -C "${PWD}/src" DESTDIR="$pkgdir" ENABLE_SHARED=1 install
    ${ANDROID_STRIP} -g --strip-unneeded "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.so
    ${ANDROID_STRIP} -g "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.a || true

    for pc in liburing.pc liburing-ffi.pc; do
        pcFile=${pkgdir}/${ANDROID_PREFIX_LIB}/pkgconfig/${pc}
        install -D -m 644 "${srcdir}/liburing-liburing-${pkgver}/${pc}.in" "${pcFile}"
        sed -i -e "s%@prefix@%${ANDROID_PREFIX}%g" \
               -e "s%@libdir@%${ANDROID_PREFIX_LIB}%g" \
               -e "s%@includedir@%${ANDROID_PREFIX_INCLUDE}%g" \
               -e "s%@NAME@%liburing%g" \
               -e "s%@VERSION@%${pkgver}%g" \
               "${pcFile}"
    done
}