2019-08-17 14:06:39 +00:00
|
|
|
#!/bin/sh -x
|
2019-08-20 11:00:53 +00:00
|
|
|
set -e
|
2019-08-17 14:06:39 +00:00
|
|
|
|
2020-10-10 23:34:23 +00:00
|
|
|
win_openfpgatoolchain_url="https://github.com/open-tool-forge/fpga-toolchain/releases/download/nightly-20201010/fpga-toolchain-windows_amd64-nightly-20201010.zip"
|
2020-03-28 07:01:45 +00:00
|
|
|
win_wishbone_tool_url="https://github.com/litex-hub/wishbone-utils/releases/download/v0.6.10/wishbone-tool-v0.6.10-x86_64-pc-windows-gnu.tar.gz"
|
2019-10-25 12:02:48 +00:00
|
|
|
win_riscv_url="https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-w64-mingw32.zip"
|
2020-02-22 01:09:07 +00:00
|
|
|
win_make_url="https://sourceforge.net/projects/ezwinports/files/make-4.3-without-guile-w32-bin.zip/download"
|
2019-08-17 14:06:39 +00:00
|
|
|
win_teraterm_url="https://osdn.net/frs/redir.php?m=constant&f=ttssh2%2F71232%2Fteraterm-4.103.zip"
|
|
|
|
|
2020-10-10 23:34:23 +00:00
|
|
|
mac_openfpgatoolchain_url="https://github.com/open-tool-forge/fpga-toolchain/releases/download/nightly-20201010/fpga-toolchain-darwin-nightly-20201010.tar.xz"
|
2020-03-28 07:01:45 +00:00
|
|
|
mac_wishbone_tool_url="https://github.com/litex-hub/wishbone-utils/releases/download/v0.6.10/wishbone-tool-v0.6.10-x86_64-apple-darwin.tar.gz"
|
2019-10-25 12:02:48 +00:00
|
|
|
mac_riscv_url="https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-apple-darwin.tar.gz"
|
2019-08-17 14:06:39 +00:00
|
|
|
|
2020-10-10 23:34:23 +00:00
|
|
|
linux_openfpgatoolchain_url="https://github.com/open-tool-forge/fpga-toolchain/releases/download/nightly-20201010/fpga-toolchain-linux_x86_64-nightly-20201010.tar.xz"
|
2020-03-28 07:01:45 +00:00
|
|
|
linux_wishbone_tool_url="https://github.com/litex-hub/wishbone-utils/releases/download/v0.6.10/wishbone-tool-v0.6.10-x86_64-unknown-linux-gnu.tar.gz"
|
2019-10-25 12:02:48 +00:00
|
|
|
linux_riscv_url="https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-centos6.tar.gz"
|
2019-08-17 14:06:39 +00:00
|
|
|
|
|
|
|
base="$(pwd)"
|
2020-10-10 11:21:49 +00:00
|
|
|
output_name="fomu-toolchain-${ARCH}"
|
2019-08-17 14:06:39 +00:00
|
|
|
output="${base}/output/${output_name}"
|
|
|
|
input="${base}/input"
|
2019-08-21 22:45:03 +00:00
|
|
|
|
2019-08-17 14:06:39 +00:00
|
|
|
mkdir -p $output
|
|
|
|
mkdir -p $input
|
|
|
|
mkdir -p $output/bin
|
|
|
|
|
2019-08-21 22:45:03 +00:00
|
|
|
checksum_output() {
|
|
|
|
set +x
|
|
|
|
hashes="sha1 sha256 sha512"
|
|
|
|
local outfile hashfile
|
2019-12-29 23:38:07 +00:00
|
|
|
cd "$(dirname $output)"
|
|
|
|
outfile=$(basename "$output$1")
|
2019-08-21 22:45:03 +00:00
|
|
|
|
|
|
|
for hash in $hashes ; do
|
|
|
|
hashfile=$outfile.$hash
|
|
|
|
${hash}sum $outfile > $hashfile
|
|
|
|
echo -n "$hash: " ; cat $hashfile
|
|
|
|
done
|
|
|
|
set -x
|
|
|
|
}
|
|
|
|
|
2020-10-10 15:02:45 +00:00
|
|
|
extract_zip() {
|
|
|
|
wget -O "$2" "$1"
|
|
|
|
cd $output"$3"
|
|
|
|
unzip -o "$2"
|
|
|
|
}
|
|
|
|
|
2019-08-17 14:06:39 +00:00
|
|
|
case "${ARCH}" in
|
2020-10-10 11:21:49 +00:00
|
|
|
"Windows")
|
2020-10-10 23:34:23 +00:00
|
|
|
# Open FPGA toolchain
|
|
|
|
wget -O $input/openfpgatoolchain-${ARCH}.zip $win_openfpgatoolchain_url
|
|
|
|
unzip $input/openfpgatoolchain-${ARCH}.zip
|
|
|
|
mv fpga-toolchain/* $output/
|
2019-08-17 14:06:39 +00:00
|
|
|
|
|
|
|
# Teraterm Terminal
|
2020-10-10 15:02:45 +00:00
|
|
|
extract_zip $win_teraterm_url $input/teraterm-${ARCH}.zip "/bin"
|
2019-08-17 14:06:39 +00:00
|
|
|
|
|
|
|
# Wishbone Tool
|
2020-10-10 14:57:16 +00:00
|
|
|
curl -fsSL $win_wishbone_tool_url | tar xvzf - -C $output/bin
|
2019-08-17 14:06:39 +00:00
|
|
|
|
|
|
|
# Riscv Toolchain
|
|
|
|
# Note that we want to strip the front part of the path.
|
|
|
|
# Also, we do "cp -l" then "rm -rf" to merge the directories.
|
|
|
|
wget -O $input/riscv-${ARCH}.zip $win_riscv_url
|
|
|
|
cd $input
|
|
|
|
mkdir re
|
|
|
|
cd re
|
|
|
|
unzip -o $input/riscv-${ARCH}.zip
|
|
|
|
cp -f -l -r */* $output
|
|
|
|
cd ..
|
|
|
|
rm -rf re
|
|
|
|
|
|
|
|
# Make.exe
|
|
|
|
wget -O $input/make-${ARCH}.zip $win_make_url
|
|
|
|
cd $output
|
|
|
|
unzip -o $input/make-${ARCH}.zip
|
|
|
|
|
|
|
|
cd $base/output
|
2020-01-12 04:14:53 +00:00
|
|
|
zip -r -X $output_name.zip $output_name
|
2019-08-21 22:45:03 +00:00
|
|
|
checksum_output .zip
|
2019-08-17 14:06:39 +00:00
|
|
|
;;
|
|
|
|
|
2020-10-10 11:21:49 +00:00
|
|
|
"macOS")
|
2020-10-10 23:34:23 +00:00
|
|
|
# Open FPGA toolchain
|
|
|
|
curl -fsSL $mac_openfpgatoolchain_url | tar xvJf - -C $input
|
|
|
|
mv $input/fpga-toolchain/* $output/
|
2019-08-17 14:06:39 +00:00
|
|
|
|
|
|
|
# Wishbone Tool
|
2020-10-10 14:57:16 +00:00
|
|
|
curl -fsSL $mac_wishbone_tool_url | tar xvzf - -C $output/bin
|
2019-08-17 14:06:39 +00:00
|
|
|
|
|
|
|
# Riscv Toolchain
|
|
|
|
# Note that we want to strip the front part of the path.
|
|
|
|
# Also, we do "cp -l" then "rm -rf" to merge the directories.
|
|
|
|
wget -O $input/riscv-${ARCH}.tar.gz $mac_riscv_url
|
|
|
|
cd $input
|
|
|
|
mkdir re
|
|
|
|
cd re
|
|
|
|
tar xvzf $input/riscv-${ARCH}.tar.gz
|
|
|
|
cp -f -l -r */* $output
|
|
|
|
cd ..
|
|
|
|
rm -rf re
|
|
|
|
|
|
|
|
cd $base/output
|
2020-01-12 04:14:53 +00:00
|
|
|
zip -r -X $output_name.zip $output_name
|
2019-08-21 22:45:03 +00:00
|
|
|
checksum_output .zip
|
2019-08-17 14:06:39 +00:00
|
|
|
;;
|
|
|
|
|
2020-10-10 11:21:49 +00:00
|
|
|
"Linux")
|
2020-10-10 23:34:23 +00:00
|
|
|
# Open FPGA toolchain
|
|
|
|
curl -fsSL $linux_openfpgatoolchain_url | tar xvJf - -C $input
|
|
|
|
mv $input/fpga-toolchain/* $output/
|
2019-08-17 14:06:39 +00:00
|
|
|
|
|
|
|
# Wishbone Tool
|
2020-10-10 14:57:16 +00:00
|
|
|
curl -fsSL $linux_wishbone_tool_url | tar xvzf - -C $output/bin
|
2019-08-17 14:06:39 +00:00
|
|
|
|
|
|
|
# Riscv Toolchain
|
|
|
|
# Note that we want to strip the front part of the path.
|
|
|
|
# Also, we do "cp -l" then "rm -rf" to merge the directories.
|
2020-10-10 23:34:23 +00:00
|
|
|
wget -O $input/riscv-${ARCH}.tar.gz $linux_riscv_url
|
2019-08-17 14:06:39 +00:00
|
|
|
cd $input
|
|
|
|
mkdir re
|
|
|
|
cd re
|
|
|
|
tar xvzf $input/riscv-${ARCH}.tar.gz
|
|
|
|
cp -f -l -r */* $output
|
|
|
|
cd ..
|
|
|
|
rm -rf re
|
|
|
|
|
2020-10-10 14:00:11 +00:00
|
|
|
cd $base/output/
|
2019-08-17 14:06:39 +00:00
|
|
|
tar cvzf $output_name.tar.gz $output_name
|
2019-08-21 22:45:03 +00:00
|
|
|
checksum_output .tar.gz
|
2019-08-17 14:06:39 +00:00
|
|
|
;;
|
|
|
|
*)
|
2020-10-10 11:21:49 +00:00
|
|
|
echo "Unrecognized platform: ${ARCH}"
|
|
|
|
echo "Supported platforms: MacOS, Windows, Linux"
|
2019-08-17 14:06:39 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
2019-08-20 11:00:53 +00:00
|
|
|
esac
|
|
|
|
|
2020-10-10 11:21:49 +00:00
|
|
|
echo "${GITHUB_SHA}" > $output/VERSION
|
2019-10-25 12:02:48 +00:00
|
|
|
|
2020-01-12 04:14:53 +00:00
|
|
|
exit 0
|