bsd.x11.mk revision 1.66 1 1.66 rtr # $NetBSD: bsd.x11.mk,v 1.66 2008/09/15 08:05:19 rtr Exp $
2 1.1 lukem
3 1.1 lukem .include <bsd.init.mk>
4 1.1 lukem
5 1.61 lukem .if make(depend) || make(all) || make(dependall)
6 1.61 lukem .if (${MKX11} != "no" && ${MKXORG} != "no")
7 1.61 lukem .BEGIN:
8 1.61 lukem @echo
9 1.61 lukem @echo "ERROR: \$$MKX11 and \$$MKXORG are mutually exclusive."
10 1.61 lukem @echo
11 1.61 lukem @false
12 1.61 lukem .endif
13 1.61 lukem .endif
14 1.61 lukem
15 1.3 lukem BINDIR= ${X11BINDIR}
16 1.3 lukem LIBDIR= ${X11USRLIBDIR}
17 1.3 lukem MANDIR= ${X11MANDIR}
18 1.3 lukem
19 1.47 tron COPTS+= -fno-strict-aliasing
20 1.47 tron
21 1.55 tron .if defined(USE_SSP) && (${USE_SSP} != "no")
22 1.55 tron CPPFLAGS+= -DNO_ALLOCA
23 1.55 tron .endif
24 1.55 tron
25 1.1 lukem X11FLAGS.VERSION= -DOSMAJORVERSION=1 -DOSMINORVERSION=6 # XXX
26 1.1 lukem
27 1.8 lukem # THREADS_DEFINES
28 1.1 lukem X11FLAGS.THREADS= -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API \
29 1.1 lukem -DXNO_MTSAFE_PWDAPI
30 1.1 lukem
31 1.8 lukem # CONNECTION_FLAGS
32 1.37 fredb X11FLAGS.CONNECTION= -DTCPCONN -DUNIXCONN -DHAS_STICKY_DIR_BIT \
33 1.43 lukem -DHAS_FCHOWN
34 1.43 lukem
35 1.43 lukem .if (${USE_INET6} != "no")
36 1.43 lukem X11FLAGS.CONNECTION+= -DIPv6
37 1.43 lukem .endif
38 1.1 lukem
39 1.8 lukem # EXT_DEFINES
40 1.58 mrg .if ${MKXORG} != "no"
41 1.58 mrg X11FLAGS.BASE_EXTENSION= -DMITMISC -DXTEST -DXTRAP -DXSYNC -DXCMISC \
42 1.58 mrg -DXRECORD -DMITSHM -DBIGREQS -DXF86VIDMODE \
43 1.58 mrg -DXF86MISC -DDPMSExtension -DEVI \
44 1.58 mrg -DSCREENSAVER -DXV -DXVMC -DGLXEXT \
45 1.58 mrg -DFONTCACHE -DRES
46 1.58 mrg
47 1.58 mrg X11FLAGS.PERVASIVE_EXTENSION= -DSHAPE -DXINPUT -DXKB -DLBX -DXAPPGROUP \
48 1.58 mrg -DXCSECURITY -DTOGCUP -DXF86BIGFONT \
49 1.58 mrg -DDPMSExtension -DPIXPRIV -DPANORAMIX \
50 1.58 mrg -DRENDER -DRANDR -DXFIXES -DDAMAGE \
51 1.58 mrg -DCOMPOSITE -DXEVIE
52 1.58 mrg X11FLAGS.EXTENSION= ${X11FLAGS.BASE_EXTENSION} \
53 1.58 mrg ${X11FLAGS.PERVASIVE_EXTENSION}
54 1.59 mrg
55 1.59 mrg X11FLAGS.DIX= -DHAVE_DIX_CONFIG_H -D_BSD_SOURCE -DHAS_FCHOWN \
56 1.59 mrg -DHAS_STICKY_DIR_BIT -D_POSIX_THREAD_SAFE_FUNCTIONS
57 1.59 mrg X11INCS.DIX= -I${X11INCSDIR}/freetype2 \
58 1.59 mrg -I${X11INCSDIR}/pixman-1 \
59 1.59 mrg -I$(X11SRCDIR.xorg-server)/include \
60 1.59 mrg -I$(X11SRCDIR.xorg-server)/Xext \
61 1.59 mrg -I$(X11SRCDIR.xorg-server)/composite \
62 1.59 mrg -I$(X11SRCDIR.xorg-server)/damageext \
63 1.59 mrg -I$(X11SRCDIR.xorg-server)/xfixes \
64 1.59 mrg -I$(X11SRCDIR.xorg-server)/Xi \
65 1.59 mrg -I$(X11SRCDIR.xorg-server)/mi \
66 1.59 mrg -I$(X11SRCDIR.xorg-server)/miext/shadow \
67 1.59 mrg -I$(X11SRCDIR.xorg-server)/miext/damage \
68 1.59 mrg -I$(X11SRCDIR.xorg-server)/render \
69 1.59 mrg -I$(X11SRCDIR.xorg-server)/randr \
70 1.59 mrg -I$(X11SRCDIR.xorg-server)/fb
71 1.58 mrg .else
72 1.1 lukem X11FLAGS.EXTENSION= -DMITMISC -DXTEST -DXTRAP -DXSYNC -DXCMISC -DXRECORD \
73 1.11 rtr -DMITSHM -DBIGREQS -DXF86MISC -DDBE -DDPMSExtension \
74 1.11 rtr -DEVI -DSCREENSAVER -DXV -DXVMC -DGLXEXT \
75 1.11 rtr -DGLX_USE_MESA -DFONTCACHE -DRES
76 1.58 mrg .endif
77 1.1 lukem
78 1.31 rtr X11FLAGS.DRI= -DGLXEXT -DXF86DRI -DGLX_DIRECT_RENDERING \
79 1.31 rtr -DGLX_USE_DLOPEN -DGLX_USE_MESA
80 1.31 rtr
81 1.31 rtr .if ${X11DRI} != "no"
82 1.31 rtr X11FLAGS.EXTENSION+= ${X11FLAGS.DRI}
83 1.31 rtr .endif
84 1.31 rtr
85 1.8 lukem # ServerDefines
86 1.11 rtr X11FLAGS.SERVER= -DSHAPE -DXKB -DLBX -DXAPPGROUP -DXCSECURITY \
87 1.1 lukem -DTOGCUP -DXF86BIGFONT -DDPMSExtension -DPIXPRIV \
88 1.1 lukem -DPANORAMIX -DRENDER -DRANDR -DGCCUSESGAS \
89 1.11 rtr -DAVOID_GLYPHBLT -DSINGLEDEPTH -DXvExtension \
90 1.11 rtr -DXFree86Server -DXvMCExtension -DSMART_SCHEDULE \
91 1.13 rtr -DBUILDDEBUG -DXResExtension -DNDEBUG
92 1.13 rtr
93 1.8 lukem # OS_DEFINES
94 1.18 rtr X11FLAGS.OS_DEFINES= -DDDXOSINIT -DSERVER_LOCK -DDDXOSFATALERROR \
95 1.51 spz -DDDXOSVERRORF -DDDXTIME -DUSB_HID
96 1.11 rtr
97 1.23 matt .if !(${MACHINE} == "acorn32" || \
98 1.23 matt ${MACHINE} == "alpha" || \
99 1.23 matt ${MACHINE} == "amiga" || \
100 1.23 matt ${MACHINE} == "pmax" || \
101 1.32 rtr ${MACHINE} == "sun3" || \
102 1.23 matt ${MACHINE} == "vax")
103 1.11 rtr # EXT_DEFINES
104 1.11 rtr X11FLAGS.EXTENSION+= -DXF86VIDMODE
105 1.11 rtr
106 1.11 rtr # ServerDefines
107 1.25 jmmv X11FLAGS.SERVER+= -DXINPUT -DXFreeXDGA -DXF86VIDMODE
108 1.22 rtr .endif
109 1.11 rtr
110 1.24 rtr .if ${MACHINE_ARCH} == "alpha" || \
111 1.24 rtr ${MACHINE_ARCH} == "sparc64" || \
112 1.24 rtr ${MACHINE_ARCH} == "x86_64"
113 1.12 rtr # ServerDefines
114 1.12 rtr X11FLAGS.SERVER+= -D_XSERVER64
115 1.26 rtr X11FLAGS.EXTENSION+= -D__GLX_ALIGN64
116 1.12 rtr .endif
117 1.11 rtr
118 1.23 matt .if ${MACHINE} == "amd64" || \
119 1.23 matt ${MACHINE} == "cats" || \
120 1.23 matt ${MACHINE} == "i386" || \
121 1.41 sekiya ${MACHINE} == "macppc" || \
122 1.53 uwe ${MACHINE} == "netwinder" || \
123 1.57 phx ${MACHINE} == "ofppc" || \
124 1.48 martin ${MACHINE} == "sgimips" || \
125 1.50 macallan ${MACHINE} == "sparc64" || \
126 1.54 macallan ${MACHINE} == "sparc" || \
127 1.54 macallan ${MACHINE} == "shark"
128 1.11 rtr # LOADABLE
129 1.49 martin X11FLAGS.LOADABLE= -DXFree86LOADER -DIN_MODULE -DXFree86Module \
130 1.49 martin -fno-merge-constants
131 1.11 rtr .endif
132 1.58 mrg
133 1.58 mrg # XXX FIX ME
134 1.58 mrg .if ${MKXORG} != "no"
135 1.58 mrg XVENDORNAMESHORT= '"X.Org"'
136 1.58 mrg XVENDORNAME= '"The X.Org Foundation"'
137 1.60 mrg XORG_RELEASE= '"Release 1.4.2"'
138 1.58 mrg __XKBDEFRULES__= '"xorg"'
139 1.62 rtr XLOCALE.DEFINES= -DXLOCALEDIR=\"${X11LIBDIR}/locale\" \
140 1.62 rtr -DXLOCALELIBDIR=\"${X11LIBDIR}/locale\"
141 1.58 mrg
142 1.58 mrg # XXX oh yeah, fix me later
143 1.59 mrg XORG_VERSION_CURRENT="(((1) * 10000000) + ((4) * 100000) + ((2) * 1000) + 0)"
144 1.58 mrg .endif
145 1.8 lukem
146 1.64 cube PRINT_PACKAGE_VERSION= awk '/^PACKAGE_VERSION=/ { \
147 1.64 cube match($$1, "([0-9]+\\.)+[0-9]+"); \
148 1.64 cube version = substr($$1, RSTART, RLENGTH); \
149 1.64 cube } END { print version }'
150 1.64 cube
151 1.64 cube
152 1.29 rtr # Extract X11VERSION
153 1.29 rtr PRINTX11VERSION=awk '/^\#define XF86_VERSION_MAJOR/ {major = $$3} \
154 1.29 rtr /^\#define XF86_VERSION_MINOR/ {minor = $$3} \
155 1.29 rtr /^\#define XF86_VERSION_PATCH/ {patch = $$3} \
156 1.29 rtr /^\#define XF86_VERSION_SNAP/ {snap = $$3} \
157 1.29 rtr END { print "((("major") * 10000000) + (("minor") * 100000) + (("patch") * 1000) + "snap")"}' \
158 1.29 rtr ${X11SRCDIR.xc}/programs/Xserver/hw/xfree86/xf86Version.h
159 1.8 lukem
160 1.38 fredb # Commandline to convert 'XCOMM' comments and 'XHASH' to '#', among other
161 1.38 fredb # things. Transformed from the "CppSedMagic" macro from "Imake.rules".
162 1.8 lukem #
163 1.38 fredb X11TOOL_UNXCOMM= sed -e '/^\# *[0-9][0-9]* *.*$$/d' \
164 1.38 fredb -e '/^\#line *[0-9][0-9]* *.*$$/d' \
165 1.38 fredb -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
166 1.38 fredb -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
167 1.38 fredb -e '/^[ ]*XHASH/s/XHASH/\#/' \
168 1.38 fredb -e '/\@\@$$/s/\@\@$$/\\/'
169 1.1 lukem
170 1.3 lukem
171 1.1 lukem CPPFLAGS+= -DCSRG_BASED -DFUNCPROTO=15 -DNARROWPROTO
172 1.2 lukem CPPFLAGS+= -I${DESTDIR}${X11INCDIR}
173 1.1 lukem
174 1.39 drochner .if ${MACHINE_ARCH} == "x86_64"
175 1.39 drochner CPPFLAGS+= -D__AMD64__
176 1.39 drochner .endif
177 1.39 drochner
178 1.1 lukem LDFLAGS+= -Wl,-rpath-link,${DESTDIR}${X11USRLIBDIR} \
179 1.1 lukem -R${X11USRLIBDIR} \
180 1.1 lukem -L${DESTDIR}${X11USRLIBDIR}
181 1.3 lukem
182 1.1 lukem
183 1.1 lukem #
184 1.1 lukem # .cpp -> "" handling
185 1.1 lukem # CPPSCRIPTS list of files/scripts to run through cpp
186 1.1 lukem # CPPSCRIPTFLAGS extra flags to ${CPP}
187 1.1 lukem # CPPSCRIPTFLAGS_fn extra flags to ${CPP} for file `fn'
188 1.1 lukem #
189 1.1 lukem .if defined(CPPSCRIPTS) # {
190 1.1 lukem .SUFFIXES: .cpp
191 1.1 lukem
192 1.1 lukem .cpp:
193 1.7 lukem ${_MKTARGET_CREATE}
194 1.5 lukem rm -f ${.TARGET}
195 1.1 lukem ${CPP} -undef -traditional \
196 1.1 lukem ${CPPSCRIPTFLAGS_${.TARGET}:U${CPPSCRIPTFLAGS}} \
197 1.1 lukem < ${.IMPSRC} | ${X11TOOL_UNXCOMM} > ${.TARGET}
198 1.1 lukem
199 1.1 lukem realall: ${CPPSCRIPTS}
200 1.1 lukem
201 1.1 lukem clean: cleancppscripts
202 1.27 lukem cleancppscripts: .PHONY
203 1.1 lukem rm -f ${CPPSCRIPTS}
204 1.1 lukem .endif # }
205 1.1 lukem
206 1.64 cube #
207 1.64 cube # X.Org pkgconfig files handling
208 1.64 cube #
209 1.64 cube # PKGCONFIG is expected to contain a list of pkgconfig module names.
210 1.64 cube # They will produce the files <module1>.pc, <module2>.pc, etc, to be
211 1.64 cube # put in X11USRLIBDIR/pkgconfig.
212 1.64 cube #
213 1.64 cube # PKGDIST contains the name of a X11SRCDIR subscript where to find the
214 1.64 cube # source file for the pkgconfig files.
215 1.64 cube #
216 1.64 cube # If PKGDIST is not suitable, a consumer can set PKGDIST.<module> with
217 1.64 cube # the full path to the source file.
218 1.64 cube #
219 1.64 cube # Also, the consumer can use PKGDIST alone, and a PKGCONFIG will be
220 1.64 cube # derived from it. Many times, PKGDIST is capitalized and PKGCONFIG is
221 1.64 cube # the lower case version.
222 1.64 cube #
223 1.64 cube
224 1.64 cube .if defined(PKGDIST) && !defined(PKGCONFIG)
225 1.64 cube PKGCONFIG= ${PKGDIST:tl}
226 1.64 cube .endif
227 1.64 cube .if defined(PKGCONFIG)
228 1.64 cube
229 1.64 cube .include <bsd.files.mk>
230 1.64 cube
231 1.64 cube _PKGCONFIG_FILES= ${PKGCONFIG:C/$/.pc/}
232 1.64 cube
233 1.64 cube .PHONY: pkgconfig-install
234 1.64 cube pkgconfig-install:
235 1.64 cube
236 1.64 cube realall: ${_PKGCONFIG_FILES:O:u}
237 1.64 cube realinstall: pkgconfig-install
238 1.64 cube
239 1.64 cube .for _pkg in ${PKGCONFIG:O:u}
240 1.64 cube PKGDIST.${_pkg}?= ${X11SRCDIR.${PKGDIST:U${_pkg}}}
241 1.64 cube _PKGDEST.${_pkg}= ${DESTDIR}/${X11USRLIBDIR}/pkgconfig/${_pkg}.pc
242 1.64 cube
243 1.64 cube .PATH: ${PKGDIST.${_pkg}}
244 1.64 cube
245 1.64 cube FILESOWN_${_pkg}.pc= ${BINOWN}
246 1.64 cube FILESGRP_${_pkg}.pc= ${BINGRP}
247 1.64 cube FILESMODE_${_pkg}.pc= ${NONBINMODE}
248 1.64 cube
249 1.64 cube ${_PKGDEST.${_pkg}}: ${_pkg}.pc __fileinstall
250 1.64 cube pkgconfig-install: ${_PKGDEST.${_pkg}}
251 1.64 cube .endfor
252 1.64 cube
253 1.64 cube # XXX
254 1.64 cube # The sed script is very, very ugly. What we actually need is a
255 1.64 cube # mknative-xorg script that will generate all the .pc files from
256 1.64 cube # running the autoconfigure script.
257 1.64 cube # And yes, it has to be splitted in two otherwise it's too long
258 1.64 cube # for sed to handle.
259 1.64 cube
260 1.64 cube .SUFFIXES: .pc.in .pc
261 1.64 cube .pc.in.pc:
262 1.64 cube ${_MKTARGET_CREATE}
263 1.64 cube rm -f ${.TARGET}
264 1.64 cube if [ -n '${PKGCONFIG_VERSION.${.PREFIX}}' ]; then \
265 1.64 cube _pkg_version='${PKGCONFIG_VERSION.${.PREFIX}}'; \
266 1.64 cube else \
267 1.64 cube _pkg_version=$$(${PRINT_PACKAGE_VERSION} \
268 1.64 cube ${PKGDIST.${.PREFIX}}/configure); \
269 1.64 cube fi; \
270 1.65 cube ${TOOL_SED} -E \
271 1.64 cube -e "s,@prefix@,${X11ROOTDIR},; \
272 1.64 cube s,@INSTALL_DIR@,${X11ROOTDIR},; \
273 1.64 cube s,@exec_prefix@,\\$$\{prefix\},; \
274 1.64 cube s,@libdir@,\\$$\{prefix\}/lib,; \
275 1.64 cube s,@includedir@,\\$$\{prefix\}/include,; \
276 1.64 cube s,@datarootdir@,\\$$\{prefix\}/share,; \
277 1.64 cube s,@appdefaultdir@,\\$$\{libdir}/X11/app-default,; \
278 1.64 cube s,@MAPDIR@,\\$$\{libdir\}/X11/fonts/util,; \
279 1.64 cube s,@ICONDIR@,\\$$\{datarootdir\}/icons,; \
280 1.64 cube s,@PACKAGE_VERSION@,$${_pkg_version},; \
281 1.64 cube s,@VERSION@,$${_pkg_version},; \
282 1.64 cube s,@COMPOSITEEXT_VERSION@,$${_pkg_version%.*},; \
283 1.64 cube s,@DAMAGEEXT_VERSION@,$${_pkg_version%.*},; \
284 1.64 cube s,@FIXESEXT_VERSION@,$${_pkg_version%.*},; \
285 1.64 cube s,@RANDR_VERSION@,$${_pkg_version%.*},; \
286 1.64 cube s,@RENDER_VERSION@,$${_pkg_version%.*}," \
287 1.64 cube -e "s,@moduledir@,\\$$\{libdir\}/modules,; \
288 1.64 cube s,@sdkdir@,\\$$\{includedir\}/xorg,; \
289 1.64 cube s,@PIXMAN_CFLAGS@,,; \
290 1.64 cube s,@LIB_DIR@,/lib,; \
291 1.64 cube s,@XKBPROTO_REQUIRES@,kbproto,; \
292 1.64 cube s,@FREETYPE_REQUIRES@,freetype2,; \
293 1.64 cube s,@EXPAT_LIBS@,-lexpat,; \
294 1.64 cube s,@FREETYPE_LIBS@,-lfreetype,; \
295 1.64 cube s,@DEP_CFLAGS@,,; \
296 1.64 cube s,@DEP_LIBS@,,; \
297 1.64 cube s,@X11_EXTRA_DEPS@,,; \
298 1.66 rtr s,@XTHREAD_CFLAGS@,-D_REENTRANT,; \
299 1.64 cube s,@XTHREADLIB@,-lpthread,; \
300 1.64 cube s,@fchown_define@,-DHAS_FCHOWN,; \
301 1.64 cube s,@sticky_bit_define@,-DHAS_STICKY_DIR_BIT," \
302 1.65 cube -e '/^Libs:/ s%-L([^[:space:]]+)%-Wl,-R\1 &%g' \
303 1.64 cube < ${.IMPSRC} > ${.TARGET}.tmp && \
304 1.64 cube mv -f ${.TARGET}.tmp ${.TARGET}
305 1.64 cube
306 1.64 cube CLEANFILES+= ${_PKGCONFIG_FILES} ${_PKGCONFIG_FILES:C/$/.tmp/}
307 1.64 cube .endif
308 1.1 lukem
309 1.1 lukem #
310 1.1 lukem # APPDEFS (app defaults) handling
311 1.1 lukem #
312 1.1 lukem .if defined(APPDEFS) # {
313 1.28 lukem appdefsinstall:: .PHONY ${APPDEFS:@S@${DESTDIR}${X11LIBDIR}/app-defaults/${S:T:R}@}
314 1.28 lukem .PRECIOUS: ${APPDEFS:@S@${DESTDIR}${X11LIBDIR}/app-defaults/${S:T:R}@}
315 1.1 lukem
316 1.1 lukem __appdefinstall: .USE
317 1.56 lukem ${_MKTARGET_INSTALL}
318 1.10 rtr ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${NONBINMODE} \
319 1.52 jwise ${.ALLSRC} ${.TARGET}
320 1.1 lukem
321 1.1 lukem .for S in ${APPDEFS:O:u}
322 1.1 lukem ${DESTDIR}${X11LIBDIR}/app-defaults/${S:T:R}: ${S} __appdefinstall
323 1.1 lukem .endfor
324 1.1 lukem
325 1.1 lukem realinstall: appdefsinstall
326 1.1 lukem .endif # }
327 1.1 lukem
328 1.1 lukem
329 1.1 lukem #
330 1.1 lukem # .man page handling
331 1.1 lukem #
332 1.4 lukem .if (${MKMAN} != "no" && (${MAN:U} != "" || ${PROG:U} != "")) # {
333 1.1 lukem cleandir: cleanx11man
334 1.27 lukem cleanx11man: .PHONY
335 1.4 lukem rm -f ${MAN:U${PROG:D${PROG.1}}}
336 1.1 lukem .endif # }
337 1.1 lukem
338 1.16 rtr .SUFFIXES: .man .1 .3 .4 .5 .7
339 1.1 lukem
340 1.17 rtr .man.1 .man.3 .man.4 .man.5 .man.7:
341 1.7 lukem ${_MKTARGET_CREATE}
342 1.1 lukem rm -f ${.TARGET}
343 1.42 fredb sed -e 's/\\$$/\\ /' ${.IMPSRC} \
344 1.42 fredb | ${CPP} -undef -traditional \
345 1.1 lukem -D__apploaddir__=${X11ROOTDIR}/lib/X11/app-defaults \
346 1.63 lukem -D__appmansuffix__=1 \
347 1.40 lukem -D__libmansuffix__=3 \
348 1.40 lukem -D__filemansuffix__=5 \
349 1.40 lukem -D__miscmansuffix__=7 \
350 1.40 lukem -D__drivermansuffix__=4 \
351 1.40 lukem -D__adminmansuffix__=8 \
352 1.1 lukem -D__projectroot__=${X11ROOTDIR} \
353 1.1 lukem -D__xorgversion__='"Release 6.6" "X Version 11"' \
354 1.46 hira -D__vendorversion__="XFree86 4.5.0" \
355 1.1 lukem ${X11EXTRAMANDEFS} \
356 1.42 fredb | ${X11TOOL_UNXCOMM} > ${.TARGET}
357