/[gentoo-x86]/eclass/x-modular.eclass
Gentoo

Contents of /eclass/x-modular.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.21 - (hide annotations) (download)
Tue Nov 15 03:05:06 2005 UTC (8 years, 11 months ago) by spyderous
Branch: MAIN
Changes since 1.20: +4 -2 lines
(#112480) Add RDEPEND on >=sys-apps/man-1.6b-r2 so it looks in the [0-8]x/ directories.

1 spyderous 1.1 # Copyright 1999-2005 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 spyderous 1.21 # $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.20 2005/11/11 05:29:41 spyderous Exp $
4 spyderous 1.1 #
5     # Author: Donnie Berkholz <spyderous@gentoo.org>
6     #
7     # This eclass is designed to reduce code duplication in the modularized X11
8     # ebuilds.
9 spyderous 1.2 #
10     # If the ebuild installs fonts, set FONT="yes" at the top and set FONT_DIRS to
11     # the subdirectories within /usr/share/fonts to which it installs fonts.
12 spyderous 1.1
13 spyderous 1.4 EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst
14 spyderous 1.1
15 joshuabaergen 1.16 inherit eutils libtool
16 spyderous 1.1
17     # Directory prefix to use for everything
18     XDIR="/usr"
19    
20     IUSE=""
21     HOMEPAGE="http://xorg.freedesktop.org/"
22 spyderous 1.20 SRC_URI="http://xorg.freedesktop.org/releases/X11R7.0-RC2/everything/${P}.tar.bz2
23     http://xorg.freedesktop.org/releases/X11R7.0-RC1/everything/${P}.tar.bz2
24 spyderous 1.14 http://xorg.freedesktop.org/releases/X11R7.0-RC0/everything/${P}.tar.bz2"
25 spyderous 1.1 LICENSE="X11"
26     SLOT="0"
27    
28     # Set up shared dependencies
29     if [ -n "${SNAPSHOT}" ]; then
30     # FIXME: What's the minimal libtool version supporting arbitrary versioning?
31     DEPEND="${DEPEND}
32     >=sys-devel/autoconf-2.57
33     >=sys-devel/automake-1.7
34     >=sys-devel/libtool-1.5
35     >=sys-devel/m4-1.4"
36     fi
37    
38 spyderous 1.3 # If we're a font package, but not the font.alias one
39 spyderous 1.14 if [[ "${PN/#font-}" != "${PN}" ]] && [[ "${PN}" != "font-alias" ]]; then
40 spyderous 1.4 # Activate font code in the rest of the eclass
41     FONT="yes"
42    
43 spyderous 1.3 RDEPEND="${RDEPEND}
44     media-fonts/encodings"
45     PDEPEND="${PDEPEND}
46     media-fonts/font-alias"
47     fi
48    
49 spyderous 1.7 # If we're a driver package
50 spyderous 1.12 if [[ "${PN/#xf86-video}" != "${PN}" ]] || [[ "${PN/#xf86-input}" != "${PN}" ]]; then
51 spyderous 1.7 # Don't build static driver modules
52     DRIVER_OPTIONS="--disable-static"
53     fi
54    
55 spyderous 1.1 DEPEND="${DEPEND}
56 spyderous 1.11 >=dev-util/pkgconfig-0.18
57 spyderous 1.15 >=x11-misc/util-macros-0.99.0_p20051007"
58 spyderous 1.1
59 spyderous 1.21 # >=sys-apps/man-1.6b-r2 required to look in [0-8]x/ directories
60 spyderous 1.13 RDEPEND="${RDEPEND}
61 spyderous 1.21 !<x11-base/xorg-x11-7.0.0_rc0
62     >=sys-apps/man-1.6b-r2"
63 spyderous 1.13 # Provides virtual/x11 for temporary use until packages are ported
64 spyderous 1.1 # x11-base/x11-env"
65    
66     x-modular_unpack_source() {
67     unpack ${A}
68     cd ${S}
69 joshuabaergen 1.16
70     # Joshua Baergen - October 23, 2005
71     # Fix shared lib issues on MIPS, FBSD, etc etc
72     elibtoolize
73 spyderous 1.1 }
74    
75     x-modular_patch_source() {
76     # Use standardized names and locations with bulk patching
77     # Patch directory is ${WORKDIR}/patch
78     # See epatch() in eutils.eclass for more documentation
79     if [ -z "${EPATCH_SUFFIX}" ] ; then
80     EPATCH_SUFFIX="patch"
81     fi
82    
83     # For specific list of patches
84     if [ -n "${PATCHES}" ] ; then
85     for PATCH in ${PATCHES}
86     do
87     epatch ${PATCH}
88     done
89     # For non-default directory bulk patching
90     elif [ -n "${PATCH_LOC}" ] ; then
91     epatch ${PATCH_LOC}
92     # For standard bulk patching
93     elif [ -d "${EPATCH_SOURCE}" ] ; then
94     epatch
95     fi
96     }
97    
98     x-modular_reconf_source() {
99     # Run autoreconf for CVS snapshots only
100     if [ "${SNAPSHOT}" = "yes" ]
101     then
102     # If possible, generate configure if it doesn't exist
103     if [ -f "${S}/configure.ac" ]
104     then
105     einfo "Running autoreconf..."
106 cardoe 1.8 autoreconf -v --force --install
107 spyderous 1.1 fi
108     fi
109    
110     }
111    
112     x-modular_src_unpack() {
113     x-modular_unpack_source
114     x-modular_patch_source
115     x-modular_reconf_source
116     }
117    
118 spyderous 1.6 x-modular_src_configure() {
119 spyderous 1.1 # If prefix isn't set here, .pc files cause problems
120     if [ -x ./configure ]; then
121     econf --prefix=${XDIR} \
122     --datadir=${XDIR}/share \
123 spyderous 1.7 ${DRIVER_OPTIONS} \
124 spyderous 1.1 ${CONFIGURE_OPTIONS}
125     fi
126 spyderous 1.6 }
127    
128     x-modular_src_make() {
129 spyderous 1.1 emake || die "emake failed"
130     }
131    
132 spyderous 1.6 x-modular_src_compile() {
133     x-modular_src_configure
134     x-modular_src_make
135     }
136    
137 spyderous 1.1 x-modular_src_install() {
138     # Install everything to ${XDIR}
139     make \
140     DESTDIR="${D}" \
141     install
142     # Shouldn't be necessary in XDIR=/usr
143     # einstall forces datadir, so we need to re-force it
144     # datadir=${XDIR}/share \
145     # mandir=${XDIR}/share/man \
146 spyderous 1.7
147     # Don't install libtool archives for server modules
148     if [[ -e ${D}/usr/lib/xorg/modules ]]; then
149     find ${D}/usr/lib/xorg/modules -name '*.la' \
150     | xargs rm -f
151     fi
152 spyderous 1.1 }
153 spyderous 1.2
154 spyderous 1.4 x-modular_pkg_preinst() {
155     if [[ -n "${FONT}" ]]; then
156     discover_font_dirs
157     fi
158     }
159    
160 spyderous 1.2 x-modular_pkg_postinst() {
161     if [[ -n "${FONT}" ]]; then
162     setup_fonts
163     fi
164     }
165    
166     setup_fonts() {
167     if [[ ! -n "${FONT_DIRS}" ]]; then
168     msg="FONT_DIRS empty. Set it to at least one subdir of /usr/share/fonts."
169     eerror ${msg}
170     die ${msg}
171     fi
172    
173     create_fonts_scale
174     create_fonts_dir
175     fix_font_permissions
176     create_font_cache
177     }
178    
179 spyderous 1.4 discover_font_dirs() {
180     pushd ${IMAGE}/usr/share/fonts
181     FONT_DIRS="$(find . -maxdepth 1 -mindepth 1 -type d)"
182     FONT_DIRS="$(echo ${FONT_DIRS} | sed -e 's:./::g')"
183     popd
184     }
185    
186 spyderous 1.2 create_fonts_scale() {
187     ebegin "Creating fonts.scale files"
188     local x
189     for FONT_DIR in ${FONT_DIRS}; do
190     x=${ROOT}/usr/share/fonts/${FONT_DIR}
191     [ -z "$(ls ${x}/)" ] && continue
192     [ "$(ls ${x}/)" = "fonts.cache-1" ] && continue
193    
194     # Only generate .scale files if truetype, opentype or type1
195     # fonts are present ...
196    
197     # First truetype (ttf,ttc)
198     # NOTE: ttmkfdir does NOT work on type1 fonts (#53753)
199     # Also, there is no way to regenerate Speedo/CID fonts.scale
200     # <spyderous@gentoo.org> 2 August 2004
201     if [ "${x/encodings}" = "${x}" -a \
202     -n "$(find ${x} -iname '*.tt[cf]' -print)" ]; then
203     if [ -x ${ROOT}/usr/bin/ttmkfdir ]; then
204     LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \
205     ${ROOT}/usr/bin/ttmkfdir -x 2 \
206     -e ${ROOT}/usr/share/fonts/encodings/encodings.dir \
207     -o ${x}/fonts.scale -d ${x}
208     # ttmkfdir fails on some stuff, so try mkfontscale if it does
209     local ttmkfdir_return=$?
210     else
211     # We didn't use ttmkfdir at all
212     local ttmkfdir_return=2
213     fi
214     if [ ${ttmkfdir_return} -ne 0 ]; then
215     LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \
216     ${ROOT}/usr/bin/mkfontscale \
217     -a /usr/share/fonts/encodings/encodings.dir \
218     -- ${x}
219     fi
220     # Next type1 and opentype (pfa,pfb,otf,otc)
221     elif [ "${x/encodings}" = "${x}" -a \
222     -n "$(find ${x} -iname '*.[po][ft][abcf]' -print)" ]; then
223     LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \
224     ${ROOT}/usr/bin/mkfontscale \
225     -a ${ROOT}/usr/share/fonts/encodings/encodings.dir \
226     -- ${x}
227     fi
228     done
229     eend 0
230     }
231    
232     create_fonts_dir() {
233     ebegin "Generating fonts.dir files"
234     for FONT_DIR in ${FONT_DIRS}; do
235     x=${ROOT}/usr/share/fonts/${FONT_DIR}
236     [ -z "$(ls ${x}/)" ] && continue
237     [ "$(ls ${x}/)" = "fonts.cache-1" ] && continue
238    
239     if [ "${x/encodings}" = "${x}" ]; then
240     LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \
241     ${ROOT}/usr/bin/mkfontdir \
242     -e ${ROOT}/usr/share/fonts/encodings \
243     -e ${ROOT}/usr/share/fonts/encodings/large \
244     -- ${x}
245     fi
246     done
247     eend 0
248     }
249    
250     fix_font_permissions() {
251     ebegin "Fixing permissions"
252     for FONT_DIR in ${FONT_DIRS}; do
253     find ${ROOT}/usr/share/fonts/${FONT_DIR} -type f -name 'font.*' \
254     -exec chmod 0644 {} \;
255     done
256     eend 0
257     }
258    
259     create_font_cache() {
260     # danarmak found out that fc-cache should be run AFTER all the above
261     # stuff, as otherwise the cache is invalid, and has to be run again
262     # as root anyway
263     if [ -x ${ROOT}/usr/bin/fc-cache ]; then
264     ebegin "Creating FC font cache"
265     HOME="/root" ${ROOT}/usr/bin/fc-cache
266     eend 0
267     fi
268     }

  ViewVC Help
Powered by ViewVC 1.1.20