1 |
chithanh |
1.60 |
# Copyright 1999-2013 Gentoo Foundation |
2 |
scarabeus |
1.1 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
mgorny |
1.61 |
# $Header: /var/cvsroot/gentoo-x86/eclass/xorg-2.eclass,v 1.60 2013/01/31 14:12:12 chithanh Exp $ |
4 |
vapier |
1.47 |
|
5 |
scarabeus |
1.1 |
# @ECLASS: xorg-2.eclass |
6 |
|
|
# @MAINTAINER: |
7 |
|
|
# x11@gentoo.org |
8 |
vapier |
1.47 |
# @AUTHOR: |
9 |
|
|
# Author: Tomáš Chvátal <scarabeus@gentoo.org> |
10 |
|
|
# Author: Donnie Berkholz <dberkholz@gentoo.org> |
11 |
scarabeus |
1.1 |
# @BLURB: Reduces code duplication in the modularized X11 ebuilds. |
12 |
|
|
# @DESCRIPTION: |
13 |
|
|
# This eclass makes trivial X ebuilds possible for apps, fonts, drivers, |
14 |
|
|
# and more. Many things that would normally be done in various functions |
15 |
|
|
# can be accessed by setting variables instead, such as patching, |
16 |
|
|
# running eautoreconf, passing options to configure and installing docs. |
17 |
|
|
# |
18 |
|
|
# All you need to do in a basic ebuild is inherit this eclass and set |
19 |
|
|
# DESCRIPTION, KEYWORDS and RDEPEND/DEPEND. If your package is hosted |
20 |
|
|
# with the other X packages, you don't need to set SRC_URI. Pretty much |
21 |
|
|
# everything else should be automatic. |
22 |
|
|
|
23 |
|
|
GIT_ECLASS="" |
24 |
|
|
if [[ ${PV} == *9999* ]]; then |
25 |
mgorny |
1.41 |
GIT_ECLASS="git-2" |
26 |
scarabeus |
1.1 |
XORG_EAUTORECONF="yes" |
27 |
|
|
fi |
28 |
|
|
|
29 |
|
|
# If we're a font package, but not the font.alias one |
30 |
|
|
FONT_ECLASS="" |
31 |
|
|
if [[ ${PN} == font* \ |
32 |
|
|
&& ${CATEGORY} = media-fonts \ |
33 |
|
|
&& ${PN} != font-alias \ |
34 |
|
|
&& ${PN} != font-util ]]; then |
35 |
|
|
# Activate font code in the rest of the eclass |
36 |
|
|
FONT="yes" |
37 |
|
|
FONT_ECLASS="font" |
38 |
|
|
fi |
39 |
|
|
|
40 |
mgorny |
1.61 |
# @ECLASS-VARIABLE: XORG_MULTILIB |
41 |
|
|
# @DESCRIPTION: |
42 |
|
|
# If set to 'yes', the multilib support for package will be enabled. Set |
43 |
|
|
# before inheriting this eclass. |
44 |
|
|
: ${XORG_MULTILIB:="no"} |
45 |
|
|
|
46 |
mgorny |
1.52 |
# we need to inherit autotools first to get the deps |
47 |
|
|
inherit autotools autotools-utils eutils libtool multilib toolchain-funcs \ |
48 |
|
|
flag-o-matic ${FONT_ECLASS} ${GIT_ECLASS} |
49 |
scarabeus |
1.1 |
|
50 |
mgorny |
1.61 |
if [[ ${XORG_MULTILIB} == yes ]]; then |
51 |
|
|
inherit autotools-multilib |
52 |
|
|
fi |
53 |
|
|
|
54 |
scarabeus |
1.1 |
EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_postinst pkg_postrm" |
55 |
|
|
case "${EAPI:-0}" in |
56 |
axs |
1.59 |
3|4|5) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure" ;; |
57 |
scarabeus |
1.39 |
*) die "EAPI=${EAPI} is not supported" ;; |
58 |
scarabeus |
1.1 |
esac |
59 |
|
|
|
60 |
|
|
# exports must be ALWAYS after inherit |
61 |
|
|
EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS} |
62 |
|
|
|
63 |
|
|
IUSE="" |
64 |
|
|
HOMEPAGE="http://xorg.freedesktop.org/" |
65 |
|
|
|
66 |
|
|
# @ECLASS-VARIABLE: XORG_EAUTORECONF |
67 |
|
|
# @DESCRIPTION: |
68 |
|
|
# If set to 'yes' and configure.ac exists, eautoreconf will run. Set |
69 |
|
|
# before inheriting this eclass. |
70 |
|
|
: ${XORG_EAUTORECONF:="no"} |
71 |
|
|
|
72 |
scarabeus |
1.31 |
# @ECLASS-VARIABLE: XORG_BASE_INDIVIDUAL_URI |
73 |
flameeyes |
1.28 |
# @DESCRIPTION: |
74 |
|
|
# Set up SRC_URI for individual modular releases. If set to an empty |
75 |
|
|
# string, no SRC_URI will be provided by the eclass. |
76 |
scarabeus |
1.31 |
: ${XORG_BASE_INDIVIDUAL_URI="http://xorg.freedesktop.org/releases/individual"} |
77 |
flameeyes |
1.28 |
|
78 |
scarabeus |
1.31 |
# @ECLASS-VARIABLE: XORG_MODULE |
79 |
scarabeus |
1.1 |
# @DESCRIPTION: |
80 |
|
|
# The subdirectory to download source from. Possible settings are app, |
81 |
|
|
# doc, data, util, driver, font, lib, proto, xserver. Set above the |
82 |
|
|
# inherit to override the default autoconfigured module. |
83 |
scarabeus |
1.31 |
if [[ -z ${XORG_MODULE} ]]; then |
84 |
scarabeus |
1.1 |
case ${CATEGORY} in |
85 |
scarabeus |
1.31 |
app-doc) XORG_MODULE=doc/ ;; |
86 |
|
|
media-fonts) XORG_MODULE=font/ ;; |
87 |
|
|
x11-apps|x11-wm) XORG_MODULE=app/ ;; |
88 |
|
|
x11-misc|x11-themes) XORG_MODULE=util/ ;; |
89 |
|
|
x11-base) XORG_MODULE=xserver/ ;; |
90 |
|
|
x11-drivers) XORG_MODULE=driver/ ;; |
91 |
|
|
x11-proto) XORG_MODULE=proto/ ;; |
92 |
|
|
x11-libs) XORG_MODULE=lib/ ;; |
93 |
|
|
*) XORG_MODULE= ;; |
94 |
scarabeus |
1.1 |
esac |
95 |
|
|
fi |
96 |
|
|
|
97 |
scarabeus |
1.31 |
# @ECLASS-VARIABLE: XORG_PACKAGE_NAME |
98 |
scarabeus |
1.20 |
# @DESCRIPTION: |
99 |
mgorny |
1.24 |
# For git checkout the git repository might differ from package name. |
100 |
scarabeus |
1.21 |
# This variable can be used for proper directory specification |
101 |
scarabeus |
1.31 |
: ${XORG_PACKAGE_NAME:=${PN}} |
102 |
scarabeus |
1.20 |
|
103 |
scarabeus |
1.1 |
if [[ -n ${GIT_ECLASS} ]]; then |
104 |
mattst88 |
1.55 |
: ${EGIT_REPO_URI:="git://anongit.freedesktop.org/xorg/${XORG_MODULE}${XORG_PACKAGE_NAME} http://anongit.freedesktop.org/git/xorg/${XORG_MODULE}${XORG_PACKAGE_NAME}"} |
105 |
scarabeus |
1.31 |
elif [[ -n ${XORG_BASE_INDIVIDUAL_URI} ]]; then |
106 |
|
|
SRC_URI="${XORG_BASE_INDIVIDUAL_URI}/${XORG_MODULE}${P}.tar.bz2" |
107 |
scarabeus |
1.1 |
fi |
108 |
|
|
|
109 |
|
|
: ${SLOT:=0} |
110 |
|
|
|
111 |
|
|
# Set the license for the package. This can be overridden by setting |
112 |
|
|
# LICENSE after the inherit. Nearly all FreeDesktop-hosted X packages |
113 |
|
|
# are under the MIT license. (This is what Red Hat does in their rpms) |
114 |
scarabeus |
1.2 |
: ${LICENSE:=MIT} |
115 |
scarabeus |
1.1 |
|
116 |
scarabeus |
1.19 |
# Set up autotools shared dependencies |
117 |
|
|
# Remember that all versions here MUST be stable |
118 |
|
|
XORG_EAUTORECONF_ARCHES="x86-interix ppc-aix x86-winnt" |
119 |
|
|
EAUTORECONF_DEPEND+=" |
120 |
|
|
>=sys-devel/libtool-2.2.6a |
121 |
|
|
sys-devel/m4" |
122 |
|
|
if [[ ${PN} != util-macros ]] ; then |
123 |
chithanh |
1.54 |
EAUTORECONF_DEPEND+=" >=x11-misc/util-macros-1.17" |
124 |
scarabeus |
1.19 |
# Required even by xorg-server |
125 |
scarabeus |
1.35 |
[[ ${PN} == "font-util" ]] || EAUTORECONF_DEPEND+=" >=media-fonts/font-util-1.2.0" |
126 |
scarabeus |
1.1 |
fi |
127 |
scarabeus |
1.19 |
WANT_AUTOCONF="latest" |
128 |
|
|
WANT_AUTOMAKE="latest" |
129 |
|
|
for arch in ${XORG_EAUTORECONF_ARCHES}; do |
130 |
|
|
EAUTORECONF_DEPENDS+=" ${arch}? ( ${EAUTORECONF_DEPEND} )" |
131 |
|
|
done |
132 |
|
|
DEPEND+=" ${EAUTORECONF_DEPENDS}" |
133 |
|
|
[[ ${XORG_EAUTORECONF} != no ]] && DEPEND+=" ${EAUTORECONF_DEPEND}" |
134 |
|
|
unset EAUTORECONF_DEPENDS |
135 |
|
|
unset EAUTORECONF_DEPEND |
136 |
scarabeus |
1.1 |
|
137 |
|
|
if [[ ${FONT} == yes ]]; then |
138 |
|
|
RDEPEND+=" media-fonts/encodings |
139 |
|
|
x11-apps/mkfontscale |
140 |
|
|
x11-apps/mkfontdir" |
141 |
|
|
PDEPEND+=" media-fonts/font-alias" |
142 |
scarabeus |
1.35 |
DEPEND+=" >=media-fonts/font-util-1.2.0" |
143 |
scarabeus |
1.1 |
|
144 |
|
|
# @ECLASS-VARIABLE: FONT_DIR |
145 |
|
|
# @DESCRIPTION: |
146 |
|
|
# If you're creating a font package and the suffix of PN is not equal to |
147 |
|
|
# the subdirectory of /usr/share/fonts/ it should install into, set |
148 |
|
|
# FONT_DIR to that directory or directories. Set before inheriting this |
149 |
|
|
# eclass. |
150 |
|
|
[[ -z ${FONT_DIR} ]] && FONT_DIR=${PN##*-} |
151 |
|
|
|
152 |
|
|
# Fix case of font directories |
153 |
|
|
FONT_DIR=${FONT_DIR/ttf/TTF} |
154 |
|
|
FONT_DIR=${FONT_DIR/otf/OTF} |
155 |
|
|
FONT_DIR=${FONT_DIR/type1/Type1} |
156 |
|
|
FONT_DIR=${FONT_DIR/speedo/Speedo} |
157 |
|
|
|
158 |
|
|
# Set up configure options, wrapped so ebuilds can override if need be |
159 |
|
|
[[ -z ${FONT_OPTIONS} ]] && FONT_OPTIONS="--with-fontdir=\"${EPREFIX}/usr/share/fonts/${FONT_DIR}\"" |
160 |
|
|
|
161 |
|
|
[[ ${PN##*-} = misc || ${PN##*-} = 75dpi || ${PN##*-} = 100dpi || ${PN##*-} = cyrillic ]] && IUSE+=" nls" |
162 |
|
|
fi |
163 |
|
|
|
164 |
|
|
# If we're a driver package, then enable DRIVER case |
165 |
|
|
[[ ${PN} == xf86-video-* || ${PN} == xf86-input-* ]] && DRIVER="yes" |
166 |
|
|
|
167 |
scarabeus |
1.2 |
# @ECLASS-VARIABLE: XORG_STATIC |
168 |
|
|
# @DESCRIPTION: |
169 |
|
|
# Enables static-libs useflag. Set to no, if your package gets: |
170 |
|
|
# |
171 |
|
|
# QA: configure: WARNING: unrecognized options: --disable-static |
172 |
|
|
: ${XORG_STATIC:="yes"} |
173 |
|
|
|
174 |
scarabeus |
1.1 |
# Add static-libs useflag where usefull. |
175 |
scarabeus |
1.2 |
if [[ ${XORG_STATIC} == yes \ |
176 |
|
|
&& ${FONT} != yes \ |
177 |
scarabeus |
1.1 |
&& ${CATEGORY} != app-doc \ |
178 |
scarabeus |
1.18 |
&& ${CATEGORY} != x11-apps \ |
179 |
scarabeus |
1.1 |
&& ${CATEGORY} != x11-proto \ |
180 |
|
|
&& ${CATEGORY} != x11-drivers \ |
181 |
|
|
&& ${CATEGORY} != media-fonts \ |
182 |
|
|
&& ${PN} != util-macros \ |
183 |
|
|
&& ${PN} != xbitmaps \ |
184 |
|
|
&& ${PN} != xorg-cf-files \ |
185 |
|
|
&& ${PN/xcursor} = ${PN} ]]; then |
186 |
|
|
IUSE+=" static-libs" |
187 |
|
|
fi |
188 |
|
|
|
189 |
jdhore |
1.53 |
DEPEND+=" virtual/pkgconfig" |
190 |
scarabeus |
1.1 |
|
191 |
scarabeus |
1.31 |
# @ECLASS-VARIABLE: XORG_DRI |
192 |
|
|
# @DESCRIPTION: |
193 |
|
|
# Possible values are "always" or the value of the useflag DRI capabilities |
194 |
|
|
# are required for. Default value is "no" |
195 |
|
|
# |
196 |
|
|
# Eg. XORG_DRI="opengl" will pull all dri dependant deps for opengl useflag |
197 |
|
|
: ${XORG_DRI:="no"} |
198 |
|
|
|
199 |
|
|
DRI_COMMON_DEPEND=" |
200 |
|
|
x11-base/xorg-server[-minimal] |
201 |
|
|
x11-libs/libdrm |
202 |
|
|
" |
203 |
|
|
DRI_DEPEND=" |
204 |
|
|
x11-proto/xf86driproto |
205 |
|
|
x11-proto/glproto |
206 |
|
|
x11-proto/dri2proto |
207 |
|
|
" |
208 |
|
|
case ${XORG_DRI} in |
209 |
|
|
no) |
210 |
|
|
;; |
211 |
|
|
always) |
212 |
|
|
COMMON_DEPEND+=" ${DRI_COMMON_DEPEND}" |
213 |
|
|
DEPEND+=" ${DRI_DEPEND}" |
214 |
|
|
;; |
215 |
|
|
*) |
216 |
|
|
COMMON_DEPEND+=" ${XORG_DRI}? ( ${DRI_COMMON_DEPEND} )" |
217 |
|
|
DEPEND+=" ${XORG_DRI}? ( ${DRI_DEPEND} )" |
218 |
scarabeus |
1.38 |
IUSE+=" ${XORG_DRI}" |
219 |
scarabeus |
1.31 |
;; |
220 |
|
|
esac |
221 |
|
|
unset DRI_DEPEND |
222 |
|
|
unset DRI_COMMONDEPEND |
223 |
|
|
|
224 |
scarabeus |
1.26 |
if [[ -n "${DRIVER}" ]]; then |
225 |
|
|
COMMON_DEPEND+=" |
226 |
|
|
x11-base/xorg-server[xorg] |
227 |
|
|
" |
228 |
|
|
fi |
229 |
scarabeus |
1.44 |
if [[ -n "${DRIVER}" && ${PN} == xf86-input-* ]]; then |
230 |
scarabeus |
1.42 |
DEPEND+=" |
231 |
|
|
x11-proto/inputproto |
232 |
scarabeus |
1.43 |
x11-proto/kbproto |
233 |
|
|
x11-proto/xproto |
234 |
scarabeus |
1.42 |
" |
235 |
|
|
fi |
236 |
|
|
if [[ -n "${DRIVER}" && ${PN} == xf86-video-* ]]; then |
237 |
mgorny |
1.24 |
COMMON_DEPEND+=" |
238 |
|
|
x11-libs/libpciaccess |
239 |
|
|
" |
240 |
|
|
# we also needs some protos and libs in all cases |
241 |
|
|
DEPEND+=" |
242 |
|
|
x11-proto/fontsproto |
243 |
|
|
x11-proto/randrproto |
244 |
|
|
x11-proto/renderproto |
245 |
|
|
x11-proto/videoproto |
246 |
|
|
x11-proto/xextproto |
247 |
|
|
x11-proto/xineramaproto |
248 |
|
|
x11-proto/xproto |
249 |
|
|
" |
250 |
|
|
fi |
251 |
|
|
|
252 |
scarabeus |
1.31 |
# @ECLASS-VARIABLE: XORG_DOC |
253 |
|
|
# @DESCRIPTION: |
254 |
|
|
# Possible values are "always" or the value of the useflag doc packages |
255 |
|
|
# are required for. Default value is "no" |
256 |
|
|
# |
257 |
|
|
# Eg. XORG_DOC="manual" will pull all doc dependant deps for manual useflag |
258 |
|
|
: ${XORG_DOC:="no"} |
259 |
|
|
|
260 |
|
|
DOC_DEPEND=" |
261 |
|
|
doc? ( |
262 |
|
|
app-text/asciidoc |
263 |
|
|
app-text/xmlto |
264 |
|
|
app-doc/doxygen |
265 |
scarabeus |
1.33 |
app-text/docbook-xml-dtd:4.1.2 |
266 |
scarabeus |
1.31 |
app-text/docbook-xml-dtd:4.2 |
267 |
|
|
app-text/docbook-xml-dtd:4.3 |
268 |
|
|
) |
269 |
|
|
" |
270 |
|
|
case ${XORG_DOC} in |
271 |
|
|
no) |
272 |
|
|
;; |
273 |
|
|
always) |
274 |
scarabeus |
1.32 |
DEPEND+=" ${DOC_DEPEND}" |
275 |
scarabeus |
1.31 |
;; |
276 |
|
|
*) |
277 |
scarabeus |
1.32 |
DEPEND+=" ${XORG_DOC}? ( ${DOC_DEPEND} )" |
278 |
scarabeus |
1.38 |
IUSE+=" ${XORG_DOC}" |
279 |
scarabeus |
1.31 |
;; |
280 |
|
|
esac |
281 |
|
|
unset DOC_DEPEND |
282 |
mgorny |
1.24 |
|
283 |
chithanh |
1.60 |
# @ECLASS-VARIABLE: XORG_MODULE_REBUILD |
284 |
|
|
# @DESCRIPTION: |
285 |
|
|
# Describes whether a package contains modules that need to be rebuilt on |
286 |
|
|
# xorg-server upgrade. This has an effect only since EAPI=5. |
287 |
|
|
# Possible values are "yes" or "no". Default value is "yes" for packages which |
288 |
|
|
# are recognized as DRIVER by this eclass and "no" for all other packages. |
289 |
|
|
if [[ "${DRIVER}" == yes ]]; then |
290 |
|
|
: ${XORG_MODULE_REBUILD:="yes"} |
291 |
|
|
else |
292 |
|
|
: ${XORG_MODULE_REBUILD:="no"} |
293 |
|
|
fi |
294 |
|
|
|
295 |
|
|
if [[ ${XORG_MODULE_REBUILD} == yes ]]; then |
296 |
|
|
case ${EAPI} in |
297 |
|
|
3|4) |
298 |
|
|
;; |
299 |
|
|
*) |
300 |
|
|
RDEPEND+=" x11-base/xorg-server:=" |
301 |
|
|
;; |
302 |
|
|
esac |
303 |
|
|
fi |
304 |
|
|
|
305 |
mgorny |
1.24 |
DEPEND+=" ${COMMON_DEPEND}" |
306 |
|
|
RDEPEND+=" ${COMMON_DEPEND}" |
307 |
|
|
unset COMMON_DEPEND |
308 |
|
|
|
309 |
mgorny |
1.61 |
if [[ ${XORG_MULTILIB} == yes ]]; then |
310 |
|
|
RDEPEND+=" abi_x86_32? ( !<=app-emulation/emul-linux-x86-xlibs-20121202 )" |
311 |
|
|
fi |
312 |
|
|
|
313 |
mgorny |
1.24 |
debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: DEPEND=${DEPEND}" |
314 |
|
|
debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: RDEPEND=${RDEPEND}" |
315 |
scarabeus |
1.31 |
debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: PDEPEND=${PDEPEND}" |
316 |
scarabeus |
1.1 |
|
317 |
|
|
# @FUNCTION: xorg-2_pkg_setup |
318 |
|
|
# @DESCRIPTION: |
319 |
|
|
# Setup prefix compat |
320 |
|
|
xorg-2_pkg_setup() { |
321 |
scarabeus |
1.21 |
debug-print-function ${FUNCNAME} "$@" |
322 |
|
|
|
323 |
|
|
[[ ${FONT} == yes ]] && font_pkg_setup "$@" |
324 |
scarabeus |
1.1 |
} |
325 |
|
|
|
326 |
|
|
# @FUNCTION: xorg-2_src_unpack |
327 |
|
|
# @DESCRIPTION: |
328 |
|
|
# Simply unpack source code. |
329 |
|
|
xorg-2_src_unpack() { |
330 |
scarabeus |
1.21 |
debug-print-function ${FUNCNAME} "$@" |
331 |
|
|
|
332 |
scarabeus |
1.1 |
if [[ -n ${GIT_ECLASS} ]]; then |
333 |
mgorny |
1.41 |
git-2_src_unpack |
334 |
scarabeus |
1.1 |
else |
335 |
|
|
unpack ${A} |
336 |
|
|
fi |
337 |
|
|
|
338 |
|
|
[[ -n ${FONT_OPTIONS} ]] && einfo "Detected font directory: ${FONT_DIR}" |
339 |
|
|
} |
340 |
|
|
|
341 |
|
|
# @FUNCTION: xorg-2_patch_source |
342 |
|
|
# @DESCRIPTION: |
343 |
|
|
# Apply all patches |
344 |
|
|
xorg-2_patch_source() { |
345 |
scarabeus |
1.21 |
debug-print-function ${FUNCNAME} "$@" |
346 |
|
|
|
347 |
scarabeus |
1.1 |
# Use standardized names and locations with bulk patching |
348 |
|
|
# Patch directory is ${WORKDIR}/patch |
349 |
|
|
# See epatch() in eutils.eclass for more documentation |
350 |
|
|
EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch} |
351 |
|
|
|
352 |
|
|
[[ -d "${EPATCH_SOURCE}" ]] && epatch |
353 |
|
|
} |
354 |
|
|
|
355 |
|
|
# @FUNCTION: xorg-2_reconf_source |
356 |
|
|
# @DESCRIPTION: |
357 |
|
|
# Run eautoreconf if necessary, and run elibtoolize. |
358 |
|
|
xorg-2_reconf_source() { |
359 |
scarabeus |
1.21 |
debug-print-function ${FUNCNAME} "$@" |
360 |
|
|
|
361 |
scarabeus |
1.1 |
case ${CHOST} in |
362 |
|
|
*-interix* | *-aix* | *-winnt*) |
363 |
|
|
# some hosts need full eautoreconf |
364 |
mgorny |
1.52 |
[[ -e "./configure.ac" || -e "./configure.in" ]] \ |
365 |
|
|
&& AUTOTOOLS_AUTORECONF=1 |
366 |
scarabeus |
1.1 |
;; |
367 |
|
|
*) |
368 |
|
|
# elibtoolize required for BSD |
369 |
mgorny |
1.52 |
[[ ${XORG_EAUTORECONF} != no && ( -e "./configure.ac" || -e "./configure.in" ) ]] \ |
370 |
|
|
&& AUTOTOOLS_AUTORECONF=1 |
371 |
scarabeus |
1.1 |
;; |
372 |
|
|
esac |
373 |
|
|
} |
374 |
|
|
|
375 |
|
|
# @FUNCTION: xorg-2_src_prepare |
376 |
|
|
# @DESCRIPTION: |
377 |
|
|
# Prepare a package after unpacking, performing all X-related tasks. |
378 |
|
|
xorg-2_src_prepare() { |
379 |
scarabeus |
1.21 |
debug-print-function ${FUNCNAME} "$@" |
380 |
|
|
|
381 |
scarabeus |
1.1 |
xorg-2_patch_source |
382 |
|
|
xorg-2_reconf_source |
383 |
mgorny |
1.52 |
autotools-utils_src_prepare "$@" |
384 |
scarabeus |
1.1 |
} |
385 |
|
|
|
386 |
|
|
# @FUNCTION: xorg-2_font_configure |
387 |
|
|
# @DESCRIPTION: |
388 |
|
|
# If a font package, perform any necessary configuration steps |
389 |
|
|
xorg-2_font_configure() { |
390 |
scarabeus |
1.21 |
debug-print-function ${FUNCNAME} "$@" |
391 |
|
|
|
392 |
scarabeus |
1.1 |
if has nls ${IUSE//+} && ! use nls; then |
393 |
mgorny |
1.24 |
if grep -q -s "disable-all-encodings" ${ECONF_SOURCE:-.}/configure; then |
394 |
|
|
FONT_OPTIONS+=" |
395 |
|
|
--disable-all-encodings" |
396 |
|
|
else |
397 |
|
|
FONT_OPTIONS+=" |
398 |
|
|
--disable-iso8859-2 |
399 |
|
|
--disable-iso8859-3 |
400 |
|
|
--disable-iso8859-4 |
401 |
|
|
--disable-iso8859-5 |
402 |
|
|
--disable-iso8859-6 |
403 |
|
|
--disable-iso8859-7 |
404 |
|
|
--disable-iso8859-8 |
405 |
|
|
--disable-iso8859-9 |
406 |
|
|
--disable-iso8859-10 |
407 |
|
|
--disable-iso8859-11 |
408 |
|
|
--disable-iso8859-12 |
409 |
|
|
--disable-iso8859-13 |
410 |
|
|
--disable-iso8859-14 |
411 |
|
|
--disable-iso8859-15 |
412 |
|
|
--disable-iso8859-16 |
413 |
|
|
--disable-jisx0201 |
414 |
|
|
--disable-koi8-r" |
415 |
|
|
fi |
416 |
scarabeus |
1.1 |
fi |
417 |
|
|
} |
418 |
|
|
|
419 |
scarabeus |
1.11 |
# @FUNCTION: xorg-2_flags_setup |
420 |
scarabeus |
1.1 |
# @DESCRIPTION: |
421 |
|
|
# Set up CFLAGS for a debug build |
422 |
|
|
xorg-2_flags_setup() { |
423 |
scarabeus |
1.21 |
debug-print-function ${FUNCNAME} "$@" |
424 |
|
|
|
425 |
scarabeus |
1.1 |
# Win32 require special define |
426 |
|
|
[[ ${CHOST} == *-winnt* ]] && append-cppflags -DWIN32 -D__STDC__ |
427 |
|
|
# hardened ldflags |
428 |
|
|
[[ ${PN} = xorg-server || -n ${DRIVER} ]] && append-ldflags -Wl,-z,lazy |
429 |
scarabeus |
1.15 |
|
430 |
scarabeus |
1.16 |
# Quite few libraries fail on runtime without these: |
431 |
|
|
if has static-libs ${IUSE//+}; then |
432 |
|
|
filter-flags -Wl,-Bdirect |
433 |
|
|
filter-ldflags -Bdirect |
434 |
|
|
filter-ldflags -Wl,-Bdirect |
435 |
|
|
fi |
436 |
scarabeus |
1.1 |
} |
437 |
|
|
|
438 |
|
|
# @FUNCTION: xorg-2_src_configure |
439 |
|
|
# @DESCRIPTION: |
440 |
|
|
# Perform any necessary pre-configuration steps, then run configure |
441 |
|
|
xorg-2_src_configure() { |
442 |
scarabeus |
1.21 |
debug-print-function ${FUNCNAME} "$@" |
443 |
scarabeus |
1.1 |
|
444 |
|
|
xorg-2_flags_setup |
445 |
|
|
|
446 |
mgorny |
1.41 |
# @VARIABLE: XORG_CONFIGURE_OPTIONS |
447 |
scarabeus |
1.10 |
# @DESCRIPTION: |
448 |
mgorny |
1.41 |
# Array of an additional options to pass to configure. |
449 |
scarabeus |
1.10 |
# @DEFAULT_UNSET |
450 |
mgorny |
1.41 |
if [[ $(declare -p XORG_CONFIGURE_OPTIONS 2>&-) != "declare -a"* ]]; then |
451 |
|
|
# fallback to CONFIGURE_OPTIONS, deprecated. |
452 |
mgorny |
1.48 |
if [[ -n "${CONFIGURE_OPTIONS}" ]]; then |
453 |
|
|
eqawarn "CONFIGURE_OPTIONS are deprecated. Please migrate to XORG_CONFIGURE_OPTIONS" |
454 |
|
|
eqawarn "to preserve namespace." |
455 |
|
|
fi |
456 |
|
|
|
457 |
scarabeus |
1.56 |
local xorgconfadd=(${CONFIGURE_OPTIONS} ${XORG_CONFIGURE_OPTIONS}) |
458 |
mgorny |
1.41 |
else |
459 |
|
|
local xorgconfadd=("${XORG_CONFIGURE_OPTIONS[@]}") |
460 |
|
|
fi |
461 |
mgorny |
1.24 |
|
462 |
|
|
[[ -n "${FONT}" ]] && xorg-2_font_configure |
463 |
scarabeus |
1.58 |
|
464 |
|
|
# Check if package supports disabling of dep tracking |
465 |
|
|
# Fixes warnings like: |
466 |
|
|
# WARNING: unrecognized options: --disable-dependency-tracking |
467 |
|
|
if grep -q -s "disable-depencency-tracking" ${ECONF_SOURCE:-.}/configure; then |
468 |
|
|
local dep_track="--disable-dependency-tracking" |
469 |
|
|
fi |
470 |
|
|
|
471 |
mgorny |
1.24 |
local myeconfargs=( |
472 |
scarabeus |
1.58 |
${dep_track} |
473 |
mgorny |
1.24 |
${FONT_OPTIONS} |
474 |
mgorny |
1.41 |
"${xorgconfadd[@]}" |
475 |
mgorny |
1.24 |
) |
476 |
|
|
|
477 |
mgorny |
1.61 |
if [[ ${XORG_MULTILIB} == yes ]]; then |
478 |
|
|
autotools-multilib_src_configure "$@" |
479 |
|
|
else |
480 |
|
|
autotools-utils_src_configure "$@" |
481 |
|
|
fi |
482 |
scarabeus |
1.1 |
} |
483 |
|
|
|
484 |
|
|
# @FUNCTION: xorg-2_src_compile |
485 |
|
|
# @DESCRIPTION: |
486 |
|
|
# Compile a package, performing all X-related tasks. |
487 |
|
|
xorg-2_src_compile() { |
488 |
scarabeus |
1.21 |
debug-print-function ${FUNCNAME} "$@" |
489 |
|
|
|
490 |
mgorny |
1.61 |
if [[ ${XORG_MULTILIB} == yes ]]; then |
491 |
|
|
autotools-multilib_src_compile "$@" |
492 |
|
|
else |
493 |
|
|
autotools-utils_src_compile "$@" |
494 |
|
|
fi |
495 |
scarabeus |
1.1 |
} |
496 |
|
|
|
497 |
|
|
# @FUNCTION: xorg-2_src_install |
498 |
|
|
# @DESCRIPTION: |
499 |
|
|
# Install a built package to ${D}, performing any necessary steps. |
500 |
|
|
# Creates a ChangeLog from git if using live ebuilds. |
501 |
|
|
xorg-2_src_install() { |
502 |
scarabeus |
1.21 |
debug-print-function ${FUNCNAME} "$@" |
503 |
|
|
|
504 |
mgorny |
1.61 |
local install_args=( docdir="${EPREFIX}/usr/share/doc/${PF}" ) |
505 |
|
|
|
506 |
scarabeus |
1.1 |
if [[ ${CATEGORY} == x11-proto ]]; then |
507 |
mgorny |
1.61 |
install_args+=( |
508 |
|
|
${PN/proto/}docdir="${EPREFIX}/usr/share/doc/${PF}" |
509 |
|
|
) |
510 |
|
|
fi |
511 |
|
|
|
512 |
|
|
if [[ ${XORG_MULTILIB} == yes ]]; then |
513 |
|
|
autotools-multilib_src_install "${install_args[@]}" |
514 |
scarabeus |
1.1 |
else |
515 |
mgorny |
1.61 |
autotools-utils_src_install "${install_args[@]}" |
516 |
scarabeus |
1.1 |
fi |
517 |
|
|
|
518 |
|
|
if [[ -n ${GIT_ECLASS} ]]; then |
519 |
|
|
pushd "${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}" > /dev/null |
520 |
scarabeus |
1.12 |
git log ${EGIT_COMMIT} > "${S}"/ChangeLog |
521 |
scarabeus |
1.1 |
popd > /dev/null |
522 |
|
|
fi |
523 |
|
|
|
524 |
|
|
if [[ -e "${S}"/ChangeLog ]]; then |
525 |
scarabeus |
1.21 |
dodoc "${S}"/ChangeLog || die "dodoc failed" |
526 |
scarabeus |
1.1 |
fi |
527 |
|
|
|
528 |
mgorny |
1.57 |
# Don't install libtool archives (even for modules) |
529 |
|
|
prune_libtool_files --all |
530 |
scarabeus |
1.1 |
|
531 |
|
|
[[ -n ${FONT} ]] && remove_font_metadata |
532 |
|
|
} |
533 |
|
|
|
534 |
|
|
# @FUNCTION: xorg-2_pkg_postinst |
535 |
|
|
# @DESCRIPTION: |
536 |
|
|
# Run X-specific post-installation tasks on the live filesystem. The |
537 |
|
|
# only task right now is some setup for font packages. |
538 |
|
|
xorg-2_pkg_postinst() { |
539 |
scarabeus |
1.21 |
debug-print-function ${FUNCNAME} "$@" |
540 |
|
|
|
541 |
mgorny |
1.50 |
if [[ -n ${FONT} ]]; then |
542 |
|
|
create_fonts_scale |
543 |
|
|
create_fonts_dir |
544 |
|
|
font_pkg_postinst "$@" |
545 |
|
|
fi |
546 |
scarabeus |
1.1 |
} |
547 |
|
|
|
548 |
|
|
# @FUNCTION: xorg-2_pkg_postrm |
549 |
|
|
# @DESCRIPTION: |
550 |
|
|
# Run X-specific post-removal tasks on the live filesystem. The only |
551 |
|
|
# task right now is some cleanup for font packages. |
552 |
|
|
xorg-2_pkg_postrm() { |
553 |
scarabeus |
1.21 |
debug-print-function ${FUNCNAME} "$@" |
554 |
|
|
|
555 |
mgorny |
1.50 |
if [[ -n ${FONT} ]]; then |
556 |
|
|
# if we're doing an upgrade, postinst will do |
557 |
|
|
if [[ ${EAPI} -lt 4 || -z ${REPLACED_BY_VERSION} ]]; then |
558 |
|
|
create_fonts_scale |
559 |
|
|
create_fonts_dir |
560 |
|
|
font_pkg_postrm "$@" |
561 |
|
|
fi |
562 |
|
|
fi |
563 |
scarabeus |
1.1 |
} |
564 |
|
|
|
565 |
|
|
# @FUNCTION: remove_font_metadata |
566 |
|
|
# @DESCRIPTION: |
567 |
|
|
# Don't let the package install generated font files that may overlap |
568 |
|
|
# with other packages. Instead, they're generated in pkg_postinst(). |
569 |
|
|
remove_font_metadata() { |
570 |
scarabeus |
1.21 |
debug-print-function ${FUNCNAME} "$@" |
571 |
|
|
|
572 |
scarabeus |
1.1 |
if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then |
573 |
|
|
einfo "Removing font metadata" |
574 |
|
|
rm -rf "${ED}"/usr/share/fonts/${FONT_DIR}/fonts.{scale,dir,cache-1} |
575 |
|
|
fi |
576 |
|
|
} |
577 |
|
|
|
578 |
|
|
# @FUNCTION: create_fonts_scale |
579 |
|
|
# @DESCRIPTION: |
580 |
|
|
# Create fonts.scale file, used by the old server-side fonts subsystem. |
581 |
|
|
create_fonts_scale() { |
582 |
scarabeus |
1.21 |
debug-print-function ${FUNCNAME} "$@" |
583 |
|
|
|
584 |
scarabeus |
1.1 |
if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then |
585 |
mgorny |
1.49 |
ebegin "Generating fonts.scale" |
586 |
scarabeus |
1.1 |
mkfontscale \ |
587 |
|
|
-a "${EROOT}/usr/share/fonts/encodings/encodings.dir" \ |
588 |
|
|
-- "${EROOT}/usr/share/fonts/${FONT_DIR}" |
589 |
|
|
eend $? |
590 |
|
|
fi |
591 |
|
|
} |
592 |
|
|
|
593 |
|
|
# @FUNCTION: create_fonts_dir |
594 |
|
|
# @DESCRIPTION: |
595 |
|
|
# Create fonts.dir file, used by the old server-side fonts subsystem. |
596 |
|
|
create_fonts_dir() { |
597 |
scarabeus |
1.21 |
debug-print-function ${FUNCNAME} "$@" |
598 |
|
|
|
599 |
scarabeus |
1.1 |
ebegin "Generating fonts.dir" |
600 |
|
|
mkfontdir \ |
601 |
|
|
-e "${EROOT}"/usr/share/fonts/encodings \ |
602 |
|
|
-e "${EROOT}"/usr/share/fonts/encodings/large \ |
603 |
|
|
-- "${EROOT}/usr/share/fonts/${FONT_DIR}" |
604 |
|
|
eend $? |
605 |
|
|
} |