summaryrefslogtreecommitdiff
path: root/msvcc.sh
diff options
context:
space:
mode:
authorfwg <fwg@users.noreply.github.com>2018-04-02 13:55:31 +0200
committerAnthony Green <green@moxielogic.com>2018-04-02 06:55:31 -0500
commitaf6773d6ab4db0577bc6b932ab5a2f98a0a8dca2 (patch)
tree812b6d0727d5104317df93387c2ac341aaf60b9e /msvcc.sh
parent48bdb02867edb7e9f3785ccb4bdff1087fb44246 (diff)
downloadlibffi-af6773d6ab4db0577bc6b932ab5a2f98a0a8dca2.tar.gz
Fix appveyor windows build (#420)
* Fix msvcc dll build by adding dllexport decorations to all API declarations * Fix appveyor build for VS 2013 Use the new -DFFI_BUILDING_DLL for producing a working DLL. Update the msvcc.sh wrapper script to successfully compile the testsuite files. * MSVC build: suppress warnings in testsuite * fix testsuite on appveyor
Diffstat (limited to 'msvcc.sh')
-rwxr-xr-xmsvcc.sh65
1 files changed, 51 insertions, 14 deletions
diff --git a/msvcc.sh b/msvcc.sh
index 9ed6bd1..9a252f8 100755
--- a/msvcc.sh
+++ b/msvcc.sh
@@ -52,11 +52,17 @@ ml="ml"
safeseh="-safeseh"
output=
libpaths=
+libversion=7
+verbose=
while [ $# -gt 0 ]
do
case $1
in
+ --verbose)
+ $verbose=1
+ shift 1
+ ;;
--version)
args="-help"
shift 1
@@ -162,23 +168,30 @@ do
;;
-L)
p=$(cygpath -m $2)
- linkargs="$linkargs /LIBPATH:$p"
+ linkargs="$linkargs -LIBPATH:$p"
shift 2
;;
-L*)
p=$(cygpath -m ${1#-L})
- linkargs="$linkargs /LIBPATH:$p"
+ linkargs="$linkargs -LIBPATH:$p"
shift 1
;;
+ -link)
+ # add next argument verbatim to linker args
+ linkargs="$linkargs $2"
+ shift 2
+ ;;
-l*)
case $1
in
- -lffi)
- linkargs="$linkargs lib${1#-l}.a"
- ;;
- *)
- # linkargs="$linkargs ${1#-l}.lib"
- ;;
+ -lffi)
+ linkargs="$linkargs lib${1#-l}-${libversion}.lib"
+ ;;
+ *)
+ # ignore other libraries like -lm, hope they are
+ # covered by MSVCRT
+ # linkargs="$linkargs ${1#-l}.lib"
+ ;;
esac
shift 1
;;
@@ -195,6 +208,15 @@ do
# libffi tests -pedantic with -Wall, so drop it also.
shift 1
;;
+ -warn)
+ # ignore -warn all from libtool as well.
+ if test "$2" = "all"; then
+ shift 2
+ else
+ args="$args -warn"
+ shift 1
+ fi
+ ;;
-Werror)
args="$args -WX"
shift 1
@@ -248,7 +270,7 @@ if [ -n "$linkargs" ]; then
linkargs="$linkargs -OPT:REF -OPT:ICF -INCREMENTAL:NO"
fi
- args="$args /link $linkargs"
+ args="$args -link $linkargs"
fi
if [ -n "$static_crt" ]; then
@@ -266,12 +288,19 @@ if [ -n "$assembly" ]; then
outdir="."
fi
ppsrc="$outdir/$(basename $src|sed 's/.S$/.asm/g')"
- echo "$cl -nologo -EP $includes $defines $src > $ppsrc"
+
+ if test -n "$verbose"; then
+ echo "$cl -nologo -EP $includes $defines $src > $ppsrc"
+ fi
+
"$cl" -nologo -EP $includes $defines $src > $ppsrc || exit $?
output="$(echo $output | sed 's%/F[dpa][^ ]*%%g')"
args="-nologo $safeseh $single $output $ppsrc"
- echo "$ml $args"
+ if test -n "$verbose"; then
+ echo "$ml $args"
+ fi
+
eval "\"$ml\" $args"
result=$?
@@ -279,13 +308,21 @@ if [ -n "$assembly" ]; then
#mv *.obj $outdir
else
args="$md $args"
- echo "$cl $args"
+
+ if test -n "$verbose"; then
+ echo "$cl $args"
+ fi
# Return an error code of 1 if an invalid command line parameter is passed
- # instead of just ignoring it.
+ # instead of just ignoring it. Any output that is not a warning or an
+ # error is filtered so this command behaves more like gcc. cl.exe prints
+ # the name of the compiled file otherwise, which breaks the dejagnu checks
+ # for excess warnings and errors.
eval "(\"$cl\" $args 2>&1 1>&3 | \
- awk '{print \$0} /D9002/ {error=1} END{exit error}' >&2) 3>&1"
+ awk '{print \$0} /D9002/ {error=1} END{exit error}' >&2) 3>&1 | \
+ awk '/warning|error/'"
result=$?
fi
exit $result
+# vim: noai:ts=4:sw=4