Siqua

libarchive-environment

Jul 15th, 2019
144
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. declare -x ABI="amd64"
  2. declare -x ABI_MIPS=""
  3. declare -x ABI_PPC=""
  4. declare -x ABI_RISCV=""
  5. declare -x ABI_S390=""
  6. declare -x ABI_X86="64"
  7. declare -x APACHE2_MODULES=""
  8. declare -x APACHE2_MPMS=""
  9. declare -x ARCH="x64-macos"
  10. declare -x Apple_PubSub_Socket_Render="/private/tmp/com.apple.launchd.qX08w0uh1f/Render"
  11. declare BDEPEND=">=app-portage/elt-patches-20170815"
  12. declare -x BOOTSTRAP_RAP_STAGE2="yes"
  13. declare -x BOOTSTRAP_USE="unicode internal-glib pkg-config split-usr python_targets_python3_6 python_targets_python2_7"
  14. declare -x CALLIGRA_FEATURES=""
  15. declare -x CAMERAS=""
  16. declare -x CBUILD="x86_64-apple-darwin18"
  17. declare -x CC="clang -m64"
  18. declare -x CFLAGS="-march=native -O2 -pipe"
  19. declare -x CFLAGS_default
  20. declare -x CHOST="x86_64-apple-darwin18"
  21. declare -x CHOST_amd64="x86_64-apple-darwin18"
  22. declare -x CHOST_default="x86_64-apple-darwin18"
  23. declare -x COLLECTD_PLUGINS=""
  24. declare -x CONFIGURE_EPREFIX="/users/curtis/gentoo/tmp"
  25. declare -x CONFIG_SHELL="/users/curtis/gentoo/tmp/bin/bash"
  26. declare -x CONF_PREFIX="/users/curtis/gentoo/tmp/usr"
  27. declare -x CPPFLAGS="-I/users/curtis/gentoo/tmp/usr/include"
  28. declare -x CPU_FLAGS_ARM=""
  29. declare -x CPU_FLAGS_X86=""
  30. declare -x CTARGET_default="x86_64-apple-darwin18"
  31. declare -x CURL_SSL=""
  32. declare -x CXX="clang++ -m64"
  33. declare -x CXXFLAGS="-march=native -O2 -pipe"
  34. declare -x DEBUGBUILD="1"
  35. declare -x DEFAULT_ABI="amd64"
  36. declare -x DEFINED_PHASES=" compile configure install prepare test"
  37. declare DEPEND="
  38. acl? ( virtual/acl[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  39. bzip2? ( app-arch/bzip2[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  40. expat? ( dev-libs/expat[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  41. !expat? ( dev-libs/libxml2[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  42. iconv? ( virtual/libiconv[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  43. kernel_linux? (
  44. xattr? ( sys-apps/attr[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  45. )
  46. !libressl? ( dev-libs/openssl:0=[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  47. libressl? ( dev-libs/libressl:0=[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  48. lz4? ( >=app-arch/lz4-0_p131:0=[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  49. lzma? ( app-arch/xz-utils[threads=,abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  50. lzo? ( >=dev-libs/lzo-2[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  51. nettle? ( dev-libs/nettle:0=[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  52. zlib? ( sys-libs/zlib[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  53. zstd? ( app-arch/zstd[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  54. kernel_linux? (
  55. virtual/os-headers
  56. e2fsprogs? ( sys-fs/e2fsprogs )
  57. ) "
  58. declare DESCRIPTION="Multi-format archive and compression library"
  59. declare -x DIROPTIONS="-m0755"
  60. declare -x EAPI="7"
  61. declare -x ELIBC="Darwin"
  62. declare -x ENLIGHTENMENT_MODULES=""
  63. declare -x ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
  64. declare -- EPOCHREALTIME="1563231169.915526"
  65. declare -- EPOCHSECONDS="1563231169"
  66. declare -x EXEOPTIONS="-m0755"
  67. declare -x EXTRA_ECONF="--disable-bootstrap "
  68. declare -x FCFLAGS=""
  69. 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}\""
  70. declare -x FFLAGS=""
  71. declare -x FFTOOLS=""
  72. declare -x FPCDIR="/sw/lib/fpc/3.0.4"
  73. declare -x GCC_MAKE_TARGET="all"
  74. declare -x GPSD_PROTOCOLS=""
  75. declare -x GRUB_PLATFORMS=""
  76. declare HDEPEND=""
  77. declare HOMEPAGE="https://www.libarchive.org/"
  78. declare -x HOSTCC="clang -m64"
  79. declare -x INHERITED=" toolchain-funcs multilib prefix libtool multibuild multilib-build multilib-minimal"
  80. declare -x INPUT_DEVICES=""
  81. declare -x INSOPTIONS="-m0644"
  82. declare IUSE="acl +bzip2 +e2fsprogs expat +iconv kernel_linux libressl lz4 +lzma lzo nettle static-libs +threads xattr +zlib zstd abi_x86_32 abi_x86_64 abi_x86_x32 abi_mips_n32 abi_mips_n64 abi_mips_o32 abi_riscv_lp64d abi_riscv_lp64 abi_s390_32 abi_s390_64"
  83. declare -x IUSE_EFFECTIVE="abi_mips_n32 abi_mips_n64 abi_mips_o32 abi_riscv_lp64 abi_riscv_lp64d abi_s390_32 abi_s390_64 abi_x86_32 abi_x86_64 abi_x86_x32 acl alpha amd64 amd64-fbsd amd64-linux arm arm64 bzip2 e2fsprogs 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 expat hppa ia64 iconv kernel_AIX kernel_Darwin kernel_FreeBSD kernel_HPUX kernel_NetBSD kernel_OpenBSD kernel_SunOS kernel_Winnt kernel_freemint kernel_linux libressl lz4 lzma lzo m68k m68k-mint mips nettle ppc ppc-aix ppc-macos ppc64 ppc64-linux prefix prefix-guest prefix-stack riscv s390 sh sparc sparc-solaris sparc64-solaris static-libs threads userland_BSD userland_GNU x64-cygwin x64-macos x64-solaris x86 x86-cygwin x86-fbsd x86-linux x86-macos x86-solaris x86-winnt xattr zlib zstd"
  84. declare -x IUSE_IMPLICIT="abi_x86_64 prefix prefix-guest prefix-stack"
  85. declare -x KERNEL="Darwin"
  86. declare -x KERNEL_ABI="amd64"
  87. declare -x KEYWORDS="alpha amd64 ~arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 s390 ~sh sparc x86 ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
  88. declare -x L10N=""
  89. declare -x LANG="en_US.UTF-8"
  90. declare -x LATEST_TREE_YES="1"
  91. declare -x LCD_DEVICES=""
  92. declare -x LC_COLLATE="C"
  93. declare -x LC_MESSAGES="C"
  94. declare -x LDFLAGS="-Wl,-search_paths_first -L/users/curtis/gentoo/tmp/usr/lib"
  95. declare -x LDFLAGS_default
  96. declare -x LIBDIR_amd64="lib"
  97. declare -x LIBDIR_default="lib"
  98. declare -x LIBOPTIONS="-m0644"
  99. declare -x LIBREOFFICE_EXTENSIONS=""
  100. declare -x LICENSE="BSD BSD-2 BSD-4 public-domain"
  101. declare -x LIRC_DEVICES=""
  102. declare -x LLVM_TARGETS=""
  103. declare -x MACOSSANDBOX_PATHS="/dev/fd/ /private/tmp/ /private/var/tmp/ @@PORTAGE_BUILDDIR@@/ @@PORTAGE_ACTUAL_DISTDIR@@/"
  104. declare -x MACOSSANDBOX_PATHS_CONTENT_ONLY="/dev/null /dev/dtracehelper /dev/tty /private/var/run/syslog"
  105. declare -x MACOSX_DEPLOYMENT_TARGET="10.14"
  106. declare -x MAKE="make"
  107. declare -x MAKEOPTS=""
  108. declare -x MONKEYD_PLUGINS=""
  109. declare -x MULTILIB_ABIS="amd64"
  110. declare -- MULTILIB_USEDEP="abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?"
  111. declare -x MYCMAKEARGS="-DCMAKE_USE_SYSTEM_LIBRARY_LIBUV=OFF"
  112. declare -x NETBEANS_MODULES=""
  113. declare -x NGINX_MODULES_HTTP=""
  114. declare -x NGINX_MODULES_MAIL=""
  115. declare -x NGINX_MODULES_STREAM=""
  116. declare -x OFED_DRIVERS=""
  117. declare -x OFFICE_IMPLEMENTATION=""
  118. declare -x OPENMPI_FABRICS=""
  119. declare -x OPENMPI_OFED_FEATURES=""
  120. declare -x OPENMPI_RM=""
  121. declare -a PATCHES=([0]="/users/curtis/gentoo/tmp/var/tmp/portage/app-arch/libarchive-3.3.3/files/libarchive-3.3.3-libressl.patch")
  122. declare -x PATH="/users/curtis/gentoo/tmp/usr/lib/portage/bin/ebuild-helpers/unprivileged:/users/curtis/gentoo/tmp/usr/lib/portage/bin/ebuild-helpers:/users/curtis/gentoo/tmp/usr/local/sbin:/users/curtis/gentoo/tmp/usr/local/bin:/users/curtis/gentoo/tmp/usr/sbin:/users/curtis/gentoo/tmp/usr/bin:/users/curtis/gentoo/tmp/sbin:/users/curtis/gentoo/tmp/bin:/users/curtis/gentoo/tmp/opt/bin:/Users/curtis/gentoo/usr/bin:/Users/curtis/gentoo/bin:/Users/curtis/gentoo/tmp/usr/bin:/Users/curtis/gentoo/tmp/bin:/usr/bin:/bin"
  123. declare PDEPEND=""
  124. declare -x PERL="/Users/curtis/gentoo/tmp/usr/bin/touch"
  125. declare -x PHP_TARGETS=""
  126. declare -x PKG_CONFIG_PATH="/users/curtis/gentoo/tmp/usr/lib/pkgconfig"
  127. declare -x PORTAGE_COMPRESSION_COMMAND="bzip2"
  128. declare -a PORTAGE_DOCOMPRESS=([0]="/usr/share/doc" [1]="/usr/share/info" [2]="/usr/share/man")
  129. declare -x PORTAGE_DOCOMPRESS_SIZE_LIMIT="128"
  130. declare -a PORTAGE_DOCOMPRESS_SKIP=([0]="/usr/share/doc/libarchive-3.3.3/html")
  131. declare -a PORTAGE_DOSTRIP=([0]="/")
  132. declare -a PORTAGE_DOSTRIP_SKIP=()
  133. declare -x PORTAGE_ROOT_USER="curtis"
  134. declare -x POSTGRES_TARGETS=""
  135. declare -x PPC_CONFIG_PATH="/sw/etc/"
  136. 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"
  137. declare -x PROPERTIES=""
  138. declare -x PYTHONDONTWRITEBYTECODE="1"
  139. declare -x PYTHON_COMPAT_OVERRIDE="python3.6"
  140. declare -x PYTHON_SINGLE_TARGET=""
  141. declare -x PYTHON_TARGETS=""
  142. declare -x QEMU_SOFTMMU_TARGETS=""
  143. declare -x QEMU_USER_TARGETS=""
  144. declare RDEPEND="
  145. acl? ( virtual/acl[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  146. bzip2? ( app-arch/bzip2[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  147. expat? ( dev-libs/expat[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  148. !expat? ( dev-libs/libxml2[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  149. iconv? ( virtual/libiconv[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  150. kernel_linux? (
  151. xattr? ( sys-apps/attr[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  152. )
  153. !libressl? ( dev-libs/openssl:0=[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  154. libressl? ( dev-libs/libressl:0=[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  155. lz4? ( >=app-arch/lz4-0_p131:0=[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  156. lzma? ( app-arch/xz-utils[threads=,abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  157. lzo? ( >=dev-libs/lzo-2[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  158. nettle? ( dev-libs/nettle:0=[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  159. zlib? ( sys-libs/zlib[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] )
  160. zstd? ( app-arch/zstd[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] ) "
  161. declare REPOSITORY
  162. declare REQUIRED_USE=""
  163. declare -x RESTRICT="test"
  164. 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}\""
  165. declare -x ROS_MESSAGES=""
  166. declare -x RUBY_TARGETS=""
  167. declare -x S="/users/curtis/gentoo/tmp/var/tmp/portage/app-arch/libarchive-3.3.3/work/libarchive-3.3.3"
  168. declare -x SANDBOX_DENY=""
  169. declare -x SANDBOX_PREDICT=""
  170. declare -x SANDBOX_READ="/:/users/curtis/gentoo/tmp/var/tmp/portage"
  171. declare -x SANDBOX_WRITE="/users/curtis/gentoo/tmp/var/tmp/portage"
  172. declare -x SANE_BACKENDS=""
  173. declare -x SGML_CATALOG_FILES="/sw/etc/sgml/catalog"
  174. declare -x SHELL="/bin/bash"
  175. declare -x SLOT="0/13"
  176. declare SRC_URI="https://www.libarchive.org/downloads/libarchive-3.3.3.tar.gz"
  177. declare -x TERM_SESSION_ID="06518A97-D2EC-4B30-852E-BFB2A1A66ABB"
  178. declare -x TPREFIX="/users/curtis/gentoo"
  179. declare -x TWISTED_DISABLE_WRITING_OF_PLUGIN_CACHE="1"
  180. declare -x USE="abi_x86_64 bzip2 elibc_Darwin iconv kernel_Darwin lzma prefix prefix-guest threads userland_GNU x64-macos zlib"
  181. declare -x USERLAND="GNU"
  182. declare -x USE_EXPAND_IMPLICIT="ARCH ELIBC KERNEL USERLAND"
  183. declare -x USE_EXPAND_UNPREFIXED="ARCH"
  184. declare -x USE_EXPAND_VALUES_ARCH="alpha amd64 amd64-fbsd amd64-linux arm arm64 hppa ia64 m68k m68k-mint mips ppc ppc64 ppc64-linux ppc-aix ppc-macos riscv 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"
  185. declare -x USE_EXPAND_VALUES_ELIBC="AIX bionic Cygwin Darwin DragonFly FreeBSD glibc HPUX Interix mingw mintlib musl NetBSD OpenBSD SunOS uclibc Winnt"
  186. declare -x USE_EXPAND_VALUES_KERNEL="AIX Darwin FreeBSD freemint HPUX linux NetBSD OpenBSD SunOS Winnt"
  187. declare -x USE_EXPAND_VALUES_USERLAND="BSD GNU"
  188. declare -x UWSGI_PLUGINS=""
  189. declare -x VIDEO_CARDS=""
  190. declare -x VOICEMAIL_STORAGE=""
  191. declare -x XDG_CONFIG_DIRS="/sw/etc/xdg"
  192. declare -x XDG_DATA_DIRS="/sw/share"
  193. declare -x XFCE_PLUGINS=""
  194. declare -x XML_CATALOG_FILES="/sw/etc/xml/catalog"
  195. declare -x XPC_FLAGS="0x0"
  196. declare -x XPC_SERVICE_NAME="0"
  197. declare -x XTABLES_ADDONS=""
  198. declare -x _E_DESTTREE_="/usr"
  199. declare -x _E_DOCDESTTREE_=""
  200. declare -x _E_EXEDESTTREE_=""
  201. declare -x _E_INSDESTTREE_=""
  202. declare -- _LIBTOOL_ECLASS="1"
  203. declare -- _MULTIBUILD="1"
  204. declare -- _MULTILIB_BUILD="1"
  205. declare -- _MULTILIB_ECLASS="1"
  206. 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_riscv_lp64d:lp64d" [7]="abi_riscv_lp64:lp64" [8]="abi_s390_32:s390" [9]="abi_s390_64:s390x")
  207. declare -- _TOOLCHAIN_FUNCS_ECLASS="1"
  208. declare -x ac_cv_header_ext2fs_ext2_fs_h="no"
  209. declare -- phase_func
  210. declare -- started_applying="1"
  211. __eapi6_src_install ()
  212. {
  213. if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then
  214. emake DESTDIR="${D}" install;
  215. fi;
  216. einstalldocs
  217. }
  218. __eapi6_src_prepare ()
  219. {
  220. if ___is_indexed_array_var PATCHES; then
  221. [[ ${#PATCHES[@]} -gt 0 ]] && eapply "${PATCHES[@]}";
  222. else
  223. if [[ -n ${PATCHES} ]]; then
  224. eapply ${PATCHES};
  225. fi;
  226. fi;
  227. eapply_user
  228. }
  229. __eapi7_ver_compare ()
  230. {
  231. local va=${1} vb=${2} a an al as ar b bn bl bs br re LC_ALL=C;
  232. re="^([0-9]+(\.[0-9]+)*)([a-z]?)((_(alpha|beta|pre|rc|p)[0-9]*)*)(-r[0-9]+)?$";
  233. [[ ${va} =~ ${re} ]] || die "${FUNCNAME}: invalid version: ${va}";
  234. an=${BASH_REMATCH[1]};
  235. al=${BASH_REMATCH[3]};
  236. as=${BASH_REMATCH[4]};
  237. ar=${BASH_REMATCH[7]};
  238. [[ ${vb} =~ ${re} ]] || die "${FUNCNAME}: invalid version: ${vb}";
  239. bn=${BASH_REMATCH[1]};
  240. bl=${BASH_REMATCH[3]};
  241. bs=${BASH_REMATCH[4]};
  242. br=${BASH_REMATCH[7]};
  243. __eapi7_ver_compare_int "${an%%.*}" "${bn%%.*}" || return;
  244. while [[ ${an} == *.* && ${bn} == *.* ]]; do
  245. an=${an#*.};
  246. bn=${bn#*.};
  247. a=${an%%.*};
  248. b=${bn%%.*};
  249. if [[ ${a} == 0* || ${b} == 0* ]]; then
  250. [[ ${a} =~ 0+$ ]] && a=${a%"${BASH_REMATCH[0]}"};
  251. [[ ${b} =~ 0+$ ]] && b=${b%"${BASH_REMATCH[0]}"};
  252. [[ ${a} > ${b} ]] && return 3;
  253. [[ ${a} < ${b} ]] && return 1;
  254. else
  255. __eapi7_ver_compare_int "${a}" "${b}" || return;
  256. fi;
  257. done;
  258. [[ ${an} == *.* ]] && return 3;
  259. [[ ${bn} == *.* ]] && return 1;
  260. [[ ${al} > ${bl} ]] && return 3;
  261. [[ ${al} < ${bl} ]] && return 1;
  262. as=${as#_}${as:+_};
  263. bs=${bs#_}${bs:+_};
  264. while [[ -n ${as} && -n ${bs} ]]; do
  265. a=${as%%_*};
  266. b=${bs%%_*};
  267. if [[ ${a%%[0-9]*} == "${b%%[0-9]*}" ]]; then
  268. __eapi7_ver_compare_int "${a##*[a-z]}" "${b##*[a-z]}" || return;
  269. else
  270. [[ ${a%%[0-9]*} == p ]] && return 3;
  271. [[ ${b%%[0-9]*} == p ]] && return 1;
  272. [[ ${a} > ${b} ]] && return 3 || return 1;
  273. fi;
  274. as=${as#*_};
  275. bs=${bs#*_};
  276. done;
  277. if [[ -n ${as} ]]; then
  278. [[ ${as} == p[_0-9]* ]] && return 3 || return 1;
  279. else
  280. if [[ -n ${bs} ]]; then
  281. [[ ${bs} == p[_0-9]* ]] && return 1 || return 3;
  282. fi;
  283. fi;
  284. __eapi7_ver_compare_int "${ar#-r}" "${br#-r}" || return;
  285. return 2
  286. }
  287. __eapi7_ver_compare_int ()
  288. {
  289. local a=$1 b=$2 d=$(( ${#1}-${#2} ));
  290. if [[ ${d} -gt 0 ]]; then
  291. printf -v b "%0${d}d%s" 0 "${b}";
  292. else
  293. if [[ ${d} -lt 0 ]]; then
  294. printf -v a "%0$(( -d ))d%s" 0 "${a}";
  295. fi;
  296. fi;
  297. [[ ${a} > ${b} ]] && return 3;
  298. [[ ${a} == "${b}" ]]
  299. }
  300. __eapi7_ver_parse_range ()
  301. {
  302. local range=${1};
  303. local max=${2};
  304. [[ ${range} == [0-9]* ]] || die "${FUNCNAME}: range must start with a number";
  305. start=${range%-*};
  306. [[ ${range} == *-* ]] && end=${range#*-} || end=${start};
  307. if [[ -n ${end} ]]; then
  308. [[ ${start} -le ${end} ]] || die "${FUNCNAME}: end of range must be >= start";
  309. [[ ${end} -le ${max} ]] || end=${max};
  310. else
  311. end=${max};
  312. fi
  313. }
  314. __eapi7_ver_split ()
  315. {
  316. local v=${1} LC_ALL=C;
  317. comp=();
  318. local s c;
  319. while [[ -n ${v} ]]; do
  320. s=${v%%[a-zA-Z0-9]*};
  321. v=${v:${#s}};
  322. [[ ${v} == [0-9]* ]] && c=${v%%[^0-9]*} || c=${v%%[^a-zA-Z]*};
  323. v=${v:${#c}};
  324. comp+=("${s}" "${c}");
  325. done
  326. }
  327. _clang_fullversion ()
  328. {
  329. local ver="$1";
  330. shift;
  331. set -- $($(tc-getCPP "$@") -E -P - <<<"__clang_major__ __clang_minor__ __clang_patchlevel__");
  332. eval echo "$ver"
  333. }
  334. _eapply_patch ()
  335. {
  336. local f=${1};
  337. local prefix=${2};
  338. started_applying=1;
  339. ebegin "${prefix:-Applying }${f##*/}";
  340. ${patch_cmd} -p1 -f -s -g0 --no-backup-if-mismatch "${patch_options[@]}" < "${f}";
  341. failed=${?};
  342. if ! eend "${failed}"; then
  343. __helpers_die "patch -p1 ${patch_options[*]} failed with ${f}";
  344. fi
  345. }
  346. _gcc-install-dir ()
  347. {
  348. echo "$(LC_ALL=C $(tc-getCC) -print-search-dirs 2> /dev/null | awk '$1=="install:" {print $2}')"
  349. }
  350. _gcc-specs-directive_raw ()
  351. {
  352. local cc=$(tc-getCC);
  353. local specfiles=$(LC_ALL=C ${cc} -v 2>&1 | awk '$1=="Reading" {print $NF}');
  354. ${cc} -dumpspecs 2> /dev/null | cat - ${specfiles} | awk -v directive=$1 'BEGIN { pspec=""; spec=""; outside=1 }
  355. $1=="*"directive":" { pspec=spec; spec=""; outside=0; next }
  356. outside || NF==0 || ( substr($1,1,1)=="*" && substr($1,length($1),1)==":" ) { outside=1; next }
  357. spec=="" && substr($0,1,1)=="+" { spec=pspec " " substr($0,2); next }
  358. { spec=spec $0 }
  359. END { print spec }';
  360. return 0
  361. }
  362. _gcc-specs-exists ()
  363. {
  364. [[ -f $(_gcc-install-dir)/$1 ]]
  365. }
  366. _gcc_fullversion ()
  367. {
  368. local ver="$1";
  369. shift;
  370. set -- $($(tc-getCPP "$@") -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__");
  371. eval echo "$ver"
  372. }
  373. _multibuild_run ()
  374. {
  375. local i=1;
  376. while [[ ${!i} == _* ]]; do
  377. (( i += 1 ));
  378. done;
  379. [[ ${i} -le ${#} ]] && einfo "${v}: running ${@:${i}}";
  380. "${@}"
  381. }
  382. _multilib_multibuild_wrapper ()
  383. {
  384. debug-print-function ${FUNCNAME} "${@}";
  385. local ABI=${MULTIBUILD_VARIANT#*.};
  386. local -r MULTILIB_ABI_FLAG=${MULTIBUILD_VARIANT%.*};
  387. multilib_toolchain_setup "${ABI}";
  388. readonly ABI;
  389. "${@}"
  390. }
  391. _tc-getPROG ()
  392. {
  393. local tuple=$1;
  394. local v var vars=$2;
  395. local prog=($3);
  396. var=${vars%% *};
  397. for v in ${vars};
  398. do
  399. if [[ -n ${!v} ]]; then
  400. export ${var}="${!v}";
  401. echo "${!v}";
  402. return 0;
  403. fi;
  404. done;
  405. local search=;
  406. [[ -n $4 ]] && search=$(type -p $4-${prog[0]});
  407. [[ -z ${search} && -n ${!tuple} ]] && search=$(type -p ${!tuple}-${prog[0]});
  408. [[ -n ${search} ]] && prog[0]=${search##*/};
  409. export ${var}="${prog[*]}";
  410. echo "${!var}"
  411. }
  412. clang-fullversion ()
  413. {
  414. _clang_fullversion '$1.$2.$3' "$@"
  415. }
  416. clang-major-version ()
  417. {
  418. _clang_fullversion '$1' "$@"
  419. }
  420. clang-micro-version ()
  421. {
  422. _clang_fullversion '$3' "$@"
  423. }
  424. clang-minor-version ()
  425. {
  426. _clang_fullversion '$2' "$@"
  427. }
  428. clang-version ()
  429. {
  430. _clang_fullversion '$1.$2' "$@"
  431. }
  432. darwintoolize ()
  433. {
  434. die "Use elibtoolize"
  435. }
  436. eapply ()
  437. {
  438. local failed patch_cmd=patch;
  439. local -x LC_COLLATE=POSIX;
  440. type -P gpatch > /dev/null && patch_cmd=gpatch;
  441. function _eapply_patch ()
  442. {
  443. local f=${1};
  444. local prefix=${2};
  445. started_applying=1;
  446. ebegin "${prefix:-Applying }${f##*/}";
  447. ${patch_cmd} -p1 -f -s -g0 --no-backup-if-mismatch "${patch_options[@]}" < "${f}";
  448. failed=${?};
  449. if ! eend "${failed}"; then
  450. __helpers_die "patch -p1 ${patch_options[*]} failed with ${f}";
  451. fi
  452. };
  453. local patch_options=() files=();
  454. local i found_doublehyphen;
  455. for ((i = 1; i <= ${#@}; ++i ))
  456. do
  457. if [[ ${@:i:1} == -- ]]; then
  458. patch_options=("${@:1:i-1}");
  459. files=("${@:i+1}");
  460. found_doublehyphen=1;
  461. break;
  462. fi;
  463. done;
  464. if [[ -z ${found_doublehyphen} ]]; then
  465. for ((i = 1; i <= ${#@}; ++i ))
  466. do
  467. if [[ ${@:i:1} != -* ]]; then
  468. patch_options=("${@:1:i-1}");
  469. files=("${@:i}");
  470. break;
  471. fi;
  472. done;
  473. for i in "${files[@]}";
  474. do
  475. if [[ ${i} == -* ]]; then
  476. die "eapply: all options must be passed before non-options";
  477. fi;
  478. done;
  479. fi;
  480. if [[ ${#files[@]} -eq 0 ]]; then
  481. die "eapply: no files specified";
  482. fi;
  483. local f;
  484. for f in "${files[@]}";
  485. do
  486. if [[ -d ${f} ]]; then
  487. function _eapply_get_files ()
  488. {
  489. local LC_ALL=POSIX;
  490. local prev_shopt=$(shopt -p nullglob);
  491. shopt -s nullglob;
  492. local f;
  493. for f in "${1}"/*;
  494. do
  495. if [[ ${f} == *.diff || ${f} == *.patch ]]; then
  496. files+=("${f}");
  497. fi;
  498. done;
  499. ${prev_shopt}
  500. };
  501. local files=();
  502. _eapply_get_files "${f}";
  503. [[ ${#files[@]} -eq 0 ]] && die "No *.{patch,diff} files in directory ${f}";
  504. einfo "Applying patches from ${f} ...";
  505. local f2;
  506. for f2 in "${files[@]}";
  507. do
  508. _eapply_patch "${f2}" ' ';
  509. [[ ${failed} -ne 0 ]] && return "${failed}";
  510. done;
  511. else
  512. _eapply_patch "${f}";
  513. [[ ${failed} -ne 0 ]] && return "${failed}";
  514. fi;
  515. done;
  516. return 0
  517. }
  518. eapply_user ()
  519. {
  520. [[ ${EBUILD_PHASE} == prepare ]] || die "eapply_user() called during invalid phase: ${EBUILD_PHASE}";
  521. local tagfile=${T}/.portage_user_patches_applied;
  522. [[ -f ${tagfile} ]] && return;
  523. >> "${tagfile}";
  524. local basedir=${PORTAGE_CONFIGROOT%/}/etc/portage/patches;
  525. local applied d f;
  526. local -A _eapply_user_patches;
  527. local prev_shopt=$(shopt -p nullglob);
  528. shopt -s nullglob;
  529. for d in "${basedir}"/${CATEGORY}/{${P}-${PR},${P},${PN}}{:${SLOT%/*},};
  530. do
  531. for f in "${d}"/*;
  532. do
  533. if [[ ( ${f} == *.diff || ${f} == *.patch ) && -z ${_eapply_user_patches[${f##*/}]} ]]; then
  534. _eapply_user_patches[${f##*/}]=${f};
  535. fi;
  536. done;
  537. done;
  538. if [[ ${#_eapply_user_patches[@]} -gt 0 ]]; then
  539. while read -r -d '' f; do
  540. f=${_eapply_user_patches[${f}]};
  541. if [[ -s ${f} ]]; then
  542. eapply "${f}";
  543. applied=1;
  544. fi;
  545. done < <(printf -- '%s\0' "${!_eapply_user_patches[@]}" |
  546. LC_ALL=C sort -z);
  547. fi;
  548. ${prev_shopt};
  549. [[ -n ${applied} ]] && ewarn "User patches applied."
  550. }
  551. econf_build ()
  552. {
  553. local CBUILD=${CBUILD:-${CHOST}};
  554. tc-env_build econf --build=${CBUILD} --host=${CBUILD} "$@"
  555. }
  556. einstalldocs ()
  557. {
  558. ( if ! declare -p DOCS &> /dev/null; then
  559. local d;
  560. for d in README* ChangeLog AUTHORS NEWS TODO CHANGES THANKS BUGS FAQ CREDITS CHANGELOG;
  561. do
  562. [[ -f ${d} && -s ${d} ]] && docinto / && dodoc "${d}";
  563. done;
  564. else
  565. if ___is_indexed_array_var DOCS; then
  566. [[ ${#DOCS[@]} -gt 0 ]] && docinto / && dodoc -r "${DOCS[@]}";
  567. else
  568. [[ -n ${DOCS} ]] && docinto / && dodoc -r ${DOCS};
  569. fi;
  570. fi );
  571. ( if ___is_indexed_array_var HTML_DOCS; then
  572. [[ ${#HTML_DOCS[@]} -gt 0 ]] && docinto html && dodoc -r "${HTML_DOCS[@]}";
  573. else
  574. [[ -n ${HTML_DOCS} ]] && docinto html && dodoc -r ${HTML_DOCS};
  575. fi )
  576. }
  577. elibtoolize ()
  578. {
  579. type -P eltpatch &> /dev/null || die "eltpatch not found; is app-portage/elt-patches installed?";
  580. ELT_LOGDIR=${T} LD=$(tc-getLD) eltpatch "${@}" || die "eltpatch failed"
  581. }
  582. eprefixify ()
  583. {
  584. [[ $# -lt 1 ]] && die "at least one argument required";
  585. einfo "Adjusting to prefix ${EPREFIX:-/}";
  586. local x;
  587. for x in "$@";
  588. do
  589. if [[ -e ${x} ]]; then
  590. ebegin " ${x##*/}";
  591. sed -i -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}|g" "${x}";
  592. eend $? || die "failed to eprefixify ${x}";
  593. else
  594. die "${x} does not exist";
  595. fi;
  596. done;
  597. return 0
  598. }
  599. gcc-fullversion ()
  600. {
  601. _gcc_fullversion '$1.$2.$3' "$@"
  602. }
  603. gcc-major-version ()
  604. {
  605. _gcc_fullversion '$1' "$@"
  606. }
  607. gcc-micro-version ()
  608. {
  609. _gcc_fullversion '$3' "$@"
  610. }
  611. gcc-minor-version ()
  612. {
  613. _gcc_fullversion '$2' "$@"
  614. }
  615. gcc-specs-directive ()
  616. {
  617. local directive subdname subdirective;
  618. directive="$(_gcc-specs-directive_raw $1)";
  619. while [[ ${directive} == *%\(*\)* ]]; do
  620. subdname=${directive/*%\(};
  621. subdname=${subdname/\)*};
  622. subdirective="$(_gcc-specs-directive_raw ${subdname})";
  623. directive="${directive//\%(${subdname})/${subdirective}}";
  624. done;
  625. echo "${directive}";
  626. return 0
  627. }
  628. gcc-specs-nostrict ()
  629. {
  630. local directive;
  631. directive=$(gcc-specs-directive cc1);
  632. [[ "${directive/\{!fstrict-overflow:}" != "${directive}" ]]
  633. }
  634. gcc-specs-now ()
  635. {
  636. local directive;
  637. directive=$(gcc-specs-directive link_command);
  638. [[ "${directive/\{!nonow:}" != "${directive}" ]]
  639. }
  640. gcc-specs-pie ()
  641. {
  642. local directive;
  643. directive=$(gcc-specs-directive cc1);
  644. [[ "${directive/\{!nopie:}" != "${directive}" ]]
  645. }
  646. gcc-specs-relro ()
  647. {
  648. local directive;
  649. directive=$(gcc-specs-directive link_command);
  650. [[ "${directive/\{!norelro:}" != "${directive}" ]]
  651. }
  652. gcc-specs-ssp ()
  653. {
  654. local directive;
  655. directive=$(gcc-specs-directive cc1);
  656. [[ "${directive/\{!fno-stack-protector:}" != "${directive}" ]]
  657. }
  658. gcc-specs-ssp-to-all ()
  659. {
  660. local directive;
  661. directive=$(gcc-specs-directive cc1);
  662. [[ "${directive/\{!fno-stack-protector-all:}" != "${directive}" ]]
  663. }
  664. gcc-specs-stack-check ()
  665. {
  666. local directive;
  667. directive=$(gcc-specs-directive cc1);
  668. [[ "${directive/\{!fno-stack-check:}" != "${directive}" ]]
  669. }
  670. gcc-version ()
  671. {
  672. _gcc_fullversion '$1.$2' "$@"
  673. }
  674. gen_usr_ldscript ()
  675. {
  676. local lib libdir=$(get_libdir) output_format="" auto=false suffix=$(get_libname);
  677. [[ -z ${ED+set} ]] && local ED=${D%/}${EPREFIX}/;
  678. tc-is-static-only && return;
  679. use prefix && return;
  680. if [[ $(type -t multilib_is_native_abi) == "function" ]]; then
  681. multilib_is_native_abi || return 0;
  682. fi;
  683. case ${CTARGET:-${CHOST}} in
  684. *-darwin*)
  685. type -P scanmacho > /dev/null || return
  686. ;;
  687. *-android*)
  688. return 0
  689. ;;
  690. *linux* | *-freebsd* | *-openbsd* | *-netbsd*)
  691. use prefix && return 0
  692. ;;
  693. *)
  694. return 0
  695. ;;
  696. esac;
  697. dodir /usr/${libdir};
  698. if [[ $1 == "-a" ]]; then
  699. auto=true;
  700. shift;
  701. dodir /${libdir};
  702. fi;
  703. local flags=(${CFLAGS} ${LDFLAGS} -Wl,--verbose);
  704. if $(tc-getLD) --version | grep -q 'GNU gold'; then
  705. local d="${T}/bfd-linker";
  706. mkdir -p "${d}";
  707. ln -sf $(which ${CHOST}-ld.bfd) "${d}"/ld;
  708. flags+=(-B"${d}");
  709. fi;
  710. output_format=$($(tc-getCC) "${flags[@]}" 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p');
  711. [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )";
  712. for lib in "$@";
  713. do
  714. local tlib;
  715. if ${auto}; then
  716. lib="lib${lib}${suffix}";
  717. else
  718. [[ -r ${ED}/${libdir}/${lib} ]] || continue;
  719. fi;
  720. case ${CTARGET:-${CHOST}} in
  721. *-darwin*)
  722. if ${auto}; then
  723. tlib=$(scanmacho -qF'%S#F' "${ED}"/usr/${libdir}/${lib});
  724. else
  725. tlib=$(scanmacho -qF'%S#F' "${ED}"/${libdir}/${lib});
  726. fi;
  727. [[ -z ${tlib} ]] && die "unable to read install_name from ${lib}";
  728. tlib=${tlib##*/};
  729. if ${auto}; then
  730. mv "${ED}"/usr/${libdir}/${lib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die;
  731. if [[ ${tlib} != ${lib%${suffix}}.*${suffix#.} ]]; then
  732. mv "${ED}"/usr/${libdir}/${tlib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die;
  733. fi;
  734. rm -f "${ED}"/${libdir}/${lib};
  735. fi;
  736. if [[ ! -w "${ED}/${libdir}/${tlib}" ]]; then
  737. chmod u+w "${ED}${libdir}/${tlib}";
  738. local nowrite=yes;
  739. fi;
  740. install_name_tool -id "${EPREFIX}"/${libdir}/${tlib} "${ED}"/${libdir}/${tlib} || die "install_name_tool failed";
  741. [[ -n ${nowrite} ]] && chmod u-w "${ED}${libdir}/${tlib}";
  742. local l obj needed lib;
  743. scanmacho -qyRF '%p;%n' "${D}" | {
  744. while IFS= read l; do
  745. obj=${l%%;*};
  746. needed=${l#*;};
  747. for lib in ${needed//,/ };
  748. do
  749. if [[ ${lib} == */usr/lib*/${tlib} ]]; then
  750. local s=${lib%usr/*}${lib##*/usr/};
  751. [[ ${lib} != ${s} ]] || continue;
  752. einfo "gen_usr_ldscript: correcting install_name from ${lib} to ${s} in ${obj}";
  753. install_name_tool -change "${lib}" "${s}" "${D}${obj}";
  754. fi;
  755. done;
  756. done
  757. };
  758. pushd "${ED}/usr/${libdir}" > /dev/null;
  759. ln -snf "../../${libdir}/${tlib}" "${lib}";
  760. popd > /dev/null
  761. ;;
  762. *)
  763. if ${auto}; then
  764. tlib=$(scanelf -qF'%S#F' "${ED}"/usr/${libdir}/${lib});
  765. [[ -z ${tlib} ]] && die "unable to read SONAME from ${lib}";
  766. mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die;
  767. if [[ ${tlib} != ${lib}* ]]; then
  768. mv "${ED}"/usr/${libdir}/${tlib}* "${ED}"/${libdir}/ || die;
  769. fi;
  770. rm -f "${ED}"/${libdir}/${lib};
  771. else
  772. tlib=${lib};
  773. fi;
  774. cat > "${ED}/usr/${libdir}/${lib}" <<-END_LDSCRIPT
  775. /* GNU ld script
  776. Since Gentoo has critical dynamic libraries in /lib, and the static versions
  777. in /usr/lib, we need to have a "fake" dynamic lib in /usr/lib, otherwise we
  778. run into linking problems. This "fake" dynamic lib is a linker script that
  779. redirects the linker to the real lib. And yes, this works in the cross-
  780. compiling scenario as the sysroot-ed linker will prepend the real path.
  781.  
  782. See bug https://bugs.gentoo.org/4411 for more info.
  783. */
  784. ${output_format}
  785. GROUP ( ${EPREFIX}/${libdir}/${tlib} )
  786. END_LDSCRIPT
  787.  
  788. ;;
  789. esac
  790. fperms a+x "/usr/${libdir}/${lib}" || die "could not change perms on ${lib}";
  791. done
  792. }
  793. get_abi_CFLAGS ()
  794. {
  795. get_abi_var CFLAGS "$@"
  796. }
  797. get_abi_CHOST ()
  798. {
  799. get_abi_var CHOST "$@"
  800. }
  801. get_abi_CTARGET ()
  802. {
  803. get_abi_var CTARGET "$@"
  804. }
  805. get_abi_FAKE_TARGETS ()
  806. {
  807. get_abi_var FAKE_TARGETS "$@"
  808. }
  809. get_abi_LDFLAGS ()
  810. {
  811. get_abi_var LDFLAGS "$@"
  812. }
  813. get_abi_LIBDIR ()
  814. {
  815. get_abi_var LIBDIR "$@"
  816. }
  817. get_abi_var ()
  818. {
  819. local flag=$1;
  820. local abi=${2:-${ABI:-${DEFAULT_ABI:-default}}};
  821. local var="${flag}_${abi}";
  822. echo ${!var}
  823. }
  824. get_all_abis ()
  825. {
  826. local x order="" mvar dvar;
  827. mvar="MULTILIB_ABIS";
  828. dvar="DEFAULT_ABI";
  829. if [[ -n $1 ]]; then
  830. mvar="$1_${mvar}";
  831. dvar="$1_${dvar}";
  832. fi;
  833. if [[ -z ${!mvar} ]]; then
  834. echo "default";
  835. return 0;
  836. fi;
  837. for x in ${!mvar};
  838. do
  839. if [[ ${x} != ${!dvar} ]]; then
  840. order="${order:+${order} }${x}";
  841. fi;
  842. done;
  843. order="${order:+${order} }${!dvar}";
  844. echo ${order};
  845. return 0
  846. }
  847. get_all_libdirs ()
  848. {
  849. local libdirs abi;
  850. for abi in ${MULTILIB_ABIS};
  851. do
  852. libdirs+=" $(get_abi_LIBDIR ${abi})";
  853. done;
  854. [[ " ${libdirs} " != *" lib "* ]] && libdirs+=" lib";
  855. echo "${libdirs}"
  856. }
  857. get_exeext ()
  858. {
  859. case ${CHOST} in
  860. *-cygwin* | mingw* | *-mingw*)
  861. echo ".exe"
  862. ;;
  863. esac
  864. }
  865. get_install_abis ()
  866. {
  867. local x order="";
  868. if [[ -z ${MULTILIB_ABIS} ]]; then
  869. echo "default";
  870. return 0;
  871. fi;
  872. if [[ ${EMULTILIB_PKG} == "true" ]]; then
  873. for x in ${MULTILIB_ABIS};
  874. do
  875. if [[ ${x} != "${DEFAULT_ABI}" ]]; then
  876. has ${x} ${ABI_DENY} || order="${order} ${x}";
  877. fi;
  878. done;
  879. has ${DEFAULT_ABI} ${ABI_DENY} || order="${order} ${DEFAULT_ABI}";
  880. if [[ -n ${ABI_ALLOW} ]]; then
  881. local ordera="";
  882. for x in ${order};
  883. do
  884. if has ${x} ${ABI_ALLOW}; then
  885. ordera="${ordera} ${x}";
  886. fi;
  887. done;
  888. order=${ordera};
  889. fi;
  890. else
  891. order=${DEFAULT_ABI};
  892. fi;
  893. if [[ -z ${order} ]]; then
  894. 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.";
  895. fi;
  896. echo ${order};
  897. return 0
  898. }
  899. get_libdir ()
  900. {
  901. local libdir_var="LIBDIR_${ABI}";
  902. local libdir="lib";
  903. [[ -n ${ABI} && -n ${!libdir_var} ]] && libdir=${!libdir_var};
  904. echo "${libdir}"
  905. }
  906. get_libname ()
  907. {
  908. local libname;
  909. local ver=$1;
  910. case ${CHOST} in
  911. *-cygwin*)
  912. libname="dll.a"
  913. ;;
  914. mingw* | *-mingw*)
  915. libname="dll"
  916. ;;
  917. *-darwin*)
  918. libname="dylib"
  919. ;;
  920. *-mint*)
  921. libname="irrelevant"
  922. ;;
  923. hppa*-hpux*)
  924. libname="sl"
  925. ;;
  926. *)
  927. libname="so"
  928. ;;
  929. esac;
  930. if [[ -z $* ]]; then
  931. echo ".${libname}";
  932. else
  933. for ver in "$@";
  934. do
  935. case ${CHOST} in
  936. *-cygwin*)
  937. echo ".${ver}.${libname}"
  938. ;;
  939. *-darwin*)
  940. echo ".${ver}.${libname}"
  941. ;;
  942. *-mint*)
  943. echo ".${libname}"
  944. ;;
  945. *)
  946. echo ".${libname}.${ver}"
  947. ;;
  948. esac;
  949. done;
  950. fi
  951. }
  952. get_modname ()
  953. {
  954. local modname;
  955. local ver=$1;
  956. case ${CHOST} in
  957. *-darwin*)
  958. modname="bundle"
  959. ;;
  960. *)
  961. modname="so"
  962. ;;
  963. esac;
  964. echo ".${modname}"
  965. }
  966. has_multilib_profile ()
  967. {
  968. [ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ]
  969. }
  970. hprefixify ()
  971. {
  972. use prefix || return 0;
  973. local xl=() x;
  974. while [[ $# -gt 0 ]]; do
  975. case $1 in
  976. -e)
  977. local PREFIX_EXTRA_REGEX="$2";
  978. shift
  979. ;;
  980. -w)
  981. local PREFIX_LINE_MATCH="$2";
  982. shift
  983. ;;
  984. -q)
  985. local PREFIX_QUOTE_CHAR="${EPREFIX:+$2}";
  986. shift
  987. ;;
  988. *)
  989. xl+=("$1")
  990. ;;
  991. esac;
  992. shift;
  993. done;
  994. local dirs="/(usr|lib(|[onx]?32|n?64)|etc|bin|sbin|var|opt|run)" eprefix="${PREFIX_QUOTE_CHAR}${EPREFIX}${PREFIX_QUOTE_CHAR}";
  995. [[ ${#xl[@]} -lt 1 ]] && die "at least one file operand is required";
  996. einfo "Adjusting to prefix ${EPREFIX:-/}";
  997. for x in "${xl[@]}";
  998. do
  999. if [[ -e ${x} ]]; then
  1000. ebegin " ${x##*/}";
  1001. sed -r -e "${PREFIX_LINE_MATCH}s,([^[:alnum:]}\)\.])${dirs},\1${eprefix}/\2,g" -e "${PREFIX_LINE_MATCH}s,^${dirs},${eprefix}/\1," -e "${PREFIX_EXTRA_REGEX}" -i "${x}";
  1002. eend $? || die "failed to prefixify ${x}";
  1003. else
  1004. die "${x} does not exist";
  1005. fi;
  1006. done
  1007. }
  1008. in_iuse ()
  1009. {
  1010. local use=${1};
  1011. if [[ -z "${use}" ]]; then
  1012. echo "!!! in_iuse() called without a parameter." 1>&2;
  1013. echo "!!! in_iuse <USEFLAG>" 1>&2;
  1014. die "in_iuse() called without a parameter";
  1015. fi;
  1016. local liuse=(${IUSE_EFFECTIVE});
  1017. has "${use}" "${liuse[@]#[+-]}"
  1018. }
  1019. is_final_abi ()
  1020. {
  1021. has_multilib_profile || return 0;
  1022. set -- $(get_install_abis);
  1023. local LAST_ABI=$#;
  1024. [[ ${!LAST_ABI} == ${ABI} ]]
  1025. }
  1026. multibuild_copy_sources ()
  1027. {
  1028. debug-print-function ${FUNCNAME} "${@}";
  1029. local _MULTIBUILD_INITIAL_BUILD_DIR=${BUILD_DIR:-${S}};
  1030. einfo "Will copy sources from ${_MULTIBUILD_INITIAL_BUILD_DIR}";
  1031. local cp_args=();
  1032. if cp --reflink=auto --version &> /dev/null; then
  1033. cp_args+=(--reflink=auto);
  1034. fi;
  1035. function _multibuild_create_source_copy ()
  1036. {
  1037. einfo "${MULTIBUILD_VARIANT}: copying to ${BUILD_DIR}";
  1038. cp -p -R "${cp_args[@]}" "${_MULTIBUILD_INITIAL_BUILD_DIR}" "${BUILD_DIR}" || die
  1039. };
  1040. multibuild_foreach_variant _multibuild_create_source_copy
  1041. }
  1042. multibuild_for_best_variant ()
  1043. {
  1044. debug-print-function ${FUNCNAME} "${@}";
  1045. [[ -n ${MULTIBUILD_VARIANTS} ]] || die "MULTIBUILD_VARIANTS need to be set";
  1046. local MULTIBUILD_VARIANTS=("${MULTIBUILD_VARIANTS[$(( ${#MULTIBUILD_VARIANTS[@]} - 1 ))]}");
  1047. multibuild_foreach_variant "${@}"
  1048. }
  1049. multibuild_foreach_variant ()
  1050. {
  1051. debug-print-function ${FUNCNAME} "${@}";
  1052. [[ -n ${MULTIBUILD_VARIANTS} ]] || die "MULTIBUILD_VARIANTS need to be set";
  1053. local bdir=${BUILD_DIR:-${S}};
  1054. [[ ${bdir%%/} == ${WORKDIR%%/} ]] && bdir=${WORKDIR}/build;
  1055. local prev_id=${MULTIBUILD_ID:+${MULTIBUILD_ID}-};
  1056. local ret=0 lret=0 v;
  1057. debug-print "${FUNCNAME}: initial build_dir = ${bdir}";
  1058. for v in "${MULTIBUILD_VARIANTS[@]}";
  1059. do
  1060. local MULTIBUILD_VARIANT=${v};
  1061. local MULTIBUILD_ID=${prev_id}${v};
  1062. local BUILD_DIR=${bdir%%/}-${v};
  1063. function _multibuild_run ()
  1064. {
  1065. local i=1;
  1066. while [[ ${!i} == _* ]]; do
  1067. (( i += 1 ));
  1068. done;
  1069. [[ ${i} -le ${#} ]] && einfo "${v}: running ${@:${i}}";
  1070. "${@}"
  1071. };
  1072. _multibuild_run "${@}" > >(exec tee -a "${T}/build-${MULTIBUILD_ID}.log") 2>&1;
  1073. lret=${?};
  1074. done;
  1075. [[ ${ret} -eq 0 && ${lret} -ne 0 ]] && ret=${lret};
  1076. return ${ret}
  1077. }
  1078. multibuild_merge_root ()
  1079. {
  1080. local src=${1};
  1081. local dest=${2};
  1082. local ret;
  1083. if use userland_BSD; then
  1084. tar -C "${src}" -f - -c . | tar -x -f - -C "${dest}";
  1085. [[ ${PIPESTATUS[*]} == '0 0' ]];
  1086. ret=${?};
  1087. else
  1088. local cp_args=();
  1089. if cp -a --version &> /dev/null; then
  1090. cp_args+=(-a);
  1091. else
  1092. cp_args+=(-P -R -p);
  1093. fi;
  1094. if cp --reflink=auto --version &> /dev/null; then
  1095. cp_args+=(--reflink=auto);
  1096. fi;
  1097. cp "${cp_args[@]}" "${src}"/. "${dest}"/;
  1098. ret=${?};
  1099. fi;
  1100. if [[ ${ret} -ne 0 ]]; then
  1101. die "${MULTIBUILD_VARIANT:-(unknown)}: merging image failed.";
  1102. fi;
  1103. rm -rf "${src}"
  1104. }
  1105. multibuild_parallel_foreach_variant ()
  1106. {
  1107. debug-print-function ${FUNCNAME} "${@}";
  1108. [[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}";
  1109. multibuild_foreach_variant "${@}"
  1110. }
  1111. multilib-minimal_abi_src_configure ()
  1112. {
  1113. debug-print-function ${FUNCNAME} "$@";
  1114. mkdir -p "${BUILD_DIR}" || die;
  1115. pushd "${BUILD_DIR}" > /dev/null || die;
  1116. if declare -f multilib_src_configure > /dev/null; then
  1117. multilib_src_configure;
  1118. else
  1119. default_src_configure;
  1120. fi;
  1121. popd > /dev/null || die
  1122. }
  1123. multilib-minimal_src_compile ()
  1124. {
  1125. debug-print-function ${FUNCNAME} "$@";
  1126. function multilib-minimal_abi_src_compile ()
  1127. {
  1128. debug-print-function ${FUNCNAME} "$@";
  1129. pushd "${BUILD_DIR}" > /dev/null || die;
  1130. if declare -f multilib_src_compile > /dev/null; then
  1131. multilib_src_compile;
  1132. else
  1133. default_src_compile;
  1134. fi;
  1135. popd > /dev/null || die
  1136. };
  1137. multilib_foreach_abi multilib-minimal_abi_src_compile
  1138. }
  1139. multilib-minimal_src_configure ()
  1140. {
  1141. debug-print-function ${FUNCNAME} "$@";
  1142. function multilib-minimal_abi_src_configure ()
  1143. {
  1144. debug-print-function ${FUNCNAME} "$@";
  1145. mkdir -p "${BUILD_DIR}" || die;
  1146. pushd "${BUILD_DIR}" > /dev/null || die;
  1147. if declare -f multilib_src_configure > /dev/null; then
  1148. multilib_src_configure;
  1149. else
  1150. default_src_configure;
  1151. fi;
  1152. popd > /dev/null || die
  1153. };
  1154. multilib_foreach_abi multilib-minimal_abi_src_configure
  1155. }
  1156. multilib-minimal_src_install ()
  1157. {
  1158. debug-print-function ${FUNCNAME} "$@";
  1159. function multilib-minimal_abi_src_install ()
  1160. {
  1161. debug-print-function ${FUNCNAME} "$@";
  1162. pushd "${BUILD_DIR}" > /dev/null || die;
  1163. if declare -f multilib_src_install > /dev/null; then
  1164. multilib_src_install;
  1165. else
  1166. if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then
  1167. emake DESTDIR="${D}" install;
  1168. fi;
  1169. fi;
  1170. multilib_prepare_wrappers;
  1171. multilib_check_headers;
  1172. popd > /dev/null || die
  1173. };
  1174. multilib_foreach_abi multilib-minimal_abi_src_install;
  1175. multilib_install_wrappers;
  1176. if declare -f multilib_src_install_all > /dev/null; then
  1177. multilib_src_install_all;
  1178. else
  1179. einstalldocs;
  1180. fi
  1181. }
  1182. multilib-minimal_src_test ()
  1183. {
  1184. debug-print-function ${FUNCNAME} "$@";
  1185. function multilib-minimal_abi_src_test ()
  1186. {
  1187. debug-print-function ${FUNCNAME} "$@";
  1188. pushd "${BUILD_DIR}" > /dev/null || die;
  1189. if declare -f multilib_src_test > /dev/null; then
  1190. multilib_src_test;
  1191. else
  1192. default_src_test;
  1193. fi;
  1194. popd > /dev/null || die
  1195. };
  1196. multilib_foreach_abi multilib-minimal_abi_src_test
  1197. }
  1198. multilib_build_binaries ()
  1199. {
  1200. debug-print-function ${FUNCNAME} "${@}";
  1201. [[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}, use multilib_is_native_abi() instead";
  1202. eqawarn "QA warning: multilib_build_binaries is deprecated. Please use the equivalent";
  1203. eqawarn "multilib_is_native_abi function instead.";
  1204. multilib_is_native_abi "${@}"
  1205. }
  1206. multilib_check_headers ()
  1207. {
  1208. function _multilib_header_cksum ()
  1209. {
  1210. set -o pipefail;
  1211. if [[ -d ${ED%/}/usr/include ]]; then
  1212. find "${ED%/}"/usr/include -type f -exec cksum {} + | sort -k2;
  1213. fi
  1214. };
  1215. local cksum cksum_prev;
  1216. local cksum_file=${T}/.multilib_header_cksum;
  1217. cksum=$(_multilib_header_cksum) || die;
  1218. unset -f _multilib_header_cksum;
  1219. if [[ -f ${cksum_file} ]]; then
  1220. cksum_prev=$(< "${cksum_file}") || die;
  1221. if [[ ${cksum} != ${cksum_prev} ]]; then
  1222. echo "${cksum}" > "${cksum_file}.new" || die;
  1223. eerror "Header files have changed between ABIs.";
  1224. if type -p diff &> /dev/null; then
  1225. eerror "$(diff -du "${cksum_file}" "${cksum_file}.new")";
  1226. else
  1227. eerror "Old checksums in: ${cksum_file}";
  1228. eerror "New checksums in: ${cksum_file}.new";
  1229. fi;
  1230. die "Header checksum mismatch, aborting.";
  1231. fi;
  1232. else
  1233. echo "${cksum}" > "${cksum_file}" || die;
  1234. fi
  1235. }
  1236. multilib_copy_sources ()
  1237. {
  1238. debug-print-function ${FUNCNAME} "${@}";
  1239. local MULTIBUILD_VARIANTS=($(multilib_get_enabled_abi_pairs));
  1240. multibuild_copy_sources
  1241. }
  1242. multilib_env ()
  1243. {
  1244. local CTARGET=${1:-${CTARGET}};
  1245. local cpu=${CTARGET%%*-};
  1246. case ${cpu} in
  1247. aarch64*)
  1248. export CFLAGS_arm=${CFLAGS_arm-};
  1249. case ${cpu} in
  1250. aarch64*be)
  1251. export CHOST_arm="armv8b-${CTARGET#*-}"
  1252. ;;
  1253. *)
  1254. export CHOST_arm="armv8l-${CTARGET#*-}"
  1255. ;;
  1256. esac;
  1257. CHOST_arm=${CHOST_arm/%-gnu/-gnueabi};
  1258. export CTARGET_arm=${CHOST_arm};
  1259. export LIBDIR_arm="lib";
  1260. export CFLAGS_arm64=${CFLAGS_arm64-};
  1261. export CHOST_arm64=${CTARGET};
  1262. export CTARGET_arm64=${CHOST_arm64};
  1263. export LIBDIR_arm64="lib64";
  1264. : ${MULTILIB_ABIS=arm64};
  1265. : ${DEFAULT_ABI=arm64}
  1266. ;;
  1267. x86_64*)
  1268. export CFLAGS_x86=${CFLAGS_x86--m32};
  1269. export CHOST_x86=${CTARGET/x86_64/i686};
  1270. CHOST_x86=${CHOST_x86/%-gnux32/-gnu};
  1271. export CTARGET_x86=${CHOST_x86};
  1272. if [[ ${SYMLINK_LIB} == "yes" ]]; then
  1273. export LIBDIR_x86="lib32";
  1274. else
  1275. export LIBDIR_x86="lib";
  1276. fi;
  1277. export CFLAGS_amd64=${CFLAGS_amd64--m64};
  1278. export CHOST_amd64=${CTARGET/%-gnux32/-gnu};
  1279. export CTARGET_amd64=${CHOST_amd64};
  1280. export LIBDIR_amd64="lib64";
  1281. export CFLAGS_x32=${CFLAGS_x32--mx32};
  1282. export CHOST_x32=${CTARGET/%-gnu/-gnux32};
  1283. export CTARGET_x32=${CHOST_x32};
  1284. export LIBDIR_x32="libx32";
  1285. case ${CTARGET} in
  1286. *-gnux32)
  1287. : ${MULTILIB_ABIS=x32 amd64 x86};
  1288. : ${DEFAULT_ABI=x32}
  1289. ;;
  1290. *)
  1291. : ${MULTILIB_ABIS=amd64 x86};
  1292. : ${DEFAULT_ABI=amd64}
  1293. ;;
  1294. esac
  1295. ;;
  1296. mips64* | mipsisa64*)
  1297. export CFLAGS_o32=${CFLAGS_o32--mabi=32};
  1298. export CHOST_o32=${CTARGET/mips64/mips};
  1299. export CHOST_o32=${CHOST_o32/mipsisa64/mipsisa32};
  1300. export CTARGET_o32=${CHOST_o32};
  1301. export LIBDIR_o32="lib";
  1302. export CFLAGS_n32=${CFLAGS_n32--mabi=n32};
  1303. export CHOST_n32=${CTARGET};
  1304. export CTARGET_n32=${CHOST_n32};
  1305. export LIBDIR_n32="lib32";
  1306. export CFLAGS_n64=${CFLAGS_n64--mabi=64};
  1307. export CHOST_n64=${CTARGET};
  1308. export CTARGET_n64=${CHOST_n64};
  1309. export LIBDIR_n64="lib64";
  1310. : ${MULTILIB_ABIS=n64 n32 o32};
  1311. : ${DEFAULT_ABI=n32}
  1312. ;;
  1313. powerpc64*)
  1314. export CFLAGS_ppc=${CFLAGS_ppc--m32};
  1315. export CHOST_ppc=${CTARGET/powerpc64/powerpc};
  1316. export CTARGET_ppc=${CHOST_ppc};
  1317. export LIBDIR_ppc="lib";
  1318. export CFLAGS_ppc64=${CFLAGS_ppc64--m64};
  1319. export CHOST_ppc64=${CTARGET};
  1320. export CTARGET_ppc64=${CHOST_ppc64};
  1321. export LIBDIR_ppc64="lib64";
  1322. : ${MULTILIB_ABIS=ppc64 ppc};
  1323. : ${DEFAULT_ABI=ppc64}
  1324. ;;
  1325. riscv64*)
  1326. export CFLAGS_lp64d=${CFLAGS_lp64d--mabi=lp64d};
  1327. export CHOST_lp64d=${CTARGET};
  1328. export CTARGET_lp64d=${CTARGET};
  1329. export LIBDIR_lp64d="lib64/lp64d";
  1330. export CFLAGS_lp64=${CFLAGS_lp64--mabi=lp64};
  1331. export CHOST_lp64=${CTARGET};
  1332. export CTARGET_lp64=${CTARGET};
  1333. export LIBDIR_lp64="lib64/lp64";
  1334. : ${MULTILIB_ABIS=lp64d lp64};
  1335. : ${DEFAULT_ABI=lp64d}
  1336. ;;
  1337. s390x*)
  1338. export CFLAGS_s390=${CFLAGS_s390--m31};
  1339. export CHOST_s390=${CTARGET/s390x/s390};
  1340. export CTARGET_s390=${CHOST_s390};
  1341. export LIBDIR_s390="lib";
  1342. export CFLAGS_s390x=${CFLAGS_s390x--m64};
  1343. export CHOST_s390x=${CTARGET};
  1344. export CTARGET_s390x=${CHOST_s390x};
  1345. export LIBDIR_s390x="lib64";
  1346. : ${MULTILIB_ABIS=s390x s390};
  1347. : ${DEFAULT_ABI=s390x}
  1348. ;;
  1349. sparc64*)
  1350. export CFLAGS_sparc32=${CFLAGS_sparc32--m32};
  1351. export CHOST_sparc32=${CTARGET/sparc64/sparc};
  1352. export CTARGET_sparc32=${CHOST_sparc32};
  1353. export LIBDIR_sparc32="lib";
  1354. export CFLAGS_sparc64=${CFLAGS_sparc64--m64};
  1355. export CHOST_sparc64=${CTARGET};
  1356. export CTARGET_sparc64=${CHOST_sparc64};
  1357. export LIBDIR_sparc64="lib64";
  1358. : ${MULTILIB_ABIS=sparc64 sparc32};
  1359. : ${DEFAULT_ABI=sparc64}
  1360. ;;
  1361. *)
  1362. : ${MULTILIB_ABIS=default};
  1363. : ${DEFAULT_ABI=default}
  1364. ;;
  1365. esac;
  1366. export MULTILIB_ABIS DEFAULT_ABI
  1367. }
  1368. multilib_for_best_abi ()
  1369. {
  1370. debug-print-function ${FUNCNAME} "${@}";
  1371. [[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}, use multilib_is_native_abi() instead";
  1372. eqawarn "QA warning: multilib_for_best_abi() function is deprecated and should";
  1373. eqawarn "not be used. The multilib_is_native_abi() check may be used instead.";
  1374. local MULTIBUILD_VARIANTS=($(multilib_get_enabled_abi_pairs));
  1375. multibuild_for_best_variant _multilib_multibuild_wrapper "${@}"
  1376. }
  1377. multilib_foreach_abi ()
  1378. {
  1379. debug-print-function ${FUNCNAME} "${@}";
  1380. local MULTIBUILD_VARIANTS=($(multilib_get_enabled_abi_pairs));
  1381. multibuild_foreach_variant _multilib_multibuild_wrapper "${@}"
  1382. }
  1383. multilib_get_enabled_abi_pairs ()
  1384. {
  1385. debug-print-function ${FUNCNAME} "${@}";
  1386. local abis=($(get_all_abis));
  1387. local abi i found;
  1388. for abi in "${abis[@]}";
  1389. do
  1390. for i in "${_MULTILIB_FLAGS[@]}";
  1391. do
  1392. local m_abis=${i#*:} m_abi;
  1393. local m_flag=${i%:*};
  1394. for m_abi in ${m_abis//,/ };
  1395. do
  1396. if [[ ${m_abi} == ${abi} ]] && {
  1397. [[ ! -n "${MULTILIB_COMPAT[@]}" ]] || has "${m_flag}" "${MULTILIB_COMPAT[@]}"
  1398. } && use "${m_flag}"; then
  1399. echo "${m_flag}.${abi}";
  1400. found=1;
  1401. break 2;
  1402. fi;
  1403. done;
  1404. done;
  1405. done;
  1406. if [[ ! -n ${found} ]]; then
  1407. local abi=${ABI:-${DEFAULT_ABI}};
  1408. debug-print "${FUNCNAME}: no ABIs enabled, fallback to ${abi}";
  1409. debug-print "${FUNCNAME}: ABI=${ABI}, DEFAULT_ABI=${DEFAULT_ABI}";
  1410. echo ".${abi}";
  1411. fi
  1412. }
  1413. multilib_get_enabled_abis ()
  1414. {
  1415. debug-print-function ${FUNCNAME} "${@}";
  1416. local pairs=($(multilib_get_enabled_abi_pairs));
  1417. echo "${pairs[@]#*.}"
  1418. }
  1419. multilib_install_wrappers ()
  1420. {
  1421. debug-print-function ${FUNCNAME} "${@}";
  1422. [[ ${#} -le 1 ]] || die "${FUNCNAME}: too many arguments";
  1423. [[ ${COMPLETE_MULTILIB} == yes ]] && return;
  1424. local root=${1:-${ED}};
  1425. if [[ -d ${ED%/}/tmp/multilib-include ]]; then
  1426. multibuild_merge_root "${ED%/}"/tmp/multilib-include "${root}"/usr/include;
  1427. rmdir "${ED%/}"/tmp &> /dev/null;
  1428. fi
  1429. }
  1430. multilib_is_native_abi ()
  1431. {
  1432. debug-print-function ${FUNCNAME} "${@}";
  1433. [[ ${#} -eq 0 ]] || die "${FUNCNAME}: too many arguments";
  1434. [[ ${COMPLETE_MULTILIB} == yes || ${ABI} == ${DEFAULT_ABI} ]]
  1435. }
  1436. multilib_native_enable ()
  1437. {
  1438. if multilib_is_native_abi; then
  1439. echo "--enable-${1}${2+=${2}}";
  1440. else
  1441. echo "--disable-${1}";
  1442. fi
  1443. }
  1444. multilib_native_use_enable ()
  1445. {
  1446. if multilib_is_native_abi; then
  1447. use_enable "${@}";
  1448. else
  1449. echo "--disable-${2:-${1}}";
  1450. fi
  1451. }
  1452. multilib_native_use_with ()
  1453. {
  1454. if multilib_is_native_abi; then
  1455. use_with "${@}";
  1456. else
  1457. echo "--without-${2:-${1}}";
  1458. fi
  1459. }
  1460. multilib_native_usex ()
  1461. {
  1462. if multilib_is_native_abi; then
  1463. usex "${@}";
  1464. else
  1465. echo "${3-no}${5}";
  1466. fi
  1467. }
  1468. multilib_native_with ()
  1469. {
  1470. if multilib_is_native_abi; then
  1471. echo "--with-${1}${2+=${2}}";
  1472. else
  1473. echo "--without-${1}";
  1474. fi
  1475. }
  1476. multilib_parallel_foreach_abi ()
  1477. {
  1478. debug-print-function ${FUNCNAME} "${@}";
  1479. local MULTIBUILD_VARIANTS=($(multilib_get_enabled_abi_pairs));
  1480. multibuild_foreach_variant _multilib_multibuild_wrapper "${@}"
  1481. }
  1482. multilib_prepare_wrappers ()
  1483. {
  1484. debug-print-function ${FUNCNAME} "${@}";
  1485. [[ ${#} -le 1 ]] || die "${FUNCNAME}: too many arguments";
  1486. local root=${1:-${ED%/}};
  1487. local f;
  1488. if [[ ${COMPLETE_MULTILIB} == yes ]]; then
  1489. for f in "${MULTILIB_CHOST_TOOLS[@]}";
  1490. do
  1491. f=${f#/};
  1492. local dir=${f%/*};
  1493. local fn=${f##*/};
  1494. ln -s "${fn}" "${root}/${dir}/${CHOST}-${fn}" || die;
  1495. done;
  1496. return;
  1497. fi;
  1498. for f in "${MULTILIB_CHOST_TOOLS[@]}";
  1499. do
  1500. f=${f#/};
  1501. local dir=${f%/*};
  1502. local fn=${f##*/};
  1503. if [[ -L ${root}/${f} ]]; then
  1504. local target;
  1505. target=$(readlink "${root}/${f}") || die;
  1506. local target_dir target_fn=${target##*/};
  1507. [[ ${target} == */* ]] && target_dir=${target%/*};
  1508. ln -f -s "${target_dir+${target_dir}/}${CHOST}-${target_fn}" "${root}/${f}" || die;
  1509. fi;
  1510. mv "${root}/${f}" "${root}/${dir}/${CHOST}-${fn}" || die;
  1511. if multilib_is_native_abi; then
  1512. ln -s "${CHOST}-${fn}" "${root}/${f}" || die;
  1513. fi;
  1514. done;
  1515. if [[ -n ${MULTILIB_WRAPPED_HEADERS[@]} ]]; then
  1516. if [[ -n ${MULTILIB_ABI_FLAG} ]]; then
  1517. for f in "${MULTILIB_WRAPPED_HEADERS[@]}";
  1518. do
  1519. f=${f#/};
  1520. if [[ ${f} != usr/include/* ]]; then
  1521. die "Wrapping headers outside of /usr/include is not supported at the moment.";
  1522. fi;
  1523. f=${f#usr/include};
  1524. local dir=${f%/*};
  1525. if [[ -f ${root}/usr/include${f} ]]; then
  1526. local wrapper=${ED%/}/tmp/multilib-include${f};
  1527. if [[ ! -f ${ED%/}/tmp/multilib-include${f} ]]; then
  1528. dodir "/tmp/multilib-include${dir}";
  1529. cat > "${wrapper}" <<_EOF_ ||
  1530. /* This file is auto-generated by multilib-build.eclass
  1531. * as a multilib-friendly wrapper. For the original content,
  1532. * please see the files that are #included below.
  1533. */
  1534.  
  1535. #if defined(__x86_64__) /* amd64 */
  1536. # if defined(__ILP32__) /* x32 ABI */
  1537. # error "abi_x86_x32 not supported by the package."
  1538. # else /* 64-bit ABI */
  1539. # error "abi_x86_64 not supported by the package."
  1540. # endif
  1541. #elif defined(__i386__) /* plain x86 */
  1542. # error "abi_x86_32 not supported by the package."
  1543. #elif defined(__mips__)
  1544. # if(_MIPS_SIM == _ABIN32) /* n32 */
  1545. # error "abi_mips_n32 not supported by the package."
  1546. # elif(_MIPS_SIM == _ABI64) /* n64 */
  1547. # error "abi_mips_n64 not supported by the package."
  1548. # elif(_MIPS_SIM == _ABIO32) /* o32 */
  1549. # error "abi_mips_o32 not supported by the package."
  1550. # endif
  1551. #elif defined(__riscv)
  1552. # if defined(__riscv_float_abi_double)
  1553. # error "abi_riscv_lp64d not supported by the package."
  1554. # elif defined(__riscv_float_abi_single)
  1555. # error "abi_riscv_lp64f not supported by the package."
  1556. # else
  1557. # error "abi_riscv_lp64 not supported by the package."
  1558. # endif
  1559. #elif defined(__sparc__)
  1560. # if defined(__arch64__)
  1561. # error "abi_sparc_64 not supported by the package."
  1562. # else
  1563. # error "abi_sparc_32 not supported by the package."
  1564. # endif
  1565. #elif defined(__s390__)
  1566. # if defined(__s390x__)
  1567. # error "abi_s390_64 not supported by the package."
  1568. # else
  1569. # error "abi_s390_32 not supported by the package."
  1570. # endif
  1571. #elif defined(__powerpc__) || defined(__ppc__)
  1572. # if defined(__powerpc64__) || defined(__ppc64__)
  1573. # error "abi_ppc_64 not supported by the package."
  1574. # else
  1575. # error "abi_ppc_32 not supported by the package."
  1576. # endif
  1577. #elif defined(SWIG) /* https://sourceforge.net/p/swig/bugs/799/ */
  1578. # error "Native ABI not supported by the package."
  1579. #else
  1580. # error "No ABI matched, please report a bug to bugs.gentoo.org"
  1581. #endif
  1582. _EOF_
  1583. die;
  1584. fi
  1585. if ! grep -q "${MULTILIB_ABI_FLAG} " "${wrapper}"; then
  1586. die "Flag ${MULTILIB_ABI_FLAG} not listed in wrapper template. Please report a bug to https://bugs.gentoo.org.";
  1587. fi;
  1588. dodir "/tmp/multilib-include/${CHOST}${dir}";
  1589. mv "${root}/usr/include${f}" "${ED%/}/tmp/multilib-include/${CHOST}${dir}/" || die;
  1590. sed -e "/${MULTILIB_ABI_FLAG} /s&error.*&include <${CHOST}${f}>&" -i "${wrapper}" || die;
  1591. if multilib_is_native_abi; then
  1592. sed -e "/Native ABI/s&error.*&include <${CHOST}${f}>&" -i "${wrapper}" || die;
  1593. fi;
  1594. fi;
  1595. done;
  1596. fi;
  1597. fi
  1598. }
  1599. multilib_src_compile ()
  1600. {
  1601. if multilib_is_native_abi; then
  1602. emake;
  1603. else
  1604. emake libarchive.la;
  1605. fi
  1606. }
  1607. multilib_src_configure ()
  1608. {
  1609. export ac_cv_header_ext2fs_ext2_fs_h=$(usex e2fsprogs);
  1610. local myconf=();
  1611. myconf=($(use_enable acl) $(use_enable static-libs static) $(use_enable xattr) $(use_with bzip2 bz2lib) $(use_with expat) $(use_with !expat xml2) $(use_with iconv) $(use_with lz4) $(use_with lzma) $(use_with lzo lzo2) $(use_with nettle) $(use_with zlib) $(use_with zstd) --without-cng);
  1612. if multilib_is_native_abi; then
  1613. myconf+=(--enable-bsdcat=$(tc-is-static-only && echo static || echo shared) --enable-bsdcpio=$(tc-is-static-only && echo static || echo shared) --enable-bsdtar=$(tc-is-static-only && echo static || echo shared));
  1614. else
  1615. myconf+=(--disable-bsdcat --disable-bsdcpio --disable-bsdtar);
  1616. fi;
  1617. ECONF_SOURCE="${S}" econf "${myconf[@]}"
  1618. }
  1619. multilib_src_install ()
  1620. {
  1621. if multilib_is_native_abi; then
  1622. emake DESTDIR="${D}" install;
  1623. if ! use prefix && [[ ${CHOST} == *-freebsd* ]]; then
  1624. for bin in cpio tar;
  1625. do
  1626. dosym bsd${bin} /usr/bin/${bin};
  1627. echo '.so bsd${bin}.1' > "${T}"/${bin}.1;
  1628. doman "${T}"/${bin}.1;
  1629. done;
  1630. fi;
  1631. else
  1632. local install_targets=(install-includeHEADERS install-libLTLIBRARIES install-pkgconfigDATA);
  1633. emake DESTDIR="${D}" "${install_targets[@]}";
  1634. fi;
  1635. find "${ED}" -name "*.la" -delete || die
  1636. }
  1637. multilib_src_install_all ()
  1638. {
  1639. cd "${S}" || die;
  1640. einstalldocs
  1641. }
  1642. multilib_src_test ()
  1643. {
  1644. multilib_is_native_abi && emake check
  1645. }
  1646. multilib_toolchain_setup ()
  1647. {
  1648. local v vv;
  1649. export ABI=$1;
  1650. if [[ ${_DEFAULT_ABI_SAVED} == "true" ]]; then
  1651. for v in CHOST CBUILD AS CC CXX F77 FC LD PKG_CONFIG_{LIBDIR,PATH};
  1652. do
  1653. vv="_abi_saved_${v}";
  1654. [[ ${!vv+set} == "set" ]] && export ${v}="${!vv}" || unset ${v};
  1655. unset ${vv};
  1656. done;
  1657. unset _DEFAULT_ABI_SAVED;
  1658. fi;
  1659. if [[ ${ABI} != ${DEFAULT_ABI} ]]; then
  1660. for v in CHOST CBUILD AS CC CXX F77 FC LD PKG_CONFIG_{LIBDIR,PATH};
  1661. do
  1662. vv="_abi_saved_${v}";
  1663. [[ ${!v+set} == "set" ]] && export ${vv}="${!v}" || unset ${vv};
  1664. done;
  1665. export _DEFAULT_ABI_SAVED="true";
  1666. if [[ ${CBUILD} == "${CHOST}" ]]; then
  1667. export CBUILD=$(get_abi_CHOST $1);
  1668. fi;
  1669. export CHOST=$(get_abi_CHOST ${DEFAULT_ABI});
  1670. export CC="$(tc-getCC) $(get_abi_CFLAGS)";
  1671. export CXX="$(tc-getCXX) $(get_abi_CFLAGS)";
  1672. export F77="$(tc-getF77) $(get_abi_CFLAGS)";
  1673. export FC="$(tc-getFC) $(get_abi_CFLAGS)";
  1674. export LD="$(tc-getLD) $(get_abi_LDFLAGS)";
  1675. export CHOST=$(get_abi_CHOST $1);
  1676. export PKG_CONFIG_LIBDIR=${EPREFIX}/usr/$(get_libdir)/pkgconfig;
  1677. export PKG_CONFIG_PATH=${EPREFIX}/usr/share/pkgconfig;
  1678. fi
  1679. }
  1680. number_abis ()
  1681. {
  1682. set -- `get_install_abis`;
  1683. echo $#
  1684. }
  1685. pkg_nofetch ()
  1686. {
  1687. default
  1688. }
  1689. post_src_install ()
  1690. {
  1691. prefix-post_src_install
  1692. }
  1693. prefix-post_src_install ()
  1694. {
  1695. local f;
  1696. if [[ ${PN} != "libiconv" && -n $(ls "${ED}"/usr/lib*/charset.alias 2>/dev/null) ]]; then
  1697. einfo "automatically removing charset.alias";
  1698. rm -f "${ED}"/usr/lib*/charset.alias;
  1699. fi
  1700. }
  1701. prefixify_ro ()
  1702. {
  1703. if [[ -e $1 ]]; then
  1704. local f=${1##*/};
  1705. cp "$1" "${T}" || die "failed to copy file";
  1706. local x="${T}"/${f};
  1707. if grep -qs @GENTOO_PORTAGE_EPREFIX@ "${x}"; then
  1708. eprefixify "${T}"/${f} 1>&2;
  1709. else
  1710. hprefixify "${T}"/${f} 1>&2;
  1711. fi;
  1712. echo "${x}";
  1713. else
  1714. die "$1 does not exist";
  1715. fi
  1716. }
  1717. profile-post_src_install ()
  1718. {
  1719. prefix-post_src_install
  1720. }
  1721. run_in_build_dir ()
  1722. {
  1723. debug-print-function ${FUNCNAME} "${@}";
  1724. local ret;
  1725. [[ ${#} -ne 0 ]] || die "${FUNCNAME}: no command specified.";
  1726. [[ -n ${BUILD_DIR} ]] || die "${FUNCNAME}: BUILD_DIR not set.";
  1727. mkdir -p "${BUILD_DIR}" || die;
  1728. pushd "${BUILD_DIR}" > /dev/null || die;
  1729. "${@}";
  1730. ret=${?};
  1731. popd > /dev/null || die;
  1732. return ${ret}
  1733. }
  1734. src_compile ()
  1735. {
  1736. multilib-minimal_src_compile "$@"
  1737. }
  1738. src_configure ()
  1739. {
  1740. multilib-minimal_src_configure "$@"
  1741. }
  1742. src_install ()
  1743. {
  1744. multilib-minimal_src_install "$@"
  1745. }
  1746. src_prepare ()
  1747. {
  1748. default;
  1749. elibtoolize
  1750. }
  1751. src_test ()
  1752. {
  1753. multilib-minimal_src_test "$@"
  1754. }
  1755. src_unpack ()
  1756. {
  1757. default
  1758. }
  1759. tc-arch ()
  1760. {
  1761. tc-ninja_magic_to_arch portage "$@"
  1762. }
  1763. tc-arch-kernel ()
  1764. {
  1765. tc-ninja_magic_to_arch kern "$@"
  1766. }
  1767. tc-check-openmp ()
  1768. {
  1769. if ! tc-has-openmp; then
  1770. eerror "Your current compiler does not support OpenMP!";
  1771. if tc-is-gcc; then
  1772. eerror "Enable OpenMP support by building sys-devel/gcc with USE=\"openmp\".";
  1773. else
  1774. if tc-is-clang; then
  1775. eerror "OpenMP support in sys-devel/clang is provided by sys-libs/libomp.";
  1776. fi;
  1777. fi;
  1778. die "Active compiler does not have required support for OpenMP";
  1779. fi
  1780. }
  1781. tc-cpp-is-true ()
  1782. {
  1783. local CONDITION=${1};
  1784. shift;
  1785. local RESULT=$($(tc-getTARGET_CPP) "${@}" -P - <<-EOF 2>/dev/null
  1786. #if ${CONDITION}
  1787. true
  1788. #endif
  1789. EOF
  1790. );
  1791. [[ ${RESULT} == true ]]
  1792. }
  1793. tc-detect-is-softfloat ()
  1794. {
  1795. [[ $(tc-getTARGET_CPP) == "gcc -E" ]] && return 1;
  1796. case ${CTARGET:-${CHOST}} in
  1797. *-newlib | *-elf | *-eabi)
  1798. return 1
  1799. ;;
  1800. arm*)
  1801. if tc-cpp-is-true "defined(__ARM_PCS_VFP)"; then
  1802. echo "no";
  1803. else
  1804. if tc-cpp-is-true "defined(__SOFTFP__)"; then
  1805. echo "yes";
  1806. else
  1807. echo "softfp";
  1808. fi;
  1809. fi;
  1810. return 0
  1811. ;;
  1812. *)
  1813. return 1
  1814. ;;
  1815. esac
  1816. }
  1817. tc-enables-pie ()
  1818. {
  1819. tc-cpp-is-true "defined(__PIE__)" ${CPPFLAGS} ${CFLAGS}
  1820. }
  1821. tc-enables-ssp ()
  1822. {
  1823. tc-cpp-is-true "defined(__SSP__) || defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS}
  1824. }
  1825. tc-enables-ssp-all ()
  1826. {
  1827. tc-cpp-is-true "defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS}
  1828. }
  1829. tc-enables-ssp-strong ()
  1830. {
  1831. tc-cpp-is-true "defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS}
  1832. }
  1833. tc-endian ()
  1834. {
  1835. local host=$1;
  1836. [[ -z ${host} ]] && host=${CTARGET:-${CHOST}};
  1837. host=${host%%-*};
  1838. case ${host} in
  1839. aarch64*be)
  1840. echo big
  1841. ;;
  1842. aarch64)
  1843. echo little
  1844. ;;
  1845. alpha*)
  1846. echo little
  1847. ;;
  1848. arm*b*)
  1849. echo big
  1850. ;;
  1851. arm*)
  1852. echo little
  1853. ;;
  1854. cris*)
  1855. echo little
  1856. ;;
  1857. hppa*)
  1858. echo big
  1859. ;;
  1860. i?86*)
  1861. echo little
  1862. ;;
  1863. ia64*)
  1864. echo little
  1865. ;;
  1866. m68*)
  1867. echo big
  1868. ;;
  1869. mips*l*)
  1870. echo little
  1871. ;;
  1872. mips*)
  1873. echo big
  1874. ;;
  1875. powerpc*le)
  1876. echo little
  1877. ;;
  1878. powerpc*)
  1879. echo big
  1880. ;;
  1881. riscv*)
  1882. echo little
  1883. ;;
  1884. s390*)
  1885. echo big
  1886. ;;
  1887. sh*b*)
  1888. echo big
  1889. ;;
  1890. sh*)
  1891. echo little
  1892. ;;
  1893. sparc*)
  1894. echo big
  1895. ;;
  1896. x86_64*)
  1897. echo little
  1898. ;;
  1899. *)
  1900. echo wtf
  1901. ;;
  1902. esac
  1903. }
  1904. tc-env_build ()
  1905. {
  1906. tc-export_build_env;
  1907. 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) "$@"
  1908. }
  1909. tc-export ()
  1910. {
  1911. local var;
  1912. for var in "$@";
  1913. do
  1914. [[ $(type -t "tc-get${var}") != "function" ]] && die "tc-export: invalid export variable '${var}'";
  1915. "tc-get${var}" > /dev/null;
  1916. done
  1917. }
  1918. tc-export_build_env ()
  1919. {
  1920. tc-export "$@";
  1921. if tc-is-cross-compiler; then
  1922. : ${BUILD_CFLAGS:=-O1 -pipe};
  1923. : ${BUILD_CXXFLAGS:=-O1 -pipe};
  1924. : ${BUILD_CPPFLAGS:= };
  1925. : ${BUILD_LDFLAGS:= };
  1926. else
  1927. : ${BUILD_CFLAGS:=${CFLAGS}};
  1928. : ${BUILD_CXXFLAGS:=${CXXFLAGS}};
  1929. : ${BUILD_CPPFLAGS:=${CPPFLAGS}};
  1930. : ${BUILD_LDFLAGS:=${LDFLAGS}};
  1931. fi;
  1932. export BUILD_{C,CXX,CPP,LD}FLAGS;
  1933. local v;
  1934. for v in BUILD_{C,CXX,CPP,LD}FLAGS;
  1935. do
  1936. export ${v#BUILD_}_FOR_BUILD="${!v}";
  1937. done
  1938. }
  1939. tc-get-compiler-type ()
  1940. {
  1941. local code='
  1942. #if defined(__PATHSCALE__)
  1943. HAVE_PATHCC
  1944. #elif defined(__clang__)
  1945. HAVE_CLANG
  1946. #elif defined(__GNUC__)
  1947. HAVE_GCC
  1948. #endif
  1949. ';
  1950. local res=$($(tc-getCPP "$@") -E -P - <<<"${code}");
  1951. case ${res} in
  1952. *HAVE_PATHCC*)
  1953. echo pathcc
  1954. ;;
  1955. *HAVE_CLANG*)
  1956. echo clang
  1957. ;;
  1958. *HAVE_GCC*)
  1959. echo gcc
  1960. ;;
  1961. *)
  1962. echo unknown
  1963. ;;
  1964. esac
  1965. }
  1966. tc-getAR ()
  1967. {
  1968. tc-getPROG AR ar "$@"
  1969. }
  1970. tc-getAS ()
  1971. {
  1972. tc-getPROG AS as "$@"
  1973. }
  1974. tc-getBUILD_AR ()
  1975. {
  1976. tc-getBUILD_PROG AR ar "$@"
  1977. }
  1978. tc-getBUILD_AS ()
  1979. {
  1980. tc-getBUILD_PROG AS as "$@"
  1981. }
  1982. tc-getBUILD_CC ()
  1983. {
  1984. tc-getBUILD_PROG CC gcc "$@"
  1985. }
  1986. tc-getBUILD_CPP ()
  1987. {
  1988. tc-getBUILD_PROG CPP "$(tc-getBUILD_CC) -E" "$@"
  1989. }
  1990. tc-getBUILD_CXX ()
  1991. {
  1992. tc-getBUILD_PROG CXX g++ "$@"
  1993. }
  1994. tc-getBUILD_LD ()
  1995. {
  1996. tc-getBUILD_PROG LD ld "$@"
  1997. }
  1998. tc-getBUILD_NM ()
  1999. {
  2000. tc-getBUILD_PROG NM nm "$@"
  2001. }
  2002. tc-getBUILD_OBJCOPY ()
  2003. {
  2004. tc-getBUILD_PROG OBJCOPY objcopy "$@"
  2005. }
  2006. tc-getBUILD_PKG_CONFIG ()
  2007. {
  2008. tc-getBUILD_PROG PKG_CONFIG pkg-config "$@"
  2009. }
  2010. tc-getBUILD_PROG ()
  2011. {
  2012. local vars="BUILD_$1 $1_FOR_BUILD HOST$1";
  2013. tc-is-cross-compiler || vars+=" $1";
  2014. _tc-getPROG CBUILD "${vars}" "${@:2}"
  2015. }
  2016. tc-getBUILD_RANLIB ()
  2017. {
  2018. tc-getBUILD_PROG RANLIB ranlib "$@"
  2019. }
  2020. tc-getBUILD_STRIP ()
  2021. {
  2022. tc-getBUILD_PROG STRIP strip "$@"
  2023. }
  2024. tc-getCC ()
  2025. {
  2026. tc-getPROG CC gcc "$@"
  2027. }
  2028. tc-getCPP ()
  2029. {
  2030. tc-getPROG CPP "${CC:-gcc} -E" "$@"
  2031. }
  2032. tc-getCXX ()
  2033. {
  2034. tc-getPROG CXX g++ "$@"
  2035. }
  2036. tc-getDLLWRAP ()
  2037. {
  2038. tc-getPROG DLLWRAP dllwrap "$@"
  2039. }
  2040. tc-getF77 ()
  2041. {
  2042. tc-getPROG F77 gfortran "$@"
  2043. }
  2044. tc-getFC ()
  2045. {
  2046. tc-getPROG FC gfortran "$@"
  2047. }
  2048. tc-getGCJ ()
  2049. {
  2050. tc-getPROG GCJ gcj "$@"
  2051. }
  2052. tc-getGO ()
  2053. {
  2054. tc-getPROG GO gccgo "$@"
  2055. }
  2056. tc-getLD ()
  2057. {
  2058. tc-getPROG LD ld "$@"
  2059. }
  2060. tc-getNM ()
  2061. {
  2062. tc-getPROG NM nm "$@"
  2063. }
  2064. tc-getOBJCOPY ()
  2065. {
  2066. tc-getPROG OBJCOPY objcopy "$@"
  2067. }
  2068. tc-getOBJDUMP ()
  2069. {
  2070. tc-getPROG OBJDUMP objdump "$@"
  2071. }
  2072. tc-getPKG_CONFIG ()
  2073. {
  2074. tc-getPROG PKG_CONFIG pkg-config "$@"
  2075. }
  2076. tc-getPROG ()
  2077. {
  2078. _tc-getPROG CHOST "$@"
  2079. }
  2080. tc-getRANLIB ()
  2081. {
  2082. tc-getPROG RANLIB ranlib "$@"
  2083. }
  2084. tc-getRC ()
  2085. {
  2086. tc-getPROG RC windres "$@"
  2087. }
  2088. tc-getSTRIP ()
  2089. {
  2090. tc-getPROG STRIP strip "$@"
  2091. }
  2092. tc-getTARGET_CPP ()
  2093. {
  2094. if [[ -n ${CTARGET} ]]; then
  2095. _tc-getPROG CTARGET TARGET_CPP "gcc -E" "$@";
  2096. else
  2097. tc-getCPP "$@";
  2098. fi
  2099. }
  2100. tc-has-openmp ()
  2101. {
  2102. local base="${T}/test-tc-openmp";
  2103. cat <<-EOF > "${base}.c"
  2104. #include <omp.h>
  2105. int main() {
  2106. int nthreads, tid, ret = 0;
  2107. #pragma omp parallel private(nthreads, tid)
  2108. {
  2109. tid = omp_get_thread_num();
  2110. nthreads = omp_get_num_threads(); ret += tid + nthreads;
  2111. }
  2112. return ret;
  2113. }
  2114. EOF
  2115.  
  2116. $(tc-getCC "$@") -fopenmp "${base}.c" -o "${base}" &> /dev/null;
  2117. local ret=$?;
  2118. rm -f "${base}"*;
  2119. return ${ret}
  2120. }
  2121. tc-has-tls ()
  2122. {
  2123. local base="${T}/test-tc-tls";
  2124. cat <<-EOF > "${base}.c"
  2125. int foo(int *i) {
  2126. static __thread int j = 0;
  2127. return *i ? j : *i;
  2128. }
  2129. EOF
  2130.  
  2131. local flags;
  2132. case $1 in
  2133. -s)
  2134. flags="-S"
  2135. ;;
  2136. -c)
  2137. flags="-c"
  2138. ;;
  2139. -l)
  2140.  
  2141. ;;
  2142. -*)
  2143. die "Usage: tc-has-tls [-c|-l] [toolchain prefix]"
  2144. ;;
  2145. esac;
  2146. case "${CHOST}" in
  2147. *-darwin*)
  2148. : ${flags:=-dynamiclib}
  2149. ;;
  2150. *)
  2151. : ${flags:=-fPIC -shared -Wl,-z,defs}
  2152. ;;
  2153. esac;
  2154. [[ $1 == -* ]] && shift;
  2155. $(tc-getCC "$@") ${flags} "${base}.c" -o "${base}" &> /dev/null;
  2156. local ret=$?;
  2157. rm -f "${base}"*;
  2158. return ${ret}
  2159. }
  2160. tc-is-clang ()
  2161. {
  2162. [[ $(tc-get-compiler-type) == clang ]]
  2163. }
  2164. tc-is-cross-compiler ()
  2165. {
  2166. [[ ${CBUILD:-${CHOST}} != ${CHOST} ]]
  2167. }
  2168. tc-is-gcc ()
  2169. {
  2170. [[ $(tc-get-compiler-type) == gcc ]]
  2171. }
  2172. tc-is-softfloat ()
  2173. {
  2174. tc-detect-is-softfloat || tc-tuple-is-softfloat
  2175. }
  2176. tc-is-static-only ()
  2177. {
  2178. local host=${CTARGET:-${CHOST}};
  2179. [[ ${host} == *-mint* ]]
  2180. }
  2181. tc-ld-disable-gold ()
  2182. {
  2183. if ! tc-ld-is-gold "$@"; then
  2184. return;
  2185. fi;
  2186. ewarn "Forcing usage of the BFD linker instead of GOLD";
  2187. local ld=$(tc-getLD "$@");
  2188. local bfd_ld="${ld%% *}.bfd";
  2189. local path_ld=$(which "${bfd_ld}" 2>/dev/null);
  2190. [[ -e ${path_ld} ]] && export LD=${bfd_ld};
  2191. local fallback="true";
  2192. if tc-is-gcc; then
  2193. local major=$(gcc-major-version "$@");
  2194. local minor=$(gcc-minor-version "$@");
  2195. if [[ ${major} -gt 4 ]] || [[ ${major} -eq 4 && ${minor} -ge 8 ]]; then
  2196. export LDFLAGS="${LDFLAGS} -fuse-ld=bfd";
  2197. fallback="false";
  2198. fi;
  2199. else
  2200. if tc-is-clang; then
  2201. local major=$(clang-major-version "$@");
  2202. local minor=$(clang-minor-version "$@");
  2203. if [[ ${major} -gt 3 ]] || [[ ${major} -eq 3 && ${minor} -ge 5 ]]; then
  2204. export LDFLAGS="${LDFLAGS} -fuse-ld=bfd";
  2205. fallback="false";
  2206. fi;
  2207. fi;
  2208. fi;
  2209. if [[ ${fallback} == "true" ]]; then
  2210. if [[ -e ${path_ld} ]]; then
  2211. local d="${T}/bfd-linker";
  2212. mkdir -p "${d}";
  2213. ln -sf "${path_ld}" "${d}"/ld;
  2214. export LDFLAGS="${LDFLAGS} -B${d}";
  2215. else
  2216. die "unable to locate a BFD linker to bypass gold";
  2217. fi;
  2218. fi
  2219. }
  2220. tc-ld-is-gold ()
  2221. {
  2222. local out;
  2223. out=$($(tc-getLD "$@") --version 2>&1);
  2224. if [[ ${out} == *"GNU gold"* ]]; then
  2225. return 0;
  2226. fi;
  2227. local base="${T}/test-tc-gold";
  2228. cat <<-EOF > "${base}.c"
  2229. int main() { return 0; }
  2230. EOF
  2231.  
  2232. out=$($(tc-getCC "$@") ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -Wl,--version "${base}.c" -o "${base}" 2>&1);
  2233. rm -f "${base}"*;
  2234. if [[ ${out} == *"GNU gold"* ]]; then
  2235. return 0;
  2236. fi;
  2237. return 1
  2238. }
  2239. tc-ninja_magic_to_arch ()
  2240. {
  2241. function ninj ()
  2242. {
  2243. [[ ${type} == "kern" ]] && echo $1 || echo $2
  2244. };
  2245. local type=$1;
  2246. local host=$2;
  2247. [[ -z ${host} ]] && host=${CTARGET:-${CHOST}};
  2248. case ${host} in
  2249. powerpc-apple-darwin*)
  2250. echo ppc-macos
  2251. ;;
  2252. powerpc64-apple-darwin*)
  2253. echo ppc64-macos
  2254. ;;
  2255. i?86-apple-darwin*)
  2256. echo x86-macos
  2257. ;;
  2258. x86_64-apple-darwin*)
  2259. echo x64-macos
  2260. ;;
  2261. sparc-sun-solaris*)
  2262. echo sparc-solaris
  2263. ;;
  2264. sparcv9-sun-solaris*)
  2265. echo sparc64-solaris
  2266. ;;
  2267. i?86-pc-solaris*)
  2268. echo x86-solaris
  2269. ;;
  2270. x86_64-pc-solaris*)
  2271. echo x64-solaris
  2272. ;;
  2273. powerpc-ibm-aix*)
  2274. echo ppc-aix
  2275. ;;
  2276. mips-sgi-irix*)
  2277. echo mips-irix
  2278. ;;
  2279. ia64w-hp-hpux*)
  2280. echo ia64w-hpux
  2281. ;;
  2282. ia64-hp-hpux*)
  2283. echo ia64-hpux
  2284. ;;
  2285. hppa*64*-hp-hpux*)
  2286. echo hppa64-hpux
  2287. ;;
  2288. hppa*-hp-hpux*)
  2289. echo hppa-hpux
  2290. ;;
  2291. i?86-pc-freebsd*)
  2292. echo x86-freebsd
  2293. ;;
  2294. x86_64-pc-freebsd*)
  2295. echo x64-freebsd
  2296. ;;
  2297. powerpc-unknown-openbsd*)
  2298. echo ppc-openbsd
  2299. ;;
  2300. i?86-pc-openbsd*)
  2301. echo x86-openbsd
  2302. ;;
  2303. x86_64-pc-openbsd*)
  2304. echo x64-openbsd
  2305. ;;
  2306. i?86-pc-netbsd*)
  2307. echo x86-netbsd
  2308. ;;
  2309. i?86-pc-interix*)
  2310. echo x86-interix
  2311. ;;
  2312. i?86-pc-winnt*)
  2313. echo x86-winnt
  2314. ;;
  2315. aarch64*)
  2316. echo arm64
  2317. ;;
  2318. alpha*)
  2319. echo alpha
  2320. ;;
  2321. arm*)
  2322. echo arm
  2323. ;;
  2324. avr*)
  2325. ninj avr32 avr
  2326. ;;
  2327. bfin*)
  2328. ninj blackfin bfin
  2329. ;;
  2330. c6x*)
  2331. echo c6x
  2332. ;;
  2333. cris*)
  2334. echo cris
  2335. ;;
  2336. frv*)
  2337. echo frv
  2338. ;;
  2339. hexagon*)
  2340. echo hexagon
  2341. ;;
  2342. hppa*)
  2343. ninj parisc hppa
  2344. ;;
  2345. i?86*)
  2346. if [[ ${type} == "kern" && ${host} == *freebsd* ]]; then
  2347. echo i386;
  2348. else
  2349. echo x86;
  2350. fi
  2351. ;;
  2352. ia64*)
  2353. echo ia64
  2354. ;;
  2355. m68*)
  2356. echo m68k
  2357. ;;
  2358. metag*)
  2359. echo metag
  2360. ;;
  2361. microblaze*)
  2362. echo microblaze
  2363. ;;
  2364. mips*)
  2365. echo mips
  2366. ;;
  2367. nios2*)
  2368. echo nios2
  2369. ;;
  2370. nios*)
  2371. echo nios
  2372. ;;
  2373. or1k | or32*)
  2374. echo openrisc
  2375. ;;
  2376. powerpc*)
  2377. if [[ ${type} == "kern" ]]; then
  2378. echo powerpc;
  2379. else
  2380. if [[ ${host} == powerpc64* ]]; then
  2381. echo ppc64;
  2382. else
  2383. echo ppc;
  2384. fi;
  2385. fi
  2386. ;;
  2387. riscv*)
  2388. echo riscv
  2389. ;;
  2390. s390*)
  2391. echo s390
  2392. ;;
  2393. score*)
  2394. echo score
  2395. ;;
  2396. sh64*)
  2397. ninj sh64 sh
  2398. ;;
  2399. sh*)
  2400. echo sh
  2401. ;;
  2402. sparc64*)
  2403. ninj sparc64 sparc
  2404. ;;
  2405. sparc*)
  2406. [[ ${PROFILE_ARCH} == "sparc64" ]] && ninj sparc64 sparc || echo sparc
  2407. ;;
  2408. tile*)
  2409. echo tile
  2410. ;;
  2411. vax*)
  2412. echo vax
  2413. ;;
  2414. x86_64*freebsd*)
  2415. echo amd64
  2416. ;;
  2417. x86_64*)
  2418. if [[ ${type} == "kern" ]]; then
  2419. echo x86;
  2420. else
  2421. echo amd64;
  2422. fi
  2423. ;;
  2424. xtensa*)
  2425. echo xtensa
  2426. ;;
  2427. *)
  2428. echo unknown
  2429. ;;
  2430. esac
  2431. }
  2432. tc-stack-grows-down ()
  2433. {
  2434. case ${ARCH} in
  2435. hppa | metag)
  2436. return 1
  2437. ;;
  2438. esac;
  2439. return 0
  2440. }
  2441. tc-tuple-is-softfloat ()
  2442. {
  2443. local CTARGET=${CTARGET:-${CHOST}};
  2444. case ${CTARGET//_/-} in
  2445. bfin* | h8300*)
  2446. echo "only"
  2447. ;;
  2448. *-softfloat-*)
  2449. echo "yes"
  2450. ;;
  2451. *-softfp-*)
  2452. echo "softfp"
  2453. ;;
  2454. arm*-hardfloat-* | arm*eabihf)
  2455. echo "no"
  2456. ;;
  2457. *-newlib | *-elf | *-eabi)
  2458. echo "no"
  2459. ;;
  2460. arm*)
  2461. echo "yes"
  2462. ;;
  2463. *)
  2464. echo "no"
  2465. ;;
  2466. esac
  2467. }
  2468. uclibctoolize ()
  2469. {
  2470. die "Use elibtoolize"
  2471. }
  2472. ver_cut ()
  2473. {
  2474. local range=${1};
  2475. local v=${2:-${PV}};
  2476. local start end;
  2477. local -a comp;
  2478. __eapi7_ver_split "${v}";
  2479. local max=$((${#comp[@]}/2));
  2480. __eapi7_ver_parse_range "${range}" "${max}";
  2481. local IFS=;
  2482. if [[ ${start} -gt 0 ]]; then
  2483. start=$(( start*2 - 1 ));
  2484. fi;
  2485. echo "${comp[*]:start:end*2-start}"
  2486. }
  2487. ver_rs ()
  2488. {
  2489. local v;
  2490. (( ${#} & 1 )) && v=${@: -1} || v=${PV};
  2491. local start end i;
  2492. local -a comp;
  2493. __eapi7_ver_split "${v}";
  2494. local max=$((${#comp[@]}/2 - 1));
  2495. while [[ ${#} -ge 2 ]]; do
  2496. __eapi7_ver_parse_range "${1}" "${max}";
  2497. for ((i = start*2; i <= end*2; i+=2 ))
  2498. do
  2499. [[ ${i} -eq 0 && -z ${comp[i]} ]] && continue;
  2500. comp[i]=${2};
  2501. done;
  2502. shift 2;
  2503. done;
  2504. local IFS=;
  2505. echo "${comp[*]}"
  2506. }
  2507. ver_test ()
  2508. {
  2509. local va op vb;
  2510. if [[ $# -eq 3 ]]; then
  2511. va=${1};
  2512. shift;
  2513. else
  2514. va=${PVR};
  2515. fi;
  2516. [[ $# -eq 2 ]] || die "${FUNCNAME}: bad number of arguments";
  2517. op=${1};
  2518. vb=${2};
  2519. case ${op} in
  2520. -eq | -ne | -lt | -le | -gt | -ge)
  2521.  
  2522. ;;
  2523. *)
  2524. die "${FUNCNAME}: invalid operator: ${op}"
  2525. ;;
  2526. esac;
  2527. __eapi7_ver_compare "${va}" "${vb}";
  2528. test $? "${op}" 2
  2529. }
RAW Paste Data