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

Contents of /eclass/x-modular.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.20 - (hide annotations) (download)
Fri Nov 11 05:29:41 2005 UTC (9 years, 1 month ago) by spyderous
Branch: MAIN
Changes since 1.19: +3 -2 lines
Add RC2 to SRC_URI list.

1 spyderous 1.1 # Copyright 1999-2005 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 spyderous 1.20 # $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.19 2005/11/02 06:11:29 joshuabaergen 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.13 RDEPEND="${RDEPEND}
60 joshuabaergen 1.17 !<x11-base/xorg-x11-7.0.0_rc0"
61 spyderous 1.13 # Provides virtual/x11 for temporary use until packages are ported
62 spyderous 1.1 # x11-base/x11-env"
63    
64     x-modular_unpack_source() {
65     unpack ${A}
66     cd ${S}
67 joshuabaergen 1.16
68     # Joshua Baergen - October 23, 2005
69     # Fix shared lib issues on MIPS, FBSD, etc etc
70     elibtoolize
71 spyderous 1.1 }
72    
73     x-modular_patch_source() {
74     # Use standardized names and locations with bulk patching
75     # Patch directory is ${WORKDIR}/patch
76     # See epatch() in eutils.eclass for more documentation
77     if [ -z "${EPATCH_SUFFIX}" ] ; then
78     EPATCH_SUFFIX="patch"
79     fi
80    
81     # For specific list of patches
82     if [ -n "${PATCHES}" ] ; then
83     for PATCH in ${PATCHES}
84     do
85     epatch ${PATCH}
86     done
87     # For non-default directory bulk patching
88     elif [ -n "${PATCH_LOC}" ] ; then
89     epatch ${PATCH_LOC}
90     # For standard bulk patching
91     elif [ -d "${EPATCH_SOURCE}" ] ; then
92     epatch
93     fi
94     }
95    
96     x-modular_reconf_source() {
97     # Run autoreconf for CVS snapshots only
98     if [ "${SNAPSHOT}" = "yes" ]
99     then
100     # If possible, generate configure if it doesn't exist
101     if [ -f "${S}/configure.ac" ]
102     then
103     einfo "Running autoreconf..."
104 cardoe 1.8 autoreconf -v --force --install
105 spyderous 1.1 fi
106     fi
107    
108     }
109    
110     x-modular_src_unpack() {
111     x-modular_unpack_source
112     x-modular_patch_source
113     x-modular_reconf_source
114     }
115    
116 spyderous 1.6 x-modular_src_configure() {
117 spyderous 1.1 # If prefix isn't set here, .pc files cause problems
118     if [ -x ./configure ]; then
119     econf --prefix=${XDIR} \
120     --datadir=${XDIR}/share \
121 spyderous 1.7 ${DRIVER_OPTIONS} \
122 spyderous 1.1 ${CONFIGURE_OPTIONS}
123     fi
124 spyderous 1.6 }
125    
126     x-modular_src_make() {
127 spyderous 1.1 emake || die "emake failed"
128     }
129    
130 spyderous 1.6 x-modular_src_compile() {
131     x-modular_src_configure
132     x-modular_src_make
133     }
134    
135 spyderous 1.1 x-modular_src_install() {
136     # Install everything to ${XDIR}
137     make \
138     DESTDIR="${D}" \
139     install
140     # Shouldn't be necessary in XDIR=/usr
141     # einstall forces datadir, so we need to re-force it
142     # datadir=${XDIR}/share \
143     # mandir=${XDIR}/share/man \
144 spyderous 1.7
145     # Don't install libtool archives for server modules
146     if [[ -e ${D}/usr/lib/xorg/modules ]]; then
147     find ${D}/usr/lib/xorg/modules -name '*.la' \
148     | xargs rm -f
149     fi
150 spyderous 1.1 }
151 spyderous 1.2
152 spyderous 1.4 x-modular_pkg_preinst() {
153     if [[ -n "${FONT}" ]]; then
154     discover_font_dirs
155     fi
156     }
157    
158 spyderous 1.2 x-modular_pkg_postinst() {
159     if [[ -n "${FONT}" ]]; then
160     setup_fonts
161     fi
162     }
163    
164     setup_fonts() {
165     if [[ ! -n "${FONT_DIRS}" ]]; then
166     msg="FONT_DIRS empty. Set it to at least one subdir of /usr/share/fonts."
167     eerror ${msg}
168     die ${msg}
169     fi
170    
171     create_fonts_scale
172     create_fonts_dir
173     fix_font_permissions
174     create_font_cache
175     }
176    
177 spyderous 1.4 discover_font_dirs() {
178     pushd ${IMAGE}/usr/share/fonts
179     FONT_DIRS="$(find . -maxdepth 1 -mindepth 1 -type d)"
180     FONT_DIRS="$(echo ${FONT_DIRS} | sed -e 's:./::g')"
181     popd
182     }
183    
184 spyderous 1.2 create_fonts_scale() {
185     ebegin "Creating fonts.scale files"
186     local x
187     for FONT_DIR in ${FONT_DIRS}; do
188     x=${ROOT}/usr/share/fonts/${FONT_DIR}
189     [ -z "$(ls ${x}/)" ] && continue
190     [ "$(ls ${x}/)" = "fonts.cache-1" ] && continue
191    
192     # Only generate .scale files if truetype, opentype or type1
193     # fonts are present ...
194    
195     # First truetype (ttf,ttc)
196     # NOTE: ttmkfdir does NOT work on type1 fonts (#53753)
197     # Also, there is no way to regenerate Speedo/CID fonts.scale
198     # <spyderous@gentoo.org> 2 August 2004
199     if [ "${x/encodings}" = "${x}" -a \
200     -n "$(find ${x} -iname '*.tt[cf]' -print)" ]; then
201     if [ -x ${ROOT}/usr/bin/ttmkfdir ]; then
202     LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \
203     ${ROOT}/usr/bin/ttmkfdir -x 2 \
204     -e ${ROOT}/usr/share/fonts/encodings/encodings.dir \
205     -o ${x}/fonts.scale -d ${x}
206     # ttmkfdir fails on some stuff, so try mkfontscale if it does
207     local ttmkfdir_return=$?
208     else
209     # We didn't use ttmkfdir at all
210     local ttmkfdir_return=2
211     fi
212     if [ ${ttmkfdir_return} -ne 0 ]; then
213     LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \
214     ${ROOT}/usr/bin/mkfontscale \
215     -a /usr/share/fonts/encodings/encodings.dir \
216     -- ${x}
217     fi
218     # Next type1 and opentype (pfa,pfb,otf,otc)
219     elif [ "${x/encodings}" = "${x}" -a \
220     -n "$(find ${x} -iname '*.[po][ft][abcf]' -print)" ]; then
221     LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \
222     ${ROOT}/usr/bin/mkfontscale \
223     -a ${ROOT}/usr/share/fonts/encodings/encodings.dir \
224     -- ${x}
225     fi
226     done
227     eend 0
228     }
229    
230     create_fonts_dir() {
231     ebegin "Generating fonts.dir files"
232     for FONT_DIR in ${FONT_DIRS}; do
233     x=${ROOT}/usr/share/fonts/${FONT_DIR}
234     [ -z "$(ls ${x}/)" ] && continue
235     [ "$(ls ${x}/)" = "fonts.cache-1" ] && continue
236    
237     if [ "${x/encodings}" = "${x}" ]; then
238     LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \
239     ${ROOT}/usr/bin/mkfontdir \
240     -e ${ROOT}/usr/share/fonts/encodings \
241     -e ${ROOT}/usr/share/fonts/encodings/large \
242     -- ${x}
243     fi
244     done
245     eend 0
246     }
247    
248     fix_font_permissions() {
249     ebegin "Fixing permissions"
250     for FONT_DIR in ${FONT_DIRS}; do
251     find ${ROOT}/usr/share/fonts/${FONT_DIR} -type f -name 'font.*' \
252     -exec chmod 0644 {} \;
253     done
254     eend 0
255     }
256    
257     create_font_cache() {
258     # danarmak found out that fc-cache should be run AFTER all the above
259     # stuff, as otherwise the cache is invalid, and has to be run again
260     # as root anyway
261     if [ -x ${ROOT}/usr/bin/fc-cache ]; then
262     ebegin "Creating FC font cache"
263     HOME="/root" ${ROOT}/usr/bin/fc-cache
264     eend 0
265     fi
266     }

  ViewVC Help
Powered by ViewVC 1.1.20