forked from openXC7/toolchain-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
toolchain-installer.sh
executable file
·92 lines (79 loc) · 1.91 KB
/
toolchain-installer.sh
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
#!/bin/bash
TMPDIR=$(mktemp -d)
cd $TMPDIR
YOSYS_VERSION=0.17
NEXTPNR_VERSION=0.4.0
function cleanup {
cd
rm -rf $TMPDIR
}
if [ ! -x "$(which yosys)" ]
then
wget -c https://github.com/openXC7/yosys-snap/releases/download/v${YOSYS_VERSION}/yosys_${YOSYS_VERSION}_amd64.snap
if [ $? -ne 0 ]
then
echo Downloading yosys package failed.
cleanup
exit 1
fi
sudo snap install --classic --dangerous ./yosys_*.snap
else
echo "Yosys is already installed. Using your current installation"
fi
if [ -d /snap/nextpnr-kintex ]
then
echo removing old toolchain version
snap remove nextpnr-kintex
cleanup
exit 1
fi
if [ -d /snap/openxc7 ]
then
echo openxc7 is already installed. Please remove it first, before running this script!
cleanup
exit 1
fi
wget -c https://github.com/openXC7/openXC7-snap/releases/download/v${NEXTPNR_VERSION}/openxc7_${NEXTPNR_VERSION}_amd64.snap
if [ $? -ne 0 ]
then
echo Downloading openxc7 package failed.
cleanup
exit 1
fi
sudo snap install --classic --dangerous ./openxc7_*.snap
if [ $? -ne 0 ]
then
echo installing openxc7 package failed.
cleanup
exit 1
fi
if [ ! -x "$(which nextpnr-xilinx)" ]
then
sudo snap alias openxc7.nextpnr-xilinx nextpnr-xilinx
else
echo nextpnr-xilinx already exists, refraining from creating an alias
fi
if [ ! -x "$(which bbasm)" ]
then
sudo snap alias openxc7.bbasm bbasm
else
echo bbasm already exists, refraining from creating an alias
fi
if [ ! -x "$(which fasm2frames)" ]
then
sudo snap alias openxc7.fasm2frames fasm2frames
else
echo fasm2frames already exists, refraining from creating an alias
fi
if [ ! -x "$(which xc7frames2bit)" ]
then
sudo snap alias openxc7.xc7frames2bit xc7frames2bit
else
echo xc7frames2bit already exists, refraining from creating an alias
fi
if [ ! -x "$(which bit2fasm)" ]
then
sudo snap alias openxc7.bit2fasm bit2fasm
else
echo bit2fasm already exists, refraining from creating an alias
fi