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

pkgname=nextpnr-xilinx-git
pkgver=cd8b15d_20211117
pkgrel=1
epoch=1
pkgdesc="nextpnr portable FPGA place and route tool - for Xilinx"
arch=("any")
url="https://github.com/gatecat/nextpnr-xilinx"
license=("custom:ISC")
groups=()
options=("!strip")
depends=(
	"python"
	"boost-libs"
)
optdepends=()
makedepends=("git" "gcc" "cmake" "ninja" "pkgconf" "gawk" "eigen" "boost" "pypy3")
conflicts=(
	"nextpnr-git"
)
replaces=()
source=(
	"nextpnr::git+https://github.com/gatecat/nextpnr-xilinx.git"
)
sha256sums=(
	"SKIP"
)
_DEVICES=(
        "xc7a100tcsg324-1"
        "xc7a100tfgg676-1"
        "xc7a200tffg1156-1"
        "xc7a200tsbg484-1"
        "xc7a35tcpg236-1"
        "xc7a35tcsg324-1"
        "xc7a35tftg256-1"
        "xc7a50tfgg484-1"
)

_PREFIX="/usr"
prepare() {
	cd "${srcdir}/nextpnr"
    git submodule init
    git submodule update
	[ ! -d "${srcdir}/nextpnr/build-xilinx" ] && mkdir build-xilinx
	cd ..
}

build() {
	cd "${srcdir}/nextpnr"
	cd build-xilinx
		cmake -G Ninja        \
			-DARCH=xilinx     \
			-DBUILD_PYTHON=OFF \
			-DBUILD_GUI=OFF    \
			-DCMAKE_BUILD_TYPE=RelWithDebInfo \
			-DCMAKE_INSTALL_PREFIX=${_PREFIX} \
			-DUSE_OPENMP=ON	\
			..
	cd ..
	ninja -C build-xilinx
#    echo "Generating device xc7a35t"
#    [ ! -f "xilinx/xc7a35t.bba" ] && python3 xilinx/python/bbaexport.py --device xc7a35tcsg324-1 --bba xilinx/xc7a35t.bba
#    [ ! -f "xilinx/xc7a35t.bin" ] && build-xilinx/bbasm --l xilinx/xc7a35t.bba xilinx/xc7a35t.bin
    echo "Generating device database, it will take some time, have a coffee..."
    for i in ${_DEVICES[@]}; do
        echo "### Generating device $i ###"
        [ ! -f "xilinx/$i.bba" ] && pypy3 xilinx/python/bbaexport.py --device $i --bba xilinx/$i.bba
        [ ! -f "xilinx/$i.bin" ] && build-xilinx/bbasm --l xilinx/$i.bba xilinx/$i.bin
    done
    cd ..
}

package() {
	cd "${srcdir}/nextpnr"
	DESTDIR="${pkgdir}" PREFIX="${_PREFIX}" ninja -C build-xilinx install
	install -Dm644 "${srcdir}/nextpnr/COPYING" "${pkgdir}${_PREFIX}/share/licenses/nextpnr-xilinx/COPYING"
    for i in ${_DEVICES[@]}; do
        install -Dm644 "${srcdir}/nextpnr/xilinx/$i.bin" "${pkgdir}${_PREFIX}/share/nextpnr/xilinx-chipdb/$i.bin"
    done
    ln -s "xc7a35tcsg324-1.bin" "${pkgdir}${_PREFIX}/share/nextpnr/xilinx-chipdb/xc7a35t.bin"
	cd ..
}