Skip to content
This repository has been archived by the owner on Nov 4, 2021. It is now read-only.

yosys: cleanup of ghdl-yosys-plugin config/envvars #67

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
35 changes: 19 additions & 16 deletions scripts/compile_yosys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,35 @@ fi

cd $BUILD_DIR/$dir_name

MAKEFILE_CONF_GHDL=
GHDL_LDLIBS=
if [ $COMPILE_GHDL == "1" ]
then
patch < $WORK_DIR/scripts/yosys_ghdl.diff

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)"
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
}

# -- 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 \
Expand All @@ -59,7 +62,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" \
Expand All @@ -74,7 +77,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
Expand Down