release.sh: restore -jJAILDIR option
[minix.git] / share / mk / bsd.x11.mk
blob915c666ae8950828c2f6ba96d835a38ca8df3ec6
1 # $NetBSD: bsd.x11.mk,v 1.106 2012/04/04 10:59:47 joerg Exp $
3 .include <bsd.init.mk>
5 BINDIR= ${X11BINDIR}
6 LIBDIR= ${X11USRLIBDIR}
7 MANDIR= ${X11MANDIR}
9 COPTS+= -fno-strict-aliasing
11 .include <bsd.sys.mk>
13 .if defined(USE_SSP) && (${USE_SSP} != "no")
14 CPPFLAGS+= -DNO_ALLOCA
15 .endif
17 X11FLAGS.VERSION= -DOSMAJORVERSION=5 -DOSMINORVERSION=99 # XXX
19 # THREADS_DEFINES
20 X11FLAGS.THREADS= -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API \
21 -DXNO_MTSAFE_PWDAPI
23 # CONNECTION_FLAGS
24 X11FLAGS.CONNECTION= -DTCPCONN -DUNIXCONN -DHAS_STICKY_DIR_BIT \
25 -DHAS_FCHOWN
27 .if (${USE_INET6} != "no")
28 X11FLAGS.CONNECTION+= -DIPv6
29 .endif
31 # EXT_DEFINES
32 .if ${X11FLAVOUR} == "Xorg"
33 X11FLAGS.BASE_EXTENSION= -DMITMISC -DXTEST -DXTRAP -DXSYNC -DXCMISC \
34 -DXRECORD -DMITSHM -DBIGREQS -DXF86VIDMODE \
35 -DXF86MISC -DDPMSExtension -DEVI \
36 -DSCREENSAVER -DXV -DXVMC -DGLXEXT \
37 -DRES
39 X11FLAGS.PERVASIVE_EXTENSION= -DSHAPE -DXINPUT -DXKB -DLBX -DXAPPGROUP \
40 -DXCSECURITY -DTOGCUP -DXF86BIGFONT \
41 -DDPMSExtension -DPIXPRIV -DPANORAMIX \
42 -DRENDER -DRANDR -DXFIXES -DDAMAGE \
43 -DCOMPOSITE -DXEVIE
44 X11FLAGS.EXTENSION= ${X11FLAGS.BASE_EXTENSION} \
45 ${X11FLAGS.PERVASIVE_EXTENSION}
47 X11FLAGS.DIX= -DHAVE_DIX_CONFIG_H -D_BSD_SOURCE -DHAS_FCHOWN \
48 -DHAS_STICKY_DIR_BIT -D_POSIX_THREAD_SAFE_FUNCTIONS \
49 -DHAVE_XORG_CONFIG_H
50 X11INCS.DIX= -I${X11INCSDIR}/freetype2 \
51 -I${X11INCSDIR}/pixman-1 \
52 -I$(X11SRCDIR.xorg-server)/include \
53 -I$(X11SRCDIR.xorg-server)/Xext \
54 -I$(X11SRCDIR.xorg-server)/composite \
55 -I$(X11SRCDIR.xorg-server)/damageext \
56 -I$(X11SRCDIR.xorg-server)/xfixes \
57 -I$(X11SRCDIR.xorg-server)/Xi \
58 -I$(X11SRCDIR.xorg-server)/mi \
59 -I$(X11SRCDIR.xorg-server)/miext/shadow \
60 -I$(X11SRCDIR.xorg-server)/miext/damage \
61 -I$(X11SRCDIR.xorg-server)/render \
62 -I$(X11SRCDIR.xorg-server)/randr \
63 -I$(X11SRCDIR.xorg-server)/fb \
64 -I$(X11SRCDIR.xorg-server)/../include
65 .else
66 X11FLAGS.EXTENSION= -DMITMISC -DXTEST -DXTRAP -DXSYNC -DXCMISC -DXRECORD \
67 -DMITSHM -DBIGREQS -DXF86MISC -DDBE -DDPMSExtension \
68 -DEVI -DSCREENSAVER -DXV -DXVMC -DGLXEXT \
69 -DGLX_USE_MESA -DFONTCACHE -DRES
70 .endif
72 X11FLAGS.DRI= -DGLXEXT -DXF86DRI -DGLX_DIRECT_RENDERING \
73 -DGLX_USE_DLOPEN -DGLX_USE_MESA
75 .if ${X11DRI} != "no"
76 X11FLAGS.EXTENSION+= ${X11FLAGS.DRI}
77 .endif
79 # ServerDefines
80 X11FLAGS.SERVER= -DSHAPE -DXKB -DLBX -DXAPPGROUP -DXCSECURITY \
81 -DTOGCUP -DXF86BIGFONT -DDPMSExtension -DPIXPRIV \
82 -DPANORAMIX -DRENDER -DRANDR -DGCCUSESGAS \
83 -DAVOID_GLYPHBLT -DSINGLEDEPTH -DXvExtension \
84 -DXFree86Server -DXvMCExtension -DSMART_SCHEDULE \
85 -DBUILDDEBUG -DXResExtension -DNDEBUG
87 # OS_DEFINES
88 X11FLAGS.OS_DEFINES= -DDDXOSINIT -DSERVER_LOCK -DDDXOSFATALERROR \
89 -DDDXOSVERRORF -DDDXTIME -DUSB_HID
91 .if !(${MACHINE} == "acorn32" || \
92 (${MACHINE} == "alpha" && ${X11FLAVOUR} != "Xorg") || \
93 ${MACHINE} == "amiga" || \
94 ${MACHINE} == "pmax" || \
95 ${MACHINE} == "sun3" || \
96 ${MACHINE} == "vax")
97 # EXT_DEFINES
98 X11FLAGS.EXTENSION+= -DXF86VIDMODE
100 # ServerDefines
101 X11FLAGS.SERVER+= -DXINPUT -DXFreeXDGA -DXF86VIDMODE
102 .endif
104 .if ${MACHINE_ARCH} == "alpha" || \
105 ${MACHINE_ARCH} == "sparc64" || \
106 ${MACHINE_ARCH} == "x86_64"
107 # ServerDefines
108 X11FLAGS.SERVER+= -D_XSERVER64
109 X11FLAGS.EXTENSION+= -D__GLX_ALIGN64
110 .endif
112 .if ${MACHINE} == "amd64" || \
113 ${MACHINE} == "cats" || \
114 ${MACHINE} == "i386" || \
115 ${MACHINE} == "macppc" || \
116 ${MACHINE} == "netwinder" || \
117 ${MACHINE} == "ofppc" || \
118 ${MACHINE} == "prep" || \
119 ${MACHINE} == "sgimips" || \
120 ${MACHINE} == "sparc64" || \
121 ${MACHINE} == "sparc" || \
122 ${MACHINE} == "shark" || \
123 ${MACHINE} == "zaurus"
124 # LOADABLE
125 X11FLAGS.LOADABLE= -DXFree86LOADER -DIN_MODULE -DXFree86Module \
126 ${${ACTIVE_CXX} == "gcc":? -fno-merge-constants :}
127 .endif
129 # XXX FIX ME
130 .if ${X11FLAVOUR} == "Xorg"
131 XVENDORNAMESHORT= '"X.Org"'
132 XVENDORNAME= '"The X.Org Foundation"'
133 XORG_RELEASE= '"Release 1.10.3"'
134 __XKBDEFRULES__= '"xorg"'
135 XLOCALE.DEFINES= -DXLOCALEDIR=\"${X11LIBDIR}/locale\" \
136 -DXLOCALELIBDIR=\"${X11LIBDIR}/locale\"
138 # XXX oh yeah, fix me later
139 XORG_VERSION_CURRENT="(((1) * 10000000) + ((10) * 100000) + ((3) * 1000) + 0)"
140 .endif
142 PRINT_PACKAGE_VERSION= awk '/^PACKAGE_VERSION=/ { \
143 match($$1, "([0-9]+\\.)+[0-9]+"); \
144 version = substr($$1, RSTART, RLENGTH); \
145 } END { print version }'
148 # Extract X11VERSION
149 PRINTX11VERSION=${TOOL_AWK} ' \
150 /^\#define XF86_VERSION_MAJOR/ {major = $$3} \
151 /^\#define XF86_VERSION_MINOR/ {minor = $$3} \
152 /^\#define XF86_VERSION_PATCH/ {patch = $$3} \
153 /^\#define XF86_VERSION_SNAP/ {snap = $$3} \
154 END { print "((("major") * 10000000) + (("minor") * 100000) + (("patch") * 1000) + "snap")"}' \
155 ${X11SRCDIR.xc}/programs/Xserver/hw/xfree86/xf86Version.h
157 # Commandline to convert 'XCOMM' comments and 'XHASH' to '#', among other
158 # things. Transformed from the "CppSedMagic" macro from "Imake.rules".
160 X11TOOL_UNXCOMM= ${TOOL_SED} -e '/^\# *[0-9][0-9]* *.*$$/d' \
161 -e '/^\#line *[0-9][0-9]* *.*$$/d' \
162 -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
163 -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
164 -e '/^[ ]*XHASH/s/XHASH/\#/' \
165 -e '/\@\@$$/s/\@\@$$/\\/'
168 CPPFLAGS+= -DCSRG_BASED -DFUNCPROTO=15 -DNARROWPROTO
169 CPPFLAGS+= -I${DESTDIR}${X11INCDIR}
171 .if ${MACHINE_ARCH} == "x86_64"
172 CPPFLAGS+= -D__AMD64__
173 .endif
175 LDFLAGS+= -Wl,-rpath,${X11USRLIBDIR} -L=${X11USRLIBDIR}
179 # .cpp -> "" handling
180 # CPPSCRIPTS list of files/scripts to run through cpp
181 # CPPSCRIPTFLAGS extra flags to ${CPP}
182 # CPPSCRIPTFLAGS_fn extra flags to ${CPP} for file `fn'
184 .if defined(CPPSCRIPTS) # {
185 .SUFFIXES: .cpp
187 .cpp:
188 ${_MKTARGET_CREATE}
189 rm -f ${.TARGET}
190 ${CC} -E -undef -traditional - \
191 ${CPPSCRIPTFLAGS_${.TARGET}:U${CPPSCRIPTFLAGS}} \
192 < ${.IMPSRC} | ${X11TOOL_UNXCOMM} > ${.TARGET}
194 realall: ${CPPSCRIPTS}
196 CLEANFILES+= ${CPPSCRIPTS}
197 .endif # }
200 # X.Org pkgconfig files handling
202 # PKGCONFIG is expected to contain a list of pkgconfig module names.
203 # They will produce the files <module1>.pc, <module2>.pc, etc, to be
204 # put in X11USRLIBDIR/pkgconfig.
206 # PKGDIST contains the name of a X11SRCDIR subscript where to find the
207 # source file for the pkgconfig files.
209 # If PKGDIST is not suitable, a consumer can set PKGDIST.<module> with
210 # the full path to the source file.
212 # Also, the consumer can use PKGDIST alone, and a PKGCONFIG will be
213 # derived from it. Many times, PKGDIST is capitalized and PKGCONFIG is
214 # the lower case version.
217 .if defined(PKGDIST) && !defined(PKGCONFIG)
218 PKGCONFIG= ${PKGDIST:tl}
219 .endif
220 .if defined(PKGCONFIG)
222 .include <bsd.files.mk>
224 _PKGCONFIG_FILES= ${PKGCONFIG:C/$/.pc/}
226 .PHONY: pkgconfig-install
227 pkgconfig-install:
229 realall: ${_PKGCONFIG_FILES:O:u}
230 realinstall: pkgconfig-install
232 .for _pkg in ${PKGCONFIG:O:u}
233 PKGDIST.${_pkg}?= ${X11SRCDIR.${PKGDIST:U${_pkg}}}
234 _PKGDEST.${_pkg}= ${DESTDIR}${X11USRLIBDIR}/pkgconfig/${_pkg}.pc
236 .PATH: ${PKGDIST.${_pkg}}
238 FILESOWN_${_pkg}.pc= ${BINOWN}
239 FILESGRP_${_pkg}.pc= ${BINGRP}
240 FILESMODE_${_pkg}.pc= ${NONBINMODE}
242 ${_PKGDEST.${_pkg}}: ${_pkg}.pc __fileinstall
243 pkgconfig-install: ${_PKGDEST.${_pkg}}
244 .endfor
246 # XXX
247 # The sed script is very, very ugly. What we actually need is a
248 # mknative-xorg script that will generate all the .pc files from
249 # running the autoconfigure script.
250 # And yes, it has to be splitted in two otherwise it's too long
251 # for sed to handle.
253 # hacky transforms:
254 # @XCBPROTO_VERSION@
256 .SUFFIXES: .pc.in .pc
257 .pc.in.pc:
258 ${_MKTARGET_CREATE}
259 rm -f ${.TARGET}
260 if [ -n '${PKGCONFIG_VERSION.${.PREFIX}}' ]; then \
261 _pkg_version='${PKGCONFIG_VERSION.${.PREFIX}}'; \
262 else \
263 _pkg_version=$$(${PRINT_PACKAGE_VERSION} \
264 ${PKGDIST.${.PREFIX}}/configure); \
265 fi; \
266 ${TOOL_SED} \
267 -e "s,@prefix@,${X11ROOTDIR},; \
268 s,@INSTALL_DIR@,${X11ROOTDIR},; \
269 s,@exec_prefix@,\\$$\{prefix\},; \
270 s,@libdir@,\\$$\{prefix\}/lib,; \
271 s,@includedir@,\\$$\{prefix\}/include,; \
272 s,@datarootdir@,\\$$\{prefix\}/share,; \
273 s,@datadir@,\\$$\{datarootdir\},; \
274 s,@appdefaultdir@,\\$$\{libdir}/X11/app-defaults,; \
275 s,@MAPDIR@,\\$$\{libdir\}/X11/fonts/util,; \
276 s,@ICONDIR@,\\$$\{datarootdir\}/icons,; \
277 s,@PACKAGE_VERSION@,$${_pkg_version},; \
278 s,@VERSION@,$${_pkg_version},; \
279 s,@COMPOSITEEXT_VERSION@,$${_pkg_version%.*},; \
280 s,@DAMAGEEXT_VERSION@,$${_pkg_version%.*},; \
281 s,@FIXESEXT_VERSION@,$${_pkg_version%.*},; \
282 s,@RANDR_VERSION@,$${_pkg_version%.*},; \
283 s,@RENDER_VERSION@,$${_pkg_version%.*}," \
284 -e "s,@LIBS@,,; \
285 s,@Z_LIBS@,-lz,; \
286 s,@LIBZ@,-lz,; \
287 s,@LIBBZ2@,-lbz2,; \
288 s,@xkb_base@,\\$$\{prefix\}/lib/X11/xkb,; \
289 s,@xcbincludedir@,\\$$\{prefix\}/share/xcb,; \
290 s,@fontrootdir@,\\$$\{libdir\}/X11/fonts,; \
291 s,@LIBXML2_LIBS@,,; \
292 s,@ICONV_LIBS@,,; \
293 s,@NEEDED@,,; \
294 s,@FT2_EXTRA_LIBS@,," \
295 -e "s,@moduledir@,\\$$\{libdir\}/modules,; \
296 s,@sdkdir@,\\$$\{includedir\}/xorg,; \
297 s,@PIXMAN_CFLAGS@,,; \
298 s,@LIB_DIR@,/lib,; \
299 s,@INSTALL_LIB_DIR@,\\$$\{prefix\}/lib,; \
300 s,@INSTALL_INC_DIR@,\\$$\{prefix\}/include,; \
301 s,@XKBPROTO_REQUIRES@,kbproto,; \
302 s,@XCBPROTO_VERSION@,1.7,; \
303 s,@FREETYPE_REQUIRES@,freetype2,; \
304 s,@EXPAT_LIBS@,-lexpat,; \
305 s,@FREETYPE_LIBS@,-lfreetype,; \
306 s,@DEP_CFLAGS@,,; \
307 s,@DEP_LIBS@,,; \
308 s,@X11_EXTRA_DEPS@,,; \
309 s,@XTHREAD_CFLAGS@,-D_REENTRANT,; \
310 s,@XTHREADLIB@,-lpthread,; \
311 s,@GL_LIB@,GL,; \
312 s,@GL_PC_REQ_PRIV@,x11 xext,; \
313 s,@GL_PC_LIB_PRIV@,-lm -lpthread,; \
314 s,@GL_PC_CFLAGS@,," \
315 -e "s,@GLU_LIB@,GLU,; \
316 s,@GLU_PC_REQ@,gl,; \
317 s,@GLU_PC_REQ_PRIV@,,; \
318 s,@GLU_PC_LIB_PRIV@,-lGLU,; \
319 s,@GLU_PC_CFLAGS@,,; \
320 s,@GLUT_LIB@,glut,; \
321 s,@GLUT_PC_REQ_PRIV@,gl glu,; \
322 s,@GLUT_PC_LIB_PRIV@,-lglut,; \
323 s,@GLUT_PC_CFLAGS@,,; \
324 s,@GLW_PC_CFLAGS@,,; \
325 s,@GLW_PC_REQ_PRIV@,x11 xt,; \
326 s,@GLW_PC_LIB_PRIV@,,; \
327 s,@DRI_DRIVER_DIR@,\\$$\{libdir\}/modules/dri,; \
328 s,@DRI_PC_REQ_PRIV@,,; \
329 s,@GLW_LIB@,GLw,; \
330 s,@abi_ansic@,0.4,; \
331 s,@abi_videodrv@,5.0,; \
332 s,@abi_xinput@,4.0,; \
333 s,@abi_extension@,2.0,; \
334 s,@abi_font@,0.6,; \
335 s,@fchown_define@,-DHAS_FCHOWN,; \
336 s,@sticky_bit_define@,-DHAS_STICKY_DIR_BIT," \
337 -e '/^Libs:/ s%-L\([^ ]*\)%-Wl,-rpath,\1 &%g' \
338 < ${.IMPSRC} > ${.TARGET}.tmp && \
339 mv -f ${.TARGET}.tmp ${.TARGET}
341 CLEANDIRFILES+= ${_PKGCONFIG_FILES} ${_PKGCONFIG_FILES:C/$/.tmp/}
342 .endif
345 # APPDEFS (app defaults) handling
347 .if defined(APPDEFS) # {
348 appdefsinstall:: .PHONY ${APPDEFS:@S@${DESTDIR}${X11LIBDIR}/app-defaults/${S:T:R}@}
349 .PRECIOUS: ${APPDEFS:@S@${DESTDIR}${X11LIBDIR}/app-defaults/${S:T:R}@}
351 __appdefinstall: .USE
352 ${_MKTARGET_INSTALL}
353 ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${NONBINMODE} \
354 ${.ALLSRC} ${.TARGET}
356 .for S in ${APPDEFS:O:u}
357 ${DESTDIR}${X11LIBDIR}/app-defaults/${S:T:R}: ${S} __appdefinstall
358 .endfor
360 realinstall: appdefsinstall
361 .endif # }
365 # .man page handling
367 .if (${MKMAN} != "no" && (${MAN:U} != "" || ${PROG:U} != "")) # {
368 CLEANDIRFILES+= ${MAN:U${PROG:D${PROG.1}}}
369 .endif # }
371 .SUFFIXES: .man .man.pre .1 .3 .4 .5 .7
373 _X11MANTRANSFORM= \
374 __adminmansuffix__ 8 \
375 __apploaddir__ ${X11ROOTDIR}/lib/X11/app-defaults \
376 __appmansuffix__ 1 \
377 __bindir__ ${X11BINDIR} \
378 __drivermansuffix__ 4 \
379 __filemansuffix__ 5 \
380 __LIB_MAN_SUFFIX__ 3 \
381 __libmansuffix__ 3 \
382 __logdir__ /var/log \
383 __mandir__ ${X11MANDIR} \
384 __miscmansuffix__ 7 \
385 __oslibmansuffix__ 3 \
386 __projectroot__ ${X11ROOTDIR} \
387 ${X11EXTRAMANTRANSFORMS}
389 # Note the escaping trick for _X11MANTRANSFORM using % to replace spaces
390 .if ${X11FLAVOUR} != "Xorg"
391 X11VERSION= "XFree86 4.5.0"
392 X11MANCPP?= yes
393 _X11MANTRANSFORM+= \
394 __vendorversion__ ${X11VERSION:C/ /%/gW}
395 .else
396 XORGVERSION= '"X Version 11"'
397 X11MANCPP?= no
398 _X11MANTRANSFORM+= \
399 __vendorversion__ ${XORGVERSION:C/ /%/gW} \
400 __XCONFIGFILE__ xorg.conf \
401 __xconfigfile__ xorg.conf \
402 __XCONFIGFILEMAN__ '__XCONFIGFILE__%(__filemansuffix__)' \
403 __xorgversion__ ${XORGVERSION:C/ /%/gW} \
404 __XSERVERNAME__ Xorg \
405 __xservername__ Xorg
406 .endif
408 _X11MANTRANSFORMCMD= ${TOOL_SED} -e 's/\\$$/\\ /' ${.IMPSRC}
410 .if ${X11MANCPP} != "no"
411 _X11MANTRANSFORMCMD+= | ${CC} -E -undef -traditional -
412 . for __def__ __value__ in ${_X11MANTRANSFORM}
413 _X11MANTRANSFORMCMD+= -D${__def__}=${__value__:C/%/ /gW}
414 . endfor
415 .else
416 _X11MANTRANSFORMCMD+= | ${TOOL_SED}
417 . for __def__ __value__ in ${_X11MANTRANSFORM}
418 _X11MANTRANSFORMCMD+= -e s,${__def__},${__value__:C/%/ /gW},g
419 . endfor
420 .endif
421 _X11MANTRANSFORMCMD+= ${X11EXTRAMANDEFS}
423 .man.1 .man.3 .man.4 .man.5 .man.7 .man.pre.1 .man.pre.4 .man.pre.5:
424 ${_MKTARGET_CREATE}
425 rm -f ${.TARGET}
426 ${_X11MANTRANSFORMCMD} | ${X11TOOL_UNXCOMM} > ${.TARGET}
428 ##### Pull in related .mk logic
429 .include <bsd.clean.mk>