| 1 | # Copyright 1999-2010 Gentoo Foundation |
1 | # Copyright 1999-2010 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/xorg-2.eclass,v 1.1 2010/03/14 10:27:07 scarabeus Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/xorg-2.eclass,v 1.8 2010/08/06 20:46:08 scarabeus Exp $ |
| 4 | # |
4 | # |
| 5 | # @ECLASS: xorg-2.eclass |
5 | # @ECLASS: xorg-2.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # x11@gentoo.org |
7 | # x11@gentoo.org |
| 8 | |
|
|
| 9 | # Author: Tomáš Chvátal <scarabeus@gentoo.org> |
|
|
| 10 | # Author: Donnie Berkholz <dberkholz@gentoo.org> |
|
|
| 11 | # @BLURB: Reduces code duplication in the modularized X11 ebuilds. |
8 | # @BLURB: Reduces code duplication in the modularized X11 ebuilds. |
| 12 | # @DESCRIPTION: |
9 | # @DESCRIPTION: |
| 13 | # This eclass makes trivial X ebuilds possible for apps, fonts, drivers, |
10 | # This eclass makes trivial X ebuilds possible for apps, fonts, drivers, |
| 14 | # and more. Many things that would normally be done in various functions |
11 | # and more. Many things that would normally be done in various functions |
| 15 | # can be accessed by setting variables instead, such as patching, |
12 | # can be accessed by setting variables instead, such as patching, |
| … | |
… | |
| 17 | # |
14 | # |
| 18 | # 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 |
| 19 | # DESCRIPTION, KEYWORDS and RDEPEND/DEPEND. If your package is hosted |
16 | # 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 |
17 | # with the other X packages, you don't need to set SRC_URI. Pretty much |
| 21 | # everything else should be automatic. |
18 | # everything else should be automatic. |
|
|
19 | |
|
|
20 | # Author: Tomáš Chvátal <scarabeus@gentoo.org> |
|
|
21 | # Author: Donnie Berkholz <dberkholz@gentoo.org> |
| 22 | |
22 | |
| 23 | GIT_ECLASS="" |
23 | GIT_ECLASS="" |
| 24 | if [[ ${PV} == *9999* ]]; then |
24 | if [[ ${PV} == *9999* ]]; then |
| 25 | GIT_ECLASS="git" |
25 | GIT_ECLASS="git" |
| 26 | XORG_EAUTORECONF="yes" |
26 | XORG_EAUTORECONF="yes" |
| … | |
… | |
| 89 | : ${SLOT:=0} |
89 | : ${SLOT:=0} |
| 90 | |
90 | |
| 91 | # Set the license for the package. This can be overridden by setting |
91 | # Set the license for the package. This can be overridden by setting |
| 92 | # LICENSE after the inherit. Nearly all FreeDesktop-hosted X packages |
92 | # LICENSE after the inherit. Nearly all FreeDesktop-hosted X packages |
| 93 | # are under the MIT license. (This is what Red Hat does in their rpms) |
93 | # are under the MIT license. (This is what Red Hat does in their rpms) |
| 94 | : ${LICENSE=MIT} |
94 | : ${LICENSE:=MIT} |
| 95 | |
95 | |
| 96 | # Set up shared dependencies |
96 | # Set up shared dependencies |
| 97 | if [[ ${XORG_EAUTORECONF} != no ]]; then |
97 | if [[ ${XORG_EAUTORECONF} != no ]]; then |
| 98 | DEPEND+=" |
98 | DEPEND+=" |
| 99 | >=sys-devel/libtool-2.2.6a |
99 | >=sys-devel/libtool-2.2.6a |
| 100 | sys-devel/m4" |
100 | sys-devel/m4" |
| 101 | # This MUST BE STABLE |
101 | # This MUST BE STABLE |
| 102 | if [[ ${PN} != util-macros ]] ; then |
102 | if [[ ${PN} != util-macros ]] ; then |
| 103 | DEPEND+=" >=x11-misc/util-macros-1.5.0" |
103 | DEPEND+=" >=x11-misc/util-macros-1.8.0" |
| 104 | # Required even by xorg-server |
104 | # Required even by xorg-server |
| 105 | [[ ${PN} == "font-util" ]] || DEPEND+=" >=media-fonts/font-util-1.1.1-r1" |
105 | [[ ${PN} == "font-util" ]] || DEPEND+=" >=media-fonts/font-util-1.1.1-r1" |
| 106 | fi |
106 | fi |
| 107 | WANT_AUTOCONF="latest" |
107 | WANT_AUTOCONF="latest" |
| 108 | WANT_AUTOMAKE="latest" |
108 | WANT_AUTOMAKE="latest" |
| … | |
… | |
| 135 | fi |
135 | fi |
| 136 | |
136 | |
| 137 | # If we're a driver package, then enable DRIVER case |
137 | # If we're a driver package, then enable DRIVER case |
| 138 | [[ ${PN} == xf86-video-* || ${PN} == xf86-input-* ]] && DRIVER="yes" |
138 | [[ ${PN} == xf86-video-* || ${PN} == xf86-input-* ]] && DRIVER="yes" |
| 139 | |
139 | |
|
|
140 | # @ECLASS-VARIABLE: XORG_STATIC |
|
|
141 | # @DESCRIPTION: |
|
|
142 | # Enables static-libs useflag. Set to no, if your package gets: |
|
|
143 | # |
|
|
144 | # QA: configure: WARNING: unrecognized options: --disable-static |
|
|
145 | : ${XORG_STATIC:="yes"} |
|
|
146 | |
| 140 | # Add static-libs useflag where usefull. |
147 | # Add static-libs useflag where usefull. |
|
|
148 | if [[ ${XORG_STATIC} == yes \ |
| 141 | if [[ ${FONT} != yes \ |
149 | && ${FONT} != yes \ |
| 142 | && ${CATEGORY} != app-doc \ |
150 | && ${CATEGORY} != app-doc \ |
| 143 | && ${CATEGORY} != x11-proto \ |
151 | && ${CATEGORY} != x11-proto \ |
| 144 | && ${CATEGORY} != x11-drivers \ |
152 | && ${CATEGORY} != x11-drivers \ |
| 145 | && ${CATEGORY} != media-fonts \ |
153 | && ${CATEGORY} != media-fonts \ |
| 146 | && ${PN} != util-macros \ |
154 | && ${PN} != util-macros \ |
| … | |
… | |
| 188 | # See epatch() in eutils.eclass for more documentation |
196 | # See epatch() in eutils.eclass for more documentation |
| 189 | EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch} |
197 | EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch} |
| 190 | |
198 | |
| 191 | [[ -d "${EPATCH_SOURCE}" ]] && epatch |
199 | [[ -d "${EPATCH_SOURCE}" ]] && epatch |
| 192 | base_src_prepare |
200 | base_src_prepare |
| 193 | epatch_user |
|
|
| 194 | } |
201 | } |
| 195 | |
202 | |
| 196 | # @FUNCTION: xorg-2_reconf_source |
203 | # @FUNCTION: xorg-2_reconf_source |
| 197 | # @USAGE: |
204 | # @USAGE: |
| 198 | # @DESCRIPTION: |
205 | # @DESCRIPTION: |
| 199 | # Run eautoreconf if necessary, and run elibtoolize. |
206 | # Run eautoreconf if necessary, and run elibtoolize. |
| 200 | xorg-2_reconf_source() { |
207 | xorg-2_reconf_source() { |
| 201 | case ${CHOST} in |
208 | case ${CHOST} in |
| 202 | *-interix* | *-aix* | *-winnt*) |
209 | *-interix* | *-aix* | *-winnt*) |
| 203 | # some hosts need full eautoreconf |
210 | # some hosts need full eautoreconf |
| 204 | [[ -e "./configure.ac" ]] && eautoreconf || ewarn "Unable to autoreconf the configure script. Things may fail." |
211 | [[ -e "./configure.ac" || -e "./configure.in" ]] && eautoreconf || ewarn "Unable to autoreconf the configure script. Things may fail." |
| 205 | ;; |
212 | ;; |
| 206 | *) |
213 | *) |
| 207 | # elibtoolize required for BSD |
214 | # elibtoolize required for BSD |
| 208 | [[ ${XORG_EAUTORECONF} != no && -e "./configure.ac" ]] && eautoreconf || elibtoolize |
215 | [[ ${XORG_EAUTORECONF} != no && ( -e "./configure.ac" || -e "./configure.in" ) ]] && eautoreconf || elibtoolize |
| 209 | ;; |
216 | ;; |
| 210 | esac |
217 | esac |
| 211 | } |
218 | } |
| 212 | |
219 | |
| 213 | # @FUNCTION: xorg-2_src_prepare |
220 | # @FUNCTION: xorg-2_src_prepare |
| … | |
… | |
| 348 | # @DESCRIPTION: |
355 | # @DESCRIPTION: |
| 349 | # Run X-specific post-removal tasks on the live filesystem. The only |
356 | # Run X-specific post-removal tasks on the live filesystem. The only |
| 350 | # task right now is some cleanup for font packages. |
357 | # task right now is some cleanup for font packages. |
| 351 | xorg-2_pkg_postrm() { |
358 | xorg-2_pkg_postrm() { |
| 352 | if [[ -n ${FONT} ]]; then |
359 | if [[ -n ${FONT} ]]; then |
| 353 | cleanup_fonts |
|
|
| 354 | font_pkg_postrm |
360 | font_pkg_postrm |
| 355 | fi |
361 | fi |
| 356 | } |
|
|
| 357 | |
|
|
| 358 | # @FUNCTION: cleanup_fonts |
|
|
| 359 | # @USAGE: |
|
|
| 360 | # @DESCRIPTION: |
|
|
| 361 | # Get rid of font directories that only contain generated files |
|
|
| 362 | cleanup_fonts() { |
|
|
| 363 | local allowed_files="encodings.dir fonts.alias fonts.cache-1 fonts.dir fonts.scale" |
|
|
| 364 | local real_dir=${EROOT}usr/share/fonts/${FONT_DIR} |
|
|
| 365 | local fle allowed_file |
|
|
| 366 | |
|
|
| 367 | unset KEEP_FONTDIR |
|
|
| 368 | |
|
|
| 369 | einfo "Checking ${real_dir} for useless files" |
|
|
| 370 | pushd ${real_dir} &> /dev/null |
|
|
| 371 | for fle in *; do |
|
|
| 372 | unset MATCH |
|
|
| 373 | for allowed_file in ${allowed_files}; do |
|
|
| 374 | if [[ ${fle} = ${allowed_file} ]]; then |
|
|
| 375 | # If it's allowed, then move on to the next file |
|
|
| 376 | MATCH="yes" |
|
|
| 377 | break |
|
|
| 378 | fi |
|
|
| 379 | done |
|
|
| 380 | # If we found a match in allowed files, move on to the next file |
|
|
| 381 | [[ -n ${MATCH} ]] && continue |
|
|
| 382 | # If we get this far, there wasn't a match in the allowed files |
|
|
| 383 | KEEP_FONTDIR="yes" |
|
|
| 384 | # We don't need to check more files if we're already keeping it |
|
|
| 385 | break |
|
|
| 386 | done |
|
|
| 387 | popd &> /dev/null |
|
|
| 388 | # If there are no files worth keeping, then get rid of the dir |
|
|
| 389 | [[ -z "${KEEP_FONTDIR}" ]] && rm -rf ${real_dir} |
|
|
| 390 | } |
362 | } |
| 391 | |
363 | |
| 392 | # @FUNCTION: setup_fonts |
364 | # @FUNCTION: setup_fonts |
| 393 | # @USAGE: |
365 | # @USAGE: |
| 394 | # @DESCRIPTION: |
366 | # @DESCRIPTION: |