Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libs/fst: Update from upstream #4543

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,7 @@ vcxsrc: $(GENFILES) $(EXTRA_TARGETS)
rm -rf yosys-win32-vcxsrc-$(YOSYS_VER){,.zip}
set -e; for f in `ls $(filter %.cc %.cpp,$(GENFILES)) $(addsuffix .cc,$(basename $(OBJS))) $(addsuffix .cpp,$(basename $(OBJS))) 2> /dev/null`; do \
echo "Analyse: $$f" >&2; cpp -std=c++17 -MM -I. -D_YOSYS_ $$f; done | sed 's,.*:,,; s,//*,/,g; s,/[^/]*/\.\./,/,g; y, \\,\n\n,;' | grep '^[^/]' | sort -u | grep -v kernel/version_ > srcfiles.txt
echo "libs/fst/fst_win_unistd.h" >> srcfiles.txt
bash misc/create_vcxsrc.sh yosys-win32-vcxsrc $(YOSYS_VER) $(GIT_REV)
echo "namespace Yosys { extern const char *yosys_version_str; const char *yosys_version_str=\"Yosys (Version Information Unavailable)\"; }" > kernel/version.cc
zip yosys-win32-vcxsrc-$(YOSYS_VER)/genfiles.zip $(GENFILES) kernel/version.cc
Expand Down
11 changes: 11 additions & 0 deletions libs/fst/00_PATCH_win_io.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- fst_win_unistd.h
+++ fst_win_unistd.h
@@ -26,7 +26,7 @@
#define WIN_UNISTD_H

#include <stdlib.h>
-#ifdef _WIN64
+#if defined(_MSC_VER)
#include <io.h>
#else
#include <sys/io.h>
16 changes: 16 additions & 0 deletions libs/fst/00_PATCH_win_zlib.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--- fstapi.h
+++ fstapi.h
@@ -33,11 +33,12 @@ extern "C" {
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
-#include <zlib.h>
#include <inttypes.h>
#if defined(_MSC_VER)
+ #include "libs/zlib/zlib.h"
#include "fst_win_unistd.h"
#else
+ #include <zlib.h>
#include <unistd.h>
#endif
#include <time.h>
19 changes: 19 additions & 0 deletions libs/fst/00_UPDATE.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

mv config.h config.h.bak
rm -f *.txt *.cc *.h
git clone --depth 1 https://github.com/gtkwave/gtkwave fst_upstream
rm fst_upstream/lib/libfst/CMakeLists.txt
mv fst_upstream/lib/libfst/*.{h,c,txt} .
rm -rf fst_upstream

for src in *.c; do
mv -- "$src" "${src%.c}.cc"
done
mv config.h.bak config.h

sed -i -e 's,<config.h>,"config.h",' *.cc *.h
sed -i -e 's,"fastlz.c","fastlz.cc",' *.cc *.h

patch -p0 < 00_PATCH_win_zlib.patch
patch -p0 < 00_PATCH_win_io.patch
Loading
Loading