1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
4 # @ECLASS: eutils.eclass
6 # base-system@gentoo.org
7 # @BLURB: many extra (but common) functions that are used in ebuilds
9 # The eutils eclass contains a suite of functions that complement
10 # the ones that ebuild.sh already contain. The idea is that the functions
11 # are not required in all ebuilds but enough utilize them to have a common
12 # home rather than having multiple ebuilds implementing the same thing.
14 # Due to the nature of this eclass, some functions may have maintainers
15 # different from the overall eclass!
17 if [[ -z ${_EUTILS_ECLASS} ]]; then
20 # implicitly inherited (now split) eclasses
23 inherit epatch estack ltprune multilib toolchain-funcs
30 # Proxy to ewarn for package managers that don't provide eqawarn and use the PM
31 # implementation if available. Reuses PORTAGE_ELOG_CLASSES as set by the dev
33 if ! declare -F eqawarn >/dev/null ; then
35 has qa ${PORTAGE_ELOG_CLASSES} && ewarn "$@"
40 # @FUNCTION: ecvs_clean
41 # @USAGE: [list of dirs]
43 # Remove CVS directories recursiveley. Useful when a source tarball contains
44 # internal CVS directories. Defaults to $PWD.
46 [[ $# -eq 0 ]] && set -- .
47 find "$@" -type d -name 'CVS' -prune -print0 | xargs -0 rm -rf
48 find "$@" -type f -name '.cvs*' -print0 | xargs -0 rm -rf
51 # @FUNCTION: esvn_clean
52 # @USAGE: [list of dirs]
54 # Remove .svn directories recursiveley. Useful when a source tarball contains
55 # internal Subversion directories. Defaults to $PWD.
57 [[ $# -eq 0 ]] && set -- .
58 find "$@" -type d -name '.svn' -prune -print0 | xargs -0 rm -rf
61 # @FUNCTION: egit_clean
62 # @USAGE: [list of dirs]
64 # Remove .git* directories/files recursiveley. Useful when a source tarball
65 # contains internal Git directories. Defaults to $PWD.
67 [[ $# -eq 0 ]] && set -- .
68 find "$@" -type d -name '.git*' -prune -print0 | xargs -0 rm -rf
74 # Cheap replacement for when debianutils (and thus mktemp)
75 # does not exist on the users system.
78 [[ $1 == -d ]] && exe="mkdir" && shift
81 if [[ -z ${topdir} ]] ; then
87 if ! type -P mktemp > /dev/null ; then
88 # system lacks `mktemp` so we have to fake it
90 while [[ -e ${tmp} ]] ; do
91 tmp=${topdir}/tmp.${RANDOM}.${RANDOM}.${RANDOM}
93 ${exe} "${tmp}" || ${exe} -p "${tmp}"
96 # the args here will give slightly wierd names on BSD,
97 # but should produce a usable file on all userlands
98 if [[ ${exe} == "touch" ]] ; then
99 TMPDIR="${topdir}" mktemp -t tmp.XXXXXXXXXX
101 TMPDIR="${topdir}" mktemp -dt tmp.XXXXXXXXXX
106 # @FUNCTION: edos2unix
107 # @USAGE: <file> [more files ...]
109 # A handy replacement for dos2unix, recode, fixdos, etc... This allows you
110 # to remove all of these text utilities from DEPEND variables because this
111 # is a script based solution. Just give it a list of files to convert and
112 # they will all be changed from the DOS CRLF format to the UNIX LF format.
114 [[ $# -eq 0 ]] && return 0
115 sed -i 's/\r$//' -- "$@" || die
118 # @FUNCTION: make_desktop_entry
119 # @USAGE: make_desktop_entry(<command>, [name], [icon], [type], [fields])
121 # Make a .desktop file.
124 # binary: what command does the app run with ?
125 # name: the name that will show up in the menu
126 # icon: the icon to use in the menu entry
127 # this can be relative (to /usr/share/pixmaps) or
128 # a full path to an icon
129 # type: what kind of application is this?
131 # https://specifications.freedesktop.org/menu-spec/latest/apa.html
132 # if unset, function tries to guess from package's category
133 # fields: extra fields to append to the desktop file; a printf string
135 make_desktop_entry() {
136 [[ -z $1 ]] && die "make_desktop_entry: You must specify the executable"
139 local name=${2:-${PN}}
140 local icon=${3:-${PN}}
144 if [[ -z ${type} ]] ; then
145 local catmaj=${CATEGORY%%-*}
146 local catmin=${CATEGORY##*-}
150 accessibility) type="Utility;Accessibility";;
152 antivirus) type=System;;
153 arch) type="Utility;Archiving";;
154 backup) type="Utility;Archiving";;
155 cdr) type="AudioVideo;DiscBurning";;
156 dicts) type="Office;Dictionary";;
157 doc) type=Documentation;;
158 editors) type="Utility;TextEditor";;
159 emacs) type="Development;TextEditor";;
160 emulation) type="System;Emulator";;
161 laptop) type="Settings;HardwareSettings";;
162 office) type=Office;;
163 pda) type="Office;PDA";;
164 vim) type="Development;TextEditor";;
165 xemacs) type="Development;TextEditor";;
175 action|fps) type=ActionGame;;
176 arcade) type=ArcadeGame;;
177 board) type=BoardGame;;
178 emulation) type=Emulator;;
179 kids) type=KidsGame;;
180 puzzle) type=LogicGame;;
181 roguelike) type=RolePlaying;;
182 rpg) type=RolePlaying;;
183 simulation) type=Simulation;;
184 sports) type=SportsGame;;
185 strategy) type=StrategyGame;;
214 type="AudioVideo;${type}"
221 dialup) type=Dialup;;
222 ftp) type=FileTransfer;;
223 im) type=InstantMessaging;;
224 irc) type=IRCClient;;
228 p2p) type=FileTransfer;;
229 voip) type=Telephony;;
231 type="Network;${type}"
236 astro*) type=Astronomy;;
238 calc*) type=Calculator;;
239 chem*) type=Chemistry;;
240 elec*) type=Electronics;;
243 physics) type=Physics;;
244 visual*) type=DataVisualization;;
246 type="Education;Science;${type}"
255 client) type=WebBrowser;;
257 type="Network;${type}"
265 local slot=${SLOT%/*}
266 if [[ ${slot} == "0" ]] ; then
267 local desktop_name="${PN}"
269 local desktop_name="${PN}-${slot}"
271 local desktop="${T}/$(echo ${exec} | sed 's:[[:space:]/:]:_:g')-${desktop_name}.desktop"
272 #local desktop=${T}/${exec%% *:-${desktop_name}}.desktop
274 # Don't append another ";" when a valid category value is provided.
275 type=${type%;}${type:+;}
277 if [[ -n ${icon} && ${icon} != /* ]] && [[ ${icon} == *.xpm || ${icon} == *.png || ${icon} == *.svg ]]; then
278 ewarn "As described in the Icon Theme Specification, icon file extensions are not"
279 ewarn "allowed in .desktop files if the value is not an absolute path."
283 cat <<-EOF > "${desktop}"
287 Comment=${DESCRIPTION}
294 if [[ ${fields:-=} != *=* ]] ; then
295 # 5th arg used to be value to Path=
296 ewarn "make_desktop_entry: update your 5th arg to read Path=${fields}"
297 fields="Path=${fields}"
299 [[ -n ${fields} ]] && printf '%b\n' "${fields}" >> "${desktop}"
302 # wrap the env here so that the 'insinto' call
303 # doesn't corrupt the env of the caller
304 insinto /usr/share/applications
306 ) || die "installing desktop file failed"
309 # @FUNCTION: _eutils_eprefix_init
312 # Initialized prefix variables for EAPI<3.
313 _eutils_eprefix_init() {
314 has "${EAPI:-0}" 0 1 2 && : ${ED:=${D}} ${EPREFIX:=} ${EROOT:=${ROOT}}
317 # @FUNCTION: validate_desktop_entries
318 # @USAGE: [directories]
320 # Validate desktop entries using desktop-file-utils
321 validate_desktop_entries() {
322 eqawarn "validate_desktop_entries is deprecated and should be not be used."
323 eqawarn ".desktop file validation is done implicitly by Portage now."
326 if [[ -x "${EPREFIX}"/usr/bin/desktop-file-validate ]] ; then
327 einfo "Checking desktop entry validity"
329 for d in /usr/share/applications $@ ; do
330 [[ -d ${ED}${d} ]] && directories="${directories} ${ED}${d}"
332 if [[ -n ${directories} ]] ; then
333 for FILE in $(find ${directories} -name "*\.desktop" \
334 -not -path '*.hidden*' | sort -u 2>/dev/null)
336 local temp=$(desktop-file-validate ${FILE} | grep -v "warning:" | \
337 sed -e "s|error: ||" -e "s|${FILE}:|--|g" )
338 [[ -n $temp ]] && elog ${temp/--/${FILE/${ED}/}:}
343 einfo "Passing desktop entry validity check. Install dev-util/desktop-file-utils, if you want to help to improve Gentoo."
347 # @FUNCTION: make_session_desktop
348 # @USAGE: <title> <command> [command args...]
350 # Make a GDM/KDM Session file. The title is the file to execute to start the
351 # Window Manager. The command is the name of the Window Manager.
353 # You can set the name of the file via the ${wm} variable.
354 make_session_desktop() {
355 [[ -z $1 ]] && eerror "$0: You must specify the title" && return 1
356 [[ -z $2 ]] && eerror "$0: You must specify the command" && return 1
360 local desktop=${T}/${wm:-${PN}}.desktop
363 cat <<-EOF > "${desktop}"
366 Comment=This session logs you into ${title}
373 # wrap the env here so that the 'insinto' call
374 # doesn't corrupt the env of the caller
375 insinto /usr/share/xsessions
383 # Install the list of .desktop menu files into the appropriate directory
384 # (/usr/share/applications).
387 # wrap the env here so that the 'insinto' call
388 # doesn't corrupt the env of the caller
390 insinto /usr/share/applications
392 if [[ -f ${i} ]] ; then
395 elif [[ -d ${i} ]] ; then
396 for j in "${i}"/*.desktop ; do
409 # @USAGE: <menu> <newname>
411 # Like all other new* functions, install the specified menu as newname.
414 # wrap the env here so that the 'insinto' call
415 # doesn't corrupt the env of the caller
416 insinto /usr/share/applications
421 # @FUNCTION: _iconins
424 # function for use in doicon and newicon
427 # wrap the env here so that the 'insinto' call
428 # doesn't corrupt the env of the caller
429 local funcname=$1; shift
434 while [[ $# -gt 0 ]] ; do
437 if [[ ${2%%x*}x${2%%x*} == "$2" ]] ; then
443 16|22|24|32|36|48|64|72|96|128|192|256|512)
444 size=${size}x${size};;
448 eerror "${size} is an unsupported icon size!"
459 if [[ -z ${size} ]] ; then
460 insinto /usr/share/pixmaps
462 insinto /usr/share/icons/${theme}/${size}/${context}
465 if [[ ${funcname} == doicon ]] ; then
466 if [[ -f $1 ]] ; then
468 elif [[ -d $1 ]] ; then
470 doins "${1}"/*.{png,svg}
473 eerror "${1} is not a valid file/directory!"
482 if [[ ${funcname} == newicon ]] ; then
489 # @USAGE: [options] <icons>
491 # Install icon into the icon directory /usr/share/icons or into
492 # /usr/share/pixmaps if "--size" is not set.
493 # This is useful in conjunction with creating desktop/menu files.
498 # !!! must specify to install into /usr/share/icons/... !!!
499 # size of the icon, like 48 or 48x48
500 # supported icon sizes are:
501 # 16 22 24 32 36 48 64 72 96 128 192 256 512 scalable
505 # defaults to "hicolor"
507 # icons: list of icons
509 # example 1: doicon foobar.png fuqbar.svg suckbar.png
510 # results in: insinto /usr/share/pixmaps
511 # doins foobar.png fuqbar.svg suckbar.png
513 # example 2: doicon -s 48 foobar.png fuqbar.png blobbar.png
514 # results in: insinto /usr/share/icons/hicolor/48x48/apps
515 # doins foobar.png fuqbar.png blobbar.png
518 _iconins ${FUNCNAME} "$@"
522 # @USAGE: [options] <icon> <newname>
524 # Like doicon, install the specified icon as newname.
527 # example 1: newicon foobar.png NEWNAME.png
528 # results in: insinto /usr/share/pixmaps
529 # newins foobar.png NEWNAME.png
531 # example 2: newicon -s 48 foobar.png NEWNAME.png
532 # results in: insinto /usr/share/icons/hicolor/48x48/apps
533 # newins foobar.png NEWNAME.png
536 _iconins ${FUNCNAME} "$@"
539 # @FUNCTION: strip-linguas
540 # @USAGE: [<allow LINGUAS>|<-i|-u> <directories of .po files>]
542 # Make sure that LINGUAS only contains languages that
543 # a package can support. The first form allows you to
544 # specify a list of LINGUAS. The -i builds a list of po
545 # files found in all the directories and uses the
546 # intersection of the lists. The -u builds a list of po
547 # files found in all the directories and uses the union
551 if [[ $1 == "-i" ]] || [[ $1 == "-u" ]] ; then
553 ls=$(find "$1" -name '*.po' -exec basename {} .po ';'); shift
556 if [[ ${op} == "-u" ]] ; then
561 for f in $(find "$d" -name '*.po' -exec basename {} .po ';') ; do
562 if [[ ${op} == "-i" ]] ; then
563 has ${f} ${ls} && newls="${newls} ${f}"
565 has ${f} ${ls} || newls="${newls} ${f}"
576 for f in ${LINGUAS} ; do
577 if has ${f} ${ls} ; then
578 newls="${newls} ${f}"
584 && einfo "Sorry, but ${PN} does not support the LINGUAS:" ${nols}
585 export LINGUAS=${newls:1}
588 # @FUNCTION: preserve_old_lib
589 # @USAGE: <libs to preserve> [more libs]
591 # These functions are useful when a lib in your package changes ABI SONAME.
592 # An example might be from libogg.so.0 to libogg.so.1. Removing libogg.so.0
593 # would break packages that link against it. Most people get around this
594 # by using the portage SLOT mechanism, but that is not always a relevant
595 # solution, so instead you can call this from pkg_preinst. See also the
596 # preserve_old_lib_notify function.
599 if [[ ${EBUILD_PHASE} != "preinst" ]] ; then
600 eerror "preserve_old_lib() must be called from pkg_preinst() only"
601 die "Invalid preserve_old_lib() usage"
603 [[ -z $1 ]] && die "Usage: preserve_old_lib <library to preserve> [more libraries to preserve]"
605 # let portage worry about it
606 has preserve-libs ${FEATURES} && return 0
610 [[ -e ${EROOT}/${lib} ]] || continue
612 dodir ${dir} || die "dodir ${dir} failed"
613 cp "${EROOT}"/${lib} "${ED}"/${lib} || die "cp ${lib} failed"
618 # @FUNCTION: preserve_old_lib_notify
619 # @USAGE: <libs to notify> [more libs]
621 # Spit helpful messages about the libraries preserved by preserve_old_lib.
622 preserve_old_lib_notify() {
623 if [[ ${EBUILD_PHASE} != "postinst" ]] ; then
624 eerror "preserve_old_lib_notify() must be called from pkg_postinst() only"
625 die "Invalid preserve_old_lib_notify() usage"
628 # let portage worry about it
629 has preserve-libs ${FEATURES} && return 0
635 [[ -e ${EROOT}/${lib} ]] || continue
636 if [[ ${notice} -eq 0 ]] ; then
638 ewarn "Old versions of installed libraries were detected on your system."
639 ewarn "In order to avoid breaking packages that depend on these old libs,"
640 ewarn "the libraries are not being removed. You need to run revdep-rebuild"
641 ewarn "in order to remove these old dependencies. If you do not have this"
642 ewarn "helper program, simply emerge the 'gentoolkit' package."
645 ewarn " # revdep-rebuild --library '${lib}' && rm '${lib}'"
649 # @FUNCTION: built_with_use
650 # @USAGE: [--hidden] [--missing <action>] [-a|-o] <DEPEND ATOM> <List of USE flags>
653 # Deprecated: Use EAPI 2 use deps in DEPEND|RDEPEND and with has_version calls.
655 # A temporary hack until portage properly supports DEPENDing on USE
656 # flags being enabled in packages. This will check to see if the specified
657 # DEPEND atom was built with the specified list of USE flags. The
658 # --missing option controls the behavior if called on a package that does
659 # not actually support the defined USE flags (aka listed in IUSE).
660 # The default is to abort (call die). The -a and -o flags control
661 # the requirements of the USE flags. They correspond to "and" and "or"
662 # logic. So the -a flag means all listed USE flags must be enabled
663 # while the -o flag means at least one of the listed IUSE flags must be
664 # enabled. The --hidden option is really for internal use only as it
665 # means the USE flag we're checking is hidden expanded, so it won't be found
666 # in IUSE like normal USE flags.
668 # Remember that this function isn't terribly intelligent so order of optional
673 if [[ $1 == "--hidden" ]] ; then
678 local missing_action="die"
679 if [[ $1 == "--missing" ]] ; then
682 case ${missing_action} in
684 *) die "unknown action '${missing_action}'";;
689 [[ ${opt:0:1} = "-" ]] && shift || opt="-a"
691 local PKG=$(best_version $1)
692 [[ -z ${PKG} ]] && die "Unable to resolve $1 to an installed package"
695 local USEFILE=${EROOT}/var/db/pkg/${PKG}/USE
696 local IUSEFILE=${EROOT}/var/db/pkg/${PKG}/IUSE
698 # if the IUSE file doesn't exist, the read will error out, we need to handle
700 if [[ ! -e ${USEFILE} ]] || [[ ! -e ${IUSEFILE} && ${hidden} == "no" ]] ; then
701 case ${missing_action} in
704 die) die "Unable to determine what USE flags $PKG was built with";;
708 if [[ ${hidden} == "no" ]] ; then
709 local IUSE_BUILT=( $(<"${IUSEFILE}") )
710 # Don't check USE_EXPAND #147237
712 for expand in $(echo ${USE_EXPAND} | tr '[:upper:]' '[:lower:]') ; do
713 if [[ $1 == ${expand}_* ]] ; then
718 if [[ -n ${expand} ]] ; then
719 if ! has $1 ${IUSE_BUILT[@]#[-+]} ; then
720 case ${missing_action} in
723 die) die "$PKG does not actually support the $1 USE flag!";;
729 local USE_BUILT=$(<${USEFILE})
730 while [[ $# -gt 0 ]] ; do
731 if [[ ${opt} = "-o" ]] ; then
732 has $1 ${USE_BUILT} && return 0
734 has $1 ${USE_BUILT} || return 1
741 # @FUNCTION: make_wrapper
742 # @USAGE: <wrapper> <target> [chdir] [libpaths] [installpath]
744 # Create a shell wrapper script named wrapper in installpath
745 # (defaults to the bindir) to execute target (default of wrapper) by
746 # first optionally setting LD_LIBRARY_PATH to the colon-delimited
747 # libpaths followed by optionally changing directory to chdir.
750 local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5
751 local tmpwrapper=$(emktemp)
755 [[ -n ${chdir} ]] && printf 'cd "%s"\n' "${EPREFIX}${chdir}"
756 if [[ -n ${libdir} ]] ; then
758 if [[ ${CHOST} == *-darwin* ]] ; then
759 var=DYLD_LIBRARY_PATH
764 if [ "\${${var}+set}" = "set" ] ; then
765 export ${var}="\${${var}}:${EPREFIX}${libdir}"
767 export ${var}="${EPREFIX}${libdir}"
771 # We don't want to quote ${bin} so that people can pass complex
772 # things as ${bin} ... "./someprog --args"
773 printf 'exec %s "$@"\n' "${bin/#\//${EPREFIX}/}"
775 chmod go+rx "${tmpwrapper}"
777 if [[ -n ${path} ]] ; then
780 newexe "${tmpwrapper}" "${wrapper}"
783 newbin "${tmpwrapper}" "${wrapper}" || die
787 # @FUNCTION: path_exists
788 # @USAGE: [-a|-o] <paths>
790 # Check if the specified paths exist. Works for all types of paths
791 # (files/dirs/etc...). The -a and -o flags control the requirements
792 # of the paths. They correspond to "and" and "or" logic. So the -a
793 # flag means all the paths must exist while the -o flag means at least
794 # one of the paths must exist. The default behavior is "and". If no
795 # paths are specified, then the return value is "false".
798 [[ ${opt} == -[ao] ]] && shift || opt="-a"
800 # no paths -> return false
801 # same behavior as: [[ -e "" ]]
802 [[ $# -eq 0 ]] && return 1
811 -a) return $(( r != 0 )) ;;
812 -o) return $(( r == $# )) ;;
816 # @FUNCTION: use_if_iuse
819 # Return true if the given flag is in USE and IUSE.
821 # Note that this function should not be used in the global scope.
823 in_iuse $1 || return 1
827 # @FUNCTION: optfeature
828 # @USAGE: <short description> <package atom to match> [other atoms]
830 # Print out a message suggesting an optional package (or packages) which
831 # provide the described functionality
833 # The following snippet would suggest app-misc/foo for optional foo support,
834 # app-misc/bar or app-misc/baz[bar] for optional bar support
835 # and either both app-misc/a and app-misc/b or app-misc/c for alphabet support.
837 # optfeature "foo support" app-misc/foo
838 # optfeature "bar support" app-misc/bar app-misc/baz[bar]
839 # optfeature "alphabet support" "app-misc/a app-misc/b" app-misc/c
842 debug-print-function ${FUNCNAME} "$@"
849 if has_version "${j}"; then
856 if [[ ${flag} -eq 1 ]]; then
860 if [[ ${flag} -eq 0 ]]; then
866 msg="${msg:0: -4} for ${desc}"
873 die "you no longer need this as portage supports ACCEPT_LICENSE itself"
882 # Sleep for the specified number of seconds (default of 5 seconds). Useful when
883 # printing a message the user should probably be reading and often used in
884 # conjunction with the ebeep function. If the EPAUSE_IGNORE env var is set,
885 # don't wait at all. Defined in EAPIs 0 1 and 2.
887 [[ -z ${EPAUSE_IGNORE} ]] && sleep ${1:-5}
891 # @USAGE: [number of beeps]
893 # Issue the specified number of beeps (default of 5 beeps). Useful when
894 # printing a message the user should probably be reading and often used in
895 # conjunction with the epause function. If the EBEEP_IGNORE env var is set,
896 # don't beep at all. Defined in EAPIs 0 1 and 2.
899 if [[ -z ${EBEEP_IGNORE} ]] ; then
900 for ((n=1 ; n <= ${1:-5} ; n++)) ; do
902 sleep 0.1 &>/dev/null ; sleep 0,1 &>/dev/null
913 ewarn "QA Notice: ebeep is not defined in EAPI=${EAPI}, please file a bug at https://bugs.gentoo.org"
917 ewarn "QA Notice: epause is not defined in EAPI=${EAPI}, please file a bug at https://bugs.gentoo.org"
927 # @USAGE: <USE flag> [true output] [false output] [true suffix] [false suffix]
929 # Proxy to declare usex for package managers or EAPIs that do not provide it
930 # and use the package manager implementation when available (i.e. EAPI >= 5).
931 # If USE flag is set, echo [true output][true suffix] (defaults to "yes"),
932 # otherwise echo [false output][false suffix] (defaults to "no").
933 usex() { use "$1" && echo "${2-yes}$4" || echo "${3-no}$5" ; } #382963
941 # @FUNCTION: einstalldocs
943 # Install documentation using DOCS and HTML_DOCS.
945 # If DOCS is declared and non-empty, all files listed in it are
946 # installed. The files must exist, otherwise the function will fail.
947 # In EAPI 4 and subsequent EAPIs DOCS may specify directories as well,
948 # in other EAPIs using directories is unsupported.
950 # If DOCS is not declared, the files matching patterns given
951 # in the default EAPI implementation of src_install will be installed.
952 # If this is undesired, DOCS can be set to empty value to prevent any
953 # documentation from being installed.
955 # If HTML_DOCS is declared and non-empty, all files and/or directories
956 # listed in it are installed as HTML docs (using dohtml).
958 # Both DOCS and HTML_DOCS can either be an array or a whitespace-
959 # separated list. Whenever directories are allowed, '<directory>/.' may
960 # be specified in order to install all files within the directory
961 # without creating a sub-directory in docdir.
963 # Passing additional options to dodoc and dohtml is not supported.
964 # If you needed such a thing, you need to call those helpers explicitly.
966 debug-print-function ${FUNCNAME} "${@}"
969 has ${EAPI} 0 1 2 3 && dodoc_opts=
971 if ! declare -p DOCS &>/dev/null ; then
973 for d in README* ChangeLog AUTHORS NEWS TODO CHANGES \
974 THANKS BUGS FAQ CREDITS CHANGELOG ; do
975 if [[ -s ${d} ]] ; then
979 elif [[ $(declare -p DOCS) == "declare -a"* ]] ; then
980 if [[ ${DOCS[@]} ]] ; then
981 dodoc ${dodoc_opts} "${DOCS[@]}" || die
984 if [[ ${DOCS} ]] ; then
985 dodoc ${dodoc_opts} ${DOCS} || die
989 if [[ $(declare -p HTML_DOCS 2>/dev/null) == "declare -a"* ]] ; then
990 if [[ ${HTML_DOCS[@]} ]] ; then
991 dohtml -r "${HTML_DOCS[@]}" || die
994 if [[ ${HTML_DOCS} ]] ; then
995 dohtml -r ${HTML_DOCS} || die
1002 # @FUNCTION: in_iuse
1005 # Determines whether the given flag is in IUSE. Strips IUSE default prefixes
1008 # Note that this function should not be used in the global scope.
1010 debug-print-function ${FUNCNAME} "${@}"
1011 [[ ${#} -eq 1 ]] || die "Invalid args to ${FUNCNAME}()"
1014 local liuse=( ${IUSE} )
1016 has "${flag}" "${liuse[@]#[+-]}"