summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0a986176af40cc28618c674eb8a68aa22c24bdff (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
# Maintainer: Stefan Tatschner <stefan@sevenbyte.org>
# Maintainer: taotieren <admin@taotieren.com>

pkgbase=can-utils-git
pkgname=can-utils-git
pkgver=2023.03.r233.g6526683
pkgrel=5
groups=()
pkgdesc="Linux-CAN / SocketCAN user space applications"
arch=($CARCH)
url="https://github.com/linux-can/can-utils"
license=('GPL-2.0-only' 'BSD-3-Clause')
provides=(${pkgname%-git})
conflicts=(${pkgname%-git})
depends=(glibc
    bash)
makedepends=(git
    cmake
    ninja)
optdepends=("can-doc: Linux-CAN / SocketCAN documentation"
    "can-isotp-dkms: Kernel modules for isotp")
source=("${pkgname}::git+${url}.git")
sha256sums=('SKIP')

pkgver() {
    cd "${srcdir}/${pkgname}"
    git describe --long --tags | sed 's/^v//g' | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
    git -C "${srcdir}/${pkgname}" clean -dfx
}

build() {
    cd "${srcdir}/${pkgname}"
    sed -i "s|sbin|bin|g" mcp251xfd/99-devcoredump.rules

    cmake -D CMAKE_BUILD_TYPE=None \
        -D CMAKE_INSTALL_PREFIX=/usr \
        -D CMAKE_INSTALL_LIBDIR=lib \
        -B build \
        -G Ninja

    ninja -C build
}

package() {
    DESTDIR="${pkgdir}" ninja -C "${srcdir}"/${pkgname}/build install

    install -Dm0755 "${srcdir}/${pkgname}/mcp251xfd/devcoredump" -t "${pkgdir}/usr/bin/"
    install -Dm0644 "${srcdir}/${pkgname}/mcp251xfd/99-devcoredump.rules" -t "${pkgdir}/usr/lib/udev/rules.d/"
    install -Dm0644 "${srcdir}/${pkgname}"/*.md -t "${pkgdir}/usr/share/doc/${pkgname%-git}/"
}