| 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.27 2005/12/09 16:13:54 spyderous Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.30 2005/12/10 21:49:07 spyderous Exp $ |
| 4 | # |
4 | # |
| 5 | # Author: Donnie Berkholz <spyderous@gentoo.org> |
5 | # Author: Donnie Berkholz <spyderous@gentoo.org> |
| 6 | # |
6 | # |
| 7 | # This eclass is designed to reduce code duplication in the modularized X11 |
7 | # This eclass is designed to reduce code duplication in the modularized X11 |
| 8 | # ebuilds. |
8 | # ebuilds. |
| … | |
… | |
| 15 | inherit eutils libtool toolchain-funcs |
15 | inherit eutils libtool toolchain-funcs |
| 16 | |
16 | |
| 17 | # Directory prefix to use for everything |
17 | # Directory prefix to use for everything |
| 18 | XDIR="/usr" |
18 | XDIR="/usr" |
| 19 | |
19 | |
|
|
20 | # Set up default patchset version(s) if necessary |
|
|
21 | # x11-driver-patches |
|
|
22 | if [[ -z "${XDPVER}" ]]; then |
|
|
23 | XDPVER="1" |
|
|
24 | fi |
|
|
25 | |
| 20 | IUSE="" |
26 | IUSE="" |
| 21 | HOMEPAGE="http://xorg.freedesktop.org/" |
27 | HOMEPAGE="http://xorg.freedesktop.org/" |
| 22 | SRC_URI="http://xorg.freedesktop.org/releases/X11R7.0-RC3/everything/${P}.tar.bz2 |
28 | SRC_URI="http://xorg.freedesktop.org/releases/X11R7.0-RC3/everything/${P}.tar.bz2 |
| 23 | http://xorg.freedesktop.org/releases/X11R7.0-RC2/everything/${P}.tar.bz2 |
29 | http://xorg.freedesktop.org/releases/X11R7.0-RC2/everything/${P}.tar.bz2 |
| 24 | http://xorg.freedesktop.org/releases/X11R7.0-RC1/everything/${P}.tar.bz2 |
30 | http://xorg.freedesktop.org/releases/X11R7.0-RC1/everything/${P}.tar.bz2 |
| 25 | http://xorg.freedesktop.org/releases/X11R7.0-RC0/everything/${P}.tar.bz2" |
31 | http://xorg.freedesktop.org/releases/X11R7.0-RC0/everything/${P}.tar.bz2" |
| 26 | LICENSE="X11" |
32 | LICENSE="X11" |
| 27 | SLOT="0" |
33 | SLOT="0" |
| 28 | |
34 | |
| 29 | # Set up shared dependencies |
35 | # Set up shared dependencies |
| 30 | if [ -n "${SNAPSHOT}" ]; then |
36 | if [[ -n "${SNAPSHOT}" ]]; then |
| 31 | # FIXME: What's the minimal libtool version supporting arbitrary versioning? |
37 | # FIXME: What's the minimal libtool version supporting arbitrary versioning? |
| 32 | DEPEND="${DEPEND} |
38 | DEPEND="${DEPEND} |
| 33 | >=sys-devel/autoconf-2.57 |
39 | >=sys-devel/autoconf-2.57 |
| 34 | >=sys-devel/automake-1.7 |
40 | >=sys-devel/automake-1.7 |
| 35 | >=sys-devel/libtool-1.5 |
41 | >=sys-devel/libtool-1.5 |
| … | |
… | |
| 43 | # Activate font code in the rest of the eclass |
49 | # Activate font code in the rest of the eclass |
| 44 | FONT="yes" |
50 | FONT="yes" |
| 45 | |
51 | |
| 46 | RDEPEND="${RDEPEND} |
52 | RDEPEND="${RDEPEND} |
| 47 | media-fonts/encodings" |
53 | media-fonts/encodings" |
|
|
54 | DEPEND="${DEPEND} |
|
|
55 | x11-apps/mkfontscale |
|
|
56 | x11-apps/mkfontdir" |
| 48 | PDEPEND="${PDEPEND} |
57 | PDEPEND="${PDEPEND} |
| 49 | media-fonts/font-alias" |
58 | media-fonts/font-alias" |
| 50 | |
59 | |
| 51 | # Starting with 7.0RC3, we can specify the font directory |
60 | # Starting with 7.0RC3, we can specify the font directory |
| 52 | # But oddly, we can't do the same for encodings or font-alias |
61 | # But oddly, we can't do the same for encodings or font-alias |
| … | |
… | |
| 75 | |
84 | |
| 76 | # If we're a driver package |
85 | # If we're a driver package |
| 77 | if [[ "${PN/#xf86-video}" != "${PN}" ]] || [[ "${PN/#xf86-input}" != "${PN}" ]]; then |
86 | if [[ "${PN/#xf86-video}" != "${PN}" ]] || [[ "${PN/#xf86-input}" != "${PN}" ]]; then |
| 78 | # Don't build static driver modules |
87 | # Don't build static driver modules |
| 79 | DRIVER_OPTIONS="--disable-static" |
88 | DRIVER_OPTIONS="--disable-static" |
|
|
89 | |
|
|
90 | # Enable driver code in the rest of the eclass |
|
|
91 | DRIVER="yes" |
|
|
92 | |
|
|
93 | # Add driver patchset to SRC_URI |
|
|
94 | SRC_URI="${SRC_URI} |
|
|
95 | http://dev.gentoo.org/~joshuabaergen/distfiles/x11-driver-patches-${XDPVER}.tar.bz2" |
| 80 | fi |
96 | fi |
| 81 | |
97 | |
| 82 | DEPEND="${DEPEND} |
98 | DEPEND="${DEPEND} |
| 83 | >=dev-util/pkgconfig-0.18 |
99 | >=dev-util/pkgconfig-0.18 |
| 84 | >=x11-misc/util-macros-0.99.2" |
100 | >=x11-misc/util-macros-0.99.2" |
| … | |
… | |
| 101 | |
117 | |
| 102 | x-modular_patch_source() { |
118 | x-modular_patch_source() { |
| 103 | # Use standardized names and locations with bulk patching |
119 | # Use standardized names and locations with bulk patching |
| 104 | # Patch directory is ${WORKDIR}/patch |
120 | # Patch directory is ${WORKDIR}/patch |
| 105 | # See epatch() in eutils.eclass for more documentation |
121 | # See epatch() in eutils.eclass for more documentation |
| 106 | if [ -z "${EPATCH_SUFFIX}" ] ; then |
122 | if [[ -z "${EPATCH_SUFFIX}" ]] ; then |
| 107 | EPATCH_SUFFIX="patch" |
123 | EPATCH_SUFFIX="patch" |
| 108 | fi |
124 | fi |
| 109 | |
125 | |
|
|
126 | # If this is a driver package we need to fix man page install location. |
|
|
127 | # Running autoreconf will use the patched util-macros to make the |
|
|
128 | # change for us, so we only need to patch if it is not going to run. |
|
|
129 | if [[ -n "${DRIVER}" ]] && [[ "${SNAPSHOT}" != "yes" ]]; then |
|
|
130 | PATCHES="${PATCHES} ${DISTDIR}/x11-driver-patches-${XDPVER}.tar.bz2" |
|
|
131 | fi |
|
|
132 | |
| 110 | # For specific list of patches |
133 | # For specific list of patches |
| 111 | if [ -n "${PATCHES}" ] ; then |
134 | if [[ -n "${PATCHES}" ]] ; then |
| 112 | for PATCH in ${PATCHES} |
135 | for PATCH in ${PATCHES} |
| 113 | do |
136 | do |
| 114 | epatch ${PATCH} |
137 | epatch ${PATCH} |
| 115 | done |
138 | done |
| 116 | # For non-default directory bulk patching |
139 | # For non-default directory bulk patching |
| 117 | elif [ -n "${PATCH_LOC}" ] ; then |
140 | elif [[ -n "${PATCH_LOC}" ]] ; then |
| 118 | epatch ${PATCH_LOC} |
141 | epatch ${PATCH_LOC} |
| 119 | # For standard bulk patching |
142 | # For standard bulk patching |
| 120 | elif [ -d "${EPATCH_SOURCE}" ] ; then |
143 | elif [[ -d "${EPATCH_SOURCE}" ]] ; then |
| 121 | epatch |
144 | epatch |
| 122 | fi |
145 | fi |
| 123 | } |
146 | } |
| 124 | |
147 | |
| 125 | x-modular_reconf_source() { |
148 | x-modular_reconf_source() { |
| 126 | # Run autoreconf for CVS snapshots only |
149 | # Run autoreconf for CVS snapshots only |
| 127 | if [ "${SNAPSHOT}" = "yes" ] |
150 | if [[ "${SNAPSHOT}" = "yes" ]] |
| 128 | then |
151 | then |
| 129 | # If possible, generate configure if it doesn't exist |
152 | # If possible, generate configure if it doesn't exist |
| 130 | if [ -f "${S}/configure.ac" ] |
153 | if [ -f "${S}/configure.ac" ] |
| 131 | then |
154 | then |
| 132 | einfo "Running autoreconf..." |
155 | einfo "Running autoreconf..." |
| … | |
… | |
| 135 | fi |
158 | fi |
| 136 | |
159 | |
| 137 | } |
160 | } |
| 138 | |
161 | |
| 139 | x-modular_src_unpack() { |
162 | x-modular_src_unpack() { |
| 140 | for x in xorg-server xf86-video- xf86-input- ; do |
163 | if [[ ${PN:0:11} = "xorg-server" ]] || [[ -n "${DRIVER}" ]]; then |
| 141 | if [[ ${PN:0:11} = $x ]] && gcc-specs-now; then |
164 | if gcc-specs-now; then |
| 142 | msg="Do not emerge ${PN} without vanilla gcc!" |
165 | msg="Do not emerge ${PN} without vanilla gcc!" |
| 143 | eerror "$msg" |
166 | eerror "$msg" |
| 144 | die "$msg" |
167 | die "$msg" |
| 145 | fi |
168 | fi |
| 146 | done |
169 | fi |
| 147 | |
170 | |
| 148 | x-modular_unpack_source |
171 | x-modular_unpack_source |
| 149 | x-modular_patch_source |
172 | x-modular_patch_source |
| 150 | x-modular_reconf_source |
173 | x-modular_reconf_source |
| 151 | |
174 | |
| … | |
… | |
| 183 | |
206 | |
| 184 | x-modular_src_configure() { |
207 | x-modular_src_configure() { |
| 185 | x-modular_font_configure |
208 | x-modular_font_configure |
| 186 | |
209 | |
| 187 | # If prefix isn't set here, .pc files cause problems |
210 | # If prefix isn't set here, .pc files cause problems |
| 188 | if [ -x ./configure ]; then |
211 | if [[ -x ./configure ]]; then |
| 189 | econf --prefix=${XDIR} \ |
212 | econf --prefix=${XDIR} \ |
| 190 | --datadir=${XDIR}/share \ |
213 | --datadir=${XDIR}/share \ |
| 191 | ${FONT_OPTIONS} \ |
214 | ${FONT_OPTIONS} \ |
| 192 | ${DRIVER_OPTIONS} \ |
215 | ${DRIVER_OPTIONS} \ |
| 193 | ${CONFIGURE_OPTIONS} |
216 | ${CONFIGURE_OPTIONS} |
| … | |
… | |
| 296 | create_fonts_scale() { |
319 | create_fonts_scale() { |
| 297 | ebegin "Creating fonts.scale files" |
320 | ebegin "Creating fonts.scale files" |
| 298 | local x |
321 | local x |
| 299 | for FONT_DIR in ${FONT_DIRS}; do |
322 | for FONT_DIR in ${FONT_DIRS}; do |
| 300 | x=${ROOT}/usr/share/fonts/${FONT_DIR} |
323 | x=${ROOT}/usr/share/fonts/${FONT_DIR} |
| 301 | [ -z "$(ls ${x}/)" ] && continue |
324 | [[ -z "$(ls ${x}/)" ]] && continue |
| 302 | [ "$(ls ${x}/)" = "fonts.cache-1" ] && continue |
325 | [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue |
| 303 | |
326 | |
| 304 | # Only generate .scale files if truetype, opentype or type1 |
327 | # Only generate .scale files if truetype, opentype or type1 |
| 305 | # fonts are present ... |
328 | # fonts are present ... |
| 306 | |
329 | |
| 307 | # First truetype (ttf,ttc) |
330 | # First truetype (ttf,ttc) |
| 308 | # NOTE: ttmkfdir does NOT work on type1 fonts (#53753) |
331 | # NOTE: ttmkfdir does NOT work on type1 fonts (#53753) |
| 309 | # Also, there is no way to regenerate Speedo/CID fonts.scale |
332 | # Also, there is no way to regenerate Speedo/CID fonts.scale |
| 310 | # <spyderous@gentoo.org> 2 August 2004 |
333 | # <spyderous@gentoo.org> 2 August 2004 |
| 311 | if [ "${x/encodings}" = "${x}" -a \ |
334 | if [[ "${x/encodings}" = "${x}" ]] \ |
| 312 | -n "$(find ${x} -iname '*.tt[cf]' -print)" ]; then |
335 | && [[ -n "$(find ${x} -iname '*.tt[cf]' -print)" ]]; then |
| 313 | if [ -x ${ROOT}/usr/bin/ttmkfdir ]; then |
336 | if [[ -x ${ROOT}/usr/bin/ttmkfdir ]]; then |
| 314 | LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ |
337 | LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ |
| 315 | ${ROOT}/usr/bin/ttmkfdir -x 2 \ |
338 | ${ROOT}/usr/bin/ttmkfdir -x 2 \ |
| 316 | -e ${ROOT}/usr/share/fonts/encodings/encodings.dir \ |
339 | -e ${ROOT}/usr/share/fonts/encodings/encodings.dir \ |
| 317 | -o ${x}/fonts.scale -d ${x} |
340 | -o ${x}/fonts.scale -d ${x} |
| 318 | # ttmkfdir fails on some stuff, so try mkfontscale if it does |
341 | # ttmkfdir fails on some stuff, so try mkfontscale if it does |
| 319 | local ttmkfdir_return=$? |
342 | local ttmkfdir_return=$? |
| 320 | else |
343 | else |
| 321 | # We didn't use ttmkfdir at all |
344 | # We didn't use ttmkfdir at all |
| 322 | local ttmkfdir_return=2 |
345 | local ttmkfdir_return=2 |
| 323 | fi |
346 | fi |
| 324 | if [ ${ttmkfdir_return} -ne 0 ]; then |
347 | if [[ ${ttmkfdir_return} -ne 0 ]]; then |
| 325 | LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ |
348 | LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ |
| 326 | ${ROOT}/usr/bin/mkfontscale \ |
349 | ${ROOT}/usr/bin/mkfontscale \ |
| 327 | -a /usr/share/fonts/encodings/encodings.dir \ |
350 | -a /usr/share/fonts/encodings/encodings.dir \ |
| 328 | -- ${x} |
351 | -- ${x} |
| 329 | fi |
352 | fi |
| 330 | # Next type1 and opentype (pfa,pfb,otf,otc) |
353 | # Next type1 and opentype (pfa,pfb,otf,otc) |
| 331 | elif [ "${x/encodings}" = "${x}" -a \ |
354 | elif [[ "${x/encodings}" = "${x}" ]] \ |
| 332 | -n "$(find ${x} -iname '*.[po][ft][abcf]' -print)" ]; then |
355 | && [[ -n "$(find ${x} -iname '*.[po][ft][abcf]' -print)" ]]; then |
| 333 | LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ |
356 | LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ |
| 334 | ${ROOT}/usr/bin/mkfontscale \ |
357 | ${ROOT}/usr/bin/mkfontscale \ |
| 335 | -a ${ROOT}/usr/share/fonts/encodings/encodings.dir \ |
358 | -a ${ROOT}/usr/share/fonts/encodings/encodings.dir \ |
| 336 | -- ${x} |
359 | -- ${x} |
| 337 | fi |
360 | fi |
| … | |
… | |
| 341 | |
364 | |
| 342 | create_fonts_dir() { |
365 | create_fonts_dir() { |
| 343 | ebegin "Generating fonts.dir files" |
366 | ebegin "Generating fonts.dir files" |
| 344 | for FONT_DIR in ${FONT_DIRS}; do |
367 | for FONT_DIR in ${FONT_DIRS}; do |
| 345 | x=${ROOT}/usr/share/fonts/${FONT_DIR} |
368 | x=${ROOT}/usr/share/fonts/${FONT_DIR} |
| 346 | [ -z "$(ls ${x}/)" ] && continue |
369 | [[ -z "$(ls ${x}/)" ]] && continue |
| 347 | [ "$(ls ${x}/)" = "fonts.cache-1" ] && continue |
370 | [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue |
| 348 | |
371 | |
| 349 | if [ "${x/encodings}" = "${x}" ]; then |
372 | if [[ "${x/encodings}" = "${x}" ]]; then |
| 350 | LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ |
373 | LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ |
| 351 | ${ROOT}/usr/bin/mkfontdir \ |
374 | ${ROOT}/usr/bin/mkfontdir \ |
| 352 | -e ${ROOT}/usr/share/fonts/encodings \ |
375 | -e ${ROOT}/usr/share/fonts/encodings \ |
| 353 | -e ${ROOT}/usr/share/fonts/encodings/large \ |
376 | -e ${ROOT}/usr/share/fonts/encodings/large \ |
| 354 | -- ${x} |
377 | -- ${x} |
| … | |
… | |
| 368 | |
391 | |
| 369 | create_font_cache() { |
392 | create_font_cache() { |
| 370 | # danarmak found out that fc-cache should be run AFTER all the above |
393 | # danarmak found out that fc-cache should be run AFTER all the above |
| 371 | # stuff, as otherwise the cache is invalid, and has to be run again |
394 | # stuff, as otherwise the cache is invalid, and has to be run again |
| 372 | # as root anyway |
395 | # as root anyway |
| 373 | if [ -x ${ROOT}/usr/bin/fc-cache ]; then |
396 | if [[ -x ${ROOT}/usr/bin/fc-cache ]]; then |
| 374 | ebegin "Creating FC font cache" |
397 | ebegin "Creating FC font cache" |
| 375 | HOME="/root" ${ROOT}/usr/bin/fc-cache |
398 | HOME="/root" ${ROOT}/usr/bin/fc-cache |
| 376 | eend 0 |
399 | eend 0 |
| 377 | fi |
400 | fi |
| 378 | } |
401 | } |