summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: eb7a07a4cfc38a87f1dc80feb8953875e4c888fd (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
# Maintainer: Peter Ivanov <ivanovp@gmail.com>
# Contributor: Aki-nyan <aur@catgirl.link>

_pkgname=nextpnr-xilinx
pkgname=$_pkgname-git
pkgver=r2994.f7938759
pkgrel=1
epoch=2
pkgdesc="nextpnr portable FPGA place and route tool - for Xilinx"
arch=(x86_64)
url="https://github.com/gatecat/$_pkgname"
license=("custom:ISC")
groups=()
depends=(
	"python"
	"boost-libs"
)
optdepends=()
makedepends=("git" "gcc" "cmake" "pkgconf" "gawk" "eigen" "boost" "prjxray-db>=r258" "pypy3")
conflicts=(
	"nextpnr"
)
replaces=()
source=(
	"$_pkgname::git+$url"
	"nextpnr-xilinx-meta::git+https://github.com/gatecat/nextpnr-xilinx-meta.git"
)
sha256sums=('SKIP'
            'SKIP')
_DEVICES=(
	"xc7a100tcsg324-1"
	"xc7a100tfgg676-1"
	"xc7a200tffg1156-1"
	"xc7a200tsbg484-1"
	"xc7a35tcpg236-1"
	"xc7a35tcsg324-1"
	"xc7a35tftg256-1"
	"xc7a50tfgg484-1"
)

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

prepare() {
	cd "$_pkgname"
}

build() {
	cmake -S "$_pkgname" -B build \
		-DARCH=xilinx \
		-DBUILD_TESTS=ON \
		-DBUILD_PYTHON=OFF \
		-DBUILD_GUI=OFF \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DUSE_OPENMP=ON

	make -C build

	echo "Generating device database, it will take some time, have a coffee..."

	mkdir -p devicedbs
	for i in "${_DEVICES[@]}"; do
		echo "### Generating device $i ###"
		pypy3 "$_pkgname"/xilinx/python/bbaexport.py --xray /usr/share/xray/database/artix7 --meta "$srcdir/nextpnr-xilinx-meta/artix7" --device "$i" --bba "devicedbs/$i.bba"
		build/bba/bbasm --le "devicedbs/$i.bba" "devicedbs/$i.bin"
	done
}

check() {
	make -C build test
}

package() {
	make -C build DESTDIR="${pkgdir}" install

	install -Dm644 "$_pkgname/COPYING" "${pkgdir}/usr/share/licenses/$pkgname/COPYING"
	for i in "${_DEVICES[@]}"; do
		install -Dm644 "devicedbs/$i.bin" "${pkgdir}/usr/share/nextpnr/xilinx-chipdb/$i.bin"
	done
}

# vim: set noet: