1 |
--- |
2 |
eclass/font.eclass | 57 +++++++++++++++++++++++----------------------- |
3 |
1 file changed, 28 insertions(+), 29 deletions(-) |
4 |
|
5 |
diff --git a/eclass/font.eclass b/eclass/font.eclass |
6 |
index 58ec9e3..622f143 100644 |
7 |
--- a/eclass/font.eclass |
8 |
+++ b/eclass/font.eclass |
9 |
@@ -1,4 +1,4 @@ |
10 |
-# Copyright 1999-2015 Gentoo Foundation |
11 |
+# Copyright 1999-2019 Gentoo Foundation |
12 |
# Distributed under the terms of the GNU General Public License v2 |
13 |
|
14 |
# @ECLASS: font.eclass |
15 |
@@ -7,12 +7,11 @@ |
16 |
# @BLURB: Eclass to make font installation uniform |
17 |
|
18 |
case ${EAPI:-0} in |
19 |
- 0|1|2|3|4|5|6) ;; |
20 |
- *) die "EAPI ${EAPI} is not supported by font.eclass." ;; |
21 |
+ 0|1|2|3|4|5|6) inherit eutils ;; |
22 |
+ 7) ;; |
23 |
+ *) die "EAPI ${EAPI} is not supported by font.eclass." ;; |
24 |
esac |
25 |
|
26 |
-inherit eutils |
27 |
- |
28 |
EXPORT_FUNCTIONS pkg_setup src_install pkg_postinst pkg_postrm |
29 |
|
30 |
# @ECLASS-VARIABLE: FONT_SUFFIX |
31 |
@@ -68,12 +67,12 @@ font_xfont_config() { |
32 |
if has X ${IUSE//+} && use X ; then |
33 |
dir_name="${1:-${FONT_PN}}" |
34 |
ebegin "Creating fonts.scale & fonts.dir in ${dir_name##*/}" |
35 |
- rm -f "${ED}${FONTDIR}/${1//${S}/}"/{fonts.{dir,scale},encodings.dir} |
36 |
- mkfontscale "${ED}${FONTDIR}/${1//${S}/}" |
37 |
+ rm -f "${ED%/}/${FONTDIR}/${1//${S}/}"/{fonts.{dir,scale},encodings.dir} |
38 |
+ mkfontscale "${ED%/}/${FONTDIR}/${1//${S}/}" |
39 |
mkfontdir \ |
40 |
-e ${EPREFIX}/usr/share/fonts/encodings \ |
41 |
-e ${EPREFIX}/usr/share/fonts/encodings/large \ |
42 |
- "${ED}${FONTDIR}/${1//${S}/}" |
43 |
+ "${ED%/}/${FONTDIR}/${1//${S}/}" |
44 |
eend $? |
45 |
if [[ -e fonts.alias ]] ; then |
46 |
doins fonts.alias |
47 |
@@ -103,7 +102,7 @@ font_cleanup_dirs() { |
48 |
local d f g generated candidate otherfile |
49 |
|
50 |
ebegin "Cleaning up font directories" |
51 |
- find -L "${EROOT}"usr/share/fonts/ -type d -print0 | while read -d $'\0' d; do |
52 |
+ find -L "${EROOT%/}"/usr/share/fonts/ -type d -print0 | while read -d $'\0' d; do |
53 |
candidate=false |
54 |
otherfile=false |
55 |
for f in "${d}"/*; do |
56 |
@@ -160,7 +159,7 @@ font_pkg_setup() { |
57 |
|
58 |
# make sure we get no collisions |
59 |
# setup is not the nicest place, but preinst doesn't cut it |
60 |
- [[ -e "${EROOT}/${FONTDIR}/fonts.cache-1" ]] && rm -f "${EROOT}/${FONTDIR}/fonts.cache-1" |
61 |
+ [[ -e "${EROOT%/}/${FONTDIR}/fonts.cache-1" ]] && rm -f "${EROOT%/}/${FONTDIR}/fonts.cache-1" |
62 |
} |
63 |
|
64 |
# @FUNCTION: font_src_install |
65 |
@@ -202,36 +201,42 @@ font_src_install() { |
66 |
done |
67 |
} |
68 |
|
69 |
+# @FUNCTION: _update_fontcache |
70 |
+# @DESCRIPTION: |
71 |
+# Updates fontcache if !prefix and media-libs/fontconfig installed |
72 |
+_update_fontcache() { |
73 |
+ # TODO: cleanup after <EAPI-7 is banned |
74 |
+ if has_version media-libs/fontconfig && { [[ -z ${ROOT} ]] || [[ ${ROOT} == / ]] ; } then |
75 |
+ ebegin "Updating global fontcache" |
76 |
+ fc-cache -fs |
77 |
+ eend $? |
78 |
+ else |
79 |
+ einfo "Skipping fontcache update (media-libs/fontconfig is not installed or ROOT != /)" |
80 |
+ fi |
81 |
+} |
82 |
+ |
83 |
# @FUNCTION: font_pkg_postinst |
84 |
# @DESCRIPTION: |
85 |
# The font pkg_postinst function. |
86 |
font_pkg_postinst() { |
87 |
# unreadable font files = fontconfig segfaults |
88 |
- find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \ |
89 |
+ find "${EROOT%/}"/usr/share/fonts/ -type f '!' -perm 0644 -print0 \ |
90 |
| xargs -0 chmod -v 0644 2>/dev/null |
91 |
|
92 |
if [[ -n ${FONT_CONF[@]} ]]; then |
93 |
local conffile |
94 |
- echo |
95 |
elog "The following fontconfig configuration files have been installed:" |
96 |
elog |
97 |
for conffile in "${FONT_CONF[@]}"; do |
98 |
- if [[ -e ${EROOT}etc/fonts/conf.avail/$(basename ${conffile}) ]]; then |
99 |
+ if [[ -e ${EROOT%/}/etc/fonts/conf.avail/$(basename ${conffile}) ]]; then |
100 |
elog " $(basename ${conffile})" |
101 |
fi |
102 |
done |
103 |
elog |
104 |
elog "Use \`eselect fontconfig\` to enable/disable them." |
105 |
- echo |
106 |
fi |
107 |
|
108 |
- if has_version media-libs/fontconfig && [[ ${ROOT} == / ]]; then |
109 |
- ebegin "Updating global fontcache" |
110 |
- fc-cache -fs |
111 |
- eend $? |
112 |
- else |
113 |
- einfo "Skipping fontcache update (media-libs/fontconfig is not installed or ROOT != /)" |
114 |
- fi |
115 |
+ _update_fontcache |
116 |
} |
117 |
|
118 |
# @FUNCTION: font_pkg_postrm |
119 |
@@ -241,14 +246,8 @@ font_pkg_postrm() { |
120 |
font_cleanup_dirs |
121 |
|
122 |
# unreadable font files = fontconfig segfaults |
123 |
- find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \ |
124 |
+ find "${EROOT%/}"/usr/share/fonts/ -type f '!' -perm 0644 -print0 \ |
125 |
| xargs -0 chmod -v 0644 2>/dev/null |
126 |
|
127 |
- if has_version media-libs/fontconfig && [[ ${ROOT} == / ]]; then |
128 |
- ebegin "Updating global fontcache" |
129 |
- fc-cache -fs |
130 |
- eend $? |
131 |
- else |
132 |
- einfo "Skipping fontcache update (media-libs/fontconfig is not installed or ROOT != /)" |
133 |
- fi |
134 |
+ _update_fontcache |
135 |
} |
136 |
-- |
137 |
2.21.0 |