summaryrefslogtreecommitdiff
path: root/graphics/Mesa/Makefile.lib
blob: 22d056ef4ee56ac71cc0bc6deb3b73658b2ac565 (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
# $NetBSD: Makefile.lib,v 1.13 2008/07/27 00:03:42 bjs Exp $
#
# This Makefile fragment is included by all packages that build libraries
# from the Mesa sources.
#

.include "../../graphics/Mesa/Makefile.common"

DISTFILES+=	MesaLib-${MESA_VERSION}${EXTRACT_SUFX}
DISTFILES+=	MesaGLUT-${MESA_VERSION}${EXTRACT_SUFX}
DISTFILES+=	MesaDemos-${MESA_VERSION}${EXTRACT_SUFX}

PKG_INSTALLATION_TYPES=	overwrite pkgviews

USE_LANGUAGES=		c c++
USE_LIBTOOL=		yes
LIBTOOL=		${PKG_SHLIBTOOL}
USE_TOOLS+=		gmake pkg-config

PATCHDIR=		${.CURDIR}/../MesaLib/patches
DISTINFO_FILE=		${.CURDIR}/../MesaLib/distinfo

COPTS?= 	 	# empty
COPTS+= 	 	-prefer-pic 	# Make sure to build PIC libraries.

MAKE_ENV+=		MAKE=${GMAKE:Q}
MAKE_ENV+=		COPTS=${COPTS:M*:Q}
MAKE_ENV+=		MKDEP=${TRUE:Q}

#.if ${X11_TYPE} == "modular"
#.  if defined(PKG_BUILD_OPTIONS.libX11) && \
#	!empty(PKG_BUILD_OPTIONS.libX11:Mxcb)
#MAKE_ENV+=		USE_XCB=yes
#.  endif
#.endif

#.if empty(MAKE_ENV:MUSE_XCB=*)
MAKE_ENV+=		USE_XCB=no
#.endif

.include "../../mk/compiler.mk"

.if !empty(PKGSRC_COMPILER:Mccc)
CFLAGS+=	-D__FUNCTION__=__FILE__
.endif

MESA_HZ?=	100
MAKE_ENV+=	MESA_HZ=${MESA_HZ:Q}
.if ${OPSYS} == "NetBSD" && exists(/sbin/sysctl)
tmphz=\
	${/sbin/sysctl kern.clockrate || ${TRUE}\
	:L:sh:ts,:S/,//gW:C/([^[0-9]]*)(=|[^ hz])*([^[0-9])//g:M[0-9]*}
.  if !empty(tmphz) && (${tmphz} > 50) && (${tmphz} < 2001)
MESA_HZ=	${tmphz}
.  endif
.endif
###
### XXX do we still want this?
###
.if ${OPSYS} == "Interix"
BUILD_TARGET=		interix3
.else
BUILD_TARGET?=		pkgsrc
.endif

RM_PATCH_BACKUP_DIRS= 	docs src/mesa src/glut/glx \
 	 	 	progs/demos progs/xdemos progs/glsl
pre-patch:
	for fn in ${RM_PATCH_BACKUP_DIRS}; do \
		${RM} -f ${WRKSRC}/$${fn}/*.orig; \
	done

post-patch:
	${CP} ${.CURDIR}/../MesaLib/files/configs/[d-z]* ${WRKSRC}/configs

post-install: install-headers
###
### XXX MesaLib installs headers into GL/internal, and this directory is
###	created there by the pre-install target.  TODO: unify these targets.
###
.PHONY: install-headers
.if empty(PKGNAME:M*MesaDemos*)
install-headers:
	${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX}/include/GL
.for hdr in ${MESA_HEADERS}
	if [ -f ${WRKSRC}/include/GL/${hdr:Q} ]; then \
	    ${INSTALL_DATA} ${WRKSRC}/include/GL/${hdr:Q} \
	    ${DESTDIR}${PREFIX}/include/GL/${hdr:Q}; \
	fi;
.endfor
.else
install-headers:
	@${DO_NADA}
.endif

SUBST_CLASSES+=                 fix-paths
SUBST_STAGE.fix-paths=          pre-configure
SUBST_MESSAGE.fix-paths=        Fixing absolute paths.
SUBST_FILES.fix-paths=          src/*.c
SUBST_FILES.fix-paths+=         scripts/*.sh
SUBST_SED.fix-paths=            -e 's,"/usr/local,"${PREFIX},g'