Skip to content

Commit

Permalink
sdl static linking under OS X
Browse files Browse the repository at this point in the history
  • Loading branch information
miniupnp committed Jul 13, 2019
1 parent 3cdc8e1 commit 839bac6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions config.lib
Original file line number Diff line number Diff line change
Expand Up @@ -1010,9 +1010,14 @@ make_cflags_and_ldflags() {
# SDL must not add _GNU_SOURCE as it breaks many platforms
CFLAGS="$CFLAGS `$sdl_config --cflags | sed 's@-D_GNU_SOURCE[^ ]*@@'`"
if [ "$enable_static" != "0" ]; then
LIBS="$LIBS `$sdl_config --static-libs`"
if [ "$os" = "OSX" ] ; then
libpath=`$sdl_config --static-libs | cut -d ' ' -f 1 | cut -c 3- `
LIBS="$LIBS `$sdl_config --static-libs | sed 's@ -l\([^ ]*\)@ '${libpath}'/lib\1.a@g' `"
else
LIBS="$LIBS `$sdl_config --static-libs`"
fi
if [ $with_sdlimage -gt 0 ]; then
if [ "$os" == "OSX" ] ; then
if [ "$os" = "OSX" ] ; then
LIBS="$LIBS $(pkg-config SDL_image --libs-only-L | cut -c 3- | tr -d ' ')/libSDL_image.a"
else
LIBS="$LIBS -lSDL_image"
Expand All @@ -1034,14 +1039,14 @@ make_cflags_and_ldflags() {
# SDL2 must not add _GNU_SOURCE as it breaks many platforms
CFLAGS="$CFLAGS `$sdl2_config --cflags | sed 's@-D_GNU_SOURCE[^ ]*@@'` -DSDL_FORCE_INLINE='static __inline'"
if [ "$enable_static" != "0" ]; then
if [ "$os" == "OSX" ] ; then
if [ "$os" = "OSX" ] ; then
libpath=`$sdl2_config --static-libs | cut -d ' ' -f 1 | cut -b 3- `
LIBS="$LIBS `$sdl2_config --static-libs | cut -d ' ' -f 2- | sed 's@-l\([^ ]*\)@'${libpath}'/lib\1.a@' `"
else
LIBS="$LIBS `$sdl2_config --static-libs`"
fi
if [ $with_sdl2image -gt 0 ]; then
if [ "$os" == "OSX" ] ; then
if [ "$os" = "OSX" ] ; then
LIBS="$LIBS $(pkg-config SDL2_image --libs-only-L | cut -c 3- | tr -d ' ')/libSDL2_image.a"
else
LIBS="$LIBS -lSDL2_image"
Expand Down

0 comments on commit 839bac6

Please sign in to comment.