/usr/bin/yosys-config is in yosys 0.5.0+20151013gitf13e387-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | #!/bin/bash
help() {
{
echo ""
echo "Usage: $0 [--exec] [--prefix pf] args.."
echo " $0 --build modname.so cppsources.."
echo ""
echo "Replecement args:"
echo " --cxx gcc"
echo " --cxxflags $( echo '-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wextra -ggdb -I"/usr/share/yosys/include" -MD -D_YOSYS_ -fPIC -I/usr/include -std=gnu++0x -Os -DYOSYS_ENABLE_READLINE -DYOSYS_ENABLE_PLUGINS -I/usr/include/tcl8.6 -DYOSYS_ENABLE_TCL -DYOSYS_ENABLE_ABC -DYOSYS_ENABLE_COVER' | fmt -w60 | sed ':a;N;$!ba;s/\n/ \\\n /g' )"
echo " --ldflags -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed -L/usr/lib -rdynamic"
echo " --ldlibs -lstdc++ -lm -lrt -lreadline -lffi -ldl -ltcl8.6"
echo " --bindir /usr/bin"
echo " --datdir /usr/share/yosys"
echo ""
echo "All other args are passed through as they are."
echo ""
echo "Use --exec to call a command instead of generating output. Example usage:"
echo ""
echo " yosys-config --exec --cxx --cxxflags --ldflags -o plugin.so -shared plugin.cc --ldlibs"
echo ""
echo "The above command can be abbreviated as:"
echo ""
echo " yosys-config --build plugin.so plugin.cc"
echo ""
echo "Use --prefix to change the prefix for the special args from '--' to"
echo "something else. Example:"
echo ""
echo " yosys-config --prefix @ bindir: @bindir"
echo ""
echo "The args --bindir and --datdir can be directly followed by a slash and"
echo "additional text. Example:"
echo ""
echo " yosys-config --datdir/simlib.v"
echo ""
} >&2
exit 1
}
if [ $# -eq 0 ]; then
help
fi
if [ "$1" == "--build" ]; then
modname="$2"; shift 2
set -- --exec --cxx --cxxflags --ldflags -o "$modname" -shared "$@" --ldlibs
fi
prefix="--"
get_prefix=false
exec_mode=false
declare -a tokens=()
for opt; do
if $get_prefix; then
prefix="$opt"
get_prefix=false
continue
fi
case "$opt" in
"$prefix"cxx)
tokens=( "${tokens[@]}" gcc ) ;;
"$prefix"cxxflags)
tokens=( "${tokens[@]}" -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wextra -ggdb -I"/usr/share/yosys/include" -MD -D_YOSYS_ -fPIC -I/usr/include -std=gnu++0x -Os -DYOSYS_ENABLE_READLINE -DYOSYS_ENABLE_PLUGINS -I/usr/include/tcl8.6 -DYOSYS_ENABLE_TCL -DYOSYS_ENABLE_ABC -DYOSYS_ENABLE_COVER ) ;;
"$prefix"ldflags)
tokens=( "${tokens[@]}" -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed -L/usr/lib -rdynamic ) ;;
"$prefix"ldlibs)
tokens=( "${tokens[@]}" -lstdc++ -lm -lrt -lreadline -lffi -ldl -ltcl8.6 ) ;;
"$prefix"bindir)
tokens=( "${tokens[@]}" '/usr/bin' ) ;;
"$prefix"datdir)
tokens=( "${tokens[@]}" '/usr/share/yosys' ) ;;
"$prefix"bindir/*)
tokens=( "${tokens[@]}" '/usr/bin'"${opt#${prefix}bindir}" ) ;;
"$prefix"datdir/*)
tokens=( "${tokens[@]}" '/usr/share/yosys'"${opt#${prefix}datdir}" ) ;;
--help|-\?|-h)
if [ ${#tokens[@]} -eq 0 ]; then
help
else
tokens=( "${tokens[@]}" "$opt" )
fi ;;
--exec)
if [ ${#tokens[@]} -eq 0 ]; then
exec_mode=true
else
tokens=( "${tokens[@]}" "$opt" )
fi ;;
--prefix)
if [ ${#tokens[@]} -eq 0 ]; then
get_prefix=true
else
tokens=( "${tokens[@]}" "$opt" )
fi ;;
*)
tokens=( "${tokens[@]}" "$opt" )
esac
done
if $exec_mode; then
exec "${tokens[@]}"
fi
echo "${tokens[@]}"
exit 0
|