/[gentoo-x86]/eclass/chromium.eclass
Gentoo

Contents of /eclass/chromium.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (hide annotations) (download)
Thu Jun 4 18:49:42 2015 UTC (4 weeks, 3 days ago) by kensington
Branch: MAIN
CVS Tags: HEAD
Changes since 1.11: +2 -2 lines
Move various kde-base packages to kde-apps.

1 floppym 1.10 # Copyright 1999-2015 Gentoo Foundation
2 floppym 1.1 # Distributed under the terms of the GNU General Public License v2
3 kensington 1.12 # $Header: /var/cvsroot/gentoo-x86/eclass/chromium.eclass,v 1.11 2015/05/21 12:28:00 floppym Exp $
4 floppym 1.1
5     # @ECLASS: chromium.eclass
6     # @MAINTAINER:
7     # Chromium Herd <chromium@gentoo.org>
8     # @AUTHOR:
9     # Mike Gilbert <floppym@gentoo.org>
10     # @BLURB: Shared functions for chromium and google-chrome
11    
12     inherit eutils fdo-mime gnome2-utils linux-info
13    
14 floppym 1.8 if [[ ${CHROMIUM_EXPORT_PHASES} != no ]]; then
15     EXPORT_FUNCTIONS pkg_preinst pkg_postinst pkg_postrm
16     fi
17 floppym 1.1
18 floppym 1.3 if [[ ${PN} == chromium ]]; then
19     IUSE+=" custom-cflags"
20     fi
21    
22 phajdan.jr 1.5 # @FUNCTION: chromium_suid_sandbox_check_kernel_config
23 floppym 1.1 # @USAGE:
24     # @DESCRIPTION:
25 phajdan.jr 1.5 # Ensures the system kernel supports features needed for SUID sandbox to work.
26     chromium_suid_sandbox_check_kernel_config() {
27 floppym 1.1 has "${EAPI:-0}" 0 1 2 3 && die "EAPI=${EAPI} is not supported"
28    
29     if [[ "${MERGE_TYPE}" == "source" || "${MERGE_TYPE}" == "binary" ]]; then
30     # Warn if the kernel does not support features needed for sandboxing.
31     # Bug #363987.
32     ERROR_PID_NS="PID_NS is required for sandbox to work"
33     ERROR_NET_NS="NET_NS is required for sandbox to work"
34 floppym 1.10 ERROR_USER_NS="USER_NS is required for sandbox to work"
35 phajdan.jr 1.9 ERROR_SECCOMP_FILTER="SECCOMP_FILTER is required for sandbox to work"
36 floppym 1.11 CONFIG_CHECK="~PID_NS ~NET_NS ~SECCOMP_FILTER ~USER_NS"
37 floppym 1.1 check_extra_config
38     fi
39     }
40    
41     # @ECLASS-VARIABLE: CHROMIUM_LANGS
42     # @DEFAULT_UNSET
43     # @DESCRIPTION:
44     # List of language packs available for this package.
45    
46     _chromium_set_linguas_IUSE() {
47     [[ ${EAPI:-0} == 0 ]] && die "EAPI=${EAPI} is not supported"
48    
49     local lang
50     for lang in ${CHROMIUM_LANGS}; do
51     # Default to enabled since we bundle them anyway.
52     # USE-expansion will take care of disabling the langs the user has not
53     # selected via LINGUAS.
54     IUSE+=" +linguas_${lang}"
55     done
56     }
57    
58     if [[ ${CHROMIUM_LANGS} ]]; then
59     _chromium_set_linguas_IUSE
60     fi
61    
62     _chromium_crlang() {
63     local x
64     for x in "$@"; do
65     case $x in
66     es_LA) echo es-419 ;;
67     *) echo "${x/_/-}" ;;
68     esac
69     done
70     }
71    
72     _chromium_syslang() {
73     local x
74     for x in "$@"; do
75     case $x in
76     es-419) echo es_LA ;;
77     *) echo "${x/-/_}" ;;
78     esac
79     done
80     }
81    
82     _chromium_strip_pak() {
83     local x
84     for x in "$@"; do
85     echo "${x%.pak}"
86     done
87     }
88    
89     # @FUNCTION: chromium_remove_language_paks
90     # @USAGE:
91     # @DESCRIPTION:
92     # Removes pak files from the current directory for languages that the user has
93     # not selected via the LINGUAS variable.
94     # Also performs QA checks to ensure CHROMIUM_LANGS has been set correctly.
95     chromium_remove_language_paks() {
96     local crlangs=$(_chromium_crlang ${CHROMIUM_LANGS})
97     local present_crlangs=$(_chromium_strip_pak *.pak)
98     local present_langs=$(_chromium_syslang ${present_crlangs})
99     local lang
100    
101     # Look for missing pak files.
102     for lang in ${crlangs}; do
103     if ! has ${lang} ${present_crlangs}; then
104     eqawarn "LINGUAS warning: no .pak file for ${lang} (${lang}.pak not found)"
105     fi
106     done
107    
108     # Look for extra pak files.
109     # Remove pak files that the user does not want.
110     for lang in ${present_langs}; do
111     if [[ ${lang} == en_US ]]; then
112     continue
113     fi
114     if ! has ${lang} ${CHROMIUM_LANGS}; then
115     eqawarn "LINGUAS warning: no ${lang} in LANGS"
116     continue
117     fi
118     if ! use linguas_${lang}; then
119 floppym 1.6 rm "$(_chromium_crlang ${lang}).pak" || die
120 floppym 1.1 fi
121     done
122     }
123    
124     chromium_pkg_preinst() {
125     gnome2_icon_savelist
126     }
127    
128     chromium_pkg_postinst() {
129     fdo-mime_desktop_database_update
130     gnome2_icon_cache_update
131    
132     # For more info see bug #292201, bug #352263, bug #361859.
133 floppym 1.4 if ! has_version x11-themes/gnome-icon-theme &&
134     ! has_version x11-themes/oxygen-icons ; then
135     elog
136     elog "Depending on your desktop environment, you may need"
137     elog "to install additional packages to get icons on the Downloads page."
138     elog
139 kensington 1.12 elog "For KDE, the required package is kde-apps/oxygen-icons."
140 floppym 1.4 elog
141     elog "For other desktop environments, try one of the following:"
142     elog " - x11-themes/gnome-icon-theme"
143     elog " - x11-themes/tango-icon-theme"
144     fi
145 floppym 1.1
146     # For more info see bug #359153.
147     elog
148     elog "Some web pages may require additional fonts to display properly."
149     elog "Try installing some of the following packages if some characters"
150     elog "are not displayed properly:"
151     elog " - media-fonts/arphicfonts"
152     elog " - media-fonts/bitstream-cyberbit"
153     elog " - media-fonts/droid"
154     elog " - media-fonts/ipamonafont"
155     elog " - media-fonts/ja-ipafonts"
156     elog " - media-fonts/takao-fonts"
157     elog " - media-fonts/wqy-microhei"
158     elog " - media-fonts/wqy-zenhei"
159     }
160    
161     chromium_pkg_postrm() {
162     gnome2_icon_cache_update
163     }
164    
165     chromium_pkg_die() {
166     if [[ "${EBUILD_PHASE}" != "compile" ]]; then
167     return
168     fi
169    
170     # Prevent user problems like bug #348235.
171     eshopts_push -s extglob
172     if is-flagq '-g?(gdb)?([1-9])'; then
173     ewarn
174     ewarn "You have enabled debug info (i.e. -g or -ggdb in your CFLAGS/CXXFLAGS)."
175 floppym 1.2 ewarn "This produces very large build files causes the linker to consume large"
176     ewarn "amounts of memory."
177     ewarn
178 floppym 1.1 ewarn "Please try removing -g{,gdb} before reporting a bug."
179     ewarn
180     fi
181     eshopts_pop
182    
183     # ccache often causes bogus compile failures, especially when the cache gets
184     # corrupted.
185     if has ccache ${FEATURES}; then
186     ewarn
187     ewarn "You have enabled ccache. Please try disabling ccache"
188     ewarn "before reporting a bug."
189     ewarn
190     fi
191    
192     # No ricer bugs.
193     if use_if_iuse custom-cflags; then
194     ewarn
195     ewarn "You have enabled the custom-cflags USE flag."
196     ewarn "Please disable it before reporting a bug."
197     ewarn
198     fi
199    
200     # If the system doesn't have enough memory, the compilation is known to
201     # fail. Print info about memory to recognize this condition.
202     einfo
203     einfo "$(grep MemTotal /proc/meminfo)"
204     einfo "$(grep SwapTotal /proc/meminfo)"
205     einfo
206     }
207    
208     # @VARIABLE: EGYP_CHROMIUM_COMMAND
209     # @DESCRIPTION:
210     # Path to the gyp_chromium script.
211     : ${EGYP_CHROMIUM_COMMAND:=build/gyp_chromium}
212    
213     # @VARIABLE: EGYP_CHROMIUM_DEPTH
214     # @DESCRIPTION:
215     # Depth for egyp_chromium.
216     : ${EGYP_CHROMIUM_DEPTH:=.}
217    
218     # @FUNCTION: egyp_chromium
219     # @USAGE: [gyp arguments]
220     # @DESCRIPTION:
221     # Calls EGYP_CHROMIUM_COMMAND with depth EGYP_CHROMIUM_DEPTH and given
222     # arguments. The full command line is echoed for logging.
223     egyp_chromium() {
224     set -- "${EGYP_CHROMIUM_COMMAND}" --depth="${EGYP_CHROMIUM_DEPTH}" "$@"
225     echo "$@"
226     "$@"
227     }
228    
229     # @FUNCTION: gyp_use
230     # @USAGE: <USE flag> [GYP flag] [true suffix] [false suffix]
231     # @DESCRIPTION:
232     # If USE flag is set, echo -D[GYP flag]=[true suffix].
233     #
234     # If USE flag is not set, echo -D[GYP flag]=[false suffix].
235     #
236     # [GYP flag] defaults to use_[USE flag] with hyphens converted to underscores.
237     #
238     # [true suffix] defaults to 1. [false suffix] defaults to 0.
239     gyp_use() {
240     local gypflag="-D${2:-use_${1//-/_}}="
241     usex "$1" "${gypflag}" "${gypflag}" "${3-1}" "${4-0}"
242     }
243    
244     # @FUNCTION: chromium_bundled_v8_version
245     # @USAGE: [path to version.cc]
246     # @DESCRIPTION:
247     # Outputs the version of v8 parsed from a (bundled) copy of the source code.
248     chromium_bundled_v8_version() {
249     local vf=${1:-v8/src/version.cc}
250     local major minor build patch
251     major=$(sed -ne 's/#define MAJOR_VERSION *\([0-9]*\)/\1/p' "${vf}")
252     minor=$(sed -ne 's/#define MINOR_VERSION *\([0-9]*\)/\1/p' "${vf}")
253     build=$(sed -ne 's/#define BUILD_NUMBER *\([0-9]*\)/\1/p' "${vf}")
254     patch=$(sed -ne 's/#define PATCH_LEVEL *\([0-9]*\)/\1/p' "${vf}")
255     echo "${major}.${minor}.${build}.${patch}"
256     }
257    
258     # @FUNCTION: chromium_installed_v8_version
259     # @USAGE:
260     # @DESCRIPTION:
261     # Outputs the version of dev-lang/v8 currently installed on the host system.
262     chromium_installed_v8_version() {
263     local cpf=$(best_version dev-lang/v8)
264     local pvr=${cpf#dev-lang/v8-}
265     echo "${pvr%-r*}"
266     }

  ViewVC Help
Powered by ViewVC 1.1.20