| 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.5 2005/08/15 00:33:31 spyderous Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.30 2005/12/10 21:49:07 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 | # 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. |
11 | # the subdirectories within /usr/share/fonts to which it installs fonts. |
| 12 | |
12 | |
| 13 | EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst |
13 | EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm |
| 14 | |
14 | |
| 15 | inherit eutils |
15 | inherit eutils libtool toolchain-funcs |
| 16 | |
16 | |
| 17 | # Directory prefix to use for everything |
17 | # Directory prefix to use for everything |
| 18 | XDIR="/usr" |
18 | XDIR="/usr" |
| 19 | |
19 | |
|
|
20 | # Set up default patchset version(s) if necessary |
|
|
21 | # x11-driver-patches |
|
|
22 | if [[ -z "${XDPVER}" ]]; then |
|
|
23 | XDPVER="1" |
|
|
24 | fi |
|
|
25 | |
| 20 | IUSE="" |
26 | IUSE="" |
| 21 | HOMEPAGE="http://xorg.freedesktop.org/" |
27 | HOMEPAGE="http://xorg.freedesktop.org/" |
| 22 | SRC_URI="http://xorg.freedesktop.org/X11R7.0-RC0/everything/${P}.tar.bz2" |
28 | SRC_URI="http://xorg.freedesktop.org/releases/X11R7.0-RC3/everything/${P}.tar.bz2 |
|
|
29 | http://xorg.freedesktop.org/releases/X11R7.0-RC2/everything/${P}.tar.bz2 |
|
|
30 | http://xorg.freedesktop.org/releases/X11R7.0-RC1/everything/${P}.tar.bz2 |
|
|
31 | http://xorg.freedesktop.org/releases/X11R7.0-RC0/everything/${P}.tar.bz2" |
| 23 | LICENSE="X11" |
32 | LICENSE="X11" |
| 24 | SLOT="0" |
33 | SLOT="0" |
| 25 | |
34 | |
| 26 | # Set up shared dependencies |
35 | # Set up shared dependencies |
| 27 | if [ -n "${SNAPSHOT}" ]; then |
36 | if [[ -n "${SNAPSHOT}" ]]; then |
| 28 | # FIXME: What's the minimal libtool version supporting arbitrary versioning? |
37 | # FIXME: What's the minimal libtool version supporting arbitrary versioning? |
| 29 | DEPEND="${DEPEND} |
38 | DEPEND="${DEPEND} |
| 30 | >=sys-devel/autoconf-2.57 |
39 | >=sys-devel/autoconf-2.57 |
| 31 | >=sys-devel/automake-1.7 |
40 | >=sys-devel/automake-1.7 |
| 32 | >=sys-devel/libtool-1.5 |
41 | >=sys-devel/libtool-1.5 |
| 33 | >=sys-devel/m4-1.4" |
42 | >=sys-devel/m4-1.4" |
| 34 | fi |
43 | fi |
| 35 | |
44 | |
| 36 | # If we're a font package, but not the font.alias one |
45 | # If we're a font package, but not the font.alias one |
| 37 | if [[ "${PN/#font}" != "${PN}" ]] && [[ "${PN}" != "font-alias" ]]; then |
46 | if [[ "${PN/#font-}" != "${PN}" ]] \ |
|
|
47 | && [[ "${PN}" != "font-alias" ]] \ |
|
|
48 | && [[ "${PN}" != "font-util" ]]; then |
| 38 | # Activate font code in the rest of the eclass |
49 | # Activate font code in the rest of the eclass |
| 39 | FONT="yes" |
50 | FONT="yes" |
| 40 | |
51 | |
| 41 | RDEPEND="${RDEPEND} |
52 | RDEPEND="${RDEPEND} |
| 42 | media-fonts/encodings" |
53 | media-fonts/encodings" |
|
|
54 | DEPEND="${DEPEND} |
|
|
55 | x11-apps/mkfontscale |
|
|
56 | x11-apps/mkfontdir" |
| 43 | PDEPEND="${PDEPEND} |
57 | PDEPEND="${PDEPEND} |
| 44 | media-fonts/font-alias" |
58 | media-fonts/font-alias" |
|
|
59 | |
|
|
60 | # Starting with 7.0RC3, we can specify the font directory |
|
|
61 | # But oddly, we can't do the same for encodings or font-alias |
|
|
62 | |
|
|
63 | # Wrap in `if` so ebuilds can set it too |
|
|
64 | if [[ -z ${FONT_DIR} ]]; then |
|
|
65 | FONT_DIR=${PN##*-} |
|
|
66 | |
|
|
67 | fi |
|
|
68 | |
|
|
69 | # Fix case of font directories |
|
|
70 | FONT_DIR=${FONT_DIR/ttf/TTF} |
|
|
71 | FONT_DIR=${FONT_DIR/otf/OTF} |
|
|
72 | FONT_DIR=${FONT_DIR/type1/Type1} |
|
|
73 | FONT_DIR=${FONT_DIR/speedo/Speedo} |
|
|
74 | |
|
|
75 | # Set up configure option |
|
|
76 | FONT_OPTIONS="--with-fontdir=\"/usr/share/fonts/${FONT_DIR}\"" |
|
|
77 | |
|
|
78 | if [[ -n "${FONT}" ]]; then |
|
|
79 | if [[ ${PN##*-} = misc ]] || [[ ${PN##*-} = 75dpi ]] || [[ ${PN##*-} = 100dpi ]]; then |
|
|
80 | IUSE="${IUSE} nls" |
|
|
81 | fi |
|
|
82 | fi |
| 45 | fi |
83 | fi |
| 46 | |
84 | |
|
|
85 | # If we're a driver package |
|
|
86 | if [[ "${PN/#xf86-video}" != "${PN}" ]] || [[ "${PN/#xf86-input}" != "${PN}" ]]; then |
|
|
87 | # Don't build static driver modules |
|
|
88 | DRIVER_OPTIONS="--disable-static" |
|
|
89 | |
|
|
90 | # Enable driver code in the rest of the eclass |
|
|
91 | DRIVER="yes" |
|
|
92 | |
|
|
93 | # Add driver patchset to SRC_URI |
|
|
94 | SRC_URI="${SRC_URI} |
|
|
95 | http://dev.gentoo.org/~joshuabaergen/distfiles/x11-driver-patches-${XDPVER}.tar.bz2" |
|
|
96 | fi |
|
|
97 | |
| 47 | DEPEND="${DEPEND} |
98 | DEPEND="${DEPEND} |
| 48 | dev-util/pkgconfig |
99 | >=dev-util/pkgconfig-0.18 |
| 49 | x11-misc/util-macros" |
100 | >=x11-misc/util-macros-0.99.2" |
| 50 | |
101 | |
|
|
102 | # >=sys-apps/man-1.6b-r2 required to look in [0-8]x/ directories |
| 51 | RDEPEND="${RDEPEND}" |
103 | RDEPEND="${RDEPEND} |
| 52 | # Shouldn't be necessary once we're in a standard location |
104 | !<=x11-base/xorg-x11-6.9 |
|
|
105 | >=sys-apps/man-1.6b-r2" |
|
|
106 | # Provides virtual/x11 for temporary use until packages are ported |
| 53 | # x11-base/x11-env" |
107 | # x11-base/x11-env" |
| 54 | # FIXME: Uncomment once it's in portage |
|
|
| 55 | # !x11-base/xorg-x11" |
|
|
| 56 | |
108 | |
| 57 | x-modular_unpack_source() { |
109 | x-modular_unpack_source() { |
| 58 | unpack ${A} |
110 | unpack ${A} |
| 59 | cd ${S} |
111 | cd ${S} |
|
|
112 | |
|
|
113 | if [[ -n ${FONT_OPTIONS} ]]; then |
|
|
114 | einfo "Detected font directory: ${FONT_DIR}" |
|
|
115 | fi |
| 60 | } |
116 | } |
| 61 | |
117 | |
| 62 | x-modular_patch_source() { |
118 | x-modular_patch_source() { |
| 63 | # Use standardized names and locations with bulk patching |
119 | # Use standardized names and locations with bulk patching |
| 64 | # Patch directory is ${WORKDIR}/patch |
120 | # Patch directory is ${WORKDIR}/patch |
| 65 | # See epatch() in eutils.eclass for more documentation |
121 | # See epatch() in eutils.eclass for more documentation |
| 66 | if [ -z "${EPATCH_SUFFIX}" ] ; then |
122 | if [[ -z "${EPATCH_SUFFIX}" ]] ; then |
| 67 | EPATCH_SUFFIX="patch" |
123 | EPATCH_SUFFIX="patch" |
| 68 | fi |
124 | fi |
| 69 | |
125 | |
|
|
126 | # If this is a driver package we need to fix man page install location. |
|
|
127 | # Running autoreconf will use the patched util-macros to make the |
|
|
128 | # change for us, so we only need to patch if it is not going to run. |
|
|
129 | if [[ -n "${DRIVER}" ]] && [[ "${SNAPSHOT}" != "yes" ]]; then |
|
|
130 | PATCHES="${PATCHES} ${DISTDIR}/x11-driver-patches-${XDPVER}.tar.bz2" |
|
|
131 | fi |
|
|
132 | |
| 70 | # For specific list of patches |
133 | # For specific list of patches |
| 71 | if [ -n "${PATCHES}" ] ; then |
134 | if [[ -n "${PATCHES}" ]] ; then |
| 72 | for PATCH in ${PATCHES} |
135 | for PATCH in ${PATCHES} |
| 73 | do |
136 | do |
| 74 | epatch ${PATCH} |
137 | epatch ${PATCH} |
| 75 | done |
138 | done |
| 76 | # For non-default directory bulk patching |
139 | # For non-default directory bulk patching |
| 77 | elif [ -n "${PATCH_LOC}" ] ; then |
140 | elif [[ -n "${PATCH_LOC}" ]] ; then |
| 78 | epatch ${PATCH_LOC} |
141 | epatch ${PATCH_LOC} |
| 79 | # For standard bulk patching |
142 | # For standard bulk patching |
| 80 | elif [ -d "${EPATCH_SOURCE}" ] ; then |
143 | elif [[ -d "${EPATCH_SOURCE}" ]] ; then |
| 81 | epatch |
144 | epatch |
| 82 | fi |
145 | fi |
| 83 | } |
146 | } |
| 84 | |
147 | |
| 85 | x-modular_reconf_source() { |
148 | x-modular_reconf_source() { |
| 86 | # Run autoreconf for CVS snapshots only |
149 | # Run autoreconf for CVS snapshots only |
| 87 | if [ "${SNAPSHOT}" = "yes" ] |
150 | if [[ "${SNAPSHOT}" = "yes" ]] |
| 88 | then |
151 | then |
| 89 | # If possible, generate configure if it doesn't exist |
152 | # If possible, generate configure if it doesn't exist |
| 90 | if [ -f "${S}/configure.ac" ] |
153 | if [ -f "${S}/configure.ac" ] |
| 91 | then |
154 | then |
| 92 | einfo "Running autoreconf..." |
155 | einfo "Running autoreconf..." |
| 93 | autoreconf -v --install |
156 | autoreconf -v --force --install |
| 94 | fi |
157 | fi |
| 95 | fi |
158 | fi |
| 96 | |
159 | |
| 97 | } |
160 | } |
| 98 | |
161 | |
| 99 | x-modular_src_unpack() { |
162 | x-modular_src_unpack() { |
|
|
163 | if [[ ${PN:0:11} = "xorg-server" ]] || [[ -n "${DRIVER}" ]]; then |
|
|
164 | if gcc-specs-now; then |
|
|
165 | msg="Do not emerge ${PN} without vanilla gcc!" |
|
|
166 | eerror "$msg" |
|
|
167 | die "$msg" |
|
|
168 | fi |
|
|
169 | fi |
|
|
170 | |
| 100 | x-modular_unpack_source |
171 | x-modular_unpack_source |
| 101 | x-modular_patch_source |
172 | x-modular_patch_source |
| 102 | x-modular_reconf_source |
173 | x-modular_reconf_source |
| 103 | } |
|
|
| 104 | |
174 | |
|
|
175 | # Joshua Baergen - October 23, 2005 |
|
|
176 | # Fix shared lib issues on MIPS, FBSD, etc etc |
|
|
177 | elibtoolize |
|
|
178 | } |
|
|
179 | |
|
|
180 | x-modular_font_configure() { |
|
|
181 | if [[ -n "${FONT}" ]]; then |
|
|
182 | # Might be worth adding an option to configure your desired font |
|
|
183 | # and exclude all others. Also, should this USE be nls or minimal? |
|
|
184 | if ! use nls; then |
|
|
185 | FONT_OPTIONS="${FONT_OPTIONS} |
|
|
186 | --disable-iso8859-2 |
|
|
187 | --disable-iso8859-3 |
|
|
188 | --disable-iso8859-4 |
|
|
189 | --disable-iso8859-5 |
|
|
190 | --disable-iso8859-6 |
|
|
191 | --disable-iso8859-7 |
|
|
192 | --disable-iso8859-8 |
|
|
193 | --disable-iso8859-9 |
|
|
194 | --disable-iso8859-10 |
|
|
195 | --disable-iso8859-11 |
|
|
196 | --disable-iso8859-12 |
|
|
197 | --disable-iso8859-13 |
|
|
198 | --disable-iso8859-14 |
|
|
199 | --disable-iso8859-15 |
|
|
200 | --disable-iso8859-16 |
|
|
201 | --disable-jisx0201 |
|
|
202 | --disable-koi8-r" |
|
|
203 | fi |
|
|
204 | fi |
|
|
205 | } |
|
|
206 | |
| 105 | x-modular_src_compile() { |
207 | x-modular_src_configure() { |
|
|
208 | x-modular_font_configure |
|
|
209 | |
| 106 | # If prefix isn't set here, .pc files cause problems |
210 | # If prefix isn't set here, .pc files cause problems |
| 107 | if [ -x ./configure ]; then |
211 | if [[ -x ./configure ]]; then |
| 108 | econf --prefix=${XDIR} \ |
212 | econf --prefix=${XDIR} \ |
| 109 | --datadir=${XDIR}/share \ |
213 | --datadir=${XDIR}/share \ |
|
|
214 | ${FONT_OPTIONS} \ |
|
|
215 | ${DRIVER_OPTIONS} \ |
| 110 | ${CONFIGURE_OPTIONS} |
216 | ${CONFIGURE_OPTIONS} |
| 111 | fi |
217 | fi |
|
|
218 | } |
|
|
219 | |
|
|
220 | x-modular_src_make() { |
| 112 | emake || die "emake failed" |
221 | emake || die "emake failed" |
|
|
222 | } |
|
|
223 | |
|
|
224 | x-modular_src_compile() { |
|
|
225 | x-modular_src_configure |
|
|
226 | x-modular_src_make |
| 113 | } |
227 | } |
| 114 | |
228 | |
| 115 | x-modular_src_install() { |
229 | x-modular_src_install() { |
| 116 | # Install everything to ${XDIR} |
230 | # Install everything to ${XDIR} |
| 117 | make \ |
231 | make \ |
| … | |
… | |
| 119 | install |
233 | install |
| 120 | # Shouldn't be necessary in XDIR=/usr |
234 | # Shouldn't be necessary in XDIR=/usr |
| 121 | # einstall forces datadir, so we need to re-force it |
235 | # einstall forces datadir, so we need to re-force it |
| 122 | # datadir=${XDIR}/share \ |
236 | # datadir=${XDIR}/share \ |
| 123 | # mandir=${XDIR}/share/man \ |
237 | # mandir=${XDIR}/share/man \ |
|
|
238 | |
|
|
239 | # Don't install libtool archives for server modules |
|
|
240 | if [[ -e ${D}/usr/lib/xorg/modules ]]; then |
|
|
241 | find ${D}/usr/lib/xorg/modules -name '*.la' \ |
|
|
242 | | xargs rm -f |
|
|
243 | fi |
| 124 | } |
244 | } |
| 125 | |
245 | |
| 126 | x-modular_pkg_preinst() { |
246 | x-modular_pkg_preinst() { |
| 127 | if [[ -n "${FONT}" ]]; then |
247 | if [[ -n "${FONT}" ]]; then |
| 128 | discover_font_dirs |
248 | discover_font_dirs |
| … | |
… | |
| 133 | if [[ -n "${FONT}" ]]; then |
253 | if [[ -n "${FONT}" ]]; then |
| 134 | setup_fonts |
254 | setup_fonts |
| 135 | fi |
255 | fi |
| 136 | } |
256 | } |
| 137 | |
257 | |
|
|
258 | x-modular_pkg_postrm() { |
|
|
259 | if [[ -n "${FONT}" ]]; then |
|
|
260 | cleanup_fonts |
|
|
261 | fi |
|
|
262 | } |
|
|
263 | |
|
|
264 | cleanup_fonts() { |
|
|
265 | local ALLOWED_FILES="encodings.dir fonts.cache-1 fonts.dir fonts.scale" |
|
|
266 | for DIR in ${FONT_DIR}; do |
|
|
267 | unset KEEP_FONTDIR |
|
|
268 | REAL_DIR=${ROOT}usr/share/fonts/${DIR} |
|
|
269 | |
|
|
270 | ebegin "Checking ${REAL_DIR} for useless files" |
|
|
271 | pushd ${REAL_DIR} &> /dev/null |
|
|
272 | for FILE in *; do |
|
|
273 | unset MATCH |
|
|
274 | for ALLOWED_FILE in ${ALLOWED_FILES}; do |
|
|
275 | if [[ ${FILE} = ${ALLOWED_FILE} ]]; then |
|
|
276 | # If it's allowed, then move on to the next file |
|
|
277 | MATCH="yes" |
|
|
278 | break |
|
|
279 | fi |
|
|
280 | done |
|
|
281 | # If we found a match in allowed files, move on to the next file |
|
|
282 | if [[ -n ${MATCH} ]]; then |
|
|
283 | continue |
|
|
284 | fi |
|
|
285 | # If we get this far, there wasn't a match in the allowed files |
|
|
286 | KEEP_FONTDIR="yes" |
|
|
287 | # We don't need to check more files if we're already keeping it |
|
|
288 | break |
|
|
289 | done |
|
|
290 | popd &> /dev/null |
|
|
291 | # If there are no files worth keeping, then get rid of the dir |
|
|
292 | if [[ -z "${KEEP_FONTDIR}" ]]; then |
|
|
293 | rm -rf ${REAL_DIR} |
|
|
294 | fi |
|
|
295 | eend 0 |
|
|
296 | done |
|
|
297 | } |
|
|
298 | |
| 138 | setup_fonts() { |
299 | setup_fonts() { |
| 139 | if [[ ! -n "${FONT_DIRS}" ]]; then |
300 | if [[ ! -n "${FONT_DIRS}" ]]; then |
| 140 | msg="FONT_DIRS empty. Set it to at least one subdir of /usr/share/fonts." |
301 | msg="FONT_DIRS is empty. The ebuild should set it to at least one subdir of /usr/share/fonts." |
| 141 | eerror ${msg} |
302 | eerror "${msg}" |
| 142 | die ${msg} |
303 | die "${msg}" |
| 143 | fi |
304 | fi |
| 144 | |
305 | |
| 145 | create_fonts_scale |
306 | create_fonts_scale |
| 146 | create_fonts_dir |
307 | create_fonts_dir |
| 147 | fix_font_permissions |
308 | fix_font_permissions |
| … | |
… | |
| 158 | create_fonts_scale() { |
319 | create_fonts_scale() { |
| 159 | ebegin "Creating fonts.scale files" |
320 | ebegin "Creating fonts.scale files" |
| 160 | local x |
321 | local x |
| 161 | for FONT_DIR in ${FONT_DIRS}; do |
322 | for FONT_DIR in ${FONT_DIRS}; do |
| 162 | x=${ROOT}/usr/share/fonts/${FONT_DIR} |
323 | x=${ROOT}/usr/share/fonts/${FONT_DIR} |
| 163 | [ -z "$(ls ${x}/)" ] && continue |
324 | [[ -z "$(ls ${x}/)" ]] && continue |
| 164 | [ "$(ls ${x}/)" = "fonts.cache-1" ] && continue |
325 | [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue |
| 165 | |
326 | |
| 166 | # Only generate .scale files if truetype, opentype or type1 |
327 | # Only generate .scale files if truetype, opentype or type1 |
| 167 | # fonts are present ... |
328 | # fonts are present ... |
| 168 | |
329 | |
| 169 | # First truetype (ttf,ttc) |
330 | # First truetype (ttf,ttc) |
| 170 | # NOTE: ttmkfdir does NOT work on type1 fonts (#53753) |
331 | # NOTE: ttmkfdir does NOT work on type1 fonts (#53753) |
| 171 | # Also, there is no way to regenerate Speedo/CID fonts.scale |
332 | # Also, there is no way to regenerate Speedo/CID fonts.scale |
| 172 | # <spyderous@gentoo.org> 2 August 2004 |
333 | # <spyderous@gentoo.org> 2 August 2004 |
| 173 | if [ "${x/encodings}" = "${x}" -a \ |
334 | if [[ "${x/encodings}" = "${x}" ]] \ |
| 174 | -n "$(find ${x} -iname '*.tt[cf]' -print)" ]; then |
335 | && [[ -n "$(find ${x} -iname '*.tt[cf]' -print)" ]]; then |
| 175 | if [ -x ${ROOT}/usr/bin/ttmkfdir ]; then |
336 | if [[ -x ${ROOT}/usr/bin/ttmkfdir ]]; then |
| 176 | LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ |
337 | LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ |
| 177 | ${ROOT}/usr/bin/ttmkfdir -x 2 \ |
338 | ${ROOT}/usr/bin/ttmkfdir -x 2 \ |
| 178 | -e ${ROOT}/usr/share/fonts/encodings/encodings.dir \ |
339 | -e ${ROOT}/usr/share/fonts/encodings/encodings.dir \ |
| 179 | -o ${x}/fonts.scale -d ${x} |
340 | -o ${x}/fonts.scale -d ${x} |
| 180 | # ttmkfdir fails on some stuff, so try mkfontscale if it does |
341 | # ttmkfdir fails on some stuff, so try mkfontscale if it does |
| 181 | local ttmkfdir_return=$? |
342 | local ttmkfdir_return=$? |
| 182 | else |
343 | else |
| 183 | # We didn't use ttmkfdir at all |
344 | # We didn't use ttmkfdir at all |
| 184 | local ttmkfdir_return=2 |
345 | local ttmkfdir_return=2 |
| 185 | fi |
346 | fi |
| 186 | if [ ${ttmkfdir_return} -ne 0 ]; then |
347 | if [[ ${ttmkfdir_return} -ne 0 ]]; then |
| 187 | LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ |
348 | LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ |
| 188 | ${ROOT}/usr/bin/mkfontscale \ |
349 | ${ROOT}/usr/bin/mkfontscale \ |
| 189 | -a /usr/share/fonts/encodings/encodings.dir \ |
350 | -a /usr/share/fonts/encodings/encodings.dir \ |
| 190 | -- ${x} |
351 | -- ${x} |
| 191 | fi |
352 | fi |
| 192 | # Next type1 and opentype (pfa,pfb,otf,otc) |
353 | # Next type1 and opentype (pfa,pfb,otf,otc) |
| 193 | elif [ "${x/encodings}" = "${x}" -a \ |
354 | elif [[ "${x/encodings}" = "${x}" ]] \ |
| 194 | -n "$(find ${x} -iname '*.[po][ft][abcf]' -print)" ]; then |
355 | && [[ -n "$(find ${x} -iname '*.[po][ft][abcf]' -print)" ]]; then |
| 195 | LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ |
356 | LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ |
| 196 | ${ROOT}/usr/bin/mkfontscale \ |
357 | ${ROOT}/usr/bin/mkfontscale \ |
| 197 | -a ${ROOT}/usr/share/fonts/encodings/encodings.dir \ |
358 | -a ${ROOT}/usr/share/fonts/encodings/encodings.dir \ |
| 198 | -- ${x} |
359 | -- ${x} |
| 199 | fi |
360 | fi |
| … | |
… | |
| 203 | |
364 | |
| 204 | create_fonts_dir() { |
365 | create_fonts_dir() { |
| 205 | ebegin "Generating fonts.dir files" |
366 | ebegin "Generating fonts.dir files" |
| 206 | for FONT_DIR in ${FONT_DIRS}; do |
367 | for FONT_DIR in ${FONT_DIRS}; do |
| 207 | x=${ROOT}/usr/share/fonts/${FONT_DIR} |
368 | x=${ROOT}/usr/share/fonts/${FONT_DIR} |
| 208 | [ -z "$(ls ${x}/)" ] && continue |
369 | [[ -z "$(ls ${x}/)" ]] && continue |
| 209 | [ "$(ls ${x}/)" = "fonts.cache-1" ] && continue |
370 | [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue |
| 210 | |
371 | |
| 211 | if [ "${x/encodings}" = "${x}" ]; then |
372 | if [[ "${x/encodings}" = "${x}" ]]; then |
| 212 | LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ |
373 | LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ |
| 213 | ${ROOT}/usr/bin/mkfontdir \ |
374 | ${ROOT}/usr/bin/mkfontdir \ |
| 214 | -e ${ROOT}/usr/share/fonts/encodings \ |
375 | -e ${ROOT}/usr/share/fonts/encodings \ |
| 215 | -e ${ROOT}/usr/share/fonts/encodings/large \ |
376 | -e ${ROOT}/usr/share/fonts/encodings/large \ |
| 216 | -- ${x} |
377 | -- ${x} |
| … | |
… | |
| 230 | |
391 | |
| 231 | create_font_cache() { |
392 | create_font_cache() { |
| 232 | # danarmak found out that fc-cache should be run AFTER all the above |
393 | # danarmak found out that fc-cache should be run AFTER all the above |
| 233 | # stuff, as otherwise the cache is invalid, and has to be run again |
394 | # stuff, as otherwise the cache is invalid, and has to be run again |
| 234 | # as root anyway |
395 | # as root anyway |
| 235 | if [ -x ${ROOT}/usr/bin/fc-cache ]; then |
396 | if [[ -x ${ROOT}/usr/bin/fc-cache ]]; then |
| 236 | ebegin "Creating FC font cache" |
397 | ebegin "Creating FC font cache" |
| 237 | HOME="/root" ${ROOT}/usr/bin/fc-cache |
398 | HOME="/root" ${ROOT}/usr/bin/fc-cache |
| 238 | eend 0 |
399 | eend 0 |
| 239 | fi |
400 | fi |
| 240 | } |
401 | } |