spacepaste

  1.  
  2. declare -x ABI="arm64"
  3. declare -x ABI_MIPS=""
  4. declare -x ABI_PPC=""
  5. declare -x ABI_S390=""
  6. declare -x ABI_X86=""
  7. declare -x ALSA_CARDS=""
  8. declare -x APACHE2_MODULES=""
  9. declare -x APACHE2_MPMS=""
  10. declare -x ARCH="arm64"
  11. declare BDEPEND=""
  12. declare -x BOOTSTRAP_USE="cxx unicode internal-glib split-usr python_targets_python3_6 python_targets_python2_7 multilib"
  13. declare -x CALLIGRA_EXPERIMENTAL_FEATURES=""
  14. declare -x CALLIGRA_FEATURES=""
  15. declare -x CAMERAS=""
  16. declare -x CBUILD="aarch64-unknown-linux-gnu"
  17. declare -x CFLAGS="-march=armv8-a+crc -mtune=cortex-a53 -ftree-vectorize -O2 -pipe -fomit-frame-pointer -Wno-error"
  18. declare -x CFLAGS_default
  19. declare -x CHOST="aarch64-unknown-linux-gnu"
  20. declare -x CHOST_arm64="aarch64-unknown-linux-gnu"
  21. declare -x CHOST_default="aarch64-unknown-linux-gnu"
  22. declare -x COLLECTD_PLUGINS=""
  23. declare -x CONF_PREFIX="/usr"
  24. declare -x CPU_FLAGS_ARM=""
  25. declare -x CPU_FLAGS_X86=""
  26. declare -x CTARGET_default="aarch64-unknown-linux-gnu"
  27. declare -x CURL_SSL=""
  28. declare -x CXXFLAGS="-march=armv8-a+crc -mtune=cortex-a53 -ftree-vectorize -O2 -pipe -fomit-frame-pointer -Wno-error"
  29. declare -x DCC_EMAILLOG_WHOM_TO_BLAME=""
  30. declare -x DEFAULT_ABI="arm64"
  31. declare -x DEFINED_PHASES=" compile configure install prepare setup"
  32. declare DEPEND="
  33. dev-libs/lzo:2=
  34. sys-apps/util-linux:0=[static-libs(+)?]
  35. sys-libs/zlib:0=
  36. convert? (
  37. sys-fs/e2fsprogs:0=
  38. sys-libs/e2fsprogs-libs:0=
  39. reiserfs? (
  40. >=sys-fs/reiserfsprogs-3.6.27
  41. )
  42. )
  43. python? ( python_single_target_python3_4? ( dev-lang/python:3.4 ) python_single_target_python3_5? ( dev-lang/python:3.5 ) python_single_target_python3_6? ( dev-lang/python:3.6 ) >=dev-lang/python-exec-2:=[python_targets_python3_4(-)?,python_targets_python3_5(-)?,python_targets_python3_6(-)?,-python_single_target_jython2_7(-),-python_single_target_pypy(-),-python_single_target_pypy3(-),-python_single_target_python2_7(-),-python_single_target_python3_7(-),python_single_target_python3_4(+)?,python_single_target_python3_5(+)?,python_single_target_python3_6(+)?] )
  44. zstd? ( app-arch/zstd:0= )
  45. convert? ( sys-apps/acl )
  46. >=app-text/asciidoc-8.6.0
  47. app-text/docbook-xml-dtd:4.5
  48. app-text/xmlto
  49. python? ( dev-python/setuptools[python_targets_python3_4(-)?,python_targets_python3_5(-)?,python_targets_python3_6(-)?,-python_single_target_jython2_7(-),-python_single_target_pypy(-),-python_single_target_pypy3(-),-python_single_target_python2_7(-),-python_single_target_python3_7(-),python_single_target_python3_4(+)?,python_single_target_python3_5(+)?,python_single_target_python3_6(+)?] )
  50. static? (
  51. dev-libs/lzo:2[static-libs(+)]
  52. sys-apps/util-linux:0[static-libs(+)]
  53. sys-libs/zlib:0[static-libs(+)]
  54. convert? (
  55. sys-fs/e2fsprogs:0[static-libs(+)]
  56. sys-libs/e2fsprogs-libs:0[static-libs(+)]
  57. reiserfs? (
  58. >=sys-fs/reiserfsprogs-3.6.27[static-libs(+)]
  59. )
  60. )
  61. zstd? ( app-arch/zstd:0[static-libs(+)] )
  62. )
  63. "
  64. declare DESCRIPTION="Btrfs filesystem utilities"
  65. declare -x DESTTREE="/usr"
  66. declare -x DIROPTIONS="-m0755"
  67. declare -x EAPI="6"
  68. declare -- ECONF_SOURCE="."
  69. declare -x ELIBC="glibc"
  70. declare -x ENLIGHTENMENT_MODULES=""
  71. declare -x ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
  72. declare -x EVCS_OFFLINE="1"
  73. declare -x EXEOPTIONS="-m0755"
  74. declare -x FCFLAGS="-O2"
  75. 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}\""
  76. declare -x FFLAGS="-O2"
  77. declare -x FFTOOLS=""
  78. declare -x GCC_SPECS=""
  79. declare -x GENTOO_WS="/home/Necktwi/workspace/Gentoo/"
  80. declare -x GPSD_PROTOCOLS=""
  81. declare -x GRUB_PLATFORMS=""
  82. declare HDEPEND=""
  83. declare HOMEPAGE="https://btrfs.wiki.kernel.org"
  84. declare -x INCLUDE_SERVER_DIR="/tmp/distcc-pump.2CxOJT"
  85. declare -x INCLUDE_SERVER_PID="19648"
  86. declare -x INCLUDE_SERVER_PORT="/tmp/distcc-pump.2CxOJT/socket"
  87. declare -x INHERITED=" toolchain-funcs multilib bash-completion-r1 python-utils-r1 python-single-r1"
  88. declare -x INPUT_DEVICES=""
  89. declare -x INSDESTTREE=""
  90. declare -x INSOPTIONS="-m0644"
  91. declare IUSE="+convert python reiserfs static static-libs +zstd python_targets_python3_4 python_targets_python3_5 python_targets_python3_6 python_single_target_python3_4 python_single_target_python3_5 python_single_target_python3_6"
  92. declare -x IUSE_EFFECTIVE="alpha amd64 amd64-fbsd amd64-linux arm arm64 convert elibc_AIX elibc_Cygwin elibc_Darwin elibc_DragonFly elibc_FreeBSD elibc_HPUX elibc_Interix elibc_NetBSD elibc_OpenBSD elibc_SunOS elibc_Winnt elibc_bionic elibc_glibc elibc_mingw elibc_mintlib elibc_musl elibc_uclibc hppa 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 ppc ppc-aix ppc-macos ppc64 ppc64-linux prefix prefix-chain prefix-guest python python_single_target_python3_4 python_single_target_python3_5 python_single_target_python3_6 python_targets_python3_4 python_targets_python3_5 python_targets_python3_6 reiserfs s390 sh sparc sparc-solaris sparc64-solaris static static-libs userland_BSD userland_GNU x64-cygwin x64-macos x64-solaris x86 x86-cygwin x86-fbsd x86-linux x86-macos x86-solaris x86-winnt zstd"
  93. declare -x IUSE_IMPLICIT="prefix prefix-chain prefix-guest"
  94. declare -x KERNEL="linux"
  95. declare -x KERNEL_ABI="arm64"
  96. declare -x KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
  97. declare -x L10N=""
  98. declare -x LANG="en_US.utf8"
  99. declare -x LANGUAGE="en_US.utf8"
  100. declare -x LCD_DEVICES=""
  101. declare -x LC_ADDRESS="en_US.utf8"
  102. declare -x LC_COLLATE="C"
  103. declare -x LC_CTYPE="en_US.utf8"
  104. declare -x LC_IDENTIFICATION="en_US.utf8"
  105. declare -x LC_MEASUREMENT="en_US.utf8"
  106. declare -x LC_MESSAGES="en_US.utf8"
  107. declare -x LC_MONETARY="en_US.utf8"
  108. declare -x LC_NAME="en_US.utf8"
  109. declare -x LC_NUMERIC="en_US.utf8"
  110. declare -x LC_PAPER="en_US.utf8"
  111. declare -x LC_TELEPHONE="en_US.utf8"
  112. declare -x LC_TIME="en_US.utf8"
  113. declare -x LDFLAGS="-Wl,-O1 -Wl,--as-needed"
  114. declare -x LDFLAGS_default
  115. declare -x LIBDIR_arm64="lib64"
  116. declare -x LIBDIR_default="lib"
  117. declare -x LIBOPTIONS="-m0644"
  118. declare -x LIBREOFFICE_EXTENSIONS=""
  119. declare -x LICENSE="GPL-2"
  120. declare -x LIRC_DEVICES=""
  121. declare -x LLVM_TARGETS=""
  122. declare -x MAIL="/var/mail/Necktwi"
  123. declare -x MAKEOPTS="-j1"
  124. declare -x MANPAGER="manpager"
  125. declare -x MONKEYD_PLUGINS=""
  126. declare -x MULTILIB_ABIS="arm64"
  127. declare -x MULTILIB_STRICT_DENY="64-bit.*shared object"
  128. 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"
  129. declare -x MULTILIB_STRICT_EXEMPT="(perl5|gcc|gcc-lib|binutils|eclipse-3|debug|portage|udev|systemd|clang|python-exec|llvm)"
  130. declare -- MY_PV="v4.17.1"
  131. declare -x NETBEANS="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml"
  132. declare -x NETBEANS_MODULES=""
  133. declare -x NGINX_MODULES_HTTP=""
  134. declare -x NGINX_MODULES_MAIL=""
  135. declare -x NGINX_MODULES_STREAM=""
  136. declare -x OFED_DRIVERS=""
  137. declare -x OFFICE_IMPLEMENTATION=""
  138. declare -x OPENMPI_FABRICS=""
  139. declare -x OPENMPI_OFED_FEATURES=""
  140. declare -x OPENMPI_RM=""
  141. declare -a PATCHES=([0]="/var/tmp/portage/sys-fs/btrfs-progs-4.17.1/files/btrfs-progs-man-no-gz.patch")
  142. declare -x PATH="/usr/lib/ccache/bin:/usr/lib64/distcc/bin:/usr/lib/portage/python3.6/ebuild-helpers/xattr:/usr/lib/portage/python3.6/ebuild-helpers:/usr/aarch64-RPi3B-linux-musl/gcc-bin/8.2.0:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin"
  143. declare PDEPEND=""
  144. declare -x PHP_TARGETS=""
  145. declare -x PKG_CONFIG_PATH="/usr/lib/pkgconfig/"
  146. declare -x PORTAGE_COMPRESSION_COMMAND="bzip2"
  147. declare -a PORTAGE_DOCOMPRESS=([0]="/usr/share/doc" [1]="/usr/share/info" [2]="/usr/share/man")
  148. declare -x PORTAGE_DOCOMPRESS_SIZE_LIMIT="128"
  149. declare -a PORTAGE_DOCOMPRESS_SKIP=([0]="/usr/share/doc/btrfs-progs-4.17.1/html")
  150. declare -a PORTAGE_DOSTRIP=([0]="/")
  151. declare -a PORTAGE_DOSTRIP_SKIP=()
  152. declare -x POSTGRES_TARGETS=""
  153. 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"
  154. declare -x PROPERTIES=""
  155. declare -x PYTHONDONTWRITEBYTECODE="1"
  156. declare -a PYTHON_COMPAT=([0]="python3_4" [1]="python3_5" [2]="python3_6")
  157. declare -- PYTHON_DEPS="python_single_target_python3_4? ( dev-lang/python:3.4 ) python_single_target_python3_5? ( dev-lang/python:3.5 ) python_single_target_python3_6? ( dev-lang/python:3.6 ) >=dev-lang/python-exec-2:=[python_targets_python3_4(-)?,python_targets_python3_5(-)?,python_targets_python3_6(-)?,-python_single_target_jython2_7(-),-python_single_target_pypy(-),-python_single_target_pypy3(-),-python_single_target_python2_7(-),-python_single_target_python3_7(-),python_single_target_python3_4(+)?,python_single_target_python3_5(+)?,python_single_target_python3_6(+)?]"
  158. declare -- PYTHON_REQUIRED_USE="^^ ( python_single_target_python3_4 python_single_target_python3_5 python_single_target_python3_6 ) python_single_target_python3_4? ( python_targets_python3_4 ) python_single_target_python3_5? ( python_targets_python3_5 ) python_single_target_python3_6? ( python_targets_python3_6 )"
  159. declare -x PYTHON_SINGLE_TARGET="python3_6"
  160. declare -x PYTHON_TARGETS="python3_6"
  161. declare -- PYTHON_USEDEP="python_targets_python3_4(-)?,python_targets_python3_5(-)?,python_targets_python3_6(-)?,-python_single_target_jython2_7(-),-python_single_target_pypy(-),-python_single_target_pypy3(-),-python_single_target_python2_7(-),-python_single_target_python3_7(-),python_single_target_python3_4(+)?,python_single_target_python3_5(+)?,python_single_target_python3_6(+)?"
  162. declare -x QEMU_SOFTMMU_TARGETS=""
  163. declare -x QEMU_USER_TARGETS=""
  164. declare RDEPEND="
  165. dev-libs/lzo:2=
  166. sys-apps/util-linux:0=[static-libs(+)?]
  167. sys-libs/zlib:0=
  168. convert? (
  169. sys-fs/e2fsprogs:0=
  170. sys-libs/e2fsprogs-libs:0=
  171. reiserfs? (
  172. >=sys-fs/reiserfsprogs-3.6.27
  173. )
  174. )
  175. python? ( python_single_target_python3_4? ( dev-lang/python:3.4 ) python_single_target_python3_5? ( dev-lang/python:3.5 ) python_single_target_python3_6? ( dev-lang/python:3.6 ) >=dev-lang/python-exec-2:=[python_targets_python3_4(-)?,python_targets_python3_5(-)?,python_targets_python3_6(-)?,-python_single_target_jython2_7(-),-python_single_target_pypy(-),-python_single_target_pypy3(-),-python_single_target_python2_7(-),-python_single_target_python3_7(-),python_single_target_python3_4(+)?,python_single_target_python3_5(+)?,python_single_target_python3_6(+)?] )
  176. zstd? ( app-arch/zstd:0= )
  177. "
  178. declare REPOSITORY
  179. declare REQUIRED_USE="python? ( ^^ ( python_single_target_python3_4 python_single_target_python3_5 python_single_target_python3_6 ) python_single_target_python3_4? ( python_targets_python3_4 ) python_single_target_python3_5? ( python_targets_python3_5 ) python_single_target_python3_6? ( python_targets_python3_6 ) ) "
  180. declare -x RESTRICT="test"
  181. 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}\""
  182. declare -x ROS_MESSAGES=""
  183. declare -x RUBY_TARGETS=""
  184. declare -x S="/var/tmp/portage/sys-fs/btrfs-progs-4.17.1/work/btrfs-progs-v4.17.1"
  185. declare -x SANDBOX_DEBUG="0"
  186. declare -x SANDBOX_DENY=""
  187. declare -x SANDBOX_PREDICT="/var/tmp/portage/sys-fs/btrfs-progs-4.17.1/homedir"
  188. declare -x SANDBOX_READ="/:/var/CCache:/var/tmp"
  189. declare -x SANDBOX_VERBOSE="1"
  190. 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/CCache:/var/tmp:/var/tmp/:/var/tmp/portage/sys-fs/btrfs-progs-4.17.1/homedir/.bash_history:/var/tmp/portage/.distcc/"
  191. declare -x SANE_BACKENDS=""
  192. declare -x SHELL="/bin/bash"
  193. declare -x SLOT="0/0"
  194. declare SRC_URI="https://www.kernel.org/pub/linux/kernel/people/kdave/btrfs-progs/btrfs-progs-v4.17.1.tar.xz"
  195. declare -x SSH_CLIENT="192.168.2.21 50679 22"
  196. declare -x SSH_CONNECTION="192.168.2.21 50679 192.168.2.23 22"
  197. declare -x SSH_TTY="/dev/pts/0"
  198. declare -x TWISTED_DISABLE_WRITING_OF_PLUGIN_CACHE="1"
  199. declare -x UNCACHED_ERR_FD=""
  200. declare -x USE="arm64 convert elibc_glibc kernel_linux python_single_target_python3_6 python_targets_python3_6 userland_GNU zstd"
  201. declare -x USERLAND="GNU"
  202. declare -x USE_EXPAND_IMPLICIT="ARCH ELIBC KERNEL USERLAND"
  203. declare -x USE_EXPAND_UNPREFIXED="ARCH"
  204. 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 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"
  205. declare -x USE_EXPAND_VALUES_ELIBC="AIX bionic Cygwin Darwin DragonFly FreeBSD glibc HPUX Interix mingw mintlib musl NetBSD OpenBSD SunOS uclibc Winnt"
  206. declare -x USE_EXPAND_VALUES_KERNEL="AIX Darwin FreeBSD freemint HPUX linux NetBSD OpenBSD SunOS Winnt"
  207. declare -x USE_EXPAND_VALUES_USERLAND="BSD GNU"
  208. declare -x UWSGI_PLUGINS=""
  209. declare -x VIDEO_CARDS=""
  210. declare -x VISUAL="emacs"
  211. declare -x VOICEMAIL_STORAGE=""
  212. declare -x XFCE_PLUGINS=""
  213. declare -x XTABLES_ADDONS=""
  214. declare -x _E_DOCDESTTREE_=""
  215. declare -x _E_EXEDESTTREE_=""
  216. declare -- _MULTILIB_ECLASS="1"
  217. declare -a _PYTHON_ALL_IMPLS=([0]="jython2_7" [1]="pypy" [2]="pypy3" [3]="python2_7" [4]="python3_4" [5]="python3_5" [6]="python3_6" [7]="python3_7")
  218. declare -- _PYTHON_SINGLE_R1="1"
  219. declare -a _PYTHON_SUPPORTED_IMPLS=([0]="python3_4" [1]="python3_5" [2]="python3_6")
  220. declare -a _PYTHON_UNSUPPORTED_IMPLS=([0]="jython2_7" [1]="pypy" [2]="pypy3" [3]="python2_7" [4]="python3_7")
  221. declare -- _PYTHON_UTILS_R1="1"
  222. declare -- _TOOLCHAIN_FUNCS_ECLASS="1"
  223. declare -x export
  224. declare -- libbtrfs_soname="0"
  225. declare -- phase_func
  226. declare -- started_applying="1"
  227. PYTHON ()
  228. {
  229. die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#.24.28PYTHON.29.2C_.24.7BEPYTHON.7D"
  230. }
  231. __eapi6_src_install ()
  232. {
  233. if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then
  234. emake DESTDIR="${D}" install;
  235. fi;
  236. einstalldocs
  237. }
  238. __eapi6_src_prepare ()
  239. {
  240. if [[ $(declare -p PATCHES 2>/dev/null) == "declare -a"* ]]; then
  241. [[ ${#PATCHES[@]} -gt 0 ]] && eapply "${PATCHES[@]}";
  242. else
  243. if [[ -n ${PATCHES} ]]; then
  244. eapply ${PATCHES};
  245. fi;
  246. fi;
  247. eapply_user
  248. }
  249. _bash-completion-r1_get_bashcompdir ()
  250. {
  251. debug-print-function ${FUNCNAME} "${@}";
  252. _bash-completion-r1_get_bashdir completionsdir /usr/share/bash-completion/completions
  253. }
  254. _bash-completion-r1_get_bashdir ()
  255. {
  256. debug-print-function ${FUNCNAME} "${@}";
  257. if $(tc-getPKG_CONFIG) --exists bash-completion &> /dev/null; then
  258. local path;
  259. path=$($(tc-getPKG_CONFIG) --variable="${1}" bash-completion) || die;
  260. echo "${path#${EPREFIX}}";
  261. else
  262. echo "${2}";
  263. fi
  264. }
  265. _bash-completion-r1_get_bashhelpersdir ()
  266. {
  267. debug-print-function ${FUNCNAME} "${@}";
  268. _bash-completion-r1_get_bashdir helpersdir /usr/share/bash-completion/helpers
  269. }
  270. _clang_fullversion ()
  271. {
  272. local ver="$1";
  273. shift;
  274. set -- $($(tc-getCPP "$@") -E -P - <<<"__clang_major__ __clang_minor__ __clang_patchlevel__");
  275. eval echo "$ver"
  276. }
  277. _eapply_patch ()
  278. {
  279. local f=${1};
  280. local prefix=${2};
  281. started_applying=1;
  282. ebegin "${prefix:-Applying }${f##*/}";
  283. ${patch_cmd} -p1 -f -s -g0 --no-backup-if-mismatch "${patch_options[@]}" < "${f}";
  284. failed=${?};
  285. if ! eend "${failed}"; then
  286. __helpers_die "patch -p1 ${patch_options[*]} failed with ${f}";
  287. fi
  288. }
  289. _gcc-install-dir ()
  290. {
  291. echo "$(LC_ALL=C $(tc-getCC) -print-search-dirs 2> /dev/null | awk '$1=="install:" {print $2}')"
  292. }
  293. _gcc-specs-directive_raw ()
  294. {
  295. local cc=$(tc-getCC);
  296. local specfiles=$(LC_ALL=C ${cc} -v 2>&1 | awk '$1=="Reading" {print $NF}');
  297. ${cc} -dumpspecs 2> /dev/null | cat - ${specfiles} | awk -v directive=$1 'BEGIN { pspec=""; spec=""; outside=1 }
  298. $1=="*"directive":" { pspec=spec; spec=""; outside=0; next }
  299. outside || NF==0 || ( substr($1,1,1)=="*" && substr($1,length($1),1)==":" ) { outside=1; next }
  300. spec=="" && substr($0,1,1)=="+" { spec=pspec " " substr($0,2); next }
  301. { spec=spec $0 }
  302. END { print spec }';
  303. return 0
  304. }
  305. _gcc-specs-exists ()
  306. {
  307. [[ -f $(_gcc-install-dir)/$1 ]]
  308. }
  309. _gcc_fullversion ()
  310. {
  311. local ver="$1";
  312. shift;
  313. set -- $($(tc-getCPP "$@") -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__");
  314. eval echo "$ver"
  315. }
  316. _python_check_dead_variables ()
  317. {
  318. local v;
  319. for v in PYTHON_DEPEND PYTHON_USE_WITH{,_OR,_OPT} {RESTRICT,SUPPORT}_PYTHON_ABIS;
  320. do
  321. if [[ -n ${!v} ]]; then
  322. die "${v} is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#Ebuild_head";
  323. fi;
  324. done;
  325. for v in PYTHON_{CPPFLAGS,CFLAGS,CXXFLAGS,LDFLAGS};
  326. do
  327. if [[ -n ${!v} ]]; then
  328. die "${v} is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#PYTHON_CFLAGS";
  329. fi;
  330. done;
  331. for v in PYTHON_TESTS_RESTRICTED_ABIS PYTHON_EXPORT_PHASE_FUNCTIONS PYTHON_VERSIONED_{SCRIPTS,EXECUTABLES} PYTHON_NONVERSIONED_EXECUTABLES;
  332. do
  333. if [[ -n ${!v} ]]; then
  334. die "${v} is invalid for python-r1 suite";
  335. fi;
  336. done;
  337. for v in DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES DISTUTILS_SETUP_FILES DISTUTILS_GLOBAL_OPTIONS DISTUTILS_SRC_TEST PYTHON_MODNAME;
  338. do
  339. if [[ -n ${!v} ]]; then
  340. die "${v} is invalid for distutils-r1, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#${v}";
  341. fi;
  342. done;
  343. if [[ -n ${DISTUTILS_DISABLE_TEST_DEPENDENCY} ]]; then
  344. die "${v} is invalid for distutils-r1, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#DISTUTILS_SRC_TEST";
  345. fi;
  346. for v in PYTHON_BDEPEND PYTHON_MULTIPLE_ABIS PYTHON_ABI_TYPE PYTHON_RESTRICTED_ABIS PYTHON_TESTS_FAILURES_TOLERANT_ABIS PYTHON_CFFI_MODULES_GENERATION_COMMANDS;
  347. do
  348. if [[ -n ${!v} ]]; then
  349. die "${v} is invalid for python-r1 suite";
  350. fi;
  351. done
  352. }
  353. _python_check_locale_sanity ()
  354. {
  355. local -x LC_ALL=${1};
  356. local IFS=;
  357. local lc=({a..z});
  358. local uc=({A..Z});
  359. local input="${lc[*]}${uc[*]}";
  360. local output=$(tr '[:lower:][:upper:]' '[:upper:][:lower:]' <<<"${input}");
  361. [[ ${output} == "${uc[*]}${lc[*]}" ]]
  362. }
  363. _python_impl_matches ()
  364. {
  365. [[ ${#} -ge 2 ]] || die "${FUNCNAME}: takes at least 2 parameters";
  366. local impl=${1} pattern;
  367. shift;
  368. for pattern in "$@";
  369. do
  370. if [[ ${pattern} == -2 ]]; then
  371. ! python_is_python3 "${impl}";
  372. return;
  373. else
  374. if [[ ${pattern} == -3 ]]; then
  375. python_is_python3 "${impl}";
  376. return;
  377. else
  378. if [[ ${impl/./_} == ${pattern/./_} ]]; then
  379. return 0;
  380. fi;
  381. fi;
  382. fi;
  383. done;
  384. return 1
  385. }
  386. _python_impl_supported ()
  387. {
  388. debug-print-function ${FUNCNAME} "${@}";
  389. [[ ${#} -eq 1 ]] || die "${FUNCNAME}: takes exactly 1 argument (impl).";
  390. local impl=${1};
  391. case "${impl}" in
  392. python2_7 | python3_[4567] | jython2_7)
  393. return 0
  394. ;;
  395. pypy1_[89] | pypy2_0 | python2_[56] | python3_[123])
  396. return 1
  397. ;;
  398. pypy | pypy3)
  399. if [[ ${EAPI:-0} == [01234] ]]; then
  400. die "PyPy is supported in EAPI 5 and newer only.";
  401. fi
  402. ;;
  403. *)
  404. [[ -n ${PYTHON_COMPAT_NO_STRICT} ]] && return 1;
  405. die "Invalid implementation in PYTHON_COMPAT: ${impl}"
  406. ;;
  407. esac
  408. }
  409. _python_ln_rel ()
  410. {
  411. debug-print-function ${FUNCNAME} "${@}";
  412. local target=${1};
  413. local symname=${2};
  414. local tgpath=${target%/*}/;
  415. local sympath=${symname%/*}/;
  416. local rel_target=;
  417. while [[ -n ${sympath} ]]; do
  418. local tgseg= symseg=;
  419. while [[ ! -n ${tgseg} && -n ${tgpath} ]]; do
  420. tgseg=${tgpath%%/*};
  421. tgpath=${tgpath#${tgseg}/};
  422. done;
  423. while [[ ! -n ${symseg} && -n ${sympath} ]]; do
  424. symseg=${sympath%%/*};
  425. sympath=${sympath#${symseg}/};
  426. done;
  427. if [[ ${tgseg} != ${symseg} ]]; then
  428. rel_target=../${rel_target}${tgseg:+${tgseg}/};
  429. fi;
  430. done;
  431. rel_target+=${tgpath}${target##*/};
  432. debug-print "${FUNCNAME}: ${symname} -> ${target}";
  433. debug-print "${FUNCNAME}: rel_target = ${rel_target}";
  434. ln -fs "${rel_target}" "${symname}"
  435. }
  436. _python_set_impls ()
  437. {
  438. local i;
  439. if ! declare -p PYTHON_COMPAT &> /dev/null; then
  440. die 'PYTHON_COMPAT not declared.';
  441. fi;
  442. if [[ $(declare -p PYTHON_COMPAT) != "declare -a"* ]]; then
  443. die 'PYTHON_COMPAT must be an array.';
  444. fi;
  445. for i in "${PYTHON_COMPAT[@]}";
  446. do
  447. _python_impl_supported "${i}";
  448. done;
  449. local supp=() unsupp=();
  450. for i in "${_PYTHON_ALL_IMPLS[@]}";
  451. do
  452. if has "${i}" "${PYTHON_COMPAT[@]}"; then
  453. supp+=("${i}");
  454. else
  455. unsupp+=("${i}");
  456. fi;
  457. done;
  458. if [[ ! -n ${supp[@]} ]]; then
  459. die "No supported implementation in PYTHON_COMPAT.";
  460. fi;
  461. if [[ -n ${_PYTHON_SUPPORTED_IMPLS[@]} ]]; then
  462. if [[ ${_PYTHON_SUPPORTED_IMPLS[@]} != ${supp[@]} ]]; then
  463. eerror "Supported impls (PYTHON_COMPAT) changed between inherits!";
  464. eerror "Before: ${_PYTHON_SUPPORTED_IMPLS[*]}";
  465. eerror "Now : ${supp[*]}";
  466. die "_PYTHON_SUPPORTED_IMPLS integrity check failed";
  467. fi;
  468. if [[ ${_PYTHON_UNSUPPORTED_IMPLS[@]} != ${unsupp[@]} ]]; then
  469. eerror "Unsupported impls changed between inherits!";
  470. eerror "Before: ${_PYTHON_UNSUPPORTED_IMPLS[*]}";
  471. eerror "Now : ${unsupp[*]}";
  472. die "_PYTHON_UNSUPPORTED_IMPLS integrity check failed";
  473. fi;
  474. else
  475. _PYTHON_SUPPORTED_IMPLS=("${supp[@]}");
  476. _PYTHON_UNSUPPORTED_IMPLS=("${unsupp[@]}");
  477. readonly _PYTHON_SUPPORTED_IMPLS _PYTHON_UNSUPPORTED_IMPLS;
  478. fi
  479. }
  480. _tc-getPROG ()
  481. {
  482. local tuple=$1;
  483. local v var vars=$2;
  484. local prog=($3);
  485. var=${vars%% *};
  486. for v in ${vars};
  487. do
  488. if [[ -n ${!v} ]]; then
  489. export ${var}="${!v}";
  490. echo "${!v}";
  491. return 0;
  492. fi;
  493. done;
  494. local search=;
  495. [[ -n $4 ]] && search=$(type -p $4-${prog[0]});
  496. [[ -z ${search} && -n ${!tuple} ]] && search=$(type -p ${!tuple}-${prog[0]});
  497. [[ -n ${search} ]] && prog[0]=${search##*/};
  498. export ${var}="${prog[*]}";
  499. echo "${!var}"
  500. }
  501. bashcomp_alias ()
  502. {
  503. debug-print-function ${FUNCNAME} "${@}";
  504. [[ ${#} -lt 2 ]] && die "Usage: ${FUNCNAME} <basename> <alias>...";
  505. local base=${1} f;
  506. shift;
  507. for f in "$@";
  508. do
  509. dosym "${base}" "$(_bash-completion-r1_get_bashcompdir)/${f}" || return;
  510. done
  511. }
  512. clang-fullversion ()
  513. {
  514. _clang_fullversion '$1.$2.$3' "$@"
  515. }
  516. clang-major-version ()
  517. {
  518. _clang_fullversion '$1' "$@"
  519. }
  520. clang-micro-version ()
  521. {
  522. _clang_fullversion '$3' "$@"
  523. }
  524. clang-minor-version ()
  525. {
  526. _clang_fullversion '$2' "$@"
  527. }
  528. clang-version ()
  529. {
  530. _clang_fullversion '$1.$2' "$@"
  531. }
  532. dobashcomp ()
  533. {
  534. debug-print-function ${FUNCNAME} "${@}";
  535. ( insopts -m 0644;
  536. insinto "$(_bash-completion-r1_get_bashcompdir)";
  537. doins "${@}" )
  538. }
  539. eapply ()
  540. {
  541. local failed patch_cmd=patch;
  542. local -x LC_COLLATE=POSIX;
  543. type -P gpatch > /dev/null && patch_cmd=gpatch;
  544. function _eapply_patch ()
  545. {
  546. local f=${1};
  547. local prefix=${2};
  548. started_applying=1;
  549. ebegin "${prefix:-Applying }${f##*/}";
  550. ${patch_cmd} -p1 -f -s -g0 --no-backup-if-mismatch "${patch_options[@]}" < "${f}";
  551. failed=${?};
  552. if ! eend "${failed}"; then
  553. __helpers_die "patch -p1 ${patch_options[*]} failed with ${f}";
  554. fi
  555. };
  556. local patch_options=() files=();
  557. local i found_doublehyphen;
  558. for ((i = 1; i <= ${#@}; ++i ))
  559. do
  560. if [[ ${@:i:1} == -- ]]; then
  561. patch_options=("${@:1:i-1}");
  562. files=("${@:i+1}");
  563. found_doublehyphen=1;
  564. break;
  565. fi;
  566. done;
  567. if [[ -z ${found_doublehyphen} ]]; then
  568. for ((i = 1; i <= ${#@}; ++i ))
  569. do
  570. if [[ ${@:i:1} != -* ]]; then
  571. patch_options=("${@:1:i-1}");
  572. files=("${@:i}");
  573. break;
  574. fi;
  575. done;
  576. for i in "${files[@]}";
  577. do
  578. if [[ ${i} == -* ]]; then
  579. die "eapply: all options must be passed before non-options";
  580. fi;
  581. done;
  582. fi;
  583. if [[ ${#files[@]} -eq 0 ]]; then
  584. die "eapply: no files specified";
  585. fi;
  586. local f;
  587. for f in "${files[@]}";
  588. do
  589. if [[ -d ${f} ]]; then
  590. function _eapply_get_files ()
  591. {
  592. local LC_ALL=POSIX;
  593. local prev_shopt=$(shopt -p nullglob);
  594. shopt -s nullglob;
  595. local f;
  596. for f in "${1}"/*;
  597. do
  598. if [[ ${f} == *.diff || ${f} == *.patch ]]; then
  599. files+=("${f}");
  600. fi;
  601. done;
  602. ${prev_shopt}
  603. };
  604. local files=();
  605. _eapply_get_files "${f}";
  606. [[ ${#files[@]} -eq 0 ]] && die "No *.{patch,diff} files in directory ${f}";
  607. einfo "Applying patches from ${f} ...";
  608. local f2;
  609. for f2 in "${files[@]}";
  610. do
  611. _eapply_patch "${f2}" ' ';
  612. [[ ${failed} -ne 0 ]] && return "${failed}";
  613. done;
  614. else
  615. _eapply_patch "${f}";
  616. [[ ${failed} -ne 0 ]] && return "${failed}";
  617. fi;
  618. done;
  619. return 0
  620. }
  621. eapply_user ()
  622. {
  623. [[ ${EBUILD_PHASE} == prepare ]] || die "eapply_user() called during invalid phase: ${EBUILD_PHASE}";
  624. local tagfile=${T}/.portage_user_patches_applied;
  625. [[ -f ${tagfile} ]] && return;
  626. >> "${tagfile}";
  627. local basedir=${PORTAGE_CONFIGROOT%/}/etc/portage/patches;
  628. local applied d f;
  629. local -A _eapply_user_patches;
  630. local prev_shopt=$(shopt -p nullglob);
  631. shopt -s nullglob;
  632. for d in "${basedir}"/${CATEGORY}/{${P}-${PR},${P},${PN}}{:${SLOT%/*},};
  633. do
  634. for f in "${d}"/*;
  635. do
  636. if [[ ( ${f} == *.diff || ${f} == *.patch ) && -z ${_eapply_user_patches[${f##*/}]} ]]; then
  637. _eapply_user_patches[${f##*/}]=${f};
  638. fi;
  639. done;
  640. done;
  641. if [[ ${#_eapply_user_patches[@]} -gt 0 ]]; then
  642. while read -r -d '' f; do
  643. f=${_eapply_user_patches[${f}]};
  644. if [[ -s ${f} ]]; then
  645. eapply "${f}";
  646. applied=1;
  647. fi;
  648. done < <(printf -- '%s\0' "${!_eapply_user_patches[@]}" |
  649. LC_ALL=C sort -z);
  650. fi;
  651. ${prev_shopt};
  652. [[ -n ${applied} ]] && ewarn "User patches applied."
  653. }
  654. econf_build ()
  655. {
  656. local CBUILD=${CBUILD:-${CHOST}};
  657. tc-env_build econf --build=${CBUILD} --host=${CBUILD} "$@"
  658. }
  659. einstalldocs ()
  660. {
  661. ( if ! declare -p DOCS &> /dev/null; then
  662. local d;
  663. for d in README* ChangeLog AUTHORS NEWS TODO CHANGES THANKS BUGS FAQ CREDITS CHANGELOG;
  664. do
  665. [[ -f ${d} && -s ${d} ]] && docinto / && dodoc "${d}";
  666. done;
  667. else
  668. if [[ $(declare -p DOCS) == "declare -a"* ]]; then
  669. [[ ${#DOCS[@]} -gt 0 ]] && docinto / && dodoc -r "${DOCS[@]}";
  670. else
  671. [[ -n ${DOCS} ]] && docinto / && dodoc -r ${DOCS};
  672. fi;
  673. fi );
  674. ( if [[ $(declare -p HTML_DOCS 2>/dev/null) == "declare -a"* ]]; then
  675. [[ ${#HTML_DOCS[@]} -gt 0 ]] && docinto html && dodoc -r "${HTML_DOCS[@]}";
  676. else
  677. [[ -n ${HTML_DOCS} ]] && docinto html && dodoc -r ${HTML_DOCS};
  678. fi )
  679. }
  680. gcc-fullversion ()
  681. {
  682. _gcc_fullversion '$1.$2.$3' "$@"
  683. }
  684. gcc-major-version ()
  685. {
  686. _gcc_fullversion '$1' "$@"
  687. }
  688. gcc-micro-version ()
  689. {
  690. _gcc_fullversion '$3' "$@"
  691. }
  692. gcc-minor-version ()
  693. {
  694. _gcc_fullversion '$2' "$@"
  695. }
  696. gcc-specs-directive ()
  697. {
  698. local directive subdname subdirective;
  699. directive="$(_gcc-specs-directive_raw $1)";
  700. while [[ ${directive} == *%\(*\)* ]]; do
  701. subdname=${directive/*%\(};
  702. subdname=${subdname/\)*};
  703. subdirective="$(_gcc-specs-directive_raw ${subdname})";
  704. directive="${directive//\%(${subdname})/${subdirective}}";
  705. done;
  706. echo "${directive}";
  707. return 0
  708. }
  709. gcc-specs-nostrict ()
  710. {
  711. local directive;
  712. directive=$(gcc-specs-directive cc1);
  713. [[ "${directive/\{!fstrict-overflow:}" != "${directive}" ]]
  714. }
  715. gcc-specs-now ()
  716. {
  717. local directive;
  718. directive=$(gcc-specs-directive link_command);
  719. [[ "${directive/\{!nonow:}" != "${directive}" ]]
  720. }
  721. gcc-specs-pie ()
  722. {
  723. local directive;
  724. directive=$(gcc-specs-directive cc1);
  725. [[ "${directive/\{!nopie:}" != "${directive}" ]]
  726. }
  727. gcc-specs-relro ()
  728. {
  729. local directive;
  730. directive=$(gcc-specs-directive link_command);
  731. [[ "${directive/\{!norelro:}" != "${directive}" ]]
  732. }
  733. gcc-specs-ssp ()
  734. {
  735. local directive;
  736. directive=$(gcc-specs-directive cc1);
  737. [[ "${directive/\{!fno-stack-protector:}" != "${directive}" ]]
  738. }
  739. gcc-specs-ssp-to-all ()
  740. {
  741. local directive;
  742. directive=$(gcc-specs-directive cc1);
  743. [[ "${directive/\{!fno-stack-protector-all:}" != "${directive}" ]]
  744. }
  745. gcc-specs-stack-check ()
  746. {
  747. local directive;
  748. directive=$(gcc-specs-directive cc1);
  749. [[ "${directive/\{!fno-stack-check:}" != "${directive}" ]]
  750. }
  751. gcc-version ()
  752. {
  753. _gcc_fullversion '$1.$2' "$@"
  754. }
  755. gen_usr_ldscript ()
  756. {
  757. local lib libdir=$(get_libdir) output_format="" auto=false suffix=$(get_libname);
  758. [[ -z ${ED+set} ]] && local ED=${D%/}${EPREFIX}/;
  759. tc-is-static-only && return;
  760. if [[ $(type -t multilib_is_native_abi) == "function" ]]; then
  761. multilib_is_native_abi || return 0;
  762. fi;
  763. case ${CTARGET:-${CHOST}} in
  764. *-darwin*)
  765. ;;
  766. *-android*)
  767. return 0
  768. ;;
  769. *linux* | *-freebsd* | *-openbsd* | *-netbsd*)
  770. use prefix && return 0
  771. ;;
  772. *)
  773. return 0
  774. ;;
  775. esac;
  776. dodir /usr/${libdir};
  777. if [[ $1 == "-a" ]]; then
  778. auto=true;
  779. shift;
  780. dodir /${libdir};
  781. fi;
  782. local flags=(${CFLAGS} ${LDFLAGS} -Wl,--verbose);
  783. if $(tc-getLD) --version | grep -q 'GNU gold'; then
  784. local d="${T}/bfd-linker";
  785. mkdir -p "${d}";
  786. ln -sf $(which ${CHOST}-ld.bfd) "${d}"/ld;
  787. flags+=(-B"${d}");
  788. fi;
  789. output_format=$($(tc-getCC) "${flags[@]}" 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p');
  790. [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )";
  791. for lib in "$@";
  792. do
  793. local tlib;
  794. if ${auto}; then
  795. lib="lib${lib}${suffix}";
  796. else
  797. [[ -r ${ED}/${libdir}/${lib} ]] || continue;
  798. fi;
  799. case ${CTARGET:-${CHOST}} in
  800. *-darwin*)
  801. if ${auto}; then
  802. tlib=$(scanmacho -qF'%S#F' "${ED}"/usr/${libdir}/${lib});
  803. else
  804. tlib=$(scanmacho -qF'%S#F' "${ED}"/${libdir}/${lib});
  805. fi;
  806. [[ -z ${tlib} ]] && die "unable to read install_name from ${lib}";
  807. tlib=${tlib##*/};
  808. if ${auto}; then
  809. mv "${ED}"/usr/${libdir}/${lib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die;
  810. if [[ ${tlib} != ${lib%${suffix}}.*${suffix#.} ]]; then
  811. mv "${ED}"/usr/${libdir}/${tlib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die;
  812. fi;
  813. rm -f "${ED}"/${libdir}/${lib};
  814. fi;
  815. if [[ ! -w "${ED}/${libdir}/${tlib}" ]]; then
  816. chmod u+w "${ED}${libdir}/${tlib}";
  817. local nowrite=yes;
  818. fi;
  819. install_name_tool -id "${EPREFIX}"/${libdir}/${tlib} "${ED}"/${libdir}/${tlib} || die "install_name_tool failed";
  820. [[ -n ${nowrite} ]] && chmod u-w "${ED}${libdir}/${tlib}";
  821. pushd "${ED}/usr/${libdir}" > /dev/null;
  822. ln -snf "../../${libdir}/${tlib}" "${lib}";
  823. popd > /dev/null
  824. ;;
  825. *)
  826. if ${auto}; then
  827. tlib=$(scanelf -qF'%S#F' "${ED}"/usr/${libdir}/${lib});
  828. [[ -z ${tlib} ]] && die "unable to read SONAME from ${lib}";
  829. mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die;
  830. if [[ ${tlib} != ${lib}* ]]; then
  831. mv "${ED}"/usr/${libdir}/${tlib}* "${ED}"/${libdir}/ || die;
  832. fi;
  833. rm -f "${ED}"/${libdir}/${lib};
  834. else
  835. tlib=${lib};
  836. fi;
  837. cat > "${ED}/usr/${libdir}/${lib}" <<-END_LDSCRIPT
  838. /* GNU ld script
  839. Since Gentoo has critical dynamic libraries in /lib, and the static versions
  840. in /usr/lib, we need to have a "fake" dynamic lib in /usr/lib, otherwise we
  841. run into linking problems. This "fake" dynamic lib is a linker script that
  842. redirects the linker to the real lib. And yes, this works in the cross-
  843. compiling scenario as the sysroot-ed linker will prepend the real path.
  844. See bug https://bugs.gentoo.org/4411 for more info.
  845. */
  846. ${output_format}
  847. GROUP ( ${EPREFIX}/${libdir}/${tlib} )
  848. END_LDSCRIPT
  849. ;;
  850. esac
  851. fperms a+x "/usr/${libdir}/${lib}" || die "could not change perms on ${lib}";
  852. done
  853. }
  854. get_abi_CFLAGS ()
  855. {
  856. get_abi_var CFLAGS "$@"
  857. }
  858. get_abi_CHOST ()
  859. {
  860. get_abi_var CHOST "$@"
  861. }
  862. get_abi_CTARGET ()
  863. {
  864. get_abi_var CTARGET "$@"
  865. }
  866. get_abi_FAKE_TARGETS ()
  867. {
  868. get_abi_var FAKE_TARGETS "$@"
  869. }
  870. get_abi_LDFLAGS ()
  871. {
  872. get_abi_var LDFLAGS "$@"
  873. }
  874. get_abi_LIBDIR ()
  875. {
  876. get_abi_var LIBDIR "$@"
  877. }
  878. get_abi_var ()
  879. {
  880. local flag=$1;
  881. local abi=${2:-${ABI:-${DEFAULT_ABI:-default}}};
  882. local var="${flag}_${abi}";
  883. echo ${!var}
  884. }
  885. get_all_abis ()
  886. {
  887. local x order="" mvar dvar;
  888. mvar="MULTILIB_ABIS";
  889. dvar="DEFAULT_ABI";
  890. if [[ -n $1 ]]; then
  891. mvar="$1_${mvar}";
  892. dvar="$1_${dvar}";
  893. fi;
  894. if [[ -z ${!mvar} ]]; then
  895. echo "default";
  896. return 0;
  897. fi;
  898. for x in ${!mvar};
  899. do
  900. if [[ ${x} != ${!dvar} ]]; then
  901. order="${order:+${order} }${x}";
  902. fi;
  903. done;
  904. order="${order:+${order} }${!dvar}";
  905. echo ${order};
  906. return 0
  907. }
  908. get_all_libdirs ()
  909. {
  910. local libdirs abi;
  911. for abi in ${MULTILIB_ABIS};
  912. do
  913. libdirs+=" $(get_abi_LIBDIR ${abi})";
  914. done;
  915. [[ " ${libdirs} " != *" lib "* ]] && libdirs+=" lib";
  916. echo "${libdirs}"
  917. }
  918. get_bashcompdir ()
  919. {
  920. debug-print-function ${FUNCNAME} "${@}";
  921. echo "${EPREFIX}$(_bash-completion-r1_get_bashcompdir)"
  922. }
  923. get_bashhelpersdir ()
  924. {
  925. debug-print-function ${FUNCNAME} "${@}";
  926. echo "${EPREFIX}$(_bash-completion-r1_get_bashhelpersdir)"
  927. }
  928. get_exeext ()
  929. {
  930. case ${CHOST} in
  931. *-cygwin* | mingw* | *-mingw*)
  932. echo ".exe"
  933. ;;
  934. esac
  935. }
  936. get_install_abis ()
  937. {
  938. local x order="";
  939. if [[ -z ${MULTILIB_ABIS} ]]; then
  940. echo "default";
  941. return 0;
  942. fi;
  943. if [[ ${EMULTILIB_PKG} == "true" ]]; then
  944. for x in ${MULTILIB_ABIS};
  945. do
  946. if [[ ${x} != "${DEFAULT_ABI}" ]]; then
  947. has ${x} ${ABI_DENY} || order="${order} ${x}";
  948. fi;
  949. done;
  950. has ${DEFAULT_ABI} ${ABI_DENY} || order="${order} ${DEFAULT_ABI}";
  951. if [[ -n ${ABI_ALLOW} ]]; then
  952. local ordera="";
  953. for x in ${order};
  954. do
  955. if has ${x} ${ABI_ALLOW}; then
  956. ordera="${ordera} ${x}";
  957. fi;
  958. done;
  959. order=${ordera};
  960. fi;
  961. else
  962. order=${DEFAULT_ABI};
  963. fi;
  964. if [[ -z ${order} ]]; then
  965. 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.";
  966. fi;
  967. echo ${order};
  968. return 0
  969. }
  970. get_libdir ()
  971. {
  972. local libdir_var="LIBDIR_${ABI}";
  973. local libdir="lib";
  974. [[ -n ${ABI} && -n ${!libdir_var} ]] && libdir=${!libdir_var};
  975. echo "${libdir}"
  976. }
  977. get_libname ()
  978. {
  979. local libname;
  980. local ver=$1;
  981. case ${CHOST} in
  982. *-cygwin*)
  983. libname="dll.a"
  984. ;;
  985. mingw* | *-mingw*)
  986. libname="dll"
  987. ;;
  988. *-darwin*)
  989. libname="dylib"
  990. ;;
  991. *-mint*)
  992. libname="irrelevant"
  993. ;;
  994. hppa*-hpux*)
  995. libname="sl"
  996. ;;
  997. *)
  998. libname="so"
  999. ;;
  1000. esac;
  1001. if [[ -z $* ]]; then
  1002. echo ".${libname}";
  1003. else
  1004. for ver in "$@";
  1005. do
  1006. case ${CHOST} in
  1007. *-cygwin*)
  1008. echo ".${ver}.${libname}"
  1009. ;;
  1010. *-darwin*)
  1011. echo ".${ver}.${libname}"
  1012. ;;
  1013. *-mint*)
  1014. echo ".${libname}"
  1015. ;;
  1016. *)
  1017. echo ".${libname}.${ver}"
  1018. ;;
  1019. esac;
  1020. done;
  1021. fi
  1022. }
  1023. get_modname ()
  1024. {
  1025. local modname;
  1026. local ver=$1;
  1027. case ${CHOST} in
  1028. *-darwin*)
  1029. modname="bundle"
  1030. ;;
  1031. *)
  1032. modname="so"
  1033. ;;
  1034. esac;
  1035. echo ".${modname}"
  1036. }
  1037. has_multilib_profile ()
  1038. {
  1039. [ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ]
  1040. }
  1041. in_iuse ()
  1042. {
  1043. local use=${1};
  1044. if [[ -z "${use}" ]]; then
  1045. echo "!!! in_iuse() called without a parameter." 1>&2;
  1046. echo "!!! in_iuse <USEFLAG>" 1>&2;
  1047. die "in_iuse() called without a parameter";
  1048. fi;
  1049. local liuse=(${IUSE_EFFECTIVE});
  1050. has "${use}" "${liuse[@]#[+-]}"
  1051. }
  1052. is_final_abi ()
  1053. {
  1054. has_multilib_profile || return 0;
  1055. set -- $(get_install_abis);
  1056. local LAST_ABI=$#;
  1057. [[ ${!LAST_ABI} == ${ABI} ]]
  1058. }
  1059. multilib_env ()
  1060. {
  1061. local CTARGET=${1:-${CTARGET}};
  1062. local cpu=${CTARGET%%*-};
  1063. case ${cpu} in
  1064. aarch64*)
  1065. export CFLAGS_arm=${CFLAGS_arm-};
  1066. case ${cpu} in
  1067. aarch64*be)
  1068. export CHOST_arm="armv8b-${CTARGET#*-}"
  1069. ;;
  1070. *)
  1071. export CHOST_arm="armv8l-${CTARGET#*-}"
  1072. ;;
  1073. esac;
  1074. CHOST_arm=${CHOST_arm/%-gnu/-gnueabi};
  1075. export CTARGET_arm=${CHOST_arm};
  1076. export LIBDIR_arm="lib";
  1077. export CFLAGS_arm64=${CFLAGS_arm64-};
  1078. export CHOST_arm64=${CTARGET};
  1079. export CTARGET_arm64=${CHOST_arm64};
  1080. export LIBDIR_arm64="lib64";
  1081. : ${MULTILIB_ABIS=arm64};
  1082. : ${DEFAULT_ABI=arm64}
  1083. ;;
  1084. x86_64*)
  1085. export CFLAGS_x86=${CFLAGS_x86--m32};
  1086. export CHOST_x86=${CTARGET/x86_64/i686};
  1087. CHOST_x86=${CHOST_x86/%-gnux32/-gnu};
  1088. export CTARGET_x86=${CHOST_x86};
  1089. if [[ ${SYMLINK_LIB} == "yes" ]]; then
  1090. export LIBDIR_x86="lib32";
  1091. else
  1092. export LIBDIR_x86="lib";
  1093. fi;
  1094. export CFLAGS_amd64=${CFLAGS_amd64--m64};
  1095. export CHOST_amd64=${CTARGET/%-gnux32/-gnu};
  1096. export CTARGET_amd64=${CHOST_amd64};
  1097. export LIBDIR_amd64="lib64";
  1098. export CFLAGS_x32=${CFLAGS_x32--mx32};
  1099. export CHOST_x32=${CTARGET/%-gnu/-gnux32};
  1100. export CTARGET_x32=${CHOST_x32};
  1101. export LIBDIR_x32="libx32";
  1102. case ${CTARGET} in
  1103. *-gnux32)
  1104. : ${MULTILIB_ABIS=x32 amd64 x86};
  1105. : ${DEFAULT_ABI=x32}
  1106. ;;
  1107. *)
  1108. : ${MULTILIB_ABIS=amd64 x86};
  1109. : ${DEFAULT_ABI=amd64}
  1110. ;;
  1111. esac
  1112. ;;
  1113. mips64* | mipsisa64*)
  1114. export CFLAGS_o32=${CFLAGS_o32--mabi=32};
  1115. export CHOST_o32=${CTARGET/mips64/mips};
  1116. export CHOST_o32=${CHOST_o32/mipsisa64/mipsisa32};
  1117. export CTARGET_o32=${CHOST_o32};
  1118. export LIBDIR_o32="lib";
  1119. export CFLAGS_n32=${CFLAGS_n32--mabi=n32};
  1120. export CHOST_n32=${CTARGET};
  1121. export CTARGET_n32=${CHOST_n32};
  1122. export LIBDIR_n32="lib32";
  1123. export CFLAGS_n64=${CFLAGS_n64--mabi=64};
  1124. export CHOST_n64=${CTARGET};
  1125. export CTARGET_n64=${CHOST_n64};
  1126. export LIBDIR_n64="lib64";
  1127. : ${MULTILIB_ABIS=n64 n32 o32};
  1128. : ${DEFAULT_ABI=n32}
  1129. ;;
  1130. powerpc64*)
  1131. export CFLAGS_ppc=${CFLAGS_ppc--m32};
  1132. export CHOST_ppc=${CTARGET/powerpc64/powerpc};
  1133. export CTARGET_ppc=${CHOST_ppc};
  1134. export LIBDIR_ppc="lib";
  1135. export CFLAGS_ppc64=${CFLAGS_ppc64--m64};
  1136. export CHOST_ppc64=${CTARGET};
  1137. export CTARGET_ppc64=${CHOST_ppc64};
  1138. export LIBDIR_ppc64="lib64";
  1139. : ${MULTILIB_ABIS=ppc64 ppc};
  1140. : ${DEFAULT_ABI=ppc64}
  1141. ;;
  1142. s390x*)
  1143. export CFLAGS_s390=${CFLAGS_s390--m31};
  1144. export CHOST_s390=${CTARGET/s390x/s390};
  1145. export CTARGET_s390=${CHOST_s390};
  1146. export LIBDIR_s390="lib";
  1147. export CFLAGS_s390x=${CFLAGS_s390x--m64};
  1148. export CHOST_s390x=${CTARGET};
  1149. export CTARGET_s390x=${CHOST_s390x};
  1150. export LIBDIR_s390x="lib64";
  1151. : ${MULTILIB_ABIS=s390x s390};
  1152. : ${DEFAULT_ABI=s390x}
  1153. ;;
  1154. sparc64*)
  1155. export CFLAGS_sparc32=${CFLAGS_sparc32--m32};
  1156. export CHOST_sparc32=${CTARGET/sparc64/sparc};
  1157. export CTARGET_sparc32=${CHOST_sparc32};
  1158. export LIBDIR_sparc32="lib";
  1159. export CFLAGS_sparc64=${CFLAGS_sparc64--m64};
  1160. export CHOST_sparc64=${CTARGET};
  1161. export CTARGET_sparc64=${CHOST_sparc64};
  1162. export LIBDIR_sparc64="lib64";
  1163. : ${MULTILIB_ABIS=sparc64 sparc32};
  1164. : ${DEFAULT_ABI=sparc64}
  1165. ;;
  1166. *)
  1167. : ${MULTILIB_ABIS=default};
  1168. : ${DEFAULT_ABI=default}
  1169. ;;
  1170. esac;
  1171. export MULTILIB_ABIS DEFAULT_ABI
  1172. }
  1173. multilib_toolchain_setup ()
  1174. {
  1175. local v vv;
  1176. export ABI=$1;
  1177. if [[ ${_DEFAULT_ABI_SAVED} == "true" ]]; then
  1178. for v in CHOST CBUILD AS CC CXX F77 FC LD PKG_CONFIG_{LIBDIR,PATH};
  1179. do
  1180. vv="_abi_saved_${v}";
  1181. [[ ${!vv+set} == "set" ]] && export ${v}="${!vv}" || unset ${v};
  1182. unset ${vv};
  1183. done;
  1184. unset _DEFAULT_ABI_SAVED;
  1185. fi;
  1186. if [[ ${ABI} != ${DEFAULT_ABI} ]]; then
  1187. for v in CHOST CBUILD AS CC CXX F77 FC LD PKG_CONFIG_{LIBDIR,PATH};
  1188. do
  1189. vv="_abi_saved_${v}";
  1190. [[ ${!v+set} == "set" ]] && export ${vv}="${!v}" || unset ${vv};
  1191. done;
  1192. export _DEFAULT_ABI_SAVED="true";
  1193. if [[ ${CBUILD} == "${CHOST}" ]]; then
  1194. export CBUILD=$(get_abi_CHOST $1);
  1195. fi;
  1196. export CHOST=$(get_abi_CHOST ${DEFAULT_ABI});
  1197. export CC="$(tc-getCC) $(get_abi_CFLAGS)";
  1198. export CXX="$(tc-getCXX) $(get_abi_CFLAGS)";
  1199. export F77="$(tc-getF77) $(get_abi_CFLAGS)";
  1200. export FC="$(tc-getFC) $(get_abi_CFLAGS)";
  1201. export LD="$(tc-getLD) $(get_abi_LDFLAGS)";
  1202. export CHOST=$(get_abi_CHOST $1);
  1203. export PKG_CONFIG_LIBDIR=${EPREFIX}/usr/$(get_libdir)/pkgconfig;
  1204. export PKG_CONFIG_PATH=${EPREFIX}/usr/share/pkgconfig;
  1205. fi
  1206. }
  1207. newbashcomp ()
  1208. {
  1209. debug-print-function ${FUNCNAME} "${@}";
  1210. ( insopts -m 0644;
  1211. insinto "$(_bash-completion-r1_get_bashcompdir)";
  1212. newins "${@}" )
  1213. }
  1214. number_abis ()
  1215. {
  1216. set -- `get_install_abis`;
  1217. echo $#
  1218. }
  1219. pkg_nofetch ()
  1220. {
  1221. default
  1222. }
  1223. pkg_setup ()
  1224. {
  1225. use python && python-single-r1_pkg_setup
  1226. }
  1227. python-single-r1_pkg_setup ()
  1228. {
  1229. debug-print-function ${FUNCNAME} "${@}";
  1230. [[ ${MERGE_TYPE} != binary ]] && python_setup
  1231. }
  1232. python_abi_depend ()
  1233. {
  1234. die "${FUNCNAME}() is invalid for python-r1 suite"
  1235. }
  1236. python_byte-compile_modules ()
  1237. {
  1238. die "${FUNCNAME}() is invalid for python-r1 suite"
  1239. }
  1240. python_clean_byte-compiled_modules ()
  1241. {
  1242. die "${FUNCNAME}() is invalid for python-r1 suite"
  1243. }
  1244. python_clean_installation_image ()
  1245. {
  1246. die "${FUNCNAME}() is invalid for python-r1 suite"
  1247. }
  1248. python_clean_py-compile_files ()
  1249. {
  1250. die "${FUNCNAME}() is invalid for python-r1 suite"
  1251. }
  1252. python_convert_shebangs ()
  1253. {
  1254. die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#python_convert_shebangs"
  1255. }
  1256. python_disable_pyc ()
  1257. {
  1258. die "${FUNCNAME}() is invalid for python-r1 suite"
  1259. }
  1260. python_doexe ()
  1261. {
  1262. debug-print-function ${FUNCNAME} "${@}";
  1263. local f;
  1264. for f in "$@";
  1265. do
  1266. python_newexe "${f}" "${f##*/}";
  1267. done
  1268. }
  1269. python_doheader ()
  1270. {
  1271. debug-print-function ${FUNCNAME} "${@}";
  1272. [[ -n ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).';
  1273. if [[ ${EAPI:-0} == [0123] ]]; then
  1274. die "python_do* and python_new* helpers are banned in EAPIs older than 4.";
  1275. fi;
  1276. local d PYTHON_INCLUDEDIR=${PYTHON_INCLUDEDIR};
  1277. [[ -n ${PYTHON_INCLUDEDIR} ]] || python_export PYTHON_INCLUDEDIR;
  1278. d=${PYTHON_INCLUDEDIR#${EPREFIX}};
  1279. ( insopts -m 0644;
  1280. insinto "${d}";
  1281. doins -r "${@}" || return ${?} )
  1282. }
  1283. python_domodule ()
  1284. {
  1285. debug-print-function ${FUNCNAME} "${@}";
  1286. [[ -n ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).';
  1287. if [[ ${EAPI:-0} == [0123] ]]; then
  1288. die "python_do* and python_new* helpers are banned in EAPIs older than 4.";
  1289. fi;
  1290. local d;
  1291. if [[ ${python_moduleroot} == /* ]]; then
  1292. d=${python_moduleroot};
  1293. else
  1294. local PYTHON_SITEDIR=${PYTHON_SITEDIR};
  1295. [[ -n ${PYTHON_SITEDIR} ]] || python_export PYTHON_SITEDIR;
  1296. d=${PYTHON_SITEDIR#${EPREFIX}}/${python_moduleroot//.//};
  1297. fi;
  1298. ( insopts -m 0644;
  1299. insinto "${d}";
  1300. doins -r "${@}" || return ${?} );
  1301. python_optimize "${ED%/}/${d}"
  1302. }
  1303. python_doscript ()
  1304. {
  1305. debug-print-function ${FUNCNAME} "${@}";
  1306. local _PYTHON_REWRITE_SHEBANG=1;
  1307. python_doexe "${@}"
  1308. }
  1309. python_enable_pyc ()
  1310. {
  1311. die "${FUNCNAME}() is invalid for python-r1 suite"
  1312. }
  1313. python_execute_function ()
  1314. {
  1315. die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#python_execute_function"
  1316. }
  1317. python_execute_nosetests ()
  1318. {
  1319. die "${FUNCNAME}() is invalid for python-r1 suite"
  1320. }
  1321. python_execute_py.test ()
  1322. {
  1323. die "${FUNCNAME}() is invalid for python-r1 suite"
  1324. }
  1325. python_execute_trial ()
  1326. {
  1327. die "${FUNCNAME}() is invalid for python-r1 suite"
  1328. }
  1329. python_export ()
  1330. {
  1331. debug-print-function ${FUNCNAME} "${@}";
  1332. local impl var;
  1333. case "${1}" in
  1334. python* | jython*)
  1335. impl=${1/_/.};
  1336. shift
  1337. ;;
  1338. pypy | pypy3)
  1339. impl=${1};
  1340. shift
  1341. ;;
  1342. *)
  1343. impl=${EPYTHON};
  1344. if [[ -z ${impl} ]]; then
  1345. die "python_export called without a python implementation and EPYTHON is unset";
  1346. fi
  1347. ;;
  1348. esac;
  1349. debug-print "${FUNCNAME}: implementation: ${impl}";
  1350. for var in "$@";
  1351. do
  1352. case "${var}" in
  1353. EPYTHON)
  1354. export EPYTHON=${impl};
  1355. debug-print "${FUNCNAME}: EPYTHON = ${EPYTHON}"
  1356. ;;
  1357. PYTHON)
  1358. export PYTHON=${EPREFIX}/usr/bin/${impl};
  1359. debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
  1360. ;;
  1361. PYTHON_SITEDIR)
  1362. [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it";
  1363. PYTHON_SITEDIR=$("${PYTHON}" -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())') || die;
  1364. export PYTHON_SITEDIR;
  1365. debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}"
  1366. ;;
  1367. PYTHON_INCLUDEDIR)
  1368. [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it";
  1369. PYTHON_INCLUDEDIR=$("${PYTHON}" -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_inc())') || die;
  1370. export PYTHON_INCLUDEDIR;
  1371. debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR = ${PYTHON_INCLUDEDIR}";
  1372. if [[ ! -d ${PYTHON_INCLUDEDIR} ]]; then
  1373. die "${impl} does not install any header files!";
  1374. fi
  1375. ;;
  1376. PYTHON_LIBPATH)
  1377. [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it";
  1378. PYTHON_LIBPATH=$("${PYTHON}" -c 'import os.path, sysconfig; print(os.path.join(sysconfig.get_config_var("LIBDIR"), sysconfig.get_config_var("LDLIBRARY")) if sysconfig.get_config_var("LDLIBRARY") else "")') || die;
  1379. export PYTHON_LIBPATH;
  1380. debug-print "${FUNCNAME}: PYTHON_LIBPATH = ${PYTHON_LIBPATH}";
  1381. if [[ ! -n ${PYTHON_LIBPATH} ]]; then
  1382. die "${impl} lacks a (usable) dynamic library";
  1383. fi
  1384. ;;
  1385. PYTHON_CFLAGS)
  1386. local val;
  1387. case "${impl}" in
  1388. python*)
  1389. val=$($(tc-getPKG_CONFIG) --cflags ${impl/n/n-}) || die
  1390. ;;
  1391. *)
  1392. die "${impl}: obtaining ${var} not supported"
  1393. ;;
  1394. esac;
  1395. export PYTHON_CFLAGS=${val};
  1396. debug-print "${FUNCNAME}: PYTHON_CFLAGS = ${PYTHON_CFLAGS}"
  1397. ;;
  1398. PYTHON_LIBS)
  1399. local val;
  1400. case "${impl}" in
  1401. python*)
  1402. val=$($(tc-getPKG_CONFIG) --libs ${impl/n/n-}) || die
  1403. ;;
  1404. *)
  1405. die "${impl}: obtaining ${var} not supported"
  1406. ;;
  1407. esac;
  1408. export PYTHON_LIBS=${val};
  1409. debug-print "${FUNCNAME}: PYTHON_LIBS = ${PYTHON_LIBS}"
  1410. ;;
  1411. PYTHON_CONFIG)
  1412. local flags val;
  1413. case "${impl}" in
  1414. python*)
  1415. [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it";
  1416. flags=$("${PYTHON}" -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS") or "")') || die;
  1417. val=${PYTHON}${flags}-config
  1418. ;;
  1419. *)
  1420. die "${impl}: obtaining ${var} not supported"
  1421. ;;
  1422. esac;
  1423. export PYTHON_CONFIG=${val};
  1424. debug-print "${FUNCNAME}: PYTHON_CONFIG = ${PYTHON_CONFIG}"
  1425. ;;
  1426. PYTHON_PKG_DEP)
  1427. local d;
  1428. case ${impl} in
  1429. python2.7)
  1430. PYTHON_PKG_DEP='>=dev-lang/python-2.7.5-r2:2.7'
  1431. ;;
  1432. python3.3)
  1433. PYTHON_PKG_DEP='>=dev-lang/python-3.3.2-r2:3.3'
  1434. ;;
  1435. python*)
  1436. PYTHON_PKG_DEP="dev-lang/python:${impl#python}"
  1437. ;;
  1438. pypy)
  1439. PYTHON_PKG_DEP='>=virtual/pypy-5:0='
  1440. ;;
  1441. pypy3)
  1442. PYTHON_PKG_DEP='>=virtual/pypy3-5:0='
  1443. ;;
  1444. jython2.7)
  1445. PYTHON_PKG_DEP='dev-java/jython:2.7'
  1446. ;;
  1447. *)
  1448. die "Invalid implementation: ${impl}"
  1449. ;;
  1450. esac;
  1451. if [[ -n ${PYTHON_REQ_USE} ]]; then
  1452. PYTHON_PKG_DEP+=[${PYTHON_REQ_USE}];
  1453. fi;
  1454. export PYTHON_PKG_DEP;
  1455. debug-print "${FUNCNAME}: PYTHON_PKG_DEP = ${PYTHON_PKG_DEP}"
  1456. ;;
  1457. PYTHON_SCRIPTDIR)
  1458. local dir;
  1459. export PYTHON_SCRIPTDIR=${EPREFIX}/usr/lib/python-exec/${impl};
  1460. debug-print "${FUNCNAME}: PYTHON_SCRIPTDIR = ${PYTHON_SCRIPTDIR}"
  1461. ;;
  1462. *)
  1463. die "python_export: unknown variable ${var}"
  1464. ;;
  1465. esac;
  1466. done
  1467. }
  1468. python_export_utf8_locale ()
  1469. {
  1470. debug-print-function ${FUNCNAME} "${@}";
  1471. type locale > /dev/null || return 0;
  1472. if [[ $(locale charmap) != UTF-8 ]]; then
  1473. local lang locales="C.UTF-8 en_US.UTF-8 en_GB.UTF-8 $(locale -a)";
  1474. for lang in ${locales};
  1475. do
  1476. if [[ $(LC_ALL=${lang} locale charmap 2>/dev/null) == UTF-8 ]]; then
  1477. if _python_check_locale_sanity "${lang}"; then
  1478. export LC_CTYPE=${lang};
  1479. if [[ -n ${LC_ALL} ]]; then
  1480. export LC_NUMERIC=${LC_ALL};
  1481. export LC_TIME=${LC_ALL};
  1482. export LC_COLLATE=${LC_ALL};
  1483. export LC_MONETARY=${LC_ALL};
  1484. export LC_MESSAGES=${LC_ALL};
  1485. export LC_PAPER=${LC_ALL};
  1486. export LC_NAME=${LC_ALL};
  1487. export LC_ADDRESS=${LC_ALL};
  1488. export LC_TELEPHONE=${LC_ALL};
  1489. export LC_MEASUREMENT=${LC_ALL};
  1490. export LC_IDENTIFICATION=${LC_ALL};
  1491. export LC_ALL=;
  1492. fi;
  1493. return 0;
  1494. fi;
  1495. fi;
  1496. done;
  1497. ewarn "Could not find a UTF-8 locale. This may trigger build failures in";
  1498. ewarn "some python packages. Please ensure that a UTF-8 locale is listed in";
  1499. ewarn "/etc/locale.gen and run locale-gen.";
  1500. return 1;
  1501. fi;
  1502. return 0
  1503. }
  1504. python_fix_shebang ()
  1505. {
  1506. debug-print-function ${FUNCNAME} "${@}";
  1507. [[ -n ${EPYTHON} ]] || die "${FUNCNAME}: EPYTHON unset (pkg_setup not called?)";
  1508. local force quiet;
  1509. while [[ -n ${@} ]]; do
  1510. case "${1}" in
  1511. -f | --force)
  1512. force=1;
  1513. shift
  1514. ;;
  1515. -q | --quiet)
  1516. quiet=1;
  1517. shift
  1518. ;;
  1519. --)
  1520. shift;
  1521. break
  1522. ;;
  1523. *)
  1524. break
  1525. ;;
  1526. esac;
  1527. done;
  1528. [[ -n ${1} ]] || die "${FUNCNAME}: no paths given";
  1529. local path f;
  1530. for path in "$@";
  1531. do
  1532. local any_correct any_fixed is_recursive;
  1533. [[ -d ${path} ]] && is_recursive=1;
  1534. while IFS= read -r -d '' f; do
  1535. local shebang i;
  1536. local error= from=;
  1537. IFS= read -r shebang < "${f}";
  1538. if [[ ${shebang} == '#!'* ]]; then
  1539. local split_shebang=();
  1540. read -r -a split_shebang <<< ${shebang} || die;
  1541. for i in "${split_shebang[@]}";
  1542. do
  1543. case "${i}" in
  1544. *"${EPYTHON}")
  1545. debug-print "${FUNCNAME}: in file ${f#${D%/}}";
  1546. debug-print "${FUNCNAME}: shebang matches EPYTHON: ${shebang}";
  1547. any_correct=1;
  1548. from=${EPYTHON};
  1549. break
  1550. ;;
  1551. *python | *python[23])
  1552. debug-print "${FUNCNAME}: in file ${f#${D%/}}";
  1553. debug-print "${FUNCNAME}: rewriting shebang: ${shebang}";
  1554. if [[ ${i} == *python2 ]]; then
  1555. from=python2;
  1556. if [[ ! -n ${force} ]]; then
  1557. python_is_python3 "${EPYTHON}" && error=1;
  1558. fi;
  1559. else
  1560. if [[ ${i} == *python3 ]]; then
  1561. from=python3;
  1562. if [[ ! -n ${force} ]]; then
  1563. python_is_python3 "${EPYTHON}" || error=1;
  1564. fi;
  1565. else
  1566. from=python;
  1567. fi;
  1568. fi;
  1569. break
  1570. ;;
  1571. *python[23].[0123456789] | *pypy | *pypy3 | *jython[23].[0123456789])
  1572. if [[ ! -n ${force} ]]; then
  1573. error=1;
  1574. else
  1575. case "${i}" in
  1576. *python[23].[0123456789])
  1577. from="python[23].[0123456789]"
  1578. ;;
  1579. *pypy)
  1580. from="pypy"
  1581. ;;
  1582. *pypy3)
  1583. from="pypy3"
  1584. ;;
  1585. *jython[23].[0123456789])
  1586. from="jython[23].[0123456789]"
  1587. ;;
  1588. *)
  1589. die "${FUNCNAME}: internal error in 2nd pattern match"
  1590. ;;
  1591. esac;
  1592. fi;
  1593. break
  1594. ;;
  1595. esac;
  1596. done;
  1597. fi;
  1598. if [[ ! -n ${error} && ! -n ${from} ]]; then
  1599. [[ -n ${is_recursive} ]] && continue;
  1600. error=1;
  1601. fi;
  1602. if [[ ! -n ${quiet} ]]; then
  1603. einfo "Fixing shebang in ${f#${D%/}}.";
  1604. fi;
  1605. if [[ ! -n ${error} ]]; then
  1606. if [[ ${shebang} == *${from}" "* ]]; then
  1607. sed -i -e "1s:${from} :${EPYTHON} :" "${f}" || die;
  1608. else
  1609. sed -i -e "1s:${from}$:${EPYTHON}:" "${f}" || die;
  1610. fi;
  1611. any_fixed=1;
  1612. else
  1613. eerror "The file has incompatible shebang:";
  1614. eerror " file: ${f#${D%/}}";
  1615. eerror " current shebang: ${shebang}";
  1616. eerror " requested impl: ${EPYTHON}";
  1617. die "${FUNCNAME}: conversion of incompatible shebang requested";
  1618. fi;
  1619. done < <(find -H "${path}" -type f -print0 || die);
  1620. if [[ ! -n ${any_fixed} ]]; then
  1621. local cmd=eerror;
  1622. [[ ${EAPI:-0} == [012345] ]] && cmd=eqawarn;
  1623. "${cmd}" "QA warning: ${FUNCNAME}, ${path#${D%/}} did not match any fixable files.";
  1624. if [[ -n ${any_correct} ]]; then
  1625. "${cmd}" "All files have ${EPYTHON} shebang already.";
  1626. else
  1627. "${cmd}" "There are no Python files in specified directory.";
  1628. fi;
  1629. [[ ${cmd} == eerror ]] && die "${FUNCNAME} did not match any fixable files (QA warning fatal in EAPI ${EAPI})";
  1630. fi;
  1631. done
  1632. }
  1633. python_gen_cond_dep ()
  1634. {
  1635. debug-print-function ${FUNCNAME} "${@}";
  1636. local flag_prefix impl matches=();
  1637. if [[ ${#_PYTHON_SUPPORTED_IMPLS[@]} -eq 1 ]]; then
  1638. flag_prefix=python_targets;
  1639. else
  1640. flag_prefix=python_single_target;
  1641. fi;
  1642. local dep=${1};
  1643. shift;
  1644. for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}";
  1645. do
  1646. if _python_impl_matches "${impl}" "${@}"; then
  1647. if [[ ${dep} == *'${PYTHON_USEDEP}'* ]]; then
  1648. local usedep=$(python_gen_usedep "${@}");
  1649. dep=${dep//\$\{PYTHON_USEDEP\}/${usedep}};
  1650. fi;
  1651. matches+=("${flag_prefix}_${impl}? ( ${dep} )");
  1652. fi;
  1653. done;
  1654. echo "${matches[@]}"
  1655. }
  1656. python_gen_impl_dep ()
  1657. {
  1658. debug-print-function ${FUNCNAME} "${@}";
  1659. local impl pattern;
  1660. local matches=();
  1661. if [[ ${#_PYTHON_SUPPORTED_IMPLS[@]} -eq 1 ]]; then
  1662. flag_prefix=python_targets;
  1663. else
  1664. flag_prefix=python_single_target;
  1665. fi;
  1666. local PYTHON_REQ_USE=${1};
  1667. shift;
  1668. local patterns=("${@-*}");
  1669. for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}";
  1670. do
  1671. if _python_impl_matches "${impl}" "${patterns[@]}"; then
  1672. local PYTHON_PKG_DEP;
  1673. python_export "${impl}" PYTHON_PKG_DEP;
  1674. matches+=("${flag_prefix}_${impl}? ( ${PYTHON_PKG_DEP} )");
  1675. fi;
  1676. done;
  1677. echo "${matches[@]}"
  1678. }
  1679. python_gen_usedep ()
  1680. {
  1681. debug-print-function ${FUNCNAME} "${@}";
  1682. local impl matches=();
  1683. for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}";
  1684. do
  1685. if _python_impl_matches "${impl}" "${@}"; then
  1686. matches+=("python_targets_${impl}(-)?" "python_single_target_${impl}(+)?");
  1687. fi;
  1688. done;
  1689. [[ -n ${matches[@]} ]] || die "No supported implementations match python_gen_usedep patterns: ${@}";
  1690. local out=${matches[@]};
  1691. echo "${out// /,}"
  1692. }
  1693. python_gen_useflags ()
  1694. {
  1695. debug-print-function ${FUNCNAME} "${@}";
  1696. local flag_prefix impl matches=();
  1697. if [[ ${#_PYTHON_SUPPORTED_IMPLS[@]} -eq 1 ]]; then
  1698. flag_prefix=python_targets;
  1699. else
  1700. flag_prefix=python_single_target;
  1701. fi;
  1702. for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}";
  1703. do
  1704. if _python_impl_matches "${impl}" "${@}"; then
  1705. matches+=("${flag_prefix}_${impl}");
  1706. fi;
  1707. done;
  1708. echo "${matches[@]}"
  1709. }
  1710. python_generate_cffi_modules ()
  1711. {
  1712. die "${FUNCNAME}() is invalid for python-r1 suite"
  1713. }
  1714. python_generate_wrapper_scripts ()
  1715. {
  1716. die "${FUNCNAME}() is invalid for python-r1 suite"
  1717. }
  1718. python_get_CFLAGS ()
  1719. {
  1720. debug-print-function ${FUNCNAME} "${@}";
  1721. python_export "${@}" PYTHON_CFLAGS;
  1722. echo "${PYTHON_CFLAGS}"
  1723. }
  1724. python_get_LIBS ()
  1725. {
  1726. debug-print-function ${FUNCNAME} "${@}";
  1727. python_export "${@}" PYTHON_LIBS;
  1728. echo "${PYTHON_LIBS}"
  1729. }
  1730. python_get_PYTHON_CONFIG ()
  1731. {
  1732. debug-print-function ${FUNCNAME} "${@}";
  1733. python_export "${@}" PYTHON_CONFIG;
  1734. echo "${PYTHON_CONFIG}"
  1735. }
  1736. python_get_extension_module_suffix ()
  1737. {
  1738. die "${FUNCNAME}() is invalid for python-r1 suite"
  1739. }
  1740. python_get_implementation ()
  1741. {
  1742. die "${FUNCNAME}() is invalid for python-r1 suite"
  1743. }
  1744. python_get_implementation_and_version ()
  1745. {
  1746. die "${FUNCNAME}() is invalid for python-r1 suite"
  1747. }
  1748. python_get_implementational_package ()
  1749. {
  1750. die "${FUNCNAME}() is invalid for python-r1 suite"
  1751. }
  1752. python_get_includedir ()
  1753. {
  1754. debug-print-function ${FUNCNAME} "${@}";
  1755. python_export "${@}" PYTHON_INCLUDEDIR;
  1756. echo "${PYTHON_INCLUDEDIR}"
  1757. }
  1758. python_get_libdir ()
  1759. {
  1760. die "${FUNCNAME}() is invalid for python-r1 suite"
  1761. }
  1762. python_get_library ()
  1763. {
  1764. die "${FUNCNAME}() is invalid for python-r1 suite"
  1765. }
  1766. python_get_library_path ()
  1767. {
  1768. debug-print-function ${FUNCNAME} "${@}";
  1769. python_export "${@}" PYTHON_LIBPATH;
  1770. echo "${PYTHON_LIBPATH}"
  1771. }
  1772. python_get_scriptdir ()
  1773. {
  1774. debug-print-function ${FUNCNAME} "${@}";
  1775. python_export "${@}" PYTHON_SCRIPTDIR;
  1776. echo "${PYTHON_SCRIPTDIR}"
  1777. }
  1778. python_get_sitedir ()
  1779. {
  1780. debug-print-function ${FUNCNAME} "${@}";
  1781. python_export "${@}" PYTHON_SITEDIR;
  1782. echo "${PYTHON_SITEDIR}"
  1783. }
  1784. python_get_version ()
  1785. {
  1786. die "${FUNCNAME}() is invalid for python-r1 suite"
  1787. }
  1788. python_install_executables ()
  1789. {
  1790. die "${FUNCNAME}() is invalid for python-r1 suite"
  1791. }
  1792. python_is_installed ()
  1793. {
  1794. local impl=${1:-${EPYTHON}};
  1795. [[ -n ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON";
  1796. local hasv_args=();
  1797. case ${EAPI:-0} in
  1798. 0 | 1 | 2 | 3 | 4)
  1799. local -x ROOT=/
  1800. ;;
  1801. 5 | 6)
  1802. hasv_args+=(--host-root)
  1803. ;;
  1804. *)
  1805. hasv_args+=(-b)
  1806. ;;
  1807. esac;
  1808. case "${impl}" in
  1809. pypy | pypy3)
  1810. local append=;
  1811. if [[ -n ${PYTHON_REQ_USE} ]]; then
  1812. append=[${PYTHON_REQ_USE}];
  1813. fi;
  1814. has_version "${hasv_args[@]}" "dev-python/${impl}${append}" || has_version "${hasv_args[@]}" "dev-python/${impl}-bin${append}"
  1815. ;;
  1816. *)
  1817. local PYTHON_PKG_DEP;
  1818. python_export "${impl}" PYTHON_PKG_DEP;
  1819. has_version "${hasv_args[@]}" "${PYTHON_PKG_DEP}"
  1820. ;;
  1821. esac
  1822. }
  1823. python_is_python3 ()
  1824. {
  1825. local impl=${1:-${EPYTHON}};
  1826. [[ -n ${impl} ]] || die "python_is_python3: no impl nor EPYTHON";
  1827. [[ ${impl} == python3* || ${impl} == pypy3 ]]
  1828. }
  1829. python_merge_intermediate_installation_images ()
  1830. {
  1831. die "${FUNCNAME}() is invalid for python-r1 suite"
  1832. }
  1833. python_mod_cleanup ()
  1834. {
  1835. die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#Python_byte-code_compilation"
  1836. }
  1837. python_mod_optimize ()
  1838. {
  1839. die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#Python_byte-code_compilation"
  1840. }
  1841. python_moduleinto ()
  1842. {
  1843. debug-print-function ${FUNCNAME} "${@}";
  1844. python_moduleroot=${1}
  1845. }
  1846. python_need_rebuild ()
  1847. {
  1848. die "${FUNCNAME}() is invalid for python-r1 suite"
  1849. }
  1850. python_newexe ()
  1851. {
  1852. debug-print-function ${FUNCNAME} "${@}";
  1853. [[ -n ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).';
  1854. [[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} <path> <new-name>";
  1855. if [[ ${EAPI:-0} == [0123] ]]; then
  1856. die "python_do* and python_new* helpers are banned in EAPIs older than 4.";
  1857. fi;
  1858. local wrapd=${python_scriptroot:-/usr/bin};
  1859. local f=${1};
  1860. local newfn=${2};
  1861. local PYTHON_SCRIPTDIR d;
  1862. python_export PYTHON_SCRIPTDIR;
  1863. d=${PYTHON_SCRIPTDIR#${EPREFIX}};
  1864. ( dodir "${wrapd}";
  1865. exeopts -m 0755;
  1866. exeinto "${d}";
  1867. newexe "${f}" "${newfn}" || return ${?} );
  1868. _python_ln_rel "${ED%/}"/usr/lib/python-exec/python-exec2 "${ED%/}/${wrapd}/${newfn}" || die;
  1869. if [[ -n ${_PYTHON_REWRITE_SHEBANG} ]]; then
  1870. python_fix_shebang -q "${ED%/}/${d}/${newfn}";
  1871. fi
  1872. }
  1873. python_newscript ()
  1874. {
  1875. debug-print-function ${FUNCNAME} "${@}";
  1876. local _PYTHON_REWRITE_SHEBANG=1;
  1877. python_newexe "${@}"
  1878. }
  1879. python_optimize ()
  1880. {
  1881. debug-print-function ${FUNCNAME} "${@}";
  1882. if [[ ${EBUILD_PHASE} == pre* || ${EBUILD_PHASE} == post* ]]; then
  1883. eerror "The new Python eclasses expect the compiled Python files to";
  1884. eerror "be controlled by the Package Manager. For this reason,";
  1885. eerror "the python_optimize function can be used only during src_* phases";
  1886. eerror "(src_install most commonly) and not during pkg_* phases.";
  1887. echo;
  1888. die "python_optimize is not to be used in pre/post* phases";
  1889. fi;
  1890. [[ -n ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).';
  1891. local PYTHON=${PYTHON};
  1892. [[ -n ${PYTHON} ]] || python_export PYTHON;
  1893. if [[ ${#} -eq 0 ]]; then
  1894. local f;
  1895. while IFS= read -r -d '' f; do
  1896. if [[ ${f} == /* && -d ${D%/}${f} ]]; then
  1897. set -- "${D%/}${f}" "${@}";
  1898. fi;
  1899. done < <("${PYTHON}" -c 'import sys; print("\0".join(sys.path))' || die);
  1900. debug-print "${FUNCNAME}: using sys.path: ${*/%/;}";
  1901. fi;
  1902. local d;
  1903. for d in "$@";
  1904. do
  1905. local instpath=${d#${D%/}};
  1906. instpath=/${instpath##/};
  1907. case "${EPYTHON}" in
  1908. python2.7 | python3.[34])
  1909. "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}";
  1910. "${PYTHON}" -OO -m compileall -q -f -d "${instpath}" "${d}"
  1911. ;;
  1912. python* | pypy3)
  1913. "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}";
  1914. "${PYTHON}" -O -m compileall -q -f -d "${instpath}" "${d}";
  1915. "${PYTHON}" -OO -m compileall -q -f -d "${instpath}" "${d}"
  1916. ;;
  1917. *)
  1918. "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}"
  1919. ;;
  1920. esac;
  1921. done
  1922. }
  1923. python_pkg_setup ()
  1924. {
  1925. die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#pkg_setup"
  1926. }
  1927. python_scriptinto ()
  1928. {
  1929. debug-print-function ${FUNCNAME} "${@}";
  1930. python_scriptroot=${1}
  1931. }
  1932. python_set_active_version ()
  1933. {
  1934. die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#pkg_setup"
  1935. }
  1936. python_setup ()
  1937. {
  1938. debug-print-function ${FUNCNAME} "${@}";
  1939. unset EPYTHON;
  1940. if [[ -n ${PYTHON_COMPAT_OVERRIDE} ]]; then
  1941. local impls=(${PYTHON_COMPAT_OVERRIDE});
  1942. [[ ${#impls[@]} -eq 1 ]] || die "PYTHON_COMPAT_OVERRIDE must name exactly one implementation for python-single-r1";
  1943. ewarn "WARNING: PYTHON_COMPAT_OVERRIDE in effect. The following Python";
  1944. ewarn "implementation will be used:";
  1945. ewarn;
  1946. ewarn " ${PYTHON_COMPAT_OVERRIDE}";
  1947. ewarn;
  1948. ewarn "Dependencies won't be satisfied, and PYTHON_SINGLE_TARGET flags will be ignored.";
  1949. python_export "${impls[0]}" EPYTHON PYTHON;
  1950. python_wrapper_setup;
  1951. return;
  1952. fi;
  1953. if [[ ${#_PYTHON_SUPPORTED_IMPLS[@]} -eq 1 ]]; then
  1954. if use "python_targets_${_PYTHON_SUPPORTED_IMPLS[0]}"; then
  1955. python_export "${_PYTHON_SUPPORTED_IMPLS[0]}" EPYTHON PYTHON;
  1956. python_wrapper_setup;
  1957. fi;
  1958. else
  1959. local impl;
  1960. for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}";
  1961. do
  1962. if use "python_single_target_${impl}"; then
  1963. if [[ -n ${EPYTHON} ]]; then
  1964. eerror "Your PYTHON_SINGLE_TARGET setting lists more than a single Python";
  1965. eerror "implementation. Please set it to just one value. If you need";
  1966. eerror "to override the value for a single package, please use package.env";
  1967. eerror "or an equivalent solution (man 5 portage).";
  1968. echo;
  1969. die "More than one implementation in PYTHON_SINGLE_TARGET.";
  1970. fi;
  1971. if ! use "python_targets_${impl}"; then
  1972. eerror "The implementation chosen as PYTHON_SINGLE_TARGET must be added";
  1973. eerror "to PYTHON_TARGETS as well. This is in order to ensure that";
  1974. eerror "dependencies are satisfied correctly. We're sorry";
  1975. eerror "for the inconvenience.";
  1976. echo;
  1977. die "Build target (${impl}) not in PYTHON_TARGETS.";
  1978. fi;
  1979. python_export "${impl}" EPYTHON PYTHON;
  1980. python_wrapper_setup;
  1981. fi;
  1982. done;
  1983. fi;
  1984. if [[ ! -n ${EPYTHON} ]]; then
  1985. eerror "No Python implementation selected for the build. Please set";
  1986. if [[ ${#_PYTHON_SUPPORTED_IMPLS[@]} -eq 1 ]]; then
  1987. eerror "the PYTHON_TARGETS variable in your make.conf to include one";
  1988. else
  1989. eerror "the PYTHON_SINGLE_TARGET variable in your make.conf to one";
  1990. fi;
  1991. eerror "of the following values:";
  1992. eerror;
  1993. eerror "${_PYTHON_SUPPORTED_IMPLS[@]}";
  1994. echo;
  1995. die "No supported Python implementation in PYTHON_SINGLE_TARGET/PYTHON_TARGETS.";
  1996. fi
  1997. }
  1998. python_wrapper_setup ()
  1999. {
  2000. debug-print-function ${FUNCNAME} "${@}";
  2001. local workdir=${1:-${T}/${EPYTHON}};
  2002. local impl=${2:-${EPYTHON}};
  2003. [[ -n ${workdir} ]] || die "${FUNCNAME}: no workdir specified.";
  2004. [[ -n ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON specified.";
  2005. if [[ ! -x ${workdir}/bin/python ]]; then
  2006. _python_check_dead_variables;
  2007. mkdir -p "${workdir}"/{bin,pkgconfig} || die;
  2008. rm -f "${workdir}"/bin/python{,2,3}{,-config} || die;
  2009. rm -f "${workdir}"/bin/2to3 || die;
  2010. rm -f "${workdir}"/pkgconfig/python{,2,3}.pc || die;
  2011. local EPYTHON PYTHON;
  2012. python_export "${impl}" EPYTHON PYTHON;
  2013. local pyver pyother;
  2014. if python_is_python3; then
  2015. pyver=3;
  2016. pyother=2;
  2017. else
  2018. pyver=2;
  2019. pyother=3;
  2020. fi;
  2021. cat > "${workdir}/bin/python" <<-_EOF_ ||
  2022. #!/bin/sh
  2023. exec "${PYTHON}" "\${@}"
  2024. _EOF_
  2025. die
  2026. cp "${workdir}/bin/python" "${workdir}/bin/python${pyver}" || die;
  2027. chmod +x "${workdir}/bin/python" "${workdir}/bin/python${pyver}" || die;
  2028. local nonsupp=("python${pyother}" "python${pyother}-config");
  2029. if [[ ${EPYTHON} == python* ]]; then
  2030. cat > "${workdir}/bin/python-config" <<-_EOF_ ||
  2031. #!/bin/sh
  2032. exec "${PYTHON}-config" "\${@}"
  2033. _EOF_
  2034. die
  2035. cp "${workdir}/bin/python-config" "${workdir}/bin/python${pyver}-config" || die;
  2036. chmod +x "${workdir}/bin/python-config" "${workdir}/bin/python${pyver}-config" || die;
  2037. ln -s "${PYTHON/python/2to3-}" "${workdir}"/bin/2to3 || die;
  2038. ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}.pc "${workdir}"/pkgconfig/python.pc || die;
  2039. ln -s python.pc "${workdir}"/pkgconfig/python${pyver}.pc || die;
  2040. else
  2041. nonsupp+=(2to3 python-config "python${pyver}-config");
  2042. fi;
  2043. local x;
  2044. for x in "${nonsupp[@]}";
  2045. do
  2046. cat > "${workdir}"/bin/${x} <<-_EOF_ ||
  2047. #!/bin/sh
  2048. echo "${ECLASS}: ${FUNCNAME}: ${x} is not supported by ${EPYTHON} (PYTHON_COMPAT)" >&2
  2049. exit 127
  2050. _EOF_
  2051. die
  2052. chmod +x "${workdir}"/bin/${x} || die;
  2053. done;
  2054. fi;
  2055. if [[ ${PATH##:*} != ${workdir}/bin ]]; then
  2056. PATH=${workdir}/bin${PATH:+:${PATH}};
  2057. fi;
  2058. if [[ ${PKG_CONFIG_PATH##:*} != ${workdir}/pkgconfig ]]; then
  2059. PKG_CONFIG_PATH=${workdir}/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}};
  2060. fi;
  2061. export PATH PKG_CONFIG_PATH
  2062. }
  2063. src_compile ()
  2064. {
  2065. emake V=1 all $(usev static)
  2066. }
  2067. src_configure ()
  2068. {
  2069. local myeconfargs=(--bindir="${EPREFIX}"/sbin $(use_enable convert) $(use_enable elibc_glibc backtrace) $(use_enable python) $(use_enable static-libs static) $(use_enable zstd) --with-convert=ext2$(usex reiserfs ',reiserfs' ''));
  2070. econf "${myeconfargs[@]}"
  2071. }
  2072. src_install ()
  2073. {
  2074. local makeargs=($(usex python install_python '') $(usex static install-static ''));
  2075. emake V=1 DESTDIR="${D}" install "${makeargs[@]}";
  2076. newbashcomp btrfs-completion btrfs;
  2077. use python && python_optimize
  2078. }
  2079. src_prepare ()
  2080. {
  2081. default;
  2082. if [[ ${PV} == 9999 ]]; then
  2083. AT_M4DIR=m4 eautoreconf;
  2084. mkdir config || die;
  2085. local automakedir="$(autotools_run_tool --at-output automake --print-libdir)";
  2086. [[ -e ${automakedir} ]] || die "Could not locate automake directory";
  2087. ln -s "${automakedir}"/install-sh config/install-sh || die;
  2088. ln -s "${EPREFIX}"/usr/share/gnuconfig/config.guess config/config.guess || die;
  2089. ln -s "${EPREFIX}"/usr/share/gnuconfig/config.sub config/config.sub || die;
  2090. fi
  2091. }
  2092. src_test ()
  2093. {
  2094. default
  2095. }
  2096. src_unpack ()
  2097. {
  2098. default
  2099. }
  2100. tc-arch ()
  2101. {
  2102. tc-ninja_magic_to_arch portage "$@"
  2103. }
  2104. tc-arch-kernel ()
  2105. {
  2106. tc-ninja_magic_to_arch kern "$@"
  2107. }
  2108. tc-check-openmp ()
  2109. {
  2110. if ! tc-has-openmp; then
  2111. eerror "Your current compiler does not support OpenMP!";
  2112. if tc-is-gcc; then
  2113. eerror "Enable OpenMP support by building sys-devel/gcc with USE=\"openmp\".";
  2114. else
  2115. if tc-is-clang; then
  2116. eerror "OpenMP support in sys-devel/clang is provided by sys-libs/libomp.";
  2117. fi;
  2118. fi;
  2119. die "Active compiler does not have required support for OpenMP";
  2120. fi
  2121. }
  2122. tc-cpp-is-true ()
  2123. {
  2124. local CONDITION=${1};
  2125. shift;
  2126. local RESULT=$($(tc-getTARGET_CPP) "${@}" -P - <<-EOF 2>/dev/null
  2127. #if ${CONDITION}
  2128. true
  2129. #endif
  2130. EOF
  2131. );
  2132. [[ ${RESULT} == true ]]
  2133. }
  2134. tc-detect-is-softfloat ()
  2135. {
  2136. [[ $(tc-getTARGET_CPP) == "gcc -E" ]] && return 1;
  2137. case ${CTARGET:-${CHOST}} in
  2138. *-newlib | *-elf | *-eabi)
  2139. return 1
  2140. ;;
  2141. arm*)
  2142. if tc-cpp-is-true "defined(__ARM_PCS_VFP)"; then
  2143. echo "no";
  2144. else
  2145. if tc-cpp-is-true "defined(__SOFTFP__)"; then
  2146. echo "yes";
  2147. else
  2148. echo "softfp";
  2149. fi;
  2150. fi;
  2151. return 0
  2152. ;;
  2153. *)
  2154. return 1
  2155. ;;
  2156. esac
  2157. }
  2158. tc-enables-pie ()
  2159. {
  2160. tc-cpp-is-true "defined(__PIE__)" ${CPPFLAGS} ${CFLAGS}
  2161. }
  2162. tc-enables-ssp ()
  2163. {
  2164. tc-cpp-is-true "defined(__SSP__) || defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS}
  2165. }
  2166. tc-enables-ssp-all ()
  2167. {
  2168. tc-cpp-is-true "defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS}
  2169. }
  2170. tc-enables-ssp-strong ()
  2171. {
  2172. tc-cpp-is-true "defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS}
  2173. }
  2174. tc-endian ()
  2175. {
  2176. local host=$1;
  2177. [[ -z ${host} ]] && host=${CTARGET:-${CHOST}};
  2178. host=${host%%-*};
  2179. case ${host} in
  2180. aarch64*be)
  2181. echo big
  2182. ;;
  2183. aarch64)
  2184. echo little
  2185. ;;
  2186. alpha*)
  2187. echo little
  2188. ;;
  2189. arm*b*)
  2190. echo big
  2191. ;;
  2192. arm*)
  2193. echo little
  2194. ;;
  2195. cris*)
  2196. echo little
  2197. ;;
  2198. hppa*)
  2199. echo big
  2200. ;;
  2201. i?86*)
  2202. echo little
  2203. ;;
  2204. ia64*)
  2205. echo little
  2206. ;;
  2207. m68*)
  2208. echo big
  2209. ;;
  2210. mips*l*)
  2211. echo little
  2212. ;;
  2213. mips*)
  2214. echo big
  2215. ;;
  2216. powerpc*le)
  2217. echo little
  2218. ;;
  2219. powerpc*)
  2220. echo big
  2221. ;;
  2222. s390*)
  2223. echo big
  2224. ;;
  2225. sh*b*)
  2226. echo big
  2227. ;;
  2228. sh*)
  2229. echo little
  2230. ;;
  2231. sparc*)
  2232. echo big
  2233. ;;
  2234. x86_64*)
  2235. echo little
  2236. ;;
  2237. *)
  2238. echo wtf
  2239. ;;
  2240. esac
  2241. }
  2242. tc-env_build ()
  2243. {
  2244. tc-export_build_env;
  2245. 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) "$@"
  2246. }
  2247. tc-export ()
  2248. {
  2249. local var;
  2250. for var in "$@";
  2251. do
  2252. [[ $(type -t "tc-get${var}") != "function" ]] && die "tc-export: invalid export variable '${var}'";
  2253. "tc-get${var}" > /dev/null;
  2254. done
  2255. }
  2256. tc-export_build_env ()
  2257. {
  2258. tc-export "$@";
  2259. if tc-is-cross-compiler; then
  2260. : ${BUILD_CFLAGS:=-O1 -pipe};
  2261. : ${BUILD_CXXFLAGS:=-O1 -pipe};
  2262. : ${BUILD_CPPFLAGS:= };
  2263. : ${BUILD_LDFLAGS:= };
  2264. else
  2265. : ${BUILD_CFLAGS:=${CFLAGS}};
  2266. : ${BUILD_CXXFLAGS:=${CXXFLAGS}};
  2267. : ${BUILD_CPPFLAGS:=${CPPFLAGS}};
  2268. : ${BUILD_LDFLAGS:=${LDFLAGS}};
  2269. fi;
  2270. export BUILD_{C,CXX,CPP,LD}FLAGS;
  2271. local v;
  2272. for v in BUILD_{C,CXX,CPP,LD}FLAGS;
  2273. do
  2274. export ${v#BUILD_}_FOR_BUILD="${!v}";
  2275. done
  2276. }
  2277. tc-get-compiler-type ()
  2278. {
  2279. local code='
  2280. #if defined(__PATHSCALE__)
  2281. HAVE_PATHCC
  2282. #elif defined(__clang__)
  2283. HAVE_CLANG
  2284. #elif defined(__GNUC__)
  2285. HAVE_GCC
  2286. #endif
  2287. ';
  2288. local res=$($(tc-getCPP "$@") -E -P - <<<"${code}");
  2289. case ${res} in
  2290. *HAVE_PATHCC*)
  2291. echo pathcc
  2292. ;;
  2293. *HAVE_CLANG*)
  2294. echo clang
  2295. ;;
  2296. *HAVE_GCC*)
  2297. echo gcc
  2298. ;;
  2299. *)
  2300. echo unknown
  2301. ;;
  2302. esac
  2303. }
  2304. tc-getAR ()
  2305. {
  2306. tc-getPROG AR ar "$@"
  2307. }
  2308. tc-getAS ()
  2309. {
  2310. tc-getPROG AS as "$@"
  2311. }
  2312. tc-getBUILD_AR ()
  2313. {
  2314. tc-getBUILD_PROG AR ar "$@"
  2315. }
  2316. tc-getBUILD_AS ()
  2317. {
  2318. tc-getBUILD_PROG AS as "$@"
  2319. }
  2320. tc-getBUILD_CC ()
  2321. {
  2322. tc-getBUILD_PROG CC gcc "$@"
  2323. }
  2324. tc-getBUILD_CPP ()
  2325. {
  2326. tc-getBUILD_PROG CPP "$(tc-getBUILD_CC) -E" "$@"
  2327. }
  2328. tc-getBUILD_CXX ()
  2329. {
  2330. tc-getBUILD_PROG CXX g++ "$@"
  2331. }
  2332. tc-getBUILD_LD ()
  2333. {
  2334. tc-getBUILD_PROG LD ld "$@"
  2335. }
  2336. tc-getBUILD_NM ()
  2337. {
  2338. tc-getBUILD_PROG NM nm "$@"
  2339. }
  2340. tc-getBUILD_OBJCOPY ()
  2341. {
  2342. tc-getBUILD_PROG OBJCOPY objcopy "$@"
  2343. }
  2344. tc-getBUILD_PKG_CONFIG ()
  2345. {
  2346. tc-getBUILD_PROG PKG_CONFIG pkg-config "$@"
  2347. }
  2348. tc-getBUILD_PROG ()
  2349. {
  2350. local vars="BUILD_$1 $1_FOR_BUILD HOST$1";
  2351. tc-is-cross-compiler || vars+=" $1";
  2352. _tc-getPROG CBUILD "${vars}" "${@:2}"
  2353. }
  2354. tc-getBUILD_RANLIB ()
  2355. {
  2356. tc-getBUILD_PROG RANLIB ranlib "$@"
  2357. }
  2358. tc-getBUILD_STRIP ()
  2359. {
  2360. tc-getBUILD_PROG STRIP strip "$@"
  2361. }
  2362. tc-getCC ()
  2363. {
  2364. tc-getPROG CC gcc "$@"
  2365. }
  2366. tc-getCPP ()
  2367. {
  2368. tc-getPROG CPP "${CC:-gcc} -E" "$@"
  2369. }
  2370. tc-getCXX ()
  2371. {
  2372. tc-getPROG CXX g++ "$@"
  2373. }
  2374. tc-getDLLWRAP ()
  2375. {
  2376. tc-getPROG DLLWRAP dllwrap "$@"
  2377. }
  2378. tc-getF77 ()
  2379. {
  2380. tc-getPROG F77 gfortran "$@"
  2381. }
  2382. tc-getFC ()
  2383. {
  2384. tc-getPROG FC gfortran "$@"
  2385. }
  2386. tc-getGCJ ()
  2387. {
  2388. tc-getPROG GCJ gcj "$@"
  2389. }
  2390. tc-getGO ()
  2391. {
  2392. tc-getPROG GO gccgo "$@"
  2393. }
  2394. tc-getLD ()
  2395. {
  2396. tc-getPROG LD ld "$@"
  2397. }
  2398. tc-getNM ()
  2399. {
  2400. tc-getPROG NM nm "$@"
  2401. }
  2402. tc-getOBJCOPY ()
  2403. {
  2404. tc-getPROG OBJCOPY objcopy "$@"
  2405. }
  2406. tc-getOBJDUMP ()
  2407. {
  2408. tc-getPROG OBJDUMP objdump "$@"
  2409. }
  2410. tc-getPKG_CONFIG ()
  2411. {
  2412. tc-getPROG PKG_CONFIG pkg-config "$@"
  2413. }
  2414. tc-getPROG ()
  2415. {
  2416. _tc-getPROG CHOST "$@"
  2417. }
  2418. tc-getRANLIB ()
  2419. {
  2420. tc-getPROG RANLIB ranlib "$@"
  2421. }
  2422. tc-getRC ()
  2423. {
  2424. tc-getPROG RC windres "$@"
  2425. }
  2426. tc-getSTRIP ()
  2427. {
  2428. tc-getPROG STRIP strip "$@"
  2429. }
  2430. tc-getTARGET_CPP ()
  2431. {
  2432. if [[ -n ${CTARGET} ]]; then
  2433. _tc-getPROG CTARGET TARGET_CPP "gcc -E" "$@";
  2434. else
  2435. tc-getCPP "$@";
  2436. fi
  2437. }
  2438. tc-has-openmp ()
  2439. {
  2440. local base="${T}/test-tc-openmp";
  2441. cat > "${base}.c" <<-EOF
  2442. #include <omp.h>
  2443. int main() {
  2444. int nthreads, tid, ret = 0;
  2445. #pragma omp parallel private(nthreads, tid)
  2446. {
  2447. tid = omp_get_thread_num();
  2448. nthreads = omp_get_num_threads(); ret += tid + nthreads;
  2449. }
  2450. return ret;
  2451. }
  2452. EOF
  2453. $(tc-getCC "$@") -fopenmp "${base}.c" -o "${base}" &> /dev/null;
  2454. local ret=$?;
  2455. rm -f "${base}"*;
  2456. return ${ret}
  2457. }
  2458. tc-has-tls ()
  2459. {
  2460. local base="${T}/test-tc-tls";
  2461. cat > "${base}.c" <<-EOF
  2462. int foo(int *i) {
  2463. static __thread int j = 0;
  2464. return *i ? j : *i;
  2465. }
  2466. EOF
  2467. local flags;
  2468. case $1 in
  2469. -s)
  2470. flags="-S"
  2471. ;;
  2472. -c)
  2473. flags="-c"
  2474. ;;
  2475. -l)
  2476. ;;
  2477. -*)
  2478. die "Usage: tc-has-tls [-c|-l] [toolchain prefix]"
  2479. ;;
  2480. esac;
  2481. : ${flags:=-fPIC -shared -Wl,-z,defs};
  2482. [[ $1 == -* ]] && shift;
  2483. $(tc-getCC "$@") ${flags} "${base}.c" -o "${base}" &> /dev/null;
  2484. local ret=$?;
  2485. rm -f "${base}"*;
  2486. return ${ret}
  2487. }
  2488. tc-is-clang ()
  2489. {
  2490. [[ $(tc-get-compiler-type) == clang ]]
  2491. }
  2492. tc-is-cross-compiler ()
  2493. {
  2494. [[ ${CBUILD:-${CHOST}} != ${CHOST} ]]
  2495. }
  2496. tc-is-gcc ()
  2497. {
  2498. [[ $(tc-get-compiler-type) == gcc ]]
  2499. }
  2500. tc-is-softfloat ()
  2501. {
  2502. tc-detect-is-softfloat || tc-tuple-is-softfloat
  2503. }
  2504. tc-is-static-only ()
  2505. {
  2506. local host=${CTARGET:-${CHOST}};
  2507. [[ ${host} == *-mint* ]]
  2508. }
  2509. tc-ld-disable-gold ()
  2510. {
  2511. if ! tc-ld-is-gold "$@"; then
  2512. return;
  2513. fi;
  2514. ewarn "Forcing usage of the BFD linker instead of GOLD";
  2515. local ld=$(tc-getLD "$@");
  2516. local bfd_ld="${ld%% *}.bfd";
  2517. local path_ld=$(which "${bfd_ld}" 2>/dev/null);
  2518. [[ -e ${path_ld} ]] && export LD=${bfd_ld};
  2519. local fallback="true";
  2520. if tc-is-gcc; then
  2521. local major=$(gcc-major-version "$@");
  2522. local minor=$(gcc-minor-version "$@");
  2523. if [[ ${major} -gt 4 ]] || [[ ${major} -eq 4 && ${minor} -ge 8 ]]; then
  2524. export LDFLAGS="${LDFLAGS} -fuse-ld=bfd";
  2525. fallback="false";
  2526. fi;
  2527. else
  2528. if tc-is-clang; then
  2529. local major=$(clang-major-version "$@");
  2530. local minor=$(clang-minor-version "$@");
  2531. if [[ ${major} -gt 3 ]] || [[ ${major} -eq 3 && ${minor} -ge 5 ]]; then
  2532. export LDFLAGS="${LDFLAGS} -fuse-ld=bfd";
  2533. fallback="false";
  2534. fi;
  2535. fi;
  2536. fi;
  2537. if [[ ${fallback} == "true" ]]; then
  2538. if [[ -e ${path_ld} ]]; then
  2539. local d="${T}/bfd-linker";
  2540. mkdir -p "${d}";
  2541. ln -sf "${path_ld}" "${d}"/ld;
  2542. export LDFLAGS="${LDFLAGS} -B${d}";
  2543. else
  2544. die "unable to locate a BFD linker to bypass gold";
  2545. fi;
  2546. fi
  2547. }
  2548. tc-ld-is-gold ()
  2549. {
  2550. local out;
  2551. out=$($(tc-getLD "$@") --version 2>&1);
  2552. if [[ ${out} == *"GNU gold"* ]]; then
  2553. return 0;
  2554. fi;
  2555. local base="${T}/test-tc-gold";
  2556. cat > "${base}.c" <<-EOF
  2557. int main() { return 0; }
  2558. EOF
  2559. out=$($(tc-getCC "$@") ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -Wl,--version "${base}.c" -o "${base}" 2>&1);
  2560. rm -f "${base}"*;
  2561. if [[ ${out} == *"GNU gold"* ]]; then
  2562. return 0;
  2563. fi;
  2564. return 1
  2565. }
  2566. tc-ninja_magic_to_arch ()
  2567. {
  2568. function ninj ()
  2569. {
  2570. [[ ${type} == "kern" ]] && echo $1 || echo $2
  2571. };
  2572. local type=$1;
  2573. local host=$2;
  2574. [[ -z ${host} ]] && host=${CTARGET:-${CHOST}};
  2575. case ${host} in
  2576. aarch64*)
  2577. echo arm64
  2578. ;;
  2579. alpha*)
  2580. echo alpha
  2581. ;;
  2582. arm*)
  2583. echo arm
  2584. ;;
  2585. avr*)
  2586. ninj avr32 avr
  2587. ;;
  2588. bfin*)
  2589. ninj blackfin bfin
  2590. ;;
  2591. c6x*)
  2592. echo c6x
  2593. ;;
  2594. cris*)
  2595. echo cris
  2596. ;;
  2597. frv*)
  2598. echo frv
  2599. ;;
  2600. hexagon*)
  2601. echo hexagon
  2602. ;;
  2603. hppa*)
  2604. ninj parisc hppa
  2605. ;;
  2606. i?86*)
  2607. if [[ ${type} == "kern" && ${host} == *freebsd* ]]; then
  2608. echo i386;
  2609. else
  2610. echo x86;
  2611. fi
  2612. ;;
  2613. ia64*)
  2614. echo ia64
  2615. ;;
  2616. m68*)
  2617. echo m68k
  2618. ;;
  2619. metag*)
  2620. echo metag
  2621. ;;
  2622. microblaze*)
  2623. echo microblaze
  2624. ;;
  2625. mips*)
  2626. echo mips
  2627. ;;
  2628. nios2*)
  2629. echo nios2
  2630. ;;
  2631. nios*)
  2632. echo nios
  2633. ;;
  2634. or1k | or32*)
  2635. echo openrisc
  2636. ;;
  2637. powerpc*)
  2638. if [[ ${type} == "kern" ]]; then
  2639. echo powerpc;
  2640. else
  2641. if [[ ${host} == powerpc64* ]]; then
  2642. echo ppc64;
  2643. else
  2644. echo ppc;
  2645. fi;
  2646. fi
  2647. ;;
  2648. riscv*)
  2649. echo riscv
  2650. ;;
  2651. s390*)
  2652. echo s390
  2653. ;;
  2654. score*)
  2655. echo score
  2656. ;;
  2657. sh64*)
  2658. ninj sh64 sh
  2659. ;;
  2660. sh*)
  2661. echo sh
  2662. ;;
  2663. sparc64*)
  2664. ninj sparc64 sparc
  2665. ;;
  2666. sparc*)
  2667. [[ ${PROFILE_ARCH} == "sparc64" ]] && ninj sparc64 sparc || echo sparc
  2668. ;;
  2669. tile*)
  2670. echo tile
  2671. ;;
  2672. vax*)
  2673. echo vax
  2674. ;;
  2675. x86_64*freebsd*)
  2676. echo amd64
  2677. ;;
  2678. x86_64*)
  2679. if [[ ${type} == "kern" ]]; then
  2680. echo x86;
  2681. else
  2682. echo amd64;
  2683. fi
  2684. ;;
  2685. xtensa*)
  2686. echo xtensa
  2687. ;;
  2688. *)
  2689. echo unknown
  2690. ;;
  2691. esac
  2692. }
  2693. tc-stack-grows-down ()
  2694. {
  2695. case ${ARCH} in
  2696. hppa | metag)
  2697. return 1
  2698. ;;
  2699. esac;
  2700. return 0
  2701. }
  2702. tc-tuple-is-softfloat ()
  2703. {
  2704. local CTARGET=${CTARGET:-${CHOST}};
  2705. case ${CTARGET//_/-} in
  2706. bfin* | h8300*)
  2707. echo "only"
  2708. ;;
  2709. *-softfloat-*)
  2710. echo "yes"
  2711. ;;
  2712. *-softfp-*)
  2713. echo "softfp"
  2714. ;;
  2715. arm*-hardfloat-* | arm*eabihf)
  2716. echo "no"
  2717. ;;
  2718. *-newlib | *-elf | *-eabi)
  2719. echo "no"
  2720. ;;
  2721. arm*)
  2722. echo "yes"
  2723. ;;
  2724. *)
  2725. echo "no"
  2726. ;;
  2727. esac
  2728. }
  2729.