2020-11-10 18:52:02 +01:00
|
|
|
#! /bin/sh
|
|
|
|
# Wrapper for windres to rc which do not understand '-i -o --output-format'.
|
|
|
|
# cvtres is invoked by the linker
|
2022-08-24 17:08:34 +01:00
|
|
|
scriptversion=2022-08-24.12; # UTC
|
2020-11-10 18:52:02 +01:00
|
|
|
|
|
|
|
|
|
|
|
nl='
|
|
|
|
'
|
|
|
|
|
|
|
|
# We need space, tab and new line, in precisely that order. Quoting is
|
|
|
|
# there to prevent tools from complaining about whitespace usage.
|
|
|
|
IFS=" "" $nl"
|
|
|
|
|
|
|
|
file_conv=
|
|
|
|
|
|
|
|
# func_file_conv build_file lazy
|
|
|
|
# Convert a $build file to $host form and store it in $file
|
|
|
|
# Currently only supports Windows hosts. If the determined conversion
|
|
|
|
# type is listed in (the comma separated) LAZY, no conversion will
|
|
|
|
# take place.
|
|
|
|
func_file_conv ()
|
|
|
|
{
|
|
|
|
file=$1
|
|
|
|
case $file in
|
|
|
|
/ | /[!/]*) # absolute file, and not a UNC file
|
|
|
|
if test -z "$file_conv"; then
|
|
|
|
# lazily determine how to convert abs files
|
|
|
|
case `uname -s` in
|
|
|
|
MINGW*)
|
|
|
|
file_conv=mingw
|
|
|
|
;;
|
|
|
|
CYGWIN* | MSYS*)
|
|
|
|
file_conv=cygwin
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
file_conv=wine
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
case $file_conv/,$2, in
|
|
|
|
*,$file_conv,*)
|
|
|
|
;;
|
|
|
|
mingw/*)
|
|
|
|
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
|
|
|
;;
|
|
|
|
cygwin/* | msys/*)
|
|
|
|
file=`cygpath -m "$file" || echo "$file"`
|
|
|
|
;;
|
|
|
|
wine/*)
|
|
|
|
file=`winepath -w "$file" || echo "$file"`
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
# func_windres_wrapper rc args...
|
|
|
|
# Adjust compile command to suit rc instead of windres
|
|
|
|
func_windres_wrapper ()
|
|
|
|
{
|
|
|
|
# Assume a capable shell
|
2022-08-24 17:08:34 +01:00
|
|
|
bin=
|
2020-11-10 18:52:02 +01:00
|
|
|
in=
|
|
|
|
out=
|
|
|
|
|
|
|
|
for arg
|
|
|
|
do
|
2022-08-24 17:08:34 +01:00
|
|
|
if test -z "$bin"; then
|
|
|
|
bin=$1
|
|
|
|
elif test -n "$eat"; then
|
2020-11-10 18:52:02 +01:00
|
|
|
eat=
|
|
|
|
else
|
|
|
|
case $1 in
|
2022-08-24 17:08:34 +01:00
|
|
|
--output-format=*)
|
|
|
|
;;
|
2022-08-23 21:36:24 +02:00
|
|
|
--define*)
|
2022-08-24 17:08:34 +01:00
|
|
|
eat=1
|
|
|
|
set -- "$@" "-d $2"
|
|
|
|
;;
|
2022-08-23 21:36:24 +02:00
|
|
|
--include-dir*)
|
2022-08-24 17:08:34 +01:00
|
|
|
eat=1
|
|
|
|
func_file_conv "$2"
|
|
|
|
set -- "$@" "-I $file"
|
|
|
|
;;
|
2020-11-10 18:52:02 +01:00
|
|
|
-o)
|
|
|
|
eat=1
|
|
|
|
func_file_conv "$2"
|
|
|
|
out="$file"
|
|
|
|
echo "OUTPUT:$file"
|
|
|
|
;;
|
|
|
|
*.obj)
|
|
|
|
func_file_conv "$1"
|
|
|
|
out="$file"
|
|
|
|
echo "OUTPUT:$file"
|
|
|
|
;;
|
|
|
|
-i)
|
|
|
|
eat=1
|
|
|
|
func_file_conv "$2" mingw
|
|
|
|
in="$file"
|
|
|
|
echo "INPUT:$file"
|
|
|
|
;;
|
|
|
|
-*)
|
2022-08-24 17:08:34 +01:00
|
|
|
set -- "$@" "${1//\\\"/\"}"
|
2020-11-10 18:52:02 +01:00
|
|
|
;;
|
|
|
|
*)
|
2022-08-24 17:08:34 +01:00
|
|
|
# libtool reorders arguments; save unqualified one as input
|
|
|
|
func_file_conv "$1"
|
|
|
|
in="$file"
|
|
|
|
echo "INPUT:$file"
|
2020-11-10 18:52:02 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
shift
|
|
|
|
done
|
2022-08-24 17:08:34 +01:00
|
|
|
echo "$bin" "$@" -fo "$out" "$in"
|
|
|
|
exec "$bin" "$@" -fo "$out" "$in"
|
2020-11-10 18:52:02 +01:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
eat=
|
|
|
|
|
|
|
|
func_windres_wrapper "$@"
|
|
|
|
|
|
|
|
|
|
|
|
# Local Variables:
|
|
|
|
# mode: shell-script
|
|
|
|
# sh-indentation: 2
|
|
|
|
# eval: (add-hook 'before-save-hook 'time-stamp)
|
|
|
|
# time-stamp-start: "scriptversion="
|
|
|
|
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
|
|
|
# time-stamp-time-zone: "UTC0"
|
|
|
|
# time-stamp-end: "; # UTC"
|
|
|
|
# End:
|