From 247113d25e5c390423c4a2cc3a973a1892604ae3 Mon Sep 17 00:00:00 2001 From: umarcor Date: Mon, 4 Jan 2021 05:21:41 +0100 Subject: [PATCH 1/2] yosys: move Makefile.conf generation to a function --- scripts/compile_yosys.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/scripts/compile_yosys.sh b/scripts/compile_yosys.sh index 09950f4..5e74aea 100755 --- a/scripts/compile_yosys.sh +++ b/scripts/compile_yosys.sh @@ -21,7 +21,6 @@ fi cd $BUILD_DIR/$dir_name -MAKEFILE_CONF_GHDL= GHDL_LDLIBS= if [ $COMPILE_GHDL == "1" ] then @@ -29,8 +28,6 @@ then mkdir -p frontends/ghdl cp -R ../$dir_name_gyp/src/* frontends/ghdl - MAKEFILE_CONF_GHDL=$'ENABLE_GHDL := 1\n' - MAKEFILE_CONF_GHDL+="GHDL_PREFIX := $PACKAGE_DIR/$NAME" if [ $ARCH == "darwin" ]; then GHDL_LDLIBS="$PACKAGE_DIR/$NAME/lib/libghdl.a $(tr -s '\n' ' ' < $PACKAGE_DIR/$NAME/lib/libghdl.link)" @@ -41,12 +38,20 @@ then fi fi +_ghdl_conf() { + if [ $COMPILE_GHDL == "1" ] + then + echo 'ENABLE_GHDL := 1' >> Makefile.conf + echo "GHDL_PREFIX := $PACKAGE_DIR/$NAME" >> Makefile.conf + fi +} + # -- Compile it if [ $ARCH == "darwin" ]; then OLDPATH=$PATH export PATH="/usr/local/opt/bison/bin:/usr/local/opt/flex/bin:$PATH" $MAKE config-clang - echo "$MAKEFILE_CONF_GHDL" >> Makefile.conf + _ghdl_conf gsed -r -i 's/^(YOSYS_VER := [0-9]+\.[0-9]+\+[0-9]+).*$/\1 \(open-tool-forge build\)/;' Makefile sed -i "" "s/-Wall -Wextra -ggdb/-w/;" Makefile CXXFLAGS="-std=c++11 $CXXFLAGS" make \ @@ -59,7 +64,7 @@ if [ $ARCH == "darwin" ]; then export PATH=$OLDPATH elif [ ${ARCH:0:7} == "windows" ]; then $MAKE config-msys2-64 - echo "$MAKEFILE_CONF_GHDL" >> Makefile.conf + _ghdl_conf sed -r -i 's/^(YOSYS_VER := [0-9]+\.[0-9]+\+[0-9]+).*$/\1 \(open-tool-forge build\)/;' Makefile $MAKE -j$J GIT_REV="${GIT_REV}" PRETTY=0 \ LDLIBS="-static -lstdc++ -lm $GHDL_LDLIBS" \ @@ -74,7 +79,7 @@ elif [ ${ARCH:0:7} == "windows" ]; then test_bin yosys-smtbmc$EXE else $MAKE config-gcc - echo "$MAKEFILE_CONF_GHDL" >> Makefile.conf + _ghdl_conf sed -i "s/-Wall -Wextra -ggdb/-w/;" Makefile sed -r -i 's/^(YOSYS_VER := [0-9]+\.[0-9]+\+[0-9]+).*$/\1 \(open-tool-forge build\)/;' Makefile # sed -i "s/LD = gcc$/LD = $CC/;" Makefile From c6c373cdde8831689afb195351181c9f7ee6a5f1 Mon Sep 17 00:00:00 2001 From: umarcor Date: Mon, 4 Jan 2021 06:51:57 +0100 Subject: [PATCH 2/2] yosys: cleanup GHDL_LDLIBS --- scripts/compile_yosys.sh | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/scripts/compile_yosys.sh b/scripts/compile_yosys.sh index 5e74aea..5bd78ba 100755 --- a/scripts/compile_yosys.sh +++ b/scripts/compile_yosys.sh @@ -26,21 +26,19 @@ if [ $COMPILE_GHDL == "1" ] then patch < $WORK_DIR/scripts/yosys_ghdl.diff - mkdir -p frontends/ghdl - cp -R ../$dir_name_gyp/src/* frontends/ghdl - - if [ $ARCH == "darwin" ]; then - GHDL_LDLIBS="$PACKAGE_DIR/$NAME/lib/libghdl.a $(tr -s '\n' ' ' < $PACKAGE_DIR/$NAME/lib/libghdl.link)" - elif [ ${ARCH:0:7} == "windows" ]; then - GHDL_LDLIBS="$(cygpath -m -a $PACKAGE_DIR/$NAME/lib/libghdl.a) $(cat $PACKAGE_DIR/$NAME/lib/libghdl.link | tr -s '\n' ' ' | tr -s '\\' '/' )" - else - GHDL_LDLIBS="$PACKAGE_DIR/$NAME/lib/libghdl.a $(tr -s '\n' ' ' < $PACKAGE_DIR/$NAME/lib/libghdl.link)" - fi + #if [ ${ARCH:0:7} == "windows" ]; then + # sed -i -e 's@.*\(/mingw.*\)@\1@' $PACKAGE_DIR/$NAME/lib/libghdl.link + #fi + + GHDL_LDLIBS="$PACKAGE_DIR/$NAME/lib/libghdl.a $(cat $PACKAGE_DIR/$NAME/lib/libghdl.link)" fi _ghdl_conf() { if [ $COMPILE_GHDL == "1" ] then + mkdir -p frontends/ghdl + cp -R ../$dir_name_gyp/src/* frontends/ghdl + echo 'ENABLE_GHDL := 1' >> Makefile.conf echo "GHDL_PREFIX := $PACKAGE_DIR/$NAME" >> Makefile.conf fi