diff --git a/Makefile b/Makefile index 825307ff..473cefd4 100644 --- a/Makefile +++ b/Makefile @@ -375,6 +375,12 @@ ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu" "gnu") CLIENT_LIBS=$(SDL_LIBS) RENDERER_LIBS = $(SDL_LIBS) -lGL + ifeq ($(USE_PORTABLE_RPATH),1) + # $ is escaped using two, so this is litterly $ORIGIN + CLIENT_LIBS+=-Wl,-rpath,'$$ORIGIN/lib/$(ARCH)' + RENDERER_LIBS+=-Wl,-rpath,'$$ORIGIN/lib/$(ARCH)' + endif + ifeq ($(USE_OPENAL),1) ifneq ($(USE_OPENAL_DLOPEN),1) CLIENT_LIBS += $(THREAD_LIBS) $(OPENAL_LIBS) diff --git a/make-linux-portable.sh b/make-linux-portable.sh new file mode 100755 index 00000000..8440bd93 --- /dev/null +++ b/make-linux-portable.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +if [ -z "$1" ]; then + echo "Usage: $0 " + echo " arch can be x86 or x86_64" + exit 0 +fi + +ARCH=$1 +SDL_PREFIX=/home/zack/Local/SDL-2.0.3/build-$ARCH + +SDL_CFLAGS="`$SDL_PREFIX/bin/sdl2-config --cflags`" +SDL_LIBS="`$SDL_PREFIX/bin/sdl2-config --libs`" + +make ARCH=$ARCH USE_PORTABLE_RPATH=1 SDL_CFLAGS="$SDL_CFLAGS" SDL_LIBS="$SDL_LIBS" +