Skip to content
This repository was archived by the owner on May 19, 2022. It is now read-only.

Commit 4b9b380

Browse files
committedMar 8, 2020
Fix picking up the wrong SDL
1 parent 4b24014 commit 4b9b380

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed
 

‎INSTALL.md

-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ Here are my standard `./configure` and `make` lines, successfully building on OS
107107
make
108108
```
109109

110-
**note**: If you *have* the ``sdl2`` kegs installed via [Homebrew](http://brew.sh/), it will fail to build. This is likely an issue we should fix with our Makefiles and all.
111-
112110
## Building an OS X App
113111

114112
Building a proper application on OS X is fairly easy. Simply make sure you're in the base directory and run this:

‎configure

+14-12
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,8 @@ INTERNAL_LIBPNG=\$(findstring true,$INTERNAL_LIBPNG)
904904
INTERNAL_LIBJPEG=\$(findstring true,$INTERNAL_LIBJPEG)
905905
INTERNAL_OGGLIBS=\$(findstring true,$INTERNAL_OGGLIBS)
906906
SDL_CONFIG=$SDL_CONFIG
907+
export PKG_CONFIG_PATH := \$(shell pwd)/extlib/lib/pkgconfig:\$(PKG_CONFIG_PATH)
908+
SHELLENV = PKG_CONFIG_PATH=\$(PKG_CONFIG_PATH)
907909
908910
export CC := $CC
909911
export CXX := $CXX
@@ -914,9 +916,9 @@ export RANLIB := $RANLIB
914916
915917
# Ponscripter variables
916918
PSCFLAGS = $CFLAGSEXTRA
917-
INCS = $OURINCS \$(shell \$(SDL_CONFIG) --cflags) \\
918-
\$(shell $SMPEG_CONFIG --cflags) \\
919-
\$(shell $FREETYPE_CONFIG --cflags)
919+
INCS = $OURINCS \$(shell \$(SHELLENV) \$(SDL_CONFIG) --cflags) \\
920+
\$(shell \$(SHELLENV) $SMPEG_CONFIG --cflags) \\
921+
\$(shell \$(SHELLENV) $FREETYPE_CONFIG --cflags)
920922
_EOF
921923
case "$SYS" in
922924
MinGW)
@@ -932,9 +934,9 @@ fi
932934

933935
if $INTERNAL_SDL
934936
then
935-
MY_SDL_LIBS="\$(filter-out -lSDL2main,\$(shell \$(SDL_CONFIG) --static-libs))"
937+
MY_SDL_LIBS="\$(filter-out -lSDL2main,\$(shell \$(SHELLENV) \$(SDL_CONFIG) --static-libs))"
936938
else
937-
MY_SDL_LIBS="\$(shell \$(SDL_CONFIG) --static-libs)"
939+
MY_SDL_LIBS="\$(shell \$(SHELLENV) \$(SDL_CONFIG) --static-libs)"
938940
fi
939941

940942
cat >> $MAKEFILE <<_EOF
@@ -944,7 +946,7 @@ LIBS = $OURLIBS \\
944946
$NOTIFYLIBS $GTKLIBS\\
945947
-static -Wl,--start-group \\
946948
$MY_SDL_LIBS \\
947-
\$(shell $SMPEG_CONFIG --libs) \$(shell $FREETYPE_CONFIG --libs) \\
949+
\$(shell \$(SHELLENV) $SMPEG_CONFIG --libs) \$(shell \$(SHELLENV) $FREETYPE_CONFIG --libs) \\
948950
$LINKSDL2_image $LINKjpeg $LINKpng $LINKz \\
949951
$LINKSDL2_mixer $LINKogg $LINKvorbis $LINKvorbisfile \\
950952
$LINKbz2 -Wl,--end-group
@@ -957,9 +959,9 @@ MacOSX)
957959
cat >> $MAKEFILE <<_EOF
958960
959961
LIBS = $OURLIBS \\
960-
\$(shell $SDL_CONFIG --static-libs) \\
961-
\$(shell $SMPEG_CONFIG --libs) \\
962-
\$(shell $FREETYPE_CONFIG --libs) \\
962+
\$(shell \$(SHELLENV) $SDL_CONFIG --static-libs) \\
963+
\$(shell \$(SHELLENV) $SMPEG_CONFIG --libs) \\
964+
\$(shell \$(SHELLENV) $FREETYPE_CONFIG --libs) \\
963965
$LINKSDL2_image $LINKjpeg $LINKpng \\
964966
$LINKSDL2_mixer $LINKogg $LINKvorbis $LINKvorbisfile \\
965967
$LINKbz2 -lm -framework CoreFoundation
@@ -1003,9 +1005,9 @@ cat >> $MAKEFILE <<_EOF
10031005
LIBS = $OURLIBS \\
10041006
$LINKSDL2_image \$(if \$(findstring true,$INTERNAL_SDL_IMAGE),$LINKjpeg $LINKpng $LINKz) \\
10051007
$LINKSDL2_mixer \$(if \$(findstring true,$INTERNAL_SDL_MIXER$EXPLICIT_OGGLIBS),$LINKvorbisfile $LINKvorbis $LINKogg) \\
1006-
\$(shell $SDL_CONFIG --libs) \\
1007-
\$(shell $SMPEG_CONFIG --libs) \\
1008-
\$(shell $FREETYPE_CONFIG --libs) \\
1008+
\$(shell \$(SHELLENV) $SDL_CONFIG --libs) \\
1009+
\$(shell \$(SHELLENV) $SMPEG_CONFIG --libs) \\
1010+
\$(shell \$(SHELLENV) $FREETYPE_CONFIG --libs) \\
10091011
$LINKbz2 \$(if \$(findstring true,$INTERNAL_SDL),$INTERNAL_LDFLAGS)
10101012
10111013
DEFS = -DLINUX -DUSE_OGG_VORBIS $EXTRA_DEPS $OURDEFS

‎src/Makefile.extlibs

+5-1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ $(EB)/sdl2-config: $(SDLSRC)/Makefile
6363
fi # Fix for annoying Windows breakage
6464
@chmod +x $(EB)/sdl2-config # for some reason this isn't happening when
6565
@ # cross-compiling to MinGW
66+
@ # We only make a static lib which means things using pkg-config will get it even if they think they're linking to a dynamic lib, breaking their ldflags
67+
@ # Fix this by replacing `Libs: $libs\nLibs.static $staticonly` with `Libs: $libs $staticonly` in the pc file
68+
@ # Note: This assumes Libs.private immediately follows Libs if it exists, which seems to be the case in most pc files that have it but isn't actually a requirement.
69+
@sed -i '' -e ':a' -e 'N' -e '$$!ba' -e 's/\nLibs.private: //g' $(EL)/pkgconfig/sdl2.pc
6670

6771
#-- SDL_image -----------------------------------------------------------------
6872

@@ -179,7 +183,7 @@ $(EL)/libogg$(LIBSUFFIX): $(OGGSRC)/Makefile
179183
@$(MAKE) -C $(OGGSRC) $(REDSO)
180184
@$(MAKE) -C $(OGGSRC) install -j1 $(REDSO)
181185

182-
$(VORBSRC)/Makefile:
186+
$(VORBSRC)/Makefile: $(if $(INTERNAL_OGGLIBS),$(EL)/libogg$(LIBSUFFIX))
183187
@echo Configuring internal libvorbis...
184188
@cd $(VORBSRC) && \
185189
./configure --prefix="$(LPREFIX)" $(addprefix --disable-,shared dependency-tracking docs) $(OTHERCONFIG) $(REDIR)

0 commit comments

Comments
 (0)
This repository has been archived.