/usr/bin/polyc is in polyml 5.6-3.
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 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | #! /bin/sh
prefix=/usr
exec_prefix=${prefix}
BINDIR=${exec_prefix}/bin
LINK=g++
LIBDIR=${prefix}/lib/x86_64-linux-gnu
LIBS="-lpthread -lffi -lm -ldl -lstdc++ -lgcc_s -lgcc "
CFLAGS="-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security"
DEFAULT_COMPILER="${BINDIR}/poly"
COMPILER=${DEFAULT_COMPILER}
# Extra options for Windows. config.status sets these conditionals to either "" or "#".
EXTRALDFLAGS=""
#EXTRALDFLAGS="-Wl,-u,WinMain"
##EXTRALDFLAGS="-Wl,-u,WinMain"
##EXTRALDFLAGS="-Wl,-u,_WinMain@16 -Wl,--large-address-aware"
##EXTRALDFLAGS="-Wl,-u,_WinMain@16 -Wl,--large-address-aware"
#EXTRALDFLAGS+="-mwindows"
##EXTRALDFLAGS+="-mconsole"
#SUFFIX="obj"
SUFFIX="o"
# Msys passes the Windows TEMP in temp (lower case)
# On other systems allow TMPDIR to override /tmp.
#TEMPORARYDIR=${temp:-/tmp}
TEMPORARYDIR=${TMPDIR:-/tmp}
# Extra options for Mac OS X
#EXTRALDFLAGS="-Wl,-no_pie"
TMPOBJFILE=${TEMPORARYDIR}/polyobj.$$.$SUFFIX
trap 'rm -f "$TMPOBJFILE"' 0
compile()
{
echo "use (List.nth(CommandLine.arguments(), 2)); PolyML.export(List.nth(CommandLine.arguments(), 3), main);" | ${COMPILER} -q --error-exit "$1" "$2"
}
link()
{
if [ X"$2" = "X" ]
then
${LINK} ${EXTRALDFLAGS} ${CFLAGS} "$1" -L${LIBDIR} -Wl,-rpath,${LIBDIR} -lpolymain -lpolyml ${LIBS}
else
${LINK} ${EXTRALDFLAGS} ${CFLAGS} "$1" -o "$2" -L${LIBDIR} -Wl,-rpath,${LIBDIR} -lpolymain -lpolyml ${LIBS}
fi
}
printhelp()
{
echo "Usage: polyc [OPTION]... [SOURCEFILE]"
echo Compile and link a Standard ML source file with Poly/ML.
echo
echo " -b poly Use 'poly' as compiler instead of ${DEFAULT_COMPILER}"
echo " -c Compile but do not link. The object file is written to the source file with .$SUFFIX extension."
echo " -o output Write the executable file to 'output'"
echo " --help Write this text and exit"
exit
}
usage()
{
echo "$1"
echo "Usage: polyc [OPTION]... [SOURCEFILE]"
exit 1
}
checkml()
{
extension="${1##*.}"
case "$extension" in
sml|ML)
return 0 ;;
o|obj)
return 1;;
*)
test -r "$1" && file -b "$1" | grep -q text ;;
esac
}
sourcefile=""
outputfile=""
compileonly="no"
while [ $# -gt 0 ]
do
case "$1" in
--help)
printhelp ;;
-b)
shift
[ $# -eq 0 ] && usage "Expected file name after -b"
COMPILER="$1";;
-c) compileonly="yes";;
-o)
shift
[ $# -eq 0 ] && usage "Expected file name after -o"
outputfile="$1";;
*)
[ X"$sourcefile" = "X" ] || usage "Only one source file name allowed"
sourcefile="$1";;
esac
shift
done
[ X"$sourcefile" = "X" ] && usage "No input files"
[ -r "$sourcefile" ] || usage "Error: $sourcefile: No such file"
case "$compileonly" in
yes)
if [ "x$outputfile" = "x" ]; then
basename=${sourcefile##*/}
outputfile=${basename%.*}.o
fi
compile "$sourcefile" "$outputfile"
;;
no)
if checkml "$sourcefile"
then
compile "$sourcefile" "$TMPOBJFILE" && link "$TMPOBJFILE" "$outputfile"
else
link "$sourcefile" "$outputfile"
fi
;;
esac
|