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

Contents of /eclass/x-modular.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.22 - (show annotations) (download)
Wed Nov 16 05:01:36 2005 UTC (8 years, 11 months ago) by joshuabaergen
Branch: MAIN
Changes since 1.21: +2 -2 lines
Changed xorg-x11 blocker for clarity.

1 # Copyright 1999-2005 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.21 2005/11/15 03:05:06 spyderous Exp $
4 #
5 # Author: Donnie Berkholz <spyderous@gentoo.org>
6 #
7 # This eclass is designed to reduce code duplication in the modularized X11
8 # ebuilds.
9 #
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
13 EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst
14
15 inherit eutils libtool
16
17 # Directory prefix to use for everything
18 XDIR="/usr"
19
20 IUSE=""
21 HOMEPAGE="http://xorg.freedesktop.org/"
22 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 http://xorg.freedesktop.org/releases/X11R7.0-RC0/everything/${P}.tar.bz2"
25 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 # If we're a font package, but not the font.alias one
39 if [[ "${PN/#font-}" != "${PN}" ]] && [[ "${PN}" != "font-alias" ]]; then
40 # Activate font code in the rest of the eclass
41 FONT="yes"
42
43 RDEPEND="${RDEPEND}
44 media-fonts/encodings"
45 PDEPEND="${PDEPEND}
46 media-fonts/font-alias"
47 fi
48
49 # If we're a driver package
50 if [[ "${PN/#xf86-video}" != "${PN}" ]] || [[ "${PN/#xf86-input}" != "${PN}" ]]; then
51 # Don't build static driver modules
52 DRIVER_OPTIONS="--disable-static"
53 fi
54
55 DEPEND="${DEPEND}
56 >=dev-util/pkgconfig-0.18
57 >=x11-misc/util-macros-0.99.0_p20051007"
58
59 # >=sys-apps/man-1.6b-r2 required to look in [0-8]x/ directories
60 RDEPEND="${RDEPEND}
61 !<=x11-base/xorg-x11-6.9
62 >=sys-apps/man-1.6b-r2"
63 # Provides virtual/x11 for temporary use until packages are ported
64 # x11-base/x11-env"
65
66 x-modular_unpack_source() {
67 unpack ${A}
68 cd ${S}
69
70 # Joshua Baergen - October 23, 2005
71 # Fix shared lib issues on MIPS, FBSD, etc etc
72 elibtoolize
73 }
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 autoreconf -v --force --install
107 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 x-modular_src_configure() {
119 # If prefix isn't set here, .pc files cause problems
120 if [ -x ./configure ]; then
121 econf --prefix=${XDIR} \
122 --datadir=${XDIR}/share \
123 ${DRIVER_OPTIONS} \
124 ${CONFIGURE_OPTIONS}
125 fi
126 }
127
128 x-modular_src_make() {
129 emake || die "emake failed"
130 }
131
132 x-modular_src_compile() {
133 x-modular_src_configure
134 x-modular_src_make
135 }
136
137 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
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 }
153
154 x-modular_pkg_preinst() {
155 if [[ -n "${FONT}" ]]; then
156 discover_font_dirs
157 fi
158 }
159
160 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 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 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