compat: add msvc windres wrapper

This is by no means a complete wrapper. It's only designed to fit the
usecase ffmpegs build system has.
This commit is contained in:
Timo Rothenpieler 2022-08-07 16:31:51 +02:00
parent f85e0673c3
commit 9ca3b8b7cd
2 changed files with 34 additions and 0 deletions

32
compat/windows/mswindres Executable file
View File

@ -0,0 +1,32 @@
#!/bin/sh
if [ "$1" = "--version" ]; then
rc.exe /?
exit $?
fi
if [ $# -lt 2 ]; then
echo "Usage: mswindres [-I/include/path ...] [-DSOME_DEFINE ...] [-o output.o] input.rc [output.o]" >&2
exit 0
fi
EXTRA_OPTS="/nologo"
while [ $# -gt 2 ]; do
case $1 in
-D*) EXTRA_OPTS="$EXTRA_OPTS /d$(echo $1 | sed -e "s/^..//" -e "s/ /\\\\ /g")" ;;
-I*) EXTRA_OPTS="$EXTRA_OPTS /i$(echo $1 | sed -e "s/^..//" -e "s/ /\\\\ /g")" ;;
-o) OPT_OUT="$2"; shift ;;
esac
shift
done
IN="$1"
if [ -z "$OPT_OUT" ]; then
OUT="$2"
else
OUT="$OPT_OUT"
fi
eval set -- $EXTRA_OPTS
rc.exe "$@" /fo "$OUT" "$IN"

2
configure vendored
View File

@ -4371,6 +4371,7 @@ case "$toolchain" in
die "Unsupported MSVC version (2013 or newer required)" die "Unsupported MSVC version (2013 or newer required)"
fi fi
ld_default="$source_path/compat/windows/mslink" ld_default="$source_path/compat/windows/mslink"
windres_default="$source_path/compat/windows/mswindres"
nm_default="dumpbin.exe -symbols" nm_default="dumpbin.exe -symbols"
ar_default="lib.exe" ar_default="lib.exe"
case "${arch:-$arch_default}" in case "${arch:-$arch_default}" in
@ -5621,6 +5622,7 @@ case $target_os in
# Cannot build both shared and static libs with MSVC or icl. # Cannot build both shared and static libs with MSVC or icl.
disable static disable static
fi fi
! enabled small && test_cmd $windres --version && enable gnu_windres
enabled x86_32 && check_ldflags -LARGEADDRESSAWARE enabled x86_32 && check_ldflags -LARGEADDRESSAWARE
shlibdir_default="$bindir_default" shlibdir_default="$bindir_default"
SLIBPREF="" SLIBPREF=""