blob: 07245112189932a0857344e4e1758f11117bac63 (
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
# Maintainer:
# Contributor: xiretza <xiretza+aur@xiretza.xyz>
# Contributor: Richard Petri <git@rpls.de>
# Contributor: Graham Edgecombe <gpe@grahamedgecombe.com>
_ARCHS=('ecp5' 'ice40' 'gowin' 'himbaechel' 'nexus' 'generic')
_pkgname="nextpnr"
pkgname="$_pkgname-git"
pkgver=0.7.r158.g17943a5
pkgrel=1
pkgdesc='Portable FPGA place and route tool'
url='https://github.com/YosysHQ/nextpnr'
license=('ISC')
arch=('i686' 'x86_64')
depends=(
'boost-libs'
'python'
'qt5-base'
)
makedepends=(
'boost'
'cmake'
'eigen'
'git'
'ninja'
)
provides=("nextpnr=$pkgver")
conflicts=('nextpnr')
_source_main() {
_pkgsrc="$_pkgname"
source=("$_pkgsrc"::"git+$url.git")
sha256sums=('SKIP')
}
_source_nextpnr() {
local _sources_add=(
#'corrosion-rs.corrosion'::'git+https://github.com/corrosion-rs/corrosion.git'
#'gatecat.nextpnr-xilinx-meta'::'git+https://github.com/gatecat/nextpnr-xilinx-meta.git'
'yosyshq.nextpnr-tests'::'git+https://github.com/YosysHQ/nextpnr-tests.git'
)
local _p
for _p in ${_sources_add[@]}; do
source+=("$_p")
sha256sums+=('SKIP')
done
_prepare_nextpnr() (
cd "$srcdir/$_pkgsrc"
local _submodules=(
#'corrosion-rs.corrosion'::'3rdparty/corrosion'
#'gatecat.nextpnr-xilinx-meta'::'himbaechel/uarch/xilinx/meta'
'yosyshq.nextpnr-tests'::'tests'
)
_submodule_update
)
}
_source_main
_source_nextpnr
pkgver() {
cd "$_pkgsrc"
git describe --long --tags --abbrev=7 \
| sed -E 's/^[^0-9]*//;s/([^-]*-g)/r\1/;s/-/./g'
}
prepare() {
_submodule_update() {
local _module
for _module in "${_submodules[@]}"; do
git submodule init "${_module##*::}"
git submodule set-url "${_module##*::}" "$srcdir/${_module%%::*}"
git -c protocol.file.allow=always submodule update "${_module##*::}"
done
}
_prepare_nextpnr
}
build() {
local _cmake_options=(
-B build
-S "$_pkgsrc"
-G Ninja
-DCMAKE_BUILD_TYPE=None
-DCMAKE_INSTALL_PREFIX='/usr'
-DUSE_OPENMP=ON
-DUSE_IPO=OFF
-DBUILD_GUI=ON
-DBUILD_TESTS=ON
-Wno-dev
-DARCH=$(
IFS=';'
echo "${_ARCHS[*]}"
)
"${_CONFIG[@]}"
)
cmake "${_cmake_options[@]}"
cmake --build build
}
check() {
ctest --test-dir build --output-on-failure
}
package() {
DESTDIR="$pkgdir" cmake --install build
install -Dm644 "$_pkgsrc"/COPYING -t "$pkgdir/usr/share/licenses/$pkgname/"
}
_CONFIG=()
for _arch in ${_ARCHS[@]}; do
case $_arch in
ice40)
makedepends+=(
'icestorm' # AUR
)
_CONFIG+=('-DICESTORM_INSTALL_PREFIX=/usr')
;;
ecp5)
makedepends+=(
'prjtrellis'
'prjtrellis-db>=r269' # AUR
)
_CONFIG+=('-DTRELLIS_INSTALL_PREFIX=/usr')
;;
nexus)
makedepends+=(
'prjoxide' # AUR
)
_CONFIG+=('-DOXIDE_INSTALL_PREFIX=/usr')
;;
gowin)
makedepends=(
${makedepends[@]//prjapicula/}
'prjapicula' # AUR
)
_CONFIG+=('-DGOWIN_BBA_EXECUTABLE=/usr/bin/gowin_bba')
;;
himbaechel)
makedepends=(
${makedepends[@]//prjapicula/}
'prjapicula' # AUR
)
_CONFIG+=('-DHIMBAECHEL_UARCH=gowin')
;;
generic)
# NOOP
;;
*)
echo "Unhandled architecture: $_arch" >&2
exit 1
;;
esac
done
|