summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b5bf01eee151db407b7a14ddb04c530e21c4b717 (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
# Maintainer: Juanjo Gutierrez <juanjo at gutierrezdequevedo dot com>

pkgname=tty0tty
pkgver=r31.319c8a2
pkgrel=1
pkgdesc="tty0tty Virtual Serial Cable"
arch=('x86_64' 'aarch64')
url="https://github.com/lcgamboa/tty0tty"
license=('GPL2')
depends=('dkms')
conflicts=("${pkgname}")
source=("git+https://github.com/lcgamboa/tty0tty")
sha256sums=("SKIP")
makedepends=('git')

pkgver() {
  cd "$pkgname"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  # patch udev rules
  sed -i -e "s/dialout/uucp/g" "$pkgname/module/99-tty0tty.rules"
}

build() {
  cd "$pkgname/pts"
  make
}

package() {
  # Copy dkms.conf
  install -D -m 644 "$pkgname/module/dkms.conf" "$pkgdir/usr/src/$pkgname-$pkgver/dkms.conf"

  # Set name and version
  sed -e "s/\#MODULE_VERSION\#/$pkgver/" \
      -i "$pkgdir/usr/src/$pkgname-$pkgver/dkms.conf"

  # Copy sources (including Makefile)
  cp -r "$pkgname/module"/* "$pkgdir/usr/src/$pkgname-$pkgver/"

  # copy udev rules
  install -D -m 644 "$pkgname/module/99-tty0tty.rules" "$pkgdir/usr/lib/udev/rules.d/99-tty0tty.rules"

  # copy user space pts binary
  install -D -m 755 "$pkgname/pts/tty0tty" "$pkgdir/usr/bin/tty0tty"
}