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

Contents of /eclass/chromium.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (hide annotations) (download)
Tue Sep 11 08:15:08 2012 UTC (2 years ago) by phajdan.jr
Branch: MAIN
Changes since 1.6: +1 -11 lines
Remove deprecated chromium_check_kernel_config.

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

  ViewVC Help
Powered by ViewVC 1.1.20