| 1 | # Copyright 1999-2005 Gentoo Foundation |
1 | # Copyright 1999-2005 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.95 2008/04/13 04:44:16 dberkholz Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.119 2010/07/04 20:42:22 dirtyepic Exp $ |
| 4 | # |
4 | # |
| 5 | # @ECLASS: x-modular.eclass |
5 | # @ECLASS: x-modular.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # Donnie Berkholz <dberkholz@gentoo.org>, x11@gentoo.org |
7 | # Donnie Berkholz <dberkholz@gentoo.org>, x11@gentoo.org |
| 8 | # @BLURB: Reduces code duplication in the modularized X11 ebuilds. |
8 | # @BLURB: Reduces code duplication in the modularized X11 ebuilds. |
| … | |
… | |
| 15 | # All you need to do in a basic ebuild is inherit this eclass and set |
15 | # All you need to do in a basic ebuild is inherit this eclass and set |
| 16 | # DESCRIPTION, KEYWORDS and RDEPEND/DEPEND. If your package is hosted |
16 | # DESCRIPTION, KEYWORDS and RDEPEND/DEPEND. If your package is hosted |
| 17 | # with the other X packages, you don't need to set SRC_URI. Pretty much |
17 | # with the other X packages, you don't need to set SRC_URI. Pretty much |
| 18 | # everything else should be automatic. |
18 | # everything else should be automatic. |
| 19 | |
19 | |
|
|
20 | if [[ ${PV} = 9999* ]]; then |
|
|
21 | GIT_ECLASS="git" |
|
|
22 | SNAPSHOT="yes" |
|
|
23 | SRC_URI="" |
|
|
24 | fi |
|
|
25 | |
|
|
26 | # If we're a font package, but not the font.alias one |
|
|
27 | FONT_ECLASS="" |
|
|
28 | if [[ "${PN/#font-}" != "${PN}" ]] \ |
|
|
29 | && [[ "${CATEGORY}" = "media-fonts" ]] \ |
|
|
30 | && [[ "${PN}" != "font-alias" ]] \ |
|
|
31 | && [[ "${PN}" != "font-util" ]]; then |
|
|
32 | # Activate font code in the rest of the eclass |
|
|
33 | FONT="yes" |
|
|
34 | |
|
|
35 | # Whether to inherit the font eclass |
|
|
36 | FONT_ECLASS="font" |
|
|
37 | fi |
|
|
38 | |
|
|
39 | inherit eutils libtool multilib toolchain-funcs flag-o-matic autotools \ |
|
|
40 | ${FONT_ECLASS} ${GIT_ECLASS} |
|
|
41 | |
|
|
42 | EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm" |
|
|
43 | |
|
|
44 | case "${EAPI:-0}" in |
|
|
45 | 0|1) |
|
|
46 | ;; |
|
|
47 | 2) |
|
|
48 | EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure" |
|
|
49 | ;; |
|
|
50 | *) |
|
|
51 | die "Unknown EAPI ${EAPI}" |
|
|
52 | ;; |
|
|
53 | esac |
|
|
54 | |
|
|
55 | # exports must be ALWAYS after inherit |
|
|
56 | EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS} |
|
|
57 | |
| 20 | # @ECLASS-VARIABLE: XDIR |
58 | # @ECLASS-VARIABLE: XDIR |
| 21 | # @DESCRIPTION: |
59 | # @DESCRIPTION: |
| 22 | # Directory prefix to use for everything. If you want to install to a |
60 | # Directory prefix to use for everything. If you want to install to a |
| 23 | # non-default prefix (e.g., /opt/xorg), change XDIR. This has not been |
61 | # non-default prefix (e.g., /opt/xorg), change XDIR. This has not been |
| 24 | # recently tested. You may need to uncomment the setting of datadir and |
62 | # recently tested. You may need to uncomment the setting of datadir and |
| 25 | # mandir in x-modular_src_install() or add it back in if it's no longer |
63 | # mandir in x-modular_src_install() or add it back in if it's no longer |
| 26 | # there. You may also want to change the SLOT. |
64 | # there. You may also want to change the SLOT. |
| 27 | XDIR="/usr" |
65 | XDIR="/usr" |
| 28 | |
66 | |
| 29 | if [[ -z "${XDPVER}" ]]; then |
|
|
| 30 | # @ECLASS-VARIABLE: XDPVER |
|
|
| 31 | # @DESCRIPTION: |
|
|
| 32 | # Set up default patchset version(s) if necessary for driver patches. If |
|
|
| 33 | # you want to change the auto-application of the driver patchset or |
|
|
| 34 | # prevent it from applying, edit XDPVER in the ebuild. Set it to -1 to |
|
|
| 35 | # prevent patch application or positive integers for that patch version. |
|
|
| 36 | # Set before inheriting this eclass. |
|
|
| 37 | XDPVER="1" |
|
|
| 38 | fi |
|
|
| 39 | |
|
|
| 40 | IUSE="" |
67 | IUSE="" |
| 41 | HOMEPAGE="http://xorg.freedesktop.org/" |
68 | HOMEPAGE="http://xorg.freedesktop.org/" |
| 42 | |
69 | |
| 43 | if [[ -z ${SNAPSHOT} ]]; then |
|
|
| 44 | # @ECLASS-VARIABLE: SNAPSHOT |
70 | # @ECLASS-VARIABLE: SNAPSHOT |
| 45 | # @DESCRIPTION: |
71 | # @DESCRIPTION: |
| 46 | # If set to 'yes' and configure.ac exists, eautoreconf will run. Set |
72 | # If set to 'yes' and configure.ac exists, eautoreconf will run. Set |
| 47 | # before inheriting this eclass. |
73 | # before inheriting this eclass. |
| 48 | SNAPSHOT="no" |
74 | : ${SNAPSHOT:=no} |
| 49 | fi |
|
|
| 50 | |
|
|
| 51 | if [[ ${PV} = 9999* ]]; then |
|
|
| 52 | GIT_ECLASS="git" |
|
|
| 53 | SNAPSHOT="yes" |
|
|
| 54 | SRC_URI="" |
|
|
| 55 | fi |
|
|
| 56 | |
75 | |
| 57 | # Set up SRC_URI for individual modular releases |
76 | # Set up SRC_URI for individual modular releases |
| 58 | BASE_INDIVIDUAL_URI="http://xorg.freedesktop.org/releases/individual" |
77 | BASE_INDIVIDUAL_URI="http://xorg.freedesktop.org/releases/individual" |
| 59 | if [[ ${CATEGORY} = x11-apps ]] || [[ ${CATEGORY} = x11-wm ]]; then |
78 | # @ECLASS-VARIABLE: MODULE |
| 60 | MODULE="app" |
79 | # @DESCRIPTION: |
| 61 | elif [[ ${CATEGORY} = app-doc ]]; then |
80 | # The subdirectory to download source from. Possible settings are app, |
| 62 | MODULE="doc" |
81 | # doc, data, util, driver, font, lib, proto, xserver. Set above the |
| 63 | # x11-misc contains data and util, x11-themes contains data |
82 | # inherit to override the default autoconfigured module. |
| 64 | elif [[ ${CATEGORY} = x11-misc ]] || [[ ${CATEGORY} = x11-themes ]]; then |
83 | if [[ -z ${MODULE} ]]; then |
| 65 | if [[ ${PN} == xbitmaps || ${PN} == xcursor-themes || ${PN} == xkbdata ]]; then |
84 | case ${CATEGORY} in |
| 66 | MODULE="data" |
85 | app-doc) MODULE="doc" ;; |
| 67 | else |
86 | media-fonts) MODULE="font" ;; |
| 68 | MODULE="util" |
87 | x11-apps|x11-wm) MODULE="app" ;; |
| 69 | fi |
88 | x11-misc|x11-themes) MODULE="util" ;; |
| 70 | elif [[ ${CATEGORY} = x11-drivers ]]; then |
89 | x11-drivers) MODULE="driver" ;; |
| 71 | MODULE="driver" |
90 | x11-base) MODULE="xserver" ;; |
| 72 | elif [[ ${CATEGORY} = media-fonts ]]; then |
91 | x11-proto) MODULE="proto" ;; |
| 73 | MODULE="font" |
92 | x11-libs) MODULE="lib" ;; |
| 74 | elif [[ ${CATEGORY} = x11-libs ]]; then |
93 | esac |
| 75 | MODULE="lib" |
|
|
| 76 | elif [[ ${CATEGORY} = x11-proto ]]; then |
|
|
| 77 | MODULE="proto" |
|
|
| 78 | elif [[ ${CATEGORY} = x11-base ]]; then |
|
|
| 79 | MODULE="xserver" |
|
|
| 80 | fi |
94 | fi |
| 81 | |
95 | |
| 82 | if [[ -n ${GIT_ECLASS} ]]; then |
96 | if [[ -n ${GIT_ECLASS} ]]; then |
| 83 | EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}/${PN}" |
97 | EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}/${PN}" |
| 84 | else |
98 | else |
| … | |
… | |
| 86 | fi |
100 | fi |
| 87 | |
101 | |
| 88 | SLOT="0" |
102 | SLOT="0" |
| 89 | |
103 | |
| 90 | # Set the license for the package. This can be overridden by setting |
104 | # Set the license for the package. This can be overridden by setting |
| 91 | # LICENSE after the inherit. |
105 | # LICENSE after the inherit. Nearly all FreeDesktop-hosted X packages |
| 92 | LICENSE=${PN} |
106 | # are under the MIT license. (This is what Red Hat does in their rpms) |
|
|
107 | LICENSE="MIT" |
| 93 | |
108 | |
| 94 | # Set up shared dependencies |
109 | # Set up shared dependencies |
| 95 | if [[ -n "${SNAPSHOT}" ]]; then |
110 | if [[ -n "${SNAPSHOT}" ]]; then |
| 96 | # FIXME: What's the minimal libtool version supporting arbitrary versioning? |
111 | # FIXME: What's the minimal libtool version supporting arbitrary versioning? |
| 97 | DEPEND="${DEPEND} |
112 | DEPEND="${DEPEND} |
| … | |
… | |
| 99 | >=sys-devel/m4-1.4" |
114 | >=sys-devel/m4-1.4" |
| 100 | WANT_AUTOCONF="latest" |
115 | WANT_AUTOCONF="latest" |
| 101 | WANT_AUTOMAKE="latest" |
116 | WANT_AUTOMAKE="latest" |
| 102 | fi |
117 | fi |
| 103 | |
118 | |
| 104 | # If we're a font package, but not the font.alias one |
119 | if [[ -n "${FONT}" ]]; then |
| 105 | FONT_ECLASS="" |
|
|
| 106 | if [[ "${PN/#font-}" != "${PN}" ]] \ |
|
|
| 107 | && [[ "${CATEGORY}" = "media-fonts" ]] \ |
|
|
| 108 | && [[ "${PN}" != "font-alias" ]] \ |
|
|
| 109 | && [[ "${PN}" != "font-util" ]]; then |
|
|
| 110 | # Activate font code in the rest of the eclass |
|
|
| 111 | FONT="yes" |
|
|
| 112 | |
|
|
| 113 | # Whether to inherit the font eclass |
|
|
| 114 | FONT_ECLASS="font" |
|
|
| 115 | |
|
|
| 116 | RDEPEND="${RDEPEND} |
120 | RDEPEND="${RDEPEND} |
| 117 | media-fonts/encodings |
121 | media-fonts/encodings |
| 118 | x11-apps/mkfontscale |
122 | x11-apps/mkfontscale |
| 119 | x11-apps/mkfontdir" |
123 | x11-apps/mkfontdir" |
| 120 | PDEPEND="${PDEPEND} |
124 | PDEPEND="${PDEPEND} |
| 121 | media-fonts/font-alias" |
125 | media-fonts/font-alias" |
| 122 | |
126 | |
| 123 | # Starting with 7.0RC3, we can specify the font directory |
127 | # Starting with 7.0RC3, we can specify the font directory |
| 124 | # But oddly, we can't do the same for encodings or font-alias |
128 | # But oddly, we can't do the same for encodings or font-alias |
| 125 | |
129 | |
| 126 | # Wrap in `if` so ebuilds can set it too |
|
|
| 127 | if [[ -z ${FONT_DIR} ]]; then |
|
|
| 128 | # @ECLASS-VARIABLE: FONT_DIR |
130 | # @ECLASS-VARIABLE: FONT_DIR |
| 129 | # @DESCRIPTION: |
131 | # @DESCRIPTION: |
| 130 | # If you're creating a font package and the suffix of PN is not equal to |
132 | # If you're creating a font package and the suffix of PN is not equal to |
| 131 | # the subdirectory of /usr/share/fonts/ it should install into, set |
133 | # the subdirectory of /usr/share/fonts/ it should install into, set |
| 132 | # FONT_DIR to that directory or directories. Set before inheriting this |
134 | # FONT_DIR to that directory or directories. Set before inheriting this |
| 133 | # eclass. |
135 | # eclass. |
| 134 | FONT_DIR=${PN##*-} |
136 | : ${FONT_DIR:=${PN##*-}} |
| 135 | |
|
|
| 136 | fi |
|
|
| 137 | |
137 | |
| 138 | # Fix case of font directories |
138 | # Fix case of font directories |
| 139 | FONT_DIR=${FONT_DIR/ttf/TTF} |
139 | FONT_DIR=${FONT_DIR/ttf/TTF} |
| 140 | FONT_DIR=${FONT_DIR/otf/OTF} |
140 | FONT_DIR=${FONT_DIR/otf/OTF} |
| 141 | FONT_DIR=${FONT_DIR/type1/Type1} |
141 | FONT_DIR=${FONT_DIR/type1/Type1} |
| 142 | FONT_DIR=${FONT_DIR/speedo/Speedo} |
142 | FONT_DIR=${FONT_DIR/speedo/Speedo} |
| 143 | |
143 | |
| 144 | # Set up configure option |
144 | # Set up configure options, wrapped so ebuilds can override if need be |
|
|
145 | if [[ -z ${FONT_OPTIONS} ]]; then |
| 145 | FONT_OPTIONS="--with-fontdir=\"/usr/share/fonts/${FONT_DIR}\"" |
146 | FONT_OPTIONS="--with-fontdir=\"/usr/share/fonts/${FONT_DIR}\"" |
|
|
147 | fi |
| 146 | |
148 | |
| 147 | if [[ -n "${FONT}" ]]; then |
149 | if [[ -n "${FONT}" ]]; then |
| 148 | if [[ ${PN##*-} = misc ]] || [[ ${PN##*-} = 75dpi ]] || [[ ${PN##*-} = 100dpi ]]; then |
150 | if [[ ${PN##*-} = misc ]] || [[ ${PN##*-} = 75dpi ]] || [[ ${PN##*-} = 100dpi ]] || [[ ${PN##*-} = cyrillic ]]; then |
| 149 | IUSE="${IUSE} nls" |
151 | IUSE="${IUSE} nls" |
| 150 | fi |
152 | fi |
| 151 | fi |
153 | fi |
| 152 | fi |
154 | fi |
| 153 | |
155 | |
| 154 | # If we're a driver package |
156 | # If we're a driver package |
| 155 | if [[ "${PN/#xf86-video}" != "${PN}" ]] || [[ "${PN/#xf86-input}" != "${PN}" ]]; then |
157 | if [[ "${PN/#xf86-video}" != "${PN}" ]] || [[ "${PN/#xf86-input}" != "${PN}" ]]; then |
| 156 | # Enable driver code in the rest of the eclass |
158 | # Enable driver code in the rest of the eclass |
| 157 | DRIVER="yes" |
159 | DRIVER="yes" |
| 158 | |
|
|
| 159 | if [[ ${XDPVER} != -1 ]]; then |
|
|
| 160 | # Add driver patchset to SRC_URI |
|
|
| 161 | SRC_URI="${SRC_URI} |
|
|
| 162 | mirror://gentoo/x11-driver-patches-${XDPVER}.tar.bz2" |
|
|
| 163 | fi |
|
|
| 164 | fi |
160 | fi |
| 165 | |
161 | |
| 166 | # Debugging -- ignore packages that can't be built with debugging |
162 | # Debugging -- ignore packages that can't be built with debugging |
| 167 | if [[ -z "${FONT}" ]] \ |
163 | if [[ -z "${FONT}" ]] \ |
| 168 | && [[ "${CATEGORY/app-doc}" = "${CATEGORY}" ]] \ |
164 | && [[ "${CATEGORY/app-doc}" = "${CATEGORY}" ]] \ |
| … | |
… | |
| 180 | DEPEND="${DEPEND} |
176 | DEPEND="${DEPEND} |
| 181 | >=dev-util/pkgconfig-0.18" |
177 | >=dev-util/pkgconfig-0.18" |
| 182 | |
178 | |
| 183 | if [[ "${PN/util-macros}" = "${PN}" ]]; then |
179 | if [[ "${PN/util-macros}" = "${PN}" ]]; then |
| 184 | DEPEND="${DEPEND} |
180 | DEPEND="${DEPEND} |
| 185 | >=x11-misc/util-macros-0.99.2 |
181 | >=x11-misc/util-macros-1.3.0 |
| 186 | >=sys-devel/binutils-2.16.1-r3" |
182 | sys-devel/binutils" |
| 187 | fi |
183 | fi |
| 188 | |
184 | |
| 189 | RDEPEND="${RDEPEND} |
185 | RDEPEND="${RDEPEND} |
| 190 | !<=x11-base/xorg-x11-6.9" |
186 | !<=x11-base/xorg-x11-6.9" |
| 191 | # Provides virtual/x11 for temporary use until packages are ported |
187 | # Provides virtual/x11 for temporary use until packages are ported |
| 192 | # x11-base/x11-env" |
188 | # x11-base/x11-env" |
| 193 | |
|
|
| 194 | inherit eutils libtool multilib toolchain-funcs flag-o-matic autotools \ |
|
|
| 195 | ${FONT_ECLASS} ${GIT_ECLASS} |
|
|
| 196 | |
189 | |
| 197 | # @FUNCTION: x-modular_specs_check |
190 | # @FUNCTION: x-modular_specs_check |
| 198 | # @USAGE: |
191 | # @USAGE: |
| 199 | # @DESCRIPTION: |
192 | # @DESCRIPTION: |
| 200 | # Make any necessary changes related to gcc specs (generally hardened) |
193 | # Make any necessary changes related to gcc specs (generally hardened) |
| … | |
… | |
| 211 | # @DESCRIPTION: |
204 | # @DESCRIPTION: |
| 212 | # Ensures the server supports DRI if building a driver with DRI support |
205 | # Ensures the server supports DRI if building a driver with DRI support |
| 213 | x-modular_dri_check() { |
206 | x-modular_dri_check() { |
| 214 | # (#120057) Enabling DRI in drivers requires that the server was built with |
207 | # (#120057) Enabling DRI in drivers requires that the server was built with |
| 215 | # support for it |
208 | # support for it |
|
|
209 | # Starting with xorg-server 1.5.3, DRI support is always enabled unless |
|
|
210 | # USE=minimal is set (see bug #252084) |
| 216 | if [[ -n "${DRIVER}" ]]; then |
211 | if [[ -n "${DRIVER}" ]]; then |
| 217 | if has dri ${IUSE} && use dri; then |
212 | if has dri ${IUSE} && use dri; then |
| 218 | einfo "Checking for direct rendering capabilities ..." |
213 | einfo "Checking for direct rendering capabilities ..." |
|
|
214 | if has_version '>=x11-base/xorg-server-1.5.3'; then |
|
|
215 | if built_with_use x11-base/xorg-server minimal; then |
|
|
216 | die "You must build x11-base/xorg-server with USE=-minimal." |
|
|
217 | fi |
|
|
218 | else |
| 219 | if ! built_with_use x11-base/xorg-server dri; then |
219 | if ! built_with_use x11-base/xorg-server dri; then |
| 220 | die "You must build x11-base/xorg-server with USE=dri." |
220 | die "You must build x11-base/xorg-server with USE=dri." |
|
|
221 | fi |
| 221 | fi |
222 | fi |
| 222 | fi |
223 | fi |
| 223 | fi |
224 | fi |
| 224 | } |
225 | } |
| 225 | |
226 | |
| … | |
… | |
| 248 | if [[ -n ${GIT_ECLASS} ]]; then |
249 | if [[ -n ${GIT_ECLASS} ]]; then |
| 249 | git_src_unpack |
250 | git_src_unpack |
| 250 | else |
251 | else |
| 251 | unpack ${A} |
252 | unpack ${A} |
| 252 | fi |
253 | fi |
| 253 | cd ${S} |
254 | cd "${S}" |
| 254 | |
255 | |
| 255 | if [[ -n ${FONT_OPTIONS} ]]; then |
256 | if [[ -n ${FONT_OPTIONS} ]]; then |
| 256 | einfo "Detected font directory: ${FONT_DIR}" |
257 | einfo "Detected font directory: ${FONT_DIR}" |
| 257 | fi |
258 | fi |
| 258 | } |
259 | } |
| … | |
… | |
| 265 | # Use standardized names and locations with bulk patching |
266 | # Use standardized names and locations with bulk patching |
| 266 | # Patch directory is ${WORKDIR}/patch |
267 | # Patch directory is ${WORKDIR}/patch |
| 267 | # See epatch() in eutils.eclass for more documentation |
268 | # See epatch() in eutils.eclass for more documentation |
| 268 | if [[ -z "${EPATCH_SUFFIX}" ]] ; then |
269 | if [[ -z "${EPATCH_SUFFIX}" ]] ; then |
| 269 | EPATCH_SUFFIX="patch" |
270 | EPATCH_SUFFIX="patch" |
| 270 | fi |
|
|
| 271 | |
|
|
| 272 | # If this is a driver package we need to fix man page install location. |
|
|
| 273 | # Running autoreconf will use the patched util-macros to make the |
|
|
| 274 | # change for us, so we only need to patch if it is not going to run. |
|
|
| 275 | if [[ -n "${DRIVER}" ]] && [[ "${SNAPSHOT}" != "yes" ]]\ |
|
|
| 276 | && [[ ${XDPVER} != -1 ]]; then |
|
|
| 277 | PATCHES="${PATCHES} ${DISTDIR}/x11-driver-patches-${XDPVER}.tar.bz2" |
|
|
| 278 | fi |
271 | fi |
| 279 | |
272 | |
| 280 | # @VARIABLE: PATCHES |
273 | # @VARIABLE: PATCHES |
| 281 | # @DESCRIPTION: |
274 | # @DESCRIPTION: |
| 282 | # If you have any patches to apply, set PATCHES to their locations and epatch |
275 | # If you have any patches to apply, set PATCHES to their locations and epatch |
| … | |
… | |
| 316 | # Joshua Baergen - October 23, 2005 |
309 | # Joshua Baergen - October 23, 2005 |
| 317 | # Fix shared lib issues on MIPS, FBSD, etc etc |
310 | # Fix shared lib issues on MIPS, FBSD, etc etc |
| 318 | elibtoolize |
311 | elibtoolize |
| 319 | } |
312 | } |
| 320 | |
313 | |
|
|
314 | # @FUNCTION: x-modular_src_prepare |
|
|
315 | # @USAGE: |
|
|
316 | # @DESCRIPTION: |
|
|
317 | # Prepare a package after unpacking, performing all X-related tasks. |
|
|
318 | x-modular_src_prepare() { |
|
|
319 | [[ -n ${GIT_ECLASS} ]] && has src_prepare ${EXPORTED_FUNCTIONS} \ |
|
|
320 | && git_src_prepare |
|
|
321 | x-modular_patch_source |
|
|
322 | x-modular_reconf_source |
|
|
323 | } |
|
|
324 | |
| 321 | # @FUNCTION: x-modular_src_unpack |
325 | # @FUNCTION: x-modular_src_unpack |
| 322 | # @USAGE: |
326 | # @USAGE: |
| 323 | # @DESCRIPTION: |
327 | # @DESCRIPTION: |
| 324 | # Unpack a package, performing all X-related tasks. |
328 | # Unpack a package, performing all X-related tasks. |
| 325 | x-modular_src_unpack() { |
329 | x-modular_src_unpack() { |
| 326 | x-modular_specs_check |
330 | x-modular_specs_check |
| 327 | x-modular_server_supports_drivers_check |
331 | x-modular_server_supports_drivers_check |
| 328 | x-modular_dri_check |
332 | x-modular_dri_check |
| 329 | x-modular_unpack_source |
333 | x-modular_unpack_source |
| 330 | x-modular_patch_source |
334 | has src_prepare ${EXPORTED_FUNCTIONS} || x-modular_src_prepare |
| 331 | x-modular_reconf_source |
|
|
| 332 | } |
335 | } |
| 333 | |
336 | |
| 334 | # @FUNCTION: x-modular_font_configure |
337 | # @FUNCTION: x-modular_font_configure |
| 335 | # @USAGE: |
338 | # @USAGE: |
| 336 | # @DESCRIPTION: |
339 | # @DESCRIPTION: |
| 337 | # If a font package, perform any necessary configuration steps |
340 | # If a font package, perform any necessary configuration steps |
| 338 | x-modular_font_configure() { |
341 | x-modular_font_configure() { |
| 339 | if [[ -n "${FONT}" ]]; then |
342 | if [[ -n "${FONT}" ]]; then |
| 340 | # Might be worth adding an option to configure your desired font |
343 | # Might be worth adding an option to configure your desired font |
| 341 | # and exclude all others. Also, should this USE be nls or minimal? |
344 | # and exclude all others. Also, should this USE be nls or minimal? |
| 342 | if ! use nls; then |
345 | if has nls ${IUSE//+} && ! use nls; then |
| 343 | FONT_OPTIONS="${FONT_OPTIONS} |
346 | FONT_OPTIONS="${FONT_OPTIONS} |
| 344 | --disable-iso8859-2 |
347 | --disable-iso8859-2 |
| 345 | --disable-iso8859-3 |
348 | --disable-iso8859-3 |
| 346 | --disable-iso8859-4 |
349 | --disable-iso8859-4 |
| 347 | --disable-iso8859-5 |
350 | --disable-iso8859-5 |
| … | |
… | |
| 383 | x-modular_font_configure |
386 | x-modular_font_configure |
| 384 | x-modular_debug_setup |
387 | x-modular_debug_setup |
| 385 | |
388 | |
| 386 | # @VARIABLE: CONFIGURE_OPTIONS |
389 | # @VARIABLE: CONFIGURE_OPTIONS |
| 387 | # @DESCRIPTION: |
390 | # @DESCRIPTION: |
| 388 | # Any options to pass to configure |
391 | # Any extra options to pass to configure |
| 389 | [[ -n ${CONFIGURE_OPTIONTS} ]] |
|
|
| 390 | |
392 | |
| 391 | # If prefix isn't set here, .pc files cause problems |
393 | # If prefix isn't set here, .pc files cause problems |
| 392 | if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then |
394 | if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then |
| 393 | econf --prefix=${XDIR} \ |
395 | econf --prefix=${XDIR} \ |
| 394 | --datadir=${XDIR}/share \ |
396 | --datadir=${XDIR}/share \ |
| … | |
… | |
| 404 | # Run make. |
406 | # Run make. |
| 405 | x-modular_src_make() { |
407 | x-modular_src_make() { |
| 406 | emake || die "emake failed" |
408 | emake || die "emake failed" |
| 407 | } |
409 | } |
| 408 | |
410 | |
| 409 | # @FUNCTION: x-modular_src_configure |
411 | # @FUNCTION: x-modular_src_compile |
| 410 | # @USAGE: |
412 | # @USAGE: |
| 411 | # @DESCRIPTION: |
413 | # @DESCRIPTION: |
| 412 | # Compile a package, performing all X-related tasks. |
414 | # Compile a package, performing all X-related tasks. |
| 413 | x-modular_src_compile() { |
415 | x-modular_src_compile() { |
| 414 | x-modular_src_configure |
416 | has src_configure ${EXPORTED_FUNCTIONS} || x-modular_src_configure |
| 415 | x-modular_src_make |
417 | x-modular_src_make |
| 416 | } |
418 | } |
| 417 | |
419 | |
| 418 | # @FUNCTION: x-modular_src_install |
420 | # @FUNCTION: x-modular_src_install |
| 419 | # @USAGE: |
421 | # @USAGE: |
| 420 | # @DESCRIPTION: |
422 | # @DESCRIPTION: |
| 421 | # Install a built package to ${D}, performing any necessary steps. |
423 | # Install a built package to ${D}, performing any necessary steps. |
| 422 | # Creates a ChangeLog from git if using live ebuilds. |
424 | # Creates a ChangeLog from git if using live ebuilds. |
| 423 | x-modular_src_install() { |
425 | x-modular_src_install() { |
| 424 | # Install everything to ${XDIR} |
426 | # Install everything to ${XDIR} |
|
|
427 | if [[ ${CATEGORY} = x11-proto ]]; then |
| 425 | make \ |
428 | make \ |
|
|
429 | ${PN/proto/}docdir=/usr/share/doc/${PF} \ |
| 426 | DESTDIR="${D}" \ |
430 | DESTDIR="${D}" \ |
| 427 | install |
431 | install \ |
|
|
432 | || die |
|
|
433 | else |
|
|
434 | make \ |
|
|
435 | docdir=/usr/share/doc/${PF} \ |
|
|
436 | DESTDIR="${D}" \ |
|
|
437 | install \ |
|
|
438 | || die |
|
|
439 | fi |
| 428 | # Shouldn't be necessary in XDIR=/usr |
440 | # Shouldn't be necessary in XDIR=/usr |
| 429 | # einstall forces datadir, so we need to re-force it |
441 | # einstall forces datadir, so we need to re-force it |
| 430 | # datadir=${XDIR}/share \ |
442 | # datadir=${XDIR}/share \ |
| 431 | # mandir=${XDIR}/share/man \ |
443 | # mandir=${XDIR}/share/man \ |
| 432 | |
444 | |
| … | |
… | |
| 435 | git log ${GIT_TREE} > "${S}"/ChangeLog |
447 | git log ${GIT_TREE} > "${S}"/ChangeLog |
| 436 | popd |
448 | popd |
| 437 | fi |
449 | fi |
| 438 | |
450 | |
| 439 | if [[ -e ${S}/ChangeLog ]]; then |
451 | if [[ -e ${S}/ChangeLog ]]; then |
| 440 | dodoc ${S}/ChangeLog |
452 | dodoc "${S}"/ChangeLog |
| 441 | fi |
453 | fi |
| 442 | # @VARIABLE: DOCS |
454 | # @VARIABLE: DOCS |
| 443 | # @DESCRIPTION: |
455 | # @DESCRIPTION: |
| 444 | # Any documentation to install |
456 | # Any documentation to install via dodoc |
| 445 | [[ -n ${DOCS} ]] && dodoc ${DOCS} |
457 | [[ -n ${DOCS} ]] && dodoc ${DOCS} |
| 446 | |
|
|
| 447 | # Make sure docs get compressed |
|
|
| 448 | prepalldocs |
|
|
| 449 | |
458 | |
| 450 | # Don't install libtool archives for server modules |
459 | # Don't install libtool archives for server modules |
| 451 | if [[ -e ${D}/usr/$(get_libdir)/xorg/modules ]]; then |
460 | if [[ -e ${D}/usr/$(get_libdir)/xorg/modules ]]; then |
| 452 | find ${D}/usr/$(get_libdir)/xorg/modules -name '*.la' \ |
461 | find "${D}"/usr/$(get_libdir)/xorg/modules -name '*.la' \ |
| 453 | | xargs rm -f |
462 | | xargs rm -f |
| 454 | fi |
463 | fi |
| 455 | |
464 | |
| 456 | if [[ -n "${FONT}" ]]; then |
465 | if [[ -n "${FONT}" ]]; then |
| 457 | remove_font_metadata |
466 | remove_font_metadata |
| … | |
… | |
| 487 | # @DESCRIPTION: |
496 | # @DESCRIPTION: |
| 488 | # Run X-specific post-removal tasks on the live filesystem. The only |
497 | # Run X-specific post-removal tasks on the live filesystem. The only |
| 489 | # task right now is some cleanup for font packages. |
498 | # task right now is some cleanup for font packages. |
| 490 | x-modular_pkg_postrm() { |
499 | x-modular_pkg_postrm() { |
| 491 | if [[ -n "${FONT}" ]]; then |
500 | if [[ -n "${FONT}" ]]; then |
| 492 | cleanup_fonts |
|
|
| 493 | font_pkg_postrm |
501 | font_pkg_postrm |
| 494 | fi |
502 | fi |
| 495 | } |
|
|
| 496 | |
|
|
| 497 | # @FUNCTION: cleanup_fonts |
|
|
| 498 | # @USAGE: |
|
|
| 499 | # @DESCRIPTION: |
|
|
| 500 | # Get rid of font directories that only contain generated files |
|
|
| 501 | cleanup_fonts() { |
|
|
| 502 | local ALLOWED_FILES="encodings.dir fonts.cache-1 fonts.dir fonts.scale" |
|
|
| 503 | for DIR in ${FONT_DIR}; do |
|
|
| 504 | unset KEEP_FONTDIR |
|
|
| 505 | REAL_DIR=${ROOT}usr/share/fonts/${DIR} |
|
|
| 506 | |
|
|
| 507 | ebegin "Checking ${REAL_DIR} for useless files" |
|
|
| 508 | pushd ${REAL_DIR} &> /dev/null |
|
|
| 509 | for FILE in *; do |
|
|
| 510 | unset MATCH |
|
|
| 511 | for ALLOWED_FILE in ${ALLOWED_FILES}; do |
|
|
| 512 | if [[ ${FILE} = ${ALLOWED_FILE} ]]; then |
|
|
| 513 | # If it's allowed, then move on to the next file |
|
|
| 514 | MATCH="yes" |
|
|
| 515 | break |
|
|
| 516 | fi |
|
|
| 517 | done |
|
|
| 518 | # If we found a match in allowed files, move on to the next file |
|
|
| 519 | if [[ -n ${MATCH} ]]; then |
|
|
| 520 | continue |
|
|
| 521 | fi |
|
|
| 522 | # If we get this far, there wasn't a match in the allowed files |
|
|
| 523 | KEEP_FONTDIR="yes" |
|
|
| 524 | # We don't need to check more files if we're already keeping it |
|
|
| 525 | break |
|
|
| 526 | done |
|
|
| 527 | popd &> /dev/null |
|
|
| 528 | # If there are no files worth keeping, then get rid of the dir |
|
|
| 529 | if [[ -z "${KEEP_FONTDIR}" ]]; then |
|
|
| 530 | rm -rf ${REAL_DIR} |
|
|
| 531 | fi |
|
|
| 532 | eend 0 |
|
|
| 533 | done |
|
|
| 534 | } |
503 | } |
| 535 | |
504 | |
| 536 | # @FUNCTION: setup_fonts |
505 | # @FUNCTION: setup_fonts |
| 537 | # @USAGE: |
506 | # @USAGE: |
| 538 | # @DESCRIPTION: |
507 | # @DESCRIPTION: |
| … | |
… | |
| 544 | die "${msg}" |
513 | die "${msg}" |
| 545 | fi |
514 | fi |
| 546 | |
515 | |
| 547 | create_fonts_scale |
516 | create_fonts_scale |
| 548 | create_fonts_dir |
517 | create_fonts_dir |
| 549 | fix_font_permissions |
|
|
| 550 | create_font_cache |
518 | create_font_cache |
| 551 | } |
519 | } |
| 552 | |
520 | |
| 553 | # @FUNCTION: remove_font_metadata |
521 | # @FUNCTION: remove_font_metadata |
| 554 | # @USAGE: |
522 | # @USAGE: |
| … | |
… | |
| 560 | for DIR in ${FONT_DIR}; do |
528 | for DIR in ${FONT_DIR}; do |
| 561 | if [[ "${DIR}" != "Speedo" ]] && \ |
529 | if [[ "${DIR}" != "Speedo" ]] && \ |
| 562 | [[ "${DIR}" != "CID" ]] ; then |
530 | [[ "${DIR}" != "CID" ]] ; then |
| 563 | # Delete font metadata files |
531 | # Delete font metadata files |
| 564 | # fonts.scale, fonts.dir, fonts.cache-1 |
532 | # fonts.scale, fonts.dir, fonts.cache-1 |
| 565 | rm -f ${D}/usr/share/fonts/${DIR}/fonts.{scale,dir,cache-1} |
533 | rm -f "${D}"/usr/share/fonts/${DIR}/fonts.{scale,dir,cache-1} |
| 566 | fi |
534 | fi |
| 567 | done |
535 | done |
| 568 | } |
536 | } |
| 569 | |
537 | |
| 570 | # @FUNCTION: install_driver_hwdata |
538 | # @FUNCTION: install_driver_hwdata |
| … | |
… | |
| 609 | # NOTE: There is no way to regenerate Speedo/CID fonts.scale |
577 | # NOTE: There is no way to regenerate Speedo/CID fonts.scale |
| 610 | # <dberkholz@gentoo.org> 2 August 2004 |
578 | # <dberkholz@gentoo.org> 2 August 2004 |
| 611 | if [[ "${x/encodings}" = "${x}" ]] \ |
579 | if [[ "${x/encodings}" = "${x}" ]] \ |
| 612 | && [[ -n "$(find ${x} -iname '*.[pot][ft][abcf]' -print)" ]]; then |
580 | && [[ -n "$(find ${x} -iname '*.[pot][ft][abcf]' -print)" ]]; then |
| 613 | mkfontscale \ |
581 | mkfontscale \ |
| 614 | -a ${ROOT}/usr/share/fonts/encodings/encodings.dir \ |
582 | -a "${ROOT}"/usr/share/fonts/encodings/encodings.dir \ |
| 615 | -- ${x} |
583 | -- ${x} |
| 616 | fi |
584 | fi |
| 617 | done |
585 | done |
| 618 | eend 0 |
586 | eend 0 |
| 619 | } |
587 | } |
| … | |
… | |
| 629 | [[ -z "$(ls ${x}/)" ]] && continue |
597 | [[ -z "$(ls ${x}/)" ]] && continue |
| 630 | [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue |
598 | [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue |
| 631 | |
599 | |
| 632 | if [[ "${x/encodings}" = "${x}" ]]; then |
600 | if [[ "${x/encodings}" = "${x}" ]]; then |
| 633 | mkfontdir \ |
601 | mkfontdir \ |
| 634 | -e ${ROOT}/usr/share/fonts/encodings \ |
602 | -e "${ROOT}"/usr/share/fonts/encodings \ |
| 635 | -e ${ROOT}/usr/share/fonts/encodings/large \ |
603 | -e "${ROOT}"/usr/share/fonts/encodings/large \ |
| 636 | -- ${x} |
604 | -- ${x} |
| 637 | fi |
605 | fi |
| 638 | done |
606 | done |
| 639 | eend 0 |
607 | eend 0 |
| 640 | } |
608 | } |
| 641 | |
609 | |
| 642 | # @FUNCTION: fix_font_permissions |
|
|
| 643 | # @USAGE: |
|
|
| 644 | # @DESCRIPTION: |
|
|
| 645 | # Font files should have 644 permissions. Ensure this is the case. |
|
|
| 646 | fix_font_permissions() { |
|
|
| 647 | ebegin "Fixing permissions" |
|
|
| 648 | for DIR in ${FONT_DIR}; do |
|
|
| 649 | find ${ROOT}/usr/share/fonts/${DIR} -type f -name 'font.*' \ |
|
|
| 650 | -exec chmod 0644 {} \; |
|
|
| 651 | done |
|
|
| 652 | eend 0 |
|
|
| 653 | } |
|
|
| 654 | |
|
|
| 655 | # @FUNCTION: create_font_cache |
610 | # @FUNCTION: create_font_cache |
| 656 | # @USAGE: |
611 | # @USAGE: |
| 657 | # @DESCRIPTION: |
612 | # @DESCRIPTION: |
| 658 | # Create fonts.cache-1 files, used by the new client-side fonts |
613 | # Create fonts.cache-1 files, used by the new client-side fonts |
| 659 | # subsystem. |
614 | # subsystem. |
| 660 | create_font_cache() { |
615 | create_font_cache() { |
| 661 | font_pkg_postinst |
616 | font_pkg_postinst |
| 662 | } |
617 | } |
| 663 | |
|
|
| 664 | EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm |
|
|