summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: eddbf5acb5aa3c3c4ee743903f826ea099488deb (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
# Maintainer: xiretza <xiretza+aur@xiretza.xyz>
# Contributor: Richard Petri <git@rpls.de>
# Contributor: Graham Edgecombe <gpe@grahamedgecombe.com>
_ARCHS=('generic' 'ice40' 'ecp5' 'nexus' 'gowin' 'himbaechel')

pkgname=nextpnr-git
pkgver=0.7.r29.gf0859503
pkgrel=1
pkgdesc='Portable FPGA place and route tool'
arch=('i686' 'x86_64')
url='https://github.com/YosysHQ/nextpnr'
license=('custom:ISC')
depends=('boost-libs' 'python' 'qt5-base')
makedepends=('boost' 'cmake' 'eigen' 'git')
provides=("nextpnr=$pkgver")
conflicts=('nextpnr')
source=('nextpnr::git+https://github.com/YosysHQ/nextpnr.git')
sha256sums=('SKIP')

_CONFIG=()
for _arch in ${_ARCHS[@]}; do
  case $_arch in
    ice40)
      makedepends+=('icestorm')
      _CONFIG+=('-DICESTORM_INSTALL_PREFIX=/usr')
      ;;
    ecp5)
      # FIXME once prjtrellis-db-git has versioned provides=
      makedepends+=('prjtrellis' 'prjtrellis-db-git>=r269.566c78d')
      _CONFIG+=('-DTRELLIS_INSTALL_PREFIX=/usr')
      ;;
    nexus)
      makedepends+=('prjoxide')
      _CONFIG+=('-DOXIDE_INSTALL_PREFIX=/usr')
      ;;
    gowin)
      makedepends+=('prjapicula')
      _CONFIG+=('-DGOWIN_BBA_EXECUTABLE=/usr/bin/gowin_bba')
      ;;
    himbaechel)
      makedepends+=('prjapicula')
      _CONFIG+=('-DHIMBAECHEL_GOWIN_DEVICES=all')
      ;;
    generic)
      ;;
    *)
      echo "Unhandled architecture: $_arch" >&2
      exit 1
      ;;
  esac
done

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

build() {
  cd "$srcdir/nextpnr"

  mkdir -p build
  cd build

  cmake \
    -DARCH=$(IFS=\;; echo "${_ARCHS[*]}") \
    "${_CONFIG[@]}" \
    -DBUILD_TESTS=ON \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DUSE_OPENMP=ON \
    -DUSE_IPO=OFF \
    -DBUILD_GUI=ON \
    ..
  make
}

check() {
  cd "$srcdir/nextpnr/build"
  make test
}

package() {
  cd "$srcdir/nextpnr/build"
  make DESTDIR="$pkgdir" install
  install -Dm644 ../COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"
}

# vim: set et ts=2: