aboutsummaryrefslogtreecommitdiff
path: root/x11-servers/xorg-server/Makefile
blob: aecc5442cc9e892236ef67e80d11b8a41729490d (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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# Created by: Eric Anholt <anholt@FreeBSD.org>
# $FreeBSD$

PORTNAME?=	xorg-server
PORTVERSION=	${XORG_VERSION}
PORTREVISION?=	${XORG_REVISION}
PORTEPOCH?=	1
CATEGORIES=	x11-servers
MASTER_SITES=	XORG
MASTER_SITE_SUBDIR=	individual/xserver
DISTNAME=	xorg-server-${PORTVERSION}

MAINTAINER=	x11@FreeBSD.org
COMMENT?=	X.Org X server and related programs

LIB_DEPENDS=	libdrm.so:${PORTSDIR}/graphics/libdrm
RUN_DEPENDS=	xkeyboard-config>=2.5:${PORTSDIR}/x11/xkeyboard-config \
		xkbcomp:${PORTSDIR}/x11/xkbcomp

XORG_CAT=	xserver
SLAVE_PORT?=	no

OPTIONS_DEFINE=	AIGLX SUID
OPTIONS_RADIO=	CONF
OPTIONS_RADIO_CONF= HAL DEVD
AIGLX_DESC=	Compile with Accelerated Indirect GLX support
SUID_DESC=	Install the Xorg server with setuid bit set
HAL_DESC=	Compile with HAL config support
DEVD_DESC=	Use devd for autoconfiguration of input devices (experimental)
OPTIONS_DEFAULT=AIGLX SUID HAL

OPTIONS_EXCLUDE_sparc64=	HAL

.include <bsd.port.options.mk>

.if defined(WITH_NEW_XORG)
XORG_VERSION=	1.12.4
XORG_REVISION=	5
PLIST_SUB+=	OLD="@comment " NEW=""
EXTRA_PATCHES+=	${FILESDIR}/extra-clang \
		${FILESDIR}/extra-configure \
		${FILESDIR}/extra-new-dix_dixfonts.c
.else
XORG_VERSION=	1.7.7
XORG_REVISION=	12
PLIST_SUB+=	OLD="" NEW="@comment "
EXTRA_PATCHES+=	${FILESDIR}/extra-Xext-xace.c \
		${FILESDIR}/extra-Xserver-os-xprintf.c \
		${FILESDIR}/extra-include_eventstr.h \
		${FILESDIR}/extra-os-utils.c \
		${FILESDIR}/extra-dix_events.c \
		${FILESDIR}/extra-Xserver-hw-xfree86-common-xf86Config.c \
		${FILESDIR}/extra-old-dix_dixfonts.c
.endif

USE_BZIP2=	yes
USES=		gmake perl5 libtool
USE_PERL5=	build
USE_GL=		gl
USE_XORG?=	xf86driproto glproto xdmcp x11 xkbfile xxf86misc xxf86vm xaw7 \
		xmu xt xpm xext randrproto renderproto fixesproto damageproto \
		dri2proto xcmiscproto xextproto xproto xtrans xf86miscproto \
		xf86vidmodeproto xf86bigfontproto scrnsaverproto bigreqsproto \
		resourceproto fontsproto inputproto xf86dgaproto \
		videoproto compositeproto trapproto recordproto xineramaproto \
		xinerama evieproto xfont fontenc xkbui pixman pciaccess

USE_OPENSSL=	yes
CONFIGURE_ARGS?=--disable-dmx --disable-xvfb --disable-xnest \
		--without-xmlto --disable-docs --disable-devel-docs \
		--localstatedir=/var --without-dtrace --disable-xephyr \
		--enable-record=yes

.if ${SLAVE_PORT} == "no"
SUB_FILES=	pkg-install pkg-deinstall
.else
# for slave ports we need to overwrite PLIST, so it doesn't overwrite
# PLIST_FILES, with the masterport plist.
PLIST=		${.CURDIR}/pkg-plist
.endif

.include <bsd.port.pre.mk>

.if defined(WITH_OPENSSL_BASE)
# The reason why I use this is cause openssl from base doesn't install a .pc file
# and configure will fail trying to find it. Setting both of those variables to
# a *non-empty* value by-passes the pkg-config check.
CONFIGURE_ENV=	SHA1_LIB="-L/usr/lib -lcrypto" SHA1_CFLAGS="-I/usr/include"
.endif

.if ${PORT_OPTIONS:MHAL}
LIB_DEPENDS+=	libhal.so:${PORTSDIR}/sysutils/hal
CONFIGURE_ARGS+=	--enable-config-hal=yes
.else
CONFIGURE_ARGS+=	--enable-config-hal=no
.endif

.if ${PORT_OPTIONS:MDEVD}
EXTRA_PATCHES+=		${FILESDIR}/extra-config_devd.c
.endif

.if ${PORT_OPTIONS:MAIGLX}
CONFIGURE_ARGS+=	--enable-aiglx=yes
.else
CONFIGURE_ARGS+=	--enable-aiglx=no
.endif

.if ${PORT_OPTIONS:MSUID}
CONFIGURE_ARGS+=--enable-install-setuid=yes
PLIST_SUB+=	SUID=""
.else
CONFIGURE_ARGS+=--enable-install-setuid=no
PLIST_SUB+=	SUID="@comment "
.endif

.if ${ARCH} == i386
.if defined(WITH_NEW_XORG)
EXTRA_PATCHES+=	${FILESDIR}/extra-new-arch-i386
.else
EXTRA_PATCHES+=	${FILESDIR}/extra-old-arch-i386
.endif
.endif

.if ${ARCH} == ia64
PLIST_SUB+=	IA64_NA="@comment "
EXTRA_PATCHES=	${.CURDIR}/files/extra-arch-ia64
.else
PLIST_SUB+=	IA64_NA=""
.endif

.if ${ARCH} == powerpc || ${ARCH} == powerpc64
PLIST_SUB+=	PPC_NA="@comment "
.if defined(WITH_NEW_XORG)
EXTRA_PATCHES=	${.CURDIR}/files/extra-new-arch-powerpc
.else
EXTRA_PATCHES=	${.CURDIR}/files/extra-old-arch-powerpc
.endif
.else
PLIST_SUB+=	PPC_NA=""
.endif

.if ${ARCH} == sparc64
PLIST_SUB+=	SPARC64=""
PLIST_SUB+=	SPARC64_NA="@comment "
.if defined(WITH_NEW_XORG)
EXTRA_PATCHES+=	${FILESDIR}/extra-new-arch-sparc64
.else
EXTRA_PATCHES+=	${FILESDIR}/extra-old-arch-sparc64
.endif
.else
PLIST_SUB+=	SPARC64="@comment "
PLIST_SUB+=	SPARC64_NA=""
.endif

.if ${ARCH} == amd64 || ${ARCH} == i386 || ${ARCH} == sparc64
PLIST_SUB+=	AMD64_I386_SPARC64=""
.else
PLIST_SUB+=	AMD64_I386_SPARC64="@comment "
.endif

.if ${PORT_OPTIONS:MSUID}
pre-everything::
	@${ECHO_MSG} "By default, the X Server installs as a set-user-id root binary. When run by"
	@${ECHO_MSG} "a normal user, it checks arguments and environment as done in the x11/wrapper"
	@${ECHO_MSG} "port before handling them normally.  If you are concerned about the security"
	@${ECHO_MSG} "of this, but still want to run an X Server (for example using xdm/kdm/gdm,"
	@${ECHO_MSG} "which will still run the server as root), you can cancel the build and set"
	@${ECHO_MSG} "xorg-server_UNSET=SUID in /etc/make.conf."
.endif

post-patch:
	@${REINPLACE_CMD} 's/test.*-traditional.*;/true;/' \
		${WRKSRC}/configure
# build libglx.so but don't install it yet. which is done in pre-install.
	@${REINPLACE_CMD} -e 's|@GLX_TRUE@GLXMODS =|@GLX_BOGUS@GLXMODS =|g' \
		-e 's|^LTLIBRARIES = |LTLIBRARIES = libglx.la |g' \
		${WRKSRC}/hw/xfree86/dixmods/Makefile.in
.if ${PORT_OPTIONS:MDEVD}
	@${ECHO_CMD} -e "\nint config_devd_init(void);\nvoid config_devd_fini(void);" \
		>> ${WRKSRC}/config/config-backends.h
.endif
 
post-configure:
.if ${PORT_OPTIONS:MDEVD}
	@${REINPLACE_CMD} -e 's|config\.c|config.c devd.c|g' \
		-e 's|config\.lo|config.lo devd.lo|g' \
		${WRKSRC}/config/Makefile
.endif

.if ${SLAVE_PORT} == "no"
post-install:
# The .xorg dir because else the xorg-server might not load the correct 
# libglx module.
	${MKDIR} ${STAGEDIR}${PREFIX}/lib/xorg/modules/extensions/.xorg
	${INSTALL_LIB} ${WRKSRC}/hw/xfree86/dixmods/.libs/libglx.so \
		${STAGEDIR}${PREFIX}/lib/xorg/modules/extensions/.xorg/
	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/xorg/modules/*.so
.if !defined(WITH_NEW_XORG)
	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/xorg/modules/extensions/*.so
.endif
	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/xorg/modules/multimedia/*.so

.if defined(WITH_NEW_XORG)
	@${MKDIR} ${STAGEDIR}${PREFIX}/etc/X11/xorg.conf.d
.endif
.endif # ! SLAVE_PORT

.include <bsd.port.post.mk>