]> git.draconx.ca Git - gentoo-draconx.git/blob - x11-base/xorg-server/xorg-server-9999.ebuild
xorg-server: Add live ebuild.
[gentoo-draconx.git] / x11-base / xorg-server / xorg-server-9999.ebuild
1 # Copyright 1999-2009 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI=3
6 inherit xorg-2 multilib versionator
7
8 EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/xserver"
9
10 OPENGL_DIR="xorg-x11"
11
12 DESCRIPTION="X.Org X servers"
13 KEYWORDS=""
14
15 IUSE_SERVERS="dmx kdrive xorg"
16 IUSE="${IUSE_SERVERS} doc tslib ipv6 minimal nptl +udev"
17 RDEPEND=">=app-admin/eselect-opengl-1.0.8
18         dev-libs/openssl
19         media-libs/freetype
20         >=x11-apps/iceauth-1.0.2
21         >=x11-apps/rgb-1.0.3
22         >=x11-apps/xauth-1.0.3
23         x11-apps/xkbcomp
24         >=x11-libs/libpciaccess-0.10.3
25         >=x11-libs/libXau-1.0.4
26         >=x11-libs/libXdmcp-1.0.2
27         >=x11-libs/libXfont-1.3.3
28         >=x11-libs/libxkbfile-1.0.4
29         >=x11-libs/pixman-0.15.20
30         >=x11-libs/xtrans-1.2.2
31         >=x11-misc/xbitmaps-1.0.1
32         >=x11-misc/xkeyboard-config-1.4
33         dmx? (
34                 x11-libs/libXt
35                 >=x11-libs/libdmx-1.0.99.1
36                 >=x11-libs/libX11-1.1.5
37                 >=x11-libs/libXaw-1.0.4
38                 >=x11-libs/libXext-1.0.5
39                 >=x11-libs/libXfixes-4.0.3
40                 >=x11-libs/libXi-1.2.99.1
41                 >=x11-libs/libXmu-1.0.3
42                 >=x11-libs/libXres-1.0.3
43                 >=x11-libs/libXtst-1.0.3
44         )
45         kdrive? (
46                 >=x11-libs/libXext-1.0.5
47         )
48         !minimal? (
49                 >=x11-libs/libX11-1.1.5
50                 >=x11-libs/libXext-1.0.5
51                 >=media-libs/mesa-7.8_rc[nptl=]
52         )
53         tslib? ( >=x11-libs/tslib-1.0 x11-proto/xcalibrateproto )
54         udev? ( sys-fs/udev )"
55
56 DEPEND="${RDEPEND}
57         !!net-dialup/dtrace
58         sys-devel/flex
59         >=x11-proto/bigreqsproto-1.1.0
60         >=x11-proto/compositeproto-0.4
61         >=x11-proto/damageproto-1.1
62         >=x11-proto/fixesproto-4.1
63         >=x11-proto/fontsproto-2.0.2
64         >=x11-proto/glproto-1.4.11
65         >=x11-proto/inputproto-1.9.99.902
66         >=x11-proto/kbproto-1.0.3
67         >=x11-proto/randrproto-1.2.99.3
68         >=x11-proto/recordproto-1.13.99.1
69         >=x11-proto/renderproto-0.11
70         >=x11-proto/resourceproto-1.0.2
71         >=x11-proto/scrnsaverproto-1.1
72         >=x11-proto/trapproto-3.4.3
73         >=x11-proto/videoproto-2.2.2
74         >=x11-proto/xcmiscproto-1.2.0
75         >=x11-proto/xextproto-7.0.99.3
76         >=x11-proto/xf86dgaproto-2.0.99.1
77         >=x11-proto/xf86rushproto-1.1.2
78         >=x11-proto/xf86vidmodeproto-2.2.99.1
79         >=x11-proto/xineramaproto-1.1.3
80         >=x11-proto/xproto-7.0.13
81         dmx? ( >=x11-proto/dmxproto-2.2.99.1 )
82         doc? ( app-doc/doxygen )
83         !minimal? (
84                 >=x11-proto/xf86driproto-2.1.0
85                 >=x11-proto/dri2proto-2.1
86                 >=x11-libs/libdrm-2.3.0
87         )"
88
89 PDEPEND="
90         >=x11-apps/xinit-1.2.1-r1"
91
92 EPATCH_FORCE="yes"
93 EPATCH_SUFFIX="patch"
94
95 # These have been sent upstream
96 #UPSTREAMED_PATCHES=(
97 #       "${WORKDIR}/patches/"
98 #       )
99
100 PATCHES=(
101         "${UPSTREAMED_PATCHES[@]}"
102         "${FILESDIR}"/${PN}-disable-acpi.patch
103         )
104
105 pkg_setup() {
106         xorg-2_pkg_setup
107
108         use minimal || ensure_a_server_is_building
109
110         # localstatedir is used for the log location; we need to override the default
111         # from ebuild.sh
112         # sysconfdir is used for the xorg.conf location; same applies
113         # --enable-install-setuid needed because sparcs default off
114         CONFIGURE_OPTIONS="
115                 $(use_enable ipv6)
116                 $(use_enable dmx)
117                 $(use_enable kdrive)
118                 $(use_enable tslib)
119                 $(use_enable tslib xcalibrate)
120                 $(use_enable !minimal xvfb)
121                 $(use_enable !minimal xnest)
122                 $(use_enable !minimal record)
123                 $(use_enable !minimal xfree86-utils)
124                 $(use_enable !minimal install-libxf86config)
125                 $(use_enable !minimal dri)
126                 $(use_enable !minimal dri2)
127                 $(use_enable !minimal glx)
128                 $(use_enable xorg)
129                 $(use_enable nptl glx-tls)
130                 $(use_enable udev config-udev)
131                 $(use_with doc doxygen)
132                 --sysconfdir=/etc/X11
133                 --localstatedir=/var
134                 --enable-install-setuid
135                 --with-fontrootdir=/usr/share/fonts
136                 --with-xkb-output=/var/lib/xkb
137                 --disable-config-hal
138                 --without-dtrace
139                 --with-os-vendor=Gentoo
140                 ${conf_opts}"
141
142         # (#121394) Causes window corruption
143         filter-flags -fweb
144
145         # Incompatible with GCC 3.x SSP on x86, bug #244352
146         if use x86 ; then
147                 if [[ $(gcc-major-version) -lt 4 ]]; then
148                         filter-flags -fstack-protector
149                 fi
150         fi
151
152         # Incompatible with GCC 3.x CPP, bug #314615
153         if [[ $(gcc-major-version) -lt 4 ]]; then
154                 ewarn "GCC 3.x C preprocessor may cause build failures. Use GCC 4.x"
155                 ewarn "or set CPP=cpp-4.3.4 (replace with the actual installed version)"
156         fi
157
158         # detect if we should inform user about ebuild breakage
159         if ! has_version "x11-base/xorg-server" ||
160                         has_version "<x11-base/xorg-server-$(get_version_component_range 1-2)"; then
161                 INFO="yes"
162         fi
163 }
164
165 src_configure() {
166         # this is required only for configure and build time
167         # we need to ensure having enough glxtokens
168         # the subshell is needed so the addwrite is not shared in rest of that phase
169         OLD_IMPLEM="$(eselect opengl show)"
170         [[ ${OLD_IMPLEM} != ${OPENGL_DIR} ]] && ( addwrite "${ROOT}"; eselect opengl set ${OPENGL_DIR}; )
171         xorg-2_src_configure
172 }
173
174 src_compile() {
175         emake # no die here intentional
176         if [[ $? != 0 ]]; then
177                 [[ ${OLD_IMPLEM} != ${OPENGL_DIR} ]] && ( addwrite "${ROOT}"; eselect opengl set ${OLD_IMPLEM}; )
178                 die "Compilation failed"
179         fi
180         [[ ${OLD_IMPLEM} != ${OPENGL_DIR} ]] && ( addwrite "${ROOT}"; eselect opengl set ${OLD_IMPLEM}; )
181 }
182
183 src_install() {
184         xorg-2_src_install
185
186         dynamic_libgl_install
187
188         server_based_install
189
190         if ! use minimal &&     use xorg; then
191                 # Install xorg.conf.example into docs
192                 dodoc hw/xfree86/xorg.conf.example \
193                         || die "couldn't install xorg.conf.example"
194         fi
195
196         # install the xdm.init
197         cp "${FILESDIR}"/xdm.initd "${T}"
198         sed -i \
199                 -e "/@HALD_DEPEND@/ d" \
200                 "${T}"/xdm.initd \
201                 || die "sed failed"
202         newinitd "${T}"/xdm.initd xdm || die "initd file install failed"
203         newinitd "${FILESDIR}"/xdm-setup.initd-1 xdm-setup || die
204         newconfd "${FILESDIR}"/xdm.confd-3 xdm || die
205 }
206
207 pkg_postinst() {
208         if [[ ${INFO} = yes ]]; then
209                 einfo "You should consider reading upgrade guide for this release:"
210                 einfo " http://www.gentoo.org/proj/en/desktop/x/x11/xorg-server-$(get_version_component_range 1-2)-upgrade-guide.xml"
211                 echo
212                 ewarn "You must rebuild all drivers if upgrading from <xorg-server-$(get_version_component_range 1-2)"
213                 ewarn "because the ABI changed. If you cannot start X because"
214                 ewarn "of module version mismatch errors, this is your problem."
215
216                 echo
217                 ewarn "You can generate a list of all installed packages in the x11-drivers"
218                 ewarn "category using this command:"
219                 ewarn " emerge portage-utils; qlist -I -C x11-drivers/"
220         fi
221 }
222
223 pkg_postrm() {
224         # Get rid of module dir to ensure opengl-update works properly
225         if ! has_version x11-base/xorg-server; then
226                 if [[ -e ${ROOT}/usr/$(get_libdir)/xorg/modules ]]; then
227                         rm -rf "${ROOT}"/usr/$(get_libdir)/xorg/modules
228                 fi
229         fi
230 }
231
232 dynamic_libgl_install() {
233         # next section is to setup the dynamic libGL stuff
234         ebegin "Moving GL files for dynamic switching"
235                 dodir /usr/$(get_libdir)/opengl/${OPENGL_DIR}/extensions
236                 local x=""
237                 for x in "${D}"/usr/$(get_libdir)/xorg/modules/extensions/lib{glx,dri,dri2}*; do
238                         if [ -f ${x} -o -L ${x} ]; then
239                                 mv -f ${x} "${D}"/usr/$(get_libdir)/opengl/${OPENGL_DIR}/extensions
240                         fi
241                 done
242         eend 0
243 }
244
245 server_based_install() {
246         if ! use xorg; then
247                 rm "${D}"/usr/share/man/man1/Xserver.1x \
248                         "${D}"/usr/$(get_libdir)/xserver/SecurityPolicy \
249                         "${D}"/usr/$(get_libdir)/pkgconfig/xorg-server.pc \
250                         "${D}"/usr/share/man/man1/Xserver.1x
251         fi
252 }
253
254 ensure_a_server_is_building() {
255         for server in ${IUSE_SERVERS}; do
256                 use ${server} && return;
257         done
258         eerror "You need to specify at least one server to build."
259         eerror "Valid servers are: ${IUSE_SERVERS}."
260         die "No servers were specified to build."
261 }