spacepaste

  1.  
  2. declare -x ABI="amd64"
  3. declare -x ABI_MIPS=""
  4. declare -x ABI_PPC=""
  5. declare -x ABI_S390=""
  6. declare -x ABI_X86="64"
  7. declare -a ALL_AUTOTOOLS_MACROS=([0]="AC_PROG_LIBTOOL" [1]="AM_PROG_LIBTOOL" [2]="LT_INIT" [3]="LT_CONFIG_LTDL_DIR" [4]="AC_CONFIG_HEADERS" [5]="AC_CONFIG_HEADER" [6]="AM_CONFIG_HEADERS" [7]="AM_CONFIG_HEADER" [8]="AC_CONFIG_SUBDIRS" [9]="AC_CONFIG_AUX_DIR" [10]="AC_CONFIG_MACRO_DIR" [11]="AM_INIT_AUTOMAKE" [12]="AM_GLIB_GNU_GETTEXT" [13]="AM_GNU_GETTEXT_VERSION" [14]="AM_GNU_GETTEXT_REQUIRE_VERSION" [15]="AC_PROG_INTLTOOL" [16]="IT_PROG_INTLTOOL" [17]="GTK_DOC_CHECK" [18]="GNOME_DOC_INIT")
  8. declare -x ALSA_CARDS=""
  9. declare -x APACHE2_MODULES=""
  10. declare -x APACHE2_MPMS=""
  11. declare -x ARCH="amd64"
  12. declare -- AT_M4DIR=""
  13. declare -- AT_SYS_M4DIR=""
  14. declare -- AUTOTOOLS_AUTO_DEPEND="yes"
  15. declare -- AUTOTOOLS_DEPEND="!<sys-devel/gettext-0.18.1.1-r3
  16. || ( >=sys-devel/automake-1.16:1.16 >=sys-devel/automake-1.15.1:1.15 )
  17. >=sys-devel/autoconf-2.69
  18. >=sys-devel/libtool-2.4"
  19. declare BDEPEND=""
  20. declare -x BOOTSTRAP_USE="cxx unicode internal-glib python_targets_python3_5 python_targets_python2_7 multilib hardened pic xtpax -jit -orc"
  21. declare -x BROWSER="firefox-bin"
  22. declare -x CALLIGRA_EXPERIMENTAL_FEATURES=""
  23. declare -x CALLIGRA_FEATURES=""
  24. declare -x CAMERAS=""
  25. declare -x CBUILD="x86_64-pc-linux-gnu"
  26. declare -x CFLAGS="-march=native -O2 -fforce-addr -pipe -D_FORTIFY_SOURCE=2 -fstack-protector-all -fstack-check -mfunction-return=thunk -mindirect-branch=thunk"
  27. declare -x CFLAGS_amd64="-m64"
  28. declare -x CFLAGS_default
  29. declare -x CFLAGS_x32="-mx32"
  30. declare -x CFLAGS_x86="-m32"
  31. declare -x CHOST="x86_64-pc-linux-gnu"
  32. declare -x CHOST_amd64="x86_64-pc-linux-gnu"
  33. declare -x CHOST_default="x86_64-pc-linux-gnu"
  34. declare -x CHOST_x32="x86_64-pc-linux-gnux32"
  35. declare -x CHOST_x86="i686-pc-linux-gnu"
  36. declare -x COLLECTD_PLUGINS=""
  37. declare -x CONF_PREFIX="/usr"
  38. declare -x CPU_FLAGS_ARM=""
  39. declare -x CPU_FLAGS_X86=""
  40. declare -x CTARGET_default="x86_64-pc-linux-gnu"
  41. declare -x CURL_SSL=""
  42. declare -x CXXFLAGS="-march=native -O2 -fforce-addr -pipe -D_FORTIFY_SOURCE=2 -fstack-protector-all -fstack-check -mfunction-return=thunk -mindirect-branch=thunk"
  43. declare -x DEFAULT_ABI="amd64"
  44. declare -x DEFINED_PHASES=" compile configure install prepare test"
  45. declare DEPEND=">=dev-libs/lzo-2.06-r1[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
  46. >=media-libs/fontconfig-2.10.92[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
  47. >=media-libs/freetype-2.5.0.1:2[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
  48. >=media-libs/libpng-1.6.10:0=[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
  49. sys-libs/binutils-libs:0=[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
  50. >=sys-libs/zlib-1.2.8-r1[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
  51. >=x11-libs/pixman-0.32.4[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
  52. gles2? ( >=media-libs/mesa-9.1.6[gles2,abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  53. glib? ( >=dev-libs/glib-2.34.3:2[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  54. opengl? ( >=media-libs/mesa-9.1.6[egl,abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  55. X? (
  56. >=x11-libs/libXrender-0.9.8[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
  57. >=x11-libs/libXext-1.3.2[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
  58. >=x11-libs/libX11-1.6.2[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
  59. )
  60. xcb? (
  61. >=x11-libs/libxcb-1.9.1[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
  62. )
  63. virtual/pkgconfig
  64. >=sys-devel/libtool-2
  65. X? (
  66. >=x11-proto/renderproto-0.11.1-r1[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
  67. ) >=app-portage/elt-patches-20170422 !<sys-devel/gettext-0.18.1.1-r3
  68. || ( >=sys-devel/automake-1.16:1.16 >=sys-devel/automake-1.15.1:1.15 )
  69. >=sys-devel/autoconf-2.69
  70. >=sys-devel/libtool-2.4"
  71. declare DESCRIPTION="A vector graphics library with cross-device output support"
  72. declare -x DESTTREE="/usr"
  73. declare -x DIROPTIONS="-m0755"
  74. declare -x EAPI="6"
  75. declare -x ELIBC="glibc"
  76. declare -x ENLIGHTENMENT_MODULES=""
  77. declare -- EPATCH_COMMON_OPTS="-g0 -E --no-backup-if-mismatch"
  78. declare -- EPATCH_EXCLUDE=""
  79. declare -- EPATCH_FORCE="no"
  80. declare -- EPATCH_MULTI_MSG="Applying various patches (bugfixes/updates) ..."
  81. declare -- EPATCH_OPTS=""
  82. declare -- EPATCH_SINGLE_MSG=""
  83. declare -- EPATCH_SOURCE="/var/tmp/portage/x11-libs/cairo-1.14.12/work/patch"
  84. declare -- EPATCH_SUFFIX="patch.bz2"
  85. declare -x EXEOPTIONS="-m0755"
  86. declare -x FCFLAGS="-O2 -pipe"
  87. 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}\""
  88. declare -x FFLAGS="-O2 -pipe"
  89. declare -x FFTOOLS=""
  90. declare -x GCC_COLORS="error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01"
  91. declare -x GCC_SPECS=""
  92. declare -x GPSD_PROTOCOLS=""
  93. declare -x GRUB_PLATFORMS=""
  94. declare -x GSETTINGS_BACKEND="dconf"
  95. declare HDEPEND=""
  96. declare HOMEPAGE="https://www.cairographics.org"
  97. declare -x HUSHLOGIN="FALSE"
  98. declare -x INHERITED=" desktop estack epatch toolchain-funcs multilib ltprune preserve-libs vcs-clean eutils flag-o-matic libtool autotools multibuild multilib-build multilib-minimal"
  99. declare -x INPUT_DEVICES=""
  100. declare -x INSDESTTREE=""
  101. declare -x INSOPTIONS="-m0644"
  102. declare IUSE="X aqua debug gles2 +glib opengl static-libs +svg valgrind xcb abi_x86_32 abi_x86_64 abi_x86_x32 abi_mips_n32 abi_mips_n64 abi_mips_o32 abi_ppc_32 abi_ppc_64 abi_s390_32 abi_s390_64"
  103. declare -x IUSE_EFFECTIVE="X abi_mips_n32 abi_mips_n64 abi_mips_o32 abi_ppc_32 abi_ppc_64 abi_s390_32 abi_s390_64 abi_x86_32 abi_x86_64 abi_x86_x32 alpha amd64 amd64-fbsd amd64-linux aqua arm arm-linux arm64 debug 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 gles2 glib hppa ia64 kernel_AIX kernel_Darwin kernel_FreeBSD kernel_HPUX kernel_NetBSD kernel_OpenBSD kernel_SunOS kernel_Winnt kernel_freemint kernel_linux m68k m68k-mint mips opengl ppc ppc-aix ppc-macos ppc64 ppc64-linux prefix prefix-chain prefix-guest s390 sh sparc sparc-solaris sparc64-solaris static-libs svg userland_BSD userland_GNU valgrind x64-cygwin x64-macos x64-solaris x86 x86-cygwin x86-fbsd x86-linux x86-macos x86-solaris x86-winnt xcb"
  104. declare -x IUSE_IMPLICIT="abi_x86_64 prefix prefix-chain prefix-guest"
  105. declare -x KERNEL="linux"
  106. declare -x KERNEL_ABI="amd64"
  107. declare -x KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
  108. declare -x L10N=""
  109. declare -x LANG="en_US"
  110. declare -x LCD_DEVICES=""
  111. declare -x LC_COLLATE="C"
  112. declare -x LC_MESSAGES="C"
  113. declare -x LDFLAGS="-Wl,-O1 -Wl,--as-needed"
  114. declare -x LDFLAGS_amd64="-m elf_x86_64"
  115. declare -x LDFLAGS_default
  116. declare -x LDFLAGS_x32="-m elf32_x86_64"
  117. declare -x LDFLAGS_x86="-m elf_i386"
  118. declare -x LIBDIR_amd64="lib64"
  119. declare -x LIBDIR_default="lib"
  120. declare -x LIBDIR_x32="libx32"
  121. declare -x LIBDIR_x86="lib32"
  122. declare -x LIBOPTIONS="-m0644"
  123. declare -x LIBREOFFICE_EXTENSIONS=""
  124. declare -x LICENSE="|| ( LGPL-2.1 MPL-1.1 )"
  125. declare -x LIRC_DEVICES=""
  126. declare -x LLVM_TARGETS=""
  127. declare -x MAIL="/var/mail/josephlaptop"
  128. declare -x MAKEOPS="-j5"
  129. declare -x MAKEOPTS="-j2"
  130. declare -x MANPAGER="manpager"
  131. declare -x MONKEYD_PLUGINS=""
  132. declare -x MULTILIB_ABIS="amd64 x86"
  133. declare -x MULTILIB_STRICT_DENY="64-bit.*shared object"
  134. 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"
  135. declare -x MULTILIB_STRICT_EXEMPT="(perl5|gcc|gcc-lib|binutils|eclipse-3|debug|portage|udev|systemd|clang|python-exec|llvm)"
  136. declare -- MULTILIB_USEDEP="abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?"
  137. declare -x NETBEANS="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml"
  138. declare -x NETBEANS_MODULES=""
  139. declare -x NGINX_MODULES_HTTP=""
  140. declare -x NGINX_MODULES_MAIL=""
  141. declare -x NGINX_MODULES_STREAM=""
  142. declare -x OFED_DRIVERS=""
  143. declare -x OFFICE_IMPLEMENTATION=""
  144. declare -x OPENGL_PROFILE="xorg-x11"
  145. declare -x OPENMPI_FABRICS=""
  146. declare -x OPENMPI_OFED_FEATURES=""
  147. declare -x OPENMPI_RM=""
  148. declare -a PATCHES=([0]="/var/tmp/portage/x11-libs/cairo-1.14.12/files/cairo-1.12.18-disable-test-suite.patch" [1]="/var/tmp/portage/x11-libs/cairo-1.14.12/files/cairo-respect-fontconfig.patch")
  149. declare -x PATH="/usr/lib/portage/python3.5/ebuild-helpers/xattr:/usr/lib/portage/python3.5/ebuild-helpers:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/7.3.0:/usr/lib/llvm/5/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin"
  150. declare PDEPEND=""
  151. declare -x PHP_TARGETS=""
  152. declare -x PKG_CONFIG_PATH="/usr/lib64/pkgconfig"
  153. declare -x PORTAGE_COMPRESSION_COMMAND="bzip2"
  154. declare -a PORTAGE_DOCOMPRESS=([0]="/usr/share/doc" [1]="/usr/share/info" [2]="/usr/share/man")
  155. declare -x PORTAGE_DOCOMPRESS_SIZE_LIMIT="128"
  156. declare -a PORTAGE_DOCOMPRESS_SKIP=([0]="/usr/share/doc/cairo-1.14.12/html")
  157. declare -x PORTAGE_NICENESS="10"
  158. declare -x POSTGRES_TARGETS=""
  159. declare -x PROFILE_IS_HARDENED="1"
  160. 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"
  161. declare -x PROPERTIES=""
  162. declare -x PYTHONDONTWRITEBYTECODE="1"
  163. declare -x PYTHON_SINGLE_TARGET=""
  164. declare -x PYTHON_TARGETS=""
  165. declare -x QEMU_SOFTMMU_TARGETS=""
  166. declare -x QEMU_USER_TARGETS=""
  167. declare RDEPEND=">=dev-libs/lzo-2.06-r1[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
  168. >=media-libs/fontconfig-2.10.92[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
  169. >=media-libs/freetype-2.5.0.1:2[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
  170. >=media-libs/libpng-1.6.10:0=[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
  171. sys-libs/binutils-libs:0=[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
  172. >=sys-libs/zlib-1.2.8-r1[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
  173. >=x11-libs/pixman-0.32.4[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
  174. gles2? ( >=media-libs/mesa-9.1.6[gles2,abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  175. glib? ( >=dev-libs/glib-2.34.3:2[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  176. opengl? ( >=media-libs/mesa-9.1.6[egl,abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  177. X? (
  178. >=x11-libs/libXrender-0.9.8[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
  179. >=x11-libs/libXext-1.3.2[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
  180. >=x11-libs/libX11-1.6.2[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
  181. )
  182. xcb? (
  183. >=x11-libs/libxcb-1.9.1[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_ppc_32(-)?,abi_ppc_64(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
  184. ) "
  185. declare REPOSITORY
  186. declare REQUIRED_USE="
  187. gles2? ( !opengl )
  188. "
  189. declare -x RESTRICT="test"
  190. 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}\""
  191. declare -x ROS_MESSAGES=""
  192. declare -x RUBY_TARGETS=""
  193. declare -x R_HOME="/usr/lib64/R"
  194. declare -x S="/var/tmp/portage/x11-libs/cairo-1.14.12/work/cairo-1.14.12"
  195. declare -x SANDBOX_DEBUG="0"
  196. declare -x SANDBOX_DENY=""
  197. declare -x SANDBOX_PREDICT="/var/tmp/portage/x11-libs/cairo-1.14.12/homedir:/dev/crypto:/var/cache/fontconfig"
  198. declare -x SANDBOX_READ="/:/var/tmp"
  199. declare -x SANDBOX_VERBOSE="1"
  200. 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/x11-libs/cairo-1.14.12/homedir/.bash_history"
  201. declare -x SANE_BACKENDS=""
  202. declare -x SHELL="/bin/bash"
  203. declare -x SLOT="0"
  204. declare SRC_URI="https://www.cairographics.org/releases/cairo-1.14.12.tar.xz"
  205. declare -x SSH_ASKPASS="/usr/bin/ssh-askpass-fullscreen"
  206. declare -x SYMLINK_LIB="yes"
  207. declare -x TERMINAL="xfce4-terminal"
  208. declare -x TWISTED_DISABLE_WRITING_OF_PLUGIN_CACHE="1"
  209. declare -x USE="X abi_x86_64 amd64 elibc_glibc glib kernel_linux opengl svg userland_GNU xcb"
  210. declare -x USERLAND="GNU"
  211. declare -x USE_EXPAND_IMPLICIT="ARCH ELIBC KERNEL USERLAND"
  212. declare -x USE_EXPAND_UNPREFIXED="ARCH"
  213. declare -x USE_EXPAND_VALUES_ARCH="alpha amd64 amd64-fbsd amd64-linux arm arm-linux arm64 hppa ia64 m68k m68k-mint mips ppc ppc64 ppc64-linux ppc-aix ppc-macos s390 sh sparc sparc64-solaris sparc-solaris x64-cygwin x64-macos x64-solaris x86 x86-cygwin x86-fbsd x86-linux x86-macos x86-solaris x86-winnt"
  214. declare -x USE_EXPAND_VALUES_ELIBC="AIX bionic Cygwin Darwin DragonFly FreeBSD glibc HPUX Interix mingw mintlib musl NetBSD OpenBSD SunOS uclibc Winnt"
  215. declare -x USE_EXPAND_VALUES_KERNEL="AIX Darwin FreeBSD freemint HPUX linux NetBSD OpenBSD SunOS Winnt"
  216. declare -x USE_EXPAND_VALUES_USERLAND="BSD GNU"
  217. declare -x UWSGI_PLUGINS=""
  218. declare -x VIDEO_CARDS=""
  219. declare -x VOICEMAIL_STORAGE=""
  220. declare -x VTE_VERSION="4602"
  221. declare -x WANT_AUTOCONF="2.5"
  222. declare -x WANT_AUTOMAKE="1.15"
  223. declare -x WANT_LIBTOOL="latest"
  224. declare -x WINDOWID="18880537"
  225. declare -x WINDOWPATH="7"
  226. declare -x XDG_CONFIG_DIRS="/etc/xdg"
  227. declare -x XDG_DATA_DIRS="/usr/local/share:/usr/share"
  228. declare -x XFCE_PLUGINS=""
  229. declare -x XSESSION="i3"
  230. declare -x XTABLES_ADDONS=""
  231. declare -- _AUTOTOOLS_ECLASS="1"
  232. declare -- _DESKTOP_ECLASS="1"
  233. declare -- _EPATCH_ECLASS="1"
  234. declare -- _ESTACK_ECLASS="1"
  235. declare -- _EUTILS_ECLASS="1"
  236. declare -x _E_DOCDESTTREE_=""
  237. declare -x _E_EXEDESTTREE_=""
  238. declare -- _FLAG_O_MATIC_ECLASS="1"
  239. declare -a _LATEST_AUTOMAKE=([0]="1.16:1.16" [1]="1.15.1:1.15")
  240. declare -- _LIBTOOL_ECLASS="1"
  241. declare -- _LTPRUNE_ECLASS="1"
  242. declare -- _MULTIBUILD="1"
  243. declare -- _MULTILIB_BUILD="1"
  244. declare -- _MULTILIB_ECLASS="1"
  245. declare -a _MULTILIB_FLAGS=([0]="abi_x86_32:x86,x86_fbsd,x86_freebsd,x86_linux,x86_macos,x86_solaris" [1]="abi_x86_64:amd64,amd64_fbsd,x64_freebsd,amd64_linux,x64_macos,x64_solaris" [2]="abi_x86_x32:x32" [3]="abi_mips_n32:n32" [4]="abi_mips_n64:n64" [5]="abi_mips_o32:o32" [6]="abi_ppc_32:ppc,ppc_aix,ppc_macos" [7]="abi_ppc_64:ppc64" [8]="abi_s390_32:s390" [9]="abi_s390_64:s390x")
  246. declare -- _PRESERVE_LIBS_ECLASS="1"
  247. declare -- _TOOLCHAIN_FUNCS_ECLASS="1"
  248. declare -- __AUTOTOOLS_AUTO_DEPEND="yes"
  249. declare -- _libtool_atom=">=sys-devel/libtool-2.4"
  250. declare -- phase_func
  251. declare -- started_applying="1"
  252. __eapi6_src_install ()
  253. {
  254. if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then
  255. emake DESTDIR="${D}" install;
  256. fi;
  257. einstalldocs
  258. }
  259. __eapi6_src_prepare ()
  260. {
  261. if [[ $(declare -p PATCHES 2>/dev/null) == "declare -a"* ]]; then
  262. [[ ${#PATCHES[@]} -gt 0 ]] && eapply "${PATCHES[@]}";
  263. else
  264. if [[ -n ${PATCHES} ]]; then
  265. eapply ${PATCHES};
  266. fi;
  267. fi;
  268. eapply_user
  269. }
  270. _at_uses_autoheader ()
  271. {
  272. _at_uses_pkg A{C,M}_CONFIG_HEADER{S,}
  273. }
  274. _at_uses_automake ()
  275. {
  276. _at_uses_pkg AM_INIT_AUTOMAKE
  277. }
  278. _at_uses_gettext ()
  279. {
  280. _at_uses_pkg AM_GNU_GETTEXT_{,REQUIRE_}VERSION
  281. }
  282. _at_uses_glibgettext ()
  283. {
  284. _at_uses_pkg AM_GLIB_GNU_GETTEXT
  285. }
  286. _at_uses_gnomedoc ()
  287. {
  288. _at_uses_pkg GNOME_DOC_INIT
  289. }
  290. _at_uses_gtkdoc ()
  291. {
  292. _at_uses_pkg GTK_DOC_CHECK
  293. }
  294. _at_uses_intltool ()
  295. {
  296. _at_uses_pkg {AC,IT}_PROG_INTLTOOL
  297. }
  298. _at_uses_libltdl ()
  299. {
  300. _at_uses_pkg LT_CONFIG_LTDL_DIR
  301. }
  302. _at_uses_libtool ()
  303. {
  304. _at_uses_pkg A{C,M}_PROG_LIBTOOL LT_INIT
  305. }
  306. _at_uses_pkg ()
  307. {
  308. if [[ -n $(autotools_check_macro "$@") ]]; then
  309. return 0;
  310. else
  311. local macro args=();
  312. for macro in "$@";
  313. do
  314. args+=(-e "^[[:space:]]*${macro}\>");
  315. done;
  316. egrep -q "${args[@]}" configure.??;
  317. fi
  318. }
  319. _automake_version ()
  320. {
  321. autotools_run_tool --at-output automake --version 2> /dev/null | sed -n -e '1{s:.*(GNU automake) ::p;q}'
  322. }
  323. _autotools_m4dir_include ()
  324. {
  325. local x include_opts flag;
  326. [[ ${WANT_AUTOCONF} == "2.1" ]] && flag="l" || flag="I";
  327. for x in "$@";
  328. do
  329. case ${x} in
  330. -${flag})
  331. ;;
  332. *)
  333. [[ ! -d ${x} ]] && ewarn "autotools.eclass: '${x}' does not exist";
  334. include_opts+=" -${flag} ${x}"
  335. ;;
  336. esac;
  337. done;
  338. echo ${include_opts}
  339. }
  340. _clang_fullversion ()
  341. {
  342. local ver="$1";
  343. shift;
  344. set -- $($(tc-getCPP "$@") -E -P - <<<"__clang_major__ __clang_minor__ __clang_patchlevel__");
  345. eval echo "$ver"
  346. }
  347. _eapply_patch ()
  348. {
  349. local f=${1};
  350. local prefix=${2};
  351. started_applying=1;
  352. ebegin "${prefix:-Applying }${f##*/}";
  353. ${patch_cmd} -p1 -f -s -g0 --no-backup-if-mismatch "${patch_options[@]}" < "${f}";
  354. failed=${?};
  355. if ! eend "${failed}"; then
  356. __helpers_die "patch -p1 ${patch_options[*]} failed with ${f}";
  357. fi
  358. }
  359. _elibtoolize ()
  360. {
  361. local LIBTOOLIZE=${LIBTOOLIZE:-$(type -P glibtoolize > /dev/null && echo glibtoolize || echo libtoolize)};
  362. if [[ $1 == "--auto-ltdl" ]]; then
  363. shift;
  364. _at_uses_libltdl && set -- "$@" --ltdl;
  365. fi;
  366. [[ -f GNUmakefile.am || -f Makefile.am ]] && set -- "$@" --automake;
  367. autotools_run_tool ${LIBTOOLIZE} "$@"
  368. }
  369. _filter-hardened ()
  370. {
  371. local f;
  372. for f in "$@";
  373. do
  374. case "${f}" in
  375. -fPIC | -fpic | -fPIE | -fpie | -Wl,pie | -pie)
  376. gcc-specs-pie || continue;
  377. if ! is-flagq -nopie && ! is-flagq -no-pie; then
  378. if test-flags -nopie > /dev/null; then
  379. append-flags -nopie;
  380. else
  381. append-flags -no-pie;
  382. fi;
  383. fi
  384. ;;
  385. -fstack-protector)
  386. gcc-specs-ssp || continue;
  387. is-flagq -fno-stack-protector || append-flags $(test-flags -fno-stack-protector)
  388. ;;
  389. -fstack-protector-all)
  390. gcc-specs-ssp-to-all || continue;
  391. is-flagq -fno-stack-protector-all || append-flags $(test-flags -fno-stack-protector-all)
  392. ;;
  393. -fno-strict-overflow)
  394. gcc-specs-nostrict || continue;
  395. is-flagq -fstrict-overflow || append-flags $(test-flags -fstrict-overflow)
  396. ;;
  397. esac;
  398. done
  399. }
  400. _filter-var ()
  401. {
  402. local f x var=$1 new=();
  403. shift;
  404. for f in ${!var};
  405. do
  406. for x in "$@";
  407. do
  408. [[ ${f} == ${x} ]] && continue 2;
  409. done;
  410. new+=("${f}");
  411. done;
  412. export ${var}="${new[*]}"
  413. }
  414. _gcc-install-dir ()
  415. {
  416. echo "$(LC_ALL=C $(tc-getCC) -print-search-dirs 2> /dev/null | awk '$1=="install:" {print $2}')"
  417. }
  418. _gcc-specs-directive_raw ()
  419. {
  420. local cc=$(tc-getCC);
  421. local specfiles=$(LC_ALL=C ${cc} -v 2>&1 | awk '$1=="Reading" {print $NF}');
  422. ${cc} -dumpspecs 2> /dev/null | cat - ${specfiles} | awk -v directive=$1 'BEGIN { pspec=""; spec=""; outside=1 }
  423. $1=="*"directive":" { pspec=spec; spec=""; outside=0; next }
  424. outside || NF==0 || ( substr($1,1,1)=="*" && substr($1,length($1),1)==":" ) { outside=1; next }
  425. spec=="" && substr($0,1,1)=="+" { spec=pspec " " substr($0,2); next }
  426. { spec=spec $0 }
  427. END { print spec }';
  428. return 0
  429. }
  430. _gcc-specs-exists ()
  431. {
  432. [[ -f $(_gcc-install-dir)/$1 ]]
  433. }
  434. _gcc_fullversion ()
  435. {
  436. local ver="$1";
  437. shift;
  438. set -- $($(tc-getCPP "$@") -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__");
  439. eval echo "$ver"
  440. }
  441. _iconins ()
  442. {
  443. ( local funcname=$1;
  444. shift;
  445. local size dir;
  446. local context=apps;
  447. local theme=hicolor;
  448. while [[ $# -gt 0 ]]; do
  449. case $1 in
  450. -s | --size)
  451. if [[ ${2%%x*}x${2%%x*} == "$2" ]]; then
  452. size=${2%%x*};
  453. else
  454. size=${2};
  455. fi;
  456. case ${size} in
  457. 16 | 22 | 24 | 32 | 36 | 48 | 64 | 72 | 96 | 128 | 192 | 256 | 512)
  458. size=${size}x${size}
  459. ;;
  460. scalable)
  461. ;;
  462. *)
  463. eerror "${size} is an unsupported icon size!";
  464. exit 1
  465. ;;
  466. esac;
  467. shift 2
  468. ;;
  469. -t | --theme)
  470. theme=${2};
  471. shift 2
  472. ;;
  473. -c | --context)
  474. context=${2};
  475. shift 2
  476. ;;
  477. *)
  478. if [[ -z ${size} ]]; then
  479. insinto /usr/share/pixmaps;
  480. else
  481. insinto /usr/share/icons/${theme}/${size}/${context};
  482. fi;
  483. if [[ ${funcname} == doicon ]]; then
  484. if [[ -f $1 ]]; then
  485. doins "${1}";
  486. else
  487. if [[ -d $1 ]]; then
  488. shopt -s nullglob;
  489. doins "${1}"/*.{png,svg};
  490. shopt -u nullglob;
  491. else
  492. eerror "${1} is not a valid file/directory!";
  493. exit 1;
  494. fi;
  495. fi;
  496. else
  497. break;
  498. fi;
  499. shift 1
  500. ;;
  501. esac;
  502. done;
  503. if [[ ${funcname} == newicon ]]; then
  504. newins "$@";
  505. fi ) || die
  506. }
  507. _is_flagq ()
  508. {
  509. local x var="$1[*]";
  510. for x in ${!var};
  511. do
  512. [[ ${x} == $2 ]] && return 0;
  513. done;
  514. return 1
  515. }
  516. _multibuild_run ()
  517. {
  518. local i=1;
  519. while [[ ${!i} == _* ]]; do
  520. (( i += 1 ));
  521. done;
  522. [[ ${i} -le ${#} ]] && einfo "${v}: running ${@:${i}}";
  523. "${@}"
  524. }
  525. _multilib_multibuild_wrapper ()
  526. {
  527. debug-print-function ${FUNCNAME} "${@}";
  528. local ABI=${MULTIBUILD_VARIANT#*.};
  529. local -r MULTILIB_ABI_FLAG=${MULTIBUILD_VARIANT%.*};
  530. multilib_toolchain_setup "${ABI}";
  531. readonly ABI;
  532. "${@}"
  533. }
  534. _tc-getPROG ()
  535. {
  536. local tuple=$1;
  537. local v var vars=$2;
  538. local prog=($3);
  539. var=${vars%% *};
  540. for v in ${vars};
  541. do
  542. if [[ -n ${!v} ]]; then
  543. export ${var}="${!v}";
  544. echo "${!v}";
  545. return 0;
  546. fi;
  547. done;
  548. local search=;
  549. [[ -n $4 ]] && search=$(type -p $4-${prog[0]});
  550. [[ -z ${search} && -n ${!tuple} ]] && search=$(type -p ${!tuple}-${prog[0]});
  551. [[ -n ${search} ]] && prog[0]=${search##*/};
  552. export ${var}="${prog[*]}";
  553. echo "${!var}"
  554. }
  555. all-flag-vars ()
  556. {
  557. echo {ADA,C,CPP,CXX,CCAS,F,FC,LD}FLAGS
  558. }
  559. append-cflags ()
  560. {
  561. [[ $# -eq 0 ]] && return 0;
  562. export CFLAGS+=" $*";
  563. return 0
  564. }
  565. append-cppflags ()
  566. {
  567. [[ $# -eq 0 ]] && return 0;
  568. export CPPFLAGS+=" $*";
  569. return 0
  570. }
  571. append-cxxflags ()
  572. {
  573. [[ $# -eq 0 ]] && return 0;
  574. export CXXFLAGS+=" $*";
  575. return 0
  576. }
  577. append-fflags ()
  578. {
  579. [[ $# -eq 0 ]] && return 0;
  580. export FFLAGS+=" $*";
  581. export FCFLAGS+=" $*";
  582. return 0
  583. }
  584. append-flags ()
  585. {
  586. [[ $# -eq 0 ]] && return 0;
  587. case " $* " in
  588. *' '-[DIU]*)
  589. eqawarn 'please use append-cppflags for preprocessor flags'
  590. ;;
  591. *' '-L* | *' '-Wl,*)
  592. eqawarn 'please use append-ldflags for linker flags'
  593. ;;
  594. esac;
  595. append-cflags "$@";
  596. append-cxxflags "$@";
  597. append-fflags "$@";
  598. return 0
  599. }
  600. append-ldflags ()
  601. {
  602. [[ $# -eq 0 ]] && return 0;
  603. local flag;
  604. for flag in "$@";
  605. do
  606. [[ ${flag} == -l* ]] && eqawarn "Appending a library link instruction (${flag}); libraries to link to should not be passed through LDFLAGS";
  607. done;
  608. export LDFLAGS="${LDFLAGS} $*";
  609. return 0
  610. }
  611. append-lfs-flags ()
  612. {
  613. [[ $# -ne 0 ]] && die "append-lfs-flags takes no arguments";
  614. append-cppflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
  615. }
  616. append-libs ()
  617. {
  618. [[ $# -eq 0 ]] && return 0;
  619. local flag;
  620. for flag in "$@";
  621. do
  622. if [[ -z "${flag// }" ]]; then
  623. eqawarn "Appending an empty argument to LIBS is invalid! Skipping.";
  624. continue;
  625. fi;
  626. case $flag in
  627. -[lL]*)
  628. export LIBS="${LIBS} ${flag}"
  629. ;;
  630. -*)
  631. eqawarn "Appending non-library to LIBS (${flag}); Other linker flags should be passed via LDFLAGS";
  632. export LIBS="${LIBS} ${flag}"
  633. ;;
  634. *)
  635. export LIBS="${LIBS} -l${flag}"
  636. ;;
  637. esac;
  638. done;
  639. return 0
  640. }
  641. autotools_check_macro ()
  642. {
  643. [[ -f configure.ac || -f configure.in ]] || return 0;
  644. local trace_file=".__autoconf_trace_data";
  645. if [[ ! -e ${trace_file} ]] || [[ ! aclocal.m4 -ot ${trace_file} ]]; then
  646. WANT_AUTOCONF="2.5" autoconf $(autotools_m4dir_include) ${ALL_AUTOTOOLS_MACROS[@]/#/--trace=} > ${trace_file} 2> /dev/null;
  647. fi;
  648. local macro args=();
  649. for macro in "$@";
  650. do
  651. has ${macro} ${ALL_AUTOTOOLS_MACROS[@]} || die "internal error: add ${macro} to ALL_AUTOTOOLS_MACROS";
  652. args+=(-e ":${macro}:");
  653. done;
  654. grep "${args[@]}" ${trace_file}
  655. }
  656. autotools_check_macro_val ()
  657. {
  658. local macro scan_out;
  659. for macro in "$@";
  660. do
  661. autotools_check_macro "${macro}" | gawk -v macro="${macro}" '($0 !~ /^[[:space:]]*(#|dnl)/) {
  662. if (match($0, macro ":(.*)$", res))
  663. print res[1]
  664. }' | uniq;
  665. done;
  666. return 0
  667. }
  668. autotools_env_setup ()
  669. {
  670. if [[ ${WANT_AUTOMAKE} == "latest" ]]; then
  671. local pv;
  672. for pv in ${_LATEST_AUTOMAKE[@]/#*:};
  673. do
  674. ROOT=/ has_version "=sys-devel/automake-${pv}*" && export WANT_AUTOMAKE="${pv}" && break;
  675. done;
  676. [[ ${WANT_AUTOMAKE} == "latest" ]] && die "Cannot find the latest automake! Tried ${_LATEST_AUTOMAKE[*]}";
  677. fi;
  678. [[ ${WANT_AUTOCONF} == "latest" ]] && export WANT_AUTOCONF=2.5
  679. }
  680. autotools_m4dir_include ()
  681. {
  682. _autotools_m4dir_include ${AT_M4DIR}
  683. }
  684. autotools_m4sysdir_include ()
  685. {
  686. local paths=($(eval echo ${AT_SYS_M4DIR}));
  687. if [[ ${#paths[@]} -eq 0 && -n ${SYSROOT} ]]; then
  688. local path="${SYSROOT}/usr/share/aclocal";
  689. [[ -d ${path} ]] && paths+=("${path}");
  690. fi;
  691. _autotools_m4dir_include "${paths[@]}"
  692. }
  693. autotools_run_tool ()
  694. {
  695. local autofail=true m4flags=false missing_ok=false return_output=false;
  696. while [[ -n $1 ]]; do
  697. case $1 in
  698. --at-no-fail)
  699. autofail=false
  700. ;;
  701. --at-m4flags)
  702. m4flags=true
  703. ;;
  704. --at-missing)
  705. missing_ok=true
  706. ;;
  707. --at-output)
  708. return_output=true
  709. ;;
  710. *)
  711. break
  712. ;;
  713. esac;
  714. shift;
  715. done;
  716. if [[ ${EBUILD_PHASE} != "unpack" && ${EBUILD_PHASE} != "prepare" ]]; then
  717. ewarn "QA Warning: running $1 in ${EBUILD_PHASE} phase";
  718. fi;
  719. if ${missing_ok} && ! type -P ${1} > /dev/null; then
  720. einfo "Skipping '$*' due $1 not installed";
  721. return 0;
  722. fi;
  723. autotools_env_setup;
  724. local STDERR_TARGET="${T}/${1##*/}.out";
  725. if [[ -e ${STDERR_TARGET} ]]; then
  726. local i=1;
  727. while :; do
  728. STDERR_TARGET="${T}/${1##*/}-${i}.out";
  729. [[ -e ${STDERR_TARGET} ]] || break;
  730. : $(( i++ ));
  731. done;
  732. fi;
  733. if ${m4flags}; then
  734. set -- "${1}" $(autotools_m4dir_include) "${@:2}" $(autotools_m4sysdir_include);
  735. fi;
  736. if ${return_output}; then
  737. "$@";
  738. return;
  739. fi;
  740. printf "***** $1 *****\n***** PWD: ${PWD}\n***** $*\n\n" > "${STDERR_TARGET}";
  741. ebegin "Running $@";
  742. "$@" >> "${STDERR_TARGET}" 2>&1;
  743. if ! eend $? && ${autofail}; then
  744. echo;
  745. eerror "Failed Running $1 !";
  746. eerror;
  747. eerror "Include in your bugreport the contents of:";
  748. eerror;
  749. eerror " ${STDERR_TARGET}";
  750. echo;
  751. die "Failed Running $1 !";
  752. fi
  753. }
  754. clang-fullversion ()
  755. {
  756. _clang_fullversion '$1.$2.$3' "$@"
  757. }
  758. clang-major-version ()
  759. {
  760. _clang_fullversion '$1' "$@"
  761. }
  762. clang-micro-version ()
  763. {
  764. _clang_fullversion '$3' "$@"
  765. }
  766. clang-minor-version ()
  767. {
  768. _clang_fullversion '$2' "$@"
  769. }
  770. clang-version ()
  771. {
  772. _clang_fullversion '$1.$2' "$@"
  773. }
  774. config_rpath_update ()
  775. {
  776. local dst src=$(type -P gettext | sed 's:bin/gettext:share/gettext/config.rpath:');
  777. [[ $# -eq 0 ]] && set -- $(find -name config.rpath);
  778. [[ $# -eq 0 ]] && return 0;
  779. einfo "Updating all config.rpath files";
  780. for dst in "$@";
  781. do
  782. einfo " ${dst}";
  783. cp "${src}" "${dst}" || die;
  784. done
  785. }
  786. darwintoolize ()
  787. {
  788. die "Use elibtoolize"
  789. }
  790. doicon ()
  791. {
  792. _iconins ${FUNCNAME} "$@"
  793. }
  794. domenu ()
  795. {
  796. ( local i j ret=0;
  797. insinto /usr/share/applications;
  798. for i in "$@";
  799. do
  800. if [[ -f ${i} ]]; then
  801. doins "${i}";
  802. ((ret+=$?));
  803. else
  804. if [[ -d ${i} ]]; then
  805. for j in "${i}"/*.desktop;
  806. do
  807. doins "${j}";
  808. ((ret+=$?));
  809. done;
  810. else
  811. ((++ret));
  812. fi;
  813. fi;
  814. done;
  815. exit ${ret} )
  816. }
  817. eaclocal ()
  818. {
  819. [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && autotools_run_tool --at-m4flags aclocal "$@" $(eaclocal_amflags)
  820. }
  821. eaclocal_amflags ()
  822. {
  823. local aclocal_opts amflags_file;
  824. for amflags_file in GNUmakefile.am Makefile.am GNUmakefile.in Makefile.in;
  825. do
  826. [[ -e ${amflags_file} ]] || continue;
  827. autotools_env_setup;
  828. aclocal_opts=$(sed -n "/^ACLOCAL_AMFLAGS[[:space:]]*=/{ # match the first line
  829. s:[^=]*=::p; # then gobble up all escaped lines
  830. : nextline /\\\\$/{ n; p; b nextline; } }" ${amflags_file});
  831. eval aclocal_opts=\""${aclocal_opts}"\";
  832. break;
  833. done;
  834. echo ${aclocal_opts}
  835. }
  836. eapply ()
  837. {
  838. local failed patch_cmd=patch;
  839. local -x LC_COLLATE=POSIX;
  840. type -P gpatch > /dev/null && patch_cmd=gpatch;
  841. function _eapply_patch ()
  842. {
  843. local f=${1};
  844. local prefix=${2};
  845. started_applying=1;
  846. ebegin "${prefix:-Applying }${f##*/}";
  847. ${patch_cmd} -p1 -f -s -g0 --no-backup-if-mismatch "${patch_options[@]}" < "${f}";
  848. failed=${?};
  849. if ! eend "${failed}"; then
  850. __helpers_die "patch -p1 ${patch_options[*]} failed with ${f}";
  851. fi
  852. };
  853. local patch_options=() files=();
  854. local i found_doublehyphen;
  855. for ((i = 1; i <= ${#@}; ++i ))
  856. do
  857. if [[ ${@:i:1} == -- ]]; then
  858. patch_options=("${@:1:i-1}");
  859. files=("${@:i+1}");
  860. found_doublehyphen=1;
  861. break;
  862. fi;
  863. done;
  864. if [[ -z ${found_doublehyphen} ]]; then
  865. for ((i = 1; i <= ${#@}; ++i ))
  866. do
  867. if [[ ${@:i:1} != -* ]]; then
  868. patch_options=("${@:1:i-1}");
  869. files=("${@:i}");
  870. break;
  871. fi;
  872. done;
  873. for i in "${files[@]}";
  874. do
  875. if [[ ${i} == -* ]]; then
  876. die "eapply: all options must be passed before non-options";
  877. fi;
  878. done;
  879. fi;
  880. if [[ ${#files[@]} -eq 0 ]]; then
  881. die "eapply: no files specified";
  882. fi;
  883. local f;
  884. for f in "${files[@]}";
  885. do
  886. if [[ -d ${f} ]]; then
  887. function _eapply_get_files ()
  888. {
  889. local LC_ALL=POSIX;
  890. local prev_shopt=$(shopt -p nullglob);
  891. shopt -s nullglob;
  892. local f;
  893. for f in "${1}"/*;
  894. do
  895. if [[ ${f} == *.diff || ${f} == *.patch ]]; then
  896. files+=("${f}");
  897. fi;
  898. done;
  899. ${prev_shopt}
  900. };
  901. local files=();
  902. _eapply_get_files "${f}";
  903. [[ ${#files[@]} -eq 0 ]] && die "No *.{patch,diff} files in directory ${f}";
  904. einfo "Applying patches from ${f} ...";
  905. local f2;
  906. for f2 in "${files[@]}";
  907. do
  908. _eapply_patch "${f2}" ' ';
  909. [[ ${failed} -ne 0 ]] && return "${failed}";
  910. done;
  911. else
  912. _eapply_patch "${f}";
  913. [[ ${failed} -ne 0 ]] && return "${failed}";
  914. fi;
  915. done;
  916. return 0
  917. }
  918. eapply_user ()
  919. {
  920. [[ ${EBUILD_PHASE} == prepare ]] || die "eapply_user() called during invalid phase: ${EBUILD_PHASE}";
  921. local tagfile=${T}/.portage_user_patches_applied;
  922. [[ -f ${tagfile} ]] && return;
  923. >> "${tagfile}";
  924. local basedir=${PORTAGE_CONFIGROOT%/}/etc/portage/patches;
  925. local applied d f;
  926. local -A _eapply_user_patches;
  927. local prev_shopt=$(shopt -p nullglob);
  928. shopt -s nullglob;
  929. for d in "${basedir}"/${CATEGORY}/{${P}-${PR},${P},${PN}}{:${SLOT%/*},};
  930. do
  931. for f in "${d}"/*;
  932. do
  933. if [[ ( ${f} == *.diff || ${f} == *.patch ) && -z ${_eapply_user_patches[${f##*/}]} ]]; then
  934. _eapply_user_patches[${f##*/}]=${f};
  935. fi;
  936. done;
  937. done;
  938. if [[ ${#_eapply_user_patches[@]} -gt 0 ]]; then
  939. while read -r -d '' f; do
  940. f=${_eapply_user_patches[${f}]};
  941. if [[ -s ${f} ]]; then
  942. eapply "${f}";
  943. applied=1;
  944. fi;
  945. done < <(printf -- '%s\0' "${!_eapply_user_patches[@]}" |
  946. LC_ALL=C sort -z);
  947. fi;
  948. ${prev_shopt};
  949. [[ -n ${applied} ]] && ewarn "User patches applied."
  950. }
  951. eautoconf ()
  952. {
  953. if [[ ! -f configure.ac && ! -f configure.in ]]; then
  954. echo;
  955. eerror "No configure.{ac,in} present in '${PWD}'!";
  956. echo;
  957. die "No configure.{ac,in} present!";
  958. fi;
  959. if [[ ${WANT_AUTOCONF} != "2.1" && -e configure.in ]]; then
  960. eqawarn "This package has a configure.in file which has long been deprecated. Please";
  961. eqawarn "update it to use configure.ac instead as newer versions of autotools will die";
  962. eqawarn "when it finds this file. See https://bugs.gentoo.org/426262 for details.";
  963. fi;
  964. autotools_run_tool --at-m4flags autoconf "$@"
  965. }
  966. eautoheader ()
  967. {
  968. _at_uses_autoheader || return 0;
  969. autotools_run_tool --at-no-fail --at-m4flags autoheader "$@"
  970. }
  971. eautomake ()
  972. {
  973. local extra_opts=();
  974. local makefile_name;
  975. for makefile_name in {GNUmakefile,{M,m}akefile}.am "";
  976. do
  977. [[ -f ${makefile_name} ]] && break;
  978. done;
  979. function _automake_version ()
  980. {
  981. autotools_run_tool --at-output automake --version 2> /dev/null | sed -n -e '1{s:.*(GNU automake) ::p;q}'
  982. };
  983. if [[ -z ${makefile_name} ]]; then
  984. _at_uses_automake || return 0;
  985. else
  986. if [[ -z ${FROM_EAUTORECONF} && -f ${makefile_name%.am}.in ]]; then
  987. local used_automake;
  988. local installed_automake;
  989. installed_automake=$(WANT_AUTOMAKE= _automake_version);
  990. used_automake=$(head -n 1 < ${makefile_name%.am}.in | sed -e 's:.*by automake \(.*\) from .*:\1:');
  991. if [[ ${installed_automake} != ${used_automake} ]]; then
  992. ewarn "Automake used for the package (${used_automake}) differs from" "the installed version (${installed_automake}).";
  993. ewarn "Forcing a full rebuild of the autotools to workaround.";
  994. eautoreconf;
  995. return 0;
  996. fi;
  997. fi;
  998. fi;
  999. [[ -f INSTALL && -f AUTHORS && -f ChangeLog && -f NEWS && -f README ]] || extra_opts+=(--foreign);
  1000. case $(_automake_version) in
  1001. 1.4 | 1.4[.-]*)
  1002. ;;
  1003. *)
  1004. extra_opts+=(--force-missing)
  1005. ;;
  1006. esac;
  1007. autotools_run_tool automake --add-missing --copy "${extra_opts[@]}" "$@"
  1008. }
  1009. eautopoint ()
  1010. {
  1011. autotools_run_tool autopoint "$@"
  1012. }
  1013. eautoreconf ()
  1014. {
  1015. local x g;
  1016. if [[ -z ${AT_NO_RECURSIVE} ]]; then
  1017. for x in $(autotools_check_macro_val AC_CONFIG_SUBDIRS);
  1018. do
  1019. if [[ -d ${x} ]]; then
  1020. pushd "${x}" > /dev/null;
  1021. AT_NOELIBTOOLIZE="yes" eautoreconf || die;
  1022. popd > /dev/null;
  1023. fi;
  1024. done;
  1025. fi;
  1026. einfo "Running eautoreconf in '${PWD}' ...";
  1027. local m4dirs=$(autotools_check_macro_val AC_CONFIG_{AUX,MACRO}_DIR);
  1028. [[ -n ${m4dirs} ]] && mkdir -p ${m4dirs};
  1029. local i tools=(glibgettext false "autotools_run_tool glib-gettextize --copy --force" gettext false "autotools_run_tool --at-missing autopoint --force" intltool false "autotools_run_tool intltoolize --automake --copy --force" gtkdoc false "autotools_run_tool --at-missing gtkdocize --copy" gnomedoc false "autotools_run_tool --at-missing gnome-doc-prepare --copy --force" libtool false "_elibtoolize --auto-ltdl --install --copy --force");
  1030. for ((i = 0; i < ${#tools[@]}; i += 3 ))
  1031. do
  1032. if _at_uses_${tools[i]}; then
  1033. tools[i+1]=true;
  1034. ${tools[i+2]};
  1035. fi;
  1036. done;
  1037. local rerun_aclocal=false;
  1038. eaclocal;
  1039. for ((i = 0; i < ${#tools[@]}; i += 3 ))
  1040. do
  1041. if ! ${tools[i+1]} && _at_uses_${tools[i]}; then
  1042. ${tools[i+2]};
  1043. rerun_aclocal=true;
  1044. fi;
  1045. done;
  1046. ${rerun_aclocal} && eaclocal;
  1047. if [[ ${WANT_AUTOCONF} = 2.1 ]]; then
  1048. eautoconf;
  1049. else
  1050. eautoconf --force;
  1051. fi;
  1052. eautoheader;
  1053. [[ ${AT_NOEAUTOMAKE} != "yes" ]] && FROM_EAUTORECONF="yes" eautomake ${AM_OPTS};
  1054. if [[ ${AT_NOELIBTOOLIZE} != "yes" ]]; then
  1055. elibtoolize --force "${PWD}";
  1056. fi;
  1057. return 0
  1058. }
  1059. ebeep ()
  1060. {
  1061. ewarn "QA Notice: ebeep is not defined in EAPI=${EAPI}, please file a bug at https://bugs.gentoo.org"
  1062. }
  1063. econf_build ()
  1064. {
  1065. local CBUILD=${CBUILD:-${CHOST}};
  1066. tc-env_build econf --build=${CBUILD} --host=${CBUILD} "$@"
  1067. }
  1068. ecvs_clean ()
  1069. {
  1070. [[ $# -eq 0 ]] && set -- .;
  1071. find "$@" '(' -type d -name 'CVS' -prune -o -type f -name '.cvs*' ')' -exec rm -rf '{}' +
  1072. }
  1073. edos2unix ()
  1074. {
  1075. [[ $# -eq 0 ]] && return 0;
  1076. sed -i 's/\r$//' -- "$@" || die
  1077. }
  1078. egit_clean ()
  1079. {
  1080. [[ $# -eq 0 ]] && set -- .;
  1081. find "$@" -type d -name '.git*' -prune -exec rm -rf '{}' +
  1082. }
  1083. einstalldocs ()
  1084. {
  1085. ( if ! declare -p DOCS &> /dev/null; then
  1086. local d;
  1087. for d in README* ChangeLog AUTHORS NEWS TODO CHANGES THANKS BUGS FAQ CREDITS CHANGELOG;
  1088. do
  1089. [[ -f ${d} && -s ${d} ]] && docinto / && dodoc "${d}";
  1090. done;
  1091. else
  1092. if [[ $(declare -p DOCS) == "declare -a"* ]]; then
  1093. [[ ${#DOCS[@]} -gt 0 ]] && docinto / && dodoc -r "${DOCS[@]}";
  1094. else
  1095. [[ -n ${DOCS} ]] && docinto / && dodoc -r ${DOCS};
  1096. fi;
  1097. fi );
  1098. ( if [[ $(declare -p HTML_DOCS 2>/dev/null) == "declare -a"* ]]; then
  1099. [[ ${#HTML_DOCS[@]} -gt 0 ]] && docinto html && dodoc -r "${HTML_DOCS[@]}";
  1100. else
  1101. [[ -n ${HTML_DOCS} ]] && docinto html && dodoc -r ${HTML_DOCS};
  1102. fi )
  1103. }
  1104. elibtoolize ()
  1105. {
  1106. type -P eltpatch &> /dev/null || die "eltpatch not found; is app-portage/elt-patches installed?";
  1107. ELT_LOGDIR=${T} LD=$(tc-getLD) eltpatch "${@}" || die "eltpatch failed"
  1108. }
  1109. emktemp ()
  1110. {
  1111. local exe="touch";
  1112. [[ $1 == -d ]] && exe="mkdir" && shift;
  1113. local topdir=$1;
  1114. if [[ -z ${topdir} ]]; then
  1115. [[ -z ${T} ]] && topdir="/tmp" || topdir=${T};
  1116. fi;
  1117. if ! type -P mktemp > /dev/null; then
  1118. local tmp=/;
  1119. while [[ -e ${tmp} ]]; do
  1120. tmp=${topdir}/tmp.${RANDOM}.${RANDOM}.${RANDOM};
  1121. done;
  1122. ${exe} "${tmp}" || ${exe} -p "${tmp}";
  1123. echo "${tmp}";
  1124. else
  1125. if [[ ${exe} == "touch" ]]; then
  1126. TMPDIR="${topdir}" mktemp -t tmp.XXXXXXXXXX;
  1127. else
  1128. TMPDIR="${topdir}" mktemp -dt tmp.XXXXXXXXXX;
  1129. fi;
  1130. fi
  1131. }
  1132. epatch ()
  1133. {
  1134. function _epatch_draw_line ()
  1135. {
  1136. [[ -z $1 ]] && set "$(printf "%65s" '')";
  1137. echo "${1//?/=}"
  1138. };
  1139. unset P4CONFIG P4PORT P4USER;
  1140. local EPATCH_OPTS=(${EPATCH_OPTS[*]});
  1141. while [[ $# -gt 0 ]]; do
  1142. case $1 in
  1143. -*)
  1144. EPATCH_OPTS+=("$1")
  1145. ;;
  1146. *)
  1147. break
  1148. ;;
  1149. esac;
  1150. shift;
  1151. done;
  1152. if [[ $# -gt 1 ]]; then
  1153. local m;
  1154. for m in "$@";
  1155. do
  1156. epatch "${m}";
  1157. done;
  1158. return 0;
  1159. fi;
  1160. local SINGLE_PATCH="no";
  1161. [[ $# -eq 0 ]] && set -- "${EPATCH_SOURCE}";
  1162. if [[ -f $1 ]]; then
  1163. SINGLE_PATCH="yes";
  1164. set -- "$1";
  1165. local EPATCH_SUFFIX=$1;
  1166. else
  1167. if [[ -d $1 ]]; then
  1168. evar_push_set LC_COLLATE C;
  1169. set -- "$1"/*${EPATCH_SUFFIX:+."${EPATCH_SUFFIX}"};
  1170. evar_pop;
  1171. else
  1172. if [[ -f ${EPATCH_SOURCE}/$1 ]]; then
  1173. epatch "${EPATCH_SOURCE}/$1";
  1174. return $?;
  1175. else
  1176. [[ $# -ne 0 ]] && EPATCH_SOURCE=$1;
  1177. echo;
  1178. eerror "Cannot find \$EPATCH_SOURCE! Value for \$EPATCH_SOURCE is:";
  1179. eerror;
  1180. eerror " ${EPATCH_SOURCE}";
  1181. eerror " ( ${EPATCH_SOURCE##*/} )";
  1182. echo;
  1183. die "Cannot find \$EPATCH_SOURCE!";
  1184. fi;
  1185. fi;
  1186. fi;
  1187. EPATCH_OPTS="${EPATCH_COMMON_OPTS} ${EPATCH_OPTS[*]}";
  1188. local PIPE_CMD;
  1189. case ${EPATCH_SUFFIX##*\.} in
  1190. xz)
  1191. PIPE_CMD="xz -dc"
  1192. ;;
  1193. lzma)
  1194. PIPE_CMD="lzma -dc"
  1195. ;;
  1196. bz2)
  1197. PIPE_CMD="bzip2 -dc"
  1198. ;;
  1199. gz | Z | z)
  1200. PIPE_CMD="gzip -dc"
  1201. ;;
  1202. ZIP | zip)
  1203. PIPE_CMD="unzip -p"
  1204. ;;
  1205. *)
  1206. ;;
  1207. esac;
  1208. [[ ${SINGLE_PATCH} == "no" ]] && einfo "${EPATCH_MULTI_MSG}";
  1209. local x;
  1210. for x in "$@";
  1211. do
  1212. [[ ! -f ${x} ]] && continue;
  1213. local patchname=${x##*/};
  1214. local a=${patchname#*_};
  1215. a=${a%%_*};
  1216. if ! [[ ${SINGLE_PATCH} == "yes" || ${EPATCH_FORCE} == "yes" || ${a} == all || ${a} == ${ARCH} ]]; then
  1217. continue;
  1218. fi;
  1219. if [[ -n ${EPATCH_EXCLUDE}${EPATCH_USER_EXCLUDE} ]]; then
  1220. eshopts_push -o noglob;
  1221. local ex;
  1222. for ex in ${EPATCH_EXCLUDE};
  1223. do
  1224. if [[ ${patchname} == ${ex} ]]; then
  1225. einfo " Skipping ${patchname} due to EPATCH_EXCLUDE ...";
  1226. eshopts_pop;
  1227. continue 2;
  1228. fi;
  1229. done;
  1230. for ex in ${EPATCH_USER_EXCLUDE};
  1231. do
  1232. if [[ ${patchname} == ${ex} ]]; then
  1233. einfo " Skipping ${patchname} due to EPATCH_USER_EXCLUDE ...";
  1234. eshopts_pop;
  1235. continue 2;
  1236. fi;
  1237. done;
  1238. eshopts_pop;
  1239. fi;
  1240. if [[ ${SINGLE_PATCH} == "yes" ]]; then
  1241. if [[ -n ${EPATCH_SINGLE_MSG} ]]; then
  1242. einfo "${EPATCH_SINGLE_MSG}";
  1243. else
  1244. einfo "Applying ${patchname} ...";
  1245. fi;
  1246. else
  1247. einfo " ${patchname} ...";
  1248. fi;
  1249. local patch="patch";
  1250. eval $(alias patch 2>/dev/null | sed 's:^alias ::');
  1251. local STDERR_TARGET="${T}/${patchname}.out";
  1252. if [[ -e ${STDERR_TARGET} ]]; then
  1253. STDERR_TARGET="${T}/${patchname}-$$.out";
  1254. fi;
  1255. printf "***** %s *****\nPWD: %s\nPATCH TOOL: %s -> %s\nVERSION INFO:\n%s\n\n" "${patchname}" "${PWD}" "${patch}" "$(type -P "${patch}")" "$(${patch} --version)" > "${STDERR_TARGET}";
  1256. local count=0;
  1257. local PATCH_TARGET;
  1258. if [[ -n ${PIPE_CMD} ]]; then
  1259. PATCH_TARGET="${T}/$$.patch";
  1260. echo "PIPE_COMMAND: ${PIPE_CMD} ${x} > ${PATCH_TARGET}" >> "${STDERR_TARGET}";
  1261. if ! ( ${PIPE_CMD} "${x}" > "${PATCH_TARGET}" ) >> "${STDERR_TARGET}" 2>&1; then
  1262. echo;
  1263. eerror "Could not extract patch!";
  1264. count=5;
  1265. break;
  1266. fi;
  1267. else
  1268. PATCH_TARGET=${x};
  1269. fi;
  1270. local abs_paths=$(egrep -n '^[-+]{3} /' "${PATCH_TARGET}" | awk '$2 != "/dev/null" { print }');
  1271. if [[ -n ${abs_paths} ]]; then
  1272. count=1;
  1273. printf "NOTE: skipping -p0 due to absolute paths in patch:\n%s\n" "${abs_paths}" >> "${STDERR_TARGET}";
  1274. fi;
  1275. local rel_paths=$(egrep -n '^[-+]{3} [^ ]*[.][.]/' "${PATCH_TARGET}");
  1276. if [[ -n ${rel_paths} ]]; then
  1277. echo;
  1278. eerror "Rejected Patch: ${patchname} !";
  1279. eerror " ( ${PATCH_TARGET} )";
  1280. eerror;
  1281. eerror "Your patch uses relative paths '../':";
  1282. eerror "${rel_paths}";
  1283. echo;
  1284. die "you need to fix the relative paths in patch";
  1285. fi;
  1286. local patch_cmd;
  1287. while [[ ${count} -lt 5 ]]; do
  1288. patch_cmd="${patch} -p${count} ${EPATCH_OPTS}";
  1289. ( _epatch_draw_line "***** ${patchname} *****";
  1290. echo;
  1291. echo "PATCH COMMAND: ${patch_cmd} --dry-run -f < '${PATCH_TARGET}'";
  1292. echo;
  1293. _epatch_draw_line "***** ${patchname} *****";
  1294. ${patch_cmd} --dry-run -f < "${PATCH_TARGET}" 2>&1;
  1295. ret=$?;
  1296. echo;
  1297. echo "patch program exited with status ${ret}";
  1298. exit ${ret} ) >> "${STDERR_TARGET}";
  1299. if [ $? -eq 0 ]; then
  1300. ( _epatch_draw_line "***** ${patchname} *****";
  1301. echo;
  1302. echo "ACTUALLY APPLYING ${patchname} ...";
  1303. echo "PATCH COMMAND: ${patch_cmd} < '${PATCH_TARGET}'";
  1304. echo;
  1305. _epatch_draw_line "***** ${patchname} *****";
  1306. ${patch_cmd} < "${PATCH_TARGET}" 2>&1;
  1307. ret=$?;
  1308. echo;
  1309. echo "patch program exited with status ${ret}";
  1310. exit ${ret} ) >> "${STDERR_TARGET}";
  1311. if [ $? -ne 0 ]; then
  1312. echo;
  1313. eerror "A dry-run of patch command succeeded, but actually";
  1314. eerror "applying the patch failed!";
  1315. count=5;
  1316. fi;
  1317. break;
  1318. fi;
  1319. : $(( count++ ));
  1320. done;
  1321. (( EPATCH_N_APPLIED_PATCHES++ ));
  1322. if [[ -n ${PIPE_CMD} ]]; then
  1323. rm -f "${PATCH_TARGET}";
  1324. fi;
  1325. if [[ ${count} -ge 5 ]]; then
  1326. echo;
  1327. eerror "Failed Patch: ${patchname} !";
  1328. eerror " ( ${PATCH_TARGET} )";
  1329. eerror;
  1330. eerror "Include in your bugreport the contents of:";
  1331. eerror;
  1332. eerror " ${STDERR_TARGET}";
  1333. echo;
  1334. die "Failed Patch: ${patchname}!";
  1335. fi;
  1336. rm -f "${STDERR_TARGET}";
  1337. cat >> "${T}/epatch.log" <<-EOF
  1338. PATCH: ${x}
  1339. CMD: ${patch_cmd}
  1340. PWD: ${PWD}
  1341. EOF
  1342. eend 0;
  1343. done;
  1344. [[ ${SINGLE_PATCH} == "no" ]] && einfo "Done with patching";
  1345. :
  1346. }
  1347. epause ()
  1348. {
  1349. ewarn "QA Notice: epause is not defined in EAPI=${EAPI}, please file a bug at https://bugs.gentoo.org"
  1350. }
  1351. eshopts_pop ()
  1352. {
  1353. local s;
  1354. estack_pop eshopts s || die "${FUNCNAME}: unbalanced push";
  1355. eval "${s}" || die "${FUNCNAME}: sanity: invalid shopt options: ${s}"
  1356. }
  1357. eshopts_push ()
  1358. {
  1359. if [[ $1 == -[su] ]]; then
  1360. estack_push eshopts "$(shopt -p)";
  1361. [[ $# -eq 0 ]] && return 0;
  1362. shopt "$@" || die "${FUNCNAME}: bad options to shopt: $*";
  1363. else
  1364. estack_push eshopts "$(shopt -p -o)";
  1365. [[ $# -eq 0 ]] && return 0;
  1366. set "$@" || die "${FUNCNAME}: bad options to set: $*";
  1367. fi
  1368. }
  1369. estack_pop ()
  1370. {
  1371. [[ $# -eq 0 || $# -gt 2 ]] && die "estack_pop: incorrect # of arguments";
  1372. local _estack_name="_ESTACK_$1_";
  1373. shift;
  1374. local _estack_retvar=$1;
  1375. shift;
  1376. eval local _estack_i=\${#${_estack_name}\[@\]};
  1377. [[ $(( --_estack_i )) -eq -1 ]] && return 1;
  1378. if [[ -n ${_estack_retvar} ]]; then
  1379. eval ${_estack_retvar}=\"\${${_estack_name}\[${_estack_i}\]}\";
  1380. fi;
  1381. eval unset \"${_estack_name}\[${_estack_i}\]\"
  1382. }
  1383. estack_push ()
  1384. {
  1385. [[ $# -eq 0 ]] && die "estack_push: incorrect # of arguments";
  1386. local stack_name="_ESTACK_$1_";
  1387. shift;
  1388. eval ${stack_name}+=\( \"\$@\" \)
  1389. }
  1390. esvn_clean ()
  1391. {
  1392. [[ $# -eq 0 ]] && set -- .;
  1393. find "$@" -type d -name '.svn' -prune -exec rm -rf '{}' +
  1394. }
  1395. eumask_pop ()
  1396. {
  1397. [[ $# -eq 0 ]] || die "${FUNCNAME}: we take no options";
  1398. local s;
  1399. estack_pop eumask s || die "${FUNCNAME}: unbalanced push";
  1400. umask ${s} || die "${FUNCNAME}: sanity: could not restore umask: ${s}"
  1401. }
  1402. eumask_push ()
  1403. {
  1404. estack_push eumask "$(umask)";
  1405. umask "$@" || die "${FUNCNAME}: bad options to umask: $*"
  1406. }
  1407. evar_pop ()
  1408. {
  1409. local cnt=${1:-bad};
  1410. case $# in
  1411. 0)
  1412. cnt=1
  1413. ;;
  1414. 1)
  1415. isdigit "${cnt}" || die "${FUNCNAME}: first arg must be a number: $*"
  1416. ;;
  1417. *)
  1418. die "${FUNCNAME}: only accepts one arg: $*"
  1419. ;;
  1420. esac;
  1421. local var val;
  1422. while (( cnt-- )); do
  1423. estack_pop evar val || die "${FUNCNAME}: unbalanced push";
  1424. estack_pop evar var || die "${FUNCNAME}: unbalanced push";
  1425. [[ ${val} == "unset_76fc3c462065bb4ca959f939e6793f94" ]] && unset ${var} || printf -v "${var}" '%s' "${val}";
  1426. done
  1427. }
  1428. evar_push ()
  1429. {
  1430. local var val;
  1431. for var in "$@";
  1432. do
  1433. [[ ${!var+set} == "set" ]] && val=${!var} || val="unset_76fc3c462065bb4ca959f939e6793f94";
  1434. estack_push evar "${var}" "${val}";
  1435. done
  1436. }
  1437. evar_push_set ()
  1438. {
  1439. local var=$1;
  1440. evar_push ${var};
  1441. case $# in
  1442. 1)
  1443. unset ${var}
  1444. ;;
  1445. 2)
  1446. printf -v "${var}" '%s' "$2"
  1447. ;;
  1448. *)
  1449. die "${FUNCNAME}: incorrect # of args: $*"
  1450. ;;
  1451. esac
  1452. }
  1453. filter-flags ()
  1454. {
  1455. _filter-hardened "$@";
  1456. local v;
  1457. for v in $(all-flag-vars);
  1458. do
  1459. _filter-var ${v} "$@";
  1460. done;
  1461. return 0
  1462. }
  1463. filter-ldflags ()
  1464. {
  1465. _filter-var LDFLAGS "$@";
  1466. return 0
  1467. }
  1468. filter-lfs-flags ()
  1469. {
  1470. [[ $# -ne 0 ]] && die "filter-lfs-flags takes no arguments";
  1471. filter-flags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
  1472. }
  1473. filter-mfpmath ()
  1474. {
  1475. local orig_mfpmath new_math prune_math;
  1476. orig_mfpmath=$(get-flag -mfpmath);
  1477. new_math=$(get-flag mfpmath);
  1478. new_math=${new_math/both/387,sse};
  1479. new_math=" ${new_math//[,+]/ } ";
  1480. prune_math="";
  1481. for prune_math in "$@";
  1482. do
  1483. new_math=${new_math/ ${prune_math} / };
  1484. done;
  1485. new_math=$(echo ${new_math});
  1486. new_math=${new_math// /,};
  1487. if [[ -z ${new_math} ]]; then
  1488. filter-flags ${orig_mfpmath};
  1489. else
  1490. replace-flags ${orig_mfpmath} -mfpmath=${new_math};
  1491. fi;
  1492. return 0
  1493. }
  1494. gcc-fullversion ()
  1495. {
  1496. _gcc_fullversion '$1.$2.$3' "$@"
  1497. }
  1498. gcc-major-version ()
  1499. {
  1500. _gcc_fullversion '$1' "$@"
  1501. }
  1502. gcc-micro-version ()
  1503. {
  1504. _gcc_fullversion '$3' "$@"
  1505. }
  1506. gcc-minor-version ()
  1507. {
  1508. _gcc_fullversion '$2' "$@"
  1509. }
  1510. gcc-specs-directive ()
  1511. {
  1512. local directive subdname subdirective;
  1513. directive="$(_gcc-specs-directive_raw $1)";
  1514. while [[ ${directive} == *%\(*\)* ]]; do
  1515. subdname=${directive/*%\(};
  1516. subdname=${subdname/\)*};
  1517. subdirective="$(_gcc-specs-directive_raw ${subdname})";
  1518. directive="${directive//\%(${subdname})/${subdirective}}";
  1519. done;
  1520. echo "${directive}";
  1521. return 0
  1522. }
  1523. gcc-specs-nostrict ()
  1524. {
  1525. local directive;
  1526. directive=$(gcc-specs-directive cc1);
  1527. [[ "${directive/\{!fstrict-overflow:}" != "${directive}" ]]
  1528. }
  1529. gcc-specs-now ()
  1530. {
  1531. local directive;
  1532. directive=$(gcc-specs-directive link_command);
  1533. [[ "${directive/\{!nonow:}" != "${directive}" ]]
  1534. }
  1535. gcc-specs-pie ()
  1536. {
  1537. local directive;
  1538. directive=$(gcc-specs-directive cc1);
  1539. [[ "${directive/\{!nopie:}" != "${directive}" ]]
  1540. }
  1541. gcc-specs-relro ()
  1542. {
  1543. local directive;
  1544. directive=$(gcc-specs-directive link_command);
  1545. [[ "${directive/\{!norelro:}" != "${directive}" ]]
  1546. }
  1547. gcc-specs-ssp ()
  1548. {
  1549. local directive;
  1550. directive=$(gcc-specs-directive cc1);
  1551. [[ "${directive/\{!fno-stack-protector:}" != "${directive}" ]]
  1552. }
  1553. gcc-specs-ssp-to-all ()
  1554. {
  1555. local directive;
  1556. directive=$(gcc-specs-directive cc1);
  1557. [[ "${directive/\{!fno-stack-protector-all:}" != "${directive}" ]]
  1558. }
  1559. gcc-specs-stack-check ()
  1560. {
  1561. local directive;
  1562. directive=$(gcc-specs-directive cc1);
  1563. [[ "${directive/\{!fno-stack-check:}" != "${directive}" ]]
  1564. }
  1565. gcc-version ()
  1566. {
  1567. _gcc_fullversion '$1.$2' "$@"
  1568. }
  1569. gen_usr_ldscript ()
  1570. {
  1571. local lib libdir=$(get_libdir) output_format="" auto=false suffix=$(get_libname);
  1572. [[ -z ${ED+set} ]] && local ED=${D%/}${EPREFIX}/;
  1573. tc-is-static-only && return;
  1574. if [[ $(type -t multilib_is_native_abi) == "function" ]]; then
  1575. multilib_is_native_abi || return 0;
  1576. fi;
  1577. case ${CTARGET:-${CHOST}} in
  1578. *-darwin*)
  1579. ;;
  1580. *-android*)
  1581. return 0
  1582. ;;
  1583. *linux* | *-freebsd* | *-openbsd* | *-netbsd*)
  1584. use prefix && return 0
  1585. ;;
  1586. *)
  1587. return 0
  1588. ;;
  1589. esac;
  1590. dodir /usr/${libdir};
  1591. if [[ $1 == "-a" ]]; then
  1592. auto=true;
  1593. shift;
  1594. dodir /${libdir};
  1595. fi;
  1596. local flags=(${CFLAGS} ${LDFLAGS} -Wl,--verbose);
  1597. if $(tc-getLD) --version | grep -q 'GNU gold'; then
  1598. local d="${T}/bfd-linker";
  1599. mkdir -p "${d}";
  1600. ln -sf $(which ${CHOST}-ld.bfd) "${d}"/ld;
  1601. flags+=(-B"${d}");
  1602. fi;
  1603. output_format=$($(tc-getCC) "${flags[@]}" 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p');
  1604. [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )";
  1605. for lib in "$@";
  1606. do
  1607. local tlib;
  1608. if ${auto}; then
  1609. lib="lib${lib}${suffix}";
  1610. else
  1611. [[ -r ${ED}/${libdir}/${lib} ]] || continue;
  1612. fi;
  1613. case ${CTARGET:-${CHOST}} in
  1614. *-darwin*)
  1615. if ${auto}; then
  1616. tlib=$(scanmacho -qF'%S#F' "${ED}"/usr/${libdir}/${lib});
  1617. else
  1618. tlib=$(scanmacho -qF'%S#F' "${ED}"/${libdir}/${lib});
  1619. fi;
  1620. [[ -z ${tlib} ]] && die "unable to read install_name from ${lib}";
  1621. tlib=${tlib##*/};
  1622. if ${auto}; then
  1623. mv "${ED}"/usr/${libdir}/${lib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die;
  1624. if [[ ${tlib} != ${lib%${suffix}}.*${suffix#.} ]]; then
  1625. mv "${ED}"/usr/${libdir}/${tlib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die;
  1626. fi;
  1627. rm -f "${ED}"/${libdir}/${lib};
  1628. fi;
  1629. if [[ ! -w "${ED}/${libdir}/${tlib}" ]]; then
  1630. chmod u+w "${ED}${libdir}/${tlib}";
  1631. local nowrite=yes;
  1632. fi;
  1633. install_name_tool -id "${EPREFIX}"/${libdir}/${tlib} "${ED}"/${libdir}/${tlib} || die "install_name_tool failed";
  1634. [[ -n ${nowrite} ]] && chmod u-w "${ED}${libdir}/${tlib}";
  1635. pushd "${ED}/usr/${libdir}" > /dev/null;
  1636. ln -snf "../../${libdir}/${tlib}" "${lib}";
  1637. popd > /dev/null
  1638. ;;
  1639. *)
  1640. if ${auto}; then
  1641. tlib=$(scanelf -qF'%S#F' "${ED}"/usr/${libdir}/${lib});
  1642. [[ -z ${tlib} ]] && die "unable to read SONAME from ${lib}";
  1643. mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die;
  1644. if [[ ${tlib} != ${lib}* ]]; then
  1645. mv "${ED}"/usr/${libdir}/${tlib}* "${ED}"/${libdir}/ || die;
  1646. fi;
  1647. rm -f "${ED}"/${libdir}/${lib};
  1648. else
  1649. tlib=${lib};
  1650. fi;
  1651. cat > "${ED}/usr/${libdir}/${lib}" <<-END_LDSCRIPT
  1652. /* GNU ld script
  1653. Since Gentoo has critical dynamic libraries in /lib, and the static versions
  1654. in /usr/lib, we need to have a "fake" dynamic lib in /usr/lib, otherwise we
  1655. run into linking problems. This "fake" dynamic lib is a linker script that
  1656. redirects the linker to the real lib. And yes, this works in the cross-
  1657. compiling scenario as the sysroot-ed linker will prepend the real path.
  1658. See bug https://bugs.gentoo.org/4411 for more info.
  1659. */
  1660. ${output_format}
  1661. GROUP ( ${EPREFIX}/${libdir}/${tlib} )
  1662. END_LDSCRIPT
  1663. ;;
  1664. esac
  1665. fperms a+x "/usr/${libdir}/${lib}" || die "could not change perms on ${lib}";
  1666. done
  1667. }
  1668. get-flag ()
  1669. {
  1670. local f var findflag="$1";
  1671. for var in $(all-flag-vars);
  1672. do
  1673. for f in ${!var};
  1674. do
  1675. if [ "${f/${findflag}}" != "${f}" ]; then
  1676. printf "%s\n" "${f/-${findflag}=}";
  1677. return 0;
  1678. fi;
  1679. done;
  1680. done;
  1681. return 1
  1682. }
  1683. get_abi_CFLAGS ()
  1684. {
  1685. get_abi_var CFLAGS "$@"
  1686. }
  1687. get_abi_CHOST ()
  1688. {
  1689. get_abi_var CHOST "$@"
  1690. }
  1691. get_abi_CTARGET ()
  1692. {
  1693. get_abi_var CTARGET "$@"
  1694. }
  1695. get_abi_FAKE_TARGETS ()
  1696. {
  1697. get_abi_var FAKE_TARGETS "$@"
  1698. }
  1699. get_abi_LDFLAGS ()
  1700. {
  1701. get_abi_var LDFLAGS "$@"
  1702. }
  1703. get_abi_LIBDIR ()
  1704. {
  1705. get_abi_var LIBDIR "$@"
  1706. }
  1707. get_abi_var ()
  1708. {
  1709. local flag=$1;
  1710. local abi=${2:-${ABI:-${DEFAULT_ABI:-default}}};
  1711. local var="${flag}_${abi}";
  1712. echo ${!var}
  1713. }
  1714. get_all_abis ()
  1715. {
  1716. local x order="" mvar dvar;
  1717. mvar="MULTILIB_ABIS";
  1718. dvar="DEFAULT_ABI";
  1719. if [[ -n $1 ]]; then
  1720. mvar="$1_${mvar}";
  1721. dvar="$1_${dvar}";
  1722. fi;
  1723. if [[ -z ${!mvar} ]]; then
  1724. echo "default";
  1725. return 0;
  1726. fi;
  1727. for x in ${!mvar};
  1728. do
  1729. if [[ ${x} != ${!dvar} ]]; then
  1730. order="${order:+${order} }${x}";
  1731. fi;
  1732. done;
  1733. order="${order:+${order} }${!dvar}";
  1734. echo ${order};
  1735. return 0
  1736. }
  1737. get_all_libdirs ()
  1738. {
  1739. local libdirs abi;
  1740. for abi in ${MULTILIB_ABIS};
  1741. do
  1742. libdirs+=" $(get_abi_LIBDIR ${abi})";
  1743. done;
  1744. [[ " ${libdirs} " != *" lib "* ]] && libdirs+=" lib";
  1745. echo "${libdirs}"
  1746. }
  1747. get_exeext ()
  1748. {
  1749. case ${CHOST} in
  1750. *-cygwin* | mingw* | *-mingw*)
  1751. echo ".exe"
  1752. ;;
  1753. esac
  1754. }
  1755. get_install_abis ()
  1756. {
  1757. local x order="";
  1758. if [[ -z ${MULTILIB_ABIS} ]]; then
  1759. echo "default";
  1760. return 0;
  1761. fi;
  1762. if [[ ${EMULTILIB_PKG} == "true" ]]; then
  1763. for x in ${MULTILIB_ABIS};
  1764. do
  1765. if [[ ${x} != "${DEFAULT_ABI}" ]]; then
  1766. has ${x} ${ABI_DENY} || order="${order} ${x}";
  1767. fi;
  1768. done;
  1769. has ${DEFAULT_ABI} ${ABI_DENY} || order="${order} ${DEFAULT_ABI}";
  1770. if [[ -n ${ABI_ALLOW} ]]; then
  1771. local ordera="";
  1772. for x in ${order};
  1773. do
  1774. if has ${x} ${ABI_ALLOW}; then
  1775. ordera="${ordera} ${x}";
  1776. fi;
  1777. done;
  1778. order=${ordera};
  1779. fi;
  1780. else
  1781. order=${DEFAULT_ABI};
  1782. fi;
  1783. if [[ -z ${order} ]]; then
  1784. 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.";
  1785. fi;
  1786. echo ${order};
  1787. return 0
  1788. }
  1789. get_libdir ()
  1790. {
  1791. local libdir_var="LIBDIR_${ABI}";
  1792. local libdir="lib";
  1793. [[ -n ${ABI} && -n ${!libdir_var} ]] && libdir=${!libdir_var};
  1794. echo "${libdir}"
  1795. }
  1796. get_libname ()
  1797. {
  1798. local libname;
  1799. local ver=$1;
  1800. case ${CHOST} in
  1801. *-cygwin*)
  1802. libname="dll.a"
  1803. ;;
  1804. mingw* | *-mingw*)
  1805. libname="dll"
  1806. ;;
  1807. *-darwin*)
  1808. libname="dylib"
  1809. ;;
  1810. *-mint*)
  1811. libname="irrelevant"
  1812. ;;
  1813. hppa*-hpux*)
  1814. libname="sl"
  1815. ;;
  1816. *)
  1817. libname="so"
  1818. ;;
  1819. esac;
  1820. if [[ -z $* ]]; then
  1821. echo ".${libname}";
  1822. else
  1823. for ver in "$@";
  1824. do
  1825. case ${CHOST} in
  1826. *-cygwin*)
  1827. echo ".${ver}.${libname}"
  1828. ;;
  1829. *-darwin*)
  1830. echo ".${ver}.${libname}"
  1831. ;;
  1832. *-mint*)
  1833. echo ".${libname}"
  1834. ;;
  1835. *)
  1836. echo ".${libname}.${ver}"
  1837. ;;
  1838. esac;
  1839. done;
  1840. fi
  1841. }
  1842. get_modname ()
  1843. {
  1844. local modname;
  1845. local ver=$1;
  1846. case ${CHOST} in
  1847. *-darwin*)
  1848. modname="bundle"
  1849. ;;
  1850. *)
  1851. modname="so"
  1852. ;;
  1853. esac;
  1854. echo ".${modname}"
  1855. }
  1856. has_m32 ()
  1857. {
  1858. die "${FUNCNAME}: don't use this anymore"
  1859. }
  1860. has_m64 ()
  1861. {
  1862. die "${FUNCNAME}: don't use this anymore"
  1863. }
  1864. has_multilib_profile ()
  1865. {
  1866. [ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ]
  1867. }
  1868. in_iuse ()
  1869. {
  1870. local use=${1};
  1871. if [[ -z "${use}" ]]; then
  1872. echo "!!! in_iuse() called without a parameter." 1>&2;
  1873. echo "!!! in_iuse <USEFLAG>" 1>&2;
  1874. die "in_iuse() called without a parameter";
  1875. fi;
  1876. local liuse=(${IUSE_EFFECTIVE});
  1877. has "${use}" "${liuse[@]#[+-]}"
  1878. }
  1879. is-flag ()
  1880. {
  1881. is-flagq "$@" && echo true
  1882. }
  1883. is-flagq ()
  1884. {
  1885. [[ -n $2 ]] && die "Usage: is-flag <flag>";
  1886. local var;
  1887. for var in $(all-flag-vars);
  1888. do
  1889. _is_flagq ${var} "$1" && return 0;
  1890. done;
  1891. return 1
  1892. }
  1893. is-ldflag ()
  1894. {
  1895. is-ldflagq "$@" && echo true
  1896. }
  1897. is-ldflagq ()
  1898. {
  1899. [[ -n $2 ]] && die "Usage: is-ldflag <flag>";
  1900. _is_flagq LDFLAGS $1
  1901. }
  1902. is_final_abi ()
  1903. {
  1904. has_multilib_profile || return 0;
  1905. set -- $(get_install_abis);
  1906. local LAST_ABI=$#;
  1907. [[ ${!LAST_ABI} == ${ABI} ]]
  1908. }
  1909. isdigit ()
  1910. {
  1911. local d;
  1912. for d in "$@";
  1913. do
  1914. [[ ${d:-bad} == *[!0-9]* ]] && return 1;
  1915. done;
  1916. return 0
  1917. }
  1918. make_desktop_entry ()
  1919. {
  1920. [[ -z $1 ]] && die "make_desktop_entry: You must specify the executable";
  1921. local exec=${1};
  1922. local name=${2:-${PN}};
  1923. local icon=${3:-${PN}};
  1924. local type=${4};
  1925. local fields=${5};
  1926. if [[ -z ${type} ]]; then
  1927. local catmaj=${CATEGORY%%-*};
  1928. local catmin=${CATEGORY##*-};
  1929. case ${catmaj} in
  1930. app)
  1931. case ${catmin} in
  1932. accessibility)
  1933. type="Utility;Accessibility"
  1934. ;;
  1935. admin)
  1936. type=System
  1937. ;;
  1938. antivirus)
  1939. type=System
  1940. ;;
  1941. arch)
  1942. type="Utility;Archiving"
  1943. ;;
  1944. backup)
  1945. type="Utility;Archiving"
  1946. ;;
  1947. cdr)
  1948. type="AudioVideo;DiscBurning"
  1949. ;;
  1950. dicts)
  1951. type="Office;Dictionary"
  1952. ;;
  1953. doc)
  1954. type=Documentation
  1955. ;;
  1956. editors)
  1957. type="Utility;TextEditor"
  1958. ;;
  1959. emacs)
  1960. type="Development;TextEditor"
  1961. ;;
  1962. emulation)
  1963. type="System;Emulator"
  1964. ;;
  1965. laptop)
  1966. type="Settings;HardwareSettings"
  1967. ;;
  1968. office)
  1969. type=Office
  1970. ;;
  1971. pda)
  1972. type="Office;PDA"
  1973. ;;
  1974. vim)
  1975. type="Development;TextEditor"
  1976. ;;
  1977. xemacs)
  1978. type="Development;TextEditor"
  1979. ;;
  1980. esac
  1981. ;;
  1982. dev)
  1983. type="Development"
  1984. ;;
  1985. games)
  1986. case ${catmin} in
  1987. action | fps)
  1988. type=ActionGame
  1989. ;;
  1990. arcade)
  1991. type=ArcadeGame
  1992. ;;
  1993. board)
  1994. type=BoardGame
  1995. ;;
  1996. emulation)
  1997. type=Emulator
  1998. ;;
  1999. kids)
  2000. type=KidsGame
  2001. ;;
  2002. puzzle)
  2003. type=LogicGame
  2004. ;;
  2005. roguelike)
  2006. type=RolePlaying
  2007. ;;
  2008. rpg)
  2009. type=RolePlaying
  2010. ;;
  2011. simulation)
  2012. type=Simulation
  2013. ;;
  2014. sports)
  2015. type=SportsGame
  2016. ;;
  2017. strategy)
  2018. type=StrategyGame
  2019. ;;
  2020. esac;
  2021. type="Game;${type}"
  2022. ;;
  2023. gnome)
  2024. type="Gnome;GTK"
  2025. ;;
  2026. kde)
  2027. type="KDE;Qt"
  2028. ;;
  2029. mail)
  2030. type="Network;Email"
  2031. ;;
  2032. media)
  2033. case ${catmin} in
  2034. gfx)
  2035. type=Graphics
  2036. ;;
  2037. *)
  2038. case ${catmin} in
  2039. radio)
  2040. type=Tuner
  2041. ;;
  2042. sound)
  2043. type=Audio
  2044. ;;
  2045. tv)
  2046. type=TV
  2047. ;;
  2048. video)
  2049. type=Video
  2050. ;;
  2051. esac;
  2052. type="AudioVideo;${type}"
  2053. ;;
  2054. esac
  2055. ;;
  2056. net)
  2057. case ${catmin} in
  2058. dialup)
  2059. type=Dialup
  2060. ;;
  2061. ftp)
  2062. type=FileTransfer
  2063. ;;
  2064. im)
  2065. type=InstantMessaging
  2066. ;;
  2067. irc)
  2068. type=IRCClient
  2069. ;;
  2070. mail)
  2071. type=Email
  2072. ;;
  2073. news)
  2074. type=News
  2075. ;;
  2076. nntp)
  2077. type=News
  2078. ;;
  2079. p2p)
  2080. type=FileTransfer
  2081. ;;
  2082. voip)
  2083. type=Telephony
  2084. ;;
  2085. esac;
  2086. type="Network;${type}"
  2087. ;;
  2088. sci)
  2089. case ${catmin} in
  2090. astro*)
  2091. type=Astronomy
  2092. ;;
  2093. bio*)
  2094. type=Biology
  2095. ;;
  2096. calc*)
  2097. type=Calculator
  2098. ;;
  2099. chem*)
  2100. type=Chemistry
  2101. ;;
  2102. elec*)
  2103. type=Electronics
  2104. ;;
  2105. geo*)
  2106. type=Geology
  2107. ;;
  2108. math*)
  2109. type=Math
  2110. ;;
  2111. physics)
  2112. type=Physics
  2113. ;;
  2114. visual*)
  2115. type=DataVisualization
  2116. ;;
  2117. esac;
  2118. type="Education;Science;${type}"
  2119. ;;
  2120. sys)
  2121. type="System"
  2122. ;;
  2123. www)
  2124. case ${catmin} in
  2125. client)
  2126. type=WebBrowser
  2127. ;;
  2128. esac;
  2129. type="Network;${type}"
  2130. ;;
  2131. *)
  2132. type=
  2133. ;;
  2134. esac;
  2135. fi;
  2136. local slot=${SLOT%/*};
  2137. if [[ ${slot} == "0" ]]; then
  2138. local desktop_name="${PN}";
  2139. else
  2140. local desktop_name="${PN}-${slot}";
  2141. fi;
  2142. local desktop="${T}/$(echo ${exec} | sed 's:[[:space:]/:]:_:g')-${desktop_name}.desktop";
  2143. type=${type%;}${type:+;};
  2144. if [[ -n ${icon} && ${icon} != /* ]] && [[ ${icon} == *.xpm || ${icon} == *.png || ${icon} == *.svg ]]; then
  2145. ewarn "As described in the Icon Theme Specification, icon file extensions are not";
  2146. ewarn "allowed in .desktop files if the value is not an absolute path.";
  2147. icon=${icon%.*};
  2148. fi;
  2149. cat > "${desktop}" <<-EOF
  2150. [Desktop Entry]
  2151. Name=${name}
  2152. Type=Application
  2153. Comment=${DESCRIPTION}
  2154. Exec=${exec}
  2155. TryExec=${exec%% *}
  2156. Icon=${icon}
  2157. Categories=${type}
  2158. EOF
  2159. if [[ ${fields:-=} != *=* ]]; then
  2160. ewarn "make_desktop_entry: update your 5th arg to read Path=${fields}";
  2161. fields="Path=${fields}";
  2162. fi;
  2163. [[ -n ${fields} ]] && printf '%b\n' "${fields}" >> "${desktop}";
  2164. ( insinto /usr/share/applications;
  2165. doins "${desktop}" ) || die "installing desktop file failed"
  2166. }
  2167. make_session_desktop ()
  2168. {
  2169. [[ -z $1 ]] && eerror "$0: You must specify the title" && return 1;
  2170. [[ -z $2 ]] && eerror "$0: You must specify the command" && return 1;
  2171. local title=$1;
  2172. local command=$2;
  2173. local desktop=${T}/${wm:-${PN}}.desktop;
  2174. shift 2;
  2175. cat > "${desktop}" <<-EOF
  2176. [Desktop Entry]
  2177. Name=${title}
  2178. Comment=This session logs you into ${title}
  2179. Exec=${command} $*
  2180. TryExec=${command}
  2181. Type=XSession
  2182. EOF
  2183. ( insinto /usr/share/xsessions;
  2184. doins "${desktop}" )
  2185. }
  2186. make_wrapper ()
  2187. {
  2188. local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5;
  2189. local tmpwrapper=$(emktemp);
  2190. has "${EAPI:-0}" 0 1 2 && local EPREFIX="";
  2191. ( echo '#!/bin/sh';
  2192. [[ -n ${chdir} ]] && printf 'cd "%s"\n' "${EPREFIX}${chdir}";
  2193. if [[ -n ${libdir} ]]; then
  2194. local var;
  2195. if [[ ${CHOST} == *-darwin* ]]; then
  2196. var=DYLD_LIBRARY_PATH;
  2197. else
  2198. var=LD_LIBRARY_PATH;
  2199. fi;
  2200. cat <<-EOF
  2201. if [ "\${${var}+set}" = "set" ] ; then
  2202. export ${var}="\${${var}}:${EPREFIX}${libdir}"
  2203. else
  2204. export ${var}="${EPREFIX}${libdir}"
  2205. fi
  2206. EOF
  2207. fi
  2208. printf 'exec %s "$@"\n' "${bin/#\//${EPREFIX}/}" ) > "${tmpwrapper}";
  2209. chmod go+rx "${tmpwrapper}";
  2210. if [[ -n ${path} ]]; then
  2211. ( exeinto "${path}";
  2212. newexe "${tmpwrapper}" "${wrapper}" ) || die;
  2213. else
  2214. newbin "${tmpwrapper}" "${wrapper}" || die;
  2215. fi
  2216. }
  2217. multibuild_copy_sources ()
  2218. {
  2219. debug-print-function ${FUNCNAME} "${@}";
  2220. local _MULTIBUILD_INITIAL_BUILD_DIR=${BUILD_DIR:-${S}};
  2221. einfo "Will copy sources from ${_MULTIBUILD_INITIAL_BUILD_DIR}";
  2222. local cp_args=();
  2223. if cp --reflink=auto --version &> /dev/null; then
  2224. cp_args+=(--reflink=auto);
  2225. fi;
  2226. function _multibuild_create_source_copy ()
  2227. {
  2228. einfo "${MULTIBUILD_VARIANT}: copying to ${BUILD_DIR}";
  2229. cp -p -R "${cp_args[@]}" "${_MULTIBUILD_INITIAL_BUILD_DIR}" "${BUILD_DIR}" || die
  2230. };
  2231. multibuild_foreach_variant _multibuild_create_source_copy
  2232. }
  2233. multibuild_for_best_variant ()
  2234. {
  2235. debug-print-function ${FUNCNAME} "${@}";
  2236. [[ -n ${MULTIBUILD_VARIANTS} ]] || die "MULTIBUILD_VARIANTS need to be set";
  2237. local MULTIBUILD_VARIANTS=("${MULTIBUILD_VARIANTS[$(( ${#MULTIBUILD_VARIANTS[@]} - 1 ))]}");
  2238. multibuild_foreach_variant "${@}"
  2239. }
  2240. multibuild_foreach_variant ()
  2241. {
  2242. debug-print-function ${FUNCNAME} "${@}";
  2243. [[ -n ${MULTIBUILD_VARIANTS} ]] || die "MULTIBUILD_VARIANTS need to be set";
  2244. local bdir=${BUILD_DIR:-${S}};
  2245. [[ ${bdir%%/} == ${WORKDIR%%/} ]] && bdir=${WORKDIR}/build;
  2246. local prev_id=${MULTIBUILD_ID:+${MULTIBUILD_ID}-};
  2247. local ret=0 lret=0 v;
  2248. debug-print "${FUNCNAME}: initial build_dir = ${bdir}";
  2249. for v in "${MULTIBUILD_VARIANTS[@]}";
  2250. do
  2251. local MULTIBUILD_VARIANT=${v};
  2252. local MULTIBUILD_ID=${prev_id}${v};
  2253. local BUILD_DIR=${bdir%%/}-${v};
  2254. function _multibuild_run ()
  2255. {
  2256. local i=1;
  2257. while [[ ${!i} == _* ]]; do
  2258. (( i += 1 ));
  2259. done;
  2260. [[ ${i} -le ${#} ]] && einfo "${v}: running ${@:${i}}";
  2261. "${@}"
  2262. };
  2263. _multibuild_run "${@}" > >(exec tee -a "${T}/build-${MULTIBUILD_ID}.log") 2>&1;
  2264. lret=${?};
  2265. done;
  2266. [[ ${ret} -eq 0 && ${lret} -ne 0 ]] && ret=${lret};
  2267. return ${ret}
  2268. }
  2269. multibuild_merge_root ()
  2270. {
  2271. local src=${1};
  2272. local dest=${2};
  2273. local ret;
  2274. if use userland_BSD; then
  2275. tar -C "${src}" -f - -c . | tar -x -f - -C "${dest}";
  2276. [[ ${PIPESTATUS[*]} == '0 0' ]];
  2277. ret=${?};
  2278. else
  2279. local cp_args=();
  2280. if cp -a --version &> /dev/null; then
  2281. cp_args+=(-a);
  2282. else
  2283. cp_args+=(-P -R -p);
  2284. fi;
  2285. if cp --reflink=auto --version &> /dev/null; then
  2286. cp_args+=(--reflink=auto);
  2287. fi;
  2288. cp "${cp_args[@]}" "${src}"/. "${dest}"/;
  2289. ret=${?};
  2290. fi;
  2291. if [[ ${ret} -ne 0 ]]; then
  2292. die "${MULTIBUILD_VARIANT:-(unknown)}: merging image failed.";
  2293. fi;
  2294. rm -rf "${src}"
  2295. }
  2296. multibuild_parallel_foreach_variant ()
  2297. {
  2298. debug-print-function ${FUNCNAME} "${@}";
  2299. [[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}";
  2300. multibuild_foreach_variant "${@}"
  2301. }
  2302. multilib-minimal_abi_src_configure ()
  2303. {
  2304. debug-print-function ${FUNCNAME} "$@";
  2305. mkdir -p "${BUILD_DIR}" || die;
  2306. pushd "${BUILD_DIR}" > /dev/null || die;
  2307. if declare -f multilib_src_configure > /dev/null; then
  2308. multilib_src_configure;
  2309. else
  2310. default_src_configure;
  2311. fi;
  2312. popd > /dev/null || die
  2313. }
  2314. multilib-minimal_src_compile ()
  2315. {
  2316. debug-print-function ${FUNCNAME} "$@";
  2317. function multilib-minimal_abi_src_compile ()
  2318. {
  2319. debug-print-function ${FUNCNAME} "$@";
  2320. pushd "${BUILD_DIR}" > /dev/null || die;
  2321. if declare -f multilib_src_compile > /dev/null; then
  2322. multilib_src_compile;
  2323. else
  2324. default_src_compile;
  2325. fi;
  2326. popd > /dev/null || die
  2327. };
  2328. multilib_foreach_abi multilib-minimal_abi_src_compile
  2329. }
  2330. multilib-minimal_src_configure ()
  2331. {
  2332. debug-print-function ${FUNCNAME} "$@";
  2333. function multilib-minimal_abi_src_configure ()
  2334. {
  2335. debug-print-function ${FUNCNAME} "$@";
  2336. mkdir -p "${BUILD_DIR}" || die;
  2337. pushd "${BUILD_DIR}" > /dev/null || die;
  2338. if declare -f multilib_src_configure > /dev/null; then
  2339. multilib_src_configure;
  2340. else
  2341. default_src_configure;
  2342. fi;
  2343. popd > /dev/null || die
  2344. };
  2345. multilib_foreach_abi multilib-minimal_abi_src_configure
  2346. }
  2347. multilib-minimal_src_install ()
  2348. {
  2349. debug-print-function ${FUNCNAME} "$@";
  2350. function multilib-minimal_abi_src_install ()
  2351. {
  2352. debug-print-function ${FUNCNAME} "$@";
  2353. pushd "${BUILD_DIR}" > /dev/null || die;
  2354. if declare -f multilib_src_install > /dev/null; then
  2355. multilib_src_install;
  2356. else
  2357. if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then
  2358. emake DESTDIR="${D}" install;
  2359. fi;
  2360. fi;
  2361. multilib_prepare_wrappers;
  2362. multilib_check_headers;
  2363. popd > /dev/null || die
  2364. };
  2365. multilib_foreach_abi multilib-minimal_abi_src_install;
  2366. multilib_install_wrappers;
  2367. if declare -f multilib_src_install_all > /dev/null; then
  2368. multilib_src_install_all;
  2369. else
  2370. einstalldocs;
  2371. fi
  2372. }
  2373. multilib-minimal_src_test ()
  2374. {
  2375. debug-print-function ${FUNCNAME} "$@";
  2376. function multilib-minimal_abi_src_test ()
  2377. {
  2378. debug-print-function ${FUNCNAME} "$@";
  2379. pushd "${BUILD_DIR}" > /dev/null || die;
  2380. if declare -f multilib_src_test > /dev/null; then
  2381. multilib_src_test;
  2382. else
  2383. default_src_test;
  2384. fi;
  2385. popd > /dev/null || die
  2386. };
  2387. multilib_foreach_abi multilib-minimal_abi_src_test
  2388. }
  2389. multilib_build_binaries ()
  2390. {
  2391. debug-print-function ${FUNCNAME} "${@}";
  2392. [[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}, use multilib_is_native_abi() instead";
  2393. eqawarn "QA warning: multilib_build_binaries is deprecated. Please use the equivalent";
  2394. eqawarn "multilib_is_native_abi function instead.";
  2395. multilib_is_native_abi "${@}"
  2396. }
  2397. multilib_check_headers ()
  2398. {
  2399. function _multilib_header_cksum ()
  2400. {
  2401. set -o pipefail;
  2402. if [[ -d ${ED}usr/include ]]; then
  2403. find "${ED}"usr/include -type f -exec cksum {} + | sort -k2;
  2404. fi
  2405. };
  2406. local cksum cksum_prev;
  2407. local cksum_file=${T}/.multilib_header_cksum;
  2408. cksum=$(_multilib_header_cksum) || die;
  2409. unset -f _multilib_header_cksum;
  2410. if [[ -f ${cksum_file} ]]; then
  2411. cksum_prev=$(< "${cksum_file}") || die;
  2412. if [[ ${cksum} != ${cksum_prev} ]]; then
  2413. echo "${cksum}" > "${cksum_file}.new" || die;
  2414. eerror "Header files have changed between ABIs.";
  2415. if type -p diff &> /dev/null; then
  2416. eerror "$(diff -du "${cksum_file}" "${cksum_file}.new")";
  2417. else
  2418. eerror "Old checksums in: ${cksum_file}";
  2419. eerror "New checksums in: ${cksum_file}.new";
  2420. fi;
  2421. die "Header checksum mismatch, aborting.";
  2422. fi;
  2423. else
  2424. echo "${cksum}" > "${cksum_file}" || die;
  2425. fi
  2426. }
  2427. multilib_copy_sources ()
  2428. {
  2429. debug-print-function ${FUNCNAME} "${@}";
  2430. local MULTIBUILD_VARIANTS=($(multilib_get_enabled_abi_pairs));
  2431. multibuild_copy_sources
  2432. }
  2433. multilib_env ()
  2434. {
  2435. local CTARGET=${1:-${CTARGET}};
  2436. local cpu=${CTARGET%%*-};
  2437. case ${cpu} in
  2438. aarch64*)
  2439. export CFLAGS_arm=${CFLAGS_arm-};
  2440. case ${cpu} in
  2441. aarch64*be)
  2442. export CHOST_arm="armv8b-${CTARGET#*-}"
  2443. ;;
  2444. *)
  2445. export CHOST_arm="armv8l-${CTARGET#*-}"
  2446. ;;
  2447. esac;
  2448. CHOST_arm=${CHOST_arm/%-gnu/-gnueabi};
  2449. export CTARGET_arm=${CHOST_arm};
  2450. export LIBDIR_arm="lib";
  2451. export CFLAGS_arm64=${CFLAGS_arm64-};
  2452. export CHOST_arm64=${CTARGET};
  2453. export CTARGET_arm64=${CHOST_arm64};
  2454. export LIBDIR_arm64="lib64";
  2455. : ${MULTILIB_ABIS=arm64};
  2456. : ${DEFAULT_ABI=arm64}
  2457. ;;
  2458. x86_64*)
  2459. export CFLAGS_x86=${CFLAGS_x86--m32};
  2460. export CHOST_x86=${CTARGET/x86_64/i686};
  2461. CHOST_x86=${CHOST_x86/%-gnux32/-gnu};
  2462. export CTARGET_x86=${CHOST_x86};
  2463. if [[ ${SYMLINK_LIB} == "yes" ]]; then
  2464. export LIBDIR_x86="lib32";
  2465. else
  2466. export LIBDIR_x86="lib";
  2467. fi;
  2468. export CFLAGS_amd64=${CFLAGS_amd64--m64};
  2469. export CHOST_amd64=${CTARGET/%-gnux32/-gnu};
  2470. export CTARGET_amd64=${CHOST_amd64};
  2471. export LIBDIR_amd64="lib64";
  2472. export CFLAGS_x32=${CFLAGS_x32--mx32};
  2473. export CHOST_x32=${CTARGET/%-gnu/-gnux32};
  2474. export CTARGET_x32=${CHOST_x32};
  2475. export LIBDIR_x32="libx32";
  2476. case ${CTARGET} in
  2477. *-gnux32)
  2478. : ${MULTILIB_ABIS=x32 amd64 x86};
  2479. : ${DEFAULT_ABI=x32}
  2480. ;;
  2481. *)
  2482. : ${MULTILIB_ABIS=amd64 x86};
  2483. : ${DEFAULT_ABI=amd64}
  2484. ;;
  2485. esac
  2486. ;;
  2487. mips64*)
  2488. export CFLAGS_o32=${CFLAGS_o32--mabi=32};
  2489. export CHOST_o32=${CTARGET/mips64/mips};
  2490. export CTARGET_o32=${CHOST_o32};
  2491. export LIBDIR_o32="lib";
  2492. export CFLAGS_n32=${CFLAGS_n32--mabi=n32};
  2493. export CHOST_n32=${CTARGET};
  2494. export CTARGET_n32=${CHOST_n32};
  2495. export LIBDIR_n32="lib32";
  2496. export CFLAGS_n64=${CFLAGS_n64--mabi=64};
  2497. export CHOST_n64=${CTARGET};
  2498. export CTARGET_n64=${CHOST_n64};
  2499. export LIBDIR_n64="lib64";
  2500. : ${MULTILIB_ABIS=n64 n32 o32};
  2501. : ${DEFAULT_ABI=n32}
  2502. ;;
  2503. powerpc64*)
  2504. export CFLAGS_ppc=${CFLAGS_ppc--m32};
  2505. export CHOST_ppc=${CTARGET/powerpc64/powerpc};
  2506. export CTARGET_ppc=${CHOST_ppc};
  2507. export LIBDIR_ppc="lib";
  2508. export CFLAGS_ppc64=${CFLAGS_ppc64--m64};
  2509. export CHOST_ppc64=${CTARGET};
  2510. export CTARGET_ppc64=${CHOST_ppc64};
  2511. export LIBDIR_ppc64="lib64";
  2512. : ${MULTILIB_ABIS=ppc64 ppc};
  2513. : ${DEFAULT_ABI=ppc64}
  2514. ;;
  2515. s390x*)
  2516. export CFLAGS_s390=${CFLAGS_s390--m31};
  2517. export CHOST_s390=${CTARGET/s390x/s390};
  2518. export CTARGET_s390=${CHOST_s390};
  2519. export LIBDIR_s390="lib";
  2520. export CFLAGS_s390x=${CFLAGS_s390x--m64};
  2521. export CHOST_s390x=${CTARGET};
  2522. export CTARGET_s390x=${CHOST_s390x};
  2523. export LIBDIR_s390x="lib64";
  2524. : ${MULTILIB_ABIS=s390x s390};
  2525. : ${DEFAULT_ABI=s390x}
  2526. ;;
  2527. sparc64*)
  2528. export CFLAGS_sparc32=${CFLAGS_sparc32--m32};
  2529. export CHOST_sparc32=${CTARGET/sparc64/sparc};
  2530. export CTARGET_sparc32=${CHOST_sparc32};
  2531. export LIBDIR_sparc32="lib";
  2532. export CFLAGS_sparc64=${CFLAGS_sparc64--m64};
  2533. export CHOST_sparc64=${CTARGET};
  2534. export CTARGET_sparc64=${CHOST_sparc64};
  2535. export LIBDIR_sparc64="lib64";
  2536. : ${MULTILIB_ABIS=sparc64 sparc32};
  2537. : ${DEFAULT_ABI=sparc64}
  2538. ;;
  2539. *)
  2540. : ${MULTILIB_ABIS=default};
  2541. : ${DEFAULT_ABI=default}
  2542. ;;
  2543. esac;
  2544. export MULTILIB_ABIS DEFAULT_ABI
  2545. }
  2546. multilib_for_best_abi ()
  2547. {
  2548. debug-print-function ${FUNCNAME} "${@}";
  2549. [[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}, use multilib_is_native_abi() instead";
  2550. eqawarn "QA warning: multilib_for_best_abi() function is deprecated and should";
  2551. eqawarn "not be used. The multilib_is_native_abi() check may be used instead.";
  2552. local MULTIBUILD_VARIANTS=($(multilib_get_enabled_abi_pairs));
  2553. multibuild_for_best_variant _multilib_multibuild_wrapper "${@}"
  2554. }
  2555. multilib_foreach_abi ()
  2556. {
  2557. debug-print-function ${FUNCNAME} "${@}";
  2558. local MULTIBUILD_VARIANTS=($(multilib_get_enabled_abi_pairs));
  2559. multibuild_foreach_variant _multilib_multibuild_wrapper "${@}"
  2560. }
  2561. multilib_get_enabled_abi_pairs ()
  2562. {
  2563. debug-print-function ${FUNCNAME} "${@}";
  2564. local abis=($(get_all_abis));
  2565. local abi i found;
  2566. for abi in "${abis[@]}";
  2567. do
  2568. for i in "${_MULTILIB_FLAGS[@]}";
  2569. do
  2570. local m_abis=${i#*:} m_abi;
  2571. local m_flag=${i%:*};
  2572. for m_abi in ${m_abis//,/ };
  2573. do
  2574. if [[ ${m_abi} == ${abi} ]] && {
  2575. [[ ! -n "${MULTILIB_COMPAT[@]}" ]] || has "${m_flag}" "${MULTILIB_COMPAT[@]}"
  2576. } && use "${m_flag}"; then
  2577. echo "${m_flag}.${abi}";
  2578. found=1;
  2579. break 2;
  2580. fi;
  2581. done;
  2582. done;
  2583. done;
  2584. if [[ ! -n ${found} ]]; then
  2585. local abi=${ABI:-${DEFAULT_ABI}};
  2586. debug-print "${FUNCNAME}: no ABIs enabled, fallback to ${abi}";
  2587. debug-print "${FUNCNAME}: ABI=${ABI}, DEFAULT_ABI=${DEFAULT_ABI}";
  2588. echo ".${abi}";
  2589. fi
  2590. }
  2591. multilib_get_enabled_abis ()
  2592. {
  2593. debug-print-function ${FUNCNAME} "${@}";
  2594. local pairs=($(multilib_get_enabled_abi_pairs));
  2595. echo "${pairs[@]#*.}"
  2596. }
  2597. multilib_install_wrappers ()
  2598. {
  2599. debug-print-function ${FUNCNAME} "${@}";
  2600. [[ ${#} -le 1 ]] || die "${FUNCNAME}: too many arguments";
  2601. [[ ${COMPLETE_MULTILIB} == yes ]] && return;
  2602. local root=${1:-${ED}};
  2603. if [[ -d "${ED}"/tmp/multilib-include ]]; then
  2604. multibuild_merge_root "${ED}"/tmp/multilib-include "${root}"/usr/include;
  2605. rmdir "${ED}"/tmp &> /dev/null;
  2606. fi
  2607. }
  2608. multilib_is_native_abi ()
  2609. {
  2610. debug-print-function ${FUNCNAME} "${@}";
  2611. [[ ${#} -eq 0 ]] || die "${FUNCNAME}: too many arguments";
  2612. [[ ${COMPLETE_MULTILIB} == yes || ${ABI} == ${DEFAULT_ABI} ]]
  2613. }
  2614. multilib_native_enable ()
  2615. {
  2616. if multilib_is_native_abi; then
  2617. echo "--enable-${1}${2+=${2}}";
  2618. else
  2619. echo "--disable-${1}";
  2620. fi
  2621. }
  2622. multilib_native_use_enable ()
  2623. {
  2624. if multilib_is_native_abi; then
  2625. use_enable "${@}";
  2626. else
  2627. echo "--disable-${2:-${1}}";
  2628. fi
  2629. }
  2630. multilib_native_use_with ()
  2631. {
  2632. if multilib_is_native_abi; then
  2633. use_with "${@}";
  2634. else
  2635. echo "--without-${2:-${1}}";
  2636. fi
  2637. }
  2638. multilib_native_usex ()
  2639. {
  2640. if multilib_is_native_abi; then
  2641. usex "${@}";
  2642. else
  2643. echo "${3-no}${5}";
  2644. fi
  2645. }
  2646. multilib_native_with ()
  2647. {
  2648. if multilib_is_native_abi; then
  2649. echo "--with-${1}${2+=${2}}";
  2650. else
  2651. echo "--without-${1}";
  2652. fi
  2653. }
  2654. multilib_parallel_foreach_abi ()
  2655. {
  2656. debug-print-function ${FUNCNAME} "${@}";
  2657. local MULTIBUILD_VARIANTS=($(multilib_get_enabled_abi_pairs));
  2658. multibuild_foreach_variant _multilib_multibuild_wrapper "${@}"
  2659. }
  2660. multilib_prepare_wrappers ()
  2661. {
  2662. debug-print-function ${FUNCNAME} "${@}";
  2663. [[ ${#} -le 1 ]] || die "${FUNCNAME}: too many arguments";
  2664. local root=${1:-${ED}};
  2665. local f;
  2666. if [[ ${COMPLETE_MULTILIB} == yes ]]; then
  2667. for f in "${MULTILIB_CHOST_TOOLS[@]}";
  2668. do
  2669. f=${f#/};
  2670. local dir=${f%/*};
  2671. local fn=${f##*/};
  2672. ln -s "${fn}" "${root}/${dir}/${CHOST}-${fn}" || die;
  2673. done;
  2674. return;
  2675. fi;
  2676. for f in "${MULTILIB_CHOST_TOOLS[@]}";
  2677. do
  2678. f=${f#/};
  2679. local dir=${f%/*};
  2680. local fn=${f##*/};
  2681. if [[ -L ${root}/${f} ]]; then
  2682. local target;
  2683. target=$(readlink "${root}/${f}") || die;
  2684. local target_dir target_fn=${target##*/};
  2685. [[ ${target} == */* ]] && target_dir=${target%/*};
  2686. ln -f -s "${target_dir+${target_dir}/}${CHOST}-${target_fn}" "${root}/${f}" || die;
  2687. fi;
  2688. mv "${root}/${f}" "${root}/${dir}/${CHOST}-${fn}" || die;
  2689. if multilib_is_native_abi; then
  2690. ln -s "${CHOST}-${fn}" "${root}/${f}" || die;
  2691. fi;
  2692. done;
  2693. if [[ -n ${MULTILIB_WRAPPED_HEADERS[@]} ]]; then
  2694. if [[ -n ${MULTILIB_ABI_FLAG} ]]; then
  2695. for f in "${MULTILIB_WRAPPED_HEADERS[@]}";
  2696. do
  2697. f=${f#/};
  2698. if [[ ${f} != usr/include/* ]]; then
  2699. die "Wrapping headers outside of /usr/include is not supported at the moment.";
  2700. fi;
  2701. f=${f#usr/include};
  2702. local dir=${f%/*};
  2703. if [[ -f ${root}/usr/include${f} ]]; then
  2704. local wrapper=${ED}/tmp/multilib-include${f};
  2705. if [[ ! -f ${ED}/tmp/multilib-include${f} ]]; then
  2706. dodir "/tmp/multilib-include${dir}";
  2707. cat > "${wrapper}" <<_EOF_ ||
  2708. /* This file is auto-generated by multilib-build.eclass
  2709. * as a multilib-friendly wrapper. For the original content,
  2710. * please see the files that are #included below.
  2711. */
  2712. #if defined(__x86_64__) /* amd64 */
  2713. # if defined(__ILP32__) /* x32 ABI */
  2714. # error "abi_x86_x32 not supported by the package."
  2715. # else /* 64-bit ABI */
  2716. # error "abi_x86_64 not supported by the package."
  2717. # endif
  2718. #elif defined(__i386__) /* plain x86 */
  2719. # error "abi_x86_32 not supported by the package."
  2720. #elif defined(__mips__)
  2721. # if(_MIPS_SIM == _ABIN32) /* n32 */
  2722. # error "abi_mips_n32 not supported by the package."
  2723. # elif(_MIPS_SIM == _ABI64) /* n64 */
  2724. # error "abi_mips_n64 not supported by the package."
  2725. # elif(_MIPS_SIM == _ABIO32) /* o32 */
  2726. # error "abi_mips_o32 not supported by the package."
  2727. # endif
  2728. #elif defined(__sparc__)
  2729. # if defined(__arch64__)
  2730. # error "abi_sparc_64 not supported by the package."
  2731. # else
  2732. # error "abi_sparc_32 not supported by the package."
  2733. # endif
  2734. #elif defined(__s390__)
  2735. # if defined(__s390x__)
  2736. # error "abi_s390_64 not supported by the package."
  2737. # else
  2738. # error "abi_s390_32 not supported by the package."
  2739. # endif
  2740. #elif defined(__powerpc__) || defined(__ppc__)
  2741. # if defined(__powerpc64__) || defined(__ppc64__)
  2742. # error "abi_ppc_64 not supported by the package."
  2743. # else
  2744. # error "abi_ppc_32 not supported by the package."
  2745. # endif
  2746. #elif defined(SWIG) /* https://sourceforge.net/p/swig/bugs/799/ */
  2747. # error "Native ABI not supported by the package."
  2748. #else
  2749. # error "No ABI matched, please report a bug to bugs.gentoo.org"
  2750. #endif
  2751. _EOF_
  2752. die;
  2753. fi
  2754. if ! grep -q "${MULTILIB_ABI_FLAG} " "${wrapper}"; then
  2755. die "Flag ${MULTILIB_ABI_FLAG} not listed in wrapper template. Please report a bug to https://bugs.gentoo.org.";
  2756. fi;
  2757. dodir "/tmp/multilib-include/${CHOST}${dir}";
  2758. mv "${root}/usr/include${f}" "${ED}/tmp/multilib-include/${CHOST}${dir}/" || die;
  2759. sed -e "/${MULTILIB_ABI_FLAG} /s&error.*&include <${CHOST}${f}>&" -i "${wrapper}" || die;
  2760. if multilib_is_native_abi; then
  2761. sed -e "/Native ABI/s&error.*&include <${CHOST}${f}>&" -i "${wrapper}" || die;
  2762. fi;
  2763. fi;
  2764. done;
  2765. fi;
  2766. fi
  2767. }
  2768. multilib_src_configure ()
  2769. {
  2770. local myopts;
  2771. [[ ${CHOST} == *-interix* ]] && append-flags -D_REENTRANT;
  2772. use elibc_FreeBSD && myopts+=" --disable-symbol-lookup";
  2773. [[ ${CHOST} == *-darwin* ]] && myopts+=" --disable-symbol-lookup";
  2774. if ! multilib_is_native_abi; then
  2775. myopts+=" --disable-qt";
  2776. fi;
  2777. ECONF_SOURCE="${S}" econf --disable-dependency-tracking $(use_with X x) $(use_enable X tee) $(use_enable X xlib) $(use_enable X xlib-xrender) $(use_enable aqua quartz) $(use_enable aqua quartz-image) $(use_enable debug test-surfaces) $(use_enable gles2 glesv2) $(use_enable glib gobject) $(use_enable opengl gl) $(use_enable static-libs static) $(use_enable svg) $(use_enable valgrind) $(use_enable xcb) $(use_enable xcb xcb-shm) --enable-ft --enable-pdf --enable-png --enable-ps --disable-drm --disable-directfb --disable-gallium --disable-qt --disable-vg --disable-xlib-xcb ${myopts}
  2778. }
  2779. multilib_src_install_all ()
  2780. {
  2781. prune_libtool_files --all;
  2782. einstalldocs
  2783. }
  2784. multilib_toolchain_setup ()
  2785. {
  2786. local v vv;
  2787. export ABI=$1;
  2788. if [[ ${_DEFAULT_ABI_SAVED} == "true" ]]; then
  2789. for v in CHOST CBUILD AS CC CXX F77 FC LD PKG_CONFIG_{LIBDIR,PATH};
  2790. do
  2791. vv="_abi_saved_${v}";
  2792. [[ ${!vv+set} == "set" ]] && export ${v}="${!vv}" || unset ${v};
  2793. unset ${vv};
  2794. done;
  2795. unset _DEFAULT_ABI_SAVED;
  2796. fi;
  2797. if [[ ${ABI} != ${DEFAULT_ABI} ]]; then
  2798. for v in CHOST CBUILD AS CC CXX F77 FC LD PKG_CONFIG_{LIBDIR,PATH};
  2799. do
  2800. vv="_abi_saved_${v}";
  2801. [[ ${!v+set} == "set" ]] && export ${vv}="${!v}" || unset ${vv};
  2802. done;
  2803. export _DEFAULT_ABI_SAVED="true";
  2804. if [[ ${CBUILD} == "${CHOST}" ]]; then
  2805. export CBUILD=$(get_abi_CHOST $1);
  2806. fi;
  2807. export CHOST=$(get_abi_CHOST ${DEFAULT_ABI});
  2808. export CC="$(tc-getCC) $(get_abi_CFLAGS)";
  2809. export CXX="$(tc-getCXX) $(get_abi_CFLAGS)";
  2810. export F77="$(tc-getF77) $(get_abi_CFLAGS)";
  2811. export FC="$(tc-getFC) $(get_abi_CFLAGS)";
  2812. export LD="$(tc-getLD) $(get_abi_LDFLAGS)";
  2813. export CHOST=$(get_abi_CHOST $1);
  2814. export PKG_CONFIG_LIBDIR=${EPREFIX}/usr/$(get_libdir)/pkgconfig;
  2815. export PKG_CONFIG_PATH=${EPREFIX}/usr/share/pkgconfig;
  2816. fi
  2817. }
  2818. newicon ()
  2819. {
  2820. _iconins ${FUNCNAME} "$@"
  2821. }
  2822. newmenu ()
  2823. {
  2824. ( insinto /usr/share/applications;
  2825. newins "$@" )
  2826. }
  2827. no-as-needed ()
  2828. {
  2829. case $($(tc-getLD) -v 2>&1 </dev/null) in
  2830. *GNU*)
  2831. echo "-Wl,--no-as-needed"
  2832. ;;
  2833. esac
  2834. }
  2835. number_abis ()
  2836. {
  2837. set -- `get_install_abis`;
  2838. echo $#
  2839. }
  2840. optfeature ()
  2841. {
  2842. debug-print-function ${FUNCNAME} "$@";
  2843. local i j msg;
  2844. local desc=$1;
  2845. local flag=0;
  2846. shift;
  2847. for i in "$@";
  2848. do
  2849. for j in ${i};
  2850. do
  2851. if has_version "${j}"; then
  2852. flag=1;
  2853. else
  2854. flag=0;
  2855. break;
  2856. fi;
  2857. done;
  2858. if [[ ${flag} -eq 1 ]]; then
  2859. break;
  2860. fi;
  2861. done;
  2862. if [[ ${flag} -eq 0 ]]; then
  2863. for i in "$@";
  2864. do
  2865. msg=" ";
  2866. for j in ${i};
  2867. do
  2868. msg+=" ${j} and";
  2869. done;
  2870. msg="${msg:0: -4} for ${desc}";
  2871. elog "${msg}";
  2872. done;
  2873. fi
  2874. }
  2875. path_exists ()
  2876. {
  2877. local opt=$1;
  2878. [[ ${opt} == -[ao] ]] && shift || opt="-a";
  2879. [[ $# -eq 0 ]] && return 1;
  2880. local p r=0;
  2881. for p in "$@";
  2882. do
  2883. [[ -e ${p} ]];
  2884. : $(( r += $? ));
  2885. done;
  2886. case ${opt} in
  2887. -a)
  2888. return $(( r != 0 ))
  2889. ;;
  2890. -o)
  2891. return $(( r == $# ))
  2892. ;;
  2893. esac
  2894. }
  2895. pkg_nofetch ()
  2896. {
  2897. default
  2898. }
  2899. preserve_old_lib ()
  2900. {
  2901. if [[ ${EBUILD_PHASE} != "preinst" ]]; then
  2902. eerror "preserve_old_lib() must be called from pkg_preinst() only";
  2903. die "Invalid preserve_old_lib() usage";
  2904. fi;
  2905. [[ -z $1 ]] && die "Usage: preserve_old_lib <library to preserve> [more libraries to preserve]";
  2906. has preserve-libs ${FEATURES} && return 0;
  2907. has "${EAPI:-0}" 0 1 2 && local ED=${D} EROOT=${ROOT};
  2908. local lib dir;
  2909. for lib in "$@";
  2910. do
  2911. [[ -e ${EROOT}/${lib} ]] || continue;
  2912. dir=${lib%/*};
  2913. dodir ${dir} || die "dodir ${dir} failed";
  2914. cp "${EROOT}"/${lib} "${ED}"/${lib} || die "cp ${lib} failed";
  2915. touch "${ED}"/${lib};
  2916. done
  2917. }
  2918. preserve_old_lib_notify ()
  2919. {
  2920. if [[ ${EBUILD_PHASE} != "postinst" ]]; then
  2921. eerror "preserve_old_lib_notify() must be called from pkg_postinst() only";
  2922. die "Invalid preserve_old_lib_notify() usage";
  2923. fi;
  2924. has preserve-libs ${FEATURES} && return 0;
  2925. has "${EAPI:-0}" 0 1 2 && local EROOT=${ROOT};
  2926. local lib notice=0;
  2927. for lib in "$@";
  2928. do
  2929. [[ -e ${EROOT}/${lib} ]] || continue;
  2930. if [[ ${notice} -eq 0 ]]; then
  2931. notice=1;
  2932. ewarn "Old versions of installed libraries were detected on your system.";
  2933. ewarn "In order to avoid breaking packages that depend on these old libs,";
  2934. ewarn "the libraries are not being removed. You need to run revdep-rebuild";
  2935. ewarn "in order to remove these old dependencies. If you do not have this";
  2936. ewarn "helper program, simply emerge the 'gentoolkit' package.";
  2937. ewarn;
  2938. fi;
  2939. ewarn " # revdep-rebuild --library '${lib}' && rm '${lib}'";
  2940. done
  2941. }
  2942. prune_libtool_files ()
  2943. {
  2944. debug-print-function ${FUNCNAME} "$@";
  2945. local removing_all removing_modules opt;
  2946. for opt in "$@";
  2947. do
  2948. case "${opt}" in
  2949. --all)
  2950. removing_all=1;
  2951. removing_modules=1
  2952. ;;
  2953. --modules)
  2954. removing_modules=1
  2955. ;;
  2956. *)
  2957. die "Invalid argument to ${FUNCNAME}(): ${opt}"
  2958. ;;
  2959. esac;
  2960. done;
  2961. local f;
  2962. local queue=();
  2963. while IFS= read -r -d '' f; do
  2964. local archivefile=${f/%.la/.a};
  2965. if ! sed -n -e '/^# Generated by .*libtool/q0;4q1' "${f}"; then
  2966. continue;
  2967. fi;
  2968. [[ ${f} != ${archivefile} ]] || die 'regex sanity check failed';
  2969. local reason= pkgconfig_scanned=;
  2970. local snotlink=$(sed -n -e 's:^shouldnotlink=::p' "${f}");
  2971. if [[ ${snotlink} == yes ]]; then
  2972. if [[ -f ${archivefile} ]]; then
  2973. einfo "Removing unnecessary ${archivefile#${D%/}} (static plugin)";
  2974. queue+=("${archivefile}");
  2975. fi;
  2976. if [[ -n ${removing_modules} ]]; then
  2977. reason='module';
  2978. fi;
  2979. else
  2980. if [[ -n ${removing_all} ]]; then
  2981. reason='requested';
  2982. else
  2983. if [[ ! -f ${archivefile} ]]; then
  2984. reason='no static archive';
  2985. else
  2986. if [[ ! -n $(sed -nre "s/^(dependency_libs|inherited_linker_flags)='(.*)'$/\2/p" "${f}") ]]; then
  2987. reason='no libs & flags';
  2988. else
  2989. if [[ ! -n ${pkgconfig_scanned} ]]; then
  2990. local pc_libs=();
  2991. if [[ ! -n ${removing_all} ]]; then
  2992. local pc;
  2993. local tf=${T}/prune-lt-files.pc;
  2994. local pkgconf=$(tc-getPKG_CONFIG);
  2995. while IFS= read -r -d '' pc; do
  2996. local arg libs;
  2997. if ${pkgconf} --exists "${pc}" &> /dev/null; then
  2998. sed -e '/^Requires:/d' "${pc}" > "${tf}";
  2999. libs=$(${pkgconf} --libs "${tf}");
  3000. else
  3001. libs=$(sed -ne 's/^Libs://p' "${pc}");
  3002. fi;
  3003. for arg in ${libs};
  3004. do
  3005. if [[ ${arg} == -l* ]]; then
  3006. if [[ ${arg} == '*$*' ]]; then
  3007. eerror "${FUNCNAME}: variable substitution likely failed in ${pc}";
  3008. eerror "(arg: ${arg})";
  3009. eerror "Most likely, you need to add virtual/pkgconfig to DEPEND.";
  3010. die "${FUNCNAME}: unsubstituted variable found in .pc";
  3011. fi;
  3012. pc_libs+=(lib${arg#-l}.la);
  3013. fi;
  3014. done;
  3015. done < <(find "${D}" -type f -name '*.pc' -print0);
  3016. rm -f "${tf}";
  3017. fi;
  3018. pkgconfig_scanned=1;
  3019. fi;
  3020. has "${f##*/}" "${pc_libs[@]}" && reason='covered by .pc';
  3021. fi;
  3022. fi;
  3023. fi;
  3024. fi;
  3025. if [[ -n ${reason} ]]; then
  3026. einfo "Removing unnecessary ${f#${D%/}} (${reason})";
  3027. queue+=("${f}");
  3028. fi;
  3029. done < <(find "${D}" -xtype f -name '*.la' -print0);
  3030. if [[ -n ${queue[@]} ]]; then
  3031. rm -f "${queue[@]}";
  3032. fi
  3033. }
  3034. raw-ldflags ()
  3035. {
  3036. local x input="$@";
  3037. [[ -z ${input} ]] && input=${LDFLAGS};
  3038. set --;
  3039. for x in ${input};
  3040. do
  3041. case ${x} in
  3042. -Wl,*)
  3043. x=${x#-Wl,};
  3044. set -- "$@" ${x//,/ }
  3045. ;;
  3046. *)
  3047. ;;
  3048. esac;
  3049. done;
  3050. echo "$@"
  3051. }
  3052. replace-cpu-flags ()
  3053. {
  3054. local newcpu="$#";
  3055. newcpu="${!newcpu}";
  3056. while [ $# -gt 1 ]; do
  3057. replace-flags "-march=${1}" "-march=${newcpu}";
  3058. replace-flags "-mcpu=${1}" "-mcpu=${newcpu}";
  3059. replace-flags "-mtune=${1}" "-mtune=${newcpu}";
  3060. shift;
  3061. done;
  3062. return 0
  3063. }
  3064. replace-flags ()
  3065. {
  3066. [[ $# != 2 ]] && die "Usage: replace-flags <old flag> <new flag>";
  3067. local f var new;
  3068. for var in $(all-flag-vars);
  3069. do
  3070. new=();
  3071. for f in ${!var};
  3072. do
  3073. [[ ${f} == ${1} ]] && f=${2};
  3074. new+=("${f}");
  3075. done;
  3076. export ${var}="${new[*]}";
  3077. done;
  3078. return 0
  3079. }
  3080. replace-sparc64-flags ()
  3081. {
  3082. local SPARC64_CPUS="ultrasparc3 ultrasparc v9";
  3083. if [ "${CFLAGS/mtune}" != "${CFLAGS}" ]; then
  3084. for x in ${SPARC64_CPUS};
  3085. do
  3086. CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8}";
  3087. done;
  3088. else
  3089. for x in ${SPARC64_CPUS};
  3090. do
  3091. CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}";
  3092. done;
  3093. fi;
  3094. if [ "${CXXFLAGS/mtune}" != "${CXXFLAGS}" ]; then
  3095. for x in ${SPARC64_CPUS};
  3096. do
  3097. CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8}";
  3098. done;
  3099. else
  3100. for x in ${SPARC64_CPUS};
  3101. do
  3102. CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}";
  3103. done;
  3104. fi;
  3105. export CFLAGS CXXFLAGS
  3106. }
  3107. run_in_build_dir ()
  3108. {
  3109. debug-print-function ${FUNCNAME} "${@}";
  3110. local ret;
  3111. [[ ${#} -ne 0 ]] || die "${FUNCNAME}: no command specified.";
  3112. [[ -n ${BUILD_DIR} ]] || die "${FUNCNAME}: BUILD_DIR not set.";
  3113. mkdir -p "${BUILD_DIR}" || die;
  3114. pushd "${BUILD_DIR}" > /dev/null || die;
  3115. "${@}";
  3116. ret=${?};
  3117. popd > /dev/null || die;
  3118. return ${ret}
  3119. }
  3120. setup-allowed-flags ()
  3121. {
  3122. ALLOWED_FLAGS=(-pipe -O '-O[12sg]' -mcpu -march -mtune '-fstack-protector*' '-fsanitize*' '-fstack-check*' -fno-stack-check -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+ -gz -fno-ident -fpermissive -frecord-gcc-switches '-fdiagnostics*' '-fplugin*' '-W*' -w '-[DUILR]*' '-Wl,*');
  3123. ALLOWED_FLAGS+=('-fno-stack-protector*' '-fabi-version=*' -fno-strict-aliasing -fno-bounds-check -fno-bounds-checking -fstrict-overflow -fno-omit-frame-pointer '-fno-builtin*');
  3124. 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)
  3125. }
  3126. src_compile ()
  3127. {
  3128. multilib-minimal_src_compile "$@"
  3129. }
  3130. src_configure ()
  3131. {
  3132. multilib-minimal_src_configure "$@"
  3133. }
  3134. src_install ()
  3135. {
  3136. multilib-minimal_src_install "$@"
  3137. }
  3138. src_prepare ()
  3139. {
  3140. default;
  3141. if ! use X; then
  3142. sed -e '/^SUBDIRS/ s#boilerplate test perf# #' -i Makefile.am || die;
  3143. fi;
  3144. if [[ ${PV} == *9999* ]]; then
  3145. touch boilerplate/Makefile.am.features;
  3146. touch src/Makefile.am.features;
  3147. touch ChangeLog;
  3148. fi;
  3149. eautoreconf
  3150. }
  3151. src_test ()
  3152. {
  3153. multilib-minimal_src_test "$@"
  3154. }
  3155. src_unpack ()
  3156. {
  3157. default
  3158. }
  3159. strip-flags ()
  3160. {
  3161. local x y var;
  3162. local ALLOWED_FLAGS;
  3163. setup-allowed-flags;
  3164. set -f;
  3165. for var in $(all-flag-vars);
  3166. do
  3167. local new=();
  3168. for x in ${!var};
  3169. do
  3170. local flag=${x%%=*};
  3171. for y in "${ALLOWED_FLAGS[@]}";
  3172. do
  3173. if [[ -z ${flag%%${y}} ]]; then
  3174. new+=("${x}");
  3175. break;
  3176. fi;
  3177. done;
  3178. done;
  3179. if _is_flagq ${var} "-O*" && ! _is_flagq new "-O*"; then
  3180. new+=(-O2);
  3181. fi;
  3182. if [[ ${!var} != "${new[*]}" ]]; then
  3183. einfo "strip-flags: ${var}: changed '${!var}' to '${new[*]}'";
  3184. fi;
  3185. export ${var}="${new[*]}";
  3186. done;
  3187. set +f;
  3188. return 0
  3189. }
  3190. strip-linguas ()
  3191. {
  3192. local ls newls nols;
  3193. if [[ $1 == "-i" ]] || [[ $1 == "-u" ]]; then
  3194. local op=$1;
  3195. shift;
  3196. ls=$(find "$1" -name '*.po' -exec basename {} .po ';');
  3197. shift;
  3198. local d f;
  3199. for d in "$@";
  3200. do
  3201. if [[ ${op} == "-u" ]]; then
  3202. newls=${ls};
  3203. else
  3204. newls="";
  3205. fi;
  3206. for f in $(find "$d" -name '*.po' -exec basename {} .po ';');
  3207. do
  3208. if [[ ${op} == "-i" ]]; then
  3209. has ${f} ${ls} && newls="${newls} ${f}";
  3210. else
  3211. has ${f} ${ls} || newls="${newls} ${f}";
  3212. fi;
  3213. done;
  3214. ls=${newls};
  3215. done;
  3216. else
  3217. ls="$@";
  3218. fi;
  3219. nols="";
  3220. newls="";
  3221. for f in ${LINGUAS};
  3222. do
  3223. if has ${f} ${ls}; then
  3224. newls="${newls} ${f}";
  3225. else
  3226. nols="${nols} ${f}";
  3227. fi;
  3228. done;
  3229. [[ -n ${nols} ]] && einfo "Sorry, but ${PN} does not support the LINGUAS:" ${nols};
  3230. export LINGUAS=${newls:1}
  3231. }
  3232. strip-unsupported-flags ()
  3233. {
  3234. export CFLAGS=$(test-flags-CC ${CFLAGS});
  3235. export CXXFLAGS=$(test-flags-CXX ${CXXFLAGS});
  3236. export FFLAGS=$(test-flags-F77 ${FFLAGS});
  3237. export FCFLAGS=$(test-flags-FC ${FCFLAGS});
  3238. export LDFLAGS=$(test-flags-CC ${LDFLAGS})
  3239. }
  3240. tc-arch ()
  3241. {
  3242. tc-ninja_magic_to_arch portage "$@"
  3243. }
  3244. tc-arch-kernel ()
  3245. {
  3246. tc-ninja_magic_to_arch kern "$@"
  3247. }
  3248. tc-check-openmp ()
  3249. {
  3250. if ! tc-has-openmp; then
  3251. eerror "Your current compiler does not support OpenMP!";
  3252. if tc-is-gcc; then
  3253. eerror "Enable OpenMP support by building sys-devel/gcc with USE=\"openmp\".";
  3254. else
  3255. if tc-is-clang; then
  3256. eerror "OpenMP support in sys-devel/clang is provided by sys-libs/libomp.";
  3257. fi;
  3258. fi;
  3259. die "Active compiler does not have required support for OpenMP";
  3260. fi
  3261. }
  3262. tc-enables-pie ()
  3263. {
  3264. local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> /dev/null | grep '^true$'
  3265. #if defined(__PIE__)
  3266. true
  3267. #endif
  3268. EOF
  3269. )";
  3270. [[ ${ret} == true ]]
  3271. }
  3272. tc-enables-ssp ()
  3273. {
  3274. local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> /dev/null | grep '^true$'
  3275. #if defined(__SSP__) || defined(__SSP_STRONG__) || defined(__SSP_ALL__)
  3276. true
  3277. #endif
  3278. EOF
  3279. )";
  3280. [[ ${ret} == true ]]
  3281. }
  3282. tc-enables-ssp-all ()
  3283. {
  3284. local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> /dev/null | grep '^true$'
  3285. #if defined(__SSP_ALL__)
  3286. true
  3287. #endif
  3288. EOF
  3289. )";
  3290. [[ ${ret} == true ]]
  3291. }
  3292. tc-enables-ssp-strong ()
  3293. {
  3294. local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> /dev/null | grep '^true$'
  3295. #if defined(__SSP_STRONG__) || defined(__SSP_ALL__)
  3296. true
  3297. #endif
  3298. EOF
  3299. )";
  3300. [[ ${ret} == true ]]
  3301. }
  3302. tc-endian ()
  3303. {
  3304. local host=$1;
  3305. [[ -z ${host} ]] && host=${CTARGET:-${CHOST}};
  3306. host=${host%%-*};
  3307. case ${host} in
  3308. aarch64*be)
  3309. echo big
  3310. ;;
  3311. aarch64)
  3312. echo little
  3313. ;;
  3314. alpha*)
  3315. echo little
  3316. ;;
  3317. arm*b*)
  3318. echo big
  3319. ;;
  3320. arm*)
  3321. echo little
  3322. ;;
  3323. cris*)
  3324. echo little
  3325. ;;
  3326. hppa*)
  3327. echo big
  3328. ;;
  3329. i?86*)
  3330. echo little
  3331. ;;
  3332. ia64*)
  3333. echo little
  3334. ;;
  3335. m68*)
  3336. echo big
  3337. ;;
  3338. mips*l*)
  3339. echo little
  3340. ;;
  3341. mips*)
  3342. echo big
  3343. ;;
  3344. powerpc*le)
  3345. echo little
  3346. ;;
  3347. powerpc*)
  3348. echo big
  3349. ;;
  3350. s390*)
  3351. echo big
  3352. ;;
  3353. sh*b*)
  3354. echo big
  3355. ;;
  3356. sh*)
  3357. echo little
  3358. ;;
  3359. sparc*)
  3360. echo big
  3361. ;;
  3362. x86_64*)
  3363. echo little
  3364. ;;
  3365. *)
  3366. echo wtf
  3367. ;;
  3368. esac
  3369. }
  3370. tc-env_build ()
  3371. {
  3372. tc-export_build_env;
  3373. 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) "$@"
  3374. }
  3375. tc-export ()
  3376. {
  3377. local var;
  3378. for var in "$@";
  3379. do
  3380. [[ $(type -t "tc-get${var}") != "function" ]] && die "tc-export: invalid export variable '${var}'";
  3381. "tc-get${var}" > /dev/null;
  3382. done
  3383. }
  3384. tc-export_build_env ()
  3385. {
  3386. tc-export "$@";
  3387. : ${BUILD_CFLAGS:=-O1 -pipe};
  3388. : ${BUILD_CXXFLAGS:=-O1 -pipe};
  3389. : ${BUILD_CPPFLAGS:= };
  3390. : ${BUILD_LDFLAGS:= };
  3391. export BUILD_{C,CXX,CPP,LD}FLAGS;
  3392. local v;
  3393. for v in BUILD_{C,CXX,CPP,LD}FLAGS;
  3394. do
  3395. export ${v#BUILD_}_FOR_BUILD="${!v}";
  3396. done
  3397. }
  3398. tc-get-compiler-type ()
  3399. {
  3400. local code='
  3401. #if defined(__PATHSCALE__)
  3402. HAVE_PATHCC
  3403. #elif defined(__clang__)
  3404. HAVE_CLANG
  3405. #elif defined(__GNUC__)
  3406. HAVE_GCC
  3407. #endif
  3408. ';
  3409. local res=$($(tc-getCPP "$@") -E -P - <<<"${code}");
  3410. case ${res} in
  3411. *HAVE_PATHCC*)
  3412. echo pathcc
  3413. ;;
  3414. *HAVE_CLANG*)
  3415. echo clang
  3416. ;;
  3417. *HAVE_GCC*)
  3418. echo gcc
  3419. ;;
  3420. *)
  3421. echo unknown
  3422. ;;
  3423. esac
  3424. }
  3425. tc-getAR ()
  3426. {
  3427. tc-getPROG AR ar "$@"
  3428. }
  3429. tc-getAS ()
  3430. {
  3431. tc-getPROG AS as "$@"
  3432. }
  3433. tc-getBUILD_AR ()
  3434. {
  3435. tc-getBUILD_PROG AR ar "$@"
  3436. }
  3437. tc-getBUILD_AS ()
  3438. {
  3439. tc-getBUILD_PROG AS as "$@"
  3440. }
  3441. tc-getBUILD_CC ()
  3442. {
  3443. tc-getBUILD_PROG CC gcc "$@"
  3444. }
  3445. tc-getBUILD_CPP ()
  3446. {
  3447. tc-getBUILD_PROG CPP "$(tc-getBUILD_CC) -E" "$@"
  3448. }
  3449. tc-getBUILD_CXX ()
  3450. {
  3451. tc-getBUILD_PROG CXX g++ "$@"
  3452. }
  3453. tc-getBUILD_LD ()
  3454. {
  3455. tc-getBUILD_PROG LD ld "$@"
  3456. }
  3457. tc-getBUILD_NM ()
  3458. {
  3459. tc-getBUILD_PROG NM nm "$@"
  3460. }
  3461. tc-getBUILD_OBJCOPY ()
  3462. {
  3463. tc-getBUILD_PROG OBJCOPY objcopy "$@"
  3464. }
  3465. tc-getBUILD_PKG_CONFIG ()
  3466. {
  3467. tc-getBUILD_PROG PKG_CONFIG pkg-config "$@"
  3468. }
  3469. tc-getBUILD_PROG ()
  3470. {
  3471. local vars="BUILD_$1 $1_FOR_BUILD HOST$1";
  3472. tc-is-cross-compiler || vars+=" $1";
  3473. _tc-getPROG CBUILD "${vars}" "${@:2}"
  3474. }
  3475. tc-getBUILD_RANLIB ()
  3476. {
  3477. tc-getBUILD_PROG RANLIB ranlib "$@"
  3478. }
  3479. tc-getBUILD_STRIP ()
  3480. {
  3481. tc-getBUILD_PROG STRIP strip "$@"
  3482. }
  3483. tc-getCC ()
  3484. {
  3485. tc-getPROG CC gcc "$@"
  3486. }
  3487. tc-getCPP ()
  3488. {
  3489. tc-getPROG CPP "${CC:-gcc} -E" "$@"
  3490. }
  3491. tc-getCXX ()
  3492. {
  3493. tc-getPROG CXX g++ "$@"
  3494. }
  3495. tc-getDLLWRAP ()
  3496. {
  3497. tc-getPROG DLLWRAP dllwrap "$@"
  3498. }
  3499. tc-getF77 ()
  3500. {
  3501. tc-getPROG F77 gfortran "$@"
  3502. }
  3503. tc-getFC ()
  3504. {
  3505. tc-getPROG FC gfortran "$@"
  3506. }
  3507. tc-getGCJ ()
  3508. {
  3509. tc-getPROG GCJ gcj "$@"
  3510. }
  3511. tc-getGO ()
  3512. {
  3513. tc-getPROG GO gccgo "$@"
  3514. }
  3515. tc-getLD ()
  3516. {
  3517. tc-getPROG LD ld "$@"
  3518. }
  3519. tc-getNM ()
  3520. {
  3521. tc-getPROG NM nm "$@"
  3522. }
  3523. tc-getOBJCOPY ()
  3524. {
  3525. tc-getPROG OBJCOPY objcopy "$@"
  3526. }
  3527. tc-getOBJDUMP ()
  3528. {
  3529. tc-getPROG OBJDUMP objdump "$@"
  3530. }
  3531. tc-getPKG_CONFIG ()
  3532. {
  3533. tc-getPROG PKG_CONFIG pkg-config "$@"
  3534. }
  3535. tc-getPROG ()
  3536. {
  3537. _tc-getPROG CHOST "$@"
  3538. }
  3539. tc-getRANLIB ()
  3540. {
  3541. tc-getPROG RANLIB ranlib "$@"
  3542. }
  3543. tc-getRC ()
  3544. {
  3545. tc-getPROG RC windres "$@"
  3546. }
  3547. tc-getSTRIP ()
  3548. {
  3549. tc-getPROG STRIP strip "$@"
  3550. }
  3551. tc-has-openmp ()
  3552. {
  3553. local base="${T}/test-tc-openmp";
  3554. cat > "${base}.c" <<-EOF
  3555. #include <omp.h>
  3556. int main() {
  3557. int nthreads, tid, ret = 0;
  3558. #pragma omp parallel private(nthreads, tid)
  3559. {
  3560. tid = omp_get_thread_num();
  3561. nthreads = omp_get_num_threads(); ret += tid + nthreads;
  3562. }
  3563. return ret;
  3564. }
  3565. EOF
  3566. $(tc-getCC "$@") -fopenmp "${base}.c" -o "${base}" &> /dev/null;
  3567. local ret=$?;
  3568. rm -f "${base}"*;
  3569. return ${ret}
  3570. }
  3571. tc-has-tls ()
  3572. {
  3573. local base="${T}/test-tc-tls";
  3574. cat > "${base}.c" <<-EOF
  3575. int foo(int *i) {
  3576. static __thread int j = 0;
  3577. return *i ? j : *i;
  3578. }
  3579. EOF
  3580. local flags;
  3581. case $1 in
  3582. -s)
  3583. flags="-S"
  3584. ;;
  3585. -c)
  3586. flags="-c"
  3587. ;;
  3588. -l)
  3589. ;;
  3590. -*)
  3591. die "Usage: tc-has-tls [-c|-l] [toolchain prefix]"
  3592. ;;
  3593. esac;
  3594. : ${flags:=-fPIC -shared -Wl,-z,defs};
  3595. [[ $1 == -* ]] && shift;
  3596. $(tc-getCC "$@") ${flags} "${base}.c" -o "${base}" &> /dev/null;
  3597. local ret=$?;
  3598. rm -f "${base}"*;
  3599. return ${ret}
  3600. }
  3601. tc-is-clang ()
  3602. {
  3603. [[ $(tc-get-compiler-type) == clang ]]
  3604. }
  3605. tc-is-cross-compiler ()
  3606. {
  3607. [[ ${CBUILD:-${CHOST}} != ${CHOST} ]]
  3608. }
  3609. tc-is-gcc ()
  3610. {
  3611. [[ $(tc-get-compiler-type) == gcc ]]
  3612. }
  3613. tc-is-softfloat ()
  3614. {
  3615. local CTARGET=${CTARGET:-${CHOST}};
  3616. case ${CTARGET} in
  3617. bfin* | h8300*)
  3618. echo "only"
  3619. ;;
  3620. *)
  3621. if [[ ${CTARGET//_/-} == *-softfloat-* ]]; then
  3622. echo "yes";
  3623. else
  3624. if [[ ${CTARGET//_/-} == *-softfp-* ]]; then
  3625. echo "softfp";
  3626. else
  3627. echo "no";
  3628. fi;
  3629. fi
  3630. ;;
  3631. esac
  3632. }
  3633. tc-is-static-only ()
  3634. {
  3635. local host=${CTARGET:-${CHOST}};
  3636. [[ ${host} == *-mint* ]]
  3637. }
  3638. tc-ld-disable-gold ()
  3639. {
  3640. if ! tc-ld-is-gold "$@"; then
  3641. return;
  3642. fi;
  3643. ewarn "Forcing usage of the BFD linker instead of GOLD";
  3644. local ld=$(tc-getLD "$@");
  3645. local bfd_ld="${ld%% *}.bfd";
  3646. local path_ld=$(which "${bfd_ld}" 2>/dev/null);
  3647. [[ -e ${path_ld} ]] && export LD=${bfd_ld};
  3648. local major=$(gcc-major-version "$@");
  3649. local minor=$(gcc-minor-version "$@");
  3650. if [[ ${major} -lt 4 ]] || [[ ${major} -eq 4 && ${minor} -lt 8 ]]; then
  3651. if [[ -e ${path_ld} ]]; then
  3652. local d="${T}/bfd-linker";
  3653. mkdir -p "${d}";
  3654. ln -sf "${path_ld}" "${d}"/ld;
  3655. export LDFLAGS="${LDFLAGS} -B${d}";
  3656. else
  3657. die "unable to locate a BFD linker to bypass gold";
  3658. fi;
  3659. else
  3660. export LDFLAGS="${LDFLAGS} -fuse-ld=bfd";
  3661. fi
  3662. }
  3663. tc-ld-is-gold ()
  3664. {
  3665. local out;
  3666. out=$($(tc-getLD "$@") --version 2>&1);
  3667. if [[ ${out} == *"GNU gold"* ]]; then
  3668. return 0;
  3669. fi;
  3670. local base="${T}/test-tc-gold";
  3671. cat > "${base}.c" <<-EOF
  3672. int main() { return 0; }
  3673. EOF
  3674. out=$($(tc-getCC "$@") ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -Wl,--version "${base}.c" -o "${base}" 2>&1);
  3675. rm -f "${base}"*;
  3676. if [[ ${out} == *"GNU gold"* ]]; then
  3677. return 0;
  3678. fi;
  3679. return 1
  3680. }
  3681. tc-ninja_magic_to_arch ()
  3682. {
  3683. function ninj ()
  3684. {
  3685. [[ ${type} == "kern" ]] && echo $1 || echo $2
  3686. };
  3687. local type=$1;
  3688. local host=$2;
  3689. [[ -z ${host} ]] && host=${CTARGET:-${CHOST}};
  3690. case ${host} in
  3691. aarch64*)
  3692. echo arm64
  3693. ;;
  3694. alpha*)
  3695. echo alpha
  3696. ;;
  3697. arm*)
  3698. echo arm
  3699. ;;
  3700. avr*)
  3701. ninj avr32 avr
  3702. ;;
  3703. bfin*)
  3704. ninj blackfin bfin
  3705. ;;
  3706. c6x*)
  3707. echo c6x
  3708. ;;
  3709. cris*)
  3710. echo cris
  3711. ;;
  3712. frv*)
  3713. echo frv
  3714. ;;
  3715. hexagon*)
  3716. echo hexagon
  3717. ;;
  3718. hppa*)
  3719. ninj parisc hppa
  3720. ;;
  3721. i?86*)
  3722. if [[ ${type} == "kern" && ${host} == *freebsd* ]]; then
  3723. echo i386;
  3724. else
  3725. echo x86;
  3726. fi
  3727. ;;
  3728. ia64*)
  3729. echo ia64
  3730. ;;
  3731. m68*)
  3732. echo m68k
  3733. ;;
  3734. metag*)
  3735. echo metag
  3736. ;;
  3737. microblaze*)
  3738. echo microblaze
  3739. ;;
  3740. mips*)
  3741. echo mips
  3742. ;;
  3743. nios2*)
  3744. echo nios2
  3745. ;;
  3746. nios*)
  3747. echo nios
  3748. ;;
  3749. or1k | or32*)
  3750. echo openrisc
  3751. ;;
  3752. powerpc*)
  3753. if [[ ${type} == "kern" ]]; then
  3754. echo powerpc;
  3755. else
  3756. if [[ ${host} == powerpc64* ]]; then
  3757. echo ppc64;
  3758. else
  3759. echo ppc;
  3760. fi;
  3761. fi
  3762. ;;
  3763. riscv*)
  3764. echo riscv
  3765. ;;
  3766. s390*)
  3767. echo s390
  3768. ;;
  3769. score*)
  3770. echo score
  3771. ;;
  3772. sh64*)
  3773. ninj sh64 sh
  3774. ;;
  3775. sh*)
  3776. echo sh
  3777. ;;
  3778. sparc64*)
  3779. ninj sparc64 sparc
  3780. ;;
  3781. sparc*)
  3782. [[ ${PROFILE_ARCH} == "sparc64" ]] && ninj sparc64 sparc || echo sparc
  3783. ;;
  3784. tile*)
  3785. echo tile
  3786. ;;
  3787. vax*)
  3788. echo vax
  3789. ;;
  3790. x86_64*freebsd*)
  3791. echo amd64
  3792. ;;
  3793. x86_64*)
  3794. if [[ ${type} == "kern" ]]; then
  3795. echo x86;
  3796. else
  3797. echo amd64;
  3798. fi
  3799. ;;
  3800. xtensa*)
  3801. echo xtensa
  3802. ;;
  3803. *)
  3804. echo unknown
  3805. ;;
  3806. esac
  3807. }
  3808. tc-stack-grows-down ()
  3809. {
  3810. case ${ARCH} in
  3811. hppa | metag)
  3812. return 1
  3813. ;;
  3814. esac;
  3815. return 0
  3816. }
  3817. test-flag-CC ()
  3818. {
  3819. test-flag-PROG "CC" c "$@"
  3820. }
  3821. test-flag-CXX ()
  3822. {
  3823. test-flag-PROG "CXX" c++ "$@"
  3824. }
  3825. test-flag-F77 ()
  3826. {
  3827. test-flag-PROG "F77" f77 "$@"
  3828. }
  3829. test-flag-FC ()
  3830. {
  3831. test-flag-PROG "FC" f95 "$@"
  3832. }
  3833. test-flag-PROG ()
  3834. {
  3835. local comp=$1;
  3836. local lang=$2;
  3837. shift 2;
  3838. [[ -z ${comp} || -z $1 ]] && return 1;
  3839. local cmdline=($(tc-get${comp}) -Werror -c -o /dev/null);
  3840. if "${cmdline[@]}" -x${lang} - < /dev/null &> /dev/null; then
  3841. cmdline+=("$@" -x${lang} -);
  3842. else
  3843. cmdline+=("$@" -c -o /dev/null /dev/null);
  3844. fi;
  3845. if ! "${cmdline[@]}" < /dev/null &> /dev/null; then
  3846. cmdline+=(-Qunused-arguments);
  3847. "${cmdline[@]}" < /dev/null &> /dev/null;
  3848. fi
  3849. }
  3850. test-flags ()
  3851. {
  3852. test-flags-CC "$@"
  3853. }
  3854. test-flags-CC ()
  3855. {
  3856. test-flags-PROG "CC" "$@"
  3857. }
  3858. test-flags-CXX ()
  3859. {
  3860. test-flags-PROG "CXX" "$@"
  3861. }
  3862. test-flags-F77 ()
  3863. {
  3864. test-flags-PROG "F77" "$@"
  3865. }
  3866. test-flags-FC ()
  3867. {
  3868. test-flags-PROG "FC" "$@"
  3869. }
  3870. test-flags-PROG ()
  3871. {
  3872. local comp=$1;
  3873. local flags=();
  3874. local x;
  3875. shift;
  3876. [[ -z ${comp} ]] && return 1;
  3877. while (( $# )); do
  3878. case "$1" in
  3879. --param)
  3880. if test-flag-${comp} "$1" "$2"; then
  3881. flags+=("$1" "$2");
  3882. fi;
  3883. shift 2
  3884. ;;
  3885. *)
  3886. if test-flag-${comp} "$1"; then
  3887. flags+=("$1");
  3888. fi;
  3889. shift 1
  3890. ;;
  3891. esac;
  3892. done;
  3893. echo "${flags[*]}";
  3894. [[ ${#flags[@]} -gt 0 ]]
  3895. }
  3896. test_version_info ()
  3897. {
  3898. if [[ $($(tc-getCC) --version 2>&1) == *$1* ]]; then
  3899. return 0;
  3900. else
  3901. return 1;
  3902. fi
  3903. }
  3904. uclibctoolize ()
  3905. {
  3906. die "Use elibtoolize"
  3907. }
  3908. use_if_iuse ()
  3909. {
  3910. in_iuse $1 || return 1;
  3911. use $1
  3912. }
  3913.