2014-10-18 08:17:33 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -ex
|
2014-10-18 12:00:52 -05:00
|
|
|
vcxsrc="$1-$2"
|
|
|
|
yosysver="$2"
|
|
|
|
gitsha="$3"
|
2014-10-18 08:17:33 -05:00
|
|
|
|
2018-09-28 10:20:16 -05:00
|
|
|
rm -rf YosysVS-Tpl-v2.zip YosysVS
|
2024-07-09 07:19:33 -05:00
|
|
|
wget https://github.com/YosysHQ/yosys/releases/download/resources/YosysVS-Tpl-v2.zip
|
|
|
|
wget https://github.com/YosysHQ/yosys/releases/download/resources/zlib-1.2.11.tar.gz
|
2014-10-18 08:17:33 -05:00
|
|
|
|
2018-09-28 10:20:16 -05:00
|
|
|
unzip YosysVS-Tpl-v2.zip
|
|
|
|
rm -f YosysVS-Tpl-v2.zip
|
2022-02-02 04:46:06 -06:00
|
|
|
tar xvfz zlib-1.2.11.tar.gz
|
2014-10-18 08:17:33 -05:00
|
|
|
|
2022-02-02 04:46:06 -06:00
|
|
|
mv YosysVS "$vcxsrc"
|
|
|
|
mkdir -p "$vcxsrc"/yosys
|
|
|
|
mkdir -p "$vcxsrc"/yosys/libs/zlib
|
|
|
|
mv zlib-1.2.11/* "$vcxsrc"/yosys/libs/zlib/.
|
|
|
|
rm -rf zlib-1.2.11
|
|
|
|
pushd "$vcxsrc"/yosys
|
|
|
|
ls libs/zlib/*.c | sed 's,.*:,,; s,//*,/,g; s,/[^/]*/\.\./,/,g; y, \\,\n\n,;' | grep '^[^/]' >> ../../srcfiles.txt
|
|
|
|
popd
|
2014-10-18 08:17:33 -05:00
|
|
|
{
|
|
|
|
n=$(grep -B999 '<ItemGroup>' "$vcxsrc"/YosysVS/YosysVS.vcxproj | wc -l)
|
|
|
|
head -n$n "$vcxsrc"/YosysVS/YosysVS.vcxproj
|
|
|
|
egrep '\.(h|hh|hpp|inc)$' srcfiles.txt | sed 's,.*,<ClInclude Include="../yosys/&" />,'
|
|
|
|
egrep -v '\.(h|hh|hpp|inc)$' srcfiles.txt | sed 's,.*,<ClCompile Include="../yosys/&" />,'
|
2014-10-18 12:00:52 -05:00
|
|
|
echo '<ClCompile Include="../yosys/kernel/version.cc" />'
|
2014-10-18 08:17:33 -05:00
|
|
|
tail -n +$((n+1)) "$vcxsrc"/YosysVS/YosysVS.vcxproj
|
|
|
|
} > "$vcxsrc"/YosysVS/YosysVS.vcxproj.new
|
|
|
|
|
2024-06-17 10:29:20 -05:00
|
|
|
sed -i 's,</AdditionalIncludeDirectories>,</AdditionalIncludeDirectories>\n <LanguageStandard>stdcpp17</LanguageStandard>\n <AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>,g' "$vcxsrc"/YosysVS/YosysVS.vcxproj.new
|
2014-10-18 08:17:33 -05:00
|
|
|
mv "$vcxsrc"/YosysVS/YosysVS.vcxproj.new "$vcxsrc"/YosysVS/YosysVS.vcxproj
|
|
|
|
|
|
|
|
mkdir -p "$vcxsrc"/yosys
|
|
|
|
tar -cf - -T srcfiles.txt | tar -xf - -C "$vcxsrc"/yosys
|
2014-10-18 12:00:52 -05:00
|
|
|
cp -r share "$vcxsrc"/
|
2014-10-18 08:17:33 -05:00
|
|
|
|
2014-10-18 12:00:52 -05:00
|
|
|
echo "namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"Yosys" \
|
|
|
|
"$yosysver (git sha1 $gitsha, Visual Studio)\"; }" > "$vcxsrc"/yosys/kernel/version.cc
|
2014-10-18 08:17:33 -05:00
|
|
|
|
2014-10-18 12:00:52 -05:00
|
|
|
cat > "$vcxsrc"/readme-git.txt << EOT
|
|
|
|
Want to use a git working copy for the yosys source code?
|
2014-10-18 08:17:33 -05:00
|
|
|
Open "Git Bash" in this directory and run:
|
|
|
|
|
|
|
|
mv yosys yosys.bak
|
2021-06-07 17:39:36 -05:00
|
|
|
git clone https://github.com/YosysHQ/yosys.git yosys
|
2014-10-18 08:17:33 -05:00
|
|
|
cd yosys
|
2024-03-23 23:41:40 -05:00
|
|
|
git checkout -B main $(git rev-parse HEAD | cut -c1-10)
|
2014-10-18 08:17:33 -05:00
|
|
|
unzip ../genfiles.zip
|
|
|
|
EOT
|
|
|
|
|
2014-10-18 12:00:52 -05:00
|
|
|
cat > "$vcxsrc"/readme-abc.txt << EOT
|
|
|
|
Yosys is using "ABC" for gate-level optimizations and technology
|
|
|
|
mapping. Download yosys-win32-mxebin-$yosysver.zip and copy the
|
|
|
|
following files from it into this directory:
|
|
|
|
|
|
|
|
pthreadVC2.dll
|
|
|
|
yosys-abc.exe
|
|
|
|
EOT
|
|
|
|
|
|
|
|
sed -i 's/$/\r/; s/\r\r*/\r/g;' "$vcxsrc"/YosysVS/YosysVS.vcxproj "$vcxsrc"/readme-git.txt "$vcxsrc"/readme-abc.txt
|
2014-10-18 08:17:33 -05:00
|
|
|
|