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

Contents of /eclass/x-modular.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.23 - (hide annotations) (download)
Sun Dec 4 18:23:43 2005 UTC (8 years, 10 months ago) by joshuabaergen
Branch: MAIN
Changes since 1.22: +3 -2 lines
Update package path for RC3.

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

  ViewVC Help
Powered by ViewVC 1.1.20