summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c74bc4b9ce6a4e93c274d49934c4a6b5e6d843a6 (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
77
78
79
80
81
82
83
84
# Maintainer: Gonzalo Exequiel Pedone <hipersayan DOT x AT gmail DOT com>
# Contributor: David Runge <dvzrv@archlinux.org>
# Contributor: judd <jvinet@zeroflux.org>

_android_arch=x86-64

pkgname=android-${_android_arch}-alsa-lib
pkgver=1.2.12
pkgrel=2
arch=('any')
pkgdesc="An alternative implementation of Linux sound support (Android ${_android_arch})"
url="https://www.alsa-project.org"
license=('LGPL-2.1-or-later')
groups=(android-alsa-lib)
depends=("android-${_android_arch}-alsa-topology-conf"
         "android-${_android_arch}-alsa-ucm-conf")
makedepends=('android-configure')
options=(!strip !buildflags staticlibs !emptydirs)
source=("$url/files/pub/lib/alsa-lib-${pkgver}.tar.bz2"{,.sig})
md5sums=('97bbf3cca911c1701fe9fe115c32b03d'
         'SKIP')
validpgpkeys=('F04DF50737AC1A884C4B3D718380596DA6E59C91') # ALSA Release Team (Package Signing Key v1) <release@alsa-project.org>

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

    autoreconf -fiv
}

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

    if [ "${ANDROID_MINIMUM_PLATFORM}" -lt 26 ]; then
        export ac_cv_header_sys_shm_h=no
    fi

    target=${_android_arch/x86-/x86_}-linux-android

    mkdir -p build-shared && pushd build-shared
    ../configure \
        --host="${target}" \
        --target="${target}" \
        --build="${CHOST}" \
        --prefix="${ANDROID_PREFIX}" \
        --libdir="${ANDROID_PREFIX_LIB}" \
        --includedir="${ANDROID_PREFIX_INCLUDE}" \
        --enable-shared=yes \
        --enable-static=no \
        --without-debug \
        --without-versioned
    popd
    # prevent excessive overlinking due to libtool
    sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' build-shared/libtool
    make -C build-shared $MAKEFLAGS

    mkdir -p build-static && pushd build-static
    ../configure \
        --host="${target}" \
        --target="${target}" \
        --build="${CHOST}" \
        --prefix="${ANDROID_PREFIX}" \
        --libdir="${ANDROID_PREFIX_LIB}" \
        --includedir="${ANDROID_PREFIX_INCLUDE}" \
        --enable-shared=no \
        --enable-static=yes \
        --without-debug \
        --without-versioned
    popd
    # prevent excessive overlinking due to libtool
    sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' build-static/libtool
    make -C build-static $MAKEFLAGS
}

package() {
    cd "${srcdir}/alsa-lib-${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
}