summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0a23fa696484a2391415492c0a97d5c346bed31f (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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# Maintainer: taotieren <admin@taotieren.com>

pkgbase=icesugar-git
pkgname=(
    icesugar-git
    icesugar-dapprog-git
    icesugar-demo-git
    icesugar-doc-git
    icesugar-icesprog-git
    icesugar-nano-git
    icesugar-nano-demo-git
    icesugar-nano-doc-git
    icesugar-pro-git
    icesugar-pro-demo-git
    icesugar-pro-doc-git
)
pkgver=1.1a.r27.g2abb4c7
pkgrel=8
epoch=
pkgdesc="iCESugar FPGA Board (base on iCE40UP5k) "
arch=(x86_64
    aarch64
    riscv64)
url="https://github.com/wuxx/icesugar"
license=('GPL')
groups=()
depends=(
    gcc-libs
    glibc
    hidapi
    libcap
    libusb
    systemd-libs)
makedepends=(
    git
    pkgconf)
checkdepends=()
optdepends=()
replaces=()
backup=()
options=('!strip')
install=
changelog=
source=("${pkgbase}::git+${url}.git"
    "${pkgbase/git/pro}::git+${url}-pro.git"
    "${pkgbase/git/nano}::git+${url}-nano.git")
noextract=()
sha256sums=('SKIP'
    'SKIP'
    'SKIP')
#validpgpkeys=()

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

prepare() {
    git -C "${srcdir}/${pkgbase}" clean -dfx
    rm -rf "${srcdir}/${pkgbase}/tools/src/icesprog"
}

build() {
    cd "${srcdir}/${pkgbase}/tools/src"
    head -n 18 icesprog.c >LICENSE
    make
}

# check() {
#     cd "${srcdir}/${pkgbase}/tools/src"
#     make test1
#     make test2
#     make test3
# }

package_icesugar-git() {
    pkgdesc+=" - Development Environments"
    provides=(${pkgname%-git})
    conflicts=(${pkgname%-git})
    arch=(any)
    depends=(
        #         arachne-pnr
        icesugar-demo
        icesugar-doc
        icesugar-icesprog
        icestorm
        #         icestorm-nightly
        nextpnr
        #         nextpnr-ice40-nightly
        riscv64-linux-gnu-gcc
        sbt
        yosys
        #         yosys-nightly
    )
}

package_icesugar-demo-git() {
    pkgdesc+=" - demo & firmware"
    provides=(${pkgname%-git})
    conflicts=(${pkgname%-git})
    arch=(any)

    cd ${srcdir}/${pkgbase}
    install -dm0755 "${pkgdir}/usr/share/${pkgbase%-git}"
    cp -rva demo firmware "${pkgdir}/usr/share/${pkgbase%-git}/"
}

package_icesugar-doc-git() {
    pkgdesc+=" - doc & schematic"
    provides=(${pkgname%-git})
    conflicts=(${pkgname%-git})
    arch=(any)

    cd ${srcdir}/${pkgbase}
    install -dm0755 "${pkgdir}/usr/share/${pkgbase%-git}"
    cp -rva doc schematic "${pkgdir}/usr/share/${pkgbase%-git}/"
}

package_icesugar-icesprog-git() {
    pkgdesc+=" - icesprog"
    provides=(${pkgname%-git} icesprog)
    conflicts=(${pkgname%-git} icesprog)
    arch=(aarch64
        x86_64
        riscv64)
    depends=(
        gcc-libs
        glibc
        hidapi
        libcap
        libusb
        systemd-libs)
    optdepends=(
        'openocd: Debugging, in-system programming and boundary-scan testing for embedded target devices')

    cd "${srcdir}/${pkgbase}/tools/src"
    install -Dm0755 icesprog -t "${pkgdir}/usr/bin"
    install -Dm0644 README.md -t "${pkgdir}/usr/share/${pkgbase%-git}/icesprog"
    install -Dm0644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgbase%-git}"
    install -Dm0644 60-icesugar.rules -t "${pkgdir}/usr/lib/udev/rules.d/"
}

package_icesugar-nano-git() {
    pkgdesc+="iCESugar-nano FPGA board (base on iCE40LP1K) -  Development Environments"
    provides=(${pkgname%-git})
    conflicts=(${pkgname%-git})
    arch=(any)
    depends=(
        #         arachne-pnr
        icesugar-icesprog
        icesugar-nano-demo
        icesugar-nano-doc
        icestorm
        #         icestorm-nightly
        nextpnr
        #         nextpnr-ice40-nightly
        riscv64-linux-gnu-gcc
        sbt
        yosys
        #         yosys-nightly
    )
}

package_icesugar-nano-demo-git() {
    pkgdesc="iCESugar-nano FPGA board (base on iCE40LP1K) - demo & firmware"
    provides=(${pkgname%-git})
    conflicts=(${pkgname%-git})
    arch=(any)

    cd ${srcdir}/${pkgbase/git/nano}
    install -dm0755 "${pkgdir}/usr/share/${pkgbase/git/nano}"
    cp -rva demo firmware "${pkgdir}/usr/share/${pkgbase/git/nano}/"
}

package_icesugar-nano-doc-git() {
    pkgdesc="iCESugar-nano FPGA board (base on iCE40LP1K) - doc & schematic"
    provides=(${pkgname%-git})
    conflicts=(${pkgname%-git})
    arch=(any)

    cd ${srcdir}/${pkgbase/git/nano}
    install -dm0755 "${pkgdir}/usr/share/${pkgbase/git/nano}"
    cp -rva doc schematic "${pkgdir}/usr/share/${pkgbase/git/nano}/"
}

package_icesugar-pro-git() {
    pkgdesc+="iCESugar-pro is a FPGA board base on Lattice LFE5U-25F-6BG256C -  Development Environments"
    provides=(${pkgname%-git})
    conflicts=(${pkgname%-git})
    arch=(any)
    depends=(
        #         arachne-pnr
        dtc
        icesugar-dapprog
        icesugar-icesprog
        icesugar-pro-demo
        icesugar-pro-doc
        icestorm
        #         icestorm-nightly
        nextpnr
        #         nextpnr-ice40-nightly
        riscv64-linux-gnu-gcc
        sbt
        yosys
        #         yosys-nightly
    )
}

package_icesugar-pro-demo-git() {
    pkgdesc="iCESugar-pro is a FPGA board base on Lattice LFE5U-25F-6BG256C - demo & firmware"
    provides=(${pkgname%-git})
    conflicts=(${pkgname%-git})
    arch=(any)

    cd ${srcdir}/${pkgbase/git/pro}
    install -dm0755 "${pkgdir}/usr/share/${pkgbase/git/pro}"
    cp -rva demo firmware "${pkgdir}/usr/share/${pkgbase/git/pro}/"
}

package_icesugar-pro-doc-git() {
    pkgdesc="iCESugar-pro is a FPGA board base on Lattice LFE5U-25F-6BG256C - doc & schematic"
    provides=(${pkgname%-git})
    conflicts=(${pkgname%-git})
    arch=(any)

    cd ${srcdir}/${pkgbase/git/pro}
    install -dm0755 "${pkgdir}/usr/share/${pkgbase/git/pro}"
    cp -rva doc schematic "${pkgdir}/usr/share/${pkgbase/git/pro}/"
}

package_icesugar-dapprog-git() {
    pkgdesc+="iCESugar-pro is a FPGA board base on Lattice LFE5U-25F-6BG256C - dapprog"
    provides=(${pkgname%-git} dapprog)
    conflicts=(${pkgname%-git} dapprog)
    depends=(openocd)
    arch=(aarch64 x86_64)

    cd "${srcdir}/${pkgbase/git/pro}"
    install -dm0755 "${pkgdir}/usr/share/${pkgbase/git/pro}"
    cp -rva tools "${pkgdir}/usr/share/${pkgbase/git/pro}/"
    install -Dm0755 /dev/stdin "${pkgdir}/usr/bin/dapprog" <<EOF
#!/bin/bash

cd /usr/share/icesugar-pro/tools

CURRENT_DIR=\$(pwd)
export PATH=\${PATH}:\${CURRENT_DIR}

./dapprog \$@
EOF
}