summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ff1135b4380c4dc01c961d8d32780d6fd2c7f3f2 (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
# Maintainer: Gonzalo Exequiel Pedone <hipersayan DOT x AT gmail DOT com>
# Contributor: Dave Reisner <dreisner@archlinux.org>

_android_arch=x86

pkgname=android-${_android_arch}-kmod
pkgver=33
pkgrel=1
pkgdesc="Linux kernel module management tools and library (Android ${_android_arch})"
arch=('any')
url='https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git'
license=('GPL2')
groups=('android-kmod')
depends=("android-${_android_arch}-zlib"
         "android-${_android_arch}-openssl"
         "android-${_android_arch}-xz"
         "android-${_android_arch}-zstd")
makedepends=('android-environment')
options=(!strip !buildflags staticlibs !emptydirs)
source=("https://www.kernel.org/pub/linux/utils/kernel/kmod/kmod-${pkgver}.tar."{xz,sign}
        '0001-Use-getcwd.patch')
md5sums=('c451c4aa61521adbe8af147f498046f8'
         'SKIP'
         'c3d62ea51e242a716752f988c742a4b8')
validpgpkeys=('EAB33C9690013C733916AC839BA2A5A630CBEA53')  # Lucas DeMarchi

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

    patch -Np1 -i ../0001-Use-getcwd.patch
}

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

    ./configure \
        --host=aarch64-linux-android \
        --target=aarch64-linux-android \
        --build="${CHOST}" \
        --prefix="${ANDROID_PREFIX}" \
        --libdir="${ANDROID_PREFIX_LIB}" \
        --includedir="${ANDROID_PREFIX_INCLUDE}" \
        --enable-shared \
        --disable-tools \
        --disable-manpages \
        --disable-test-modules \
        --with-xz \
        --with-zlib \
        --with-zstd \
        --with-openssl
    make $MAKEFLAGS
    ${ANDROID_AR} cru libkmod/.libs/libkmod.a libkmod/.libs/*.o
    ${ANDROID_RANLIB} libkmod/.libs/libkmod.a
}

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

    make DESTDIR="${pkgdir}" install
    install -v -m644 libkmod/.libs/libkmod.a "${pkgdir}/${ANDROID_PREFIX_LIB}/"
    rm -rf "${pkgdir}/${ANDROID_PREFIX_SHARE}"
    ${ANDROID_STRIP} -g --strip-unneeded "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.so
    ${ANDROID_STRIP} -g "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.a
}