aboutsummaryrefslogtreecommitdiff
path: root/Mk/bsd.sdl.mk
diff options
context:
space:
mode:
Diffstat (limited to 'Mk/bsd.sdl.mk')
-rw-r--r--Mk/bsd.sdl.mk59
1 files changed, 49 insertions, 10 deletions
diff --git a/Mk/bsd.sdl.mk b/Mk/bsd.sdl.mk
index a51b4abaaedf..7b60959f1330 100644
--- a/Mk/bsd.sdl.mk
+++ b/Mk/bsd.sdl.mk
@@ -16,14 +16,22 @@
# the standard SDL and SDL_sound, use "USE_SDL=sdl sound" and the
# required libraries are included in your LIB_DEPENDS.
#
+# If you want to check for the availability for certain SDL ports, you
+# can set WANT_SDL and run it through bsd.port.pre.mk:
+# WANT_SDL= yes
+# USE_SDL= sdl
+# .include <bsd.port.pre.mk>
+# .if ${HAVE_SDL:Mgraphics}
+# USE_SDL+= graphics
+# .endif
+# .include <bsd.port.post.mk>
+# Run "make -V USE_SDL" to see which libs are asked for at the end.
+#
#
# $FreeBSD$
#
-.if !defined(SDL_Include)
-
-SDL_Include= bsd.sdl.mk
SDL_Include_MAINTAINER= edwin@FreeBSD.org
#
@@ -32,13 +40,6 @@ SDL_Include_MAINTAINER= edwin@FreeBSD.org
_USE_SDL_ALL= gfx gui image mixer ldbad mm net sdl sound ttf
#
-# Keep some backward compatibility
-#
-.if ${USE_SDL}=="yes"
-USE_SDL=sdl
-.endif
-
-#
# Variables used to determine what is needed:
# _VERSION_xxx version of the shared library (required)
# _SUBDIR_xxx subdirectory below ${PORTSDIR} (required)
@@ -107,6 +108,42 @@ _REQUIRES_${component}=
.endfor
#
+# If WANT_SDL is defined, check for the available libraries
+#
+.if !defined(AFTERPORTMK)
+.if !defined(SDL_Include_pre)
+
+SDL_Include_pre= bsd.sdl.mk
+
+HAVE_SDL?=
+.if defined(WANT_SDL)
+.for component in ${_USE_SDL_ALL}
+.if exists(${LOCALBASE}/lib/lib${_LIB_${component}}.so.${_VERSION_${component}})
+HAVE_SDL+= ${component}
+.endif
+.endfor
+.endif
+
+.endif
+.endif
+
+#
+# If USE_SDL is defined, make dependencies for the libraries
+#
+.if !defined(BEFOREPORTMK)
+.if !defined(SDL_Include_post)
+.if defined(USE_SDL)
+
+SDL_Include_post= bsd.sdl.mk
+
+#
+# Keep some backward compatibility
+#
+.if ${USE_SDL}=="yes"
+USE_SDL= sdl
+.endif
+
+#
# Check if all the values given in USE_SDL are valid.
#
_USE_SDL=
@@ -143,3 +180,5 @@ CONFIGURE_ENV+= SDL_CONFIG=${SDL_CONFIG}
MAKE_ENV+= SDL_CONFIG=${SDL_CONFIG}
.endif
+.endif
+.endif