Update editors/libreoffice-af to version 4.3.2
[dports.git] / Mk / bsd.sdl.mk
1 #-*- tab-width: 4; -*-
2 # ex:ts=4
3 #
4 # bsd.sdl.mk - Support for SDL-based ports.
5 #
6 # Created by: Edwin Groothuis <edwin@freebsd.org>
7 #
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.
12 #
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.
18 #
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:
21 #       WANT_SDL=       yes
22 #       USE_SDL=        sdl
23 #       .include <bsd.port.pre.mk>
24 #       .if ${HAVE_SDL:Mgraphics}
25 #       USE_SDL+=       graphics
26 #       .endif
27 #       .include <bsd.port.post.mk>
28 # Run "make -V USE_SDL" to see which libs are asked for at the end.
29 #
30
31 #
32 # $FreeBSD$
33 #
34
35 SDL_Include_MAINTAINER=         mva@FreeBSD.org
36
37 #
38 # These are the current supported SDL1.2 modules
39 #
40 _USE_SDL_ALL=   console gfx image mixer mm net pango sdl sound ttf
41 #
42 # These are the current supported SDL2 modules
43 #
44 _USE_SDL_ALL+=  gfx2 image2 mixer2 net2 sdl2 ttf2
45
46 #
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
52 #
53
54 _SUBDIR_console=        devel
55 _PORTDIR_console=       sdl_console
56 _LIB_console=           libSDL_console.so
57 _REQUIRES_console=      sdl
58
59 _SUBDIR_gfx=    graphics
60 _PORTDIR_gfx=   sdl_gfx
61 _LIB_gfx=       libSDL_gfx.so
62 _REQUIRES_gfx=  sdl
63
64 _SUBDIR_image=  graphics
65 _PORTDIR_image= sdl_image
66 _LIB_image=     libSDL_image.so
67 _REQUIRES_image=sdl
68
69 _SUBDIR_mixer=  audio
70 _PORTDIR_mixer= sdl_mixer
71 _LIB_mixer=     libSDL_mixer.so
72 _REQUIRES_mixer=sdl
73
74 _SUBDIR_mm=     devel
75 _PORTDIR_mm=    sdlmm
76 _LIB_mm=        libSDLmm.so
77 _REQUIRES_mm=   sdl
78
79 _SUBDIR_net=    net
80 _PORTDIR_net=   sdl_net
81 _LIB_net=       libSDL_net.so
82 _REQUIRES_net=  sdl
83
84 _SUBDIR_pango=  x11-toolkits
85 _PORTDIR_pango= sdl_pango
86 _LIB_pango=     libSDL_Pango.so
87 _REQUIRES_pango=sdl
88
89 _SUBDIR_sdl=    devel
90 _PORTDIR_sdl=   sdl12
91 _LIB_sdl=       libSDL.so
92 _REQUIRES_sdl=
93
94 _SUBDIR_sound=  audio
95 _PORTDIR_sound= sdl_sound
96 _LIB_sound=     libSDL_sound.so
97 _REQUIRES_sound=sdl
98
99 _SUBDIR_ttf=    graphics
100 _PORTDIR_ttf=   sdl_ttf
101 _LIB_ttf=       libSDL_ttf.so
102 _REQUIRES_ttf=  sdl
103
104 _SUBDIR_gfx2=   graphics
105 _PORTDIR_gfx2=  sdl2_gfx
106 _LIB_gfx2=      libSDL2_gfx.so
107 _REQUIRES_gfx2= sdl2
108
109 _SUBDIR_image2=         graphics
110 _PORTDIR_image2=        sdl2_image
111 _LIB_image2=            libSDL2_image.so
112 _REQUIRES_image2=       sdl2
113
114 _SUBDIR_mixer2=         audio
115 _PORTDIR_mixer2=        sdl2_mixer
116 _LIB_mixer2=            libSDL2_mixer.so
117 _REQUIRES_mixer2=       sdl2
118
119 _SUBDIR_net2=   net
120 _PORTDIR_net2=  sdl2_net
121 _LIB_net2=      libSDL2_net.so
122 _REQUIRES_net2= sdl2
123
124 _SUBDIR_sdl2=   devel
125 _PORTDIR_sdl2=  sdl20
126 _LIB_sdl2=      libSDL2.so
127 _REQUIRES_sdl2=
128
129 _SUBDIR_ttf2=   graphics
130 _PORTDIR_ttf2=  sdl2_ttf
131 _LIB_ttf2=      libSDL2_ttf.so
132 _REQUIRES_ttf2= sdl2
133
134 #
135 # If WANT_SDL is defined, check for the available libraries
136 #
137 .if !defined(AFTERPORTMK)
138 .if !defined(SDL_Include_pre)
139
140 SDL_Include_pre=        bsd.sdl.mk
141
142 HAVE_SDL?=
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}
147 .endif
148 .endfor
149 .endif
150
151 .endif
152 .endif
153
154 #
155 # If USE_SDL is defined, make dependencies for the libraries
156 #
157 .if !defined(BEFOREPORTMK)
158 .if !defined(SDL_Include_post)
159 .if defined(USE_SDL)
160
161 SDL_Include_post=       bsd.sdl.mk
162
163 #
164 # Keep some backward compatibility
165 #
166 .if ${USE_SDL}=="yes"
167 USE_SDL=        sdl
168 .endif
169
170 #
171 # Check if all the values given in USE_SDL are valid.
172 #
173 _USE_SDL=
174 .for component in ${USE_SDL}
175 . if ${_USE_SDL_ALL:M${component}}==""
176 IGNORE= cannot install: unknown SDL component ${component}
177 . endif
178 _USE_SDL+=      ${_REQUIRES_${component}} ${component}
179 .endfor
180
181 #
182 # Uniquefy[sp] the list of libs required
183 #
184 __USE_SDL=
185 .for component in ${_USE_SDL}
186 . if ${__USE_SDL:M${component}}==""
187 __USE_SDL+= ${component}
188 . endif
189 .endfor
190
191 #
192 # Finally make the list of libs required
193 #
194 .for component in ${__USE_SDL}
195 LIB_DEPENDS+=   ${_LIB_${component}}:${PORTSDIR}/${_SUBDIR_${component}}/${_PORTDIR_${component}}
196 .endfor
197
198 #
199 # "Normal" dependencies and variables
200 #
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}
206 .endif
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}
212 .endif
213
214 .endif
215 .endif
216 .endif