x11-base/xorg-server: +elogind defaults, relax REQUIRED_USE.
[gentoo.git] / x11-base / xorg-server / xorg-server-1.20.4.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 XORG_DOC=doc
7 XORG_EAUTORECONF="yes"
8 inherit xorg-3 multilib flag-o-matic
9 EGIT_REPO_URI="https://anongit.freedesktop.org/git/xorg/xserver.git"
10
11 DESCRIPTION="X.Org X servers"
12 SLOT="0/${PV}"
13 if [[ ${PV} != 9999* ]]; then
14         KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
15 fi
16
17 IUSE_SERVERS="dmx kdrive wayland xephyr xnest xorg xvfb"
18 IUSE="${IUSE_SERVERS} debug +elogind +glamor ipv6 libressl minimal selinux suid systemd +udev unwind xcsecurity"
19
20 CDEPEND=">=app-eselect/eselect-opengl-1.3.0
21         !libressl? ( dev-libs/openssl:0= )
22         libressl? ( dev-libs/libressl:0= )
23         >=x11-apps/iceauth-1.0.2
24         >=x11-apps/rgb-1.0.3
25         >=x11-apps/xauth-1.0.3
26         x11-apps/xkbcomp
27         >=x11-libs/libdrm-2.4.89
28         >=x11-libs/libpciaccess-0.12.901
29         >=x11-libs/libXau-1.0.4
30         >=x11-libs/libXdmcp-1.0.2
31         >=x11-libs/libXfont2-2.0.1
32         >=x11-libs/libxkbfile-1.0.4
33         >=x11-libs/libxshmfence-1.1
34         >=x11-libs/pixman-0.27.2
35         >=x11-libs/xtrans-1.3.5
36         >=x11-misc/xbitmaps-1.0.1
37         >=x11-misc/xkeyboard-config-2.4.1-r3
38         dmx? (
39                 x11-libs/libXt
40                 >=x11-libs/libdmx-1.0.99.1
41                 >=x11-libs/libX11-1.1.5
42                 >=x11-libs/libXaw-1.0.4
43                 >=x11-libs/libXext-1.0.99.4
44                 >=x11-libs/libXfixes-5.0
45                 >=x11-libs/libXi-1.2.99.1
46                 >=x11-libs/libXmu-1.0.3
47                 x11-libs/libXrender
48                 >=x11-libs/libXres-1.0.3
49                 >=x11-libs/libXtst-1.0.99.2
50         )
51         glamor? (
52                 media-libs/libepoxy[X]
53                 >=media-libs/mesa-18[egl,gbm]
54                 !x11-libs/glamor
55         )
56         kdrive? (
57                 >=x11-libs/libXext-1.0.5
58                 x11-libs/libXv
59         )
60         xephyr? (
61                 x11-libs/libxcb[xkb]
62                 x11-libs/xcb-util
63                 x11-libs/xcb-util-image
64                 x11-libs/xcb-util-keysyms
65                 x11-libs/xcb-util-renderutil
66                 x11-libs/xcb-util-wm
67         )
68         !minimal? (
69                 >=x11-libs/libX11-1.1.5
70                 >=x11-libs/libXext-1.0.5
71                 >=media-libs/mesa-18
72         )
73         udev? ( virtual/libudev:= )
74         unwind? ( sys-libs/libunwind )
75         wayland? (
76                 >=dev-libs/wayland-1.3.0
77                 media-libs/libepoxy
78                 >=dev-libs/wayland-protocols-1.1
79         )
80         >=x11-apps/xinit-1.3.3-r1
81         systemd? (
82                 sys-apps/dbus
83                 sys-apps/systemd
84         )
85         elogind? (
86                 sys-apps/dbus
87                 sys-auth/elogind
88                 sys-auth/pambase[elogind]
89         )
90         "
91
92 DEPEND="${CDEPEND}
93         sys-devel/flex
94         >=x11-base/xorg-proto-2018.3
95         dmx? (
96                 doc? (
97                         || (
98                                 www-client/links
99                                 www-client/lynx
100                                 www-client/w3m
101                         )
102                 )
103         )"
104
105 RDEPEND="${CDEPEND}
106         selinux? ( sec-policy/selinux-xserver )
107         !x11-drivers/xf86-video-modesetting
108 "
109
110 PDEPEND="
111         xorg? ( >=x11-base/xorg-drivers-$(ver_cut 1-2) )"
112
113 REQUIRED_USE="!minimal? (
114                 || ( ${IUSE_SERVERS} )
115         )
116         elogind? ( udev )
117         ?? ( elogind systemd )
118         minimal? ( !glamor !wayland )
119         xephyr? ( kdrive )"
120
121 UPSTREAMED_PATCHES=(
122         "${FILESDIR}"/${P}-shm-reindent-shm_tmpfile-to-follow-our-standards.patch
123         "${FILESDIR}"/${P}-shm-Pick-the-shm-dir-at-run-time-not-build-time.patch
124         "${FILESDIR}"/${P}-shm-Use-memfd_create-when-possible.patch
125 )
126
127 PATCHES=(
128         "${UPSTREAMED_PATCHES[@]}"
129         "${FILESDIR}"/${PN}-1.12-unloadsubmodule.patch
130         # needed for new eselect-opengl, bug #541232
131         "${FILESDIR}"/${PN}-1.18-support-multiple-Files-sections.patch
132 )
133
134 pkg_setup() {
135         if use wayland && ! use glamor; then
136                 ewarn "glamor is necessary for acceleration under Xwayland."
137                 ewarn "Performance may be unacceptable without it."
138         fi
139
140         # localstatedir is used for the log location; we need to override the default
141         #       from ebuild.sh
142         # sysconfdir is used for the xorg.conf location; same applies
143         # NOTE: fop is used for doc generating; and I have no idea if Gentoo
144         #       package it somewhere
145         XORG_CONFIGURE_OPTIONS=(
146                 $(use_enable ipv6)
147                 $(use_enable debug)
148                 $(use_enable dmx)
149                 $(use_enable glamor)
150                 $(use_enable kdrive)
151                 $(use_enable unwind libunwind)
152                 $(use_enable wayland xwayland)
153                 $(use_enable !minimal record)
154                 $(use_enable !minimal xfree86-utils)
155                 $(use_enable !minimal dri)
156                 $(use_enable !minimal dri2)
157                 $(use_enable !minimal dri3)
158                 $(use_enable !minimal glx)
159                 $(use_enable xcsecurity)
160                 $(use_enable xephyr)
161                 $(use_enable xnest)
162                 $(use_enable xorg)
163                 $(use_enable xvfb)
164                 $(use_enable udev config-udev)
165                 $(use_with doc doxygen)
166                 $(use_with doc xmlto)
167                 $(usex !elogind $(use_enable systemd systemd-logind) '--enable-systemd-logind')
168                 $(use_with systemd systemd-daemon)
169                 $(usex suid $(use_enable systemd suid-wrapper) '--disable-suid-wrapper')
170                 $(usex suid $(use_enable !systemd install-setuid) '--disable-install-setuid')
171                 --enable-libdrm
172                 --sysconfdir="${EPREFIX}"/etc/X11
173                 --localstatedir="${EPREFIX}"/var
174                 --with-fontrootdir="${EPREFIX}"/usr/share/fonts
175                 --with-xkb-output="${EPREFIX}"/var/lib/xkb
176                 --disable-config-hal
177                 --disable-linux-acpi
178                 --without-dtrace
179                 --without-fop
180                 --with-os-vendor=Gentoo
181                 --with-sha1=libcrypto
182         )
183 }
184
185 src_install() {
186         xorg-3_src_install
187
188         server_based_install
189
190         if ! use minimal && use xorg; then
191                 # Install xorg.conf.example into docs
192                 dodoc "${S}"/hw/xfree86/xorg.conf.example
193         fi
194
195         newinitd "${FILESDIR}"/xdm-setup.initd-1 xdm-setup
196         newinitd "${FILESDIR}"/xdm.initd-11 xdm
197         newconfd "${FILESDIR}"/xdm.confd-4 xdm
198
199         # install the @x11-module-rebuild set for Portage
200         insinto /usr/share/portage/config/sets
201         newins "${FILESDIR}"/xorg-sets.conf xorg.conf
202
203         find "${ED}"/var -type d -empty -delete || die
204 }
205
206 pkg_postinst() {
207         if ! use minimal; then
208                 # sets up libGL and DRI2 symlinks if needed (ie, on a fresh install)
209                 eselect opengl set xorg-x11 --use-old
210         fi
211 }
212
213 pkg_postrm() {
214         # Get rid of module dir to ensure opengl-update works properly
215         if [[ -z ${REPLACED_BY_VERSION} && -e ${EROOT}/usr/$(get_libdir)/xorg/modules ]]; then
216                 rm -rf "${EROOT}"/usr/$(get_libdir)/xorg/modules
217         fi
218 }
219
220 server_based_install() {
221         if ! use xorg; then
222                 rm "${ED}"/usr/share/man/man1/Xserver.1x \
223                         "${ED}"/usr/$(get_libdir)/xserver/SecurityPolicy \
224                         "${ED}"/usr/$(get_libdir)/pkgconfig/xorg-server.pc \
225                         "${ED}"/usr/share/man/man1/Xserver.1x
226         fi
227 }