spacepaste

  1.  
  2. declare -x ABI="amd64"
  3. declare -x ABI_X86="64"
  4. declare -x ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci"
  5. declare -x APACHE2_MODULES="authn_core authz_core socache_shmcb unixd 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 cgi cgid 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"
  6. declare -x ARCH="amd64"
  7. declare -x BOOTSTRAP_USE="cxx unicode internal-glib python_targets_python3_4 python_targets_python2_7 multilib"
  8. declare -x CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author"
  9. declare -x CAMERAS="ptp2"
  10. declare -x CBUILD="x86_64-pc-linux-gnu"
  11. declare -x CFLAGS="-O2 -pipe"
  12. declare -x CFLAGS_amd64="-m64"
  13. declare -x CFLAGS_default
  14. declare -x CFLAGS_x32="-mx32"
  15. declare -x CFLAGS_x86="-m32"
  16. declare -x CHOST="x86_64-pc-linux-gnu"
  17. declare -x CHOST_amd64="x86_64-pc-linux-gnu"
  18. declare -x CHOST_default="x86_64-pc-linux-gnu"
  19. declare -x CHOST_x32="x86_64-pc-linux-gnux32"
  20. declare -x CHOST_x86="i686-pc-linux-gnu"
  21. declare -x COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog"
  22. declare -x CONF_PREFIX="/usr"
  23. declare -x CPU_FLAGS_X86="mmx sse sse2"
  24. declare -x CTARGET_default="x86_64-pc-linux-gnu"
  25. declare -x CXXFLAGS="-O2 -pipe"
  26. declare -x DBUS_SESSION_BUS_ADDRESS="unix:abstract=/tmp/dbus-Mcyibevh6u,guid=5fdaf27dd2b1883dbe50f3875877ee6c"
  27. declare -x DEFAULT_ABI="amd64"
  28. declare -x DEFINED_PHASES=" configure prepare"
  29. declare DEPEND="!static? ( pcre? ( >=dev-libs/libpcre-7.8-r1 ) )
  30. nls? ( virtual/libintl )
  31. virtual/libiconv
  32. virtual/pkgconfig
  33. nls? ( sys-devel/gettext )
  34. static? ( pcre? ( >=dev-libs/libpcre-7.8-r1[static-libs(+)] ) ) "
  35. declare DESCRIPTION="GNU regular expression matcher"
  36. declare -x DESKTOP_SESSION="xfce"
  37. declare -x DESTTREE="/usr"
  38. declare -x DIROPTIONS="-m0755"
  39. declare -a DOCS='([0]="AUTHORS" [1]="ChangeLog" [2]="NEWS" [3]="README" [4]="THANKS" [5]="TODO")'
  40. declare -x EAPI="5"
  41. declare -- ECONF_SOURCE="."
  42. declare -x ELIBC="glibc"
  43. declare -- EPATCH_COMMON_OPTS="-g0 -E --no-backup-if-mismatch"
  44. declare -- EPATCH_EXCLUDE=""
  45. declare -- EPATCH_FORCE="no"
  46. declare -- EPATCH_MULTI_MSG="Applying various patches (bugfixes/updates) ..."
  47. declare -- EPATCH_OPTS=""
  48. declare -- EPATCH_SINGLE_MSG=""
  49. declare -- EPATCH_SOURCE="/var/tmp/portage/sys-apps/grep-2.25/work/patch"
  50. declare -- EPATCH_SUFFIX="patch.bz2"
  51. declare -- EPATCH_USER_SOURCE="/etc/portage/patches"
  52. declare -x EXEOPTIONS="-m0755"
  53. declare -x FCFLAGS="-O2 -pipe"
  54. declare -x FETCHCOMMAND_SSH="bash -c \"x=\\\${2#ssh://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && port= ; exec rsync --rsh=\\\"ssh \\\${port:+-p\\\${port}} \\\${3}\\\" -avP \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" rsync \"\${DISTDIR}/\${FILE}\" \"\${URI}\" \"\${PORTAGE_SSH_OPTS}\""
  55. declare -x FFLAGS="-O2 -pipe"
  56. declare -x GCC_SPECS=""
  57. declare -x GLADE_CATALOG_PATH=":"
  58. declare -x GLADE_MODULE_PATH=":"
  59. declare -x GLADE_PIXMAP_PATH=":"
  60. declare -x GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx"
  61. declare -x GRUB_PLATFORMS=""
  62. declare -x GSETTINGS_BACKEND="dconf"
  63. declare -x GTK_MODULES="canberra-gtk-module"
  64. declare -x GUILE_LOAD_PATH="/usr/share/guile/1.8"
  65. declare HDEPEND=""
  66. declare HOMEPAGE="https://www.gnu.org/software/grep/"
  67. declare -x INHERITED=" multilib toolchain-funcs eutils flag-o-matic"
  68. declare -x INPUT_DEVICES="evdev synaptics"
  69. declare -x INSDESTTREE=""
  70. declare -x INSOPTIONS="-m0644"
  71. declare IUSE="nls pcre static "
  72. declare -x IUSE_EFFECTIVE="abi_x86_64 alpha amd64 amd64-fbsd amd64-linux arm arm-linux arm64 elibc_AIX elibc_Cygwin elibc_Darwin elibc_DragonFly elibc_FreeBSD elibc_HPUX elibc_Interix elibc_NetBSD elibc_OpenBSD elibc_SunOS elibc_Winnt elibc_bionic elibc_glibc elibc_mingw elibc_mintlib elibc_musl elibc_uclibc hppa hppa-hpux ia64 ia64-hpux ia64-linux kernel_AIX kernel_Darwin kernel_FreeBSD kernel_HPUX kernel_Interix kernel_NetBSD kernel_OpenBSD kernel_SunOS kernel_Winnt kernel_freemint kernel_linux m68k m68k-mint mips nios2 nls pcre ppc ppc-aix ppc-macos ppc-openbsd ppc64 ppc64-linux prefix prefix-guest riscv s390 sh sparc sparc-fbsd sparc-solaris sparc64-freebsd sparc64-solaris static userland_BSD userland_GNU x64-cygwin x64-freebsd x64-macos x64-openbsd x64-solaris x86 x86-cygwin x86-fbsd x86-freebsd x86-interix x86-linux x86-macos x86-netbsd x86-openbsd x86-solaris x86-winnt"
  73. declare -x IUSE_IMPLICIT="abi_x86_64 prefix prefix-guest"
  74. declare -x KERNEL="linux"
  75. declare -x KERNEL_ABI="amd64"
  76. declare -x KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
  77. declare -x LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text"
  78. declare -x LC_MESSAGES="C"
  79. declare -x LDFLAGS="-Wl,-O1 -Wl,--as-needed -static"
  80. declare -x LDFLAGS_amd64="-m elf_x86_64"
  81. declare -x LDFLAGS_default
  82. declare -x LDFLAGS_x32="-m elf32_x86_64"
  83. declare -x LDFLAGS_x86="-m elf_i386"
  84. declare -x LIBDIR_amd64="lib64"
  85. declare -x LIBDIR_amd64_fbsd="lib64"
  86. declare -x LIBDIR_arm="lib"
  87. declare -x LIBDIR_arm64="lib64"
  88. declare -x LIBDIR_default="lib"
  89. declare -x LIBDIR_n32="lib32"
  90. declare -x LIBDIR_n64="lib64"
  91. declare -x LIBDIR_o32="lib"
  92. declare -x LIBDIR_ppc="lib32"
  93. declare -x LIBDIR_ppc64="lib64"
  94. declare -x LIBDIR_s390="lib32"
  95. declare -x LIBDIR_s390x="lib64"
  96. declare -x LIBDIR_sparc32="lib32"
  97. declare -x LIBDIR_sparc64="lib64"
  98. declare -x LIBDIR_x32="libx32"
  99. declare -x LIBDIR_x86="lib32"
  100. declare -x LIBDIR_x86_fbsd="lib32"
  101. declare -x LIBOPTIONS="-m0644"
  102. declare -x LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer"
  103. declare -- LIB_DEPEND="pcre? ( >=dev-libs/libpcre-7.8-r1[static-libs(+)] )"
  104. declare -x LICENSE="GPL-3"
  105. declare -x MAIL="/var/mail/mikef"
  106. declare -x MAKEOPTS="-j5"
  107. declare -x MANPAGER="manpager"
  108. declare -x MULTILIB_ABIS="amd64 x86"
  109. declare -x MULTILIB_STRICT_DENY="64-bit.*shared object"
  110. 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"
  111. declare -x MULTILIB_STRICT_EXEMPT="(perl5|gcc|gcc-lib|binutils|eclipse-3|debug|portage|udev|systemd|clang|python-exec)"
  112. declare -x MULTIOSDIRS="../lib64:../lib32"
  113. declare -x NETBEANS="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml"
  114. declare -x OFFICE_IMPLEMENTATION="libreoffice"
  115. declare -x OPENGL_PROFILE="xorg-x11"
  116. declare -x PATH="/usr/lib/portage/python3.4/ebuild-helpers/xattr:/usr/lib/portage/python3.4/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.9.4"
  117. declare PDEPEND=""
  118. declare -x PHP_TARGETS="php5-6"
  119. declare -x PKG_CONFIG_PATH="/usr/lib64/pkgconfig"
  120. declare -a PORTAGE_DOCOMPRESS='([0]="/usr/share/doc" [1]="/usr/share/info" [2]="/usr/share/man")'
  121. declare -x PORTAGE_DOCOMPRESS_SIZE_LIMIT="128"
  122. declare -a PORTAGE_DOCOMPRESS_SKIP='([0]="/usr/share/doc/grep-2.25/html")'
  123. declare -x PROFILE_ONLY_VARIABLES="ARCH ELIBC IUSE_IMPLICIT KERNEL USERLAND USE_EXPAND_IMPLICIT USE_EXPAND_UNPREFIXED USE_EXPAND_VALUES_ARCH USE_EXPAND_VALUES_ELIBC USE_EXPAND_VALUES_KERNEL USE_EXPAND_VALUES_USERLAND"
  124. declare -x PROPERTIES=""
  125. declare -x PROVIDE=""
  126. declare -x PYTHONDONTWRITEBYTECODE="1"
  127. declare -x PYTHON_SINGLE_TARGET="python2_7"
  128. declare -x PYTHON_TARGETS="python2_7 python3_4"
  129. declare RDEPEND="!static? ( pcre? ( >=dev-libs/libpcre-7.8-r1 ) )
  130. nls? ( virtual/libintl )
  131. virtual/libiconv "
  132. declare REPOSITORY
  133. declare REQUIRED_USE=""
  134. declare -x RESTRICT=""
  135. declare -x RESUMECOMMAND_SSH="bash -c \"x=\\\${2#ssh://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && port= ; exec rsync --rsh=\\\"ssh \\\${port:+-p\\\${port}} \\\${3}\\\" -avP \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" rsync \"\${DISTDIR}/\${FILE}\" \"\${URI}\" \"\${PORTAGE_SSH_OPTS}\""
  136. declare -x RUBY_TARGETS="ruby21"
  137. declare -x S="/var/tmp/portage/sys-apps/grep-2.25/work/grep-2.25"
  138. declare -x SANDBOX_DEBUG="0"
  139. declare -x SANDBOX_DENY=""
  140. declare -x SANDBOX_PREDICT="/var/tmp/portage/sys-apps/grep-2.25/homedir:/dev/crypto:/var/cache/fontconfig"
  141. declare -x SANDBOX_READ="/:/var/tmp"
  142. declare -x SANDBOX_VERBOSE="1"
  143. declare -x SANDBOX_WRITE=":/dev/console:/dev/fd:/dev/full:/dev/null:/dev/ptmx:/dev/pts/:/dev/pty:/dev/shm:/dev/tts:/dev/tty:/dev/vc/:/dev/zero:/proc/self/fd:/tmp/:/usr/lib/cf:/usr/lib/conftest:/usr/lib32/cf:/usr/lib32/conftest:/usr/lib64/cf:/usr/lib64/conftest:/usr/tmp/cf:/usr/tmp/conftest:/var/tmp:/var/tmp/:/var/tmp/portage/sys-apps/grep-2.25/homedir/.bash_history"
  144. declare -x SESSION_MANAGER="local/bong:@/tmp/.ICE-unix/2491,unix/bong:/tmp/.ICE-unix/2491"
  145. declare -x SHELL="/bin/bash"
  146. declare -x SLOT="0"
  147. declare SRC_URI="mirror://gnu/grep/grep-2.25.tar.xz
  148. mirror://gentoo/grep-2.25.tar.xz"
  149. declare -x SYMLINK_LIB="yes"
  150. declare -x USE="abi_x86_64 amd64 elibc_glibc kernel_linux nls pcre static userland_GNU"
  151. declare -x USERLAND="GNU"
  152. declare -x USE_EXPAND_IMPLICIT="ARCH ELIBC KERNEL USERLAND"
  153. declare -x USE_EXPAND_UNPREFIXED="ARCH"
  154. declare -x USE_EXPAND_VALUES_ARCH="alpha amd64 amd64-fbsd amd64-linux arm arm-linux arm64 hppa hppa-hpux ia64 ia64-hpux ia64-linux m68k m68k-mint mips nios2 ppc ppc64 ppc64-linux ppc-aix ppc-macos ppc-openbsd riscv s390 sh sparc sparc64-freebsd sparc64-solaris sparc-fbsd sparc-solaris x64-cygwin x64-freebsd x64-macos x64-openbsd x64-solaris x86 x86-cygwin x86-fbsd x86-freebsd x86-interix x86-linux x86-macos x86-netbsd x86-openbsd x86-solaris x86-winnt"
  155. declare -x USE_EXPAND_VALUES_ELIBC="AIX bionic Cygwin Darwin DragonFly FreeBSD glibc HPUX Interix mingw mintlib musl NetBSD OpenBSD SunOS uclibc Winnt"
  156. declare -x USE_EXPAND_VALUES_KERNEL="AIX Darwin FreeBSD freemint HPUX Interix linux NetBSD OpenBSD SunOS Winnt"
  157. declare -x USE_EXPAND_VALUES_USERLAND="BSD GNU"
  158. declare -x VIDEO_CARDS="amdgpu radeonsi radeon"
  159. declare -x WINDOWID="39845892"
  160. declare -x XDG_CONFIG_DIRS="/etc/xdg"
  161. declare -x XDG_CURRENT_DESKTOP="XFCE"
  162. declare -x XDG_DATA_DIRS="/usr/local/share:/usr/share"
  163. declare -x XDG_MENU_PREFIX="xfce-"
  164. declare -x XSESSION="Xfce4"
  165. declare -x XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
  166. declare -- _EUTILS_ECLASS="1"
  167. declare -- _EUTILS_ECLASSDIR_LOCAL="/usr/portage/eclass"
  168. declare -x _E_DOCDESTTREE_=""
  169. declare -x _E_EXEDESTTREE_=""
  170. declare -- _FLAG_O_MATIC_ECLASS="1"
  171. declare -- _MULTILIB_ECLASS="1"
  172. declare -- _TOOLCHAIN_FUNCS_ECLASS="1"
  173. declare -x ac_cv_search_pcre_compile="-lpcre -pthread "
  174. declare -- phase_func
  175. __eapi6_src_install ()
  176. {
  177. if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then
  178. emake DESTDIR="${D}" install;
  179. fi;
  180. einstalldocs
  181. }
  182. __eapi6_src_prepare ()
  183. {
  184. if [[ $(declare -p PATCHES 2>/dev/null) == "declare -a"* ]]; then
  185. [[ -n ${PATCHES[@]} ]] && eapply "${PATCHES[@]}";
  186. else
  187. if [[ -n ${PATCHES} ]]; then
  188. eapply ${PATCHES};
  189. fi;
  190. fi;
  191. eapply_user
  192. }
  193. _clang_fullversion ()
  194. {
  195. local ver="$1";
  196. shift;
  197. set -- $($(tc-getCPP "$@") -E -P - <<<"__clang_major__ __clang_minor__ __clang_patchlevel__");
  198. eval echo "$ver"
  199. }
  200. _eutils_eprefix_init ()
  201. {
  202. has "${EAPI:-0}" 0 1 2 && : ${ED:=${D}} ${EPREFIX:=} ${EROOT:=${ROOT}}
  203. }
  204. _filter-hardened ()
  205. {
  206. local f;
  207. for f in "$@";
  208. do
  209. case "${f}" in
  210. -fPIC | -fpic | -fPIE | -fpie | -Wl,pie | -pie)
  211. gcc-specs-pie || continue;
  212. if ! is-flagq -nopie && ! is-flagq -no-pie; then
  213. if test-flags -nopie > /dev/null; then
  214. append-flags -nopie;
  215. else
  216. append-flags -no-pie;
  217. fi;
  218. fi
  219. ;;
  220. -fstack-protector)
  221. gcc-specs-ssp || continue;
  222. is-flagq -fno-stack-protector || append-flags $(test-flags -fno-stack-protector)
  223. ;;
  224. -fstack-protector-all)
  225. gcc-specs-ssp-to-all || continue;
  226. is-flagq -fno-stack-protector-all || append-flags $(test-flags -fno-stack-protector-all)
  227. ;;
  228. -fno-strict-overflow)
  229. gcc-specs-nostrict || continue;
  230. is-flagq -fstrict-overflow || append-flags $(test-flags -fstrict-overflow)
  231. ;;
  232. esac;
  233. done
  234. }
  235. _filter-var ()
  236. {
  237. local f x var=$1 new=();
  238. shift;
  239. for f in ${!var};
  240. do
  241. for x in "$@";
  242. do
  243. [[ ${f} == ${x} ]] && continue 2;
  244. done;
  245. new+=("${f}");
  246. done;
  247. eval export ${var}=\""${new[*]}"\"
  248. }
  249. _gcc-install-dir ()
  250. {
  251. echo "$(LC_ALL=C $(tc-getCC) -print-search-dirs 2> /dev/null | awk '$1=="install:" {print $2}')"
  252. }
  253. _gcc-specs-directive_raw ()
  254. {
  255. local cc=$(tc-getCC);
  256. local specfiles=$(LC_ALL=C ${cc} -v 2>&1 | awk '$1=="Reading" {print $NF}');
  257. ${cc} -dumpspecs 2> /dev/null | cat - ${specfiles} | awk -v directive=$1 'BEGIN { pspec=""; spec=""; outside=1 }
  258. $1=="*"directive":" { pspec=spec; spec=""; outside=0; next }
  259. outside || NF==0 || ( substr($1,1,1)=="*" && substr($1,length($1),1)==":" ) { outside=1; next }
  260. spec=="" && substr($0,1,1)=="+" { spec=pspec " " substr($0,2); next }
  261. { spec=spec $0 }
  262. END { print spec }';
  263. return 0
  264. }
  265. _gcc-specs-exists ()
  266. {
  267. [[ -f $(_gcc-install-dir)/$1 ]]
  268. }
  269. _gcc_fullversion ()
  270. {
  271. local ver="$1";
  272. shift;
  273. set -- $($(tc-getCPP "$@") -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__");
  274. eval echo "$ver"
  275. }
  276. _iconins ()
  277. {
  278. ( local funcname=$1;
  279. shift;
  280. local size dir;
  281. local context=apps;
  282. local theme=hicolor;
  283. while [[ $# -gt 0 ]]; do
  284. case $1 in
  285. -s | --size)
  286. if [[ ${2%%x*}x${2%%x*} == "$2" ]]; then
  287. size=${2%%x*};
  288. else
  289. size=${2};
  290. fi;
  291. case ${size} in
  292. 16 | 22 | 24 | 32 | 36 | 48 | 64 | 72 | 96 | 128 | 192 | 256 | 512)
  293. size=${size}x${size}
  294. ;;
  295. scalable)
  296. ;;
  297. *)
  298. eerror "${size} is an unsupported icon size!";
  299. exit 1
  300. ;;
  301. esac;
  302. shift 2
  303. ;;
  304. -t | --theme)
  305. theme=${2};
  306. shift 2
  307. ;;
  308. -c | --context)
  309. context=${2};
  310. shift 2
  311. ;;
  312. *)
  313. if [[ -z ${size} ]]; then
  314. insinto /usr/share/pixmaps;
  315. else
  316. insinto /usr/share/icons/${theme}/${size}/${context};
  317. fi;
  318. if [[ ${funcname} == doicon ]]; then
  319. if [[ -f $1 ]]; then
  320. doins "${1}";
  321. else
  322. if [[ -d $1 ]]; then
  323. shopt -s nullglob;
  324. doins "${1}"/*.{png,svg};
  325. shopt -u nullglob;
  326. else
  327. eerror "${1} is not a valid file/directory!";
  328. exit 1;
  329. fi;
  330. fi;
  331. else
  332. break;
  333. fi;
  334. shift 1
  335. ;;
  336. esac;
  337. done;
  338. if [[ ${funcname} == newicon ]]; then
  339. newins "$@";
  340. fi ) || die
  341. }
  342. _is_flagq ()
  343. {
  344. local x var;
  345. eval var=\""\${$1[*]}"\";
  346. for x in ${var};
  347. do
  348. [[ ${x} == $2 ]] && return 0;
  349. done;
  350. return 1
  351. }
  352. _tc-getPROG ()
  353. {
  354. local tuple=$1;
  355. local v var vars=$2;
  356. local prog=($3);
  357. var=${vars%% *};
  358. for v in ${vars};
  359. do
  360. if [[ -n ${!v} ]]; then
  361. export ${var}="${!v}";
  362. echo "${!v}";
  363. return 0;
  364. fi;
  365. done;
  366. local search=;
  367. [[ -n $4 ]] && search=$(type -p $4-${prog[0]});
  368. [[ -z ${search} && -n ${!tuple} ]] && search=$(type -p ${!tuple}-${prog[0]});
  369. [[ -n ${search} ]] && prog[0]=${search##*/};
  370. export ${var}="${prog[*]}";
  371. echo "${!var}"
  372. }
  373. all-flag-vars ()
  374. {
  375. echo {C,CPP,CXX,CCAS,F,FC,LD}FLAGS
  376. }
  377. append-cflags ()
  378. {
  379. [[ $# -eq 0 ]] && return 0;
  380. export CFLAGS+=" $*";
  381. return 0
  382. }
  383. append-cppflags ()
  384. {
  385. [[ $# -eq 0 ]] && return 0;
  386. export CPPFLAGS+=" $*";
  387. return 0
  388. }
  389. append-cxxflags ()
  390. {
  391. [[ $# -eq 0 ]] && return 0;
  392. export CXXFLAGS+=" $*";
  393. return 0
  394. }
  395. append-fflags ()
  396. {
  397. [[ $# -eq 0 ]] && return 0;
  398. export FFLAGS+=" $*";
  399. export FCFLAGS+=" $*";
  400. return 0
  401. }
  402. append-flags ()
  403. {
  404. [[ $# -eq 0 ]] && return 0;
  405. case " $* " in
  406. *' '-[DIU]*)
  407. eqawarn 'please use append-cppflags for preprocessor flags'
  408. ;;
  409. *' '-L* | *' '-Wl,*)
  410. eqawarn 'please use append-ldflags for linker flags'
  411. ;;
  412. esac;
  413. append-cflags "$@";
  414. append-cxxflags "$@";
  415. append-fflags "$@";
  416. return 0
  417. }
  418. append-ldflags ()
  419. {
  420. [[ $# -eq 0 ]] && return 0;
  421. local flag;
  422. for flag in "$@";
  423. do
  424. [[ ${flag} == -l* ]] && eqawarn "Appending a library link instruction (${flag}); libraries to link to should not be passed through LDFLAGS";
  425. done;
  426. export LDFLAGS="${LDFLAGS} $*";
  427. return 0
  428. }
  429. append-lfs-flags ()
  430. {
  431. [[ $# -ne 0 ]] && die "append-lfs-flags takes no arguments";
  432. append-cppflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
  433. }
  434. append-libs ()
  435. {
  436. [[ $# -eq 0 ]] && return 0;
  437. local flag;
  438. for flag in "$@";
  439. do
  440. if [[ -z "${flag// }" ]]; then
  441. eqawarn "Appending an empty argument to LIBS is invalid! Skipping.";
  442. continue;
  443. fi;
  444. case $flag in
  445. -[lL]*)
  446. export LIBS="${LIBS} ${flag}"
  447. ;;
  448. -*)
  449. eqawarn "Appending non-library to LIBS (${flag}); Other linker flags should be passed via LDFLAGS";
  450. export LIBS="${LIBS} ${flag}"
  451. ;;
  452. *)
  453. export LIBS="${LIBS} -l${flag}"
  454. ;;
  455. esac;
  456. done;
  457. return 0
  458. }
  459. built_with_use ()
  460. {
  461. _eutils_eprefix_init;
  462. local hidden="no";
  463. if [[ $1 == "--hidden" ]]; then
  464. hidden="yes";
  465. shift;
  466. fi;
  467. local missing_action="die";
  468. if [[ $1 == "--missing" ]]; then
  469. missing_action=$2;
  470. shift;
  471. shift;
  472. case ${missing_action} in
  473. true | false | die)
  474. ;;
  475. *)
  476. die "unknown action '${missing_action}'"
  477. ;;
  478. esac;
  479. fi;
  480. local opt=$1;
  481. [[ ${opt:0:1} = "-" ]] && shift || opt="-a";
  482. local PKG=$(best_version $1);
  483. [[ -z ${PKG} ]] && die "Unable to resolve $1 to an installed package";
  484. shift;
  485. local USEFILE=${EROOT}/var/db/pkg/${PKG}/USE;
  486. local IUSEFILE=${EROOT}/var/db/pkg/${PKG}/IUSE;
  487. if [[ ! -e ${USEFILE} ]] || [[ ! -e ${IUSEFILE} && ${hidden} == "no" ]]; then
  488. case ${missing_action} in
  489. true)
  490. return 0
  491. ;;
  492. false)
  493. return 1
  494. ;;
  495. die)
  496. die "Unable to determine what USE flags $PKG was built with"
  497. ;;
  498. esac;
  499. fi;
  500. if [[ ${hidden} == "no" ]]; then
  501. local IUSE_BUILT=($(<"${IUSEFILE}"));
  502. local expand;
  503. for expand in $(echo ${USE_EXPAND} | tr '[:upper:]' '[:lower:]');
  504. do
  505. if [[ $1 == ${expand}_* ]]; then
  506. expand="";
  507. break;
  508. fi;
  509. done;
  510. if [[ -n ${expand} ]]; then
  511. if ! has $1 ${IUSE_BUILT[@]#[-+]}; then
  512. case ${missing_action} in
  513. true)
  514. return 0
  515. ;;
  516. false)
  517. return 1
  518. ;;
  519. die)
  520. die "$PKG does not actually support the $1 USE flag!"
  521. ;;
  522. esac;
  523. fi;
  524. fi;
  525. fi;
  526. local USE_BUILT=$(<${USEFILE});
  527. while [[ $# -gt 0 ]]; do
  528. if [[ ${opt} = "-o" ]]; then
  529. has $1 ${USE_BUILT} && return 0;
  530. else
  531. has $1 ${USE_BUILT} || return 1;
  532. fi;
  533. shift;
  534. done;
  535. [[ ${opt} = "-a" ]]
  536. }
  537. check_license ()
  538. {
  539. die "you no longer need this as portage supports ACCEPT_LICENSE itself"
  540. }
  541. clang-fullversion ()
  542. {
  543. _clang_fullversion '$1.$2.$3' "$@"
  544. }
  545. clang-major-version ()
  546. {
  547. _clang_fullversion '$1' "$@"
  548. }
  549. clang-micro-version ()
  550. {
  551. _clang_fullversion '$3' "$@"
  552. }
  553. clang-minor-version ()
  554. {
  555. _clang_fullversion '$2' "$@"
  556. }
  557. clang-version ()
  558. {
  559. _clang_fullversion '$1.$2' "$@"
  560. }
  561. doicon ()
  562. {
  563. _iconins ${FUNCNAME} "$@"
  564. }
  565. domenu ()
  566. {
  567. ( local i j ret=0;
  568. insinto /usr/share/applications;
  569. for i in "$@";
  570. do
  571. if [[ -f ${i} ]]; then
  572. doins "${i}";
  573. ((ret+=$?));
  574. else
  575. if [[ -d ${i} ]]; then
  576. for j in "${i}"/*.desktop;
  577. do
  578. doins "${j}";
  579. ((ret+=$?));
  580. done;
  581. else
  582. ((++ret));
  583. fi;
  584. fi;
  585. done;
  586. exit ${ret} )
  587. }
  588. ebeep ()
  589. {
  590. ewarn "QA Notice: ebeep is not defined in EAPI=${EAPI}, please file a bug at https://bugs.gentoo.org"
  591. }
  592. econf_build ()
  593. {
  594. local CBUILD=${CBUILD:-${CHOST}};
  595. tc-env_build econf --build=${CBUILD} --host=${CBUILD} "$@"
  596. }
  597. ecvs_clean ()
  598. {
  599. [[ $# -eq 0 ]] && set -- .;
  600. find "$@" -type d -name 'CVS' -prune -print0 | xargs -0 rm -rf;
  601. find "$@" -type f -name '.cvs*' -print0 | xargs -0 rm -rf
  602. }
  603. edos2unix ()
  604. {
  605. [[ $# -eq 0 ]] && return 0;
  606. sed -i 's/\r$//' -- "$@" || die
  607. }
  608. egit_clean ()
  609. {
  610. [[ $# -eq 0 ]] && set -- .;
  611. find "$@" -type d -name '.git*' -prune -print0 | xargs -0 rm -rf
  612. }
  613. einstalldocs ()
  614. {
  615. debug-print-function ${FUNCNAME} "${@}";
  616. local dodoc_opts=-r;
  617. has ${EAPI} 0 1 2 3 && dodoc_opts=;
  618. if ! declare -p DOCS &> /dev/null; then
  619. local d;
  620. for d in README* ChangeLog AUTHORS NEWS TODO CHANGES THANKS BUGS FAQ CREDITS CHANGELOG;
  621. do
  622. if [[ -s ${d} ]]; then
  623. dodoc "${d}" || die;
  624. fi;
  625. done;
  626. else
  627. if [[ $(declare -p DOCS) == "declare -a"* ]]; then
  628. if [[ -n ${DOCS[@]} ]]; then
  629. dodoc ${dodoc_opts} "${DOCS[@]}" || die;
  630. fi;
  631. else
  632. if [[ -n ${DOCS} ]]; then
  633. dodoc ${dodoc_opts} ${DOCS} || die;
  634. fi;
  635. fi;
  636. fi;
  637. if [[ $(declare -p HTML_DOCS 2>/dev/null) == "declare -a"* ]]; then
  638. if [[ -n ${HTML_DOCS[@]} ]]; then
  639. dohtml -r "${HTML_DOCS[@]}" || die;
  640. fi;
  641. else
  642. if [[ -n ${HTML_DOCS} ]]; then
  643. dohtml -r ${HTML_DOCS} || die;
  644. fi;
  645. fi;
  646. return 0
  647. }
  648. emktemp ()
  649. {
  650. local exe="touch";
  651. [[ $1 == -d ]] && exe="mkdir" && shift;
  652. local topdir=$1;
  653. if [[ -z ${topdir} ]]; then
  654. [[ -z ${T} ]] && topdir="/tmp" || topdir=${T};
  655. fi;
  656. if ! type -P mktemp > /dev/null; then
  657. local tmp=/;
  658. while [[ -e ${tmp} ]]; do
  659. tmp=${topdir}/tmp.${RANDOM}.${RANDOM}.${RANDOM};
  660. done;
  661. ${exe} "${tmp}" || ${exe} -p "${tmp}";
  662. echo "${tmp}";
  663. else
  664. if [[ ${exe} == "touch" ]]; then
  665. TMPDIR="${topdir}" mktemp -t tmp.XXXXXXXXXX;
  666. else
  667. TMPDIR="${topdir}" mktemp -dt tmp.XXXXXXXXXX;
  668. fi;
  669. fi
  670. }
  671. epatch ()
  672. {
  673. function _epatch_draw_line ()
  674. {
  675. [[ -z $1 ]] && set "$(printf "%65s" '')";
  676. echo "${1//?/=}"
  677. };
  678. unset P4CONFIG P4PORT P4USER;
  679. local EPATCH_OPTS=(${EPATCH_OPTS[*]});
  680. while [[ $# -gt 0 ]]; do
  681. case $1 in
  682. -*)
  683. EPATCH_OPTS+=("$1")
  684. ;;
  685. *)
  686. break
  687. ;;
  688. esac;
  689. shift;
  690. done;
  691. if [[ $# -gt 1 ]]; then
  692. local m;
  693. for m in "$@";
  694. do
  695. epatch "${m}";
  696. done;
  697. return 0;
  698. fi;
  699. local SINGLE_PATCH="no";
  700. [[ $# -eq 0 ]] && set -- "${EPATCH_SOURCE}";
  701. if [[ -f $1 ]]; then
  702. SINGLE_PATCH="yes";
  703. set -- "$1";
  704. local EPATCH_SUFFIX=$1;
  705. else
  706. if [[ -d $1 ]]; then
  707. evar_push_set LC_COLLATE C;
  708. set -- "$1"/*${EPATCH_SUFFIX:+."${EPATCH_SUFFIX}"};
  709. evar_pop;
  710. else
  711. if [[ -f ${EPATCH_SOURCE}/$1 ]]; then
  712. epatch "${EPATCH_SOURCE}/$1";
  713. return $?;
  714. else
  715. [[ $# -ne 0 ]] && EPATCH_SOURCE=$1;
  716. echo;
  717. eerror "Cannot find \$EPATCH_SOURCE! Value for \$EPATCH_SOURCE is:";
  718. eerror;
  719. eerror " ${EPATCH_SOURCE}";
  720. eerror " ( ${EPATCH_SOURCE##*/} )";
  721. echo;
  722. die "Cannot find \$EPATCH_SOURCE!";
  723. fi;
  724. fi;
  725. fi;
  726. EPATCH_OPTS="${EPATCH_COMMON_OPTS} ${EPATCH_OPTS[*]}";
  727. local PIPE_CMD;
  728. case ${EPATCH_SUFFIX##*\.} in
  729. xz)
  730. PIPE_CMD="xz -dc"
  731. ;;
  732. lzma)
  733. PIPE_CMD="lzma -dc"
  734. ;;
  735. bz2)
  736. PIPE_CMD="bzip2 -dc"
  737. ;;
  738. gz | Z | z)
  739. PIPE_CMD="gzip -dc"
  740. ;;
  741. ZIP | zip)
  742. PIPE_CMD="unzip -p"
  743. ;;
  744. *)
  745. ;;
  746. esac;
  747. [[ ${SINGLE_PATCH} == "no" ]] && einfo "${EPATCH_MULTI_MSG}";
  748. local x;
  749. for x in "$@";
  750. do
  751. [[ ! -f ${x} ]] && continue;
  752. local patchname=${x##*/};
  753. local a=${patchname#*_};
  754. a=${a%%_*};
  755. if ! [[ ${SINGLE_PATCH} == "yes" || ${EPATCH_FORCE} == "yes" || ${a} == all || ${a} == ${ARCH} ]]; then
  756. continue;
  757. fi;
  758. if [[ -n ${EPATCH_EXCLUDE}${EPATCH_USER_EXCLUDE} ]]; then
  759. eshopts_push -o noglob;
  760. local ex;
  761. for ex in ${EPATCH_EXCLUDE};
  762. do
  763. if [[ ${patchname} == ${ex} ]]; then
  764. einfo " Skipping ${patchname} due to EPATCH_EXCLUDE ...";
  765. eshopts_pop;
  766. continue 2;
  767. fi;
  768. done;
  769. for ex in ${EPATCH_USER_EXCLUDE};
  770. do
  771. if [[ ${patchname} == ${ex} ]]; then
  772. einfo " Skipping ${patchname} due to EPATCH_USER_EXCLUDE ...";
  773. eshopts_pop;
  774. continue 2;
  775. fi;
  776. done;
  777. eshopts_pop;
  778. fi;
  779. if [[ ${SINGLE_PATCH} == "yes" ]]; then
  780. if [[ -n ${EPATCH_SINGLE_MSG} ]]; then
  781. einfo "${EPATCH_SINGLE_MSG}";
  782. else
  783. einfo "Applying ${patchname} ...";
  784. fi;
  785. else
  786. einfo " ${patchname} ...";
  787. fi;
  788. local patch="patch";
  789. eval $(alias patch 2>/dev/null | sed 's:^alias ::');
  790. local STDERR_TARGET="${T}/${patchname}.out";
  791. if [[ -e ${STDERR_TARGET} ]]; then
  792. STDERR_TARGET="${T}/${patchname}-$$.out";
  793. fi;
  794. printf "***** %s *****\nPWD: %s\nPATCH TOOL: %s -> %s\nVERSION INFO:\n%s\n\n" "${patchname}" "${PWD}" "${patch}" "$(type -P "${patch}")" "$(${patch} --version)" > "${STDERR_TARGET}";
  795. local count=0;
  796. local PATCH_TARGET;
  797. if [[ -n ${PIPE_CMD} ]]; then
  798. PATCH_TARGET="${T}/$$.patch";
  799. echo "PIPE_COMMAND: ${PIPE_CMD} ${x} > ${PATCH_TARGET}" >> "${STDERR_TARGET}";
  800. if ! ( ${PIPE_CMD} "${x}" > "${PATCH_TARGET}" ) >> "${STDERR_TARGET}" 2>&1; then
  801. echo;
  802. eerror "Could not extract patch!";
  803. count=5;
  804. break;
  805. fi;
  806. else
  807. PATCH_TARGET=${x};
  808. fi;
  809. local abs_paths=$(egrep -n '^[-+]{3} /' "${PATCH_TARGET}" | awk '$2 != "/dev/null" { print }');
  810. if [[ -n ${abs_paths} ]]; then
  811. count=1;
  812. printf "NOTE: skipping -p0 due to absolute paths in patch:\n%s\n" "${abs_paths}" >> "${STDERR_TARGET}";
  813. fi;
  814. local rel_paths=$(egrep -n '^[-+]{3} [^ ]*[.][.]/' "${PATCH_TARGET}");
  815. if [[ -n ${rel_paths} ]]; then
  816. echo;
  817. eerror "Rejected Patch: ${patchname} !";
  818. eerror " ( ${PATCH_TARGET} )";
  819. eerror;
  820. eerror "Your patch uses relative paths '../':";
  821. eerror "${rel_paths}";
  822. echo;
  823. die "you need to fix the relative paths in patch";
  824. fi;
  825. local patch_cmd;
  826. while [[ ${count} -lt 5 ]]; do
  827. patch_cmd="${patch} -p${count} ${EPATCH_OPTS}";
  828. ( _epatch_draw_line "***** ${patchname} *****";
  829. echo;
  830. echo "PATCH COMMAND: ${patch_cmd} --dry-run -f < '${PATCH_TARGET}'";
  831. echo;
  832. _epatch_draw_line "***** ${patchname} *****";
  833. ${patch_cmd} --dry-run -f < "${PATCH_TARGET}" 2>&1;
  834. ret=$?;
  835. echo;
  836. echo "patch program exited with status ${ret}";
  837. exit ${ret} ) >> "${STDERR_TARGET}";
  838. if [ $? -eq 0 ]; then
  839. ( _epatch_draw_line "***** ${patchname} *****";
  840. echo;
  841. echo "ACTUALLY APPLYING ${patchname} ...";
  842. echo "PATCH COMMAND: ${patch_cmd} < '${PATCH_TARGET}'";
  843. echo;
  844. _epatch_draw_line "***** ${patchname} *****";
  845. ${patch_cmd} < "${PATCH_TARGET}" 2>&1;
  846. ret=$?;
  847. echo;
  848. echo "patch program exited with status ${ret}";
  849. exit ${ret} ) >> "${STDERR_TARGET}";
  850. if [ $? -ne 0 ]; then
  851. echo;
  852. eerror "A dry-run of patch command succeeded, but actually";
  853. eerror "applying the patch failed!";
  854. count=5;
  855. fi;
  856. break;
  857. fi;
  858. : $(( count++ ));
  859. done;
  860. (( EPATCH_N_APPLIED_PATCHES++ ));
  861. if [[ -n ${PIPE_CMD} ]]; then
  862. rm -f "${PATCH_TARGET}";
  863. fi;
  864. if [[ ${count} -ge 5 ]]; then
  865. echo;
  866. eerror "Failed Patch: ${patchname} !";
  867. eerror " ( ${PATCH_TARGET} )";
  868. eerror;
  869. eerror "Include in your bugreport the contents of:";
  870. eerror;
  871. eerror " ${STDERR_TARGET}";
  872. echo;
  873. die "Failed Patch: ${patchname}!";
  874. fi;
  875. rm -f "${STDERR_TARGET}";
  876. cat >> "${T}/epatch.log" <<-EOF
  877. PATCH: ${x}
  878. CMD: ${patch_cmd}
  879. PWD: ${PWD}
  880. EOF
  881. eend 0;
  882. done;
  883. [[ ${SINGLE_PATCH} == "no" ]] && einfo "Done with patching";
  884. :
  885. }
  886. epatch_user ()
  887. {
  888. [[ $# -ne 0 ]] && die "epatch_user takes no options";
  889. local applied="${T}/epatch_user.log";
  890. [[ -e ${applied} ]] && return 2;
  891. local EPATCH_SOURCE check;
  892. for check in ${CATEGORY}/{${P}-${PR},${P},${PN}}{,:${SLOT%/*}};
  893. do
  894. EPATCH_SOURCE=${EPATCH_USER_SOURCE}/${CTARGET}/${check};
  895. [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${EPATCH_USER_SOURCE}/${CHOST}/${check};
  896. [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${EPATCH_USER_SOURCE}/${check};
  897. if [[ -d ${EPATCH_SOURCE} ]]; then
  898. local old_n_applied_patches=${EPATCH_N_APPLIED_PATCHES:-0};
  899. EPATCH_SOURCE=${EPATCH_SOURCE} EPATCH_SUFFIX="patch" EPATCH_FORCE="yes" EPATCH_MULTI_MSG="Applying user patches from ${EPATCH_SOURCE} ..." epatch;
  900. echo "${EPATCH_SOURCE}" > "${applied}";
  901. if [[ ${old_n_applied_patches} -lt ${EPATCH_N_APPLIED_PATCHES} ]]; then
  902. has epatch_user_death_notice ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS+=" epatch_user_death_notice";
  903. fi;
  904. return 0;
  905. fi;
  906. done;
  907. echo "none" > "${applied}";
  908. return 1
  909. }
  910. epatch_user_death_notice ()
  911. {
  912. ewarn "!!! User patches were applied to this build!"
  913. }
  914. epause ()
  915. {
  916. ewarn "QA Notice: epause is not defined in EAPI=${EAPI}, please file a bug at https://bugs.gentoo.org"
  917. }
  918. epunt_cxx ()
  919. {
  920. local dir=$1;
  921. [[ -z ${dir} ]] && dir=${S};
  922. ebegin "Removing useless C++ checks";
  923. local f p any_found;
  924. while IFS= read -r -d '' f; do
  925. for p in "$(eutils_elt_patch_dir)"/nocxx/*.patch;
  926. do
  927. if patch --no-backup-if-mismatch -p1 "${f}" "${p}" > /dev/null; then
  928. any_found=1;
  929. break;
  930. fi;
  931. done;
  932. done < <(find "${dir}" -name configure -print0);
  933. if [[ -z ${any_found} ]]; then
  934. eqawarn "epunt_cxx called unnecessarily (no C++ checks to punt).";
  935. fi;
  936. eend 0
  937. }
  938. eshopts_pop ()
  939. {
  940. local s;
  941. estack_pop eshopts s || die "${FUNCNAME}: unbalanced push";
  942. if [[ ${s} == "shopt -"* ]]; then
  943. eval "${s}" || die "${FUNCNAME}: sanity: invalid shopt options: ${s}";
  944. else
  945. set +$- || die "${FUNCNAME}: sanity: invalid shell settings: $-";
  946. set -${s} || die "${FUNCNAME}: sanity: unable to restore saved shell settings: ${s}";
  947. fi
  948. }
  949. eshopts_push ()
  950. {
  951. if [[ $1 == -[su] ]]; then
  952. estack_push eshopts "$(shopt -p)";
  953. [[ $# -eq 0 ]] && return 0;
  954. shopt "$@" || die "${FUNCNAME}: bad options to shopt: $*";
  955. else
  956. estack_push eshopts $-;
  957. [[ $# -eq 0 ]] && return 0;
  958. set "$@" || die "${FUNCNAME}: bad options to set: $*";
  959. fi
  960. }
  961. estack_pop ()
  962. {
  963. [[ $# -eq 0 || $# -gt 2 ]] && die "estack_pop: incorrect # of arguments";
  964. local _estack_name="_ESTACK_$1_";
  965. shift;
  966. local _estack_retvar=$1;
  967. shift;
  968. eval local _estack_i=\${#${_estack_name}\[@\]};
  969. [[ $(( --_estack_i )) -eq -1 ]] && return 1;
  970. if [[ -n ${_estack_retvar} ]]; then
  971. eval ${_estack_retvar}=\"\${${_estack_name}\[${_estack_i}\]}\";
  972. fi;
  973. eval unset \"${_estack_name}\[${_estack_i}\]\"
  974. }
  975. estack_push ()
  976. {
  977. [[ $# -eq 0 ]] && die "estack_push: incorrect # of arguments";
  978. local stack_name="_ESTACK_$1_";
  979. shift;
  980. eval ${stack_name}+=\( \"\$@\" \)
  981. }
  982. esvn_clean ()
  983. {
  984. [[ $# -eq 0 ]] && set -- .;
  985. find "$@" -type d -name '.svn' -prune -print0 | xargs -0 rm -rf
  986. }
  987. eumask_pop ()
  988. {
  989. [[ $# -eq 0 ]] || die "${FUNCNAME}: we take no options";
  990. local s;
  991. estack_pop eumask s || die "${FUNCNAME}: unbalanced push";
  992. umask ${s} || die "${FUNCNAME}: sanity: could not restore umask: ${s}"
  993. }
  994. eumask_push ()
  995. {
  996. estack_push eumask "$(umask)";
  997. umask "$@" || die "${FUNCNAME}: bad options to umask: $*"
  998. }
  999. eutils_elt_patch_dir ()
  1000. {
  1001. local d="${ECLASSDIR}/ELT-patches";
  1002. if [[ ! -d ${d} ]]; then
  1003. d="${_EUTILS_ECLASSDIR_LOCAL}/ELT-patches";
  1004. fi;
  1005. echo "${d}"
  1006. }
  1007. evar_pop ()
  1008. {
  1009. local cnt=${1:-bad};
  1010. case $# in
  1011. 0)
  1012. cnt=1
  1013. ;;
  1014. 1)
  1015. isdigit "${cnt}" || die "${FUNCNAME}: first arg must be a number: $*"
  1016. ;;
  1017. *)
  1018. die "${FUNCNAME}: only accepts one arg: $*"
  1019. ;;
  1020. esac;
  1021. local var val;
  1022. while (( cnt-- )); do
  1023. estack_pop evar val || die "${FUNCNAME}: unbalanced push";
  1024. estack_pop evar var || die "${FUNCNAME}: unbalanced push";
  1025. [[ ${val} == "unset_76fc3c462065bb4ca959f939e6793f94" ]] && unset ${var} || printf -v "${var}" '%s' "${val}";
  1026. done
  1027. }
  1028. evar_push ()
  1029. {
  1030. local var val;
  1031. for var in "$@";
  1032. do
  1033. [[ ${!var+set} == "set" ]] && val=${!var} || val="unset_76fc3c462065bb4ca959f939e6793f94";
  1034. estack_push evar "${var}" "${val}";
  1035. done
  1036. }
  1037. evar_push_set ()
  1038. {
  1039. local var=$1;
  1040. evar_push ${var};
  1041. case $# in
  1042. 1)
  1043. unset ${var}
  1044. ;;
  1045. 2)
  1046. printf -v "${var}" '%s' "$2"
  1047. ;;
  1048. *)
  1049. die "${FUNCNAME}: incorrect # of args: $*"
  1050. ;;
  1051. esac
  1052. }
  1053. filter-flags ()
  1054. {
  1055. _filter-hardened "$@";
  1056. local v;
  1057. for v in $(all-flag-vars);
  1058. do
  1059. _filter-var ${v} "$@";
  1060. done;
  1061. return 0
  1062. }
  1063. filter-ldflags ()
  1064. {
  1065. _filter-var LDFLAGS "$@";
  1066. return 0
  1067. }
  1068. filter-lfs-flags ()
  1069. {
  1070. [[ $# -ne 0 ]] && die "filter-lfs-flags takes no arguments";
  1071. filter-flags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
  1072. }
  1073. filter-mfpmath ()
  1074. {
  1075. local orig_mfpmath new_math prune_math;
  1076. orig_mfpmath=$(get-flag -mfpmath);
  1077. new_math=$(get-flag mfpmath);
  1078. new_math=${new_math/both/387,sse};
  1079. new_math=" ${new_math//[,+]/ } ";
  1080. prune_math="";
  1081. for prune_math in "$@";
  1082. do
  1083. new_math=${new_math/ ${prune_math} / };
  1084. done;
  1085. new_math=$(echo ${new_math});
  1086. new_math=${new_math// /,};
  1087. if [[ -z ${new_math} ]]; then
  1088. filter-flags ${orig_mfpmath};
  1089. else
  1090. replace-flags ${orig_mfpmath} -mfpmath=${new_math};
  1091. fi;
  1092. return 0
  1093. }
  1094. gcc-fullversion ()
  1095. {
  1096. _gcc_fullversion '$1.$2.$3' "$@"
  1097. }
  1098. gcc-major-version ()
  1099. {
  1100. _gcc_fullversion '$1' "$@"
  1101. }
  1102. gcc-micro-version ()
  1103. {
  1104. _gcc_fullversion '$3' "$@"
  1105. }
  1106. gcc-minor-version ()
  1107. {
  1108. _gcc_fullversion '$2' "$@"
  1109. }
  1110. gcc-specs-directive ()
  1111. {
  1112. local directive subdname subdirective;
  1113. directive="$(_gcc-specs-directive_raw $1)";
  1114. while [[ ${directive} == *%\(*\)* ]]; do
  1115. subdname=${directive/*%\(};
  1116. subdname=${subdname/\)*};
  1117. subdirective="$(_gcc-specs-directive_raw ${subdname})";
  1118. directive="${directive//\%(${subdname})/${subdirective}}";
  1119. done;
  1120. echo "${directive}";
  1121. return 0
  1122. }
  1123. gcc-specs-nostrict ()
  1124. {
  1125. local directive;
  1126. directive=$(gcc-specs-directive cc1);
  1127. [[ "${directive/\{!fstrict-overflow:}" != "${directive}" ]]
  1128. }
  1129. gcc-specs-now ()
  1130. {
  1131. local directive;
  1132. directive=$(gcc-specs-directive link_command);
  1133. [[ "${directive/\{!nonow:}" != "${directive}" ]]
  1134. }
  1135. gcc-specs-pie ()
  1136. {
  1137. local directive;
  1138. directive=$(gcc-specs-directive cc1);
  1139. [[ "${directive/\{!nopie:}" != "${directive}" ]]
  1140. }
  1141. gcc-specs-relro ()
  1142. {
  1143. local directive;
  1144. directive=$(gcc-specs-directive link_command);
  1145. [[ "${directive/\{!norelro:}" != "${directive}" ]]
  1146. }
  1147. gcc-specs-ssp ()
  1148. {
  1149. local directive;
  1150. directive=$(gcc-specs-directive cc1);
  1151. [[ "${directive/\{!fno-stack-protector:}" != "${directive}" ]]
  1152. }
  1153. gcc-specs-ssp-to-all ()
  1154. {
  1155. local directive;
  1156. directive=$(gcc-specs-directive cc1);
  1157. [[ "${directive/\{!fno-stack-protector-all:}" != "${directive}" ]]
  1158. }
  1159. gcc-specs-stack-check ()
  1160. {
  1161. local directive;
  1162. directive=$(gcc-specs-directive cc1);
  1163. [[ "${directive/\{!fno-stack-check:}" != "${directive}" ]]
  1164. }
  1165. gcc-version ()
  1166. {
  1167. _gcc_fullversion '$1.$2' "$@"
  1168. }
  1169. gen_usr_ldscript ()
  1170. {
  1171. local lib libdir=$(get_libdir) output_format="" auto=false suffix=$(get_libname);
  1172. [[ -z ${ED+set} ]] && local ED=${D%/}${EPREFIX}/;
  1173. tc-is-static-only && return;
  1174. if [[ $(type -t multilib_is_native_abi) == "function" ]]; then
  1175. multilib_is_native_abi || return 0;
  1176. fi;
  1177. case ${CTARGET:-${CHOST}} in
  1178. *-darwin*)
  1179. ;;
  1180. *-android*)
  1181. return 0
  1182. ;;
  1183. *linux* | *-freebsd* | *-openbsd* | *-netbsd*)
  1184. use prefix && return 0
  1185. ;;
  1186. *)
  1187. return 0
  1188. ;;
  1189. esac;
  1190. dodir /usr/${libdir};
  1191. if [[ $1 == "-a" ]]; then
  1192. auto=true;
  1193. shift;
  1194. dodir /${libdir};
  1195. fi;
  1196. local flags=(${CFLAGS} ${LDFLAGS} -Wl,--verbose);
  1197. if $(tc-getLD) --version | grep -q 'GNU gold'; then
  1198. local d="${T}/bfd-linker";
  1199. mkdir -p "${d}";
  1200. ln -sf $(which ${CHOST}-ld.bfd) "${d}"/ld;
  1201. flags+=(-B"${d}");
  1202. fi;
  1203. output_format=$($(tc-getCC) "${flags[@]}" 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p');
  1204. [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )";
  1205. for lib in "$@";
  1206. do
  1207. local tlib;
  1208. if ${auto}; then
  1209. lib="lib${lib}${suffix}";
  1210. else
  1211. [[ -r ${ED}/${libdir}/${lib} ]] || continue;
  1212. fi;
  1213. case ${CTARGET:-${CHOST}} in
  1214. *-darwin*)
  1215. if ${auto}; then
  1216. tlib=$(scanmacho -qF'%S#F' "${ED}"/usr/${libdir}/${lib});
  1217. else
  1218. tlib=$(scanmacho -qF'%S#F' "${ED}"/${libdir}/${lib});
  1219. fi;
  1220. [[ -z ${tlib} ]] && die "unable to read install_name from ${lib}";
  1221. tlib=${tlib##*/};
  1222. if ${auto}; then
  1223. mv "${ED}"/usr/${libdir}/${lib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die;
  1224. if [[ ${tlib} != ${lib%${suffix}}.*${suffix#.} ]]; then
  1225. mv "${ED}"/usr/${libdir}/${tlib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die;
  1226. fi;
  1227. rm -f "${ED}"/${libdir}/${lib};
  1228. fi;
  1229. if [[ ! -w "${ED}/${libdir}/${tlib}" ]]; then
  1230. chmod u+w "${ED}${libdir}/${tlib}";
  1231. local nowrite=yes;
  1232. fi;
  1233. install_name_tool -id "${EPREFIX}"/${libdir}/${tlib} "${ED}"/${libdir}/${tlib} || die "install_name_tool failed";
  1234. [[ -n ${nowrite} ]] && chmod u-w "${ED}${libdir}/${tlib}";
  1235. pushd "${ED}/usr/${libdir}" > /dev/null;
  1236. ln -snf "../../${libdir}/${tlib}" "${lib}";
  1237. popd > /dev/null
  1238. ;;
  1239. *)
  1240. if ${auto}; then
  1241. tlib=$(scanelf -qF'%S#F' "${ED}"/usr/${libdir}/${lib});
  1242. [[ -z ${tlib} ]] && die "unable to read SONAME from ${lib}";
  1243. mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die;
  1244. if [[ ${tlib} != ${lib}* ]]; then
  1245. mv "${ED}"/usr/${libdir}/${tlib}* "${ED}"/${libdir}/ || die;
  1246. fi;
  1247. rm -f "${ED}"/${libdir}/${lib};
  1248. else
  1249. tlib=${lib};
  1250. fi;
  1251. cat > "${ED}/usr/${libdir}/${lib}" <<-END_LDSCRIPT
  1252. /* GNU ld script
  1253. Since Gentoo has critical dynamic libraries in /lib, and the static versions
  1254. in /usr/lib, we need to have a "fake" dynamic lib in /usr/lib, otherwise we
  1255. run into linking problems. This "fake" dynamic lib is a linker script that
  1256. redirects the linker to the real lib. And yes, this works in the cross-
  1257. compiling scenario as the sysroot-ed linker will prepend the real path.
  1258. See bug https://bugs.gentoo.org/4411 for more info.
  1259. */
  1260. ${output_format}
  1261. GROUP ( ${EPREFIX}/${libdir}/${tlib} )
  1262. END_LDSCRIPT
  1263. ;;
  1264. esac
  1265. fperms a+x "/usr/${libdir}/${lib}" || die "could not change perms on ${lib}";
  1266. done
  1267. }
  1268. get-flag ()
  1269. {
  1270. local f var findflag="$1";
  1271. for var in $(all-flag-vars);
  1272. do
  1273. for f in ${!var};
  1274. do
  1275. if [ "${f/${findflag}}" != "${f}" ]; then
  1276. printf "%s\n" "${f/-${findflag}=}";
  1277. return 0;
  1278. fi;
  1279. done;
  1280. done;
  1281. return 1
  1282. }
  1283. get_abi_CFLAGS ()
  1284. {
  1285. get_abi_var CFLAGS "$@"
  1286. }
  1287. get_abi_CHOST ()
  1288. {
  1289. get_abi_var CHOST "$@"
  1290. }
  1291. get_abi_CTARGET ()
  1292. {
  1293. get_abi_var CTARGET "$@"
  1294. }
  1295. get_abi_FAKE_TARGETS ()
  1296. {
  1297. get_abi_var FAKE_TARGETS "$@"
  1298. }
  1299. get_abi_LDFLAGS ()
  1300. {
  1301. get_abi_var LDFLAGS "$@"
  1302. }
  1303. get_abi_LIBDIR ()
  1304. {
  1305. get_abi_var LIBDIR "$@"
  1306. }
  1307. get_abi_var ()
  1308. {
  1309. local flag=$1;
  1310. local abi=${2:-${ABI:-${DEFAULT_ABI:-default}}};
  1311. local var="${flag}_${abi}";
  1312. echo ${!var}
  1313. }
  1314. get_all_abis ()
  1315. {
  1316. local x order="" mvar dvar;
  1317. mvar="MULTILIB_ABIS";
  1318. dvar="DEFAULT_ABI";
  1319. if [[ -n $1 ]]; then
  1320. mvar="$1_${mvar}";
  1321. dvar="$1_${dvar}";
  1322. fi;
  1323. if [[ -z ${!mvar} ]]; then
  1324. echo "default";
  1325. return 0;
  1326. fi;
  1327. for x in ${!mvar};
  1328. do
  1329. if [[ ${x} != ${!dvar} ]]; then
  1330. order="${order:+${order} }${x}";
  1331. fi;
  1332. done;
  1333. order="${order:+${order} }${!dvar}";
  1334. echo ${order};
  1335. return 0
  1336. }
  1337. get_all_libdirs ()
  1338. {
  1339. local libdirs abi;
  1340. for abi in ${MULTILIB_ABIS};
  1341. do
  1342. libdirs+=" $(get_abi_LIBDIR ${abi})";
  1343. done;
  1344. [[ " ${libdirs} " != *" lib "* ]] && libdirs+=" lib";
  1345. echo "${libdirs}"
  1346. }
  1347. get_exeext ()
  1348. {
  1349. case ${CHOST} in
  1350. *-cygwin* | mingw* | *-mingw*)
  1351. echo ".exe"
  1352. ;;
  1353. esac
  1354. }
  1355. get_install_abis ()
  1356. {
  1357. local x order="";
  1358. if [[ -z ${MULTILIB_ABIS} ]]; then
  1359. echo "default";
  1360. return 0;
  1361. fi;
  1362. if [[ ${EMULTILIB_PKG} == "true" ]]; then
  1363. for x in ${MULTILIB_ABIS};
  1364. do
  1365. if [[ ${x} != "${DEFAULT_ABI}" ]]; then
  1366. has ${x} ${ABI_DENY} || order="${order} ${x}";
  1367. fi;
  1368. done;
  1369. has ${DEFAULT_ABI} ${ABI_DENY} || order="${order} ${DEFAULT_ABI}";
  1370. if [[ -n ${ABI_ALLOW} ]]; then
  1371. local ordera="";
  1372. for x in ${order};
  1373. do
  1374. if has ${x} ${ABI_ALLOW}; then
  1375. ordera="${ordera} ${x}";
  1376. fi;
  1377. done;
  1378. order=${ordera};
  1379. fi;
  1380. else
  1381. order=${DEFAULT_ABI};
  1382. fi;
  1383. if [[ -z ${order} ]]; then
  1384. 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.";
  1385. fi;
  1386. echo ${order};
  1387. return 0
  1388. }
  1389. get_libdir ()
  1390. {
  1391. local CONF_LIBDIR;
  1392. if [ -n "${CONF_LIBDIR_OVERRIDE}" ]; then
  1393. echo ${CONF_LIBDIR_OVERRIDE};
  1394. else
  1395. get_abi_LIBDIR;
  1396. fi
  1397. }
  1398. get_libname ()
  1399. {
  1400. local libname;
  1401. local ver=$1;
  1402. case ${CHOST} in
  1403. *-cygwin*)
  1404. libname="dll.a"
  1405. ;;
  1406. mingw* | *-mingw*)
  1407. libname="dll"
  1408. ;;
  1409. *-darwin*)
  1410. libname="dylib"
  1411. ;;
  1412. *-mint*)
  1413. libname="irrelevant"
  1414. ;;
  1415. hppa*-hpux*)
  1416. libname="sl"
  1417. ;;
  1418. *)
  1419. libname="so"
  1420. ;;
  1421. esac;
  1422. if [[ -z $* ]]; then
  1423. echo ".${libname}";
  1424. else
  1425. for ver in "$@";
  1426. do
  1427. case ${CHOST} in
  1428. *-cygwin*)
  1429. echo ".${ver}.${libname}"
  1430. ;;
  1431. *-darwin*)
  1432. echo ".${ver}.${libname}"
  1433. ;;
  1434. *-mint*)
  1435. echo ".${libname}"
  1436. ;;
  1437. *)
  1438. echo ".${libname}.${ver}"
  1439. ;;
  1440. esac;
  1441. done;
  1442. fi
  1443. }
  1444. get_modname ()
  1445. {
  1446. local modname;
  1447. local ver=$1;
  1448. case ${CHOST} in
  1449. *-darwin*)
  1450. modname="bundle"
  1451. ;;
  1452. *)
  1453. modname="so"
  1454. ;;
  1455. esac;
  1456. echo ".${modname}"
  1457. }
  1458. has_m32 ()
  1459. {
  1460. die "${FUNCNAME}: don't use this anymore"
  1461. }
  1462. has_m64 ()
  1463. {
  1464. eqawarn "${FUNCNAME}: don't use this anymore";
  1465. local temp="$(emktemp)";
  1466. echo "int main() { return(0); }" > "${temp}".c;
  1467. MY_CC=$(tc-getCC);
  1468. ${MY_CC/ .*/} -m64 -o "$(emktemp)" "${temp}".c > /dev/null 2>&1;
  1469. local ret=$?;
  1470. rm -f "${temp}".c;
  1471. [[ ${ret} != 1 ]] && return 0;
  1472. return 1
  1473. }
  1474. has_multilib_profile ()
  1475. {
  1476. [ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ]
  1477. }
  1478. in_iuse ()
  1479. {
  1480. debug-print-function ${FUNCNAME} "${@}";
  1481. [[ ${#} -eq 1 ]] || die "Invalid args to ${FUNCNAME}()";
  1482. local flag=${1};
  1483. local liuse=(${IUSE});
  1484. has "${flag}" "${liuse[@]#[+-]}"
  1485. }
  1486. is-flag ()
  1487. {
  1488. is-flagq "$@" && echo true
  1489. }
  1490. is-flagq ()
  1491. {
  1492. [[ -n $2 ]] && die "Usage: is-flag <flag>";
  1493. local var;
  1494. for var in $(all-flag-vars);
  1495. do
  1496. _is_flagq ${var} "$1" && return 0;
  1497. done;
  1498. return 1
  1499. }
  1500. is-ldflag ()
  1501. {
  1502. is-ldflagq "$@" && echo true
  1503. }
  1504. is-ldflagq ()
  1505. {
  1506. [[ -n $2 ]] && die "Usage: is-ldflag <flag>";
  1507. _is_flagq LDFLAGS $1
  1508. }
  1509. is_final_abi ()
  1510. {
  1511. has_multilib_profile || return 0;
  1512. set -- $(get_install_abis);
  1513. local LAST_ABI=$#;
  1514. [[ ${!LAST_ABI} == ${ABI} ]]
  1515. }
  1516. isdigit ()
  1517. {
  1518. local d;
  1519. for d in "$@";
  1520. do
  1521. [[ ${d:-bad} == *[!0-9]* ]] && return 1;
  1522. done;
  1523. return 0
  1524. }
  1525. make_desktop_entry ()
  1526. {
  1527. [[ -z $1 ]] && die "make_desktop_entry: You must specify the executable";
  1528. local exec=${1};
  1529. local name=${2:-${PN}};
  1530. local icon=${3:-${PN}};
  1531. local type=${4};
  1532. local fields=${5};
  1533. if [[ -z ${type} ]]; then
  1534. local catmaj=${CATEGORY%%-*};
  1535. local catmin=${CATEGORY##*-};
  1536. case ${catmaj} in
  1537. app)
  1538. case ${catmin} in
  1539. accessibility)
  1540. type="Utility;Accessibility"
  1541. ;;
  1542. admin)
  1543. type=System
  1544. ;;
  1545. antivirus)
  1546. type=System
  1547. ;;
  1548. arch)
  1549. type="Utility;Archiving"
  1550. ;;
  1551. backup)
  1552. type="Utility;Archiving"
  1553. ;;
  1554. cdr)
  1555. type="AudioVideo;DiscBurning"
  1556. ;;
  1557. dicts)
  1558. type="Office;Dictionary"
  1559. ;;
  1560. doc)
  1561. type=Documentation
  1562. ;;
  1563. editors)
  1564. type="Utility;TextEditor"
  1565. ;;
  1566. emacs)
  1567. type="Development;TextEditor"
  1568. ;;
  1569. emulation)
  1570. type="System;Emulator"
  1571. ;;
  1572. laptop)
  1573. type="Settings;HardwareSettings"
  1574. ;;
  1575. office)
  1576. type=Office
  1577. ;;
  1578. pda)
  1579. type="Office;PDA"
  1580. ;;
  1581. vim)
  1582. type="Development;TextEditor"
  1583. ;;
  1584. xemacs)
  1585. type="Development;TextEditor"
  1586. ;;
  1587. esac
  1588. ;;
  1589. dev)
  1590. type="Development"
  1591. ;;
  1592. games)
  1593. case ${catmin} in
  1594. action | fps)
  1595. type=ActionGame
  1596. ;;
  1597. arcade)
  1598. type=ArcadeGame
  1599. ;;
  1600. board)
  1601. type=BoardGame
  1602. ;;
  1603. emulation)
  1604. type=Emulator
  1605. ;;
  1606. kids)
  1607. type=KidsGame
  1608. ;;
  1609. puzzle)
  1610. type=LogicGame
  1611. ;;
  1612. roguelike)
  1613. type=RolePlaying
  1614. ;;
  1615. rpg)
  1616. type=RolePlaying
  1617. ;;
  1618. simulation)
  1619. type=Simulation
  1620. ;;
  1621. sports)
  1622. type=SportsGame
  1623. ;;
  1624. strategy)
  1625. type=StrategyGame
  1626. ;;
  1627. esac;
  1628. type="Game;${type}"
  1629. ;;
  1630. gnome)
  1631. type="Gnome;GTK"
  1632. ;;
  1633. kde)
  1634. type="KDE;Qt"
  1635. ;;
  1636. mail)
  1637. type="Network;Email"
  1638. ;;
  1639. media)
  1640. case ${catmin} in
  1641. gfx)
  1642. type=Graphics
  1643. ;;
  1644. *)
  1645. case ${catmin} in
  1646. radio)
  1647. type=Tuner
  1648. ;;
  1649. sound)
  1650. type=Audio
  1651. ;;
  1652. tv)
  1653. type=TV
  1654. ;;
  1655. video)
  1656. type=Video
  1657. ;;
  1658. esac;
  1659. type="AudioVideo;${type}"
  1660. ;;
  1661. esac
  1662. ;;
  1663. net)
  1664. case ${catmin} in
  1665. dialup)
  1666. type=Dialup
  1667. ;;
  1668. ftp)
  1669. type=FileTransfer
  1670. ;;
  1671. im)
  1672. type=InstantMessaging
  1673. ;;
  1674. irc)
  1675. type=IRCClient
  1676. ;;
  1677. mail)
  1678. type=Email
  1679. ;;
  1680. news)
  1681. type=News
  1682. ;;
  1683. nntp)
  1684. type=News
  1685. ;;
  1686. p2p)
  1687. type=FileTransfer
  1688. ;;
  1689. voip)
  1690. type=Telephony
  1691. ;;
  1692. esac;
  1693. type="Network;${type}"
  1694. ;;
  1695. sci)
  1696. case ${catmin} in
  1697. astro*)
  1698. type=Astronomy
  1699. ;;
  1700. bio*)
  1701. type=Biology
  1702. ;;
  1703. calc*)
  1704. type=Calculator
  1705. ;;
  1706. chem*)
  1707. type=Chemistry
  1708. ;;
  1709. elec*)
  1710. type=Electronics
  1711. ;;
  1712. geo*)
  1713. type=Geology
  1714. ;;
  1715. math*)
  1716. type=Math
  1717. ;;
  1718. physics)
  1719. type=Physics
  1720. ;;
  1721. visual*)
  1722. type=DataVisualization
  1723. ;;
  1724. esac;
  1725. type="Education;Science;${type}"
  1726. ;;
  1727. sys)
  1728. type="System"
  1729. ;;
  1730. www)
  1731. case ${catmin} in
  1732. client)
  1733. type=WebBrowser
  1734. ;;
  1735. esac;
  1736. type="Network;${type}"
  1737. ;;
  1738. *)
  1739. type=
  1740. ;;
  1741. esac;
  1742. fi;
  1743. local slot=${SLOT%/*};
  1744. if [[ ${slot} == "0" ]]; then
  1745. local desktop_name="${PN}";
  1746. else
  1747. local desktop_name="${PN}-${slot}";
  1748. fi;
  1749. local desktop="${T}/$(echo ${exec} | sed 's:[[:space:]/:]:_:g')-${desktop_name}.desktop";
  1750. type=${type%;}${type:+;};
  1751. eshopts_push -s extglob;
  1752. if [[ -n ${icon} && ${icon} != /* ]] && [[ ${icon} == *.xpm || ${icon} == *.png || ${icon} == *.svg ]]; then
  1753. ewarn "As described in the Icon Theme Specification, icon file extensions are not";
  1754. ewarn "allowed in .desktop files if the value is not an absolute path.";
  1755. icon=${icon%.@(xpm|png|svg)};
  1756. fi;
  1757. eshopts_pop;
  1758. cat > "${desktop}" <<-EOF
  1759. [Desktop Entry]
  1760. Name=${name}
  1761. Type=Application
  1762. Comment=${DESCRIPTION}
  1763. Exec=${exec}
  1764. TryExec=${exec%% *}
  1765. Icon=${icon}
  1766. Categories=${type}
  1767. EOF
  1768. if [[ ${fields:-=} != *=* ]]; then
  1769. ewarn "make_desktop_entry: update your 5th arg to read Path=${fields}";
  1770. fields="Path=${fields}";
  1771. fi;
  1772. [[ -n ${fields} ]] && printf '%b\n' "${fields}" >> "${desktop}";
  1773. ( insinto /usr/share/applications;
  1774. doins "${desktop}" ) || die "installing desktop file failed"
  1775. }
  1776. make_session_desktop ()
  1777. {
  1778. [[ -z $1 ]] && eerror "$0: You must specify the title" && return 1;
  1779. [[ -z $2 ]] && eerror "$0: You must specify the command" && return 1;
  1780. local title=$1;
  1781. local command=$2;
  1782. local desktop=${T}/${wm:-${PN}}.desktop;
  1783. shift 2;
  1784. cat > "${desktop}" <<-EOF
  1785. [Desktop Entry]
  1786. Name=${title}
  1787. Comment=This session logs you into ${title}
  1788. Exec=${command} $*
  1789. TryExec=${command}
  1790. Type=XSession
  1791. EOF
  1792. ( insinto /usr/share/xsessions;
  1793. doins "${desktop}" )
  1794. }
  1795. make_wrapper ()
  1796. {
  1797. _eutils_eprefix_init;
  1798. local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5;
  1799. local tmpwrapper=$(emktemp);
  1800. ( echo '#!/bin/sh';
  1801. [[ -n ${chdir} ]] && printf 'cd "%s"\n' "${EPREFIX}${chdir}";
  1802. if [[ -n ${libdir} ]]; then
  1803. local var;
  1804. if [[ ${CHOST} == *-darwin* ]]; then
  1805. var=DYLD_LIBRARY_PATH;
  1806. else
  1807. var=LD_LIBRARY_PATH;
  1808. fi;
  1809. cat <<-EOF
  1810. if [ "\${${var}+set}" = "set" ] ; then
  1811. export ${var}="\${${var}}:${EPREFIX}${libdir}"
  1812. else
  1813. export ${var}="${EPREFIX}${libdir}"
  1814. fi
  1815. EOF
  1816. fi
  1817. printf 'exec %s "$@"\n' "${bin/#\//${EPREFIX}/}" ) > "${tmpwrapper}";
  1818. chmod go+rx "${tmpwrapper}";
  1819. if [[ -n ${path} ]]; then
  1820. ( exeinto "${path}";
  1821. newexe "${tmpwrapper}" "${wrapper}" ) || die;
  1822. else
  1823. newbin "${tmpwrapper}" "${wrapper}" || die;
  1824. fi
  1825. }
  1826. multilib_env ()
  1827. {
  1828. local CTARGET=${1:-${CTARGET}};
  1829. local cpu=${CTARGET%%*-};
  1830. case ${cpu} in
  1831. aarch64*)
  1832. export CFLAGS_arm=${CFLAGS_arm-};
  1833. case ${cpu} in
  1834. aarch64*be)
  1835. export CHOST_arm="armv8b-${CTARGET#*-}"
  1836. ;;
  1837. *)
  1838. export CHOST_arm="armv8l-${CTARGET#*-}"
  1839. ;;
  1840. esac;
  1841. CHOST_arm=${CHOST_arm/%-gnu/-gnueabi};
  1842. export CTARGET_arm=${CHOST_arm};
  1843. export LIBDIR_arm="lib";
  1844. export CFLAGS_arm64=${CFLAGS_arm64-};
  1845. export CHOST_arm64=${CTARGET};
  1846. export CTARGET_arm64=${CHOST_arm64};
  1847. export LIBDIR_arm64="lib64";
  1848. : ${MULTILIB_ABIS=arm64};
  1849. : ${DEFAULT_ABI=arm64}
  1850. ;;
  1851. x86_64*)
  1852. export CFLAGS_x86=${CFLAGS_x86--m32};
  1853. export CHOST_x86=${CTARGET/x86_64/i686};
  1854. CHOST_x86=${CHOST_x86/%-gnux32/-gnu};
  1855. export CTARGET_x86=${CHOST_x86};
  1856. if [[ ${SYMLINK_LIB} == "yes" ]]; then
  1857. export LIBDIR_x86="lib32";
  1858. else
  1859. export LIBDIR_x86="lib";
  1860. fi;
  1861. export CFLAGS_amd64=${CFLAGS_amd64--m64};
  1862. export CHOST_amd64=${CTARGET/%-gnux32/-gnu};
  1863. export CTARGET_amd64=${CHOST_amd64};
  1864. export LIBDIR_amd64="lib64";
  1865. export CFLAGS_x32=${CFLAGS_x32--mx32};
  1866. export CHOST_x32=${CTARGET/%-gnu/-gnux32};
  1867. export CTARGET_x32=${CHOST_x32};
  1868. export LIBDIR_x32="libx32";
  1869. case ${CTARGET} in
  1870. *-gnux32)
  1871. : ${MULTILIB_ABIS=x32 amd64 x86};
  1872. : ${DEFAULT_ABI=x32}
  1873. ;;
  1874. *)
  1875. : ${MULTILIB_ABIS=amd64 x86};
  1876. : ${DEFAULT_ABI=amd64}
  1877. ;;
  1878. esac
  1879. ;;
  1880. mips64*)
  1881. export CFLAGS_o32=${CFLAGS_o32--mabi=32};
  1882. export CHOST_o32=${CTARGET/mips64/mips};
  1883. export CTARGET_o32=${CHOST_o32};
  1884. export LIBDIR_o32="lib";
  1885. export CFLAGS_n32=${CFLAGS_n32--mabi=n32};
  1886. export CHOST_n32=${CTARGET};
  1887. export CTARGET_n32=${CHOST_n32};
  1888. export LIBDIR_n32="lib32";
  1889. export CFLAGS_n64=${CFLAGS_n64--mabi=64};
  1890. export CHOST_n64=${CTARGET};
  1891. export CTARGET_n64=${CHOST_n64};
  1892. export LIBDIR_n64="lib64";
  1893. : ${MULTILIB_ABIS=n64 n32 o32};
  1894. : ${DEFAULT_ABI=n32}
  1895. ;;
  1896. powerpc64*)
  1897. export CFLAGS_ppc=${CFLAGS_ppc--m32};
  1898. export CHOST_ppc=${CTARGET/powerpc64/powerpc};
  1899. export CTARGET_ppc=${CHOST_ppc};
  1900. export LIBDIR_ppc="lib";
  1901. export CFLAGS_ppc64=${CFLAGS_ppc64--m64};
  1902. export CHOST_ppc64=${CTARGET};
  1903. export CTARGET_ppc64=${CHOST_ppc64};
  1904. export LIBDIR_ppc64="lib64";
  1905. : ${MULTILIB_ABIS=ppc64 ppc};
  1906. : ${DEFAULT_ABI=ppc64}
  1907. ;;
  1908. s390x*)
  1909. export CFLAGS_s390=${CFLAGS_s390--m31};
  1910. export CHOST_s390=${CTARGET/s390x/s390};
  1911. export CTARGET_s390=${CHOST_s390};
  1912. export LIBDIR_s390="lib";
  1913. export CFLAGS_s390x=${CFLAGS_s390x--m64};
  1914. export CHOST_s390x=${CTARGET};
  1915. export CTARGET_s390x=${CHOST_s390x};
  1916. export LIBDIR_s390x="lib64";
  1917. : ${MULTILIB_ABIS=s390x s390};
  1918. : ${DEFAULT_ABI=s390x}
  1919. ;;
  1920. sparc64*)
  1921. export CFLAGS_sparc32=${CFLAGS_sparc32--m32};
  1922. export CHOST_sparc32=${CTARGET/sparc64/sparc};
  1923. export CTARGET_sparc32=${CHOST_sparc32};
  1924. export LIBDIR_sparc32="lib";
  1925. export CFLAGS_sparc64=${CFLAGS_sparc64--m64};
  1926. export CHOST_sparc64=${CTARGET};
  1927. export CTARGET_sparc64=${CHOST_sparc64};
  1928. export LIBDIR_sparc64="lib64";
  1929. : ${MULTILIB_ABIS=sparc64 sparc32};
  1930. : ${DEFAULT_ABI=sparc64}
  1931. ;;
  1932. *)
  1933. : ${MULTILIB_ABIS=default};
  1934. : ${DEFAULT_ABI=default}
  1935. ;;
  1936. esac;
  1937. export MULTILIB_ABIS DEFAULT_ABI
  1938. }
  1939. multilib_toolchain_setup ()
  1940. {
  1941. local v vv;
  1942. export ABI=$1;
  1943. if [[ ${_DEFAULT_ABI_SAVED} == "true" ]]; then
  1944. for v in CHOST CBUILD AS CC CXX F77 FC LD PKG_CONFIG_{LIBDIR,PATH};
  1945. do
  1946. vv="_abi_saved_${v}";
  1947. [[ ${!vv+set} == "set" ]] && export ${v}="${!vv}" || unset ${v};
  1948. unset ${vv};
  1949. done;
  1950. unset _DEFAULT_ABI_SAVED;
  1951. fi;
  1952. if [[ ${ABI} != ${DEFAULT_ABI} ]]; then
  1953. for v in CHOST CBUILD AS CC CXX F77 FC LD PKG_CONFIG_{LIBDIR,PATH};
  1954. do
  1955. vv="_abi_saved_${v}";
  1956. [[ ${!v+set} == "set" ]] && export ${vv}="${!v}" || unset ${vv};
  1957. done;
  1958. export _DEFAULT_ABI_SAVED="true";
  1959. export CHOST=$(get_abi_CHOST ${DEFAULT_ABI});
  1960. export CC="$(tc-getCC) $(get_abi_CFLAGS)";
  1961. export CXX="$(tc-getCXX) $(get_abi_CFLAGS)";
  1962. export F77="$(tc-getF77) $(get_abi_CFLAGS)";
  1963. export FC="$(tc-getFC) $(get_abi_CFLAGS)";
  1964. export LD="$(tc-getLD) $(get_abi_LDFLAGS)";
  1965. export CHOST=$(get_abi_CHOST $1);
  1966. export CBUILD=$(get_abi_CHOST $1);
  1967. export PKG_CONFIG_LIBDIR=${EPREFIX}/usr/$(get_libdir)/pkgconfig;
  1968. export PKG_CONFIG_PATH=${EPREFIX}/usr/share/pkgconfig;
  1969. fi
  1970. }
  1971. newicon ()
  1972. {
  1973. _iconins ${FUNCNAME} "$@"
  1974. }
  1975. newmenu ()
  1976. {
  1977. ( insinto /usr/share/applications;
  1978. newins "$@" )
  1979. }
  1980. no-as-needed ()
  1981. {
  1982. case $($(tc-getLD) -v 2>&1 </dev/null) in
  1983. *GNU*)
  1984. echo "-Wl,--no-as-needed"
  1985. ;;
  1986. esac
  1987. }
  1988. number_abis ()
  1989. {
  1990. set -- `get_install_abis`;
  1991. echo $#
  1992. }
  1993. optfeature ()
  1994. {
  1995. debug-print-function ${FUNCNAME} "$@";
  1996. local i j msg;
  1997. local desc=$1;
  1998. local flag=0;
  1999. shift;
  2000. for i in "$@";
  2001. do
  2002. for j in ${i};
  2003. do
  2004. if has_version "${j}"; then
  2005. flag=1;
  2006. else
  2007. flag=0;
  2008. break;
  2009. fi;
  2010. done;
  2011. if [[ ${flag} -eq 1 ]]; then
  2012. break;
  2013. fi;
  2014. done;
  2015. if [[ ${flag} -eq 0 ]]; then
  2016. for i in "$@";
  2017. do
  2018. msg=" ";
  2019. for j in ${i};
  2020. do
  2021. msg+=" ${j} and";
  2022. done;
  2023. msg="${msg:0: -4} for ${desc}";
  2024. elog "${msg}";
  2025. done;
  2026. fi
  2027. }
  2028. path_exists ()
  2029. {
  2030. local opt=$1;
  2031. [[ ${opt} == -[ao] ]] && shift || opt="-a";
  2032. [[ $# -eq 0 ]] && return 1;
  2033. local p r=0;
  2034. for p in "$@";
  2035. do
  2036. [[ -e ${p} ]];
  2037. : $(( r += $? ));
  2038. done;
  2039. case ${opt} in
  2040. -a)
  2041. return $(( r != 0 ))
  2042. ;;
  2043. -o)
  2044. return $(( r == $# ))
  2045. ;;
  2046. esac
  2047. }
  2048. pkg_nofetch ()
  2049. {
  2050. default
  2051. }
  2052. preserve_old_lib ()
  2053. {
  2054. _eutils_eprefix_init;
  2055. if [[ ${EBUILD_PHASE} != "preinst" ]]; then
  2056. eerror "preserve_old_lib() must be called from pkg_preinst() only";
  2057. die "Invalid preserve_old_lib() usage";
  2058. fi;
  2059. [[ -z $1 ]] && die "Usage: preserve_old_lib <library to preserve> [more libraries to preserve]";
  2060. has preserve-libs ${FEATURES} && return 0;
  2061. local lib dir;
  2062. for lib in "$@";
  2063. do
  2064. [[ -e ${EROOT}/${lib} ]] || continue;
  2065. dir=${lib%/*};
  2066. dodir ${dir} || die "dodir ${dir} failed";
  2067. cp "${EROOT}"/${lib} "${ED}"/${lib} || die "cp ${lib} failed";
  2068. touch "${ED}"/${lib};
  2069. done
  2070. }
  2071. preserve_old_lib_notify ()
  2072. {
  2073. if [[ ${EBUILD_PHASE} != "postinst" ]]; then
  2074. eerror "preserve_old_lib_notify() must be called from pkg_postinst() only";
  2075. die "Invalid preserve_old_lib_notify() usage";
  2076. fi;
  2077. has preserve-libs ${FEATURES} && return 0;
  2078. _eutils_eprefix_init;
  2079. local lib notice=0;
  2080. for lib in "$@";
  2081. do
  2082. [[ -e ${EROOT}/${lib} ]] || continue;
  2083. if [[ ${notice} -eq 0 ]]; then
  2084. notice=1;
  2085. ewarn "Old versions of installed libraries were detected on your system.";
  2086. ewarn "In order to avoid breaking packages that depend on these old libs,";
  2087. ewarn "the libraries are not being removed. You need to run revdep-rebuild";
  2088. ewarn "in order to remove these old dependencies. If you do not have this";
  2089. ewarn "helper program, simply emerge the 'gentoolkit' package.";
  2090. ewarn;
  2091. fi;
  2092. ewarn " # revdep-rebuild --library '${lib}' && rm '${lib}'";
  2093. done
  2094. }
  2095. prune_libtool_files ()
  2096. {
  2097. debug-print-function ${FUNCNAME} "$@";
  2098. local removing_all removing_modules opt;
  2099. _eutils_eprefix_init;
  2100. for opt in "$@";
  2101. do
  2102. case "${opt}" in
  2103. --all)
  2104. removing_all=1;
  2105. removing_modules=1
  2106. ;;
  2107. --modules)
  2108. removing_modules=1
  2109. ;;
  2110. *)
  2111. die "Invalid argument to ${FUNCNAME}(): ${opt}"
  2112. ;;
  2113. esac;
  2114. done;
  2115. local f;
  2116. local queue=();
  2117. while IFS= read -r -d '' f; do
  2118. local archivefile=${f/%.la/.a};
  2119. if ! sed -n -e '/^# Generated by .*libtool/q0;4q1' "${f}"; then
  2120. continue;
  2121. fi;
  2122. [[ ${f} != ${archivefile} ]] || die 'regex sanity check failed';
  2123. local reason= pkgconfig_scanned=;
  2124. local snotlink=$(sed -n -e 's:^shouldnotlink=::p' "${f}");
  2125. if [[ ${snotlink} == yes ]]; then
  2126. if [[ -f ${archivefile} ]]; then
  2127. einfo "Removing unnecessary ${archivefile#${D%/}} (static plugin)";
  2128. queue+=("${archivefile}");
  2129. fi;
  2130. if [[ -n ${removing_modules} ]]; then
  2131. reason='module';
  2132. fi;
  2133. else
  2134. if [[ -n ${removing_all} ]]; then
  2135. reason='requested';
  2136. else
  2137. if [[ ! -f ${archivefile} ]]; then
  2138. reason='no static archive';
  2139. else
  2140. if [[ ! -n $(sed -nre "s/^(dependency_libs|inherited_linker_flags)='(.*)'$/\2/p" "${f}") ]]; then
  2141. reason='no libs & flags';
  2142. else
  2143. if [[ ! -n ${pkgconfig_scanned} ]]; then
  2144. local pc_libs=();
  2145. if [[ ! -n ${removing_all} ]]; then
  2146. local pc;
  2147. local tf=${T}/prune-lt-files.pc;
  2148. local pkgconf=$(tc-getPKG_CONFIG);
  2149. while IFS= read -r -d '' pc; do
  2150. local arg libs;
  2151. if ${pkgconf} --exists "${pc}" &> /dev/null; then
  2152. sed -e '/^Requires:/d' "${pc}" > "${tf}";
  2153. libs=$(${pkgconf} --libs "${tf}");
  2154. else
  2155. libs=$(sed -ne 's/^Libs://p' "${pc}");
  2156. fi;
  2157. for arg in ${libs};
  2158. do
  2159. if [[ ${arg} == -l* ]]; then
  2160. if [[ ${arg} == '*$*' ]]; then
  2161. eqawarn "${FUNCNAME}: variable substitution likely failed in ${pc}";
  2162. eqawarn "(arg: ${arg})";
  2163. eqawarn "Most likely, you need to add virtual/pkgconfig to DEPEND.";
  2164. fi;
  2165. pc_libs+=(lib${arg#-l}.la);
  2166. fi;
  2167. done;
  2168. done < <(find "${D}" -type f -name '*.pc' -print0);
  2169. rm -f "${tf}";
  2170. fi;
  2171. pkgconfig_scanned=1;
  2172. fi;
  2173. has "${f##*/}" "${pc_libs[@]}" && reason='covered by .pc';
  2174. fi;
  2175. fi;
  2176. fi;
  2177. fi;
  2178. if [[ -n ${reason} ]]; then
  2179. einfo "Removing unnecessary ${f#${D%/}} (${reason})";
  2180. queue+=("${f}");
  2181. fi;
  2182. done < <(find "${ED}" -xtype f -name '*.la' -print0);
  2183. if [[ -n ${queue[@]} ]]; then
  2184. rm -f "${queue[@]}";
  2185. fi
  2186. }
  2187. raw-ldflags ()
  2188. {
  2189. local x input="$@";
  2190. [[ -z ${input} ]] && input=${LDFLAGS};
  2191. set --;
  2192. for x in ${input};
  2193. do
  2194. case ${x} in
  2195. -Wl,*)
  2196. x=${x#-Wl,};
  2197. set -- "$@" ${x//,/ }
  2198. ;;
  2199. *)
  2200. ;;
  2201. esac;
  2202. done;
  2203. echo "$@"
  2204. }
  2205. replace-cpu-flags ()
  2206. {
  2207. local newcpu="$#";
  2208. newcpu="${!newcpu}";
  2209. while [ $# -gt 1 ]; do
  2210. replace-flags "-march=${1}" "-march=${newcpu}";
  2211. replace-flags "-mcpu=${1}" "-mcpu=${newcpu}";
  2212. replace-flags "-mtune=${1}" "-mtune=${newcpu}";
  2213. shift;
  2214. done;
  2215. return 0
  2216. }
  2217. replace-flags ()
  2218. {
  2219. [[ $# != 2 ]] && die "Usage: replace-flags <old flag> <new flag>";
  2220. local f var new;
  2221. for var in $(all-flag-vars);
  2222. do
  2223. new=();
  2224. for f in ${!var};
  2225. do
  2226. [[ ${f} == ${1} ]] && f=${2};
  2227. new+=("${f}");
  2228. done;
  2229. eval export ${var}=\""${new[*]}"\";
  2230. done;
  2231. return 0
  2232. }
  2233. replace-sparc64-flags ()
  2234. {
  2235. local SPARC64_CPUS="ultrasparc3 ultrasparc v9";
  2236. if [ "${CFLAGS/mtune}" != "${CFLAGS}" ]; then
  2237. for x in ${SPARC64_CPUS};
  2238. do
  2239. CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8}";
  2240. done;
  2241. else
  2242. for x in ${SPARC64_CPUS};
  2243. do
  2244. CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}";
  2245. done;
  2246. fi;
  2247. if [ "${CXXFLAGS/mtune}" != "${CXXFLAGS}" ]; then
  2248. for x in ${SPARC64_CPUS};
  2249. do
  2250. CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8}";
  2251. done;
  2252. else
  2253. for x in ${SPARC64_CPUS};
  2254. do
  2255. CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}";
  2256. done;
  2257. fi;
  2258. export CFLAGS CXXFLAGS
  2259. }
  2260. setup-allowed-flags ()
  2261. {
  2262. ALLOWED_FLAGS=(-pipe -O '-O[12sg]' -mcpu -march -mtune '-fstack-protector*' '-fsanitize*' -fbounds-check -fbounds-checking -fno-strict-overflow -fno-PIE -fno-pie -nopie -no-pie -fno-unit-at-a-time -g '-g[0-9]' -ggdb '-ggdb[0-9]' '-gdwarf-*' gstabs -gstabs+ -fno-ident -fpermissive -frecord-gcc-switches '-fdiagnostics*' '-fplugin*' '-W*' -w '-[DUILR]*' '-Wl,*');
  2263. ALLOWED_FLAGS+=('-fno-stack-protector*' '-fabi-version=*' -fno-strict-aliasing -fno-bounds-check -fno-bounds-checking -fstrict-overflow -fno-omit-frame-pointer '-fno-builtin*');
  2264. ALLOWED_FLAGS+=(-mregparm -mno-app-regs -mapp-regs -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-ssse3 -mno-sse4 -mno-sse4.1 -mno-sse4.2 -mno-avx -mno-aes -mno-pclmul -mno-sse4a -mno-3dnow -mno-popcnt -mno-abm -mips1 -mips2 -mips3 -mips4 -mips32 -mips64 -mips16 -mplt -msoft-float -mno-soft-float -mhard-float -mno-hard-float -mfpu -mieee -mieee-with-inexact -mschedule -mfloat-gprs -mspe -mno-spe -mtls-direct-seg-refs -mno-tls-direct-seg-refs -mflat -mno-flat -mno-faster-structs -mfaster-structs -m32 -m64 -mx32 -mabi -mlittle-endian -mbig-endian -EL -EB -fPIC -mlive-g0 -mcmodel -mstack-bias -mno-stack-bias -msecure-plt '-m*-toc' -mfloat-abi -mfix-r10000 -mno-fix-r10000 -mthumb -marm -mno-fma4 -mno-movbe -mno-xop -mno-lwp -mno-fsgsbase -mno-rdrnd -mno-f16c -mno-bmi -mno-tbm -mno-avx2 -mno-bmi2 -mno-fma -mno-lzcnt -mno-fxsr -mno-hle -mno-rtm -mno-xsave -mno-xsaveopt -mno-avx512cd -mno-avx512er -mno-avx512f -mno-avx512pf -mno-sha)
  2265. }
  2266. src_compile ()
  2267. {
  2268. default
  2269. }
  2270. src_configure ()
  2271. {
  2272. use static && append-ldflags -static;
  2273. export ac_cv_search_pcre_compile=$(
  2274. usex pcre "$($(tc-getPKG_CONFIG) --libs $(usex static --static '') libpcre)" ''
  2275. );
  2276. econf --bindir="${EPREFIX}"/bin $(use_enable nls) $(use_enable pcre perl-regexp)
  2277. }
  2278. src_install ()
  2279. {
  2280. default
  2281. }
  2282. src_prepare ()
  2283. {
  2284. sed -i -e "s:@SHELL@:${EPREFIX}/bin/sh:g" src/egrep.sh || die
  2285. }
  2286. src_test ()
  2287. {
  2288. default
  2289. }
  2290. src_unpack ()
  2291. {
  2292. default
  2293. }
  2294. strip-flags ()
  2295. {
  2296. local x y var;
  2297. local ALLOWED_FLAGS;
  2298. setup-allowed-flags;
  2299. set -f;
  2300. for var in $(all-flag-vars);
  2301. do
  2302. local new=();
  2303. for x in ${!var};
  2304. do
  2305. local flag=${x%%=*};
  2306. for y in "${ALLOWED_FLAGS[@]}";
  2307. do
  2308. if [[ -z ${flag%%${y}} ]]; then
  2309. new+=("${x}");
  2310. break;
  2311. fi;
  2312. done;
  2313. done;
  2314. if _is_flagq ${var} "-O*" && ! _is_flagq new "-O*"; then
  2315. new+=(-O2);
  2316. fi;
  2317. if [[ ${!var} != "${new[*]}" ]]; then
  2318. einfo "strip-flags: ${var}: changed '${!var}' to '${new[*]}'";
  2319. fi;
  2320. eval export ${var}=\""${new[*]}"\";
  2321. done;
  2322. set +f;
  2323. return 0
  2324. }
  2325. strip-linguas ()
  2326. {
  2327. local ls newls nols;
  2328. if [[ $1 == "-i" ]] || [[ $1 == "-u" ]]; then
  2329. local op=$1;
  2330. shift;
  2331. ls=$(find "$1" -name '*.po' -exec basename {} .po ';');
  2332. shift;
  2333. local d f;
  2334. for d in "$@";
  2335. do
  2336. if [[ ${op} == "-u" ]]; then
  2337. newls=${ls};
  2338. else
  2339. newls="";
  2340. fi;
  2341. for f in $(find "$d" -name '*.po' -exec basename {} .po ';');
  2342. do
  2343. if [[ ${op} == "-i" ]]; then
  2344. has ${f} ${ls} && newls="${newls} ${f}";
  2345. else
  2346. has ${f} ${ls} || newls="${newls} ${f}";
  2347. fi;
  2348. done;
  2349. ls=${newls};
  2350. done;
  2351. else
  2352. ls="$@";
  2353. fi;
  2354. nols="";
  2355. newls="";
  2356. for f in ${LINGUAS};
  2357. do
  2358. if has ${f} ${ls}; then
  2359. newls="${newls} ${f}";
  2360. else
  2361. nols="${nols} ${f}";
  2362. fi;
  2363. done;
  2364. [[ -n ${nols} ]] && einfo "Sorry, but ${PN} does not support the LINGUAS:" ${nols};
  2365. export LINGUAS=${newls:1}
  2366. }
  2367. strip-unsupported-flags ()
  2368. {
  2369. export CFLAGS=$(test-flags-CC ${CFLAGS});
  2370. export CXXFLAGS=$(test-flags-CXX ${CXXFLAGS});
  2371. export FFLAGS=$(test-flags-F77 ${FFLAGS});
  2372. export FCFLAGS=$(test-flags-FC ${FCFLAGS})
  2373. }
  2374. tc-arch ()
  2375. {
  2376. tc-ninja_magic_to_arch portage "$@"
  2377. }
  2378. tc-arch-kernel ()
  2379. {
  2380. tc-ninja_magic_to_arch kern "$@"
  2381. }
  2382. tc-check-openmp ()
  2383. {
  2384. if ! tc-has-openmp; then
  2385. eerror "Your current compiler does not support OpenMP!";
  2386. if tc-is-gcc; then
  2387. eerror "Enable OpenMP support by building sys-devel/gcc with USE=\"openmp\".";
  2388. else
  2389. if tc-is-clang; then
  2390. eerror "OpenMP support in sys-devel/clang is provided by sys-libs/libomp.";
  2391. fi;
  2392. fi;
  2393. die "Active compiler does not have required support for OpenMP";
  2394. fi
  2395. }
  2396. tc-endian ()
  2397. {
  2398. local host=$1;
  2399. [[ -z ${host} ]] && host=${CTARGET:-${CHOST}};
  2400. host=${host%%-*};
  2401. case ${host} in
  2402. aarch64*be)
  2403. echo big
  2404. ;;
  2405. aarch64)
  2406. echo little
  2407. ;;
  2408. alpha*)
  2409. echo big
  2410. ;;
  2411. arm*b*)
  2412. echo big
  2413. ;;
  2414. arm*)
  2415. echo little
  2416. ;;
  2417. cris*)
  2418. echo little
  2419. ;;
  2420. hppa*)
  2421. echo big
  2422. ;;
  2423. i?86*)
  2424. echo little
  2425. ;;
  2426. ia64*)
  2427. echo little
  2428. ;;
  2429. m68*)
  2430. echo big
  2431. ;;
  2432. mips*l*)
  2433. echo little
  2434. ;;
  2435. mips*)
  2436. echo big
  2437. ;;
  2438. powerpc*le)
  2439. echo little
  2440. ;;
  2441. powerpc*)
  2442. echo big
  2443. ;;
  2444. s390*)
  2445. echo big
  2446. ;;
  2447. sh*b*)
  2448. echo big
  2449. ;;
  2450. sh*)
  2451. echo little
  2452. ;;
  2453. sparc*)
  2454. echo big
  2455. ;;
  2456. x86_64*)
  2457. echo little
  2458. ;;
  2459. *)
  2460. echo wtf
  2461. ;;
  2462. esac
  2463. }
  2464. tc-env_build ()
  2465. {
  2466. tc-export_build_env;
  2467. CFLAGS=${BUILD_CFLAGS} CXXFLAGS=${BUILD_CXXFLAGS} CPPFLAGS=${BUILD_CPPFLAGS} LDFLAGS=${BUILD_LDFLAGS} AR=$(tc-getBUILD_AR) AS=$(tc-getBUILD_AS) CC=$(tc-getBUILD_CC) CPP=$(tc-getBUILD_CPP) CXX=$(tc-getBUILD_CXX) LD=$(tc-getBUILD_LD) NM=$(tc-getBUILD_NM) PKG_CONFIG=$(tc-getBUILD_PKG_CONFIG) RANLIB=$(tc-getBUILD_RANLIB) "$@"
  2468. }
  2469. tc-export ()
  2470. {
  2471. local var;
  2472. for var in "$@";
  2473. do
  2474. [[ $(type -t tc-get${var}) != "function" ]] && die "tc-export: invalid export variable '${var}'";
  2475. eval tc-get${var} > /dev/null;
  2476. done
  2477. }
  2478. tc-export_build_env ()
  2479. {
  2480. tc-export "$@";
  2481. : ${BUILD_CFLAGS:=-O1 -pipe};
  2482. : ${BUILD_CXXFLAGS:=-O1 -pipe};
  2483. : ${BUILD_CPPFLAGS:= };
  2484. : ${BUILD_LDFLAGS:= };
  2485. export BUILD_{C,CXX,CPP,LD}FLAGS;
  2486. local v;
  2487. for v in BUILD_{C,CXX,CPP,LD}FLAGS;
  2488. do
  2489. export ${v#BUILD_}_FOR_BUILD="${!v}";
  2490. done
  2491. }
  2492. tc-get-compiler-type ()
  2493. {
  2494. local code='
  2495. #if defined(__PATHSCALE__)
  2496. HAVE_PATHCC
  2497. #elif defined(__clang__)
  2498. HAVE_CLANG
  2499. #elif defined(__GNUC__)
  2500. HAVE_GCC
  2501. #endif
  2502. ';
  2503. local res=$($(tc-getCPP "$@") -E -P - <<<"${code}");
  2504. case ${res} in
  2505. *HAVE_PATHCC*)
  2506. echo pathcc
  2507. ;;
  2508. *HAVE_CLANG*)
  2509. echo clang
  2510. ;;
  2511. *HAVE_GCC*)
  2512. echo gcc
  2513. ;;
  2514. *)
  2515. echo unknown
  2516. ;;
  2517. esac
  2518. }
  2519. tc-getAR ()
  2520. {
  2521. tc-getPROG AR ar "$@"
  2522. }
  2523. tc-getAS ()
  2524. {
  2525. tc-getPROG AS as "$@"
  2526. }
  2527. tc-getBUILD_AR ()
  2528. {
  2529. tc-getBUILD_PROG AR ar "$@"
  2530. }
  2531. tc-getBUILD_AS ()
  2532. {
  2533. tc-getBUILD_PROG AS as "$@"
  2534. }
  2535. tc-getBUILD_CC ()
  2536. {
  2537. tc-getBUILD_PROG CC gcc "$@"
  2538. }
  2539. tc-getBUILD_CPP ()
  2540. {
  2541. tc-getBUILD_PROG CPP "$(tc-getBUILD_CC) -E" "$@"
  2542. }
  2543. tc-getBUILD_CXX ()
  2544. {
  2545. tc-getBUILD_PROG CXX g++ "$@"
  2546. }
  2547. tc-getBUILD_LD ()
  2548. {
  2549. tc-getBUILD_PROG LD ld "$@"
  2550. }
  2551. tc-getBUILD_NM ()
  2552. {
  2553. tc-getBUILD_PROG NM nm "$@"
  2554. }
  2555. tc-getBUILD_OBJCOPY ()
  2556. {
  2557. tc-getBUILD_PROG OBJCOPY objcopy "$@"
  2558. }
  2559. tc-getBUILD_PKG_CONFIG ()
  2560. {
  2561. tc-getBUILD_PROG PKG_CONFIG pkg-config "$@"
  2562. }
  2563. tc-getBUILD_PROG ()
  2564. {
  2565. _tc-getPROG CBUILD "BUILD_$1 $1_FOR_BUILD HOST$1" "${@:2}"
  2566. }
  2567. tc-getBUILD_RANLIB ()
  2568. {
  2569. tc-getBUILD_PROG RANLIB ranlib "$@"
  2570. }
  2571. tc-getBUILD_STRIP ()
  2572. {
  2573. tc-getBUILD_PROG STRIP strip "$@"
  2574. }
  2575. tc-getCC ()
  2576. {
  2577. tc-getPROG CC gcc "$@"
  2578. }
  2579. tc-getCPP ()
  2580. {
  2581. tc-getPROG CPP "${CC:-gcc} -E" "$@"
  2582. }
  2583. tc-getCXX ()
  2584. {
  2585. tc-getPROG CXX g++ "$@"
  2586. }
  2587. tc-getDLLWRAP ()
  2588. {
  2589. tc-getPROG DLLWRAP dllwrap "$@"
  2590. }
  2591. tc-getF77 ()
  2592. {
  2593. tc-getPROG F77 gfortran "$@"
  2594. }
  2595. tc-getFC ()
  2596. {
  2597. tc-getPROG FC gfortran "$@"
  2598. }
  2599. tc-getGCJ ()
  2600. {
  2601. tc-getPROG GCJ gcj "$@"
  2602. }
  2603. tc-getGO ()
  2604. {
  2605. tc-getPROG GO gccgo "$@"
  2606. }
  2607. tc-getLD ()
  2608. {
  2609. tc-getPROG LD ld "$@"
  2610. }
  2611. tc-getNM ()
  2612. {
  2613. tc-getPROG NM nm "$@"
  2614. }
  2615. tc-getOBJCOPY ()
  2616. {
  2617. tc-getPROG OBJCOPY objcopy "$@"
  2618. }
  2619. tc-getOBJDUMP ()
  2620. {
  2621. tc-getPROG OBJDUMP objdump "$@"
  2622. }
  2623. tc-getPKG_CONFIG ()
  2624. {
  2625. tc-getPROG PKG_CONFIG pkg-config "$@"
  2626. }
  2627. tc-getPROG ()
  2628. {
  2629. _tc-getPROG CHOST "$@"
  2630. }
  2631. tc-getRANLIB ()
  2632. {
  2633. tc-getPROG RANLIB ranlib "$@"
  2634. }
  2635. tc-getRC ()
  2636. {
  2637. tc-getPROG RC windres "$@"
  2638. }
  2639. tc-getSTRIP ()
  2640. {
  2641. tc-getPROG STRIP strip "$@"
  2642. }
  2643. tc-has-openmp ()
  2644. {
  2645. local base="${T}/test-tc-openmp";
  2646. cat > "${base}.c" <<-EOF
  2647. #include <omp.h>
  2648. int main() {
  2649. int nthreads, tid, ret = 0;
  2650. #pragma omp parallel private(nthreads, tid)
  2651. {
  2652. tid = omp_get_thread_num();
  2653. nthreads = omp_get_num_threads(); ret += tid + nthreads;
  2654. }
  2655. return ret;
  2656. }
  2657. EOF
  2658. $(tc-getCC "$@") -fopenmp "${base}.c" -o "${base}" &> /dev/null;
  2659. local ret=$?;
  2660. rm -f "${base}"*;
  2661. return ${ret}
  2662. }
  2663. tc-has-tls ()
  2664. {
  2665. local base="${T}/test-tc-tls";
  2666. cat > "${base}.c" <<-EOF
  2667. int foo(int *i) {
  2668. static __thread int j = 0;
  2669. return *i ? j : *i;
  2670. }
  2671. EOF
  2672. local flags;
  2673. case $1 in
  2674. -s)
  2675. flags="-S"
  2676. ;;
  2677. -c)
  2678. flags="-c"
  2679. ;;
  2680. -l)
  2681. ;;
  2682. -*)
  2683. die "Usage: tc-has-tls [-c|-l] [toolchain prefix]"
  2684. ;;
  2685. esac;
  2686. : ${flags:=-fPIC -shared -Wl,-z,defs};
  2687. [[ $1 == -* ]] && shift;
  2688. $(tc-getCC "$@") ${flags} "${base}.c" -o "${base}" &> /dev/null;
  2689. local ret=$?;
  2690. rm -f "${base}"*;
  2691. return ${ret}
  2692. }
  2693. tc-is-clang ()
  2694. {
  2695. [[ $(tc-get-compiler-type) == clang ]]
  2696. }
  2697. tc-is-cross-compiler ()
  2698. {
  2699. [[ ${CBUILD:-${CHOST}} != ${CHOST} ]]
  2700. }
  2701. tc-is-gcc ()
  2702. {
  2703. [[ $(tc-get-compiler-type) == gcc ]]
  2704. }
  2705. tc-is-softfloat ()
  2706. {
  2707. local CTARGET=${CTARGET:-${CHOST}};
  2708. case ${CTARGET} in
  2709. bfin* | h8300*)
  2710. echo "only"
  2711. ;;
  2712. *)
  2713. if [[ ${CTARGET//_/-} == *-softfloat-* ]]; then
  2714. echo "yes";
  2715. else
  2716. if [[ ${CTARGET//_/-} == *-softfp-* ]]; then
  2717. echo "softfp";
  2718. else
  2719. echo "no";
  2720. fi;
  2721. fi
  2722. ;;
  2723. esac
  2724. }
  2725. tc-is-static-only ()
  2726. {
  2727. local host=${CTARGET:-${CHOST}};
  2728. [[ ${host} == *-mint* ]]
  2729. }
  2730. tc-ld-disable-gold ()
  2731. {
  2732. if ! tc-ld-is-gold "$@"; then
  2733. return;
  2734. fi;
  2735. ewarn "Forcing usage of the BFD linker instead of GOLD";
  2736. local ld=$(tc-getLD "$@");
  2737. local bfd_ld="${ld%% *}.bfd";
  2738. local path_ld=$(which "${bfd_ld}" 2>/dev/null);
  2739. [[ -e ${path_ld} ]] && export LD=${bfd_ld};
  2740. local major=$(gcc-major-version "$@");
  2741. local minor=$(gcc-minor-version "$@");
  2742. if [[ ${major} -lt 4 ]] || [[ ${major} -eq 4 && ${minor} -lt 8 ]]; then
  2743. if [[ -e ${path_ld} ]]; then
  2744. local d="${T}/bfd-linker";
  2745. mkdir -p "${d}";
  2746. ln -sf "${path_ld}" "${d}"/ld;
  2747. export LDFLAGS="${LDFLAGS} -B${d}";
  2748. else
  2749. die "unable to locate a BFD linker to bypass gold";
  2750. fi;
  2751. else
  2752. export LDFLAGS="${LDFLAGS} -fuse-ld=bfd";
  2753. fi
  2754. }
  2755. tc-ld-is-gold ()
  2756. {
  2757. local out;
  2758. out=$($(tc-getLD "$@") --version 2>&1);
  2759. if [[ ${out} == *"GNU gold"* ]]; then
  2760. return 0;
  2761. fi;
  2762. local base="${T}/test-tc-gold";
  2763. cat > "${base}.c" <<-EOF
  2764. int main() { return 0; }
  2765. EOF
  2766. out=$($(tc-getCC "$@") ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -Wl,--version "${base}.c" -o "${base}" 2>&1);
  2767. rm -f "${base}"*;
  2768. if [[ ${out} == *"GNU gold"* ]]; then
  2769. return 0;
  2770. fi;
  2771. return 1
  2772. }
  2773. tc-ninja_magic_to_arch ()
  2774. {
  2775. function ninj ()
  2776. {
  2777. [[ ${type} == "kern" ]] && echo $1 || echo $2
  2778. };
  2779. local type=$1;
  2780. local host=$2;
  2781. [[ -z ${host} ]] && host=${CTARGET:-${CHOST}};
  2782. case ${host} in
  2783. aarch64*)
  2784. echo arm64
  2785. ;;
  2786. alpha*)
  2787. echo alpha
  2788. ;;
  2789. arm*)
  2790. echo arm
  2791. ;;
  2792. avr*)
  2793. ninj avr32 avr
  2794. ;;
  2795. bfin*)
  2796. ninj blackfin bfin
  2797. ;;
  2798. c6x*)
  2799. echo c6x
  2800. ;;
  2801. cris*)
  2802. echo cris
  2803. ;;
  2804. frv*)
  2805. echo frv
  2806. ;;
  2807. hexagon*)
  2808. echo hexagon
  2809. ;;
  2810. hppa*)
  2811. ninj parisc hppa
  2812. ;;
  2813. i?86*)
  2814. if [[ ${type} == "kern" && ${host} == *freebsd* ]]; then
  2815. echo i386;
  2816. else
  2817. echo x86;
  2818. fi
  2819. ;;
  2820. ia64*)
  2821. echo ia64
  2822. ;;
  2823. m68*)
  2824. echo m68k
  2825. ;;
  2826. metag*)
  2827. echo metag
  2828. ;;
  2829. microblaze*)
  2830. echo microblaze
  2831. ;;
  2832. mips*)
  2833. echo mips
  2834. ;;
  2835. nios2*)
  2836. echo nios2
  2837. ;;
  2838. nios*)
  2839. echo nios
  2840. ;;
  2841. or1k | or32*)
  2842. echo openrisc
  2843. ;;
  2844. powerpc*)
  2845. if [[ ${type} == "kern" ]]; then
  2846. echo powerpc;
  2847. else
  2848. if [[ ${host} == powerpc64* ]]; then
  2849. echo ppc64;
  2850. else
  2851. echo ppc;
  2852. fi;
  2853. fi
  2854. ;;
  2855. riscv*)
  2856. echo riscv
  2857. ;;
  2858. s390*)
  2859. echo s390
  2860. ;;
  2861. score*)
  2862. echo score
  2863. ;;
  2864. sh64*)
  2865. ninj sh64 sh
  2866. ;;
  2867. sh*)
  2868. echo sh
  2869. ;;
  2870. sparc64*)
  2871. ninj sparc64 sparc
  2872. ;;
  2873. sparc*)
  2874. [[ ${PROFILE_ARCH} == "sparc64" ]] && ninj sparc64 sparc || echo sparc
  2875. ;;
  2876. tile*)
  2877. echo tile
  2878. ;;
  2879. vax*)
  2880. echo vax
  2881. ;;
  2882. x86_64*freebsd*)
  2883. echo amd64
  2884. ;;
  2885. x86_64*)
  2886. if [[ ${type} == "kern" ]]; then
  2887. echo x86;
  2888. else
  2889. echo amd64;
  2890. fi
  2891. ;;
  2892. xtensa*)
  2893. echo xtensa
  2894. ;;
  2895. *)
  2896. echo unknown
  2897. ;;
  2898. esac
  2899. }
  2900. tc-stack-grows-down ()
  2901. {
  2902. case ${ARCH} in
  2903. hppa | metag)
  2904. return 1
  2905. ;;
  2906. esac;
  2907. return 0
  2908. }
  2909. test-flag-CC ()
  2910. {
  2911. test-flag-PROG "CC" c "$1"
  2912. }
  2913. test-flag-CXX ()
  2914. {
  2915. test-flag-PROG "CXX" c++ "$1"
  2916. }
  2917. test-flag-F77 ()
  2918. {
  2919. test-flag-PROG "F77" f77 "$1"
  2920. }
  2921. test-flag-FC ()
  2922. {
  2923. test-flag-PROG "FC" f95 "$1"
  2924. }
  2925. test-flag-PROG ()
  2926. {
  2927. local comp=$1;
  2928. local lang=$2;
  2929. local flag=$3;
  2930. [[ -z ${comp} || -z ${flag} ]] && return 1;
  2931. local cmdline=($(tc-get${comp}) -Werror -c -o /dev/null);
  2932. if "${cmdline[@]}" -x${lang} - < /dev/null > /dev/null 2>&1; then
  2933. "${cmdline[@]}" "${flag}" -x${lang} - < /dev/null > /dev/null 2>&1;
  2934. else
  2935. "${cmdline[@]}" "${flag}" -c -o /dev/null /dev/null > /dev/null 2>&1;
  2936. fi
  2937. }
  2938. test-flags ()
  2939. {
  2940. test-flags-CC "$@"
  2941. }
  2942. test-flags-CC ()
  2943. {
  2944. test-flags-PROG "CC" "$@"
  2945. }
  2946. test-flags-CXX ()
  2947. {
  2948. test-flags-PROG "CXX" "$@"
  2949. }
  2950. test-flags-F77 ()
  2951. {
  2952. test-flags-PROG "F77" "$@"
  2953. }
  2954. test-flags-FC ()
  2955. {
  2956. test-flags-PROG "FC" "$@"
  2957. }
  2958. test-flags-PROG ()
  2959. {
  2960. local comp=$1;
  2961. local flags=();
  2962. local x;
  2963. shift;
  2964. [[ -z ${comp} ]] && return 1;
  2965. for x in "$@";
  2966. do
  2967. test-flag-${comp} "${x}" && flags+=("${x}");
  2968. done;
  2969. echo "${flags[*]}";
  2970. [[ ${#flags[@]} -gt 0 ]]
  2971. }
  2972. test_version_info ()
  2973. {
  2974. if [[ $($(tc-getCC) --version 2>&1) == *$1* ]]; then
  2975. return 0;
  2976. else
  2977. return 1;
  2978. fi
  2979. }
  2980. use_if_iuse ()
  2981. {
  2982. in_iuse $1 || return 1;
  2983. use $1
  2984. }
  2985. validate_desktop_entries ()
  2986. {
  2987. _eutils_eprefix_init;
  2988. if [[ -x "${EPREFIX}"/usr/bin/desktop-file-validate ]]; then
  2989. einfo "Checking desktop entry validity";
  2990. local directories="";
  2991. for d in /usr/share/applications $@;
  2992. do
  2993. [[ -d ${ED}${d} ]] && directories="${directories} ${ED}${d}";
  2994. done;
  2995. if [[ -n ${directories} ]]; then
  2996. for FILE in $(find ${directories} -name "*\.desktop" -not -path '*.hidden*' | sort -u 2>/dev/null);
  2997. do
  2998. local temp=$(desktop-file-validate ${FILE} | grep -v "warning:" | sed -e "s|error: ||" -e "s|${FILE}:|--|g" );
  2999. [[ -n $temp ]] && elog ${temp/--/${FILE/${ED}/}:};
  3000. done;
  3001. fi;
  3002. echo "";
  3003. else
  3004. einfo "Passing desktop entry validity check. Install dev-util/desktop-file-utils, if you want to help to improve Gentoo.";
  3005. fi
  3006. }
  3007.