summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f3fbc853aae8f62a02a08faae7d86be2845f394b (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
# Maintainer: Gonzalo Exequiel Pedone <hipersayan DOT x AT gmail DOT com>
# Contributor: Jakub Klinkovský <lahwaacz at archlinux dot org>
# Contributor: David Runge <dvzrv@archlinux.org>

_android_arch=armv7a-eabi

pkgname=android-${_android_arch}-prrte
pkgver=3.0.6
pkgrel=1
arch=('any')
pkgdesc="PMIx Reference RunTime Environment (Android ${_android_arch})"
url="https://github.com/openpmix/prrte"
license=('BSD-3-Clause')
groups=('android-prrte')
depends=("android-${_android_arch}-hwloc"
         "android-${_android_arch}-libevent"
         "android-${_android_arch}-openpmix")
makedepends=("android-${_android_arch}-hwloc"
             "android-${_android_arch}-libevent"
             "android-${_android_arch}-openpmix"
             'android-environment'
             'perl')
optdepends=("android-${_android_arch}-openssh: for execution on remote hosts via plm_ssh_agent")
options=(!strip !buildflags staticlibs !emptydirs)
source=("${url}/releases/download/v${pkgver}/prrte-${pkgver}.tar.gz"
        'prte-mca-params.conf'
        'prrte-ssh'
        '0001-Force-32-bits-compile.patch'
        '0002-Unversioned-libs.patch'
        '0003-Remove-getdtablesize.patch')
md5sums=('e541663d71fd9c44fe9cac3353fbbd1c'
         '846d0affc94d41dafa76adb72abe210b'
         'aed50d2a9dae9f25179547c76332eae2'
         '33b8d8a53fb67b636835e9e3e955ff77'
         '47db6b8ab5894753aa4c508f64c75389'
         '7ff35a9373c7aae9bd177312833388c0')

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

    ./autogen.pl

    # append our options to the system config file
    cat ../prte-mca-params.conf >> src/etc/prte-mca-params.conf

    patch -Np1 -i ../0001-Force-32-bits-compile.patch
    patch -Np1 -i ../0002-Unversioned-libs.patch
    patch -Np1 -i ../0003-Remove-getdtablesize.patch
    sed -i 's|-lpthreads||g' configure
    sed -i 's|-lpthread||g' configure

    malloc_fname=prrte_malloc
    mv -f src/util/malloc.h "src/util/${malloc_fname}.h"

    sed -i "s|src/util/malloc.h|src/util/${malloc_fname}.h|g" src/mca/ess/env/ess_env_module.c
    sed -i "s|src/util/malloc.h|src/util/${malloc_fname}.h|g" src/mca/ess/hnp/ess_hnp_module.c
    sed -i "s|src/util/malloc.h|src/util/${malloc_fname}.h|g" src/runtime/prte_init.c
    sed -i "s|src/util/malloc.h|src/util/${malloc_fname}.h|g" src/util/malloc.c
    sed -i "s| malloc.h | ${malloc_fname}.h |g" src/util/Makefile.am
    sed -i "s| malloc.h | ${malloc_fname}.h |g" src/util/Makefile.in
    sed -i "s|rindex|strrchr|g" src/mca/plm/ssh/plm_ssh_module.c
}

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

    # set environment variables for reproducible build
    # see https://docs.prrte.org/en/latest/release-notes.html
    export HOSTNAME=buildhost
    export USER=builduser

    # Platform specific patches
    case "${_android_arch}" in
        aarch64)
             host=armv8-unknown-linux
            ;;
        armv7a-eabi)
             host=armv7-unknown-linux
            ;;
        x86)
             host=x86-unknown-linux
            ;;
        x86-64)
             host=x86_64-unknown-linux
            ;;
        *)
            ;;
    esac

    ./configure \
        --host=${host} \
        --prefix="${ANDROID_PREFIX}" \
        --libdir="${ANDROID_PREFIX_LIB}" \
        --includedir="${ANDROID_PREFIX_INCLUDE}" \
        --enable-shared \
        --enable-static \
        --sysconfdir="${ANDROID_PREFIX_ETC}/prtte" \
        --with-pmix="${ANDROID_PREFIX}" \
        --with-pmix-libdir="${ANDROID_PREFIX_LIB}"
    make V=1 $MAKEFLAGS
}

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

    make DESTDIR="${pkgdir}" install
    rm -f "$pkgdir/${ANDROID_PREFIX_BIN}"/*
    rm -rf "$pkgdir/${ANDROID_PREFIX_SHARE}"
    ${ANDROID_STRIP} -g --strip-unneeded "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.so
    ${ANDROID_STRIP} -g "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.a
    rm -f "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.so.*

    # install our dummy ssh wrapper
    install -vDm 755 ../prrte-ssh -t "$pkgdir/${ANDROID_PREFIX_BIN}/"
}