declare -x ABI="amd64" declare -x ALSA_CARDS="" declare -x ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" declare -x APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" declare -x ARCH="amd64" declare -x ASFLAGS_x86="--32" declare -x CBUILD="x86_64-pc-linux-gnu" declare -x CDEFINE_amd64="__x86_64__" declare -x CDEFINE_default="__unix__" declare -x CDEFINE_x86="__i386__" declare -x CFLAGS="-O3 -march=core2 -pipe -fomit-frame-pointer" declare -x CFLAGS_default="" declare -x CFLAGS_x86="-m32" declare -x CHOST="x86_64-pc-linux-gnu" declare -x CHOST_amd64="x86_64-pc-linux-gnu" declare -x CHOST_default="x86_64-pc-linux-gnu" declare -x CHOST_x86="i686-pc-linux-gnu" declare -x CROSSCOMPILE_OPTS="" declare -x CTARGET_default="x86_64-pc-linux-gnu" declare -x CVS_RSH="ssh" declare -x CXXFLAGS="-O3 -march=core2 -pipe -fomit-frame-pointer" declare -x DEFAULT_ABI="amd64" declare -- DEFINED_PHASES=" compile configure install postinst postrm preinst prepare setup test unpack" declare -- DEPEND=">=dev-libs/glib-2.16 >=x11-libs/gtk+-2.6 gnome-base/gconf >=sys-apps/dbus-1.0 pam? ( virtual/pam ) >=dev-libs/libgcrypt-1.2.2 >=dev-libs/libtasn1-1 sys-devel/gettext >=dev-util/intltool-0.35 >=dev-util/pkgconfig-0.9 doc? ( >=dev-util/gtk-doc-1.9 ) >=sys-apps/sed-4 test? ( !prefix? ( x11-base/xorg-server ) x11-apps/xhost )" declare -- DESCRIPTION="Password and keyring managing daemon" declare -x DESTTREE="/usr" declare -x DIROPTIONS="-m0755" declare -- DOCS="AUTHORS ChangeLog NEWS README TODO keyring-intro.txt" declare -x EAPI="2" declare -x ELIBC="glibc" declare -- ELIBTOOL_VERSION="2.0.2" declare -- ELTCONF="" declare -- ELT_APPLIED_PATCHES="" declare -- ELT_LTMAIN_SH="" declare -- ELT_PATCH_DIR="/usr/portage/eclass/ELT-patches" declare -x EXEOPTIONS="-m0755" declare -x FEATURES="assume-digests ccache distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch" declare -- G2CONF=" --disable-debug --disable-tests --enable-pam --with-pam-dir=/lib64/security --with-root-certs=/usr/share/ca-certificates/ --enable-acl-prompts --enable-ssh-agent" declare -x GCC_SPECS="" declare -- GCONFTOOL_BIN="/usr/bin/gconftool-2" declare -x GDK_USE_XFT="1" declare -x GNOME_TARBALL_SUFFIX="bz2" declare -- HOMEPAGE="http://www.gnome.org/" declare -x INHERITED="toolchain-funcs virtualx multilib gnome2-utils gnome2 gnome.org fdo-mime libtool pam" declare -x INPUT_DEVICES="keyboard mouse evdev" declare -x INSDESTTREE="" declare -x INSOPTIONS="-m0644" declare -- IUSE="debug doc pam test debug test" declare -x JAVAC="/etc/java-config-2/current-system-vm/bin/javac" declare -x JAVA_HOME="/etc/java-config-2/current-system-vm" declare -x JDK_HOME="/etc/java-config-2/current-system-vm" declare -x KERNEL="linux" declare -x KERNEL_ABI="amd64" declare -x KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd" declare -x KV="2.6.32-vs2.3.0.36.28-gentoo" declare -x LANG="C" declare -x LANGUAGE="C" declare -x LCD_DEVICES="" declare -x LC_COLLATE="C" declare -x LC_CTYPE="de_DE.UTF-8" declare -x LC_MESSAGES="C" declare -x LDFLAGS="-Wl,-O1" declare -x LDFLAGS_default="" declare -x LDFLAGS_x86="-m elf_i386" declare -x LIBDIR_amd64="lib64" declare -x LIBDIR_amd64_fbsd="lib64" declare -x LIBDIR_default="lib" declare -x LIBDIR_ppc="lib32" declare -x LIBDIR_ppc64="lib64" declare -x LIBDIR_sparc32="lib32" declare -x LIBDIR_sparc64="lib64" declare -x LIBDIR_x86="lib32" declare -x LIBDIR_x86_fbsd="lib32" declare -x LIBOPTIONS="-m0644" declare -x LICENSE="GPL-2 LGPL-2" declare -x LINGUAS="de en" declare -x MAIL="/var/mail/sascha" declare -x MAKEOPTS="-j1" declare -x MULTILIB_ABIS="amd64 x86" declare -x MULTILIB_STRICT_DENY="64-bit.*shared object" declare -x MULTILIB_STRICT_DIRS="/lib32 /lib /usr/lib32 /usr/lib /usr/kde/*/lib32 /usr/kde/*/lib /usr/qt/*/lib32 /usr/qt/*/lib /usr/X11R6/lib32 /usr/X11R6/lib" declare -x MULTILIB_STRICT_EXEMPT="(perl5|gcc|gcc-lib|binutils|eclipse-3|debug|portage)" declare -x NETBEANS="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" declare -x OPENGL_PROFILE="xorg-x11" declare -x PATH="/usr/lib/ccache/bin:/usr/lib64/portage/bin/ebuild-helpers:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.4.3" declare -- PDEPEND=" " declare -x PORTAGE_COMPRESS_EXCLUDE_SUFFIXES="css gif htm[l]? jp[e]?g js pdf png" declare -x PRELINK_PATH_MASK="/vservers:/usr/lib64/klibc" declare -x PROFILE_ONLY_VARIABLES="ARCH ELIBC KERNEL USERLAND" declare -x PROPERTIES="" declare -x PROVIDE="" declare -a PVP='([0]="2" [1]="28" [2]="2")' declare -x PYTHONDONTWRITEBYTECODE="1" declare -x RDEPEND=">=dev-libs/glib-2.16 >=x11-libs/gtk+-2.6 gnome-base/gconf >=sys-apps/dbus-1.0 pam? ( virtual/pam ) >=dev-libs/libgcrypt-1.2.2 >=dev-libs/libtasn1-1 " declare -x RESTRICT="" declare -x RUBYOPT="-rauto_gem" declare -x RUBY_TARGETS="" declare -x S="/var/tmp/portage/gnome-base/gnome-keyring-2.28.2/work/gnome-keyring-2.28.2" declare -x SANDBOX_DEBUG="0" declare -x SANDBOX_PID="3640" declare -x SANDBOX_PREDICT="/var/tmp/portage/gnome-base/gnome-keyring-2.28.2/homedir:/dev/crypto:/var/cache/fontconfig" declare -x SANDBOX_READ="/dev/stdin:/:/var/tmp:/usr/ccache" declare -x SANDBOX_VERBOSE="1" declare -x SANDBOX_WRITE="/dev/stdout:/dev/stderr:/var/tmp:/usr/ccache" declare -- SCROLLKEEPER_DIR="/var/lib/scrollkeeper" declare -- SCROLLKEEPER_UPDATE="1" declare -- SCROLLKEEPER_UPDATE_BIN="/usr/bin/scrollkeeper-update" declare -x SLOT="0" declare -- SRC_URI="mirror://gnome/sources/gnome-keyring/2.28/gnome-keyring-2.28.2.tar.bz2" declare -x STAGE1_USE="multilib nptl nptlonly unicode" declare -x SUDO_COMMAND="/bin/bash -c xterm -r" declare -x SUDO_GID="1003" declare -x SUDO_UID="1000" declare -x SUDO_USER="sascha" declare -x SYMLINK_LIB="yes" declare -x USE="amd64 elibc_glibc kernel_linux multilib pam userland_GNU" declare -x USERLAND="GNU" declare -x USERNAME="root" declare -- USE_EINSTALL="" declare -x VIDEO_CARDS="" declare -- VIRTUALX_DEPEND="!prefix? ( x11-base/xorg-server ) x11-apps/xhost" declare -- VIRTUALX_REQUIRED="optional" declare -- VIRTUALX_USE="test" declare -x WINDOWID="39845901" declare -x XDG_CONFIG_DIRS="/etc/xdg" declare -x XDG_DATA_DIRS="/usr/local/share:/usr/share" declare -x XSESSION="jwm" declare -x XTERM_LOCALE="de_DE.UTF-8" declare -x XTERM_SHELL="/bin/bash" declare -x XTERM_VERSION="XTerm(255)" declare -- _="PKG_INSTALL_MASK" declare -x _E_DOCDESTTREE_="" declare -x _E_EXEDESTTREE_="" declare -- ___ECLASS_RECUR_MULTILIB="yes" declare -- ___ECLASS_RECUR_TOOLCHAIN_FUNCS="yes" declare -x bash4="4.1.2(2)-release" declare -- conf="gnome-keyring-2.28.2-r0" declare -- filter_opts="" ELT_find_ltmain_sh () { local x=; local dirlist=; for x in $(find "${S}" -name 'ltmain.sh'); do dirlist="${dirlist} ${x%/*}"; done; echo "${dirlist}" } ELT_libtool_version () { local ltmain_sh=$1; local version=; version=$(eval $(grep -e '^[[:space:]]*VERSION=' "${ltmain_sh}"); echo "${VERSION}"); [[ -z ${version} ]] && version="0"; echo "${version}" } ELT_try_and_apply_patch () { local ret=0; local file=$1; local patch=$2; if patch -p0 --dry-run "${file}" "${patch}" &>"${T}/elibtool.log"; then einfo " Applying $(basename "$(dirname "${patch}")")-${patch##*/}.patch ..."; patch -p0 -g0 --no-backup-if-mismatch "${file}" "${patch}" &>"${T}/elibtool.log"; ret=$?; export ELT_APPLIED_PATCHES="${ELT_APPLIED_PATCHES} ${patch##*/}"; else ret=1; fi; return "${ret}" } ELT_walk_patches () { local x=; local y=; local ret=1; local file=$1; local patch_set=$2; local patch_dir=; local rem_int_dep=$3; if [[ -n ${patch_set} ]]; then if [[ -d ${ELT_PATCH_DIR}/${patch_set} ]]; then patch_dir="${ELT_PATCH_DIR}/${patch_set}"; else return "${ret}"; fi; for x in $(ls -d "${patch_dir}"/* 2> /dev/null | grep -v 'CVS' | sort -r); do if [[ -n ${x} && -f ${x} ]]; then if [[ -n ${rem_int_dep} ]]; then sed -e "s|@REM_INT_DEP@|${rem_int_dep}|g" ${x} > "${T}/$$.rem_int_deps.patch"; x="${T}/$$.rem_int_deps.patch"; fi; if ELT_try_and_apply_patch "${file}" "${x}"; then ret=0; break; fi; fi; done; fi; return "${ret}" } VER_major () { [[ -z $1 ]] && return 1; local VER=$@; echo "${VER%%[^[:digit:]]*}" } VER_micro () { [[ -z $1 ]] && return 1; local VER=$@; VER=${VER#*.*.}; echo "${VER%%[^[:digit:]]*}" } VER_minor () { [[ -z $1 ]] && return 1; local VER=$@; VER=${VER#*.}; echo "${VER%%[^[:digit:]]*}" } VER_to_int () { [[ -z $1 ]] && return 1; local VER_MAJOR=$(VER_major "$1"); local VER_MINOR=$(VER_minor "$1"); local VER_MICRO=$(VER_micro "$1"); local VER_int=$(( VER_MAJOR * 65536 + VER_MINOR * 256 + VER_MICRO )); if [[ ${VER_int} -ge 65536 ]]; then echo "${VER_int}"; return 0; fi; echo 1; return 1 } Xeconf () { export maketype="econf"; virtualmake "$@" } Xemake () { export maketype="emake"; virtualmake "$@" } Xmake () { export maketype="make"; virtualmake "$@" } _gcc-install-dir () { echo "$(LC_ALL=C $(tc-getCC) -print-search-dirs 2> /dev/null | awk '$1=="install:" {print $2}')" } _gcc-specs-directive_raw () { local cc=$(tc-getCC); local specfiles=$(LC_ALL=C ${cc} -v 2>&1 | awk '$1=="Reading" {print $NF}'); ${cc} -dumpspecs 2> /dev/null | cat - ${specfiles} | awk -v directive=$1 'BEGIN { pspec=""; spec=""; outside=1 } $1=="*"directive":" { pspec=spec; spec=""; outside=0; next } outside || NF==0 || ( substr($1,1,1)=="*" && substr($1,length($1),1)==":" ) { outside=1; next } spec=="" && substr($0,1,1)=="+" { spec=pspec " " substr($0,2); next } { spec=spec $0 } END { print spec }'; return 0 } _gcc-specs-exists () { [[ -f $(_gcc-install-dir)/$1 ]] } bashrc_has () { [[ " ${*:2} " == *" $1 "* ]] } cleanpamd () { while [[ -n $1 ]]; do if ! has_version sys-libs/pam; then sed -i -e '/pam_shells\|pam_console/s:^:#:' "${D}/etc/pam.d/$1"; fi; shift; done } create_ml_includes () { local dest=$1; shift; local basedirs=$(create_ml_includes-listdirs "$@"); create_ml_includes-makedestdirs ${dest} ${basedirs}; local file; for file in $(create_ml_includes-allfiles ${basedirs}); do ( echo "/* Autogenerated by create_ml_includes() in multilib.eclass */"; local dir; for dir in ${basedirs}; do if [[ -f ${D}/${dir}/${file} ]]; then echo ""; local sym=$(create_ml_includes-sym_for_dir ${dir} "$@"); if [[ ${sym/=} != "${sym}" ]]; then echo "#if ${sym}"; else if [[ ${sym::1} == "!" ]]; then echo "#ifndef ${sym:1}"; else echo "#ifdef ${sym}"; fi; fi; echo "# include <$(create_ml_includes-absolute ${dir}/${file})>"; echo "#endif /* ${sym} */"; fi; done ) > "${D}/${dest}/${file}"; done } create_ml_includes-absolute () { local dst="$(create_ml_includes-tidy_path $1)"; dst=(${dst//\// }); local i; for ((i=0; i<${#dst[*]}; i++)) do [ "${dst[i]}" == "include" ] && break; done; local strip_upto=$i; for ((i=strip_upto+1; i<${#dst[*]}-1; i++)) do echo -n ${dst[i]}/; done; echo -n ${dst[i]} } create_ml_includes-allfiles () { [[ -z ${ED} ]] && local ED=${D}; local basedir file; for basedir in "$@"; do for file in $(find "${ED}"/${basedir} -type f); do echo ${file/${ED}\/${basedir}\//}; done; done | sort | uniq } create_ml_includes-listdirs () { local dirs; local data; for data in "$@"; do dirs="${dirs} ${data/*:/}"; done; echo ${dirs:1} } create_ml_includes-makedestdirs () { local dest=$1; shift; local basedirs=$@; [[ -z ${ED} ]] && local ED=${D}; dodir ${dest}; local basedir; for basedir in ${basedirs}; do local dir; for dir in $(find "${ED}"/${basedir} -type d); do dodir ${dest}/${dir/${ED}\/${basedir}/}; done; done } create_ml_includes-sym_for_dir () { local dir=$1; shift; local data; for data in "$@"; do if [[ ${data} == *:${dir} ]]; then echo ${data/:*/}; return 0; fi; done; echo "Shouldn't be here -- create_ml_includes-sym_for_dir $1 $@"; exit 1 } create_ml_includes-tidy_path () { local removed=$1; if [ -n "${removed}" ]; then while [ "${removed}" != "${removed/\/\//\/}" ]; do removed=${removed/\/\//\/}; done; while [ "${removed}" != "${removed//\/.\//\/}" ]; do removed=${removed//\/.\//\/}; done; [ "${removed##*/}" = "." ] && removed=${removed%/*}; while [ "${removed}" != "${removed//\/..\/}" ]; do local p1="${removed%%\/..\/*}"; local p2="${removed#*\/..\/}"; removed="${p1%\/*}/${p2}"; done; [ "${removed##*/}" = ".." ] && removed=${removed%/*/*}; [ "${removed##*/}" = "" ] && removed=${removed%/*}; echo ${removed}; fi } darwintoolize () { ewarn "darwintoolize() is deprecated, please just use elibtoolize()!"; elibtoolize } dopamd () { [[ -z $1 ]] && die "dopamd requires at least one argument"; if hasq pam ${IUSE} && ! use pam; then return 0; fi; ( insinto /etc/pam.d; insopts -m 0644; doins "$@" ) || die "failed to install $@"; cleanpamd "$@" } dopammod () { [[ -z $1 ]] && die "dopammod requires at least one argument"; if hasq pam ${IUSE} && ! use pam; then return 0; fi; exeinto $(getpam_mod_dir); doexe "$@" || die "failed to install $@" } dopamsecurity () { [[ $# -lt 2 ]] && die "dopamsecurity requires at least two arguments"; if hasq pam ${IUSE} && ! use pam; then return 0; fi; ( insinto /etc/security/$1; insopts -m 0644; doins "${@:2}" ) || die "failed to install ${@:2}" } dyn_pretend () { ebuild_phase_with_hooks pkg_pretend } elibtoolize () { local x=; local y=; local do_portage="no"; local do_reversedeps="no"; local do_only_patches="no"; local do_uclibc="yes"; local deptoremove=; local my_dirlist=; local elt_patches="install-sh ltmain portage relink max_cmd_len sed test tmp cross as-needed"; local start_dir=${PWD}; my_dirlist=$(ELT_find_ltmain_sh); for x in "$@"; do case "${x}" in "--portage") do_portage="yes" ;; "--reverse-deps") do_reversedeps="yes"; elt_patches="${elt_patches} fix-relink" ;; "--patch-only") do_only_patches="yes" ;; "^--remove-internal-dep="*) deptoremove=$(echo "${x}" | sed -e 's|--remove-internal-dep=||'); [[ -n ${deptoremove} ]] && elt_patches="${elt_patches} rem-int-dep" ;; "--shallow") if [[ -f ${S}/ltmain.sh ]]; then my_dirlist=${S}; else my_dirlist=; fi ;; "--no-uclibc") do_uclibc="no" ;; *) eerror "Invalid elibtoolize option: ${x}"; die "elibtoolize called with ${x} ??" ;; esac; done; [[ ${do_uclibc} == "yes" ]] && elt_patches="${elt_patches} uclibc-conf uclibc-ltconf"; case "${CHOST}" in *-aix*) elt_patches="${elt_patches} hardcode aixrtl" ;; *-darwin*) elt_patches="${elt_patches} darwin-ltconf darwin-ltmain darwin-conf" ;; *-freebsd*) elt_patches="${elt_patches} fbsd-conf fbsd-ltconf" ;; *-hpux*) elt_patches="${elt_patches} hpux-conf deplibs hc-flag-ld hardcode hardcode-relink relink-prog no-lc" ;; *-irix*) elt_patches="${elt_patches} irix-ltmain" ;; *-mint*) elt_patches="${elt_patches} mint-conf" ;; esac; for x in ${my_dirlist}; do local tmp=$(echo "${x}" | sed -e "s|${WORKDIR}||"); export ELT_APPLIED_PATCHES=; export ELT_LTMAIN_SH="${x}/ltmain.sh"; [[ -f ${x}/.elibtoolized ]] && continue; cd ${x}; einfo "Running elibtoolize in: $(echo "/${tmp}" | sed -e 's|//|/|g; s|^/||')"; for y in ${elt_patches}; do local ret=0; case "${y}" in "portage") if [[ -z $(grep 'We do not want portage' "${x}/ltmain.sh") ]]; then ELT_walk_patches "${x}/ltmain.sh" "${y}"; ret=$?; fi ;; "rem-int-dep") ELT_walk_patches "${x}/ltmain.sh" "${y}" "${deptoremove}"; ret=$? ;; "fix-relink") if [[ -n $(grep 'inst_prefix_dir' "${x}/ltmain.sh") ]]; then ELT_walk_patches "${x}/ltmain.sh" "${y}"; ret=$?; fi ;; "max_cmd_len") if [[ -n $(grep 'max_cmd_len' "${x}/ltmain.sh") ]]; then ELT_walk_patches "${x}/ltmain.sh" "${y}"; ret=$?; fi ;; "as-needed") ELT_walk_patches "${x}/ltmain.sh" "${y}"; ret=$? ;; "uclibc-conf") if [[ -e ${x}/configure && -n $(grep 'Transform linux' "${x}/configure") ]]; then ELT_walk_patches "${x}/configure" "${y}"; ret=$?; else if [[ ! -e ${x}/configure && -e ${x}/../configure && -n $(grep 'Transform linux' "${x}/../configure") ]]; then ELT_walk_patches "${x}/../configure" "${y}"; ret=$?; fi; fi ;; "uclibc-ltconf") if [[ -s ${x}/ltconfig ]]; then ELT_walk_patches "${x}/ltconfig" "${y}"; ret=$?; fi ;; "fbsd-conf") if [[ -e ${x}/configure && -n $(grep 'version_type=freebsd-' "${x}/configure") ]]; then ELT_walk_patches "${x}/configure" "${y}"; ret=$?; else if [[ ! -e ${x}/configure && -e ${x}/../configure && -n $(grep 'version_type=freebsd-' "${x}/../configure") ]]; then ELT_walk_patches "${x}/../configure" "${y}"; ret=$?; fi; fi ;; "fbsd-ltconf") if [[ -s ${x}/ltconfig ]]; then ELT_walk_patches "${x}/ltconfig" "${y}"; ret=$?; fi ;; "darwin-conf") if [[ -e ${x}/configure && -n $(grep '&& echo \.so ||' "${x}/configure") ]]; then ELT_walk_patches "${x}/configure" "${y}"; ret=$?; else if [[ ! -e ${x}/configure && -e ${x}/../configure && -n $(grep '&& echo \.so ||' "${x}/../configure") ]]; then ELT_walk_patches "${x}/../configure" "${y}"; ret=$?; fi; fi ;; "darwin-ltconf") if [[ -s ${x}/ltconfig ]]; then ELT_walk_patches "${x}/ltconfig" "${y}"; ret=$?; fi ;; "darwin-ltmain") if [[ -e ${x}/ltmain.sh && -z $(grep 'verstring="-compatibility_version' "${x}/ltmain.sh") ]]; then ELT_walk_patches "${x}/ltmain.sh" "${y}"; ret=$?; fi ;; "aixrtl" | "hpux-conf") ret=1; local subret=0; while [[ $subret -eq 0 ]]; do subret=1; if [[ -e ${x}/configure ]]; then ELT_walk_patches "${x}/configure" "${y}"; subret=$?; else if [[ ! -e ${x}/configure && -e ${x}/../configure ]]; then ELT_walk_patches "${x}/../configure" "${y}"; subret=$?; fi; fi; if [[ $subret -eq 0 ]]; then ret=0; fi; done ;; "mint-conf") ret=1; local subret=1; if [[ -e ${x}/configure ]]; then ELT_walk_patches "${x}/configure" "${y}"; subret=$?; else if [[ ! -e ${x}/configure && -e ${x}/../configure ]]; then ELT_walk_patches "${x}/../configure" "${y}"; subret=$?; fi; fi; if [[ $subret -eq 0 ]]; then ret=0; fi ;; "install-sh") ELT_walk_patches "${x}/install-sh" "${y}"; ret=$? ;; "cross") if tc-is-cross-compiler; then ELT_walk_patches "${x}/ltmain.sh" "${y}"; ret=$?; fi ;; *) ELT_walk_patches "${x}/ltmain.sh" "${y}"; ret=$? ;; esac; if [[ ${ret} -ne 0 ]]; then case ${y} in "relink") local version=$(ELT_libtool_version "${x}/ltmain.sh"); if [[ -z $(grep 'inst_prefix_dir' "${x}/ltmain.sh") && $(VER_to_int "${version}") -ge $(VER_to_int "1.4.0") ]]; then ewarn " Could not apply relink.patch!"; fi ;; "portage") if [[ ${do_portage} == "yes" ]]; then if [[ -z $(grep 'We do not want portage' "${x}/ltmain.sh") ]]; then echo; eerror "Portage patch requested, but failed to apply!"; eerror "Please bug azarah or vapier to add proper patch."; die "Portage patch requested, but failed to apply!"; fi; else if [[ -n $(grep 'We do not want portage' "${x}/ltmain.sh") ]]; then :; else local version=$( eval $(grep -e '^[[:space:]]*VERSION=' "${x}/ltmain.sh"); echo "${VERSION}"); echo; eerror "Portage patch failed to apply (ltmain.sh version ${version})!"; eerror "Please bug azarah or vapier to add proper patch."; die "Portage patch failed to apply!"; fi; ELT_APPLIED_PATCHES="portage"; fi ;; "uclibc-"*) [[ ${CHOST} == *"-uclibc" ]] && ewarn " uClibc patch set '${y}' failed to apply!" ;; "fbsd-"*) if [[ ${CHOST} == *"-freebsd"* ]]; then if [[ -z $(grep 'Handle Gentoo/FreeBSD as it was Linux' "${x}/configure" "${x}/../configure" 2>/dev/null) ]]; then eerror " FreeBSD patch set '${y}' failed to apply!"; die "FreeBSD patch set '${y}' failed to apply!"; fi; fi ;; "darwin-"*) [[ ${CHOST} == *"-darwin"* ]] && ewarn " Darwin patch set '${y}' failed to apply!" ;; esac; fi; done; if [[ -z ${ELT_APPLIED_PATCHES} ]]; then if [[ ${do_portage} == "no" && ${do_reversedeps} == "no" && ${do_only_patches} == "no" && ${deptoremove} == "" ]]; then ewarn "Cannot apply any patches, please file a bug about this"; die; fi; fi; [[ -f ${x}/libtool ]] && rm -f "${x}/libtool"; >> "${x}/.elibtoolized"; done; cd "${start_dir}" } fdo-mime_desktop_database_update () { if [ -x "/usr/bin/update-desktop-database" ]; then einfo "Updating desktop mime database ..."; "/usr/bin/update-desktop-database" -q "${ROOT}/usr/share/applications"; fi } fdo-mime_mime_database_update () { if [ -x "/usr/bin/update-mime-database" ]; then einfo "Updating shared mime info database ..."; "/usr/bin/update-mime-database" "${ROOT}/usr/share/mime"; fi } filter_invalid_flags () { local flag broken_flags; eval broken_flags=($(get_broken_flags $(getPROG CC gcc) c ${CFLAGS})); for flag in "${broken_flags[@]}"; do ewarn "Filtering out invalid CFLAG \"${flag}\""; CFLAGS="$(remove_flag "${flag}" ${CFLAGS})"; done; eval broken_flags=($(get_broken_flags $(getPROG CXX g++) c++ ${CXXFLAGS})); for flag in "${broken_flags[@]}"; do ewarn "Filtering out invalid CXXFLAG \"${flag}\""; CXXFLAGS="$(remove_flag "${flag}" ${CXXFLAGS})"; done } gcc-fullversion () { $(tc-getCC "$@") -dumpversion } gcc-major-version () { gcc-version "$@" | cut -f1 -d. } gcc-micro-version () { gcc-fullversion "$@" | cut -f3 -d. | cut -f1 -d- } gcc-minor-version () { gcc-version "$@" | cut -f2 -d. } gcc-specs-directive () { local directive subdname subdirective; directive="$(_gcc-specs-directive_raw $1)"; while [[ ${directive} == *%\(*\)* ]]; do subdname=${directive/*%\(}; subdname=${subdname/\)*}; subdirective="$(_gcc-specs-directive_raw ${subdname})"; directive="${directive//\%(${subdname})/${subdirective}}"; done; echo "${directive}"; return 0 } gcc-specs-nostrict () { local directive; directive=$(gcc-specs-directive cc1); return $([[ "${directive/\{!fstrict-overflow:}" != "${directive}" ]]) } gcc-specs-now () { local directive; directive=$(gcc-specs-directive link_command); return $([[ "${directive/\{!nonow:}" != "${directive}" ]]) } gcc-specs-pie () { local directive; directive=$(gcc-specs-directive cc1); return $([[ "${directive/\{!nopie:}" != "${directive}" ]]) } gcc-specs-relro () { local directive; directive=$(gcc-specs-directive link_command); return $([[ "${directive/\{!norelro:}" != "${directive}" ]]) } gcc-specs-ssp () { local directive; directive=$(gcc-specs-directive cc1); return $([[ "${directive/\{!fno-stack-protector:}" != "${directive}" ]]) } gcc-specs-ssp-to-all () { local directive; directive=$(gcc-specs-directive cc1); return $([[ "${directive/\{!fno-stack-protector-all:}" != "${directive}" ]]) } gcc-version () { gcc-fullversion "$@" | cut -f1,2 -d. } gen_usr_ldscript () { local lib libdir=$(get_libdir) output_format="" auto=false suffix=$(get_libname); [[ -z ${ED+set} ]] && local ED=${D%/}${EPREFIX}/; tc-is-static-only && return; dodir /usr/${libdir}; if [[ $1 == "-a" ]]; then auto=true; shift; dodir /${libdir}; fi; output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p'); [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"; for lib in "$@"; do local tlib; if ${auto}; then lib="lib${lib}${suffix}"; else [[ -r ${ED}/${libdir}/${lib} ]] || continue; fi; case ${CTARGET:-${CHOST}} in *-darwin*) if ${auto}; then tlib=$(scanmacho -qF'%S#F' "${ED}"/usr/${libdir}/${lib}); else tlib=$(scanmacho -qF'%S#F' "${ED}"/${libdir}/${lib}); fi; [[ -z ${tlib} ]] && die "unable to read install_name from ${lib}"; tlib=${tlib##*/}; if ${auto}; then mv "${ED}"/usr/${libdir}/${lib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die; if [[ ${tlib} != ${lib%${suffix}}.*${suffix#.} ]]; then mv "${ED}"/usr/${libdir}/${tlib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die; fi; rm -f "${ED}"/${libdir}/${lib}; fi; if [[ ! -w "${ED}/${libdir}/${tlib}" ]]; then chmod u+w "${ED}${libdir}/${tlib}"; local nowrite=yes; fi; install_name_tool -id "${EPREFIX}"/${libdir}/${tlib} "${ED}"/${libdir}/${tlib} || die "install_name_tool failed"; [[ -n ${nowrite} ]] && chmod u-w "${ED}${libdir}/${tlib}"; pushd "${ED}/usr/${libdir}" > /dev/null; ln -snf "../../${libdir}/${tlib}" "${lib}"; popd > /dev/null ;; *-aix* | *-irix* | *64*-hpux* | *-interix* | *-winnt*) if ${auto}; then mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die; tlib=$(readlink "${ED}"/${libdir}/${lib}); tlib=${tlib##*/}; if [[ -z ${tlib} ]]; then tlib=${lib}; else rm -f "${ED}"/${libdir}/${lib}; fi; else tlib=${lib}; fi; pushd "${ED}/usr/${libdir}" > /dev/null; ln -snf "../../${libdir}/${tlib}" "${lib}"; popd > /dev/null ;; hppa*-hpux*) if ${auto}; then tlib=$(chatr "${ED}"/usr/${libdir}/${lib} | sed -n '/internal name:/{n;s/^ *//;p;q}'); [[ -z ${tlib} ]] && tlib=${lib}; tlib=${tlib##*/}; mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die; if [[ ${tlib} != ${lib}* ]]; then mv "${ED}"/usr/${libdir}/${tlib}* "${ED}"/${libdir}/ || die; fi; [[ ${tlib} != ${lib} ]] && rm -f "${ED}"/${libdir}/${lib}; else tlib=$(chatr "${ED}"/${libdir}/${lib} | sed -n '/internal name:/{n;s/^ *//;p;q}'); [[ -z ${tlib} ]] && tlib=${lib}; tlib=${tlib##*/}; fi; pushd "${ED}"/usr/${libdir} > /dev/null; ln -snf "../../${libdir}/${tlib}" "${lib}"; [[ ${tlib} != ${lib} ]] && ln -snf "../../${libdir}/${tlib}" "${tlib}"; popd > /dev/null ;; *) if ${auto}; then tlib=$(scanelf -qF'%S#F' "${ED}"/usr/${libdir}/${lib}); [[ -z ${tlib} ]] && die "unable to read SONAME from ${lib}"; mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die; if [[ ${tlib} != ${lib}* ]]; then mv "${ED}"/usr/${libdir}/${tlib}* "${ED}"/${libdir}/ || die; fi; rm -f "${ED}"/${libdir}/${lib}; else tlib=${lib}; fi; cat > "${ED}/usr/${libdir}/${lib}" <<-END_LDSCRIPT /* GNU ld script Since Gentoo has critical dynamic libraries in /lib, and the static versions in /usr/lib, we need to have a "fake" dynamic lib in /usr/lib, otherwise we run into linking problems. This "fake" dynamic lib is a linker script that redirects the linker to the real lib. And yes, this works in the cross- compiling scenario as the sysroot-ed linker will prepend the real path. See bug http://bugs.gentoo.org/4411 for more info. */ ${output_format} GROUP ( ${EPREFIX}/${libdir}/${tlib} ) END_LDSCRIPT ;; esac fperms a+x "/usr/${libdir}/${lib}" || die "could not change perms on ${lib}"; done } getPROG () { local var=$1 prog=$2; if [[ -n ${!var} ]]; then echo "${!var}"; return 0; fi; local search=; [[ -n $3 ]] && search=$(type -p "$3-${prog}"); [[ -z ${search} && -n ${CHOST} ]] && search=$(type -p "${CHOST}-${prog}"); [[ -n ${search} ]] && prog=${search##*/}; export ${var}=${prog}; echo "${!var}" } get_abi_ASFLAGS () { get_abi_var ASFLAGS "$@" } get_abi_CDEFINE () { get_abi_var CDEFINE "$@" } get_abi_CFLAGS () { get_abi_var CFLAGS "$@" } get_abi_CHOST () { get_abi_var CHOST "$@" } get_abi_CTARGET () { get_abi_var CTARGET "$@" } get_abi_FAKE_TARGETS () { get_abi_var FAKE_TARGETS "$@" } get_abi_LDFLAGS () { get_abi_var LDFLAGS "$@" } get_abi_LIBDIR () { get_abi_var LIBDIR "$@" } get_abi_var () { local flag=$1; local abi; if [ $# -gt 1 ]; then abi=${2}; else if [ -n "${ABI}" ]; then abi=${ABI}; else if [ -n "${DEFAULT_ABI}" ]; then abi=${DEFAULT_ABI}; else abi="default"; fi; fi; fi; local var="${flag}_${abi}"; echo ${!var} } get_all_abis () { local order=""; if [[ -z ${MULTILIB_ABIS} ]]; then echo "default"; return 0; fi; for x in ${MULTILIB_ABIS}; do if [[ ${x} != ${DEFAULT_ABI} ]]; then order="${order:+${order} }${x}"; fi; done; order="${order:+${order} }${DEFAULT_ABI}"; echo ${order}; return 0 } get_all_libdirs () { local libdirs="lib"; local abi; local dir; for abi in ${MULTILIB_ABIS}; do [ "$(get_abi_LIBDIR ${abi})" != "lib" ] && libdirs="${libdirs} $(get_abi_LIBDIR ${abi})"; done; echo "${libdirs}" } get_broken_flags () { local myprog="${1}" lang="${2}"; shift 2; echo 'main(){}' | LC_ALL=C ${myprog} ${@} -x ${lang} -o /dev/null - 2>&1 | egrep "unrecognized .*option" | egrep -o -- '('\''|\"|`)-.*' | sed -r 's/('\''|`|")//g; s/^/"/; s/$/"/'; echo 'main(){}' | LC_ALL=C ${myprog} ${@} -x ${lang} -o /dev/null - 2>&1 | egrep "unrecognised debug output" | egrep -o -- '('\''|\"|`).*' | sed -r 's/('\''|`|")//g; s/^/"-g/; s/$/"/' } get_install_abis () { local order=""; if [[ -z ${MULTILIB_ABIS} ]]; then echo "default"; return 0; fi; if [[ ${EMULTILIB_PKG} == "true" ]]; then for x in ${MULTILIB_ABIS}; do if [[ ${x} != "${DEFAULT_ABI}" ]]; then hasq ${x} ${ABI_DENY} || ordera="${ordera} ${x}"; fi; done; hasq ${DEFAULT_ABI} ${ABI_DENY} || order="${ordera} ${DEFAULT_ABI}"; if [[ -n ${ABI_ALLOW} ]]; then local ordera=""; for x in ${order}; do if hasq ${x} ${ABI_ALLOW}; then ordera="${ordera} ${x}"; fi; done; order=${ordera}; fi; else order=${DEFAULT_ABI}; fi; if [[ -z ${order} ]]; then die "The ABI list is empty. Are you using a proper multilib profile? Perhaps your USE flags or MULTILIB_ABIS are too restrictive for this package."; fi; echo ${order}; return 0 } get_libdir () { local CONF_LIBDIR; if [ -n "${CONF_LIBDIR_OVERRIDE}" ]; then echo ${CONF_LIBDIR_OVERRIDE}; else get_abi_LIBDIR; fi } get_libdir_override () { if has_multilib_profile; then eerror "get_libdir_override called, but it shouldn't be needed with the new multilib approach. Please file a bug at http://bugs.gentoo.org and assign it to eradicator@gentoo.org"; exit 1; fi; CONF_LIBDIR="$1"; CONF_LIBDIR_OVERRIDE="$1"; LIBDIR_default="$1" } get_libname () { local libname; local ver=$1; case ${CHOST} in *-cygwin | mingw* | *-mingw*) libname="dll" ;; *-darwin*) libname="dylib" ;; *-aix*) libname="a" ;; *-mint*) libname="irrelevant" ;; hppa*-hpux*) libname="sl" ;; *) libname="so" ;; esac; if [[ -z $* ]]; then echo ".${libname}"; else for ver in "$@"; do case ${CHOST} in *-darwin*) echo ".${ver}.${libname}" ;; *-aix*) echo ".${libname}" ;; *-mint*) echo ".${libname}" ;; *) echo ".${libname}.${ver}" ;; esac; done; fi } get_ml_incdir () { local dir=/usr/include; if [[ $# -gt 0 ]]; then incdir=$1; shift; fi; if [[ -z "${MULTILIB_ABIS}" ]]; then echo ${incdir}; return 0; fi; local abi=${ABI-${DEFAULT_ABI}}; if [[ $# -gt 0 ]]; then abi=$1; shift; fi; if [[ -d "${dir}/gentoo-multilib/${abi}" ]]; then echo ${dir}/gentoo-multilib/${abi}; else echo ${dir}; fi } get_modname () { local modname; local ver=$1; case ${CHOST} in *-darwin*) modname="bundle" ;; *) modname="so" ;; esac; echo ".${modname}" } get_multilibdir () { if has_multilib_profile; then eerror "get_multilibdir called, but it shouldn't be needed with the new multilib approach. Please file a bug at http://bugs.gentoo.org and assign it to eradicator@gentoo.org"; exit 1; fi; echo ${CONF_MULTILIBDIR:=lib32} } getpam_mod_dir () { if has_version sys-libs/pam || has_version sys-libs/openpam; then PAM_MOD_DIR=/$(get_libdir)/security; else PAM_MOD_DIR=/$(get_libdir)/security; fi; echo ${PAM_MOD_DIR} } gnome2_gconf_install () { local F; if [[ ! -x "${GCONFTOOL_BIN}" ]]; then return; fi; if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then einfo "No GNOME 2 GConf schemas found"; return; fi; unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL; export GCONF_CONFIG_SOURCE="$("${GCONFTOOL_BIN}" --get-default-source | sed "s;:/;:${ROOT};")"; einfo "Installing GNOME 2 GConf schemas"; for F in ${GNOME2_ECLASS_SCHEMAS}; do if [[ -e "${ROOT}${F}" ]]; then "${GCONFTOOL_BIN}" --makefile-install-rule "${ROOT}${F}" > /dev/null; fi; done; pids=$(pgrep -x gconfd-2); if [[ $? == 0 ]]; then ebegin "Reloading GConf schemas"; kill -HUP ${pids}; eend $?; fi } gnome2_gconf_savelist () { pushd "${D}" &>/dev/null; export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas' 2> /dev/null); popd &>/dev/null } gnome2_gconf_uninstall () { local F; if [[ ! -x "${GCONFTOOL_BIN}" ]]; then return; fi; if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then einfo "No GNOME 2 GConf schemas found"; return; fi; unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL; export GCONF_CONFIG_SOURCE="$("${GCONFTOOL_BIN}" --get-default-source | sed "s;:/;:${ROOT};")"; einfo "Uninstalling GNOME 2 GConf schemas"; for F in ${GNOME2_ECLASS_SCHEMAS}; do if [[ -e "${ROOT}${F}" ]]; then "${GCONFTOOL_BIN}" --makefile-uninstall-rule "${ROOT}${F}" > /dev/null; fi; done; pids=$(pgrep -x gconfd-2); if [[ $? == 0 ]]; then ebegin "Reloading GConf schemas"; kill -HUP ${pids}; eend $?; fi } gnome2_icon_cache_update () { local updater="$(type -p gtk-update-icon-cache 2> /dev/null)"; if [[ ! -x "${updater}" ]]; then debug-print "${updater} is not executable"; return; fi; if [[ -z "${GNOME2_ECLASS_ICONS}" ]]; then return; fi; ebegin "Updating icons cache"; local retval=0; local fails=(); for dir in ${GNOME2_ECLASS_ICONS}; do if [[ -f "${ROOT}${dir}/index.theme" ]]; then local rv=0; "${updater}" -qf "${ROOT}${dir}"; rv=$?; if [[ ! $rv -eq 0 ]]; then debug-print "Updating cache failed on ${ROOT}${dir}"; fails[$(( ${#fails[@]} + 1 ))]="${ROOT}${dir}"; retval=2; fi; fi; done; eend ${retval}; for f in "${fails[@]}"; do eerror "Failed to update cache with icon $f"; done } gnome2_icon_savelist () { pushd "${D}" &>/dev/null; export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null); popd &>/dev/null } gnome2_omf_fix () { local omf_makefiles filename; omf_makefiles="$@"; if [[ -f ${S}/omf.make ]]; then omf_makefiles="${omf_makefiles} ${S}/omf.make"; fi; for filename in $(find ./ -name "Makefile.in" -o -name "Makefile.am" |sort); do omf_makefiles="${omf_makefiles} ${filename}"; done; ebegin "Fixing OMF Makefiles"; local retval=0; local fails=(); for omf in ${omf_makefiles}; do local rv=0; sed -i -e 's:scrollkeeper-update:true:' "${omf}"; retval=$?; if [[ ! $rv -eq 0 ]]; then debug-print "updating of ${omf} failed"; fails[$(( ${#fails[@]} + 1 ))]=$omf; retval=2; fi; done; eend $retval; for f in "${fails[@]}"; do eerror "Failed to update OMF Makefile $f"; done } gnome2_pkg_postinst () { gnome2_gconf_install; fdo-mime_desktop_database_update; fdo-mime_mime_database_update; gnome2_icon_cache_update; if [[ "${SCROLLKEEPER_UPDATE}" = "1" ]]; then gnome2_scrollkeeper_update; fi } gnome2_pkg_postrm () { fdo-mime_desktop_database_update; fdo-mime_mime_database_update; gnome2_icon_cache_update; if [[ "${SCROLLKEEPER_UPDATE}" = "1" ]]; then gnome2_scrollkeeper_update; fi } gnome2_pkg_preinst () { gnome2_gconf_savelist; gnome2_icon_savelist } gnome2_scrollkeeper_update () { if [[ -x "${SCROLLKEEPER_UPDATE_BIN}" ]]; then einfo "Updating scrollkeeper database ..."; "${SCROLLKEEPER_UPDATE_BIN}" -q -p "${SCROLLKEEPER_DIR}"; fi } gnome2_src_compile () { has ${EAPI:-0} 0 1 && gnome2_src_configure "$@"; emake || die "compile failure" } gnome2_src_configure () { if [[ ${GCONF_DEBUG} != 'no' ]]; then if use debug; then G2CONF="${G2CONF} --enable-debug=yes"; fi; fi; if hasq doc ${IUSE}; then G2CONF="${G2CONF} $(use_enable doc gtk-doc)"; fi; addwrite "/root/.gnome2"; GST_REGISTRY="${S}/registry.xml" econf "$@" ${G2CONF} || die "configure failed" } gnome2_src_install () { local sk_tmp_dir="/var/lib/scrollkeeper"; dodir "${sk_tmp_dir}"; export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL="1"; if [[ -z "${USE_EINSTALL}" || "${USE_EINSTALL}" = "0" ]]; then debug-print "Installing with 'make install'"; emake DESTDIR="${D}" "scrollkeeper_localstate_dir=${D}${sk_tmp_dir} " "$@" install || die "install failed"; else debug-print "Installing with 'einstall'"; einstall "scrollkeeper_localstate_dir=${D}${sk_tmp_dir} " "$@" || die "einstall failed"; fi; unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL; [[ -n "${DOCS}" ]] && dodoc ${DOCS}; if [[ -z "$(find "${D}" -name '*.omf')" ]]; then export SCROLLKEEPER_UPDATE="0"; fi; rm -rf "${D}${sk_tmp_dir}"; rm -fr "${D}/usr/share/applications/mimeinfo.cache" } gnome2_src_prepare () { gnome2_omf_fix; elibtoolize ${ELTCONF} } gnome2_src_unpack () { unpack ${A}; cd "${S}"; has ${EAPI:-0} 0 1 && gnome2_src_prepare } has_multilib_profile () { [ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ] } is_final_abi () { has_multilib_profile || return 0; local ALL_ABIS=$(get_install_abis); local LAST_ABI=${ALL_ABIS/* /}; [[ ${LAST_ABI} == ${ABI} ]] } multilib_env () { local CTARGET=${1:-${CTARGET}}; case ${CTARGET} in x86_64*) export CFLAGS_x86=${CFLAGS_x86--m32}; export CHOST_x86=${CTARGET/x86_64/i686}; export CTARGET_x86=${CHOST_x86}; export CDEFINE_x86="__i386__"; export LIBDIR_x86="lib"; export CFLAGS_amd64=${CFLAGS_amd64--m64}; export CHOST_amd64=${CTARGET}; export CTARGET_amd64=${CHOST_amd64}; export CDEFINE_amd64="__x86_64__"; export LIBDIR_amd64="lib64"; export MULTILIB_ABIS="amd64 x86"; export DEFAULT_ABI="amd64" ;; mips64*) export CFLAGS_o32=${CFLAGS_o32--mabi=32}; export CHOST_o32=${CTARGET/mips64/mips}; export CTARGET_o32=${CHOST_o32}; export CDEFINE_o32="_MIPS_SIM == _ABIO32"; export LIBDIR_o32="lib"; export CFLAGS_n32=${CFLAGS_n32--mabi=n32}; export CHOST_n32=${CTARGET}; export CTARGET_n32=${CHOST_n32}; export CDEFINE_n32="_MIPS_SIM == _ABIN32"; export LIBDIR_n32="lib32"; export CFLAGS_n64=${CFLAGS_n64--mabi=64}; export CHOST_n64=${CTARGET}; export CTARGET_n64=${CHOST_n64}; export CDEFINE_n64="_MIPS_SIM == _ABI64"; export LIBDIR_n64="lib64"; export MULTILIB_ABIS="n64 n32 o32"; export DEFAULT_ABI="n32" ;; powerpc64*) export CFLAGS_ppc=${CFLAGS_ppc--m32}; export CHOST_ppc=${CTARGET/powerpc64/powerpc}; export CTARGET_ppc=${CHOST_ppc}; export CDEFINE_ppc="!__powerpc64__"; export LIBDIR_ppc="lib"; export CFLAGS_ppc64=${CFLAGS_ppc64--m64}; export CHOST_ppc64=${CTARGET}; export CTARGET_ppc64=${CHOST_ppc64}; export CDEFINE_ppc64="__powerpc64__"; export LIBDIR_ppc64="lib64"; export MULTILIB_ABIS="ppc64 ppc"; export DEFAULT_ABI="ppc64" ;; s390x*) export CFLAGS_s390=${CFLAGS_s390--m31}; export CHOST_s390=${CTARGET/s390x/s390}; export CTARGET_s390=${CHOST_s390}; export CDEFINE_s390="!__s390x__"; export LIBDIR_s390="lib"; export CFLAGS_s390x=${CFLAGS_s390x--m64}; export CHOST_s390x=${CTARGET}; export CTARGET_s390x=${CHOST_s390x}; export CDEFINE_s390x="__s390x__"; export LIBDIR_s390x="lib64"; export MULTILIB_ABIS="s390x s390"; export DEFAULT_ABI="s390x" ;; sparc*) export CFLAGS_sparc32=${CFLAGS_sparc32}; export CHOST_sparc32=${CTARGET/sparc64/sparc}; export CTARGET_sparc32=${CHOST_sparc32}; export CDEFINE_sparc32="!__arch64__"; export LIBDIR_sparc32="lib"; export CFLAGS_sparc64=${CFLAGS_sparc64--m64}; export CHOST_sparc64=${CTARGET}; export CTARGET_sparc64=${CHOST_sparc64}; export CDEFINE_sparc64="__arch64__"; export LIBDIR_sparc64="lib64"; export MULTILIB_ABIS="${MULTILIB_ABIS-sparc64 sparc32}"; export DEFAULT_ABI="${DEFAULT_ABI-sparc64}" ;; *) export MULTILIB_ABIS="default"; export DEFAULT_ABI="default" ;; esac } multilib_toolchain_setup () { local v vv; export ABI=$1; if [[ ${ABI} != ${DEFAULT_ABI} ]]; then if [[ ${DEFAULT_ABI_SAVED} != "true" ]]; then for v in CHOST CBUILD AS CC CXX LD; do export __abi_saved_${v}="${!v}"; done; export DEFAULT_ABI_SAVED="true"; fi; export CHOST=$(get_abi_CHOST ${DEFAULT_ABI}); export AS="$(tc-getAS) $(get_abi_ASFLAGS)"; export CC="$(tc-getCC) $(get_abi_CFLAGS)"; export CXX="$(tc-getCXX) $(get_abi_CFLAGS)"; export LD="$(tc-getLD) $(get_abi_LDFLAGS)"; export CHOST=$(get_abi_CHOST $1); export CBUILD=$(get_abi_CHOST $1); else if [[ ${DEFAULT_ABI_SAVED} == "true" ]]; then for v in CHOST CBUILD AS CC CXX LD; do vv="__abi_saved_${v}"; export ${v}=${!vv}; done; fi; fi } newpamd () { [[ $# -ne 2 ]] && die "newpamd requires two arguments"; if hasq pam ${IUSE} && ! use pam; then return 0; fi; ( insinto /etc/pam.d; insopts -m 0644; newins "$1" "$2" ) || die "failed to install $1 as $2"; cleanpamd $2 } newpammod () { [[ $# -ne 2 ]] && die "newpammod requires two arguements"; if hasq pam ${IUSE} && ! use pam; then return 0; fi; exeinto $(getpam_mod_dir); newexe "$1" "$2" || die "failed to install $1 as $2" } newpamsecurity () { [[ $# -ne 3 ]] && die "newpamsecurity requires three arguments"; if hasq pam ${IUSE} && ! use pam; then return 0; fi; ( insinto /etc/security/$1; insopts -m 0644; newins "$2" "$3" ) || die "failed to install $2 as $3" } nonfatal () { if has "${EAPI:-0}" 0 1 2 3 3_pre2; then die "$FUNCNAME() not supported in this EAPI"; fi; if [[ $# -lt 1 ]]; then die "$FUNCNAME(): Missing argument"; fi; PORTAGE_NONFATAL=1 "$@" } number_abis () { get_install_abis | wc -w } pam_epam_expand () { sed -n -e 's|#%EPAM-\([[:alpha:]-]\+\):\([-+<>=/.![:alnum:]]\+\)%#.*|\1 \2|p' "$@" | sort -u | while read condition parameter; do disable="yes"; case "$condition" in If-Has) message="This can be used only if you have ${parameter} installed"; has_version "$parameter" && disable="no" ;; Use-Flag) message="This can be used only if you enabled the ${parameter} USE flag"; use "$parameter" && disable="no" ;; *) eerror "Unknown EPAM condition '${condition}' ('${parameter}')"; die "Unknown EPAM condition '${condition}' ('${parameter}')" ;; esac; if [ "${disable}" = "yes" ]; then sed -i -e "/#%EPAM-${condition}:${parameter/\//\\/}%#/d" "$@"; else sed -i -e "s|#%EPAM-${condition}:${parameter}%#||" "$@"; fi; done } pamd_mimic () { [[ $# -lt 3 ]] && die "pamd_mimic requires at least three argments"; if hasq pam ${IUSE} && ! use pam; then return 0; fi; dodir /etc/pam.d; pamdfile=${D}/etc/pam.d/$2; echo -e "# File autogenerated by pamd_mimic in pam eclass\n\n" >> $pamdfile; originalstack=$1; authlevels="auth account password session"; if has_version '> ${pamdfile}; shift; done } pamd_mimic_system () { [[ $# -lt 2 ]] && die "pamd_mimic_system requires at least two argments"; pamd_mimic system-auth "$@" } pkg_nofetch () { _eapi0_pkg_nofetch "$@" } pkg_postinst () { gnome2_pkg_postinst "$@" } pkg_postrm () { gnome2_pkg_postrm "$@" } pkg_preinst () { gnome2_pkg_preinst "$@" } pkg_setup () { G2CONF="${G2CONF} $(use_enable debug) $(use_enable test tests) $(use_enable pam) $(use_with pam pam-dir $(getpam_mod_dir)) --with-root-certs=/usr/share/ca-certificates/ --enable-acl-prompts --enable-ssh-agent" } prep_ml_includes () { if [[ $(number_abis) -gt 1 ]]; then local dir; local dirs; local base; if [[ $# -eq 0 ]]; then dirs=/usr/include; else dirs="$@"; fi; for dir in ${dirs}; do base=${T}/gentoo-multilib/${dir}/gentoo-multilib; mkdir -p "${base}"; [[ -d ${base}/${ABI} ]] && rm -rf "${base}/${ABI}"; mv "${D}/${dir}" "${base}/${ABI}"; done; if is_final_abi; then base=${T}/gentoo-multilib; pushd "${base}"; find . | tar -c -T - -f - | tar -x --no-same-owner -f - -C "${D}"; popd; set --; for dir in ${dirs}; do set -- "$@" "${dir}"; local abi; for abi in $(get_install_abis); do set -- "$@" "$(get_abi_CDEFINE ${abi}):${dir}/gentoo-multilib/${abi}"; done; create_ml_includes "$@"; done; fi; fi } register_success_hook () { local x; for x in $*; do hasq $x $EBUILD_SUCCESS_HOOKS || export EBUILD_SUCCESS_HOOKS="$EBUILD_SUCCESS_HOOKS $x"; done } remove_flag () { local remove="${1}"; shift; while [[ -n "${1}" ]]; do [[ "${1}" != "${remove}" ]] && echo -n "${1} "; shift; done } src_compile () { gnome2_src_compile "$@" } src_configure () { gnome2_src_configure "$@" } src_install () { gnome2_src_install "$@" } src_prepare () { gnome2_src_prepare; sed 's:CFLAGS="$CFLAGS -Werror:CFLAGS="$CFLAGS:' -i configure.in configure || die "sed failed" } src_test () { unset DBUS_SESSION_BUS_ADDRESS; Xemake check || die "emake check failed!" } src_unpack () { gnome2_src_unpack "$@" } tc-arch () { tc-ninja_magic_to_arch portage "$@" } tc-arch-kernel () { tc-ninja_magic_to_arch kern "$@" } tc-endian () { local host=$1; [[ -z ${host} ]] && host=${CTARGET:-${CHOST}}; host=${host%%-*}; case ${host} in alpha*) echo big ;; arm*b*) echo big ;; arm*) echo little ;; cris*) echo little ;; hppa*) echo big ;; i?86*) echo little ;; ia64*) echo little ;; m68*) echo big ;; mips*l*) echo little ;; mips*) echo big ;; powerpc*) echo big ;; s390*) echo big ;; sh*b*) echo big ;; sh*) echo little ;; sparc*) echo big ;; x86_64*) echo little ;; *) echo wtf ;; esac } tc-export () { local var; for var in "$@"; do [[ $(type -t tc-get${var}) != "function" ]] && die "tc-export: invalid export variable '${var}'"; eval tc-get${var} > /dev/null; done } tc-getAR () { tc-getPROG AR ar "$@" } tc-getAS () { tc-getPROG AS as "$@" } tc-getBUILD_CC () { local v; for v in CC_FOR_BUILD BUILD_CC HOSTCC; do if [[ -n ${!v} ]]; then export BUILD_CC=${!v}; echo "${!v}"; return 0; fi; done; local search=; if [[ -n ${CBUILD} ]]; then search=$(type -p ${CBUILD}-gcc); search=${search##*/}; fi; search=${search:-gcc}; export BUILD_CC=${search}; echo "${search}" } tc-getCC () { tc-getPROG CC gcc "$@" } tc-getCPP () { tc-getPROG CPP cpp "$@" } tc-getCXX () { tc-getPROG CXX g++ "$@" } tc-getF77 () { tc-getPROG F77 f77 "$@" } tc-getFC () { tc-getPROG FC gfortran "$@" } tc-getGCJ () { tc-getPROG GCJ gcj "$@" } tc-getLD () { tc-getPROG LD ld "$@" } tc-getNM () { tc-getPROG NM nm "$@" } tc-getOBJCOPY () { tc-getPROG OBJCOPY objcopy "$@" } tc-getPKG_CONFIG () { tc-getPROG PKG_CONFIG pkg-config "$@" } tc-getPROG () { local var=$1; local prog=$2; if [[ -n ${!var} ]]; then echo "${!var}"; return 0; fi; local search=; [[ -n $3 ]] && search=$(type -p "$3-${prog}"); [[ -z ${search} && -n ${CHOST} ]] && search=$(type -p "${CHOST}-${prog}"); [[ -n ${search} ]] && prog=${search##*/}; export ${var}=${prog}; echo "${!var}" } tc-getRANLIB () { tc-getPROG RANLIB ranlib "$@" } tc-getSTRIP () { tc-getPROG STRIP strip "$@" } tc-has-tls () { local base="${T}/test-tc-tls"; cat > "${base}.c" <<-EOF int foo(int *i) { static __thread int j = 0; return *i ? j : *i; } EOF local flags; case $1 in -s) flags="-S" ;; -c) flags="-c" ;; -l) ;; -*) die "Usage: tc-has-tls [-c|-l] [toolchain prefix]" ;; esac; : ${flags:=-fPIC -shared -Wl,-z,defs}; [[ $1 == -* ]] && shift; $(tc-getCC "$@") ${flags} "${base}.c" -o "${base}" &>/dev/null; local ret=$?; rm -f "${base}"*; return ${ret} } tc-is-cross-compiler () { return $([[ ${CBUILD:-${CHOST}} != ${CHOST} ]]) } tc-is-softfloat () { case ${CTARGET} in bfin* | h8300*) echo "only" ;; *) [[ ${CTARGET//_/-} == *-softfloat-* ]] && echo "yes" || echo "no" ;; esac } tc-is-static-only () { local host=${CTARGET:-${CHOST}}; return $([[ ${host} == *-mint* ]]) } tc-ninja_magic_to_arch () { function ninj () { [[ ${type} == "kern" ]] && echo $1 || echo $2 }; local type=$1; local host=$2; [[ -z ${host} ]] && host=${CTARGET:-${CHOST}}; case ${host} in alpha*) echo alpha ;; arm*) echo arm ;; avr*) ninj avr32 avr ;; bfin*) ninj blackfin bfin ;; cris*) echo cris ;; hppa*) ninj parisc hppa ;; i?86*) if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -lt $(KV_to_int 2.6.24) || ${host} == *freebsd* ]]; then echo i386; else echo x86; fi ;; ia64*) echo ia64 ;; m68*) echo m68k ;; mips*) echo mips ;; nios2*) echo nios2 ;; nios*) echo nios ;; powerpc*) if [[ $(KV_to_int ${KV}) -ge $(KV_to_int 2.6.16) ]] && [[ ${type} == "kern" ]]; then echo powerpc; else if [[ $(KV_to_int ${KV}) -eq $(KV_to_int 2.6.15) ]] && [[ ${type} == "kern" ]]; then if [[ ${host} == powerpc64* ]] || [[ ${PROFILE_ARCH} == "ppc64" ]]; then echo powerpc; else echo ppc; fi; else if [[ ${host} == powerpc64* ]]; then echo ppc64; else if [[ ${PROFILE_ARCH} == "ppc64" ]]; then ninj ppc64 ppc; else echo ppc; fi; fi; fi; fi ;; s390*) echo s390 ;; sh64*) ninj sh64 sh ;; sh*) echo sh ;; sparc64*) ninj sparc64 sparc ;; sparc*) [[ ${PROFILE_ARCH} == "sparc64" ]] && ninj sparc64 sparc || echo sparc ;; vax*) echo vax ;; x86_64*) if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -ge $(KV_to_int 2.6.24) ]]; then echo x86; else ninj x86_64 amd64; fi ;; *) echo unknown ;; esac } uclibctoolize () { ewarn "uclibctoolize() is deprecated, please just use elibtoolize()!"; elibtoolize } virtualmake () { local retval=0; local OLD_SANDBOX_ON="${SANDBOX_ON}"; local XVFB=$(type -p Xvfb); local XHOST=$(type -p xhost); if [[ -n ${XVFB} && -n ${XHOST} ]] && ( [[ -z ${DISPLAY} ]] || ! ( ${XHOST} &>/dev/null ) ); then export XAUTHORITY=; einfo "Scanning for an open DISPLAY to start Xvfb ..."; export SANDBOX_ON="0"; local i=0; XDISPLAY=$(i=0; while [[ -f /tmp/.X${i}-lock ]] ; do ((i++));done; echo ${i}); ${XVFB} :${XDISPLAY} -fp built-ins -screen 0 800x600x24 &>/dev/null & sleep 2; local start=${XDISPLAY}; while [[ ! -f /tmp/.X${XDISPLAY}-lock ]]; do if ((XDISPLAY - start > 15)); then eerror ""; eerror "Unable to start Xvfb."; eerror ""; eerror "'${XVFB} :${XDISPLAY} -fp built-ins -screen 0 800x600x24' returns:"; eerror ""; ${XVFB} :${XDISPLAY} -fp built-ins -screen 0 800x600x24; eerror ""; eerror "If possible, correct the above error and try your emerge again."; eerror ""; die; fi; ((XDISPLAY++)); ${XVFB} :${XDISPLAY} -fp built-ins -screen 0 800x600x24 &>/dev/null & sleep 2; done; export SANDBOX_ON="${OLD_SANDBOX_ON}"; einfo "Starting Xvfb on \$DISPLAY=${XDISPLAY} ..."; export DISPLAY=:${XDISPLAY}; ${maketype} "$@"; retval=$?; kill $(cat /tmp/.X${XDISPLAY}-lock); else ${maketype} "$@"; retval=$?; fi; return ${retval} }