Skip to content

Commit

Permalink
Merge pull request #31 from lethosor/debian-ld-path
Browse files Browse the repository at this point in the history
A few Debian fixes
  • Loading branch information
lethosor committed Mar 23, 2015
2 parents 47c29a6 + 6dfef26 commit b3f8a60
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pack/df_linux/dfhack
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ if [ -n "$DF_POST_CMD" ]; then
eval $DF_POST_CMD
fi

exit $ret
exit $ret
26 changes: 20 additions & 6 deletions pack/df_linux/distro_fixes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# and sets up env variables as workaround for use by the
# df/dfhack scripts.

function dlog() {
dlog() {
echo -e "\033[0;32m[distro_fixes]\033[0;00m $1 $2"
}

Expand Down Expand Up @@ -58,24 +58,38 @@ dlog "INFO" "DF_BIN_LOCATION: $DF_BIN_LOCATION"
# but I haven't found this necessary if LD_PRELOAD is properly set (on fedora).

if [ x"$DF_ARCH" == x'32-bit' ] && [ x"$ARCH" == x'x86_64' ]; then

dlog "INFO" "32 bit df on $OS/64bit detected"
# Fedora 21/64-bit is tested
if [ x"$OS" == x'Fedora' ]; then
export PRELOAD_LIB="${PRELOAD_LIB:+$PRELOAD_LIB:}/usr/lib/libz.so.1";
dlog "INFO" "32 bit df on $OS/64bit detected. Will set LD_PRELOAD to $PRELOAD_LIB...."
dlog "INFO" "Setting LD_PRELOAD to $PRELOAD_LIB"
# Gentoo 2.2
elif [ x"$OS" == x'Gentoo' ]; then
export PRELOAD_LIB="${PRELOAD_LIB:+$PRELOAD_LIB:}/lib32/libz.so.1";
dlog "INFO" "32 bit df on $OS/64bit detected. Will set LD_PRELOAD to $PRELOAD_LIB...."
dlog "INFO" "Setting LD_PRELOAD to $PRELOAD_LIB"
elif [ x"$OS" == x'Arch' ]; then
export PRELOAD_LIB="${PRELOAD_LIB:+$PRELOAD_LIB:}/usr/lib32/libz.so";
dlog "INFO" "32 bit df on $OS/64bit detected. Will set LD_PRELOAD to $PRELOAD_LIB...."
dlog "INFO" "Setting LD_PRELOAD to $PRELOAD_LIB"
elif [ x"$OS" == x'Debian' ]; then
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}/usr/lib/mesa-diverted/i386-linux-gnu"
if [ -f "/usr/lib32/libz.so" ]; then
export PRELOAD_LIB="${PRELOAD_LIB:+$PRELOAD_LIB:}/usr/lib32/libz.so"
else
zlib32=$(ls /usr/lib32/libz.so.* | head -n1)
if [ -f "$zlib32" ]; then
export PRELOAD_LIB="${PRELOAD_LIB:+$PRELOAD_LIB:}$zlib32"
else
dlog "WARN" "Could not find a 32-bit zlib"
fi
fi
dlog "INFO" "Setting LD_PRELOAD to $PRELOAD_LIB"
dlog "INFO" "Setting LD_LIBRARY_PATH to $LD_LIBRARY_PATH"
# Add your distro here...
# elif [ x"$OS" == x'MyFooDistro' ]; then
# export PRELOAD_LIB="${PRELOAD_LIB:+$PRELOAD_LIB:}<abspath_to_32bit_libz>";
# dlog "INFO" "32 bit df on $OS/64bit detected. Will set LD_PRELOAD to $PRELOAD_LIB...."
else
dlog "WARN" "32bit 'Dwarf_Fortress' on 64bit OS detected. If you get 'missing file' errors, please open an issue on Github."
dlog "WARN" "32bit 'Dwarf_Fortress' on unhandled 64bit OS detected. If you get 'missing file' errors, please open an issue on Github: https://github.com/Lazy-Newb-Pack/Lazy-Newb-Pack-Linux/issues."
fi

fi
Expand Down

0 comments on commit b3f8a60

Please sign in to comment.