summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e85f5fdcf320b959f50efa1768e871022acd630d (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
# Maintainer: taotieren <admin@taotieren.com>

pkgbase=openarm-can
pkgname=(openarm-can python-openarm-can)
pkgver=1.2.8
pkgrel=1
pkgdesc='A C++ library for CAN communication with OpenArm robotic hardware, supporting Damiao motors over CAN/CAN-FD interfaces.'
arch=($CARCH)
url='https://github.com/enactic/openarm_can'
license=('Apache-2.0')
replaces=()
depends=(
  sh
  libgcc
  libstdc++
  glibc
  python
  python-can
  python-numpy
)
makedepends=(
  cmake
  git
  gtest
  ninja
  pkgconf

  nanobind
  python-build
  python-installer
  python-wheel
  python-scikit-build-core
  python-setuptools
)
checkdepends=()
optdepends=()
source=("${pkgbase}::git+${url}.git#tag=${pkgver}")
sha256sums=('48ba51cac67e61ec62ba409fd86595aa844881bb1b47703fc97d506a9ab5ac60')

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

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

  # see:https://wiki.archlinux.org/title/CMake_package_guidelines 
  cmake -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBEXECDIR=lib \
    -DBUILD_SHARED_LIBS=ON \
    -Wno-dev \
    -B build \
    -G Ninja

  ninja -C build
  cd "${srcdir}/${pkgbase}/python"
  python -m build --wheel --no-isolation
}

# check() {
#   cd "${srcdir}"/${pkgbase}/
#   ctest --test-dir build --output-on-failure
# }

package_openarm-can() {
  # pkgdesc
  provides=(
    ${pkgname}
  )
  conflicts=(
    ${pkgname}
  )
  depends=(
    sh
    libgcc
    libstdc++
    glibc
    python
    python-can
    python-numpy
    python-openarm-can
  )
  arch=($CARCH)

  cd "${srcdir}"/${pkgbase}
  DESTDIR="${pkgdir}" ninja -C build install
  install -Dm644 "LICENSE.txt" -t "${pkgdir}/usr/share/licenses/${pkgname}/"
}

package_python-openarm-can() {
  pkgdesc="This is the Python bindings of OpenArm CAN library."
  provides=(
    ${pkgname}
  )
  conflicts=(
    ${pkgname}
  )
  depends=(
    libgcc
    libstdc++
    glibc
  )
  arch=($CARCH)

  cd "${srcdir}/${pkgbase}/python"
  python -m installer --destdir="${pkgdir}" dist/*.whl
  install -vDm 644 LICENSE.txt -t "$pkgdir/usr/share/licenses/$pkgname/"
}