Gentoo Archives: gentoo-dev

From: Matt Turner <mattst88@g.o>
To: gentoo-dev@l.g.o
Cc: Matt Turner <mattst88@g.o>
Subject: [gentoo-dev] [PATCH] xorg-3.eclass: Copy from xorg-2.eclass and add EAPI 7 support
Date: Thu, 21 Feb 2019 06:10:13
Message-Id: 20190221060957.775-1-mattst88@gentoo.org
1 Nearly all the work is just removing uses of autotools-multilib and
2 autotools-utils.
3
4 Bug: https://bugs.gentoo.org/619832
5 Signed-off-by: Matt Turner <mattst88@g.o>
6 ---
7 Let's just make an xorg-3 eclass to avoid any possibility of breaking
8 stable things.
9
10 Points of concern:
11
12 1) The fonts code is dead code as a result of fonts.eclass only
13 supporting EAPI=6. None of the fonts ebuilds have changed since
14 the transition to git, so we might just drop that code from
15 xorg-3 and perhaps ultimately rename xorg-2 to xorg-fonts or
16 something when all other ebuilds have transitioned?
17
18 2) Suggestions welcome for solving https://bugs.gentoo.org/637898
19 I have no ideas...
20
21 3) Meson support? This eclass is pretty autotools focused. Can we
22 somehow allow Meson support without too much hassle? Maybe it's
23 not worth it, since I'm not aware of any X11 projects other than
24 the Xserver to have Meson build systems. I'm happy to punt.
25
26 eclass/xorg-3.eclass | 583 +++++++++++++++++++++++++++++++++++++++++++
27 1 file changed, 583 insertions(+)
28 create mode 100644 eclass/xorg-3.eclass
29
30 diff --git a/eclass/xorg-3.eclass b/eclass/xorg-3.eclass
31 new file mode 100644
32 index 00000000000..fd045122013
33 --- /dev/null
34 +++ b/eclass/xorg-3.eclass
35 @@ -0,0 +1,583 @@
36 +# Copyright 1999-2019 Gentoo Authors
37 +# Distributed under the terms of the GNU General Public License v2
38 +
39 +# @ECLASS: xorg-3.eclass
40 +# @MAINTAINER:
41 +# x11@g.o
42 +# @AUTHOR:
43 +# Author: Tomáš Chvátal <scarabeus@g.o>
44 +# Author: Donnie Berkholz <dberkholz@g.o>
45 +# Author: Matt Turner <mattst88@g.o>
46 +# @SUPPORTED_EAPIS: 7
47 +# @BLURB: Reduces code duplication in the modularized X11 ebuilds.
48 +# @DESCRIPTION:
49 +# This eclass makes trivial X ebuilds possible for apps, fonts, drivers,
50 +# and more. Many things that would normally be done in various functions
51 +# can be accessed by setting variables instead, such as patching,
52 +# running eautoreconf, passing options to configure and installing docs.
53 +#
54 +# All you need to do in a basic ebuild is inherit this eclass and set
55 +# DESCRIPTION, KEYWORDS and RDEPEND/DEPEND. If your package is hosted
56 +# with the other X packages, you don't need to set SRC_URI. Pretty much
57 +# everything else should be automatic.
58 +
59 +GIT_ECLASS=""
60 +if [[ ${PV} == *9999* ]]; then
61 + GIT_ECLASS="git-r3"
62 + XORG_EAUTORECONF="yes"
63 +fi
64 +
65 +# If we're a font package, but not the font.alias one
66 +FONT_ECLASS=""
67 +if [[ ${PN} == font* \
68 + && ${CATEGORY} = media-fonts \
69 + && ${PN} != font-alias \
70 + && ${PN} != font-util ]]; then
71 + # Activate font code in the rest of the eclass
72 + FONT="yes"
73 + FONT_ECLASS="font"
74 +fi
75 +
76 +# @ECLASS-VARIABLE: XORG_MULTILIB
77 +# @DESCRIPTION:
78 +# If set to 'yes', the multilib support for package will be enabled. Set
79 +# before inheriting this eclass.
80 +: ${XORG_MULTILIB:="no"}
81 +
82 +# we need to inherit autotools first to get the deps
83 +inherit autotools eutils libtool multilib toolchain-funcs \
84 + flag-o-matic ${FONT_ECLASS} ${GIT_ECLASS}
85 +
86 +if [[ ${XORG_MULTILIB} == yes ]]; then
87 + inherit multilib-minimal
88 +fi
89 +
90 +EXPORTED_FUNCTIONS="src_prepare src_configure src_unpack src_compile src_install pkg_postinst pkg_postrm"
91 +case "${EAPI:-0}" in
92 + 7) ;;
93 + *) die "EAPI=${EAPI} is not supported" ;;
94 +esac
95 +
96 +# exports must be ALWAYS after inherit
97 +EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS}
98 +
99 +IUSE=""
100 +HOMEPAGE="https://www.x.org/wiki/ https://cgit.freedesktop.org/"
101 +
102 +# @ECLASS-VARIABLE: XORG_EAUTORECONF
103 +# @DESCRIPTION:
104 +# If set to 'yes' and configure.ac exists, eautoreconf will run. Set
105 +# before inheriting this eclass.
106 +: ${XORG_EAUTORECONF:="no"}
107 +
108 +# @ECLASS-VARIABLE: XORG_BASE_INDIVIDUAL_URI
109 +# @DESCRIPTION:
110 +# Set up SRC_URI for individual modular releases. If set to an empty
111 +# string, no SRC_URI will be provided by the eclass.
112 +: ${XORG_BASE_INDIVIDUAL_URI="https://www.x.org/releases/individual"}
113 +
114 +# @ECLASS-VARIABLE: XORG_MODULE
115 +# @DESCRIPTION:
116 +# The subdirectory to download source from. Possible settings are app,
117 +# doc, data, util, driver, font, lib, proto, xserver. Set above the
118 +# inherit to override the default autoconfigured module.
119 +if [[ -z ${XORG_MODULE} ]]; then
120 + case ${CATEGORY} in
121 + app-doc) XORG_MODULE=doc/ ;;
122 + media-fonts) XORG_MODULE=font/ ;;
123 + x11-apps|x11-wm) XORG_MODULE=app/ ;;
124 + x11-misc|x11-themes) XORG_MODULE=util/ ;;
125 + x11-base) XORG_MODULE=xserver/ ;;
126 + x11-drivers) XORG_MODULE=driver/ ;;
127 + x11-libs) XORG_MODULE=lib/ ;;
128 + *) XORG_MODULE= ;;
129 + esac
130 +fi
131 +
132 +# @ECLASS-VARIABLE: XORG_PACKAGE_NAME
133 +# @DESCRIPTION:
134 +# For git checkout the git repository might differ from package name.
135 +# This variable can be used for proper directory specification
136 +: ${XORG_PACKAGE_NAME:=${PN}}
137 +
138 +if [[ -n ${GIT_ECLASS} ]]; then
139 + : ${EGIT_REPO_URI:="https://anongit.freedesktop.org/git/xorg/${XORG_MODULE}${XORG_PACKAGE_NAME}.git"}
140 +elif [[ -n ${XORG_BASE_INDIVIDUAL_URI} ]]; then
141 + SRC_URI="${XORG_BASE_INDIVIDUAL_URI}/${XORG_MODULE}${P}.tar.bz2"
142 +fi
143 +
144 +: ${SLOT:=0}
145 +
146 +# Set the license for the package. This can be overridden by setting
147 +# LICENSE after the inherit. Nearly all FreeDesktop-hosted X packages
148 +# are under the MIT license. (This is what Red Hat does in their rpms)
149 +: ${LICENSE:=MIT}
150 +
151 +# Set up autotools shared dependencies
152 +# Remember that all versions here MUST be stable
153 +XORG_EAUTORECONF_ARCHES="ppc-aix x86-winnt"
154 +EAUTORECONF_DEPEND+="
155 + >=sys-devel/libtool-2.2.6a
156 + sys-devel/m4"
157 +if [[ ${PN} != util-macros ]] ; then
158 + EAUTORECONF_DEPEND+=" >=x11-misc/util-macros-1.18"
159 + # Required even by xorg-server
160 + [[ ${PN} == "font-util" ]] || EAUTORECONF_DEPEND+=" >=media-fonts/font-util-1.2.0"
161 +fi
162 +WANT_AUTOCONF="latest"
163 +WANT_AUTOMAKE="latest"
164 +for arch in ${XORG_EAUTORECONF_ARCHES}; do
165 + EAUTORECONF_DEPENDS+=" ${arch}? ( ${EAUTORECONF_DEPEND} )"
166 +done
167 +DEPEND+=" ${EAUTORECONF_DEPENDS}"
168 +[[ ${XORG_EAUTORECONF} != no ]] && BDEPEND+=" ${EAUTORECONF_DEPEND}"
169 +unset EAUTORECONF_DEPENDS
170 +unset EAUTORECONF_DEPEND
171 +
172 +if [[ ${FONT} == yes ]]; then
173 + RDEPEND+=" media-fonts/encodings
174 + x11-apps/mkfontscale
175 + x11-apps/mkfontdir"
176 + PDEPEND+=" media-fonts/font-alias"
177 + DEPEND+=" >=media-fonts/font-util-1.2.0"
178 +
179 + # @ECLASS-VARIABLE: FONT_DIR
180 + # @DESCRIPTION:
181 + # If you're creating a font package and the suffix of PN is not equal to
182 + # the subdirectory of /usr/share/fonts/ it should install into, set
183 + # FONT_DIR to that directory or directories. Set before inheriting this
184 + # eclass.
185 + [[ -z ${FONT_DIR} ]] && FONT_DIR=${PN##*-}
186 +
187 + # Fix case of font directories
188 + FONT_DIR=${FONT_DIR/ttf/TTF}
189 + FONT_DIR=${FONT_DIR/otf/OTF}
190 + FONT_DIR=${FONT_DIR/type1/Type1}
191 + FONT_DIR=${FONT_DIR/speedo/Speedo}
192 +
193 + # Set up configure options, wrapped so ebuilds can override if need be
194 + [[ -z ${FONT_OPTIONS} ]] && FONT_OPTIONS="--with-fontdir=\"${EPREFIX}/usr/share/fonts/${FONT_DIR}\""
195 +
196 + [[ ${PN} = font-misc-misc || ${PN} = font-schumacher-misc || ${PN##*-} = 75dpi || ${PN##*-} = 100dpi || ${PN##*-} = cyrillic ]] && IUSE+=" nls"
197 +fi
198 +
199 +# If we're a driver package, then enable DRIVER case
200 +[[ ${PN} == xf86-video-* || ${PN} == xf86-input-* ]] && DRIVER="yes"
201 +
202 +# @ECLASS-VARIABLE: XORG_STATIC
203 +# @DESCRIPTION:
204 +# Enables static-libs useflag. Set to no, if your package gets:
205 +#
206 +# QA: configure: WARNING: unrecognized options: --disable-static
207 +: ${XORG_STATIC:="yes"}
208 +
209 +# Add static-libs useflag where usefull.
210 +if [[ ${XORG_STATIC} == yes \
211 + && ${FONT} != yes \
212 + && ${CATEGORY} != app-doc \
213 + && ${CATEGORY} != x11-apps \
214 + && ${CATEGORY} != x11-drivers \
215 + && ${CATEGORY} != media-fonts \
216 + && ${PN} != util-macros \
217 + && ${PN} != xbitmaps \
218 + && ${PN} != xorg-cf-files \
219 + && ${PN/xcursor} = ${PN} ]]; then
220 + IUSE+=" static-libs"
221 +fi
222 +
223 +DEPEND+=" virtual/pkgconfig"
224 +
225 +# @ECLASS-VARIABLE: XORG_DRI
226 +# @DESCRIPTION:
227 +# Possible values are "always" or the value of the useflag DRI capabilities
228 +# are required for. Default value is "no"
229 +#
230 +# Eg. XORG_DRI="opengl" will pull all dri dependant deps for opengl useflag
231 +: ${XORG_DRI:="no"}
232 +
233 +DRI_COMMON_DEPEND="
234 + x11-base/xorg-server[-minimal]
235 + x11-libs/libdrm
236 +"
237 +case ${XORG_DRI} in
238 + no)
239 + ;;
240 + always)
241 + COMMON_DEPEND+=" ${DRI_COMMON_DEPEND}"
242 + ;;
243 + *)
244 + COMMON_DEPEND+=" ${XORG_DRI}? ( ${DRI_COMMON_DEPEND} )"
245 + IUSE+=" ${XORG_DRI}"
246 + ;;
247 +esac
248 +unset DRI_COMMON_DEPEND
249 +
250 +if [[ -n "${DRIVER}" ]]; then
251 + COMMON_DEPEND+="
252 + x11-base/xorg-server[xorg]
253 + "
254 +fi
255 +if [[ -n "${DRIVER}" && ${PN} == xf86-input-* ]]; then
256 + DEPEND+=" x11-base/xorg-proto"
257 +fi
258 +if [[ -n "${DRIVER}" && ${PN} == xf86-video-* ]]; then
259 + COMMON_DEPEND+="
260 + x11-libs/libpciaccess
261 + "
262 + DEPEND+=" x11-base/xorg-proto"
263 +fi
264 +
265 +# @ECLASS-VARIABLE: XORG_DOC
266 +# @DESCRIPTION:
267 +# Possible values are "always" or the value of the useflag doc packages
268 +# are required for. Default value is "no"
269 +#
270 +# Eg. XORG_DOC="manual" will pull all doc dependant deps for manual useflag
271 +: ${XORG_DOC:="no"}
272 +
273 +DOC_DEPEND="
274 + doc? (
275 + app-text/asciidoc
276 + app-text/xmlto
277 + app-doc/doxygen
278 + app-text/docbook-xml-dtd:4.1.2
279 + app-text/docbook-xml-dtd:4.2
280 + app-text/docbook-xml-dtd:4.3
281 + )
282 +"
283 +case ${XORG_DOC} in
284 + no)
285 + ;;
286 + always)
287 + DEPEND+=" ${DOC_DEPEND}"
288 + ;;
289 + *)
290 + DEPEND+=" ${XORG_DOC}? ( ${DOC_DEPEND} )"
291 + IUSE+=" ${XORG_DOC}"
292 + ;;
293 +esac
294 +unset DOC_DEPEND
295 +
296 +# @ECLASS-VARIABLE: XORG_MODULE_REBUILD
297 +# @DESCRIPTION:
298 +# Describes whether a package contains modules that need to be rebuilt on
299 +# xorg-server upgrade.
300 +# Possible values are "yes" or "no". Default value is "yes" for packages which
301 +# are recognized as DRIVER by this eclass and "no" for all other packages.
302 +if [[ "${DRIVER}" == yes ]]; then
303 + : ${XORG_MODULE_REBUILD:="yes"}
304 +else
305 + : ${XORG_MODULE_REBUILD:="no"}
306 +fi
307 +[[ ${XORG_MODULE_REBUILD} == yes ]] && RDEPEND+=" x11-base/xorg-server:="
308 +
309 +DEPEND+=" ${COMMON_DEPEND}"
310 +RDEPEND+=" ${COMMON_DEPEND}"
311 +unset COMMON_DEPEND
312 +
313 +debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: DEPEND=${DEPEND}"
314 +debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: RDEPEND=${RDEPEND}"
315 +debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: PDEPEND=${PDEPEND}"
316 +
317 +# @FUNCTION: xorg-3_pkg_setup
318 +# @DESCRIPTION:
319 +# Setup prefix compat
320 +xorg-3_pkg_setup() {
321 + debug-print-function ${FUNCNAME} "$@"
322 +
323 + [[ ${FONT} == yes ]] && font_pkg_setup "$@"
324 +}
325 +
326 +# @FUNCTION: xorg-3_src_unpack
327 +# @DESCRIPTION:
328 +# Simply unpack source code.
329 +xorg-3_src_unpack() {
330 + debug-print-function ${FUNCNAME} "$@"
331 +
332 + if [[ -n ${GIT_ECLASS} ]]; then
333 + git-r3_src_unpack
334 + else
335 + unpack ${A}
336 + fi
337 +
338 + [[ -n ${FONT_OPTIONS} ]] && einfo "Detected font directory: ${FONT_DIR}"
339 +}
340 +
341 +# @FUNCTION: xorg-3_reconf_source
342 +# @DESCRIPTION:
343 +# Run eautoreconf if necessary, and run elibtoolize.
344 +xorg-3_reconf_source() {
345 + debug-print-function ${FUNCNAME} "$@"
346 +
347 + case ${CHOST} in
348 + *-aix* | *-winnt*)
349 + # some hosts need full eautoreconf
350 + [[ -e "./configure.ac" || -e "./configure.in" ]] \
351 + && XORG_EAUTORECONF=yes
352 + ;;
353 + *)
354 + # elibtoolize required for BSD
355 + [[ ${XORG_EAUTORECONF} != no && ( -e "./configure.ac" || -e "./configure.in" ) ]] \
356 + && XORG_EAUTORECONF=yes
357 + ;;
358 + esac
359 +
360 + [[ ${XORG_EAUTORECONF} != no ]] && eautoreconf
361 + elibtoolize --patch-only
362 +}
363 +
364 +# @FUNCTION: xorg-3_src_prepare
365 +# @DESCRIPTION:
366 +# Prepare a package after unpacking, performing all X-related tasks.
367 +xorg-3_src_prepare() {
368 + debug-print-function ${FUNCNAME} "$@"
369 +
370 + default
371 + xorg-3_reconf_source
372 +
373 + [[ ${PATCHES} ]] && epatch "${PATCHES[@]}"
374 +}
375 +
376 +# @FUNCTION: xorg-3_font_configure
377 +# @DESCRIPTION:
378 +# If a font package, perform any necessary configuration steps
379 +xorg-3_font_configure() {
380 + debug-print-function ${FUNCNAME} "$@"
381 +
382 + if has nls ${IUSE//+} && ! use nls; then
383 + if grep -q -s "disable-all-encodings" ${ECONF_SOURCE:-.}/configure; then
384 + FONT_OPTIONS+="
385 + --disable-all-encodings
386 + --enable-iso8859-1"
387 + else
388 + FONT_OPTIONS+="
389 + --disable-iso8859-2
390 + --disable-iso8859-3
391 + --disable-iso8859-4
392 + --disable-iso8859-5
393 + --disable-iso8859-6
394 + --disable-iso8859-7
395 + --disable-iso8859-8
396 + --disable-iso8859-9
397 + --disable-iso8859-10
398 + --disable-iso8859-11
399 + --disable-iso8859-12
400 + --disable-iso8859-13
401 + --disable-iso8859-14
402 + --disable-iso8859-15
403 + --disable-iso8859-16
404 + --disable-jisx0201
405 + --disable-koi8-r"
406 + fi
407 + fi
408 +}
409 +
410 +# @FUNCTION: xorg-3_flags_setup
411 +# @DESCRIPTION:
412 +# Set up CFLAGS for a debug build
413 +xorg-3_flags_setup() {
414 + debug-print-function ${FUNCNAME} "$@"
415 +
416 + # Win32 require special define
417 + [[ ${CHOST} == *-winnt* ]] && append-cppflags -DWIN32 -D__STDC__
418 + # hardened ldflags
419 + [[ ${PN} = xorg-server || -n ${DRIVER} ]] && append-ldflags -Wl,-z,lazy
420 +
421 + # Quite few libraries fail on runtime without these:
422 + if has static-libs ${IUSE//+}; then
423 + filter-flags -Wl,-Bdirect
424 + filter-ldflags -Bdirect
425 + filter-ldflags -Wl,-Bdirect
426 + fi
427 +}
428 +
429 +multilib_src_configure() {
430 + ECONF_SOURCE="${S}" econf "${econfargs[@]}"
431 +}
432 +
433 +# @FUNCTION: xorg-3_src_configure
434 +# @DESCRIPTION:
435 +# Perform any necessary pre-configuration steps, then run configure
436 +xorg-3_src_configure() {
437 + debug-print-function ${FUNCNAME} "$@"
438 +
439 + xorg-3_flags_setup
440 +
441 + # @VARIABLE: XORG_CONFIGURE_OPTIONS
442 + # @DESCRIPTION:
443 + # Array of an additional options to pass to configure.
444 + # @DEFAULT_UNSET
445 + if [[ $(declare -p XORG_CONFIGURE_OPTIONS 2>&-) != "declare -a"* ]]; then
446 + # fallback to CONFIGURE_OPTIONS, deprecated.
447 + if [[ -n "${CONFIGURE_OPTIONS}" ]]; then
448 + eqawarn "CONFIGURE_OPTIONS are deprecated. Please migrate to XORG_CONFIGURE_OPTIONS"
449 + eqawarn "to preserve namespace."
450 + fi
451 +
452 + local xorgconfadd=(${CONFIGURE_OPTIONS} ${XORG_CONFIGURE_OPTIONS})
453 + else
454 + local xorgconfadd=("${XORG_CONFIGURE_OPTIONS[@]}")
455 + fi
456 +
457 + [[ -n "${FONT}" ]] && xorg-3_font_configure
458 +
459 + # Check if package supports disabling of dep tracking
460 + # Fixes warnings like:
461 + # WARNING: unrecognized options: --disable-dependency-tracking
462 + if grep -q -s "disable-depencency-tracking" ${ECONF_SOURCE:-.}/configure; then
463 + local dep_track="--disable-dependency-tracking"
464 + fi
465 +
466 + # Check if package supports disabling of selective -Werror=...
467 + if grep -q -s "disable-selective-werror" ${ECONF_SOURCE:-.}/configure; then
468 + local selective_werror="--disable-selective-werror"
469 + fi
470 +
471 + local econfargs=(
472 + ${dep_track}
473 + ${selective_werror}
474 + ${FONT_OPTIONS}
475 + "${xorgconfadd[@]}"
476 + )
477 +
478 + # Handle static-libs found in IUSE, disable them by default
479 + if in_iuse static-libs; then
480 + econfargs+=(
481 + --enable-shared
482 + $(use_enable static-libs static)
483 + )
484 + fi
485 +
486 + if [[ ${XORG_MULTILIB} == yes ]]; then
487 + multilib-minimal_src_configure "$@"
488 + else
489 + econf "${econfargs[@]}" "$@"
490 + fi
491 +}
492 +
493 +multilib_src_compile() {
494 + emake "$@" || die 'emake failed'
495 +}
496 +
497 +# @FUNCTION: xorg-3_src_compile
498 +# @DESCRIPTION:
499 +# Compile a package, performing all X-related tasks.
500 +xorg-3_src_compile() {
501 + debug-print-function ${FUNCNAME} "$@"
502 +
503 + if [[ ${XORG_MULTILIB} == yes ]]; then
504 + multilib-minimal_src_compile "$@"
505 + else
506 + emake "$@" || die 'emake failed'
507 + fi
508 +}
509 +
510 +multilib_src_install() {
511 + emake DESTDIR="${D}" "${install_args[@]}" "$@" install || die "emake install failed"
512 +}
513 +
514 +# @FUNCTION: xorg-3_src_install
515 +# @DESCRIPTION:
516 +# Install a built package to ${D}, performing any necessary steps.
517 +# Creates a ChangeLog from git if using live ebuilds.
518 +xorg-3_src_install() {
519 + debug-print-function ${FUNCNAME} "$@"
520 +
521 + local install_args=( docdir="${EPREFIX}/usr/share/doc/${PF}" )
522 +
523 + if [[ ${XORG_MULTILIB} == yes ]]; then
524 + multilib-minimal_src_install "$@"
525 + else
526 + emake DESTDIR="${D}" "${install_args[@]}" "$@" install || die "emake install failed"
527 + fi
528 +
529 + if [[ -n ${GIT_ECLASS} ]]; then
530 + pushd "${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}" > /dev/null || die
531 + git log ${EGIT_COMMIT} > "${S}"/ChangeLog
532 + popd > /dev/null || die
533 + fi
534 +
535 + if [[ -e "${S}"/ChangeLog ]]; then
536 + dodoc "${S}"/ChangeLog || die "dodoc failed"
537 + fi
538 +
539 + # Don't install libtool archives (even for modules)
540 + find "${D}" -type f -name '*.la' -delete || die
541 +
542 + [[ -n ${FONT} ]] && remove_font_metadata
543 +}
544 +
545 +# @FUNCTION: xorg-3_pkg_postinst
546 +# @DESCRIPTION:
547 +# Run X-specific post-installation tasks on the live filesystem. The
548 +# only task right now is some setup for font packages.
549 +xorg-3_pkg_postinst() {
550 + debug-print-function ${FUNCNAME} "$@"
551 +
552 + if [[ -n ${FONT} ]]; then
553 + create_fonts_scale
554 + create_fonts_dir
555 + font_pkg_postinst "$@"
556 +
557 + ewarn "Installed fonts changed. Run 'xset fp rehash' if you are using non-fontconfig applications."
558 + fi
559 +}
560 +
561 +# @FUNCTION: xorg-3_pkg_postrm
562 +# @DESCRIPTION:
563 +# Run X-specific post-removal tasks on the live filesystem. The only
564 +# task right now is some cleanup for font packages.
565 +xorg-3_pkg_postrm() {
566 + debug-print-function ${FUNCNAME} "$@"
567 +
568 + if [[ -n ${FONT} ]]; then
569 + # if we're doing an upgrade, postinst will do
570 + if [[ -z ${REPLACED_BY_VERSION} ]]; then
571 + create_fonts_scale
572 + create_fonts_dir
573 + font_pkg_postrm "$@"
574 + fi
575 + fi
576 +}
577 +
578 +# @FUNCTION: remove_font_metadata
579 +# @DESCRIPTION:
580 +# Don't let the package install generated font files that may overlap
581 +# with other packages. Instead, they're generated in pkg_postinst().
582 +remove_font_metadata() {
583 + debug-print-function ${FUNCNAME} "$@"
584 +
585 + if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then
586 + einfo "Removing font metadata"
587 + rm -rf "${ED}"/usr/share/fonts/${FONT_DIR}/fonts.{scale,dir,cache-1}
588 + fi
589 +}
590 +
591 +# @FUNCTION: create_fonts_scale
592 +# @DESCRIPTION:
593 +# Create fonts.scale file, used by the old server-side fonts subsystem.
594 +create_fonts_scale() {
595 + debug-print-function ${FUNCNAME} "$@"
596 +
597 + if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then
598 + ebegin "Generating fonts.scale"
599 + mkfontscale \
600 + -a "${EROOT}/usr/share/fonts/encodings/encodings.dir" \
601 + -- "${EROOT}/usr/share/fonts/${FONT_DIR}"
602 + eend $?
603 + fi
604 +}
605 +
606 +# @FUNCTION: create_fonts_dir
607 +# @DESCRIPTION:
608 +# Create fonts.dir file, used by the old server-side fonts subsystem.
609 +create_fonts_dir() {
610 + debug-print-function ${FUNCNAME} "$@"
611 +
612 + ebegin "Generating fonts.dir"
613 + mkfontdir \
614 + -e "${EROOT}"/usr/share/fonts/encodings \
615 + -e "${EROOT}"/usr/share/fonts/encodings/large \
616 + -- "${EROOT}/usr/share/fonts/${FONT_DIR}"
617 + eend $?
618 +}
619 --
620 2.19.2

Replies