aboutsummaryrefslogtreecommitdiff
path: root/Mk/Uses/xorg-cat.mk
blob: b872636205b07b5b30514141f527abfeaec5a1be (plain) (blame)
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# $FreeBSD$
# 
# xorg ports categories and other things needed to build xorg ports.
# This is intended only for ports of xorg and freedesktop.org applications.
#
# Use USES=xorg and USE_XORG to depend on various xorg components.
#
# Feature:	xorg-cat
# Usage:	USES=xorg-cat:category[,buildsystem]
#
# 		category is one of:
# 		* app      Installs applications, no shared libraries.
# 		* data     Installs only data.
# 		* doc      no particular notes
# 		* driver   depends on xorgproto at least
# 		* font     don't install .pc file
# 		* lib      various dependencies, install .pc file, needs
# 		           pathfix
# 		* proto    install .pc file, needs pathfix, most only needed at
# 		           build time.
# 		* util     no particular notes
# 		* xserver  xorg x servers
#
# 		These categories has to match upstream categories.  Don't invent
# 		your own.
#
# 		builsystem is one of:
# 		* autotools (default)
# 		* meson (experimental)
#
#
# By defining USE_GITLAB and GL_COMMIT, it is possible to pull code straight
# from the freedesktop.org gitlab, instead of official release tarballs.
#
#.MAINTAINER:	x11@FreeBSD.org

.if !defined(_INCLUDE_USES_XORG_CAT_MK)
_INCLUDE_USES_XORG_CAT_MK=yes

_XORG_CATEGORIES=	app data doc driver font lib proto util xserver
_XORG_BUILDSYSTEMS=	autotools meson

_XORG_CAT=		# empty
_XORG_BUILDSYS=		# empty

.  if empty(xorg-cat_ARGS)
IGNORE=		no arguments specified to xorg-cat
.  endif

.  for _arg in ${xorg-cat_ARGS}
.    if ${_XORG_CATEGORIES:M${_arg}}
.      if empty(_XORG_CAT)
_XORG_CAT=	${_arg}
.      else
IGNORE=		multipe xorg categories specified via xorg-cat:${xorg-cat_ARGS:ts,}
.      endif
.    elif ${_XORG_BUILDSYSTEMS:M${_arg}}
.      if empty(_XORG_BUILDSYS)
_XORG_BUILDSYS=	${_arg}
.      else
IGNORE=		multipe xorg build systems specified via xorg-cat:${xorg-cat_ARGS:ts,}
.      endif
.    else
IGNORE=		unknown argument specified via xorg-cat:${xorg-cat_ARGS:ts,}
.    endif
.  endfor

# Default to the autotools build system
.  if empty(_XORG_BUILDSYS)
_XORG_BUILDSYS=		autotools
.  endif

# Default variables, common to all new modular xorg ports.
.  if empty(USES:Mtar)
EXTRACT_SUFX?=		.tar.bz2
.  endif

DIST_SUBDIR=	xorg/${_XORG_CAT}

.  if ${_XORG_BUILDSYS} == meson
IGNORE=		meson build not supported yet
.include "${USESDIR}/meson.mk"
.  elif ${_XORG_BUILDSYS} == autotools
GNU_CONFIGURE=		yes
.  else
# This should not happen
IGNORE=		unknown build system specified via xorg-cat:${xorg-cat_ARGS:ts,}
.  endif

.  if defined(USE_GITLAB)
# Set up things for fetching from freedesktop.org gitlab.
# This can be overridden using normal GL_* macros in the ports Makefile.
# We make a best guess for GL_ACCOUNT and GL_PROJECT.
GL_SITE?=		https://gitlab.freedesktop.org/xorg
GL_ACCOUNT?=		${_XORG_CAT}
GL_PROJECT?=		${PORTNAME:tl}
.    if ${_XORG_BUILDSYS} == meson
# set up meson stuff here
.    else
# Things from GL doesn't come with pre-generated configure, add dependency on
# autoreconf and run it, if we're using autotools.
.include "${USESDIR}/autoreconf.mk"
.    endif
.  else
MASTER_SITES?=		XORG/individual/${_XORG_CAT}
.  endif

#
## All xorg ports needs pkgconfig to build, but some ports look for pkgconfig
## and then continues the build.
.include "${USESDIR}/pkgconfig.mk"

#
## All xorg ports needs xorg-macros.
.  if ${PORTNAME} != xorg-macros
USE_XORG+=      xorg-macros
.  endif

.  if ${_XORG_CAT} == app
# Nothing at the moment

.  elif ${_XORG_CAT} == data
# Nothing at the moment.

.  elif ${_XORG_CAT} == driver
USE_XORG+=	xi xorg-server xorgproto
.    if ${_XORG_BUILDSYS} == meson
# Put special stuff for meson here
.    else
CONFIGURE_ENV+=	DRIVER_MAN_SUFFIX=4x DRIVER_MAN_DIR='$$(mandir)/man4'
libtool_ARGS?=	# empty
.include "${USESDIR}/libtool.mk"
INSTALL_TARGET=	install-strip
.    endif

.  elif ${_XORG_CAT} == font
FONTNAME?=	${PORTNAME:C/.*-//g:S/type/Type/:S/ttf/TTF/:S/speedo/Speedo/}
.    if ${_XORG_BUILDSYS} == meson
# Put special stuff for meson here
.    else
CONFIGURE_ARGS+=	--with-fontrootdir=${PREFIX}/share/fonts
CONFIGURE_ENV+=	FONTROOTDIR=${PREFIX}/share/fonts
.    endif
.    if !defined(NOFONT)
.include "${USESDIR}/fonts.mk"
BUILD_DEPENDS+=	mkfontscale>=0:x11-fonts/mkfontscale \
		bdftopcf:x11-fonts/bdftopcf
PLIST_FILES+=	"@comment ${FONTSDIR}/fonts.dir" \
		"@comment ${FONTSDIR}/fonts.scale"
.    endif

.  elif ${_XORG_CAT} == lib
.include "${USESDIR}/pathfix.mk"
.    if ${_XORG_BUILDSYS} == meson
# put meson stuff here
.    else
libtool_ARGS?=	# empty
.include "${USESDIR}/libtool.mk"
USE_LDCONFIG=	yes
CONFIGURE_ARGS+=--enable-malloc0returnsnull
.    endif

.  elif ${_XORG_CAT} == proto
.include "${USESDIR}/pathfix.mk"

.  elif ${_XORG_CAT} == xserver
DISTNAME?=	xorg-server-${PORTVERSION}
.include "${USESDIR}/pathfix.mk"
.    if ${_XORG_BUILDSYS} == meson
# put meson stuff here
.    else
CONFIGURE_ARGS+=	--with-xkb-path=${LOCALBASE}/share/X11/xkb \
			--with-fontrootdir=${LOCALBASE}/share/fonts
libtool_ARGS?=	# empty
.include "${USESDIR}/libtool.mk"
.    endif
LIB_PC_DEPENDS+=	${LOCALBASE}/libdata/pkgconfig/dri.pc:graphics/mesa-dri
USE_XORG+=	fontutil

.  endif # ${_XORG_CAT} == <category>

# We only need to include xorg.mk if we want USE_XORG modules
# USES+=xorg does not provide any functionality, it just silences an error
# message about USES=xorg not being set
.  if defined(USE_XORG) && !empty(USE_XORG)
USES+=		xorg
.include "${USESDIR}/xorg.mk"
.  endif

.endif