Skip to content

Commit

Permalink
configure-system-libraries.sh: Skip 32bit libraries during lookup on …
Browse files Browse the repository at this point in the history
…x64 Linux. #21353
  • Loading branch information
tinix0 committed Apr 3, 2024
1 parent 0c43801 commit 12ff759
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions configure-system-libraries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# This file must stay /bin/sh and POSIX compliant for macOS and BSD portability.
# Copy-paste the entire script into http://shellcheck.net to check.
####

set -o errexit || exit $?

patch_config()
Expand Down Expand Up @@ -37,11 +36,18 @@ patch_config()
if [ -L "bin/${REPLACE}" ]; then
return 0
fi

KERNEL="$(uname -s)"
ARCH="$(arch)"
printf "Searching for %s... " "${LABEL}"
for DIR in ${SEARCHDIRS} ; do
for LIB in ${SEARCH}; do
if [ -f "${DIR}/${LIB}" ]; then
# x86-64 Linux might have 32-bit libraries present, link against the 64 bit libraries since there is no 32-bit Linux release of dotnet
if [ "${KERNEL}" = "Linux" ] && [ "${ARCH}" = "x86_64" ]; then
if [ "$(LANG=C file -L -b "${DIR}/${LIB}" | cut -d" " -f2)" != "64-bit" ]; then
continue
fi
fi
echo "${LIB}"
ln -s "${DIR}/${LIB}" "bin/${REPLACE}"
return 0
Expand Down Expand Up @@ -69,8 +75,8 @@ if [ "$(uname -s)" = "Darwin" ]; then
patch_config FreeType "${SEARCHDIRS}" bin/OpenRA.Platforms.Default.dll.config freetype6.dylib libfreetype.6.dylib
else
SEARCHDIRS="/lib /lib64 /usr/lib /usr/lib64 /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu /usr/lib/arm-linux-gnueabihf /usr/lib/aarch64-linux-gnu /usr/lib/powerpc64le-linux-gnu /usr/lib/mipsel-linux-gnu /usr/local/lib /opt/lib /opt/local/lib /app/lib"
patch_config "Lua 5.1" "${SEARCHDIRS}" bin/Eluant.dll.config lua51.so "liblua.so.5.1.5 liblua5.1.so.5.1 liblua5.1.so.0 liblua.so.5.1 liblua-5.1.so liblua5.1.so"
patch_config SDL2 "${SEARCHDIRS}" bin/SDL2-CS.dll.config SDL2.so "libSDL2-2.0.so.0 libSDL2-2.0.so libSDL2.so"
patch_config OpenAL "${SEARCHDIRS}" bin/OpenAL-CS.dll.config soft_oal.so "libopenal.so.1 libopenal.so"
#patch_config "Lua 5.1" "${SEARCHDIRS}" bin/Eluant.dll.config lua51.so "liblua.so.5.1.5 liblua5.1.so.5.1 liblua5.1.so.0 liblua.so.5.1 liblua-5.1.so liblua5.1.so"
#patch_config SDL2 "${SEARCHDIRS}" bin/SDL2-CS.dll.config SDL2.so "libSDL2-2.0.so.0 libSDL2-2.0.so libSDL2.so"
#patch_config OpenAL "${SEARCHDIRS}" bin/OpenAL-CS.dll.config soft_oal.so "libopenal.so.1 libopenal.so"
patch_config FreeType "${SEARCHDIRS}" bin/OpenRA.Platforms.Default.dll.config freetype6.so "libfreetype.so.6 libfreetype.so"
fi

0 comments on commit 12ff759

Please sign in to comment.