1 # $NetBSD: bsd.x11.mk,v 1.106 2012/04/04 10:59:47 joerg Exp $
6 LIBDIR
= ${X11USRLIBDIR}
9 COPTS
+= -fno-strict-aliasing
13 .if defined
(USE_SSP
) && (${USE_SSP} != "no")
14 CPPFLAGS
+= -DNO_ALLOCA
17 X11FLAGS.VERSION
= -DOSMAJORVERSION
=5 -DOSMINORVERSION
=99 # XXX
20 X11FLAGS.THREADS
= -DXTHREADS
-D_REENTRANT
-DXUSE_MTSAFE_API \
24 X11FLAGS.CONNECTION
= -DTCPCONN
-DUNIXCONN
-DHAS_STICKY_DIR_BIT \
27 .if
(${USE_INET6} != "no")
28 X11FLAGS.CONNECTION
+= -DIPv6
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 \
39 X11FLAGS.PERVASIVE_EXTENSION
= -DSHAPE
-DXINPUT
-DXKB
-DLBX
-DXAPPGROUP \
40 -DXCSECURITY
-DTOGCUP
-DXF86BIGFONT \
41 -DDPMSExtension
-DPIXPRIV
-DPANORAMIX \
42 -DRENDER
-DRANDR
-DXFIXES
-DDAMAGE \
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 \
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
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
72 X11FLAGS.DRI
= -DGLXEXT
-DXF86DRI
-DGLX_DIRECT_RENDERING \
73 -DGLX_USE_DLOPEN
-DGLX_USE_MESA
76 X11FLAGS.EXTENSION
+= ${X11FLAGS.DRI
}
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
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" || \
98 X11FLAGS.EXTENSION
+= -DXF86VIDMODE
101 X11FLAGS.SERVER
+= -DXINPUT
-DXFreeXDGA
-DXF86VIDMODE
104 .if
${MACHINE_ARCH} == "alpha" || \
105 ${MACHINE_ARCH} == "sparc64" || \
106 ${MACHINE_ARCH} == "x86_64"
108 X11FLAGS.SERVER
+= -D_XSERVER64
109 X11FLAGS.EXTENSION
+= -D__GLX_ALIGN64
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"
125 X11FLAGS.LOADABLE
= -DXFree86LOADER
-DIN_MODULE
-DXFree86Module \
126 ${${ACTIVE_CXX} == "gcc":?
-fno-merge-constants
:}
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)"
142 PRINT_PACKAGE_VERSION
= awk
'/^PACKAGE_VERSION=/ { \
143 match($$1, "([0-9]+\\.)+[0-9]+"); \
144 version = substr($$1, RSTART, RLENGTH); \
145 } END { print version }'
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__
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
) # {
190 ${CC} -E
-undef
-traditional
- \
191 ${CPPSCRIPTFLAGS_
${.TARGET
}:U
${CPPSCRIPTFLAGS}} \
192 < ${.IMPSRC
} |
${X11TOOL_UNXCOMM} > ${.TARGET
}
194 realall
: ${CPPSCRIPTS}
196 CLEANFILES
+= ${CPPSCRIPTS}
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
}
220 .if defined
(PKGCONFIG
)
222 .
include <bsd.files.mk
>
224 _PKGCONFIG_FILES
= ${PKGCONFIG
:C
/$/.
pc/}
226 .PHONY
: 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}}
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
256 .SUFFIXES
: .
pc.in .
pc
260 if
[ -n
'${PKGCONFIG_VERSION.${.PREFIX}}' ]; then \
261 _pkg_version
='${PKGCONFIG_VERSION.${.PREFIX}}'; \
263 _pkg_version
=$$(${PRINT_PACKAGE_VERSION} \
264 ${PKGDIST.
${.PREFIX
}}/configure
); \
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%.*}," \
288 s,@xkb_base@,\\$$\{prefix\}/lib/X11/xkb,; \
289 s,@xcbincludedir@,\\$$\{prefix\}/share/xcb,; \
290 s,@fontrootdir@,\\$$\{libdir\}/X11/fonts,; \
291 s,@LIBXML2_LIBS@,,; \
294 s,@FT2_EXTRA_LIBS@,," \
295 -e
"s,@moduledir@,\\$$\{libdir\}/modules,; \
296 s,@sdkdir@,\\$$\{includedir\}/xorg,; \
297 s,@PIXMAN_CFLAGS@,,; \
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,; \
308 s,@X11_EXTRA_DEPS@,,; \
309 s,@XTHREAD_CFLAGS@,-D_REENTRANT,; \
310 s,@XTHREADLIB@,-lpthread,; \
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@,,; \
330 s,@abi_ansic@,0.4,; \
331 s,@abi_videodrv@,5.0,; \
332 s,@abi_xinput@,4.0,; \
333 s,@abi_extension@,2.0,; \
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
/}
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
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
360 realinstall
: appdefsinstall
367 .if
(${MKMAN} != "no" && (${MAN
:U
} != "" ||
${PROG
:U
} != "")) # {
368 CLEANDIRFILES
+= ${MAN
:U
${PROG
:D
${PROG
.1}}}
371 .SUFFIXES
: .man .man.pre
.1 .3 .4 .5 .7
374 __adminmansuffix__
8 \
375 __apploaddir__
${X11ROOTDIR}/lib
/X11
/app-defaults \
377 __bindir__
${X11BINDIR} \
378 __drivermansuffix__
4 \
379 __filemansuffix__
5 \
380 __LIB_MAN_SUFFIX__
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"
394 __vendorversion__
${X11VERSION
:C
/ /%/gW
}
396 XORGVERSION
= '"X Version 11"'
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 \
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
}
416 _X11MANTRANSFORMCMD
+= |
${TOOL_SED}
417 . for __def__ __value__ in
${_X11MANTRANSFORM}
418 _X11MANTRANSFORMCMD
+= -e s
,${__def__},${__value__
:C
/%/ /gW
},g
421 _X11MANTRANSFORMCMD
+= ${X11EXTRAMANDEFS}
423 .man
.1 .man
.3 .man
.4 .man
.5 .man
.7 .man.pre
.1 .man.pre
.4 .man.pre
.5:
426 ${_X11MANTRANSFORMCMD} |
${X11TOOL_UNXCOMM} > ${.TARGET
}
428 ##### Pull in related .mk logic
429 .
include <bsd.
clean.mk
>