summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 28ecd628c5c492ce3b2e124e30e708d79e50a01d (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
# Maintainer: chenss <ufbycd at 163 dot com>

_pkgbase=openocd-nuvoton
pkgname=${_pkgbase}-git
pkgver=0.9.0.r476.g849799e6
pkgrel=2
pkgdesc='Fork of OpenOCD that has Nuvoton devices support'
arch=('x86_64')
url='https://github.com/OpenNuvoton/OpenOCD-Nuvoton'
license=('GPL')
depends=('libftdi' 'libftdi-compat' 'libusb' 'libusb-compat' 'hidapi' )
makedepends=('git' 'automake>=1.9' 'autoconf>=2.64' 'libtool' 'tcl')
options=()

source=(
    "$pkgname::git+https://github.com/ufbycd/OpenOCD-Nuvoton.git")

md5sums=('SKIP')

# Specify desired features and device support here. A list can be
# obtained by running ./configure in the source directory.
_features=(
    aice
    amtjtagaccel
    armjtagew
    at91rm9200
    bcm2835gpio
    buspirate
    cmsis-dap
    dummy
    ep93xx
    ftdi
    gw16012
    ioutil
    jlink
    jtag_vpi
    legacy-ft2232_libftdi
    oocd_trace
    opendous
    openjtag_ftdi
    osbdm
    parport
    presto_libftdi
    remote-bitbang
    rlink
    stlink
    sysfsgpio
    ti-icdi
    ulink
    usb-blaster-2
    usb_blaster_libftdi
    usbprog
    vsllink
    xlnx_pcie_xvc
    #parport-giveio
    #zy1000
    #zy1000-master
    nulink
    )

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

prepare() {
  cd "$srcdir/$pkgname"
  git submodule init
  git submodule update
}

build() {
  cd "$srcdir/$pkgname"

  ./bootstrap
  ./configure \
    --prefix=/usr \
    --program-suffix=-nuvoton \
    --disable-werror \
    --with-gnu-ld \
    ${_features[@]/#/--enable-}

  make pkgdatadir="/usr/share/$pkgname"
}

package() {
  cd "$srcdir/$pkgname"

  make pkgdatadir="/usr/share/$pkgname" DESTDIR="$pkgdir" install

  mkdir -p "$pkgdir/usr/lib/udev/rules.d"
  mv "$pkgdir/usr/share/$pkgname/contrib/60-openocd-nuvoton.rules" "$pkgdir/usr/lib/udev/rules.d/60-openocd-nulink.rules"
  mv "$pkgdir/usr/share/$pkgname/contrib/99-openocd.rules" "$pkgdir/usr/lib/udev/rules.d/99-${pkgname}.rules"

  rm -r "$pkgdir/usr/share/info"
}

# makepkg --printsrcinfo > .SRCINFO