summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 00669004d0560668d6f2c9a677e4dc7e045d8902 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# Maintainer: Gonzalo Exequiel Pedone <hipersayan DOT x AT gmail DOT com>
# Contributor: Tobias Powalowski <tpowa@archlinux.org>

_android_arch=x86

pkgname=android-${_android_arch}-pciutils
pkgver=3.13.0
pkgrel=1
arch=('any')
pkgdesc="PCI bus configuration space access library and tools (Android ${_android_arch})"
license=('GPL2')
url="https://mj.ucw.cz/sw/pciutils/"
depends=("android-${_android_arch}-hwdata"
         "android-${_android_arch}-kmod")
makedepends=('android-environment')
options=(!strip !buildflags staticlibs !emptydirs)
source=("https://mj.ucw.cz/download/linux/pci/pciutils-${pkgver}.tar.gz"{,.sign}
        '0001-Do-not-use-lresolv.patch'
        '0002-Disable-ecam.patch')
sha256sums=('a03c88a0aab709b1697ca1753766f443e78297f84c7bcd80a82c1422edd7cb42'
            'SKIP'
            '14a963d11acb299db114187768bdf53ee1cb39f1044a0a2aa5c5a90ae58e42a3'
            'bff4d9e509ceba0cdde7a20e83afa5303f27cd93705c54867c6c073fc153aa87')
validpgpkeys=('C466A56CADA981F4297D20C31F3D0761D9B65F0B') # Martin Mares <mj@ucw.cz>

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

    patch -Np1 -i ../0001-Do-not-use-lresolv.patch

    if [ "${ANDROID_MINIMUM_PLATFORM}" -lt 28 ]; then
        patch -Np1 -i ../0002-Disable-ecam.patch
    fi
}

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

    # Platform specific patches
    case "$_android_arch" in
        aarch64)
            host=armv8-linux
            ;;
        armv7a-eabi)
            host=armv7-linux
            ;;
        *)
            host=intel-linux
            ;;
    esac

    make \
        HOST=${host} \
        OPT="${CFLAGS} -fPIC -DPIC" \
        ZLIB=no \
        SHARED=no \
        PREFIX="${ANDROID_PREFIX}" \
        SBINDIR="${ANDROID_PREFIX_BIN}" \
        SHAREDIR="${ANDROID_PREFIX_SHARE}/hwdata" \
        MANDIR="${ANDROID_PREFIX_SHARE}/man" \
        CC="${ANDROID_CC}" \
        AR="${ANDROID_AR}" \
        RANLIB="${ANDROID_RANLIB}" \
        STRIP="${ANDROID_STRIP}" \
        lib/libpci.a
    cp -f lib/libpci.a "${srcdir}/"
    make clean
    make \
        HOST=${host} \
        OPT="${CFLAGS}" \
        ZLIB=no \
        SHARED=yes \
        PREFIX="${ANDROID_PREFIX}" \
        SBINDIR="${ANDROID_PREFIX_BIN}" \
        SHAREDIR="${ANDROID_PREFIX_SHARE}/hwdata" \
        MANDIR="${ANDROID_PREFIX_SHARE}/man" \
        CC="${ANDROID_CC}" \
        AR="${ANDROID_AR}" \
        RANLIB="${ANDROID_RANLIB}" \
        STRIP="${ANDROID_STRIP}" \
        all
}

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

    # Platform specific patches
    case "$_android_arch" in
        aarch64)
            host=armv8-linux
            ;;
        armv7a-eabi)
            host=armv7-linux
            ;;
        *)
            host=intel-linux
            ;;
    esac

    make \
        HOST=${host} \
        SHARED=yes \
        PREFIX="${ANDROID_PREFIX}" \
        SBINDIR="${ANDROID_PREFIX_BIN}" \
        SHAREDIR="${ANDROID_PREFIX_SHARE}/hwdata" \
        MANDIR="${ANDROID_PREFIX_SHARE}/man" \
        DESTDIR="${pkgdir}" \
        CC="${ANDROID_CC}" \
        AR="${ANDROID_AR}" \
        RANLIB="${ANDROID_RANLIB}" \
        STRIP="${ANDROID_STRIP}" \
        install \
        install-lib

    rm -f "${pkgdir}/${ANDROID_PREFIX_BIN}/"{llvm-strip,lspci,pcilmr,setpci}
    rm -rf "${pkgdir}/${ANDROID_PREFIX_SHARE}"
    cp -f "${srcdir}/libpci.a" "${pkgdir}/${ANDROID_PREFIX_LIB}/"
    mv -f "${pkgdir}/${ANDROID_PREFIX_LIB}/libpci.so".*.* "${pkgdir}/${ANDROID_PREFIX_LIB}/libpci.so"
    rm -f "${pkgdir}/${ANDROID_PREFIX_LIB}/libpci.so".*
    ${ANDROID_STRIP} -g --strip-unneeded "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.so
    ${ANDROID_STRIP} -g "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.a
}