[FFmpeg-cvslog] build: Import makedef script from c99-to-c89
Derek Buitenhuis
git at videolan.org
Sun Nov 24 23:33:24 CET 2013
ffmpeg | branch: master | Derek Buitenhuis <derek.buitenhuis at gmail.com> | Thu Nov 21 10:36:06 2013 +0000| [dedfa00107dbbb319d0e33faac683557b86d1007] | committer: Derek Buitenhuis
build: Import makedef script from c99-to-c89
This allows MSVC 2013 and ICL to build with no external
dependencies.
Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dedfa00107dbbb319d0e33faac683557b86d1007
---
compat/windows/makedef | 132 ++++++++++++++++++++++++++++++++++++++++++++++++
configure | 2 +-
2 files changed, 133 insertions(+), 1 deletion(-)
diff --git a/compat/windows/makedef b/compat/windows/makedef
new file mode 100755
index 0000000..fcaf108
--- /dev/null
+++ b/compat/windows/makedef
@@ -0,0 +1,132 @@
+#!/bin/sh
+
+# Copyright (c) 2013, Derek Buitenhuis
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+# mktemp isn't POSIX, so supply an implementation
+mktemp() {
+ echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
+}
+
+if [ $# -lt 2 ]; then
+ echo "Usage: makedef <version_script> <objects>" >&2
+ exit 0
+fi
+
+vscript=$1
+shift
+
+if [ ! -f "$vscript" ]; then
+ echo "Version script does not exist" >&2
+ exit 1
+fi
+
+for object in "$@"; do
+ if [ ! -f "$object" ]; then
+ echo "Object does not exist: ${object}" >&2
+ exit 1
+ fi
+done
+
+# Create a lib temporarily to dump symbols from.
+# It's just much easier to do it this way
+libname=$(mktemp -u "library").lib
+
+trap 'rm -f -- $libname' EXIT
+
+lib -out:${libname} $@ >/dev/null
+if [ $? != 0 ]; then
+ echo "Could not create temporary library." >&2
+ exit 1
+fi
+
+IFS='
+'
+
+# Determine if we're building for x86 or x86_64 and
+# set the symbol prefix accordingly.
+prefix=""
+arch=$(dumpbin -headers ${libname} |
+ tr '\t' ' ' |
+ grep '^ \+.\+machine \+(.\+)' |
+ head -1 |
+ sed -e 's/^ \{1,\}.\{1,\} \{1,\}machine \{1,\}(\(...\)).*/\1/')
+
+if [ "${arch}" = "x86" ]; then
+ prefix="_"
+else
+ if [ "${arch}" != "ARM" ] && [ "${arch}" != "x64" ]; then
+ echo "Unknown machine type." >&2
+ exit 1
+ fi
+fi
+
+started=0
+regex="none"
+
+for line in $(cat ${vscript} | tr '\t' ' '); do
+ # We only care about global symbols
+ echo "${line}" | grep -q '^ \+global:'
+ if [ $? = 0 ]; then
+ started=1
+ line=$(echo "${line}" | sed -e 's/^ \{1,\}global: *//')
+ else
+ echo "${line}" | grep -q '^ \+local:'
+ if [ $? = 0 ]; then
+ started=0
+ fi
+ fi
+
+ if [ ${started} = 0 ]; then
+ continue
+ fi
+
+ # Handle multiple symbols on one line
+ IFS=';'
+
+ # Work around stupid expansion to filenames
+ line=$(echo "${line}" | sed -e 's/\*/.\\+/g')
+ for exp in ${line}; do
+ # Remove leading and trailing whitespace
+ exp=$(echo "${exp}" | sed -e 's/^ *//' -e 's/ *$//')
+
+ if [ "${regex}" = "none" ]; then
+ regex="${exp}"
+ else
+ regex="${regex};${exp}"
+ fi
+ done
+
+ IFS='
+'
+done
+
+dump=$(dumpbin -linkermember:1 ${libname})
+
+rm ${libname}
+
+IFS=';'
+list=""
+for exp in ${regex}; do
+ list="${list}"'
+'$(echo "${dump}" |
+ sed -e '/public symbols/,$!d' -e '/^ \{1,\}Summary/,$d' -e "s/ \{1,\}${prefix}/ /" -e 's/ \{1,\}/ /g' |
+ tail -n +2 |
+ cut -d' ' -f3 |
+ grep "^${exp}" |
+ sed -e 's/^/ /')
+done
+
+echo "EXPORTS"
+echo "${list}" | sort | uniq | tail -n +2
diff --git a/configure b/configure
index e9f16f3..c85d64b 100755
--- a/configure
+++ b/configure
@@ -3236,7 +3236,7 @@ case $target_os in
SLIBSUF=".dll"
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
- SLIB_CREATE_DEF_CMD='makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
+ SLIB_CREATE_DEF_CMD='$(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
SLIB_INSTALL_LINKS=
SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
More information about the ffmpeg-cvslog
mailing list