better handling for embedded/dynamic libraries

This commit is contained in:
filux 2016-09-04 22:06:52 +02:00
parent 74ed3d73be
commit 155a80f6b7
7 changed files with 141 additions and 87 deletions

View File

@ -10,18 +10,19 @@ matrix:
env: Tr_Compiler_Version="6" env: Tr_Compiler_Version="6"
# https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test # https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
dist: trusty # broken compiler on 12.04 dist: trusty # broken compiler on 12.04
- os: linux #- os: linux
compiler: gcc # compiler: gcc
env: Tr_Compiler_Version="5" # env: Tr_Compiler_Version="5"
# https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test # https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
dist: trusty # dist: trusty
- os: linux - os: linux
compiler: gcc compiler: gcc
env: Tr_Compiler_Version="default" env: Tr_Compiler_Version="default"
- os: linux - os: linux
compiler: clang compiler: clang
env: Tr_Compiler_Version="3.8" env: Tr_Compiler_Version="3.8"
# http://apt.llvm.org/ # http://apt.llvm.org/, compiler not newer than available on debian testing
# https://packages.debian.org/search?suite=testing&keywords=clang-
dist: trusty dist: trusty
- os: linux - os: linux
compiler: clang compiler: clang
@ -31,15 +32,13 @@ matrix:
# osx_image: xcode8 # osx_image: xcode8
# env: Tr_Xcode_Version="8" # env: Tr_Xcode_Version="8"
# https://docs.travis-ci.com/user/osx-ci-environment/#OS-X-Version # https://docs.travis-ci.com/user/osx-ci-environment/#OS-X-Version
# odd linking problems related with brew which is not creating links, e.g. solution
# (quite bad) "brew link gettext", or showing in cmake direct paths (also not so good)
- os: osx - os: osx
env: Tr_Xcode_Version="default" env: Tr_Xcode_Version="default"
fast_finish: true fast_finish: true
allow_failures: allow_failures:
- os: linux #- os: osx
compiler: clang # osx_image: xcode8
env: Tr_Compiler_Version="default" # env: Tr_Xcode_Version="8"
git: git:
submodules: false submodules: false
@ -52,6 +51,8 @@ before_install:
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then ./.travis-before_install.sh "$CC" "$Tr_Compiler_Version"; fi - if [ "$TRAVIS_OS_NAME" = "linux" ]; then ./.travis-before_install.sh "$CC" "$Tr_Compiler_Version"; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; fi - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install sdl2 lua freetype ftgl libogg glew libvorbis cppunit glib fribidi miniupnpc wxmac; fi - if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install sdl2 lua freetype ftgl libogg glew libvorbis cppunit glib fribidi miniupnpc wxmac; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ] && [ "$Tr_Xcode_Version" != "default" ]; then brew link --force gettext; fi
# ^ odd linking problems related with brew which is not creating links, not on travis also needed are: cmake + pkgconfig + xquartz (find by "search") + (maybe) git
- if [ "$Tr_Compiler_Version" != "" ] && [ "$Tr_Compiler_Version" != "default" ] && [ "$CC" = "gcc" ]; then export CXX="g++-${Tr_Compiler_Version}" CC="gcc-${Tr_Compiler_Version}"; fi - if [ "$Tr_Compiler_Version" != "" ] && [ "$Tr_Compiler_Version" != "default" ] && [ "$CC" = "gcc" ]; then export CXX="g++-${Tr_Compiler_Version}" CC="gcc-${Tr_Compiler_Version}"; fi
- if [ "$Tr_Compiler_Version" != "" ] && [ "$Tr_Compiler_Version" != "default" ] && [ "$CC" == "clang" ]; then export CXX="clang++-${Tr_Compiler_Version}" CC="clang-${Tr_Compiler_Version}"; fi - if [ "$Tr_Compiler_Version" != "" ] && [ "$Tr_Compiler_Version" != "default" ] && [ "$CC" == "clang" ]; then export CXX="clang++-${Tr_Compiler_Version}" CC="clang-${Tr_Compiler_Version}"; fi
- $CC --version - $CC --version

@ -1 +1 @@
Subproject commit f755b3e2562bcae1b15e35180c51b1c5749847f8 Subproject commit aea4d1ce128e104025b6a6a14e638c48acc113ac

View File

@ -66,12 +66,12 @@ fi
cd $PROJDIR cd $PROJDIR
mkdir -p "$RELEASEDIR/lib" mkdir -p "$RELEASEDIR/lib"
[[ -d "lib" ]] && rm -rf "lib" if [ -d "lib" ]; then rm -rf "lib"; fi
echo "building binary dependencies ..." echo "building binary dependencies ..."
./makedeps_folder.sh megaglest for mg_bin in megaglest megaglest_editor megaglest_g3dviewer; do
if [ $? -ne 0 ]; then ./makedeps_folder.sh "$mg_bin"
echo 'ERROR: "./makedeps_folder.sh megaglest" failed.' >&2; exit 2 if [ "$?" -ne "0" ]; then echo "ERROR: \"./makedeps_folder.sh $mg_bin\" failed." >&2; exit 2; fi
fi done
# copy binary info # copy binary info
cd $PROJDIR cd $PROJDIR

View File

@ -22,16 +22,21 @@ sync_support_libs(){
local _cp="/bin/cp" local _cp="/bin/cp"
#local skip_deps="libm.so libpthread.so libstdc++.so libgcc_s.so libc.so libdl.so libX11.so libpulse libfusion libdirect libnvidia libXext librt libxcb libICE libSM libXtst libwrap libdbus libXau libXdmcp libnsl libFLAC libGL" #local skip_deps="libm.so libpthread.so libstdc++.so libgcc_s.so libc.so libdl.so libX11.so libpulse libfusion libdirect libnvidia libXext librt libxcb libICE libSM libXtst libwrap libdbus libXau libXdmcp libnsl libFLAC libGL"
local skip_deps="" local skip_deps=""
local keep_deps="libcurl libgnu libgcrypt libnghttp libidn librtmp libssh libnettle libicu liblua libjpeg libpng libircclient libminiupnpc libwx libgtk libgdk libftgl libfreetype libvlc" local keep_deps="libcurl libgnu libgcrypt libnghttp libidn librtmp libssh libnettle libicu liblua libjpeg libpng libvorbis libogg libircclient libminiupnpc libwx_ libGLEW libftgl libfreetype libvlc libopenal libSDL2-"
# libwx_ - recommended to keep always just because API/ABI compatibility, huge impact for map editor
# libGLEW - most likely safe to keep embedded everywhere, its version matters with tools
# libopenal - safe to keep but if any version is available locally then should be replaced
# libSDL2 - safe to keep on .deb family only and even there, if any version is available locally then should be replaced
# liblber & libldap_r - aren't safe to keep, very nasty secondary dependencies
local scan_via_skiplist=1 local scan_via_skiplist=1
if [ -n "$skip_deps" ]; then if [ -n "$skip_deps" ]; then
scan_via_skiplist=1 scan_via_skiplist=1
echo 'scanning for deps TO SKIP...' echo "scanning for deps TO SKIP for '$pFILE'..."
elif [ -n "$keep_deps" ]; then elif [ -n "$keep_deps" ]; then
scan_via_skiplist=0 scan_via_skiplist=0
echo 'scanning for deps TO KEEP...' echo "scanning for deps TO KEEP for '$pFILE'..."
fi fi
@ -48,7 +53,7 @@ sync_support_libs(){
skipfile=0 skipfile=0
if [ $scan_via_skiplist -eq 1 ]; then if [ $scan_via_skiplist -eq 1 ]; then
for j in $(echo $skip_deps) for j in $(echo $skip_deps)
do do
if [ `awk "BEGIN {print index(\"$i\", \"$j\")}"` -ne 0 ]; then if [ `awk "BEGIN {print index(\"$i\", \"$j\")}"` -ne 0 ]; then
@ -57,7 +62,7 @@ sync_support_libs(){
break break
fi fi
done done
elif [ $scan_via_skiplist -eq 0 ]; then elif [ $scan_via_skiplist -eq 0 ]; then
skipfile=1 skipfile=1
for j in $(echo $keep_deps) for j in $(echo $keep_deps)
do do
@ -69,7 +74,7 @@ sync_support_libs(){
done done
fi fi
if [ $skipfile -eq 0 ]; then if [ "$skipfile" -eq "0" ] && [ ! -e "$d/$(basename "$i")" ]; then
echo Including file = [$i] echo Including file = [$i]
${_cp} -f $i ${d} ${_cp} -f $i ${d}
fi fi
@ -91,9 +96,7 @@ usage(){
} }
[ $# -eq 0 ] && usage [ $# -eq 0 ] && usage
#[ ! -d $BASE ] && mkdir -p $BASE if [ ! -d "$BASE" ]; then mkdir -p "$BASE"; fi
[ -d $BASE ] && rm -r $BASE
mkdir -p $BASE
# copy all files # copy all files
for f in $file for f in $file

View File

@ -1,12 +1,11 @@
#!/bin/sh #!/bin/sh
# 2011 Written by Mark Vejvoda <mark_vejvoda@hotmail.com> # 2011 Written by Mark Vejvoda <mark_vejvoda@hotmail.com>
# 2014 Rewritten by filux <heross(@@)o2.pl> # 2014 Rewritten by filux <heross(@@)o2.pl>
# Copyright (c) 2011-2015 under GNU GPL v3.0+ # Copyright (c) 2011-2016 under GNU GPL v3.0+
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# If you want to have core files generated (for debugging purposes): # If you want to have core files generated (for debugging purposes):
# ulimit -c unlimited # ulimit -c unlimited
LANG=C LANG=C
SCRIPTLOCATION="$(readlink -f "$0")" SCRIPTLOCATION="$(readlink -f "$0")"
GAMEDIR="$(dirname "$SCRIPTLOCATION")" GAMEDIR="$(dirname "$SCRIPTLOCATION")"
ARCHITECTURE="$(uname -m | tr '[A-Z]' '[a-z]')" ARCHITECTURE="$(uname -m | tr '[A-Z]' '[a-z]')"
@ -22,20 +21,21 @@ SHORT_GAME_NAME="megaglest"
# e.g. "\"long name with spaces\"" # e.g. "\"long name with spaces\""
LONG_GAME_NAME="MegaGlest" LONG_GAME_NAME="MegaGlest"
# ------- # -------
LIBDIR="lib"; ExitStatus=0; LibsWarnings=""; IgnoredLibs="" LIBDIR="lib"; ExitStatus=0; LibsWarnings=""; IgnoredLibs=""; FirstLnError=""
if [ ! -d "$GAMEDIR/$LIBDIR" ]; then mkdir "$GAMEDIR/$LIBDIR"; fi if [ ! -d "$GAMEDIR/$LIBDIR" ]; then mkdir "$GAMEDIR/$LIBDIR"; fi
if [ "$1" = "--tool-editor" ] || [ "$1" = "--tool-g3dviewer" ] || [ "$1" = "--tool-buginfo" ]; if [ "$1" = "--tool-editor" ] || [ "$1" = "--tool-g3dviewer" ] || [ "$1" = "--tool-buginfo" ];
then OperatingMode="$1"; else OperatingMode="--game"; fi then OperatingMode="$1"; else OperatingMode="--game"; fi
BeginTime="$(date +"%s")" BeginTime="$(date +"%s")"
if [ "$(which lsb_release 2>/dev/null)" != "" ]; then WhichLsbRelease="$(which lsb_release 2>/dev/null)"
OS_INFO_P="$(which lsb_release) -d" if [ "$WhichLsbRelease" != "" ]; then
OS_INFO="$($OS_INFO_P | awk -F ':[ \t]*' '{print $2}')" OS_INFO="$($WhichLsbRelease -d | awk -F ':[ \t]*' '{print $2}')"
fi fi
if [ "$OperatingMode" != "--tool-buginfo" ]; then if [ "$OperatingMode" != "--tool-buginfo" ]; then
if [ "$LDCONFIG" = "" ]; then if [ "$LDCONFIG" = "" ]; then
if [ "$(which ldconfig 2>/dev/null)" != "" ]; then WhichLdconfig="$(which ldconfig 2>/dev/null)"
LDCONFIG="$(which ldconfig 2>/dev/null)"; LDconfigType=1 if [ "$WhichLdconfig" != "" ]; then
LDCONFIG="$WhichLdconfig"; LDconfigType=1
elif [ -x "/sbin/ldconfig" ]; then elif [ -x "/sbin/ldconfig" ]; then
LDCONFIG="/sbin/ldconfig"; LDconfigType=2 LDCONFIG="/sbin/ldconfig"; LDconfigType=2
else else
@ -47,7 +47,7 @@ if [ "$OperatingMode" != "--tool-buginfo" ]; then
LDconfigType=9 LDconfigType=9
fi fi
LibsWarnings="$LibsWarnings LibsWarnings="$LibsWarnings
|| $LONG_GAME_NAME requires some libraries to be present on this system. || $LONG_GAME_NAME requires some libraries to be present on this operating system.
|| Missing libraries (if any) will be listed next, along with full names || Missing libraries (if any) will be listed next, along with full names
|| and default versions. Use the package manager provided by your Linux || and default versions. Use the package manager provided by your Linux
|| distribution to install them. Most Linux distributions provide a web search || distribution to install them. Most Linux distributions provide a web search
@ -60,7 +60,7 @@ if [ "$OperatingMode" != "--tool-buginfo" ]; then
|| downloaded and installed by running this script: || downloaded and installed by running this script:
|| '${SHORT_GAME_NAME}-mini-update.sh' || '${SHORT_GAME_NAME}-mini-update.sh'
|| ||
|| If, after this, $LONG_GAME_NAME still fails to start, please report a bug at || If after this, $LONG_GAME_NAME still fails to start, please report a bug at
|| '$BugReportEngine' || '$BugReportEngine'
|| or '$BugReportBoth'" || or '$BugReportBoth'"
LibsWarnings="$LibsWarnings LibsWarnings="$LibsWarnings
@ -69,19 +69,15 @@ if [ "$OperatingMode" != "--tool-buginfo" ]; then
|| OS info. [$OS_INFO], Arch.[$ARCHITECTURE], Dir.[$GAMEDIR]" || OS info. [$OS_INFO], Arch.[$ARCHITECTURE], Dir.[$GAMEDIR]"
if [ "$ARCHITECTURE" = "x86_64" ]; then GrepPattern="x86[_-]64" if [ "$ARCHITECTURE" = "x86_64" ]; then GrepPattern="x86[_-]64"
else GrepPattern="$ARCHITECTURE"; fi else GrepPattern="$ARCHITECTURE"; fi
LDCONFIG_P="$($LDCONFIG -p)"; ArchSortLibs="no" LDCONFIG_P="$($LDCONFIG -p)"; ArchSortLibs="no"
LDCONFIG_P_ARCH="$(echo "$LDCONFIG_P" | grep "$GrepPattern")" LDCONFIG_P_ARCH="$(echo "$LDCONFIG_P" | grep "$GrepPattern")"
if [ "$LDCONFIG_P_ARCH" != "" ]; then if [ "$LDCONFIG_P_ARCH" != "" ]; then
LDCONFIG_P_R_ARCH="$(echo "$LDCONFIG_P" | grep -v "$GrepPattern")" LDCONFIG_P_R_ARCH="$(echo "$LDCONFIG_P" | grep -v "$GrepPattern")"
ArchSortLibs="yes" ArchSortLibs="yes"
fi fi
if [ "$OperatingMode" = "--game" ]; then if [ "$OperatingMode" = "--game" ]; then ldd_target="$GAMEDIR/$EXC_BINARY"
ldd_target="$GAMEDIR/$EXC_BINARY" else ldd_target="$GAMEDIR/$2"; fi
else
ldd_target="$GAMEDIR/$2"
fi
c_required_libs="$(ldd "$ldd_target")"
hasSOlib() { hasSOlib() {
if [ "$2" = "myarch" ]; then if [ "$2" = "myarch" ]; then
@ -96,21 +92,25 @@ if [ "$OperatingMode" != "--tool-buginfo" ]; then
findMissingSO() { findMissingSO() {
SO_WANTED_LIB="$1"; SO_WANTED_LIB2="$2"; SO_LIB_PATTERN="$3" SO_WANTED_LIB="$1"; SO_WANTED_LIB2="$2"; SO_LIB_PATTERN="$3"
SO_LINKED_LIB="$GAMEDIR/$LIBDIR/$SO_WANTED_LIB2" SO_LINKED_LIB="$GAMEDIR/$LIBDIR/$SO_WANTED_LIB2"
hasSO="$(hasSOlib "$SO_LIB_PATTERN" "myarch")"; CommonPart="no" hasSO="$(hasSOlib "$SO_LIB_PATTERN" "myarch")"; CommonPart="no"
if [ "$hasSO" != "" ]; then if [ ! -L "$SO_LINKED_LIB" ] && [ -e "$SO_LINKED_LIB" ]; then EmbLibExist="yes"; else EmbLibExist="no"; fi
if [ "$hasSO" != "" ] && ( [ "$6" != "|L" ] || [ "$EmbLibExist" = "no" ] ); then
CommonPart="yes" CommonPart="yes"
elif [ "$SO_WANTED_LIB" = "$SO_LIB_PATTERN" ] && [ ! -h "$SO_LINKED_LIB" ] && [ -e "$SO_LINKED_LIB" ]; then elif [ "$SO_WANTED_LIB" = "$SO_LIB_PATTERN" ] && [ "$EmbLibExist" = "yes" ] && [ "$6" != "|H" ]; then
if [ "$6" = "|L" ]; then Emb_Keyword=" is used as"; else Emb_Keyword=" is missing in your OS, using"; fi
LibsWarnings="$LibsWarnings LibsWarnings="$LibsWarnings
||- default library [$SO_WANTED_LIB2] is missing in your OS, using embedded library." ||- default library ${5}[$SO_WANTED_LIB2]$Emb_Keyword embedded library."
return 0 return 0
else else
hasSO="$(hasSOlib "$SO_LIB_PATTERN")" hasSO="$(hasSOlib "$SO_LIB_PATTERN")"
if [ "$ArchSortLibs" = "yes" ] && [ "$hasSO" != "" ]; then if [ "$ArchSortLibs" = "yes" ] && [ "$hasSO" != "" ]; then
CommonPart="yes" CommonPart="yes"
else else
if [ "$SO_WANTED_LIB" = "$SO_LIB_PATTERN" ]; then if [ "$SO_WANTED_LIB" = "$SO_LIB_PATTERN" ] && ( [ "$EmbLibExist" = "no" ] || [ "$6" = "|H" ] ); then
if [ "$6" = "|H" ] && [ "$EmbLibExist" = "yes" ]; then Emb_Keyword2=" (ae)"; else Emb_Keyword2=""; fi
LibsWarnings="$LibsWarnings LibsWarnings="$LibsWarnings
||- default library [$SO_WANTED_LIB2] is missing in your OS, attempting to find and link to different version if is available..." ||- default library ${5}[$SO_WANTED_LIB2] is missing in your OS${Emb_Keyword2}, attempting to find and link to different version if is available..."
fi fi
if [ "$4" != "no" ]; then if [ "$4" != "no" ]; then
LibsWarnings="$LibsWarnings LibsWarnings="$LibsWarnings
@ -121,15 +121,24 @@ if [ "$OperatingMode" != "--tool-buginfo" ]; then
fi fi
if [ "$CommonPart" = "yes" ]; then if [ "$CommonPart" = "yes" ]; then
if [ "$SO_WANTED_LIB" != "$SO_LIB_PATTERN" ]; then if [ "$SO_WANTED_LIB" != "$SO_LIB_PATTERN" ]; then
LibsWarnings="$LibsWarnings
|| new library link [.../$LIBDIR/$SO_WANTED_LIB2] pointed to [$hasSO]."
ln -f -s "$hasSO" "$SO_LINKED_LIB" ln -f -s "$hasSO" "$SO_LINKED_LIB"
if [ "$?" -eq "0" ]; then
LibsWarnings="$LibsWarnings
|| new library link [.../$LIBDIR/$SO_WANTED_LIB2] pointed to [$hasSO]."
else
LibsWarnings="$LibsWarnings
|| ERROR: Detected some problems during process of creating symlink."
if [ "$FirstLnError" = "" ]; then FirstLnError="no"
LibsWarnings="$LibsWarnings
|| ... lack of write permissions in game location?"
fi
fi
else else
if [ -e "$SO_LINKED_LIB" ]; then rm -f "$SO_LINKED_LIB"; fi if [ -e "$SO_LINKED_LIB" ]; then rm -f "$SO_LINKED_LIB"; fi
if [ "$(echo "$c_required_libs" | grep "$SO_LIB_PATTERN[ \t]*=>[ \t]*not found")" != "" ]; then if [ "$(echo "$c_required_libs" | grep "${SO_LIB_PATTERN}[ \t]*=>[ \t]*not found")" != "" ] && [ "$EmbLibExist" = "no" ]; then
#rare exception #rare exception
LibsWarnings="$LibsWarnings LibsWarnings="$LibsWarnings
||- default library: [$SO_WANTED_LIB2] is missing in your OS, attempting to find and link to different version if is available... ||- default library: ${5}[$SO_WANTED_LIB2] is missing in your OS, attempting to find and link to different version if is available...
|| > not found !" || > not found !"
fi fi
fi fi
@ -139,24 +148,38 @@ if [ "$OperatingMode" != "--tool-buginfo" ]; then
checkLibsStatus() { checkLibsStatus() {
if [ "$1" != "" ]; then if [ "$1" != "" ]; then
list_of_libs="$(echo "$1" | sed -e 's|\([^\]\)\.|\1\\.|g' -e 's|\[num\]|[0-9]\\+|g')" check_nr=1
for var in $list_of_libs; do while [ "$check_nr" -le "2" ]; do
patterns="$(echo "$var" | sed -e 's|^ */||' -e 's|/| |g' -e 's/| /|/')" if [ "$check_nr" -eq "1" ]; then c_required_libs="$(ldd "$ldd_target")"; else
patterns_num="$(echo "$patterns" | wc -w)" c_required_libs="$(LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}${GAMEDIR}/${LIBDIR}" ldd "$ldd_target")"
wanted_lib="$(echo "$patterns" | awk '{print $1}')"; i=2
wanted_lib2="$(echo "$wanted_lib" | sed 's/\\//g')";
last_pattern="$(echo "$patterns" | awk '{print $(NF-1)}')"
if [ "$(echo "$c_required_libs" | grep "[^_-]$last_pattern")" != "" ]; then
for var2 in $patterns; do
if [ "$var2" = "|" ]; then break; fi
lib_pattern="$(echo "$var" | awk -F '/' -v ii="$i" '{print $ii}')"
if [ "$i" -lt "$patterns_num" ]; then end_w="no"; else end_w="yes"; fi
findMissingSO "$wanted_lib" "$wanted_lib2" "$lib_pattern" "$end_w"
if [ "$?" -eq "0" ]; then break; else i=$((i + 1)); fi
done
else
IgnoredLibs="$IgnoredLibs $wanted_lib2"
fi fi
list_of_libs="$(echo "$1" | sed -e 's|\([^\]\)\.|\1\\.|g' -e 's|\[num\]|[0-9]\\+|g')"
for var in $list_of_libs; do
patterns="$(echo "$var" | sed -e 's|^ */||' -e 's|/| |g' -e 's/\(|[HL]\?\) /\1/')"
wanted_lib="$(echo "$patterns" | awk '{print $1}')"; i=2
if [ "$check_nr" -ne "1" ] && [ "$(echo "$IgnoredLibs" | grep "$wanted_lib")" != "" ]; then WantedLibIgnored="yes"
else WantedLibIgnored="no"; fi
if [ "$check_nr" -eq "1" ] || [ "$WantedLibIgnored" = "yes" ]; then
wanted_lib2="$(echo "$wanted_lib" | sed 's/\\//g')"; patterns_num="$(echo "$patterns" | wc -w)"
last_pattern="$(echo "$patterns" | awk '{print $(NF-1)}')"; end_mark="$(echo "$patterns" | awk '{print $NF}')"
if [ "$check_nr" -ne "1" ]; then foreign_dep="(sd) "; else foreign_dep=""; fi
if [ "$(echo "$c_required_libs" | grep "[^_-]$last_pattern")" != "" ]; then
if [ "$WantedLibIgnored" = "yes" ]; then IgnoredLibs="$(echo "$IgnoredLibs" | sed "s|$wanted_lib||")"; fi
for var2 in $patterns; do
if [ "$var2" = "|" ] || [ "$var2" = "|H" ] || [ "$var2" = "|L" ]; then break; fi
lib_pattern="$(echo "$var" | awk -F '/' -v ii="$i" '{print $ii}')"
if [ "$wanted_lib" != "$last_pattern" ] && [ "$i" -lt "$patterns_num" ]; then end_w="no"
else end_w="yes"; fi
findMissingSO "$wanted_lib" "$wanted_lib2" "$lib_pattern" "$end_w" "$foreign_dep" "$end_mark"
if [ "$?" -eq "0" ]; then break; else i=$((i + 1)); fi
done
elif [ "$WantedLibIgnored" = "no" ]; then
IgnoredLibs="$IgnoredLibs $wanted_lib2"
if [ -L "$GAMEDIR/$LIBDIR/$wanted_lib2" ]; then rm -f "$GAMEDIR/$LIBDIR/$wanted_lib2"; fi
fi
fi
done
check_nr=$((check_nr + 1))
done done
fi fi
} }
@ -168,15 +191,20 @@ if [ "$OperatingMode" != "--tool-buginfo" ]; then
# or [num] what mean "any number with one or more digits". # or [num] what mean "any number with one or more digits".
# Last word should have length at least 6 chars, but use longer if string is too much common. # Last word should have length at least 6 chars, but use longer if string is too much common.
# If line is ended by /|H/ this mean 'H'igher priority about finding local library instead of existing
# (if exist) embedded version, useful in case if embedded library has a lot of own dependencies.
# If line is ended by /|L/ this mean 'L'ower priority about finding local library instead of existing
# (if exist) embedded version, (rarely) useful in case if embedded library may eliminate ABI-API
# conflixts, e.g. binary <> WxWidgets.
# ignored: linux-vdso.so*, linux-gate.so*, ld-linux-*.so*, libpthread.so*, libpulsecommon-*.so, libresolv.so* # ignored: linux-vdso.so*, linux-gate.so*, ld-linux-*.so*, libpthread.so*, libpulsecommon-*.so, libresolv.so*
libs_list="/libSDL2-2.0.so.0/libSDL2-2.[num].so/libSDL2-[0-9].[num].so/libSDL2-/|/ libs_list="/libSDL2-2.0.so.0/libSDL2-2.[num].so/libSDL2-[0-9].[num].so/libSDL2-/|H/
/libGLU.so.1/libGLU.so/|/ /libGLU.so.1/libGLU.so/|/
/libGL.so.1/libGL.so/|/ /libGL.so.1/libGL.so/|/
/libX11.so.6/libX11.so/|/ /libX11.so.6/libX11.so/|/
/libidn.so.11/libidn.so/|/ /libidn.so.11/libidn.so/|/
/librtmp.so.0/librtmp.so/|/ /librtmp.so.0/librtmp.so/|/
/libgcrypt.so.11/libgcrypt.so.1[0-9]/libgcrypt.so/libgcrypt/|/ /libgcrypt.so.11/|/
/libgnutls.so.26/libgnutls.so.2[0-9]/libgnutls.so/libgnutls/|/ /libgnutls.so.26/|/
/libgssapi_krb5.so.2/libgssapi_krb[0-9].so/libgssapi_krb[num].so/libgssapi_krb/|/ /libgssapi_krb5.so.2/libgssapi_krb[0-9].so/libgssapi_krb[num].so/libgssapi_krb/|/
/liblber-2.4.so.2/liblber-2.[num].so/liblber-[0-9].[num].so/liblber-/liblber/|/ /liblber-2.4.so.2/liblber-2.[num].so/liblber-[0-9].[num].so/liblber-/liblber/|/
/libldap_r-2.4.so.2/libldap_r-2.[num].so/libldap_r-[0-9].[num].so/libldap_r-/libldap_r/|/ /libldap_r-2.4.so.2/libldap_r-2.[num].so/libldap_r-[0-9].[num].so/libldap_r-/libldap_r/|/
@ -255,14 +283,14 @@ if [ "$OperatingMode" != "--tool-buginfo" ]; then
/libGLEW.so.1.10/libGLEW.so.1.[num]/libGLEW.so/|/" /libGLEW.so.1.10/libGLEW.so.1.[num]/libGLEW.so/|/"
if [ "$OperatingMode" = "--game" ]; then if [ "$OperatingMode" = "--game" ]; then
libs_list="$libs_list libs_list="$libs_list
/libopenal.so.1/libopenal.so/libopenal/|/ /libopenal.so.1/libopenal.so/libopenal/|H/
/libvlccore.so.7/libvlccore.so/libvlccore/|/ /libvlccore.so.7/libvlccore.so/libvlccore/|/
/libvlc.so.5/libvlc.so/|/" /libvlc.so.5/libvlc.so/|/"
else else
libs_list="$libs_list libs_list="$libs_list
/libwx_gtk2u_core-3.0.so.0/libwx_gtk2u_core-3.[num].so/|/ /libwx_gtk2u_core-3.0.so.0/libwx_gtk2u_core-3.[num].so/|L/
/libwx_baseu-3.0.so.0/libwx_baseu-3.[num].so/|/ /libwx_baseu-3.0.so.0/libwx_baseu-3.[num].so/|L/
/libwx_gtk2u_gl-3.0.so.0/libwx_gtk2u_gl-3.[num].so/|/ /libwx_gtk2u_gl-3.0.so.0/libwx_gtk2u_gl-3.[num].so/|L/
/libgtk-x11-2.0.so.0/libgtk-x11-2.[num].so/libgtk-x11-[0-9].[num].so/libgtk-x11-[0-9]/libgtk-x11/|/ /libgtk-x11-2.0.so.0/libgtk-x11-2.[num].so/libgtk-x11-[0-9].[num].so/libgtk-x11-[0-9]/libgtk-x11/|/
/libgdk-x11-2.0.so.0/libgdk-x11-2.[num].so/libgdk-x11-[0-9].[num].so/libgdk-x11-[0-9]/libgdk-x11/|/ /libgdk-x11-2.0.so.0/libgdk-x11-2.[num].so/libgdk-x11-[0-9].[num].so/libgdk-x11-[0-9]/libgdk-x11/|/
/libpangocairo-1.0.so.0/libpangocairo-1.[num].so/libpangocairo-[0-9].[num].so/libpangocairo-[0-9]/libpangocairo/|/ /libpangocairo-1.0.so.0/libpangocairo-1.[num].so/libpangocairo-[0-9].[num].so/libpangocairo-[0-9]/libpangocairo/|/
@ -272,7 +300,7 @@ if [ "$OperatingMode" != "--tool-buginfo" ]; then
/libgobject-2.0.so.0/libgobject-2.[num].so/libgobject-[0-9].[num].so/libgobject-[0-9]/libgobject/|/ /libgobject-2.0.so.0/libgobject-2.[num].so/libgobject-[0-9].[num].so/libgobject-[0-9]/libgobject/|/
/libglib-2.0.so.0/libglib-2.[num].so/libglib-[0-9].[num].so/libglib-[0-9]/libglib-/|/ /libglib-2.0.so.0/libglib-2.[num].so/libglib-[0-9].[num].so/libglib-[0-9]/libglib-/|/
/libSM.so.6/libSM.so/|/ /libSM.so.6/libSM.so/|/
/libjpeg.so.8/libjpeg.so.[0-9]/libjpeg.so/|/ /libjpeg.so.8/|/
/libtiff.so.5/libtiff.so/|/ /libtiff.so.5/libtiff.so/|/
/libgmodule-2.0.so.0/libgmodule-2.[num].so/libgmodule-[0-9].[num].so/libgmodule-[0-9]/libgmodule/|/ /libgmodule-2.0.so.0/libgmodule-2.[num].so/libgmodule-[0-9].[num].so/libgmodule-[0-9]/libgmodule/|/
/libatk-1.0.so.0/libatk-1.[num].so/libatk-[0-9].[num].so/libatk-[0-9]/|/ /libatk-1.0.so.0/libatk-1.[num].so/libatk-[0-9].[num].so/libatk-[0-9]/|/
@ -297,6 +325,27 @@ if [ "$OperatingMode" != "--tool-buginfo" ]; then
#else #else
#fi #fi
IfRealLibExist() {
RealEmbLib="$GAMEDIR/$LIBDIR/$1"
if [ ! -L "$RealEmbLib" ] && [ -e "$RealEmbLib" ]; then
if [ "$2" = "remove" ]; then rm -f "$RealEmbLib"; else return 0; fi
else return 1; fi
}
# exceptions, keep them in sync with listed libraries on 'libs_list'
if [ "$(echo "$OS_INFO" | grep 'Debian\|Ubuntu\|LinuxMint')" = "" ]; then IfRealLibExist "libSDL2-2.0.so.0" "remove"; fi
if [ "$OperatingMode" = "--game" ]; then
if [ "$(IfRealLibExist "libvlc.so.5"; echo "$?")" -ne "0" ] && [ "$(IfRealLibExist "libvlccore.so.7"; echo "$?")" -ne "0" ] && \
[ -d "$GAMEDIR/$LIBDIR/vlc" ]; then rm -rf "$GAMEDIR/$LIBDIR/vlc"; fi
else
if [ "$(IfRealLibExist "libwx_gtk2u_core-3.0.so.0"; echo "$?")" -ne "0" ] || \
[ "$(IfRealLibExist "libwx_baseu-3.0.so.0"; echo "$?")" -ne "0" ] || \
[ "$(IfRealLibExist "libwx_gtk2u_gl-3.0.so.0"; echo "$?")" -ne "0" ]; then
IfRealLibExist "libwx_gtk2u_core-3.0.so.0" "remove"
IfRealLibExist "libwx_baseu-3.0.so.0" "remove"
IfRealLibExist "libwx_gtk2u_gl-3.0.so.0" "remove"
fi
fi
checkLibsStatus "$libs_list" checkLibsStatus "$libs_list"
if [ -f "$GAMEDIR/${SHORT_GAME_NAME}-configure-desktop.sh" ]; then if [ -f "$GAMEDIR/${SHORT_GAME_NAME}-configure-desktop.sh" ]; then
"$GAMEDIR/${SHORT_GAME_NAME}-configure-desktop.sh" "$GAMEDIR/${SHORT_GAME_NAME}-configure-desktop.sh"
@ -312,9 +361,7 @@ fi
if [ "$OperatingMode" = "--game" ]; then if [ "$OperatingMode" = "--game" ]; then
if [ -d "$GAMEDIR/$LIBDIR" ]; then if [ -d "$GAMEDIR/$LIBDIR" ]; then
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}${GAMEDIR}/${LIBDIR}" export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}${GAMEDIR}/${LIBDIR}"
if [ -d "$GAMEDIR/$LIBDIR/vlc" ]; then if [ -d "$GAMEDIR/$LIBDIR/vlc" ]; then export VLC_PLUGIN_PATH="${GAMEDIR}/${LIBDIR}/vlc"; fi
export VLC_PLUGIN_PATH="${GAMEDIR}/${LIBDIR}/vlc"
fi
fi fi
"$GAMEDIR/$EXC_BINARY" "$@" "$GAMEDIR/$EXC_BINARY" "$@"
ExitStatus="$?" ExitStatus="$?"
@ -323,11 +370,14 @@ if [ "$OperatingMode" = "--game" ]; then
ErrorTime="$(date +"%s")" ErrorTime="$(date +"%s")"
fi fi
if [ "$ExitStatus" -ne "0" ] || [ "$OperatingMode" = "--tool-editor" ] || [ "$OperatingMode" = "--tool-g3dviewer" ]; then if [ "$ExitStatus" -ne "0" ] || [ "$OperatingMode" = "--tool-editor" ] || [ "$OperatingMode" = "--tool-g3dviewer" ]; then
if [ "$(echo "$@" | grep "^[ \t]*--help[ \t]*$")" = "" ] && [ "$(echo "$@" | grep "^[ \t]*-h[ \t]*$")" = "" ]; then if [ "$(echo "$@" | grep '^[ \t]*--help[ \t]*$\|^[ \t]*-h[ \t]*$')" = "" ]; then
DiffTime="$(($ErrorTime-$BeginTime))" DiffTime="$(($ErrorTime-$BeginTime))"
if [ "$DiffTime" -le "15" ] && [ -e "$GAMEDIR/$BinaryToCheck" ] && [ -x "$GAMEDIR/$BinaryToCheck" ]; then if [ "$OperatingMode" = "--game" ]; then ShowLibsTime=35; else ShowLibsTime=45; fi
if [ "$DiffTime" -le "$ShowLibsTime" ] && [ -e "$GAMEDIR/$BinaryToCheck" ] && [ -x "$GAMEDIR/$BinaryToCheck" ]; then
echo "$LibsWarnings" | sed 's/^[\t ]*||//g' >&2; echo echo "$LibsWarnings" | sed 's/^[\t ]*||//g' >&2; echo
if [ "$IgnoredLibs" != "" ]; then if [ "$OperatingMode" != "--tool-buginfo" ]; then
IgnoredLibs="$(echo "$IgnoredLibs" | sed -e 's/ */ /g' -e 's/^ //g')"
if [ "$IgnoredLibs" = "" ]; then IgnoredLibs="-none-"; fi
echo "Ignored libraries (please include in bug reports):" >&2 echo "Ignored libraries (please include in bug reports):" >&2
echo "$IgnoredLibs" >&2; echo echo "$IgnoredLibs" >&2; echo
fi fi
@ -339,7 +389,7 @@ if [ "$ExitStatus" -ne "0" ] || [ "$OperatingMode" = "--tool-editor" ] || [ "$Op
|| here: '$BugReportBoth2', || here: '$BugReportBoth2',
|| or if you think that bug is related with game engine here: || or if you think that bug is related with game engine here:
|| '$BugReportEngine'" || '$BugReportEngine'"
if [ "$BugReportData" != "" ] && [ "$BugReportData" != "$BugReportBoth2" ] && [ "$BugReportData" != "$BugReportEngine" ] ; then if [ "$BugReportData" != "" ] && [ "$BugReportData" != "$BugReportBoth2" ] && [ "$BugReportData" != "$BugReportEngine" ]; then
BugReportInfo="$BugReportInfo, BugReportInfo="$BugReportInfo,
|| or if you think that bug is related with game data here: || or if you think that bug is related with game data here:
|| '$BugReportData'." || '$BugReportData'."

@ -1 +1 @@
Subproject commit 0bc051300e71b01d332f03e6e7acb7d066052052 Subproject commit 86bb138f83988ada5c8cd75ca1b556d013f43190

View File

@ -1,4 +1,4 @@
local GAME_INSTALL_SIZE = 680000000; local GAME_INSTALL_SIZE = 705000000;
local GAME_VERSION = "3.12-dev"; local GAME_VERSION = "3.12-dev";
local _ = MojoSetup.translate local _ = MojoSetup.translate