Commit 7cf134e8 authored by Thomas Guillem's avatar Thomas Guillem

fix link when 2 modules have same symbols

Rename static modules symbols in order to have unique symbols.

Close #13966
parent 1a5da57e
......@@ -3,6 +3,7 @@
# Android .so
/android-libs/**/*.so
.modules/
# tmp dir used by gdb.sh
.gdb
......
......@@ -537,6 +537,10 @@ cd $SRC_DIR
# libVLC modules #
##################
REDIFINED_VLC_MODULES_DIR=$SRC_DIR/.modules/${VLC_BUILD_DIR}
rm -rf ${REDIFINED_VLC_MODULES_DIR}
mkdir -p ${REDIFINED_VLC_MODULES_DIR}
echo "Generating static module list"
blacklist_regexp=
for i in ${VLC_MODULE_BLACKLIST}
......@@ -548,24 +552,50 @@ do
blacklist_regexp="${blacklist_regexp}|${i}"
fi
done
VLC_MODULES=`find vlc/$VLC_BUILD_DIR/modules -name 'lib*plugin.a' | grep -vE "lib(${blacklist_regexp})_plugin.a" | tr '\n' ' '`
find_modules()
{
echo "`find $1 -name 'lib*plugin.a' | grep -vE "lib(${blacklist_regexp})_plugin.a" | tr '\n' ' '`"
}
get_symbol()
{
echo "$1" | grep vlc_entry_$2|cut -d" " -f 3
}
VLC_MODULES=$(find_modules vlc/$VLC_BUILD_DIR/modules)
DEFINITION="";
BUILTINS="const void *vlc_static_modules[] = {\n";
for file in $VLC_MODULES; do
symbol=`"${CROSS_COMPILE}nm" -g $file | grep vlc_entry__|cut -d" " -f 3`
DEFINITION=$DEFINITION"int $symbol (int (*)(void *, void *, int, ...), void *);\n"; \
BUILTINS="$BUILTINS $symbol,\n"; \
done; \
outfile=${REDIFINED_VLC_MODULES_DIR}/`basename $file`
name=`echo $file | sed 's/.*\.libs\/lib//' | sed 's/_plugin\.a//'`;
symbols=$("${CROSS_COMPILE}nm" -g $file)
# assure that all modules have differents entry symbols
entry=$(get_symbol "$symbols" _)
copyright=$(get_symbol "$symbols" copyright)
license=$(get_symbol "$symbols" license)
cat <<EOF > ${REDIFINED_VLC_MODULES_DIR}/syms
$entry vlc_entry__$name
$copyright vlc_entry_copyright__$name
$license vlc_entry_license__$name
EOF
${CROSS_COMPILE}objcopy --redefine-syms ${REDIFINED_VLC_MODULES_DIR}/syms $file $outfile
checkfail "objcopy failed"
DEFINITION=$DEFINITION"int vlc_entry__$name (int (*)(void *, void *, int, ...), void *);\n";
BUILTINS="$BUILTINS vlc_entry__$name,\n";
done;
BUILTINS="$BUILTINS NULL\n};\n"; \
printf "/* Autogenerated from the list of modules */\n $DEFINITION\n $BUILTINS\n" > libvlc/jni/libvlcjni.h
printf "/* Autogenerated from the list of modules */\n$DEFINITION\n$BUILTINS\n" > libvlc/jni/libvlcjni.h
rm ${REDIFINED_VLC_MODULES_DIR}/syms
###############################
# NDK-Build for libvlcjni.so #
###############################
LIBVLC_LIBS="libvlcjni"
VLC_MODULES=`echo $VLC_MODULES|sed "s|vlc/$VLC_BUILD_DIR|../vlc/$VLC_BUILD_DIR|g"`
VLC_MODULES=$(find_modules ${REDIFINED_VLC_MODULES_DIR})
VLC_SRC_DIR="$SRC_DIR/vlc"
ANDROID_SYS_HEADERS="$SRC_DIR/android-headers"
VLC_CONTRIB="$VLC_SRC_DIR/contrib/$TARGET_TUPLE"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment