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

Diff of /eclass/x-modular.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.2 Revision 1.66
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2005 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.2 2005/08/11 06:19:16 spyderous Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.66 2006/06/30 16:21:38 spyderous Exp $
4# 4#
5# Author: Donnie Berkholz <spyderous@gentoo.org> 5# Author: Donnie Berkholz <spyderous@gentoo.org>
6# 6#
7# This eclass is designed to reduce code duplication in the modularized X11 7# This eclass is designed to reduce code duplication in the modularized X11
8# ebuilds. 8# ebuilds.
9# 9#
10# If the ebuild installs fonts, set FONT="yes" at the top and set FONT_DIRS to 10# Using this eclass:
11# the subdirectories within /usr/share/fonts to which it installs fonts. 11#
12# Inherit it. If you need to run autoreconf for any reason (e.g., your patches
13# apply to the autotools files rather than configure), set SNAPSHOT="yes". Set
14# CONFIGURE_OPTIONS to everything you want to pass to the configure script.
15#
16# If you have any patches to apply, set PATCHES to their locations and epatch
17# will apply them. It also handles epatch-style bulk patches, if you know how to
18# use them and set the correct variables. If you don't, read eutils.eclass.
19#
20# If you're creating a font package and the suffix of PN is not equal to the
21# subdirectory of /usr/share/fonts/ it should install into, set FONT_DIR to that
22# directory or directories.
23#
24# IMPORTANT: Both SNAPSHOT and FONT_DIR must be set _before_ the inherit.
25#
26# Pretty much everything else should be automatic.
12 27
13EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst 28EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm
14 29
15inherit eutils 30inherit eutils libtool toolchain-funcs flag-o-matic autotools
16 31
17# Directory prefix to use for everything 32# Directory prefix to use for everything
18# Change to /usr/X11R6 once it's standard
19XDIR="/usr" 33XDIR="/usr"
34
35# Set up default patchset version(s) if necessary
36# x11-driver-patches
37if [[ -z "${XDPVER}" ]]; then
38 XDPVER="1"
39fi
20 40
21IUSE="" 41IUSE=""
22HOMEPAGE="http://xorg.freedesktop.org/" 42HOMEPAGE="http://xorg.freedesktop.org/"
23SRC_URI="http://xorg.freedesktop.org/X11R7.0-RC0/everything/${P}.tar.bz2" 43
24LICENSE="X11" 44# Set up SRC_URI for individual modular releases
45BASE_INDIVIDUAL_URI="http://xorg.freedesktop.org/releases/individual"
46if [[ ${CATEGORY} = x11-apps ]] || [[ ${CATEGORY} = x11-wm ]]; then
47 SRC_URI="${SRC_URI}
48 ${BASE_INDIVIDUAL_URI}/app/${P}.tar.bz2"
49elif [[ ${CATEGORY} = app-doc ]]; then
50 SRC_URI="${SRC_URI}
51 ${BASE_INDIVIDUAL_URI}/doc/${P}.tar.bz2"
52# x11-misc contains data and util, x11-themes contains data
53elif [[ ${CATEGORY} = x11-misc ]] || [[ ${CATEGORY} = x11-themes ]]; then
54 SRC_URI="${SRC_URI}
55 ${BASE_INDIVIDUAL_URI}/data/${P}.tar.bz2
56 ${BASE_INDIVIDUAL_URI}/util/${P}.tar.bz2"
57elif [[ ${CATEGORY} = x11-drivers ]]; then
58 SRC_URI="${SRC_URI}
59 ${BASE_INDIVIDUAL_URI}/driver/${P}.tar.bz2"
60elif [[ ${CATEGORY} = media-fonts ]]; then
61 SRC_URI="${SRC_URI}
62 ${BASE_INDIVIDUAL_URI}/font/${P}.tar.bz2"
63elif [[ ${CATEGORY} = x11-libs ]]; then
64 SRC_URI="${SRC_URI}
65 ${BASE_INDIVIDUAL_URI}/lib/${P}.tar.bz2"
66elif [[ ${CATEGORY} = x11-proto ]]; then
67 SRC_URI="${SRC_URI}
68 ${BASE_INDIVIDUAL_URI}/proto/${P}.tar.bz2"
69elif [[ ${CATEGORY} = x11-base ]]; then
70 SRC_URI="${SRC_URI}
71 ${BASE_INDIVIDUAL_URI}/xserver/${P}.tar.bz2"
72fi
73
25SLOT="0" 74SLOT="0"
26 75
76# Set the license for the package. This can be overridden by setting
77# LICENSE after the inherit.
78LICENSE=${PN}
79
27# Set up shared dependencies 80# Set up shared dependencies
28if [ -n "${SNAPSHOT}" ]; then 81if [[ -n "${SNAPSHOT}" ]]; then
29# FIXME: What's the minimal libtool version supporting arbitrary versioning? 82# FIXME: What's the minimal libtool version supporting arbitrary versioning?
30 DEPEND="${DEPEND} 83 DEPEND="${DEPEND}
31 >=sys-devel/autoconf-2.57 84 >=sys-devel/autoconf-2.57
32 >=sys-devel/automake-1.7 85 >=sys-devel/automake-1.7
33 >=sys-devel/libtool-1.5 86 >=sys-devel/libtool-1.5
34 >=sys-devel/m4-1.4" 87 >=sys-devel/m4-1.4"
35fi 88fi
36 89
90# If we're a font package, but not the font.alias one
91if [[ "${PN/#font-}" != "${PN}" ]] \
92 && [[ "${CATEGORY}" = "media-fonts" ]] \
93 && [[ "${PN}" != "font-alias" ]] \
94 && [[ "${PN}" != "font-util" ]]; then
95 # Activate font code in the rest of the eclass
96 FONT="yes"
97
98 RDEPEND="${RDEPEND}
99 media-fonts/encodings
100 x11-apps/mkfontscale
101 x11-apps/mkfontdir"
102 PDEPEND="${PDEPEND}
103 media-fonts/font-alias"
104
105 # Starting with 7.0RC3, we can specify the font directory
106 # But oddly, we can't do the same for encodings or font-alias
107
108 # Wrap in `if` so ebuilds can set it too
109 if [[ -z ${FONT_DIR} ]]; then
110 FONT_DIR=${PN##*-}
111
112 fi
113
114 # Fix case of font directories
115 FONT_DIR=${FONT_DIR/ttf/TTF}
116 FONT_DIR=${FONT_DIR/otf/OTF}
117 FONT_DIR=${FONT_DIR/type1/Type1}
118 FONT_DIR=${FONT_DIR/speedo/Speedo}
119
120 # Set up configure option
121 FONT_OPTIONS="--with-fontdir=\"/usr/share/fonts/${FONT_DIR}\""
122
123 if [[ -n "${FONT}" ]]; then
124 if [[ ${PN##*-} = misc ]] || [[ ${PN##*-} = 75dpi ]] || [[ ${PN##*-} = 100dpi ]]; then
125 IUSE="${IUSE} nls"
126 fi
127 fi
128fi
129
130# If we're a driver package
131if [[ "${PN/#xf86-video}" != "${PN}" ]] || [[ "${PN/#xf86-input}" != "${PN}" ]]; then
132 # Enable driver code in the rest of the eclass
133 DRIVER="yes"
134
135 # Add driver patchset to SRC_URI
136 SRC_URI="${SRC_URI}
137 http://dev.gentoo.org/~joshuabaergen/distfiles/x11-driver-patches-${XDPVER}.tar.bz2"
138fi
139
140# Debugging -- ignore packages that can't be built with debugging
141if [[ -z "${FONT}" ]] \
142 || [[ "${PN/app-doc}" != "${PN}" ]] \
143 || [[ "${PN/x11-proto}" != "${PN}" ]] \
144 || [[ "${PN/util-macros}" != "${PN}" ]] \
145 || [[ "${PN/xbitmaps}" != "${PN}" ]] \
146 || [[ "${PN/xkbdata}" != "${PN}" ]] \
147 || [[ "${PN/xorg-cf-files}" != "${PN}" ]] \
148 || [[ "${PN/xcursor}" != "${PN}" ]] \
149 ; then
150 DEBUGGABLE="yes"
151 IUSE="${IUSE} debug"
152 if use debug; then
153 if ! has splitdebug ${FEATURES}; then
154 RESTRICT="${RESTRICT} nostrip"
155 fi
156 fi
157fi
158
37DEPEND="${DEPEND} 159DEPEND="${DEPEND}
38 dev-util/pkgconfig 160 >=dev-util/pkgconfig-0.18"
161
162if [[ "${PN/util-macros}" = "${PN}" ]]; then
163 DEPEND="${DEPEND}
39 x11-misc/util-macros" 164 >=x11-misc/util-macros-0.99.2"
165fi
40 166
41RDEPEND="${RDEPEND}" 167RDEPEND="${RDEPEND}
42# Shouldn't be necessary once we're in a standard location 168 !<=x11-base/xorg-x11-6.9"
169# Provides virtual/x11 for temporary use until packages are ported
43# x11-base/x11-env" 170# x11-base/x11-env"
44# FIXME: Uncomment once it's in portage 171
45# !x11-base/xorg-x11" 172x-modular_specs_check() {
173 if [[ ${PN:0:11} = "xorg-server" ]] || [[ -n "${DRIVER}" ]]; then
174 if gcc-specs-now; then
175 msg="${PN} does not work with hardened gcc specs. Switch to vanilla gcc specs to emerge ${PN}."
176 eerror "$msg"
177 die "$msg"
178 fi
179
180 append-ldflags -Wl,-z,lazy
181 # (#116698) breaks loading
182 filter-ldflags -Wl,-z,now
183 fi
184}
185
186x-modular_dri_check() {
187 # (#120057) Enabling DRI in drivers requires that the server was built with
188 # support for it
189 if [[ -n "${DRIVER}" ]]; then
190 if has dri ${IUSE} && use dri; then
191 einfo "Checking for direct rendering capabilities ..."
192 if ! built_with_use x11-base/xorg-server dri; then
193 die "You must build x11-base/xorg-server with USE=dri."
194 fi
195 fi
196 fi
197}
198
199x-modular_server_supports_drivers_check() {
200 # (#135873) Only certain servers will actually use or be capable of
201 # building external drivers, including binary drivers.
202 if [[ -n "${DRIVER}" ]]; then
203 if has_version >=x11-base/xorg-server-1.1; then
204 if ! built_with_use x11-base/xorg-server xorg; then
205 eerror "x11-base/xorg-server is not built with support for external drivers."
206 die "You must build x11-base/xorg-server with USE=xorg."
207 fi
208 fi
209 fi
210}
46 211
47x-modular_unpack_source() { 212x-modular_unpack_source() {
48 unpack ${A} 213 unpack ${A}
49 cd ${S} 214 cd ${S}
215
216 if [[ -n ${FONT_OPTIONS} ]]; then
217 einfo "Detected font directory: ${FONT_DIR}"
218 fi
50} 219}
51 220
52x-modular_patch_source() { 221x-modular_patch_source() {
53 # Use standardized names and locations with bulk patching 222 # Use standardized names and locations with bulk patching
54 # Patch directory is ${WORKDIR}/patch 223 # Patch directory is ${WORKDIR}/patch
55 # See epatch() in eutils.eclass for more documentation 224 # See epatch() in eutils.eclass for more documentation
56 if [ -z "${EPATCH_SUFFIX}" ] ; then 225 if [[ -z "${EPATCH_SUFFIX}" ]] ; then
57 EPATCH_SUFFIX="patch" 226 EPATCH_SUFFIX="patch"
58 fi 227 fi
59 228
229 # If this is a driver package we need to fix man page install location.
230 # Running autoreconf will use the patched util-macros to make the
231 # change for us, so we only need to patch if it is not going to run.
232 if [[ -n "${DRIVER}" ]] && [[ "${SNAPSHOT}" != "yes" ]]; then
233 PATCHES="${PATCHES} ${DISTDIR}/x11-driver-patches-${XDPVER}.tar.bz2"
234 fi
235
60 # For specific list of patches 236 # For specific list of patches
61 if [ -n "${PATCHES}" ] ; then 237 if [[ -n "${PATCHES}" ]] ; then
62 for PATCH in ${PATCHES} 238 for PATCH in ${PATCHES}
63 do 239 do
64 epatch ${PATCH} 240 epatch ${PATCH}
65 done 241 done
66 # For non-default directory bulk patching 242 # For non-default directory bulk patching
67 elif [ -n "${PATCH_LOC}" ] ; then 243 elif [[ -n "${PATCH_LOC}" ]] ; then
68 epatch ${PATCH_LOC} 244 epatch ${PATCH_LOC}
69 # For standard bulk patching 245 # For standard bulk patching
70 elif [ -d "${EPATCH_SOURCE}" ] ; then 246 elif [[ -d "${EPATCH_SOURCE}" ]] ; then
71 epatch 247 epatch
72 fi 248 fi
73} 249}
74 250
75x-modular_reconf_source() { 251x-modular_reconf_source() {
76 # Run autoreconf for CVS snapshots only 252 # Run autoreconf for CVS snapshots only
77 if [ "${SNAPSHOT}" = "yes" ] 253 if [[ "${SNAPSHOT}" = "yes" ]]
78 then 254 then
79 # If possible, generate configure if it doesn't exist 255 # If possible, generate configure if it doesn't exist
80 if [ -f "${S}/configure.ac" ] 256 if [ -f "${S}/configure.ac" ]
81 then 257 then
82 einfo "Running autoreconf..." 258 eautoreconf
83 autoreconf -v --install
84 fi
85 fi 259 fi
260 fi
86 261
262 # Joshua Baergen - October 23, 2005
263 # Fix shared lib issues on MIPS, FBSD, etc etc
264 elibtoolize
87} 265}
88 266
89x-modular_src_unpack() { 267x-modular_src_unpack() {
268 x-modular_specs_check
269 x-modular_server_supports_drivers_check
270 x-modular_dri_check
90 x-modular_unpack_source 271 x-modular_unpack_source
91 x-modular_patch_source 272 x-modular_patch_source
92 x-modular_reconf_source 273 x-modular_reconf_source
93} 274}
94 275
276x-modular_font_configure() {
277 if [[ -n "${FONT}" ]]; then
278 # Might be worth adding an option to configure your desired font
279 # and exclude all others. Also, should this USE be nls or minimal?
280 if ! use nls; then
281 FONT_OPTIONS="${FONT_OPTIONS}
282 --disable-iso8859-2
283 --disable-iso8859-3
284 --disable-iso8859-4
285 --disable-iso8859-5
286 --disable-iso8859-6
287 --disable-iso8859-7
288 --disable-iso8859-8
289 --disable-iso8859-9
290 --disable-iso8859-10
291 --disable-iso8859-11
292 --disable-iso8859-12
293 --disable-iso8859-13
294 --disable-iso8859-14
295 --disable-iso8859-15
296 --disable-iso8859-16
297 --disable-jisx0201
298 --disable-koi8-r"
299 fi
300 fi
301}
302
303x-modular_debug_setup() {
304 if [[ -n "${DEBUGGABLE}" ]]; then
305 if use debug; then
306 strip-flags
307 append-flags -g
308 fi
309 fi
310}
311
95x-modular_src_compile() { 312x-modular_src_configure() {
313 x-modular_font_configure
314 x-modular_debug_setup
315
96 # If prefix isn't set here, .pc files cause problems 316 # If prefix isn't set here, .pc files cause problems
97 if [ -x ./configure ]; then 317 if [[ -x ./configure ]]; then
98 econf --prefix=${XDIR} \ 318 econf --prefix=${XDIR} \
99 --datadir=${XDIR}/share \ 319 --datadir=${XDIR}/share \
320 ${FONT_OPTIONS} \
321 ${DRIVER_OPTIONS} \
100 ${CONFIGURE_OPTIONS} 322 ${CONFIGURE_OPTIONS}
101 fi 323 fi
324}
325
326x-modular_src_make() {
102 emake || die "emake failed" 327 emake || die "emake failed"
328}
329
330x-modular_src_compile() {
331 x-modular_src_configure
332 x-modular_src_make
103} 333}
104 334
105x-modular_src_install() { 335x-modular_src_install() {
106 # Install everything to ${XDIR} 336 # Install everything to ${XDIR}
107 make \ 337 make \
109 install 339 install
110# Shouldn't be necessary in XDIR=/usr 340# Shouldn't be necessary in XDIR=/usr
111# einstall forces datadir, so we need to re-force it 341# einstall forces datadir, so we need to re-force it
112# datadir=${XDIR}/share \ 342# datadir=${XDIR}/share \
113# mandir=${XDIR}/share/man \ 343# mandir=${XDIR}/share/man \
344
345 if [[ -e ${S}/ChangeLog ]]; then
346 dodoc ${S}/ChangeLog
347 fi
348
349 # Make sure docs get compressed
350 prepalldocs
351
352 # Don't install libtool archives for server modules
353 if [[ -e ${D}/usr/lib/xorg/modules ]]; then
354 find ${D}/usr/lib/xorg/modules -name '*.la' \
355 | xargs rm -f
356 fi
357
358 # Don't install overlapping fonts.* files
359 # Generate them instead when possible
360 if [[ -n "${FONT}" ]]; then
361 remove_font_metadata
362 fi
363}
364
365x-modular_pkg_preinst() {
366 if [[ -n "${FONT}" ]]; then
367 discover_font_dirs
368 fi
114} 369}
115 370
116x-modular_pkg_postinst() { 371x-modular_pkg_postinst() {
117 if [[ -n "${FONT}" ]]; then 372 if [[ -n "${FONT}" ]]; then
118 setup_fonts 373 setup_fonts
119 fi 374 fi
120} 375}
121 376
377x-modular_pkg_postrm() {
378 if [[ -n "${FONT}" ]]; then
379 cleanup_fonts
380 fi
381}
382
383cleanup_fonts() {
384 local ALLOWED_FILES="encodings.dir fonts.cache-1 fonts.dir fonts.scale"
385 for DIR in ${FONT_DIR}; do
386 unset KEEP_FONTDIR
387 REAL_DIR=${ROOT}usr/share/fonts/${DIR}
388
389 ebegin "Checking ${REAL_DIR} for useless files"
390 pushd ${REAL_DIR} &> /dev/null
391 for FILE in *; do
392 unset MATCH
393 for ALLOWED_FILE in ${ALLOWED_FILES}; do
394 if [[ ${FILE} = ${ALLOWED_FILE} ]]; then
395 # If it's allowed, then move on to the next file
396 MATCH="yes"
397 break
398 fi
399 done
400 # If we found a match in allowed files, move on to the next file
401 if [[ -n ${MATCH} ]]; then
402 continue
403 fi
404 # If we get this far, there wasn't a match in the allowed files
405 KEEP_FONTDIR="yes"
406 # We don't need to check more files if we're already keeping it
407 break
408 done
409 popd &> /dev/null
410 # If there are no files worth keeping, then get rid of the dir
411 if [[ -z "${KEEP_FONTDIR}" ]]; then
412 rm -rf ${REAL_DIR}
413 fi
414 eend 0
415 done
416}
417
122setup_fonts() { 418setup_fonts() {
123 if [[ ! -n "${FONT_DIRS}" ]]; then 419 if [[ ! -n "${FONT_DIRS}" ]]; then
124 msg="FONT_DIRS empty. Set it to at least one subdir of /usr/share/fonts." 420 msg="FONT_DIRS is empty. The ebuild should set it to at least one subdir of /usr/share/fonts."
125 eerror ${msg} 421 eerror "${msg}"
126 die ${msg} 422 die "${msg}"
127 fi 423 fi
128 424
129 create_fonts_scale 425 create_fonts_scale
130 create_fonts_dir 426 create_fonts_dir
131 fix_font_permissions 427 fix_font_permissions
132 create_font_cache 428 create_font_cache
429}
430
431remove_font_metadata() {
432 local DIR
433 for DIR in ${FONT_DIR}; do
434 if [[ "${DIR}" != "Speedo" ]] && \
435 [[ "${DIR}" != "CID" ]] ; then
436 # Delete font metadata files
437 # fonts.scale, fonts.dir, fonts.cache-1
438 rm -f ${D}/usr/share/fonts/${DIR}/fonts.{scale,dir,cache-1}
439 fi
440 done
441}
442
443discover_font_dirs() {
444 pushd ${IMAGE}/usr/share/fonts
445 FONT_DIRS="$(find . -maxdepth 1 -mindepth 1 -type d)"
446 FONT_DIRS="$(echo ${FONT_DIRS} | sed -e 's:./::g')"
447 popd
133} 448}
134 449
135create_fonts_scale() { 450create_fonts_scale() {
136 ebegin "Creating fonts.scale files" 451 ebegin "Creating fonts.scale files"
137 local x 452 local x
138 for FONT_DIR in ${FONT_DIRS}; do 453 for FONT_DIR in ${FONT_DIRS}; do
139 x=${ROOT}/usr/share/fonts/${FONT_DIR} 454 x=${ROOT}/usr/share/fonts/${FONT_DIR}
140 [ -z "$(ls ${x}/)" ] && continue 455 [[ -z "$(ls ${x}/)" ]] && continue
141 [ "$(ls ${x}/)" = "fonts.cache-1" ] && continue 456 [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue
142 457
143 # Only generate .scale files if truetype, opentype or type1 458 # Only generate .scale files if truetype, opentype or type1
144 # fonts are present ... 459 # fonts are present ...
145 460
146 # First truetype (ttf,ttc) 461 # First truetype (ttf,ttc)
147 # NOTE: ttmkfdir does NOT work on type1 fonts (#53753) 462 # NOTE: ttmkfdir does NOT work on type1 fonts (#53753)
148 # Also, there is no way to regenerate Speedo/CID fonts.scale 463 # Also, there is no way to regenerate Speedo/CID fonts.scale
149 # <spyderous@gentoo.org> 2 August 2004 464 # <spyderous@gentoo.org> 2 August 2004
150 if [ "${x/encodings}" = "${x}" -a \ 465 if [[ "${x/encodings}" = "${x}" ]] \
151 -n "$(find ${x} -iname '*.tt[cf]' -print)" ]; then 466 && [[ -n "$(find ${x} -iname '*.tt[cf]' -print)" ]]; then
152 if [ -x ${ROOT}/usr/bin/ttmkfdir ]; then 467 if [[ -x ${ROOT}/usr/bin/ttmkfdir ]]; then
153 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ 468 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \
154 ${ROOT}/usr/bin/ttmkfdir -x 2 \ 469 ${ROOT}/usr/bin/ttmkfdir -x 2 \
155 -e ${ROOT}/usr/share/fonts/encodings/encodings.dir \ 470 -e ${ROOT}/usr/share/fonts/encodings/encodings.dir \
156 -o ${x}/fonts.scale -d ${x} 471 -o ${x}/fonts.scale -d ${x}
157 # ttmkfdir fails on some stuff, so try mkfontscale if it does 472 # ttmkfdir fails on some stuff, so try mkfontscale if it does
158 local ttmkfdir_return=$? 473 local ttmkfdir_return=$?
159 else 474 else
160 # We didn't use ttmkfdir at all 475 # We didn't use ttmkfdir at all
161 local ttmkfdir_return=2 476 local ttmkfdir_return=2
162 fi 477 fi
163 if [ ${ttmkfdir_return} -ne 0 ]; then 478 if [[ ${ttmkfdir_return} -ne 0 ]]; then
164 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ 479 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \
165 ${ROOT}/usr/bin/mkfontscale \ 480 ${ROOT}/usr/bin/mkfontscale \
166 -a /usr/share/fonts/encodings/encodings.dir \ 481 -a /usr/share/fonts/encodings/encodings.dir \
167 -- ${x} 482 -- ${x}
168 fi 483 fi
169 # Next type1 and opentype (pfa,pfb,otf,otc) 484 # Next type1 and opentype (pfa,pfb,otf,otc)
170 elif [ "${x/encodings}" = "${x}" -a \ 485 elif [[ "${x/encodings}" = "${x}" ]] \
171 -n "$(find ${x} -iname '*.[po][ft][abcf]' -print)" ]; then 486 && [[ -n "$(find ${x} -iname '*.[po][ft][abcf]' -print)" ]]; then
172 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ 487 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \
173 ${ROOT}/usr/bin/mkfontscale \ 488 ${ROOT}/usr/bin/mkfontscale \
174 -a ${ROOT}/usr/share/fonts/encodings/encodings.dir \ 489 -a ${ROOT}/usr/share/fonts/encodings/encodings.dir \
175 -- ${x} 490 -- ${x}
176 fi 491 fi
180 495
181create_fonts_dir() { 496create_fonts_dir() {
182 ebegin "Generating fonts.dir files" 497 ebegin "Generating fonts.dir files"
183 for FONT_DIR in ${FONT_DIRS}; do 498 for FONT_DIR in ${FONT_DIRS}; do
184 x=${ROOT}/usr/share/fonts/${FONT_DIR} 499 x=${ROOT}/usr/share/fonts/${FONT_DIR}
185 [ -z "$(ls ${x}/)" ] && continue 500 [[ -z "$(ls ${x}/)" ]] && continue
186 [ "$(ls ${x}/)" = "fonts.cache-1" ] && continue 501 [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue
187 502
188 if [ "${x/encodings}" = "${x}" ]; then 503 if [[ "${x/encodings}" = "${x}" ]]; then
189 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ 504 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \
190 ${ROOT}/usr/bin/mkfontdir \ 505 ${ROOT}/usr/bin/mkfontdir \
191 -e ${ROOT}/usr/share/fonts/encodings \ 506 -e ${ROOT}/usr/share/fonts/encodings \
192 -e ${ROOT}/usr/share/fonts/encodings/large \ 507 -e ${ROOT}/usr/share/fonts/encodings/large \
193 -- ${x} 508 -- ${x}
207 522
208create_font_cache() { 523create_font_cache() {
209 # danarmak found out that fc-cache should be run AFTER all the above 524 # danarmak found out that fc-cache should be run AFTER all the above
210 # stuff, as otherwise the cache is invalid, and has to be run again 525 # stuff, as otherwise the cache is invalid, and has to be run again
211 # as root anyway 526 # as root anyway
212 if [ -x ${ROOT}/usr/bin/fc-cache ]; then 527 if [[ -x ${ROOT}/usr/bin/fc-cache ]]; then
213 ebegin "Creating FC font cache" 528 ebegin "Creating FC font cache"
214 HOME="/root" ${ROOT}/usr/bin/fc-cache 529 HOME="/root" ${ROOT}/usr/bin/fc-cache
215 eend 0 530 eend 0
216 fi 531 fi
217} 532}

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.66

  ViewVC Help
Powered by ViewVC 1.1.20