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

Contents of /eclass/x-modular.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.17 - (hide annotations) (download)
Sun Oct 30 05:32:27 2005 UTC (9 years ago) by joshuabaergen
Branch: MAIN
Changes since 1.16: +2 -2 lines
Modify block so that release candidate metabuilds are allowed.

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

  ViewVC Help
Powered by ViewVC 1.1.20