1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-15 14:13:16 +02:00

Merge commit '1a7bf48eed806beea7e835b31b06aa6bc94da5da'

* commit '1a7bf48eed806beea7e835b31b06aa6bc94da5da':
  makedef: Extend the script for use with mingw tools as well

Merged-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer
2017-11-11 11:31:22 -03:00

View File

@@ -45,7 +45,11 @@ libname=$(mktemp -u "library").lib
trap 'rm -f -- $libname' EXIT trap 'rm -f -- $libname' EXIT
lib -out:${libname} $@ >/dev/null if [ -n "$AR" ]; then
$AR rcs ${libname} $@ >/dev/null
else
lib -out:${libname} $@ >/dev/null
fi
if [ $? != 0 ]; then if [ $? != 0 ]; then
echo "Could not create temporary library." >&2 echo "Could not create temporary library." >&2
exit 1 exit 1
@@ -57,19 +61,29 @@ IFS='
# Determine if we're building for x86 or x86_64 and # Determine if we're building for x86 or x86_64 and
# set the symbol prefix accordingly. # set the symbol prefix accordingly.
prefix="" prefix=""
arch=$(dumpbin -headers ${libname} | if [ -n "$NM" ]; then
case $ARCH in
*86)
prefix="_"
;;
*)
;;
esac
else
arch=$(dumpbin -headers ${libname} |
tr '\t' ' ' | tr '\t' ' ' |
grep '^ \+.\+machine \+(.\+)' | grep '^ \+.\+machine \+(.\+)' |
head -1 | head -1 |
sed -e 's/^ \{1,\}.\{1,\} \{1,\}machine \{1,\}(\(...\)).*/\1/') sed -e 's/^ \{1,\}.\{1,\} \{1,\}machine \{1,\}(\(...\)).*/\1/')
if [ "${arch}" = "x86" ]; then if [ "${arch}" = "x86" ]; then
prefix="_" prefix="_"
else else
if [ "${arch}" != "ARM" ] && [ "${arch}" != "x64" ]; then if [ "${arch}" != "ARM" ] && [ "${arch}" != "x64" ]; then
echo "Unknown machine type." >&2 echo "Unknown machine type." >&2
exit 1 exit 1
fi fi
fi
fi fi
started=0 started=0
@@ -112,10 +126,19 @@ for line in $(cat ${vscript} | tr '\t' ' '); do
' '
done done
dump=$(dumpbin -linkermember:1 ${libname} | if [ -n "$NM" ]; then
# Use eval, since NM="nm -g"
dump=$(eval "$NM --defined-only -g ${libname}" |
grep -v : |
grep -v ^$ |
cut -d' ' -f3 |
sed -e "s/^${prefix}//")
else
dump=$(dumpbin -linkermember:1 ${libname} |
sed -e '/public symbols/,$!d' -e '/^ \{1,\}Summary/,$d' -e "s/ \{1,\}${prefix}/ /" -e 's/ \{1,\}/ /g' | sed -e '/public symbols/,$!d' -e '/^ \{1,\}Summary/,$d' -e "s/ \{1,\}${prefix}/ /" -e 's/ \{1,\}/ /g' |
tail -n +2 | tail -n +2 |
cut -d' ' -f3) cut -d' ' -f3)
fi
rm ${libname} rm ${libname}