mirror of https://github.com/libsdl-org/SDL
Set rpath instead of changing environment for RPi
Credit goes to Adrian Perez de Castro for the improvement. Signed-off-by: Guillermo A. Amaral <g@maral.me>
This commit is contained in:
parent
965c11f38a
commit
bd0def06ee
|
@ -1132,6 +1132,7 @@ macro(CheckRPI)
|
|||
set(VIDEO_RPI_INCLUDE_DIRS "/opt/vc/include" "/opt/vc/include/interface/vcos/pthreads" "/opt/vc/include/interface/vmcs_host/linux/" )
|
||||
set(VIDEO_RPI_LIBRARY_DIRS "/opt/vc/lib" )
|
||||
set(VIDEO_RPI_LIBRARIES bcm_host )
|
||||
set(VIDEO_RPI_LDFLAGS "-Wl,-rpath,/opt/vc/lib")
|
||||
endif()
|
||||
listtostr(VIDEO_RPI_INCLUDE_DIRS VIDEO_RPI_INCLUDE_FLAGS "-I")
|
||||
listtostr(VIDEO_RPI_LIBRARY_DIRS VIDEO_RPI_LIBRARY_FLAGS "-L")
|
||||
|
@ -1152,6 +1153,7 @@ macro(CheckRPI)
|
|||
set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_RPI_SOURCES})
|
||||
list(APPEND EXTRA_LIBS ${VIDEO_RPI_LIBRARIES})
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}")
|
||||
list(APPEND EXTRA_LDFLAGS ${VIDEO_RPI_LDFLAGS})
|
||||
endif(SDL_VIDEO AND HAVE_VIDEO_RPI)
|
||||
endif(VIDEO_RPI)
|
||||
endmacro(CheckRPI)
|
||||
|
|
|
@ -19551,7 +19551,7 @@ fi
|
|||
RPI_LDFLAGS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host"
|
||||
else
|
||||
RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
|
||||
RPI_LDFLAGS="-L/opt/vc/lib -lbcm_host"
|
||||
RPI_LDFLAGS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host"
|
||||
fi
|
||||
|
||||
# Save the original compiler flags and libraries
|
||||
|
|
|
@ -1580,7 +1580,7 @@ AC_HELP_STRING([--enable-video-rpi], [use Raspberry Pi video driver [[default=ye
|
|||
RPI_LDFLAGS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host"
|
||||
else
|
||||
RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
|
||||
RPI_LDFLAGS="-L/opt/vc/lib -lbcm_host"
|
||||
RPI_LDFLAGS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host"
|
||||
fi
|
||||
|
||||
# Save the original compiler flags and libraries
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
|
||||
#if SDL_VIDEO_DRIVER_RPI
|
||||
/* Raspbian places the OpenGL ES/EGL binaries in a non standard path */
|
||||
static const char g_rpi_opt_path[] = "/opt/vc/lib";
|
||||
#define DEFAULT_EGL ( vc4 ? "libEGL.so.1" : "libbrcmEGL.so" )
|
||||
#define DEFAULT_OGL_ES2 ( vc4 ? "libGLESv2.so.2" : "libbrcmGLESv2.so" )
|
||||
#define ALT_EGL "libEGL.so"
|
||||
|
@ -266,20 +265,6 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa
|
|||
#endif
|
||||
#if SDL_VIDEO_DRIVER_RPI
|
||||
SDL_bool vc4 = (0 == access("/sys/module/vc4/", F_OK));
|
||||
|
||||
path = SDL_getenv("LD_LIBRARY_PATH");
|
||||
if (path) {
|
||||
const int path_size = SDL_strlen(path) + 1 + sizeof(g_rpi_opt_path);
|
||||
char *new_path = SDL_calloc(1, path_size);
|
||||
strcat(new_path, path);
|
||||
strcat(new_path, ":");
|
||||
strcat(new_path, g_rpi_opt_path);
|
||||
SDL_setenv("LD_LIBRARY_PATH", new_path, 1);
|
||||
SDL_free(new_path);
|
||||
} else {
|
||||
SDL_setenv("LD_LIBRARY_PATH", g_rpi_opt_path, 1);
|
||||
}
|
||||
path = NULL;
|
||||
#endif
|
||||
|
||||
if (_this->egl_data) {
|
||||
|
|
Loading…
Reference in New Issue