summaryrefslogtreecommitdiff
path: root/graphics/MesaLib/Makefile
blob: f2a3f721b5b3ed62dad1b36df875c6817e04c9a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# $NetBSD: Makefile,v 1.68 2008/08/06 02:33:22 dsainty Exp $

PKGNAME=	MesaLib-${MESA_PKGVERSION}
COMMENT=	Graphics library similar to SGI's OpenGL
PKGREVISION=	2

MESA_HEADERS=	gl.h gl_mangle.h glext.h glx.h glxext.h	\
		glx_mangle.h osmesa.h xmesa.h xmesa_x.h	\
 		xmesa_xf86.h

MESA_HEADERS+=	internal/dri_interface.h internal/sarea.h

PKG_DESTDIR_SUPPORT=	user-destdir

BUILD_DEFS+=		MESA_HZ
###
### XXX Older versions of xf86driproto installed dri_interface.h, which
###	is now installed by Mesa.
###
BUILDLINK_API_DEPENDS.driproto+=	xf86driproto>=2.0.4

.include "../../mk/bsd.prefs.mk"

CFLAGS.NetBSD+=	-D_NETBSD_SOURCE

.if (${MACHINE_ARCH} == "x86_64" || \
    ${MACHINE_ARCH} == "sparc64" || \
    ${MACHINE_ARCH} == "alpha")
CFLAGS+=	-D__GLX_ALIGN64
.endif

.if !empty(MACHINE_ARCH:Mi386) || !empty(MACHINE_ARCH:Mx86_64)
###
### This is taken from <sys/arch/i386/include/npx.h>.  If we don't override
### it, the FPU control word will be restored to 0x037f.
###
### Also, see patch-aq about the libm functions required (float functions
### such as floorf).  Proper configuration of this should be a goal of
### the Mesa developers; alas, it obviously is not.
###
### XXX We need a reliable check for these functions.
###
#/* NetBSD uses IEEE double precision. */
CFLAGS.NetBSD+=		-DDEFAULT_X86_FPU=0x127f
###
###
#/* FreeBSD leaves some exceptions unmasked as well. */
###
CFLAGS.FreeBSD+=	-DDEFAULT_x86_FPU=0x1272
.endif

CFLAGS.FreeBSD+=	-DUSE_NATIVE_LIBM_FUNCS
CFLAGS.Linux+=		-DUSE_NATIVE_LIBM_FUNCS
CFLAGS.NetBSD+=		-DUSE_NATIVE_LIBM_FUNCS
CFLAGS.DragonFly+=	-DUSE_NATIVE_LIBM_FUNCS

PLIST_VARS=		dri nodri

.include "../../graphics/Mesa/Makefile.lib"
.include "options.mk"

.if !empty(MACHINE_PLATFORM:MNetBSD-[12].*)
##
## NetBSD 2.x and earlier require pthread stubs
##
.  include "../../devel/pthread-stublib/buildlink3.mk"
PTHREAD_STUBLIB= -L${PREFIX}/lib -Wl,-R${PREFIX}/lib -lpthstub
.elif !empty(MACHINE_PLATFORM:MNetBSD-*)
##
## NetBSD 3.x and later have pthread stubs in libc
##
PTHREAD_STUBLIB=
.else
##
## Other platforms may or may not have stubs provided by libc, but pulling in
## threading support via the pthread.buildlink3.mk definitions will provide
## all the necessary interfaces.  This matches the standard configuration for
## most platforms as they appear in "${WRKSRC}/configs", and is necessary
## for successful linking with libGL under many platforms.
##
.include "../../mk/pthread.buildlink3.mk"
PTHREAD_STUBLIB= ${PTHREAD_LDFLAGS} ${PTHREAD_LIBS}
.endif
PKGSRC_MAKE_ENV+=	PTHREAD_STUBLIB=${PTHREAD_STUBLIB:Q}

.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
MAKE_ENV+=	CROSS_COMPILING=yes
.endif

RM_PATCH_BACKUP_DIRS=	docs src/mesa src/glut/glx \
			progs/demos progs/xdemos progs/glsl
post-extract:
	${CP} ${FILESDIR}/gen_matypes.awk ${WRKSRC}/src/mesa/x86
	${CP} ${FILESDIR}/gen_matypes.sh ${WRKSRC}/src/mesa/x86
	${CHMOD} a+x ${WRKSRC}/src/mesa/x86/gen_matypes.sh
	for fn in ${RM_PATCH_BACKUP_DIRS}; do \
		${RM} -f ${WRKSRC}/$${fn}/*.orig; \
	done

pre-install:
	${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX}/include/GL/internal

pre-build:
	cd ${WRKSRC} && ${RM} -fr src/glu src/glut progs

.include "../../mk/bsd.pkg.mk"