summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8df3bbf6860a46aedb229bd65def28da4685f467 (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
#!/usr/bin/bash
# shellcheck disable=SC2034,SC2154,SC2164
pkgname=('rdma-core-no-pandoc')
_srcname='rdma-core'
pkgdesc='RDMA core userspace libraries and daemons'
pkgver='31.2'
_tag="v${pkgver}"
pkgrel='1'
arch=('x86_64')
url="https://github.com/linux-rdma/${_srcname}"
license=('GPL2' 'custom:OpenIB.org BSD (MIT variant)')

depends=('libnl' 'ethtool')
makedepends=('git' 'cmake' 'gcc' 'libsystemd' 'systemd' 'pkg-config' 'ninja' 'bash')
_provides=('rdma' 'ibacm' 'libiwpm' 'libibcm' 'libibumad' 'libibverbs'
           'librdmacm' 'libcxgb3' 'libcxgb4' 'libmlx4' 'libmlx5' 'libmthca' 'libnes' 'libocrdma'
           'srptools' 'infiniband-diags' 'libibmad')
provides=("rdma-core" "${_provides[@]}")
conflicts=("rdma-core" "${_provides[@]}")
backup=('etc/rdma/'{'rmda.conf','mlx4.conf','sriov-vfs'})

source=("${_srcname}::git+${url}.git#tag=${_tag}")
sha512sums=('SKIP')
validpgpkeys=('921AFFAF83A9D7FD38CAA681E4637B88367258A7'  # leon@leon.nu
              '42D25385C1A1C02B8B1B1C6F801BDDB825988F64') # nicolas@morey-chaisemartin.com

prepare() {
    cd "${srcdir}/${_srcname}"

    find redhat -type f -exec sed --in-place \
        --expression='s|/usr/libexec|/usr/lib/rdma|g' \
        --expression='s|/usr/sbin|/usr/bin|g' \
        --expression='s|/sbin|/usr/bin|g' \
        '{}' '+'

    sed -i '/^\s.*$/d' buildlib/rdma_man.cmake
}

build() {
    cd "${srcdir}/${_srcname}"

    mkdir build
    cd build
    cmake \
        -GNinja \
        -DENABLE_VALGRIND=0 \
        -DCMAKE_BUILD_TYPE='Release' \
        -DCMAKE_INSTALL_PREFIX='/usr' \
        -DCMAKE_INSTALL_RUNDIR='/run' \
        -DCMAKE_INSTALL_SBINDIR='/usr/bin' \
        -DCMAKE_INSTALL_LIBDIR='/usr/lib' \
        -DCMAKE_INSTALL_LIBEXECDIR='/usr/lib/rdma' \
        -DCMAKE_INSTALL_SYSCONFDIR='/etc' \
        -DCMAKE_INSTALL_PERLDIR='/usr/share/perl5/vendor_perl' \
        ..
    ninja
}

package() {
    cd "${srcdir}/${_srcname}/build"
    export DESTDIR="${pkgdir}"
    ninja install

    rm --recursive "${pkgdir}/etc/init.d"

    cd "${srcdir}/${_srcname}/redhat"
    install -D --mode=0644 rdma.conf "${pkgdir}/etc/rdma/rdma.conf"
    install -D --mode=0755 rdma.kernel-init "${pkgdir}/usr/lib/rdma/rdma-init-kernel"
    install -D --mode=0755 rdma.mlx4-setup.sh "${pkgdir}/usr/lib/rdma/mlx4-setup.sh"
    install -D --mode=0644 rdma.mlx4.conf "${pkgdir}/etc/rdma/mlx4.conf"
    install -D --mode=0644 rdma.mlx4.sys.modprobe "${pkgdir}/usr/lib/modprobe.d/libmlx4.conf"
    install -D --mode=0755 rdma.modules-setup.sh "${pkgdir}/usr/lib/dracut/modules.d/05rdma/module-setup.sh"
    install -D --mode=0644 rdma.service "${pkgdir}/usr/lib/systemd/system/rdma.service"
    install -D --mode=0755 rdma.sriov-init "${pkgdir}/usr/lib/rdma/rdma-set-sriov-vf"
    install -D --mode=0644 rdma.sriov-vfs "${pkgdir}/etc/rdma/sriov-vfs"
    install -D --mode=0644 rdma.udev-rules "${pkgdir}/usr/lib/udev/rules.d/98-rdma.rules"

    cd "${srcdir}/${_srcname}"
    install -D --mode=0644 COPYING.BSD_MIT "${pkgdir}/usr/share/licenses/${pkgname[0]%-git}/COPYING.BSD_MIT"
}