summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 14d26d9d08c203aff14fc9e7be2c78a059a5cfc0 (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
#!/usr/bin/bash
# shellcheck disable=SC2034,SC2154,SC2164
pkgname=('rdma-core-git')
_srcname='rdma-core'
pkgdesc='RDMA core userspace libraries and daemons'
pkgver='r6882'
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' 'pandoc' 'python' 'python-docutils')
_provides=('rdma' 'ibacm' 'libiwpm' 'libibcm' 'libibumad' 'libibverbs'
           'librdmacm' 'libcxgb3' 'libcxgb4' 'libmlx4' 'libmlx5' 'libmthca' 'libnes' 'libocrdma'
           'srptools' 'infiniband-diags' 'libibmad')
provides=("${pkgname[0]%-git}" "${_provides[@]}")
conflicts=("${pkgname[0]%-git}" "${_provides[@]}")
replaces=("${_provides[@]}")
backup=('etc/rdma/'{'rmda.conf','mlx4.conf','sriov-vfs'})

source=("${_srcname}::git+${url}.git")
sha512sums=('SKIP')

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

    printf 'r%s.%s.%s\n' \
        "$( git rev-list --count 'HEAD' )" \
        "$( git log --max-count='1' --pretty='format:%ct' )" \
        "$( git rev-parse --short 'HEAD' )"
}

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' \
        '{}' '+'
}

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"
}