4 # bsd.sdl.mk - Support for SDL-based ports.
6 # Created by: Edwin Groothuis <edwin@freebsd.org>
8 # For FreeBSD committers:
9 # - Changes in the version number of the shared libraries are encouraged.
10 # - For the rest, please try to run them via the maintainer but feel free
11 # to commit themselves if nothing breaks.
13 # For ports-developers:
14 # If your port needs SDL or one of the SDL modules, you can easily
15 # include them with the "USE_SDL=" statement. For example if you need
16 # the standard SDL and SDL_sound, use "USE_SDL=sdl sound" and the
17 # required libraries are included in your LIB_DEPENDS.
19 # If you want to check for the availability for certain SDL ports, you
20 # can set WANT_SDL and run it through bsd.port.pre.mk:
23 # .include <bsd.port.pre.mk>
24 # .if ${HAVE_SDL:Mgraphics}
27 # .include <bsd.port.post.mk>
28 # Run "make -V USE_SDL" to see which libs are asked for at the end.
35 SDL_Include_MAINTAINER= mva@FreeBSD.org
38 # These are the current supported SDL1.2 modules
40 _USE_SDL_ALL= console gfx image mixer mm net pango sdl sound ttf
42 # These are the current supported SDL2 modules
44 _USE_SDL_ALL+= gfx2 image2 mixer2 net2 sdl2 ttf2
47 # Variables used to determine what is needed:
48 # _SUBDIR_xxx subdirectory below ${PORTSDIR} (required)
49 # _PORTDIR_xxx subdirectory below ${PORTSDIR}/${_SUBDIR_xxx}
50 # _LIB_xxx name of the shared lib
51 # _REQUIRES_xxx also needs these SDL libraries
54 _SUBDIR_console= devel
55 _PORTDIR_console= sdl_console
56 _LIB_console= libSDL_console.so
57 _REQUIRES_console= sdl
61 _LIB_gfx= libSDL_gfx.so
64 _SUBDIR_image= graphics
65 _PORTDIR_image= sdl_image
66 _LIB_image= libSDL_image.so
70 _PORTDIR_mixer= sdl_mixer
71 _LIB_mixer= libSDL_mixer.so
81 _LIB_net= libSDL_net.so
84 _SUBDIR_pango= x11-toolkits
85 _PORTDIR_pango= sdl_pango
86 _LIB_pango= libSDL_Pango.so
95 _PORTDIR_sound= sdl_sound
96 _LIB_sound= libSDL_sound.so
100 _PORTDIR_ttf= sdl_ttf
101 _LIB_ttf= libSDL_ttf.so
104 _SUBDIR_gfx2= graphics
105 _PORTDIR_gfx2= sdl2_gfx
106 _LIB_gfx2= libSDL2_gfx.so
109 _SUBDIR_image2= graphics
110 _PORTDIR_image2= sdl2_image
111 _LIB_image2= libSDL2_image.so
112 _REQUIRES_image2= sdl2
114 _SUBDIR_mixer2= audio
115 _PORTDIR_mixer2= sdl2_mixer
116 _LIB_mixer2= libSDL2_mixer.so
117 _REQUIRES_mixer2= sdl2
120 _PORTDIR_net2= sdl2_net
121 _LIB_net2= libSDL2_net.so
126 _LIB_sdl2= libSDL2.so
129 _SUBDIR_ttf2= graphics
130 _PORTDIR_ttf2= sdl2_ttf
131 _LIB_ttf2= libSDL2_ttf.so
135 # If WANT_SDL is defined, check for the available libraries
137 .if !defined(AFTERPORTMK)
138 .if !defined(SDL_Include_pre)
140 SDL_Include_pre= bsd.sdl.mk
143 .if defined(WANT_SDL)
144 .for component in ${_USE_SDL_ALL}
145 .if exists(${LOCALBASE}/lib/lib${_LIB_${component}}.so)
146 HAVE_SDL+= ${component}
155 # If USE_SDL is defined, make dependencies for the libraries
157 .if !defined(BEFOREPORTMK)
158 .if !defined(SDL_Include_post)
161 SDL_Include_post= bsd.sdl.mk
164 # Keep some backward compatibility
166 .if ${USE_SDL}=="yes"
171 # Check if all the values given in USE_SDL are valid.
174 .for component in ${USE_SDL}
175 . if ${_USE_SDL_ALL:M${component}}==""
176 IGNORE= cannot install: unknown SDL component ${component}
178 _USE_SDL+= ${_REQUIRES_${component}} ${component}
182 # Uniquefy[sp] the list of libs required
185 .for component in ${_USE_SDL}
186 . if ${__USE_SDL:M${component}}==""
187 __USE_SDL+= ${component}
192 # Finally make the list of libs required
194 .for component in ${__USE_SDL}
195 LIB_DEPENDS+= ${_LIB_${component}}:${PORTSDIR}/${_SUBDIR_${component}}/${_PORTDIR_${component}}
199 # "Normal" dependencies and variables
201 .if ${__USE_SDL:Msdl} != ""
202 BUILD_DEPENDS+= ${SDL_CONFIG}:${PORTSDIR}/${_SUBDIR_sdl}/${_PORTDIR_sdl}
203 SDL_CONFIG?= ${LOCALBASE}/bin/sdl-config
204 CONFIGURE_ENV+= SDL_CONFIG=${SDL_CONFIG}
205 MAKE_ENV+= SDL_CONFIG=${SDL_CONFIG}
207 .if ${__USE_SDL:Msdl2} != ""
208 BUILD_DEPENDS+= ${SDL2_CONFIG}:${PORTSDIR}/${_SUBDIR_sdl2}/${_PORTDIR_sdl2}
209 SDL2_CONFIG?= ${LOCALBASE}/bin/sdl2-config
210 CONFIGURE_ENV+= SDL2_CONFIG=${SDL2_CONFIG}
211 MAKE_ENV+= SDL2_CONFIG=${SDL2_CONFIG}