Unknown Log

#qIgEb1f
5010 lines
Raw
1declare -x ABI="amd64"
2declare -x ABI_MIPS=""
3declare -x ABI_PPC=""
4declare -x ABI_S390=""
5declare -x ABI_X86="32 64"
6declare -x ADA_TARGET=""
7declare -a ALL_AUTOTOOLS_MACROS=([0]="AC_PROG_LIBTOOL" [1]="AM_PROG_LIBTOOL" [2]="LT_INIT" [3]="LT_CONFIG_LTDL_DIR" [4]="AC_CONFIG_HEADERS" [5]="AC_CONFIG_HEADER" [6]="AM_CONFIG_HEADERS" [7]="AM_CONFIG_HEADER" [8]="AC_CONFIG_SUBDIRS" [9]="AC_CONFIG_AUX_DIR" [10]="AC_CONFIG_MACRO_DIR" [11]="AM_INIT_AUTOMAKE" [12]="AM_GLIB_GNU_GETTEXT" [13]="AM_GNU_GETTEXT_VERSION" [14]="AM_GNU_GETTEXT_REQUIRE_VERSION" [15]="AC_PROG_INTLTOOL" [16]="IT_PROG_INTLTOOL" [17]="GTK_DOC_CHECK" [18]="GNOME_DOC_INIT")
8declare -- ALL_LOCALES="
9aa
10af
11af_ZA
12am
13am_ET
14ang
15ar
16ar_AE
17ar_BH
18ar_DZ
19ar_EG
20ar_IN
21ar_IQ
22ar_JO
23ar_KW
24ar_LB
25ar_LY
26ar_MA
27ar_OM
28ar_QA
29ar_SA
30ar_SD
31ar_SY
32ar_TN
33ar_YE
34as
35ast
36az
37az_AZ
38az_IR
39be
40be@latin
41be_BY
42bg
43bg_BG
44bn
45bn_IN
46br
47br_FR
48bs
49bs_BA
50byn
51ca
52ca@valencia
53ca_ES
54ca_ES@euro
55ca_ES@valencia
56chs
57cht
58crh
59cs
60cs_CZ
61cy
62cy_GB
63cz
64da
65da_DK
66de
67de_AT
68de_AT@euro
69de_BE
70de_BE@euro
71de_CH
72de_DE
73de_DE.UTF-8
74de_DE@euro
75de_LU
76de_LU@euro
77dk
78dv
79dz
80el
81el_GR
82el_GR.UTF-8
83el_GR@euro
84en
85en@IPA
86en@boldquot
87en@quot
88en@shaw
89en_AU
90en_BW
91en_CA
92en_DK
93en_GB
94en_GB.UTF-8
95en_HK
96en_IE
97en_IE@euro
98en_IN
99en_NZ
100en_PH
101en_RN
102en_SG
103en_UK
104en_US
105en_US.UTF-8
106en_ZA
107en_ZW
108eo
109eo_EO
110es
111es_AR
112es_BO
113es_CL
114es_CO
115es_CR
116es_DO
117es_EC
118es_ES
119es_ES.UTF-8
120es_ES@euro
121es_GT
122es_HN
123es_MX
124es_NI
125es_PA
126es_PE
127es_PR
128es_PY
129es_SV
130es_US
131es_UY
132es_VE
133et
134et_EE
135eu
136eu_ES
137eu_ES@euro
138fa
139fa_IR
140fa_IR.UTF-8
141fi
142fi_FI
143fi_FI@euro
144fo
145fo_FO
146fr
147fr_BE
148fr_BE@euro
149fr_CA
150fr_CH
151fr_FR
152fr_FR.UTF-8
153fr_FR@euro
154fr_LU
155fr_LU@euro
156fur
157fy
158ga
159ga_IE
160ga_IE@euro
161gd
162gd_GB
163gez
164gl
165gl_ES
166gl_ES@euro
167gr
168gu
169gv
170gv_GB
171haw
172he
173he_IL
174hi
175hi_IN
176hi_IN.UTF-8
177hr
178hr_HR
179hu
180hu_HU
181hy
182hy_AM
183ia
184id
185id_ID
186is
187is_IS
188it
189it_CH
190it_IT
191it_IT@euro
192iu
193iw
194iw_IL
195ja
196ja_JP
197ja_JP.EUC
198ja_JP.EUC-JP
199ja_JP.UTF-8
200ja_JP.eucJP
201ka
202ka_GE
203kk
204kl
205kl_GL
206km
207km_KH
208kn
209ko
210ko_KR
211ko_KR.EUC-KR
212ko_KR.UTF-8
213kok
214ku
215kw
216kw_GB
217ky
218la
219lg
220li
221lo
222lt
223lt_LT
224lv
225lv_LV
226mai
227mg
228mhr
229mi
230mi_NZ
231mk
232mk_MK
233ml
234mn
235mr
236mr_IN
237mr_IN.UTF-8
238ms
239ms_MY
240mt
241mt_MT
242my
243my_MM
244nb
245nb_NO
246nds
247ne
248nl
249nl_BE
250nl_BE@euro
251nl_NL
252nl_NL@euro
253nn
254nn_NO
255no
256no_NO
257nso
258nyc
259oc
260oc_FR
261om
262or
263pa
264pl
265pl_PL
266ps
267pt
268pt_BR
269pt_PT
270pt_PT@euro
271rm
272ro
273ro_RO
274ru
275ru_RU
276ru_RU.KOI8-R
277ru_RU.UTF-8
278ru_UA
279rw
280sa
281si
282sid
283sk
284sk_SK
285sl
286sl_SI
287so
288sp
289sq
290sq_AL
291sr
292sr@Latn
293sr@ije
294sr@latin
295sr_RS
296sr_YU
297sr_YU@cyrillic
298sv
299sv_FI
300sv_FI@euro
301sv_SE
302sw
303syr
304ta
305ta_IN
306te
307te_IN
308tg
309tg_TJ
310th
311th_TH
312ti
313ti_ER
314ti_ET
315tig
316tk
317tl
318tl_PH
319tr
320tr_TR
321tt
322tt_RU
323ug
324uk
325uk_UA
326ur
327ur_PK
328uz
329uz@Latn
330uz_UZ
331ve
332vi
333vi_VN
334vi_VN.UTF-8
335wa
336wal
337wo
338xh
339yi
340yi_US
341zh
342zh_CN
343zh_CN.GB18030
344zh_CN.GB2312
345zh_CN.GBK
346zh_CN.UTF-8
347zh_HK
348zh_HK.UTF-8
349zh_SG
350zh_TW
351zh_TW.Big5
352zh_TW.EUC-TW
353zh_TW.UTF-8
354zu
355"
356declare -x ALSA_CARDS=""
357declare -- AM_OPTS=""
358declare -x ANT_HOME="/usr/share/ant"
359declare -x APACHE2_MODULES=""
360declare -x APACHE2_MPMS=""
361declare -x ARCH="amd64"
362declare -- AT_M4DIR=""
363declare -- AT_NOEAUTOHEADER=""
364declare -- AT_NOEAUTOMAKE=""
365declare -- AT_NOELIBTOOLIZE=""
366declare -- AT_SYS_M4DIR=""
367declare -- AUTOTOOLS_AUTO_DEPEND="yes"
368declare -- AUTOTOOLS_DEPEND="|| ( >=sys-devel/automake-1.16.2-r1:1.16 )
369 >=sys-devel/autoconf-2.69
370 >=sys-devel/libtool-2.4"
371declare -- BASHRCD_CCACHE_BASEDIR="/var/tmp/notmpfs/portage"
372declare -- BASHRCD_CCACHE_COMPRESS="true"
373declare -- BASHRCD_CCACHE_DIR="/var/cache/ccache"
374declare -- BASHRCD_CCACHE_NOHASHDIR="true"
375declare BDEPEND="
376 sys-devel/bc
377 virtual/yacc
378 pax-kernel? ( sys-apps/elfix )
379 sys-devel/gnuconfig >=app-portage/elt-patches-20170815 || ( >=sys-devel/automake-1.16.2-r1:1.16 )
380 >=sys-devel/autoconf-2.69
381 >=sys-devel/libtool-2.4"
382declare -x BOOTSTRAP_USE="unicode internal-glib pkg-config split-usr xml python_targets_python3_9 multilib systemd udev"
383declare -x CALLIGRA_FEATURES=""
384declare -x CAMERAS=""
385declare -x CBUILD="x86_64-pc-linux-gnu"
386declare -x CFLAGS="-march=znver3 -O3 -pipe -fomit-frame-pointer -Wl,-O1 -Wl,--as-needed"
387declare -x CFLAGS_amd64="-m64"
388declare -x CFLAGS_default
389declare -x CFLAGS_x32="-mx32"
390declare -x CFLAGS_x86="-m32"
391declare -- CHECKREQS_DISK_BUILD="4500M"
392declare -x CHOST="x86_64-pc-linux-gnu"
393declare -x CHOST_amd64="x86_64-pc-linux-gnu"
394declare -x CHOST_default="x86_64-pc-linux-gnu"
395declare -x CHOST_x32="x86_64-pc-linux-gnux32"
396declare -x CHOST_x86="i686-pc-linux-gnu"
397declare -x COLLECTD_PLUGINS=""
398declare -x COMMON_FLAGS="-march=znver3 -O3 -pipe -fomit-frame-pointer"
399declare -x CONF_PREFIX="/usr"
400declare -x CPU_FLAGS_ARM=""
401declare -x CPU_FLAGS_PPC=""
402declare -x CPU_FLAGS_X86=""
403declare -x CTARGET_default="x86_64-pc-linux-gnu"
404declare -x CURL_SSL=""
405declare -x CXXFLAGS="-march=znver3 -O3 -pipe -fomit-frame-pointer -march=znver3 -O3 -pipe -Wl,-O1 -Wl,--as-needed"
406declare -x DBUS_SESSION_BUS_PID="2045590"
407declare -x DBUS_SESSION_BUS_WINDOWID="134217729"
408declare -x DEFAULT_ABI="amd64"
409declare -x DEFINED_PHASES=" compile configure install postinst prepare pretend setup test"
410declare DEPEND="
411 app-crypt/mit-krb5[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
412 sys-libs/zlib[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
413 ia64? ( sys-libs/libunwind )
414 !minimal? ( >=dev-dotnet/libgdiplus-6.0.2 )
415 nls? ( sys-devel/gettext )
416 "
417declare DESCRIPTION="Mono runtime and class libraries, a C# compiler/interpreter"
418declare -x DEVIRTLTO="-fdevirtualize-at-ltrans"
419declare -x DIROPTIONS="-m0755"
420declare -x DOTNET_ROOT="/opt/dotnet-sdk-bin-6.0"
421declare -x EAPI="7"
422declare -- ECONF_SOURCE="."
423declare -x ELIBC="glibc"
424declare -x ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
425declare -- EPOCHREALTIME="1641986381.997177"
426declare -- EPOCHSECONDS="1641986381"
427declare -x EXEOPTIONS="-m0755"
428declare -x F77FLAGS="-march=znver3 -O3 -pipe -fomit-frame-pointer -Wl,-O1 -Wl,--as-needed"
429declare -x FCFLAGS="-march=znver3 -O3 -pipe -fomit-frame-pointer -Wl,-O1 -Wl,--as-needed"
430declare -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}\""
431declare -x FFLAGS="-march=znver3 -O3 -pipe -fomit-frame-pointer -Wl,-O1 -Wl,--as-needed"
432declare -x FFTOOLS=""
433declare -a FLAG_FILTER_CFLAGS=()
434declare -a FLAG_FILTER_CXXFLAGS=()
435declare -a FLAG_FILTER_CXX_FORTRAN=([0]="-std=c1*" [1]="-std=c8*" [2]="-std=c9*" [3]="-std=gnu1*" [4]="-std=gnu8*" [5]="-std=gnu9*" [6]="-std=iso*" [7]="-Wimplicit-function-declaration")
436declare -a FLAG_FILTER_C_CXX=([0]="-fall-intrinsics" [1]="-fbackslash" [2]="-fcray-pointer" [3]="-fd-lines-as-*" [4]="-fdec*" [5]="-fdefault-*" [6]="-fdollar-ok" [7]="-ffixed-*" [8]="-ffree-*" [9]="-fimplicit-none" [10]="-finteger-4-integer-8" [11]="-fmax-identifier-length*" [12]="-fmodule-private" [13]="-fno-range-check" [14]="-freal-*" [15]="-ftest-forall-temp" [16]="-std=f*" [17]="-std=gnu" [18]="-std=legacy")
437declare -a FLAG_FILTER_C_FORTRAN=([0]="-fabi-*" [1]="-faligned-new" [2]="-fcheck-new" [3]="-fconcepts" [4]="-fconstexpr-*" [5]="-fdeduce-init-list" [6]="-fext*" [7]="-ffor-scope" [8]="-ffriend-injection" [9]="-fms-extensions" [10]="-fnew-inheriting-ctors" [11]="-fnew-ttp-matching" [12]="-fno-access-control" [13]="-fno-elide-constructors" [14]="-fno-enforce-eh-specs" [15]="-fno-extern-tls-init" [16]="-fno-for-scope" [17]="-fno-gnu-keywords" [18]="-fno-implement-inlines" [19]="-fno-implicit-*" [20]="-fno-nonansi-builtins" [21]="-fno-operator-names" [22]="-fno-optional-diags" [23]="-fno-pretty-templates" [24]="-fno-rtti" [25]="-fno-threadsafe-statics" [26]="-fno-use-cxa-get-exception-ptr" [27]="-fno-weak" [28]="-fnothrow-opt" [29]="-fpermissive" [30]="-frepo" [31]="-fsized-deallocation" [32]="-fstrict-enums" [33]="-fstrong-eval-order" [34]="-ftemplate-*" [35]="-fuse-cxa-atexit" [36]="-fvisibility-*" [37]="-nostdinc++" [38]="-std=c++*" [39]="-std=gnu++*" [40]="-Wabi*" [41]="-Wctor-dtor-privacy" [42]="-Wdelete-non-virtual-dtor" [43]="-Weffc++" [44]="-Wliteral-suffix" [45]="-Wlto-type-mismatch" [46]="-Wmultiple-inheritance" [47]="-Wnamespaces" [48]="-Wno-narrowing" [49]="-Wno-non-template-friend" [50]="-Wno-pmf-conversions" [51]="-Wno-terminate" [52]="-Wnoexcept" [53]="-Wnon-virtual-dtor" [54]="-Wold-style-cast" [55]="-Woverloaded-virtual" [56]="-Wregister" [57]="-Wreorder" [58]="-Wsign-promo" [59]="-Wstrict-null-sentinel" [60]="-Wtemplates" [61]="-Wvirtual-inheritance")
438declare -a FLAG_FILTER_F77FLAGS=()
439declare -a FLAG_FILTER_FCFLAGS=()
440declare -a FLAG_FILTER_FFLAGS=()
441declare -a FLAG_FILTER_FORTRAN=([0]="-ansi" [1]="-fallow-parameterless-variadic-functions" [2]="-fcilkplus" [3]="-fcond-mismatch" [4]="-fdirectives-only" [5]="-ffreestanding" [6]="-fgimple" [7]="-fgnu-tm" [8]="-fgnu89-inline" [9]="-fhosted" [10]="-flax-vector-conversions" [11]="-fms-extensions" [12]="-fno-asm" [13]="-fno-builtin*" [14]="-fno-signed-bitfields" [15]="-fno-unsigned-bitfields" [16]="-fpermitted-flt-eval-methods*" [17]="-fplan9-extensions" [18]="-fsigned-*" [19]="-fsso-struct*" [20]="-funsigned-*" [21]="-Wchkp" [22]="-Wclobbered" [23]="-Wformat*" [24]="-Wvolatile-register-var")
442declare -a FLAG_FILTER_GNU=([0]="-emit-llvm" [1]="-flto=full" [2]="-flto=thin" [3]="-flto-jobs=*" [4]="-fopenmp=*" [5]="-frewrite-includes" [6]="-fsanitize=cfi" [7]="-fsanitize=safe-stack" [8]="-mllvm" [9]="-mretpoline*" [10]="-polly*" [11]="-Wl,-z,retpolineplt")
443declare -a FLAG_FILTER_NONGNU=([0]="-fcf-protection*" [1]="-fdevirtualize-at-ltrans" [2]="-fdevirtualize-speculatively" [3]="-fdirectives-only" [4]="-ffat-lto-objects" [5]="-fgcse*" [6]="-fgraphite*" [7]="-finline-functions" [8]="-fipa-pta" [9]="-fira-loop-pressure" [10]="-fisolate-erroneous-paths-attribute" [11]="-fivopts" [12]="-flimit-function-alignment" [13]="-floop*" [14]="-flto=[0-9]*" [15]="-flto=auto" [16]="-flto=jobserver" [17]="-flto-partition=*" [18]="-flto-compression-level=*" [19]="-fmodulo*" [20]="-fno-enforce-eh-specs" [21]="-fno-ident" [22]="-fno-ipa-cp-clone" [23]="-fno-plt" [24]="-fno-semantic-interposition" [25]="-fnothrow-opt" [26]="-fpredictive-commoning" [27]="-frename-registers" [28]="-freorder-functions" [29]="-frerun-cse-after-loop" [30]="-fsched*" [31]="-fsection-anchors" [32]="-fstack-clash-protection" [33]="-ftree*" [34]="-funsafe-loop*" [35]="-fuse-linker-plugin" [36]="-fvect-cost-model" [37]="-fweb" [38]="-fwhole-program" [39]="-malign-data*" [40]="-mfunction-return*" [41]="-mindirect-branch*" [42]="-mvectorize*" [43]="-Wl,-z,retpolineplt")
444declare -x FLTO="-flto=33"
445declare -x GCC_SPECS=""
446declare -x GPSD_PROTOCOLS=""
447declare -x GRAPHITE="-fgraphite-identity -floop-nest-optimize"
448declare -x GRUB_PLATFORMS=""
449declare -x GSETTINGS_BACKEND="dconf"
450declare -x HISTFILESIZE=""
451declare -x HISTSIZE=""
452declare -x HISTTIMEFORMAT="[%F %T] "
453declare HOMEPAGE="https://mono-project.com"
454declare IDEPEND
455declare -x INHERITED=" gnuconfig toolchain-funcs multilib libtool autotools check-reqs linux-info mono-env pax-utils multibuild multilib-build multilib-minimal"
456declare -x INPUT_DEVICES=""
457declare -x INSOPTIONS="-m0644"
458declare -x IPAPTA="-fipa-pta"
459declare IUSE="doc minimal nls pax-kernel xen abi_x86_32 abi_x86_64 abi_x86_x32 abi_mips_n32 abi_mips_n64 abi_mips_o32 abi_s390_32 abi_s390_64"
460declare -x IUSE_EFFECTIVE="abi_mips_n32 abi_mips_n64 abi_mips_o32 abi_s390_32 abi_s390_64 abi_x86_32 abi_x86_64 abi_x86_x32 alpha amd64 amd64-linux arm arm64 arm64-macos doc elibc_Cygwin elibc_Darwin elibc_SunOS elibc_Winnt elibc_bionic elibc_glibc elibc_mingw elibc_musl hppa ia64 kernel_Darwin kernel_SunOS kernel_Winnt kernel_linux m68k minimal mips nls pax-kernel ppc ppc-macos ppc64 ppc64-linux prefix prefix-guest prefix-stack riscv s390 sparc sparc-solaris sparc64-solaris userland_BSD userland_GNU x64-cygwin x64-macos x64-solaris x64-winnt x86 x86-linux x86-solaris x86-winnt xen"
461declare -x IUSE_IMPLICIT="abi_x86_64 prefix prefix-guest prefix-stack"
462declare -x JAVAC="/etc/java-config-2/current-system-vm/bin/javac"
463declare -x JAVA_HOME="/etc/java-config-2/current-system-vm"
464declare -x JDK_HOME="/etc/java-config-2/current-system-vm"
465declare -- KEEPPGO=":"
466declare -x KERNEL="linux"
467declare -x KERNEL_ABI="amd64"
468declare -- KERNEL_DIR="/usr/src/linux"
469declare -- KERNEL_MAKEFILE=""
470declare -x KEYWORDS="amd64 ~arm ~arm64 ~ppc ~ppc64 -riscv x86 ~amd64-linux"
471declare -x L10N=""
472declare -x LADSPA_PATH="/usr/lib64/ladspa"
473declare -x LANG="en_US.utf8"
474declare -x LCD_DEVICES=""
475declare -x LC_ALL="C"
476declare -x LC_COLLATE="C"
477declare -x LC_MESSAGES="C"
478declare -x LDFLAGS="-Wl,-O1 -Wl,--as-needed"
479declare -x LDFLAGS_amd64="-m elf_x86_64"
480declare -x LDFLAGS_default
481declare -x LDFLAGS_x32="-m elf32_x86_64"
482declare -x LDFLAGS_x86="-m elf_i386"
483declare -x LIBDIR_amd64="lib64"
484declare -x LIBDIR_default="lib"
485declare -x LIBDIR_x32="libx32"
486declare -x LIBDIR_x86="lib"
487declare -x LIBOPTIONS="-m0644"
488declare -x LIBREOFFICE_EXTENSIONS=""
489declare -x LICENSE="MIT LGPL-2.1 GPL-2 BSD-4 NPL-1.1 Ms-PL GPL-2-with-linking-exception IDPL"
490declare -x LINGUAS="en"
491declare -x LLVM_TARGETS=""
492declare -x LUA_SINGLE_TARGET=""
493declare -x LUA_TARGETS=""
494declare -x LV2_PATH="/usr/lib64/lv2"
495declare -x MAKEOPTS="-j32 -l32"
496declare -x MANPAGER="manpager"
497declare -x MONKEYD_PLUGINS=""
498declare -x MONO_REGISTRY_PATH="/var/tmp/notmpfs/portage/dev-lang/mono-6.12.0.122/temp/registry"
499declare -x MONO_SHARED_DIR="/var/tmp/notmpfs/portage/dev-lang/mono-6.12.0.122/temp"
500declare -x MOZ_GMP_PATH="/usr/lib64/nsbrowser/plugins/gmp-gmpopenh264/system-installed"
501declare -x MULTILIB_ABIS="amd64 x86"
502declare -x MULTILIB_STRICT_DENY="64-bit.*shared object"
503declare -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"
504declare -x MULTILIB_STRICT_EXEMPT="(perl5|gcc|binutils|eclipse-3|debug|portage|udev|systemd|clang|python-exec|llvm)"
505declare -- MULTILIB_USEDEP="abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_s390_32(-)?,abi_s390_64(-)?"
506declare -x NGINX_MODULES_HTTP=""
507declare -x NGINX_MODULES_MAIL=""
508declare -x NGINX_MODULES_STREAM=""
509declare -x NOCOMMON="-fno-common"
510declare -x NOPLT="-fno-plt"
511declare -x NTHREADS="33"
512declare -x OFED_DRIVERS=""
513declare -x OFFICE_IMPLEMENTATION=""
514declare -x OPENMPI_FABRICS=""
515declare -x OPENMPI_OFED_FEATURES=""
516declare -x OPENMPI_RM=""
517declare -a PATCHES=([0]="/var/tmp/notmpfs/portage/dev-lang/mono-6.12.0.122/files/mono-5.12-try-catch.patch")
518declare -x PATH="/usr/lib/portage/python3.9/ebuild-helpers/xattr:/usr/lib/portage/python3.9/ebuild-helpers:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/13/bin:/opt/cuda/bin"
519declare -- PAX_MARKINGS="none"
520declare PDEPEND=""
521declare -- PGO_DIR="/var/cache/pgo/dev-lang:mono-6.12.0.122"
522declare -- PGO_PARENT="/var/cache/pgo"
523declare -x PHP_TARGETS=""
524declare -x PORTAGE_COMPRESSION_COMMAND="bzip2"
525declare -a PORTAGE_DOCOMPRESS=([0]="/usr/share/doc" [1]="/usr/share/info" [2]="/usr/share/man")
526declare -x PORTAGE_DOCOMPRESS_SIZE_LIMIT="128"
527declare -a PORTAGE_DOCOMPRESS_SKIP=([0]="/usr/share/doc/mono-6.12.0.122/html")
528declare -a PORTAGE_DOSTRIP=([0]="/")
529declare -a PORTAGE_DOSTRIP_SKIP=()
530declare -x PORTAGE_NICENESS="-5"
531declare -x POSTGRES_TARGETS=""
532declare -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"
533declare -- PROPERTIES=""
534declare -x PYTHONDONTWRITEBYTECODE="1"
535declare -x PYTHON_SINGLE_TARGET=""
536declare -x PYTHON_TARGETS=""
537declare -- QA_MULTILIB_PATHS="usr/lib/"
538declare -x QEMU_SOFTMMU_TARGETS=""
539declare -x QEMU_USER_TARGETS=""
540declare RDEPEND="
541
542 app-crypt/mit-krb5[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
543 sys-libs/zlib[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_s390_32(-)?,abi_s390_64(-)?]
544 ia64? ( sys-libs/libunwind )
545 !minimal? ( >=dev-dotnet/libgdiplus-6.0.2 )
546 nls? ( sys-devel/gettext )
547
548 app-misc/ca-certificates
549 "
550declare REPOSITORY
551declare REQUIRED_USE=""
552declare RESTRICT=""
553declare -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}\""
554declare -x ROS_MESSAGES=""
555declare -x RUBY_TARGETS=""
556declare -x S="/var/tmp/notmpfs/portage/dev-lang/mono-6.12.0.122/work/mono-6.12.0.122"
557declare -x SAFER_FAST_MATH="-fno-signed-zeros -fno-trapping-math -fassociative-math -freciprocal-math -fno-math-errno -ffinite-math-only -fno-rounding-math -fno-signaling-nans -fcx-limited-range -fexcess-precision=fast"
558declare -x SAFER_UNSAFE_MATH_OPTS="-fno-signed-zeros -fno-trapping-math -fassociative-math -freciprocal-math"
559declare -x SAFEST_FAST_MATH="-fno-math-errno -fno-trapping-math"
560declare -x SANDBOX_DEBUG="0"
561declare -x SANDBOX_DENY=""
562declare -x SANDBOX_PREDICT="/var/tmp/notmpfs/portage/dev-lang/mono-6.12.0.122/homedir:/dev/crypto:/var/cache/man:/dev/random:/proc/self/coredump_filter:/dev/random:/proc/self/coredump_filter:/dev/random:/proc/self/coredump_filter:/var/cache/fontconfig"
563declare -x SANDBOX_READ="/:/var/tmp/notmpfs/portage"
564declare -x SANDBOX_VERBOSE="1"
565declare -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/:/usr/tmp/cf:/usr/tmp/conftest:/var/tmp/:/var/tmp/notmpfs/portage:/var/tmp/notmpfs/portage/dev-lang/mono-6.12.0.122/homedir/.bash_history"
566declare -x SANE_BACKENDS=""
567declare -x SEMINTERPOS="-fno-semantic-interposition"
568declare -x SHELL="/bin/bash"
569declare -x SLOT="0"
570declare -i SRANDOM="2498897842"
571declare SRC_URI="https://download.mono-project.com/sources/mono/mono-6.12.0.122.tar.xz"
572declare -x SSH_ASKPASS="/usr/bin/ssh-askpass-fullscreen"
573declare -x SSH_ENV="/home/marco/.ssh/environment"
574declare -x SUDO_ASKPASS="/usr/bin/ssh-askpass-fullscreen"
575declare -x SYMLINK_LIB="no"
576declare -x TWISTED_DISABLE_WRITING_OF_PLUGIN_CACHE="1"
577declare -x USE="abi_x86_32 abi_x86_64 amd64 elibc_glibc kernel_linux minimal nls userland_GNU"
578declare -x USERLAND="GNU"
579declare -x USE_EXPAND_IMPLICIT="ARCH ELIBC KERNEL USERLAND"
580declare -x USE_EXPAND_UNPREFIXED="ARCH"
581declare -x USE_EXPAND_VALUES_ARCH="alpha amd64 amd64-linux arm arm64 arm64-macos hppa ia64 m68k mips ppc ppc64 ppc64-linux ppc-macos riscv s390 sparc sparc64-solaris sparc-solaris x64-cygwin x64-macos x64-solaris x64-winnt x86 x86-linux x86-solaris x86-winnt"
582declare -x USE_EXPAND_VALUES_ELIBC="bionic Cygwin Darwin glibc mingw musl SunOS Winnt"
583declare -x USE_EXPAND_VALUES_KERNEL="Darwin linux SunOS Winnt"
584declare -x USE_EXPAND_VALUES_USERLAND="BSD GNU"
585declare -x UWSGI_PLUGINS=""
586declare -x VBOX_APP_HOME="/usr/lib64/virtualbox"
587declare -x VIDEO_CARDS=""
588declare -x VOICEMAIL_STORAGE=""
589declare -x WANT_AUTOCONF="2.5"
590declare -x WANT_AUTOMAKE="1.16"
591declare -x WANT_LIBTOOL="latest"
592declare -x XDG_CONFIG_DIRS="/etc/xdg"
593declare -x XDG_CONFIG_HOME="/var/tmp/notmpfs/portage/dev-lang/mono-6.12.0.122/temp"
594declare -x XDG_DATA_DIRS="/usr/local/share:/usr/share"
595declare -x XDG_DATA_HOME="/var/tmp/notmpfs/portage/dev-lang/mono-6.12.0.122/temp/data"
596declare -x XTABLES_ADDONS=""
597declare -- _AUTOTOOLS_ECLASS="1"
598declare -- _CHECK_REQS_ECLASS="1"
599declare -x _E_DESTTREE_="/usr"
600declare -x _E_DOCDESTTREE_=""
601declare -x _E_EXEDESTTREE_=""
602declare -x _E_INSDESTTREE_=""
603declare -- _GNUCONFIG_CLASS="1"
604declare -a _LATEST_AUTOMAKE=([0]="1.16.2-r1:1.16")
605declare -- _LIBTOOL_ECLASS="1"
606declare -- _LINUX_CONFIG_EXISTS_DONE=""
607declare -- _MONO_ENV_ECLASS="1"
608declare -- _MULTIBUILD="1"
609declare -- _MULTILIB_BUILD="1"
610declare -- _MULTILIB_ECLASS="1"
611declare -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_s390_32:s390" [7]="abi_s390_64:s390x")
612declare -- _PAX_UTILS_ECLASS="1"
613declare -- _TOOLCHAIN_FUNCS_ECLASS="1"
614declare -- __AUTOTOOLS_AUTO_DEPEND="yes"
615declare -- _libtool_atom=">=sys-devel/libtool-2.4"
616declare -- bashrcd_phases_0_all="CcacheRestore"
617declare -- bashrcd_phases_0_compile="FlagCompile"
618declare -- bashrcd_phases_0_configure="LTOPatch"
619declare -- bashrcd_phases_0_preinst="FlagPreinst"
620declare -- bashrcd_phases_0_setup="FlagSetup"
621declare -- bashrcd_phases_1_configure="nocommon_configure"
622declare -- bashrcd_phases_1_preinst="LocalePurge"
623declare -- bashrcd_phases_1_setup="QlopSetup"
624declare -- bashrcd_phases_2_preinst="Remove_la"
625declare -- bashrcd_phases_2_setup="CcacheSetup"
626declare -- bashrcd_phases_c_all="0"
627declare -- bashrcd_phases_c_compile="0"
628declare -- bashrcd_phases_c_configure="1"
629declare -- bashrcd_phases_c_preinst="2"
630declare -- bashrcd_phases_c_setup="2"
631declare -- get_version_warning_done=""
632declare -x gl_cv_type_time_t_bits_macro="no"
633BashrcdEcho ()
634{
635 local i m=einfo;
636 BashrcdTrue $BASHRCDLOG && m=elog;
637 for i in "$@";
638 do
639 $m "$i";
640 done
641}
642BashrcdLog ()
643{
644 local i m=elog;
645 BashrcdTrue $BASHRCDNOLOG && m=einfo;
646 for i in "$@";
647 do
648 $m "$i";
649 done
650}
651BashrcdMain ()
652{
653 local bashrcd_ebuild_phase bashrcd_phase bashrcd_num bashrcd_max;
654 bashrcd_ebuild_phase=$EBUILD_PHASE;
655 [ -n "${bashrcd_ebuild_phase:++}" ] || [ $# -eq 0 ] || bashrcd_ebuild_phase=$1;
656 : ${ED:=${D%/}${EPREFIX%/}/};
657 BashrcdTrue $BASHRCD_DEBUG && BashrcdEcho "$0: $* ($# args)" "EBUILD_PHASE=$EBUILD_PHASE" "PORTDIR=$PORTDIR" "CATEGORY=$CATEGORY" "P=$P" "USER=$USER" "UID=$UID" "HOME=$HOME" "PATH=$PATH" "ROOT=$ROOT" "PORTAGE_CONFIGROOT=$PORTAGE_CONFIGROOT" "LD_PRELOAD=$LD_PRELOAD" "EPREFIX=$EPREFIX" "D=$D" "ED=$ED";
658 for bashrcd_phase in all "$bashrcd_ebuild_phase";
659 do
660 eval bashrcd_max=\${bashrcd_phases_c_$bashrcd_phase};
661 [ -z "${bashrcd_max:++}" ] && continue;
662 bashrcd_num=0;
663 while {
664 eval eval \"\\\${bashrcd_phases_${bashrcd_num}_$bashrcd_phase}\";
665 [ $bashrcd_num -ne $bashrcd_max ]
666 }; do
667 bashrcd_num=$(( $bashrcd_num + 1 ));
668 done;
669 done
670}
671BashrcdTrue ()
672{
673 case ${1:-n} in
674 [nNfF]* | [oO][fF]* | 0 | -)
675 return 1
676 ;;
677 esac;
678 :
679}
680CcacheRestore ()
681{
682 local i j;
683 unset ${!CCACHE_*};
684 for i in ${!BASHRCD_CCACHE_*};
685 do
686 j=${i##BASHRCD_};
687 eval $j=\$$i;
688 export $j;
689 done
690}
691CcacheSetup ()
692{
693 local i;
694 : ${CCACHE_BASEDIR=${PORTAGE_TMPDIR:-/var/tmp}/portage};
695 : ${CCACHE_SLOPPINESS='file_macro,time_macros,include_file_mtime,include_file_ctime,file_stat_matches,pch_defines'};
696 : ${CCACHE_COMPRESS=true};
697 if BashrcdTrue $USE_NONGNU && BashrcdTrue $CCACHE_CPP2_OPTIONAL; then
698 : ${CCACHE_CPP2=true};
699 fi;
700 BashrcdTrue "${CCACHE_HASHDIR-}" || CCACHE_NOHASHDIR=true;
701 for i in ${!CCACHE_*};
702 do
703 if eval "BashrcdTrue \$$i"; then
704 eval BASHRCD_$i=\$$i;
705 export $i;
706 else
707 unset $i;
708 fi;
709 done;
710 function CcacheRestore ()
711 {
712 local i j;
713 unset ${!CCACHE_*};
714 for i in ${!BASHRCD_CCACHE_*};
715 do
716 j=${i##BASHRCD_};
717 eval $j=\$$i;
718 export $j;
719 done
720 }
721}
722FlagAdd ()
723{
724 FlagNodupAdd '' "$@"
725}
726FlagAddAllFlags ()
727{
728 FlagAddCFlags "$@";
729 FlagAddFFlags "$@"
730}
731FlagAddCFlags ()
732{
733 FlagAdd CFLAGS "$@";
734 FlagAdd CXXFLAGS "$@"
735}
736FlagAddFFlags ()
737{
738 FlagAdd FFLAGS "$@";
739 FlagAdd FCFLAGS "$@";
740 FlagAdd F77FLAGS "$@"
741}
742FlagAthlon ()
743{
744 FlagSubCFlags '-march=*';
745 FlagAddCFlags '-march=athlon-4';
746 command -v x86_64-pc-linux-gnu-gcc32 > /dev/null 2>&1 && export CC=x86_64-pc-linux-gnu-gcc32;
747 command -v x86_64-pc-linux-gnu-g++32 > /dev/null 2>&1 && export CXX=x86_64-pc-linux-gnu-g++32
748}
749FlagCompile ()
750{
751 :
752}
753FlagEval ()
754{
755 case $- in
756 *f*)
757 eval "$*"
758 ;;
759 *)
760 set -f;
761 eval "$*";
762 set +f
763 ;;
764 esac
765}
766FlagExecute ()
767{
768 local ex exy excurr;
769 for excurr in "$@";
770 do
771 case $excurr in
772 '#'*)
773 return
774 ;;
775 '!'*)
776 [ "$HOSTTYPE" = 'i686' ] || continue;
777 ex=${excurr#?}
778 ;;
779 '~'*)
780 [ "$HOSTTYPE" = 'x86_64' ] || continue;
781 ex=${excurr#?}
782 ;;
783 *)
784 ex=$excurr
785 ;;
786 esac;
787 case $ex in
788 /*/*)
789 ex=${ex%/};
790 ex=${ex#/};
791 FlagEval FlagReplaceAllFlags "${ex%%/*}" "${ex#*/}"
792 ;;
793 '-'*)
794 FlagAddCFlags "$ex"
795 ;;
796 '+flto*')
797 FlagSubAllFlags '-flto*' '-fuse-linker-plugin' '-emit-llvm'
798 ;;
799 '+'*)
800 FlagSubAllFlags "-${ex#+}"
801 ;;
802 'C*FLAGS-='*)
803 FlagEval FlagSubCFlags ${ex#*-=}
804 ;;
805 'C*FLAGS+='*)
806 FlagEval FlagAddCFlags ${ex#*+=}
807 ;;
808 'C*FLAGS='*)
809 FlagEval FlagSetCFlags "${ex#*=}"
810 ;;
811 'C*FLAGS/=/'*/*)
812 ex=${ex%/};
813 ex=${ex#*/=/};
814 FlagEval FlagReplaceCFlags "${ex%%/*}" "${ex#*/}"
815 ;;
816 'F*FLAGS-='*)
817 FlagEval FlagSubFFlags ${ex#*-=}
818 ;;
819 'F*FLAGS+='*)
820 FlagEval FlagAddFFlags ${ex#*+=}
821 ;;
822 'F*FLAGS='*)
823 FlagEval FlagSetFFlags "${ex#*=}"
824 ;;
825 'F*FLAGS/=/'*/*)
826 ex=${ex%/};
827 ex=${ex#*/=/};
828 FlagEval FlagReplaceFFlags "${ex%%/*}" "${ex#*/}"
829 ;;
830 '*FLAGS-='*)
831 FlagEval FlagSubAllFlags ${ex#*-=}
832 ;;
833 '*FLAGS+='*)
834 FlagEval FlagAddAllFlags ${ex#*+=}
835 ;;
836 '*FLAGS='*)
837 FlagEval FlagSetAllFlags "${ex#*=}"
838 ;;
839 '*FLAGS/=/'*/*)
840 ex=${ex%/};
841 ex=${ex#*/=/};
842 FlagEval FlagReplaceAllFlags "${ex%%/*}" "${ex#*/}"
843 ;;
844 'ATHLON32')
845 FlagAthlon
846 ;;
847 'NOC*OPT='* | 'NOC*='*)
848 FlagEval FlagSet NOCOPT "${ex#*=}";
849 NOCXXOPT=$NOCOPT;
850 NOCPPOPT=$NOCOPT
851 ;;
852 'NO*OPT='*)
853 FlagEval FlagSet NOCOPT "${ex#*=}";
854 NOCXXOPT=$NOCOPT;
855 NOCPPOPT=$NOCOPT;
856 NOLDOPT=$NOCOPT
857 ;;
858 'NOLD*='*)
859 FlagEval FlagSet NOLDOPT "${ex#*=}";
860 NOLDADD=$NOLDOPT
861 ;;
862 'NO*'*)
863 FlagEval FlagSet NOCOPT "${ex#*=}";
864 NOCXXOPT=$NOCOPT;
865 NOCPPOPT=$NOCOPT;
866 NOLDOPT=$NOCOPT;
867 NOLDADD=$NOCOPT;
868 NOFFLAGS=$NOCOPT;
869 NOFCFLAGS=$NOCOPT;
870 NOF77FLAGS=$NOCOPT
871 ;;
872 'SAFE')
873 NOCOPT=1;
874 NOCXXOPT=1;
875 NOCPPOPT=1;
876 NOLDOPT=1;
877 MESONDEDUP=1;
878 LDFLAGS=;
879 CONFIG_SITE=;
880 NOLAFILEREMOVE=1;
881 unset CMAKE_MAKEFILE_GENERATOR
882 ;;
883 *' '*'='*)
884 FlagEval "$ex"
885 ;;
886 *'/=/'*'/'*)
887 ex=${ex%/};
888 exy=${ex#*/=/};
889 FlagEval FlagReplace "${ex%%/=/*}" "${exy%%/*}" "${exy#*/}"
890 ;;
891 *'-='*)
892 FlagEval FlagSub "${ex%%-=*}" ${ex#*-=}
893 ;;
894 *'+='*)
895 FlagEval FlagAdd "${ex%%+=*}" ${ex#*+=}
896 ;;
897 *'='*)
898 FlagEval FlagSet "${ex%%=*}" "${ex#*=}"
899 ;;
900 *)
901 FlagEval "$ex"
902 ;;
903 esac;
904 done
905}
906FlagInfoExport ()
907{
908 local out;
909 for out in FEATURES CFLAGS CXXFLAGS CPPFLAGS FFLAGS FCFLAGS F77FLAGS LDFLAGS MAKEOPTS EXTRA_ECONF EXTRA_EMAKE USE_NONGNU;
910 do
911 eval "if [ -n \"\${$out:++}\" ]
912 then export $out
913 BashrcdEcho \"$out='\$$out'\"
914 else unset $out
915 fi";
916 done;
917 if BashrcdTrue $PGO; then
918 BashrcdEcho "Create PGO into $PGO_DIR";
919 else
920 if $use_pgo; then
921 BashrcdEcho "Using PGO from $PGO_DIR";
922 fi;
923 fi;
924 out=`${CC:-gcc} --version | head -n 1` || out=;
925 BashrcdEcho "${out:-cannot determine gcc version}";
926 out=`${CXX:-g++} --version | head -n 1` || out=;
927 BashrcdEcho "${out:-cannot determine g++ version}";
928 out=`${LD:-ld} --version | head -n 1` || out=;
929 BashrcdEcho "${out:-cannot determine ld version}";
930 BashrcdEcho "`uname -a`"
931}
932FlagMask ()
933{
934 masked-packages -qm "$1" -- "$CATEGORY/$PF:${SLOT:-0}${PORTAGE_REPO_NAME:+::}${PORTAGE_REPO_NAME-}"
935}
936FlagMesonDedup ()
937{
938 local newld=;
939 FlagNodupAdd "$CFLAGS $CXXFLAGS $CPPFLAGS $FFLAGS $FCFLAGS $F77FLAGS" newld $LDFLAGS;
940 LDFLAGS=$newld
941}
942FlagNodupAdd ()
943{
944 local addres addf addvar dups;
945 dups=$1;
946 shift;
947 addvar=$1;
948 shift;
949 eval addres=\$$addvar;
950 for addf in "$@";
951 do
952 case " $addres $dups " in
953 *[[:space:]]"$addf"[[:space:]]*)
954 continue
955 ;;
956 esac;
957 addres=$addres${addres:+\ }$addf;
958 done;
959 eval $addvar=\$addres
960}
961FlagParseLine ()
962{
963 local scanp scanl scansaveifs;
964 scanl=$2;
965 while :; do
966 case $scanl in
967 [[:space:]]*)
968 scanl=${scanl#?};
969 continue
970 ;;
971 '#'*)
972 return
973 ;;
974 *[[:space:]]*)
975 break
976 ;;
977 esac;
978 return;
979 done;
980 scanp=${scanl%%[[:space:]]*};
981 scanl=${scanl#*[[:space:]]};
982 [ -n "${scanl:++}" ] || return 0;
983 FlagMask "$scanp" || return 0;
984 scansaveifs=$IFS;
985 IFS=$1;
986 BashrcdEcho "$scanfile -> $scanp: $scanl";
987 FlagEval FlagExecute $scanl;
988 IFS=$scansaveifs
989}
990FlagPreinst ()
991{
992 :
993}
994FlagReplace ()
995{
996 local repres repf repcurr repvar reppat;
997 repvar=$1;
998 shift;
999 eval repf=\$$repvar;
1000 reppat=$1;
1001 shift;
1002 repres=;
1003 for repcurr in $repf;
1004 do
1005 case $repcurr in
1006 $reppat)
1007 $repfound && FlagAdd repres "$@";
1008 continue
1009 ;;
1010 esac;
1011 repres=$repres${repres:+\ }$repcurr;
1012 done;
1013 eval $repvar=\$repres
1014}
1015FlagReplaceAllFlags ()
1016{
1017 FlagReplaceCFlags "$@";
1018 FlagReplaceFFlags "$@";
1019 FlagSub LDFLAGS "$1";
1020 FlagSub OPTLDFLAGS "$1"
1021}
1022FlagReplaceCFlags ()
1023{
1024 FlagReplace CFLAGS "$@";
1025 FlagReplace CXXFLAGS "$@";
1026 FlagReplace CPPFLAGS "$@";
1027 FlagSub OPTCFLAGS "$1";
1028 FlagSub OPTCXXFLAGS "$1";
1029 FlagSub OPTCPPFLAGS "$1"
1030}
1031FlagReplaceFFlags ()
1032{
1033 FlagReplace FFLAGS "$@";
1034 FlagReplace FCFLAGS "$@";
1035 FlagReplace F77FLAGS "$@"
1036}
1037FlagScanDir ()
1038{
1039 local scantmp scanifs scanfile;
1040 scanifs=$IFS;
1041 if test -d "$1"; then
1042 IFS='
1043';
1044 for scantmp in `find -L "$1" '(' '(' -name '.*' -o -name '*~' ')' -prune ')' -o -type f -print`;
1045 do
1046 IFS=$scanifs;
1047 FlagScanFiles "$scantmp";
1048 done;
1049 else
1050 FlagScanFiles "$1";
1051 fi;
1052 scanfile='FLAG_ADDLINES';
1053 IFS='
1054';
1055 for scantmp in $FLAG_ADDLINES;
1056 do
1057 FlagParseLine "$scanifs" "$scantmp";
1058 done;
1059 IFS=$scanifs
1060}
1061FlagScanFiles ()
1062{
1063 local scanfile scanl oldifs scanifs;
1064 scanifs=$IFS;
1065 IFS=;
1066 for scanfile in "$@";
1067 do
1068 [ -z "${scanfile:++}" ] && continue;
1069 test -r "$scanfile" || continue;
1070 while read -r scanl; do
1071 FlagParseLine "$scanifs" "$scanl";
1072 done < "$scanfile";
1073 done;
1074 IFS=$scanifs
1075}
1076FlagSet ()
1077{
1078 local setvar;
1079 setvar=$1;
1080 shift;
1081 eval $setvar=\$*
1082}
1083FlagSetAllFlags ()
1084{
1085 FlagSetCFlags "$@";
1086 FlagSetFFlags "$@";
1087 LDFLAGS=;
1088 OPTLDFLAGS=
1089}
1090FlagSetCFlags ()
1091{
1092 FlagSet CFLAGS "$@";
1093 CXXFLAGS=$CFLAGS;
1094 CPPFLAGS=;
1095 OPTCFLAGS=;
1096 OPTCXXFLAGS=;
1097 OPTCPPFLAGS=
1098}
1099FlagSetFFlags ()
1100{
1101 FlagSet FFLAGS "$@";
1102 FlagSet FCFLAGS "$@";
1103 FlagSet F77FLAGS "$@"
1104}
1105FlagSetFlags ()
1106{
1107 local ld i;
1108 ld=;
1109 : ${PGO_PARENT:=/var/cache/pgo};
1110 : ${PGO_DIR:=$PGO_PARENT/$CATEGORY:$P};
1111 FlagScanDir "${PORTAGE_CONFIGROOT%/}/etc/portage/package.cflags";
1112 [ -z "${USE_NONGNU++}" ] && FlagSetUseNonGNU && USE_NONGNU=1;
1113 if BashrcdTrue "${USE_NONGNU-}"; then
1114 FlagSetNonGNU;
1115 else
1116 FlagSetGNU;
1117 fi;
1118 if [ -n "$FLAG_ADD" ]; then
1119 BashrcdEcho "FLAG_ADD: $FLAG_ADD";
1120 FlagEval FlagExecute "$FLAG_ADD";
1121 fi;
1122 PGO_DIR=${PGO_DIR%/};
1123 case ${PGO_DIR:-/} in
1124 /)
1125 error 'PGO_DIR must not be empty';
1126 false
1127 ;;
1128 /*)
1129 :
1130 ;;
1131 *)
1132 error 'PGO_DIR must be an absolute path';
1133 false
1134 ;;
1135 esac || {
1136 die 'Bad PGO_DIR';
1137 exit 2
1138 };
1139 use_pgo=false;
1140 if test -r "$PGO_DIR"; then
1141 unset PGO;
1142 BashrcdTrue $NOPGO || use_pgo=:;
1143 fi;
1144 if BashrcdTrue $PGO; then
1145 FlagAddCFlags "-fprofile-generate=$PGO_DIR" -fvpt -fprofile-arcs;
1146 FlagAdd LDFLAGS -fprofile-arcs;
1147 addpredict "$PGO_PARENT";
1148 else
1149 if $use_pgo; then
1150 FlagAddCFlags "-fprofile-use=$PGO_DIR" -fvpt -fbranch-probabilities -fprofile-correction;
1151 else
1152 : ${KEEPPGO:=:};
1153 fi;
1154 fi;
1155 BashrcdTrue $NOLDOPT || FlagAdd LDFLAGS $OPTLDFLAGS;
1156 BashrcdTrue $NOCADD || BashrcdTrue $MESONDEDUP || case " $LDFLAGS $CFLAGS $CXXFLAGS" in
1157 *[[:space:]]'-flto'*)
1158 ld="$CFLAGS $CXXFLAGS"
1159 ;;
1160 esac;
1161 BashrcdTrue $NOLDADD || BashrcdTrue $MESONDEDUP || FlagAddCFlags $LDFLAGS;
1162 FlagAdd LDFLAGS $ld;
1163 BashrcdTrue $NOCOPT || FlagAdd CFLAGS $OPTCFLAGS;
1164 BashrcdTrue $NOCXXOPT || FlagAdd CXXFLAGS $OPTCXXFLAGS;
1165 BashrcdTrue $NOCPPOPT || FlagAdd CPPFLAGS $OPTCPPFLAGS;
1166 BashrcdTrue $NOFFLAGS || FFLAGS=$CFLAGS;
1167 BashrcdTrue $NOFCFLAGS || FCFLAGS=$FFLAGS;
1168 BashrcdTrue $NOF77FLAGS || F77FLAGS=$FFLAGS;
1169 BashrcdTrue $NOFILTER_CXXFLAGS || FlagSub CXXFLAGS "${FLAG_FILTER_C_CXX[@]}" "${FLAG_FILTER_CXX_FORTRAN[@]}" "${FLAG_FILTER_CXXFLAGS[@]}";
1170 BashrcdTrue $NOFILTER_CFLAGS || FlagSub CFLAGS "${FLAG_FILTER_C_CXX[@]}" "${FLAG_FILTER_C_FORTRAN[@]}" "${FLAG_FILTER_CFLAGS[@]}";
1171 BashrcdTrue $NOFILTER_FFLAGS || FlagSub FFLAGS "${FLAG_FILTER_C_FORTRAN[@]}" "${FLAG_FILTER_CXX_FORTRAN[@]}" "${FLAG_FILTER_FORTRAN[@]}" "${FLAG_FILTER_FFLAGS[@]}";
1172 BashrcdTrue $NOFILTER_FCFLAGS || FlagSub FCFLAGS "${FLAG_FILTER_C_FORTRAN[@]}" "${FLAG_FILTER_CXX_FORTRAN[@]}" "${FLAG_FILTER_FORTRAN[@]}" "${FLAG_FILTER_FCFLAGS[@]}";
1173 BashrcdTrue $NOFILTER_F77FLAGS || FlagSub FCFLAGS "${FLAG_FILTER_C_FORTRAN[@]}" "${FLAG_FILTER_CXX_FORTRAN[@]}" "${FLAG_FILTER_FORTRAN[@]}" "${FLAG_FILTER_F77LAGS[@]}";
1174 ! BashrcdTrue $MESONDEDUP || FlagMesonDedup;
1175 unset OPTCFLAGS OPTCXXFLAGS OPTCPPFLAGS OPTLDFLAGS;
1176 unset NOLDOPT NOLDADD NOCOPT NOCXXOPT NOFFLAGS NOFCFLAGS NOF77FLAGS;
1177 unset NOFILTER_CXXFLAGS NOFILTER_CFLAGS;
1178 unset NOFILTER_FFLAGS NOFILTER_FCFLAGS NOFILTER_F77FLAGS
1179}
1180FlagSetGNU ()
1181{
1182 FlagSubAllFlags "${FLAG_FILTER_GNU[@]}"
1183}
1184FlagSetNonGNU ()
1185{
1186 : ${NOLDADD:=1};
1187 FlagSubAllFlags "${FLAG_FILTER_NONGNU[@]}";
1188 FlagReplaceAllFlags '-fstack-check*' '-fstack-check'
1189}
1190FlagSetUseNonGNU ()
1191{
1192 case $CC$CXX in
1193 *clang*)
1194 return 0
1195 ;;
1196 esac;
1197 return 1
1198}
1199FlagSetup ()
1200{
1201 function FlagCompile ()
1202 {
1203 :
1204 };
1205 local use_pgo;
1206 FlagSetFlags;
1207 if BashrcdTrue $PGO; then
1208 function FlagPreinst ()
1209 {
1210 test -d "$PGO_DIR" || mkdir -p -m +1777 -- "$PGO_DIR" || {
1211 eerror "cannot create pgo directory $PGO_DIR";
1212 die 'cannot create PGO_DIR';
1213 exit 2
1214 };
1215 ewarn "$CATEGORY/$PN will write profile info to world-writable";
1216 ewarn "$PGO_DIR";
1217 ewarn 'Reemerge it soon for an optimized version and removal of that directory'
1218 };
1219 else
1220 if BashrcdTrue $KEEPPGO; then
1221 function FlagPreinst ()
1222 {
1223 :
1224 };
1225 else
1226 function FlagPreinst ()
1227 {
1228 test -d "$PGO_DIR" || return 0;
1229 BashrcdLog "removing pgo directory $PGO_DIR";
1230 rm -r -f -- "$PGO_DIR" || {
1231 eerror "cannot remove pgo directory $PGO_DIR";
1232 die 'cannot remove PGO_DIR';
1233 exit 2
1234 };
1235 local g;
1236 g=${PGO_DIR%/*};
1237 [ -z "$g" ] || rmdir -p -- "$g" > /dev/null 2>&1
1238 };
1239 fi;
1240 fi;
1241 FlagInfoExport
1242}
1243FlagSub ()
1244{
1245 local subres subpat subf subvar sublist;
1246 subvar=$1;
1247 shift;
1248 subres=;
1249 eval sublist=\$$subvar;
1250 for subf in $sublist;
1251 do
1252 for subpat in "$@";
1253 do
1254 [ -n "${subpat:++}" ] || continue;
1255 case $subf in
1256 $subpat)
1257 subf=;
1258 break
1259 ;;
1260 esac;
1261 done;
1262 [ -z "${subf:++}" ] || subres=$subres${subres:+\ }$subf;
1263 done;
1264 eval $subvar=\$subres
1265}
1266FlagSubAllFlags ()
1267{
1268 FlagSubCFlags "$@";
1269 FlagSubFFlags "$@";
1270 FlagSub LDFLAGS "$@";
1271 FlagSub OPTLDFLAGS "$@"
1272}
1273FlagSubCFlags ()
1274{
1275 FlagSub CFLAGS "$@";
1276 FlagSub CXXFLAGS "$@";
1277 FlagSub CPPFLAGS "$@";
1278 FlagSub OPTCFLAGS "$@";
1279 FlagSub OPTCXXFLAGS "$@";
1280 FlagSub OPTCPPFLAGS "$@"
1281}
1282FlagSubFFlags ()
1283{
1284 FlagSub FFLAGS "$@";
1285 FlagSub FCFLAGS "$@";
1286 FlagSub F77FLAGS "$@"
1287}
1288LTOPatch ()
1289{
1290 if [[ -d $S ]]; then
1291 cd "${S}";
1292 else
1293 if ___eapi_has_S_WORKDIR_fallback; then
1294 cd "${WORKDIR}";
1295 else
1296 if [[ -z ${A} ]] && ! __has_phase_defined_up_to prepare; then
1297 cd "${WORKDIR}";
1298 else
1299 die "The source directory '${S}' doesn't exist";
1300 fi;
1301 fi;
1302 fi;
1303 local tagfile=${T}/.portage_lto_patches_applied;
1304 [[ -f ${tagfile} ]] && return;
1305 >> "${tagfile}";
1306 local lto_overlay_dir="$(portageq get_repo_path ${PORTAGE_CONFIGROOT} lto-overlay)";
1307 local basedir="${lto_overlay_dir%/}/sys-config/ltoize/files/patches";
1308 local applied d f;
1309 local -A _eapply_lto_patches;
1310 local prev_shopt=$(shopt -p nullglob);
1311 shopt -s nullglob;
1312 for d in "${basedir}"/${CATEGORY}/{${P}-${PR},${P},${PN}}{:${SLOT%/*},};
1313 do
1314 for f in "${d}"/*;
1315 do
1316 if [[ ( ${f} == *.diff || ${f} == *.patch ) && -z ${_eapply_lto_patches[${f##*/}]} ]]; then
1317 _eapply_lto_patches[${f##*/}]=${f};
1318 fi;
1319 done;
1320 done;
1321 local lto_patch_cmd;
1322 if [[ "${EAPI}" -ge 6 ]]; then
1323 lto_patch_cmd=eapply;
1324 else
1325 lto_patch_cmd=epatch;
1326 fi;
1327 if [[ ${#_eapply_lto_patches[@]} -gt 0 ]]; then
1328 while read -r -d '' f; do
1329 f=${_eapply_lto_patches[${f}]};
1330 if [[ -s ${f} ]]; then
1331 ${lto_patch_cmd} "${f}";
1332 applied=1;
1333 fi;
1334 done < <(printf -- '%s\0' "${!_eapply_lto_patches[@]}" |
1335 LC_ALL=C sort -z);
1336 fi;
1337 ${prev_shopt};
1338 [[ -n ${applied} ]] && ewarn "lto-overlay: LTO patches applied."
1339}
1340LocalePurge ()
1341{
1342 if BashrcdTrue $NOLOCALEPURGE || {
1343 ! BashrcdTrue $LOCALEPURGE && ! BashrcdTrue $MANPURGE
1344 } || [ -z "${KEEP_LOCALES++}" ]; then
1345 return 0;
1346 fi;
1347 case $- in
1348 *f*)
1349 LocalePurgeMain
1350 ;;
1351 *)
1352 set -f;
1353 LocalePurgeMain;
1354 set +f
1355 ;;
1356 esac
1357}
1358LocalePurgeMain ()
1359{
1360 local locale_list locale_item locale_cmd;
1361 locale_list=;
1362 for locale_item in $ALL_LOCALES ${ALL_LOCALES_ADD-};
1363 do
1364 [ -n "$locale_item" ] && LocalePurgeNokeep "$locale_item" && locale_list=$locale_list' '$locale_item;
1365 done;
1366 locale_cmd='for d
1367do for l in $locale_list
1368do if test -d "$d/$l$k"
1369then rm -rvf -- "$d/$l"
1370fi
1371done
1372done';
1373 export locale_list;
1374 shell=`command -v sh` || shell=;
1375 : ${shell:=/bin/sh};
1376 if BashrcdTrue $LOCALEPURGE; then
1377 einfo 'removing undesired locales';
1378 find "$ED" -name locale -type d -exec "$shell" -c "k='/LC_MESSAGES'
1379$locale_cmd" sh '{}' '+';
1380 fi;
1381 if BashrcdTrue $MANPURGE; then
1382 einfo 'removing undesired manpages';
1383 find "$ED" -name man -type d -exec "$shell" -c "k=
1384$locale_cmd" sh '{}' '+';
1385 fi;
1386 unset locale_list
1387}
1388LocalePurgeNokeep ()
1389{
1390 local locale_keep;
1391 for locale_keep in $KEEP_LOCALES;
1392 do
1393 case $1 in
1394 $locale_keep)
1395 return 1
1396 ;;
1397 esac;
1398 done
1399}
1400QlopSetup ()
1401{
1402 local num sec hour min date;
1403 ! BashrcdTrue "${NOQLOP-}" && command -v qlop > /dev/null 2>&1 || return 0;
1404 qlop -amH -- "$CATEGORY/$PN";
1405 qlop -tmH -- "$CATEGORY/$PN";
1406 command -v title > /dev/null 2>&1 || return 0;
1407 num=$(tail -n1 /var/log/emerge.log | sed -e 's/^.*(\([0-9]*\) of \([0-9]*\)).*$/\1|\2/') && [ -n "$num" ] || {
1408 date=$(date +%T);
1409 title "emerge $date $PN";
1410 return
1411 };
1412 case ${QLOPCOUNT:-1} in
1413 *[!0123456789]*)
1414 sec=$(qlop -ACMm -- "$CATEGORY/$PN" | awk '/[[:space:]][0123456789]+$/{a=$NF}
1415END{if(a!=""){print a}}')
1416 ;;
1417 [123456789]*)
1418 sec=$(qlop -tCMm -- "$CATEGORY/$PN" | awk -v 'i=0' -v 'm=0' -v "n=${QLOPCOUNT:-3}" '/[[:space:]][0123456789]+$/{a[i++]=$NF;if(i>m){m=i};if(i>=n){i=0}}
1419END{s=0;for(i=m;i>0;){s+=a[--i]};if(m>0){print int(s/m+1/2)}}')
1420 ;;
1421 *)
1422 false
1423 ;;
1424 esac && [ -n "$sec" ] || {
1425 date=$(date +%T);
1426 title "emerge $date $num $PN";
1427 return
1428 };
1429 hour=$(( $sec / 3600 ));
1430 [ "$hour" -gt 0 ] || hour=;
1431 hour=$hour${hour:+:};
1432 sec=$(( $sec % 3600 ));
1433 min=$(( $sec / 60 ));
1434 sec=$(( $sec % 60 ));
1435 [ "$min" -gt 9 ] || min=0$min;
1436 [ "$sec" -gt 9 ] || sec=0$sec;
1437 date=$(date +%T);
1438 title "emerge $date $num $PN $hour$min:$sec"
1439}
1440Remove_la ()
1441{
1442 BashrcdTrue $NOLAFILEREMOVE && return;
1443 case "$CATEGORY/$PN" in
1444 'media-libs/gst-plugins-base' | 'media-libs/libsidplay')
1445 return 0
1446 ;;
1447 esac;
1448 einfo 'removing unneeded *.la files';
1449 local shell;
1450 shell=`command -v sh` || shell=;
1451 : ${shell:=/bin/sh};
1452 Dexport=$ED find "$ED" -name '*.la' '!' -name 'libltdl.la' -exec "$shell" -c "for i
1453 do if grep -q -- '^shouldnotlink=no\$' \"\$i\"
1454 then printf '\\t%s\\n' \"\${i#\$Dexport}\"
1455 rm -- \"\$i\" || echo 'removing failed!'
1456 fi
1457 done" sh '{}' '+'
1458}
1459__eapi6_src_install ()
1460{
1461 if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then
1462 emake DESTDIR="${D}" install;
1463 fi;
1464 einstalldocs
1465}
1466__eapi6_src_prepare ()
1467{
1468 if ___is_indexed_array_var PATCHES; then
1469 [[ ${#PATCHES[@]} -gt 0 ]] && eapply "${PATCHES[@]}";
1470 else
1471 if [[ -n ${PATCHES} ]]; then
1472 eapply ${PATCHES};
1473 fi;
1474 fi;
1475 eapply_user
1476}
1477__eapi7_ver_compare ()
1478{
1479 local va=${1} vb=${2} a an al as ar b bn bl bs br re LC_ALL=C;
1480 re="^([0-9]+(\.[0-9]+)*)([a-z]?)((_(alpha|beta|pre|rc|p)[0-9]*)*)(-r[0-9]+)?$";
1481 [[ ${va} =~ ${re} ]] || die "${FUNCNAME}: invalid version: ${va}";
1482 an=${BASH_REMATCH[1]};
1483 al=${BASH_REMATCH[3]};
1484 as=${BASH_REMATCH[4]};
1485 ar=${BASH_REMATCH[7]};
1486 [[ ${vb} =~ ${re} ]] || die "${FUNCNAME}: invalid version: ${vb}";
1487 bn=${BASH_REMATCH[1]};
1488 bl=${BASH_REMATCH[3]};
1489 bs=${BASH_REMATCH[4]};
1490 br=${BASH_REMATCH[7]};
1491 __eapi7_ver_compare_int "${an%%.*}" "${bn%%.*}" || return;
1492 while [[ ${an} == *.* && ${bn} == *.* ]]; do
1493 an=${an#*.};
1494 bn=${bn#*.};
1495 a=${an%%.*};
1496 b=${bn%%.*};
1497 if [[ ${a} == 0* || ${b} == 0* ]]; then
1498 [[ ${a} =~ 0+$ ]] && a=${a%"${BASH_REMATCH[0]}"};
1499 [[ ${b} =~ 0+$ ]] && b=${b%"${BASH_REMATCH[0]}"};
1500 [[ ${a} > ${b} ]] && return 3;
1501 [[ ${a} < ${b} ]] && return 1;
1502 else
1503 __eapi7_ver_compare_int "${a}" "${b}" || return;
1504 fi;
1505 done;
1506 [[ ${an} == *.* ]] && return 3;
1507 [[ ${bn} == *.* ]] && return 1;
1508 [[ ${al} > ${bl} ]] && return 3;
1509 [[ ${al} < ${bl} ]] && return 1;
1510 as=${as#_}${as:+_};
1511 bs=${bs#_}${bs:+_};
1512 while [[ -n ${as} && -n ${bs} ]]; do
1513 a=${as%%_*};
1514 b=${bs%%_*};
1515 if [[ ${a%%[0-9]*} == "${b%%[0-9]*}" ]]; then
1516 __eapi7_ver_compare_int "${a##*[a-z]}" "${b##*[a-z]}" || return;
1517 else
1518 [[ ${a%%[0-9]*} == p ]] && return 3;
1519 [[ ${b%%[0-9]*} == p ]] && return 1;
1520 [[ ${a} > ${b} ]] && return 3 || return 1;
1521 fi;
1522 as=${as#*_};
1523 bs=${bs#*_};
1524 done;
1525 if [[ -n ${as} ]]; then
1526 [[ ${as} == p[_0-9]* ]] && return 3 || return 1;
1527 else
1528 if [[ -n ${bs} ]]; then
1529 [[ ${bs} == p[_0-9]* ]] && return 1 || return 3;
1530 fi;
1531 fi;
1532 __eapi7_ver_compare_int "${ar#-r}" "${br#-r}" || return;
1533 return 2
1534}
1535__eapi7_ver_compare_int ()
1536{
1537 local a=$1 b=$2 d=$(( ${#1}-${#2} ));
1538 if [[ ${d} -gt 0 ]]; then
1539 printf -v b "%0${d}d%s" 0 "${b}";
1540 else
1541 if [[ ${d} -lt 0 ]]; then
1542 printf -v a "%0$(( -d ))d%s" 0 "${a}";
1543 fi;
1544 fi;
1545 [[ ${a} > ${b} ]] && return 3;
1546 [[ ${a} == "${b}" ]]
1547}
1548__eapi7_ver_parse_range ()
1549{
1550 local range=${1};
1551 local max=${2};
1552 [[ ${range} == [0-9]* ]] || die "${FUNCNAME}: range must start with a number";
1553 start=${range%-*};
1554 [[ ${range} == *-* ]] && end=${range#*-} || end=${start};
1555 if [[ -n ${end} ]]; then
1556 [[ ${start} -le ${end} ]] || die "${FUNCNAME}: end of range must be >= start";
1557 [[ ${end} -le ${max} ]] || end=${max};
1558 else
1559 end=${max};
1560 fi
1561}
1562__eapi7_ver_split ()
1563{
1564 local v=${1} LC_ALL=C;
1565 comp=();
1566 local s c;
1567 while [[ -n ${v} ]]; do
1568 s=${v%%[a-zA-Z0-9]*};
1569 v=${v:${#s}};
1570 [[ ${v} == [0-9]* ]] && c=${v%%[^0-9]*} || c=${v%%[^a-zA-Z]*};
1571 v=${v:${#c}};
1572 comp+=("${s}" "${c}");
1573 done
1574}
1575__eapi8_src_prepare ()
1576{
1577 local f;
1578 if ___is_indexed_array_var PATCHES; then
1579 [[ ${#PATCHES[@]} -gt 0 ]] && eapply -- "${PATCHES[@]}";
1580 else
1581 if [[ -n ${PATCHES} ]]; then
1582 eapply -- ${PATCHES};
1583 fi;
1584 fi;
1585 eapply_user
1586}
1587_at_uses_autoheader ()
1588{
1589 _at_uses_pkg A{C,M}_CONFIG_HEADER{S,}
1590}
1591_at_uses_automake ()
1592{
1593 _at_uses_pkg AM_INIT_AUTOMAKE
1594}
1595_at_uses_gettext ()
1596{
1597 _at_uses_pkg AM_GNU_GETTEXT_{,REQUIRE_}VERSION
1598}
1599_at_uses_glibgettext ()
1600{
1601 _at_uses_pkg AM_GLIB_GNU_GETTEXT
1602}
1603_at_uses_gnomedoc ()
1604{
1605 _at_uses_pkg GNOME_DOC_INIT
1606}
1607_at_uses_gtkdoc ()
1608{
1609 _at_uses_pkg GTK_DOC_CHECK
1610}
1611_at_uses_intltool ()
1612{
1613 _at_uses_pkg {AC,IT}_PROG_INTLTOOL
1614}
1615_at_uses_libltdl ()
1616{
1617 _at_uses_pkg LT_CONFIG_LTDL_DIR
1618}
1619_at_uses_libtool ()
1620{
1621 _at_uses_pkg A{C,M}_PROG_LIBTOOL LT_INIT
1622}
1623_at_uses_pkg ()
1624{
1625 if [[ -n $(autotools_check_macro "$@") ]]; then
1626 return 0;
1627 else
1628 local macro args=();
1629 for macro in "$@";
1630 do
1631 args+=(-e "^[[:space:]]*${macro}\>");
1632 done;
1633 egrep -q "${args[@]}" configure.??;
1634 fi
1635}
1636_automake_version ()
1637{
1638 autotools_run_tool --at-output automake --version 2> /dev/null | sed -n -e '1{s:.*(GNU automake) ::p;q}'
1639}
1640_autotools_m4dir_include ()
1641{
1642 local x include_opts flag;
1643 [[ ${WANT_AUTOCONF} == "2.1" ]] && flag="l" || flag="I";
1644 for x in "$@";
1645 do
1646 case ${x} in
1647 -${flag})
1648
1649 ;;
1650 *)
1651 [[ ! -d ${x} ]] && ewarn "${ECLASS}: '${x}' does not exist";
1652 include_opts+=" -${flag} ${x}"
1653 ;;
1654 esac;
1655 done;
1656 echo ${include_opts}
1657}
1658_check-reqs_disk ()
1659{
1660 debug-print-function ${FUNCNAME} "$@";
1661 [[ -z ${2} ]] && die "Usage: ${FUNCNAME} [path] [size]";
1662 local path=${1};
1663 local size=${2};
1664 local space_kbi;
1665 _check-reqs_start_phase ${size} "disk space at \"${path}\"";
1666 space_kbi=$(df -Pk "${1}" 2>/dev/null | awk 'FNR == 2 {print $4}');
1667 if [[ $? == 0 && -n ${space_kbi} ]]; then
1668 if [[ ${space_kbi} -lt $(_check-reqs_get_kibibytes ${size}) ]]; then
1669 eend 1;
1670 _check-reqs_unsatisfied ${size} "disk space at \"${path}\"";
1671 else
1672 eend 0;
1673 fi;
1674 else
1675 eend 1;
1676 ewarn "Couldn't determine disk space, skipping...";
1677 fi
1678}
1679_check-reqs_get_kibibytes ()
1680{
1681 debug-print-function ${FUNCNAME} "$@";
1682 [[ -z ${1} ]] && die "Usage: ${FUNCNAME} [size]";
1683 local unit=${1:(-1)};
1684 local size=${1%[GMT]};
1685 case ${unit} in
1686 M)
1687 echo $((1024 * size))
1688 ;;
1689 G)
1690 echo $((1024 * 1024 * size))
1691 ;;
1692 T)
1693 echo $((1024 * 1024 * 1024 * size))
1694 ;;
1695 *)
1696 die "${FUNCNAME}: Unknown unit: ${unit}"
1697 ;;
1698 esac
1699}
1700_check-reqs_get_number ()
1701{
1702 debug-print-function ${FUNCNAME} "$@";
1703 [[ -z ${1} ]] && die "Usage: ${FUNCNAME} [size]";
1704 local size=${1%[GMT]};
1705 [[ ${size} == ${1} ]] && die "${FUNCNAME}: Missing unit: ${1}";
1706 echo ${size}
1707}
1708_check-reqs_get_unit ()
1709{
1710 debug-print-function ${FUNCNAME} "$@";
1711 [[ -z ${1} ]] && die "Usage: ${FUNCNAME} [size]";
1712 local unit=${1:(-1)};
1713 case ${unit} in
1714 M)
1715 echo "MiB"
1716 ;;
1717 G)
1718 echo "GiB"
1719 ;;
1720 T)
1721 echo "TiB"
1722 ;;
1723 *)
1724 die "${FUNCNAME}: Unknown unit: ${unit}"
1725 ;;
1726 esac
1727}
1728_check-reqs_memory ()
1729{
1730 debug-print-function ${FUNCNAME} "$@";
1731 [[ -z ${1} ]] && die "Usage: ${FUNCNAME} [size]";
1732 local size=${1};
1733 local actual_memory;
1734 local actual_swap;
1735 _check-reqs_start_phase ${size} "RAM";
1736 if [[ -r /proc/meminfo ]]; then
1737 actual_memory=$(awk '/MemTotal/ { print $2 }' /proc/meminfo);
1738 actual_swap=$(awk '/SwapTotal/ { print $2 }' /proc/meminfo);
1739 else
1740 actual_memory=$(sysctl hw.physmem 2>/dev/null);
1741 [[ $? -eq 0 ]] && actual_memory=$(echo "${actual_memory}" | sed -e 's/^[^:=]*[:=][[:space:]]*//');
1742 actual_swap=$(sysctl vm.swap_total 2>/dev/null);
1743 [[ $? -eq 0 ]] && actual_swap=$(echo "${actual_swap}" | sed -e 's/^[^:=]*[:=][[:space:]]*//');
1744 fi;
1745 if [[ -n ${actual_memory} ]]; then
1746 if [[ ${actual_memory} -ge $(_check-reqs_get_kibibytes ${size}) ]]; then
1747 eend 0;
1748 else
1749 if [[ -n ${actual_swap} && $((${actual_memory} + ${actual_swap})) -ge $(_check-reqs_get_kibibytes ${size}) ]]; then
1750 ewarn "Amount of main memory is insufficient, but amount";
1751 ewarn "of main memory combined with swap is sufficient.";
1752 ewarn "Build process may make computer very slow!";
1753 eend 0;
1754 else
1755 eend 1;
1756 _check-reqs_unsatisfied ${size} "RAM";
1757 fi;
1758 fi;
1759 else
1760 eend 1;
1761 ewarn "Couldn't determine amount of memory, skipping...";
1762 fi
1763}
1764_check-reqs_output ()
1765{
1766 debug-print-function ${FUNCNAME} "$@";
1767 local msg="ewarn";
1768 [[ ${EBUILD_PHASE} == "pretend" && -z ${CHECKREQS_DONOTHING} ]] && msg="eerror";
1769 if [[ -n ${CHECKREQS_FAILED} ]]; then
1770 ${msg};
1771 ${msg} "Space constraints set in the ebuild were not met!";
1772 ${msg} "The build will most probably fail, you should enhance the space";
1773 ${msg} "as per failed tests.";
1774 ${msg};
1775 [[ ${EBUILD_PHASE} == "pretend" && -z ${CHECKREQS_DONOTHING} ]] && die "Build requirements not met!";
1776 fi
1777}
1778_check-reqs_prepare ()
1779{
1780 debug-print-function ${FUNCNAME} "$@";
1781 if [[ -z ${CHECKREQS_MEMORY} && -z ${CHECKREQS_DISK_BUILD} && -z ${CHECKREQS_DISK_USR} && -z ${CHECKREQS_DISK_VAR} ]]; then
1782 eerror "Set some check-reqs eclass variables if you want to use it.";
1783 eerror "If you are user and see this message file a bug against the package.";
1784 die "${FUNCNAME}: check-reqs eclass called but not actually used!";
1785 fi
1786}
1787_check-reqs_run ()
1788{
1789 debug-print-function ${FUNCNAME} "$@";
1790 unset CHECKREQS_FAILED;
1791 if [[ ${MERGE_TYPE} != binary ]]; then
1792 [[ -n ${CHECKREQS_MEMORY} ]] && _check-reqs_memory ${CHECKREQS_MEMORY};
1793 [[ -n ${CHECKREQS_DISK_BUILD} ]] && _check-reqs_disk "${T}" "${CHECKREQS_DISK_BUILD}";
1794 fi;
1795 if [[ ${MERGE_TYPE} != buildonly ]]; then
1796 [[ -n ${CHECKREQS_DISK_USR} ]] && _check-reqs_disk "${EROOT%/}/usr" "${CHECKREQS_DISK_USR}";
1797 [[ -n ${CHECKREQS_DISK_VAR} ]] && _check-reqs_disk "${EROOT%/}/var" "${CHECKREQS_DISK_VAR}";
1798 fi
1799}
1800_check-reqs_start_phase ()
1801{
1802 debug-print-function ${FUNCNAME} "$@";
1803 [[ -z ${2} ]] && die "Usage: ${FUNCNAME} [size] [location]";
1804 local size=${1};
1805 local location=${2};
1806 local sizeunit="$(_check-reqs_get_number ${size}) $(_check-reqs_get_unit ${size})";
1807 ebegin "Checking for at least ${sizeunit} ${location}"
1808}
1809_check-reqs_unsatisfied ()
1810{
1811 debug-print-function ${FUNCNAME} "$@";
1812 [[ -z ${2} ]] && die "Usage: ${FUNCNAME} [size] [location]";
1813 local msg="ewarn";
1814 local size=${1};
1815 local location=${2};
1816 local sizeunit="$(_check-reqs_get_number ${size}) $(_check-reqs_get_unit ${size})";
1817 [[ ${EBUILD_PHASE} == "pretend" && -z ${CHECKREQS_DONOTHING} ]] && msg="eerror";
1818 ${msg} "There is NOT at least ${sizeunit} ${location}";
1819 CHECKREQS_FAILED="true"
1820}
1821_clang_fullversion ()
1822{
1823 local ver="$1";
1824 shift;
1825 set -- $($(tc-getCPP "$@") -E -P - <<<"__clang_major__ __clang_minor__ __clang_patchlevel__");
1826 eval echo "$ver"
1827}
1828_eapply_patch ()
1829{
1830 local f=${1};
1831 local prefix=${2};
1832 ebegin "${prefix:-Applying }${f##*/}";
1833 local all_opts=(-p1 -f -g0 --no-backup-if-mismatch "${patch_options[@]}");
1834 if ${patch_cmd} "${all_opts[@]}" --dry-run -s -F0 < "${f}" &> /dev/null; then
1835 all_opts+=(-s -F0);
1836 fi;
1837 ${patch_cmd} "${all_opts[@]}" < "${f}";
1838 failed=${?};
1839 if ! eend "${failed}"; then
1840 __helpers_die "patch -p1 ${patch_options[*]} failed with ${f}";
1841 fi
1842}
1843_elibtoolize ()
1844{
1845 local LIBTOOLIZE=${LIBTOOLIZE:-$(type -P glibtoolize > /dev/null && echo glibtoolize || echo libtoolize)};
1846 if [[ ${1} == "--auto-ltdl" ]]; then
1847 shift;
1848 _at_uses_libltdl && set -- "$@" --ltdl;
1849 fi;
1850 [[ -f GNUmakefile.am || -f Makefile.am ]] && set -- "$@" --automake;
1851 autotools_run_tool ${LIBTOOLIZE} "$@"
1852}
1853_gcc-install-dir ()
1854{
1855 echo "$(LC_ALL=C $(tc-getCC) -print-search-dirs 2> /dev/null | awk '$1=="install:" {print $2}')"
1856}
1857_gcc-specs-directive_raw ()
1858{
1859 local cc=$(tc-getCC);
1860 local specfiles=$(LC_ALL=C ${cc} -v 2>&1 | awk '$1=="Reading" {print $NF}');
1861 ${cc} -dumpspecs 2> /dev/null | cat - ${specfiles} | awk -v directive=$1 'BEGIN { pspec=""; spec=""; outside=1 }
1862$1=="*"directive":" { pspec=spec; spec=""; outside=0; next }
1863 outside || NF==0 || ( substr($1,1,1)=="*" && substr($1,length($1),1)==":" ) { outside=1; next }
1864 spec=="" && substr($0,1,1)=="+" { spec=pspec " " substr($0,2); next }
1865 { spec=spec $0 }
1866END { print spec }';
1867 return 0
1868}
1869_gcc-specs-exists ()
1870{
1871 [[ -f $(_gcc-install-dir)/$1 ]]
1872}
1873_gcc_fullversion ()
1874{
1875 local ver="$1";
1876 shift;
1877 set -- $($(tc-getCPP "$@") -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__");
1878 eval echo "$ver"
1879}
1880_multibuild_create_source_copy ()
1881{
1882 einfo "${MULTIBUILD_VARIANT}: copying to ${BUILD_DIR}";
1883 cp -p -R "${cp_args[@]}" "${_MULTIBUILD_INITIAL_BUILD_DIR}" "${BUILD_DIR}" || die
1884}
1885_multibuild_run ()
1886{
1887 local i=1;
1888 while [[ ${!i} == _* ]]; do
1889 (( i += 1 ));
1890 done;
1891 [[ ${i} -le ${#} ]] && einfo "${v}: running ${@:${i}}";
1892 "${@}"
1893}
1894_multilib_multibuild_wrapper ()
1895{
1896 debug-print-function ${FUNCNAME} "${@}";
1897 local ABI=${MULTIBUILD_VARIANT#*.};
1898 local -r MULTILIB_ABI_FLAG=${MULTIBUILD_VARIANT%.*};
1899 multilib_toolchain_setup "${ABI}";
1900 readonly ABI;
1901 "${@}"
1902}
1903_pax_list_files ()
1904{
1905 local f cmd;
1906 cmd=$1;
1907 shift;
1908 for f in "$@";
1909 do
1910 ${cmd} " ${f}";
1911 done
1912}
1913_tc-getPROG ()
1914{
1915 local tuple=$1;
1916 local v var vars=$2;
1917 local prog=($3);
1918 var=${vars%% *};
1919 for v in ${vars};
1920 do
1921 if [[ -n ${!v} ]]; then
1922 export ${var}="${!v}";
1923 echo "${!v}";
1924 return 0;
1925 fi;
1926 done;
1927 local search=;
1928 [[ -n $4 ]] && search=$(type -p $4-${prog[0]});
1929 [[ -z ${search} && -n ${!tuple} ]] && search=$(type -p ${!tuple}-${prog[0]});
1930 [[ -n ${search} ]] && prog[0]=${search##*/};
1931 export ${var}="${prog[*]}";
1932 echo "${!var}"
1933}
1934autotools_check_macro ()
1935{
1936 [[ -f configure.ac || -f configure.in ]] || return 0;
1937 local trace_file=".__autoconf_trace_data";
1938 if [[ ! -e ${trace_file} ]] || [[ ! aclocal.m4 -ot ${trace_file} ]]; then
1939 WANT_AUTOCONF="2.5" autoconf $(autotools_m4dir_include) ${ALL_AUTOTOOLS_MACROS[@]/#/--trace=} > ${trace_file} 2> /dev/null;
1940 fi;
1941 local macro args=();
1942 for macro in "$@";
1943 do
1944 has ${macro} ${ALL_AUTOTOOLS_MACROS[@]} || die "internal error: add ${macro} to ALL_AUTOTOOLS_MACROS";
1945 args+=(-e ":${macro}:");
1946 done;
1947 grep "${args[@]}" ${trace_file}
1948}
1949autotools_check_macro_val ()
1950{
1951 local macro scan_out;
1952 for macro in "$@";
1953 do
1954 autotools_check_macro "${macro}" | gawk -v macro="${macro}" '($0 !~ /^[[:space:]]*(#|dnl)/) {
1955 if (match($0, macro ":(.*)$", res))
1956 print res[1]
1957 }' | uniq;
1958 done;
1959 return 0
1960}
1961autotools_env_setup ()
1962{
1963 if [[ ${WANT_AUTOMAKE} == "latest" ]]; then
1964 local pv;
1965 for pv in ${_LATEST_AUTOMAKE[@]/#*:};
1966 do
1967 local hv_args="";
1968 case ${EAPI} in
1969 5 | 6)
1970 hv_args="--host-root"
1971 ;;
1972 7)
1973 hv_args="-b"
1974 ;;
1975 esac;
1976 ROOT=/ has_version ${hv_args} "=sys-devel/automake-${pv}*" && export WANT_AUTOMAKE="${pv}" && break;
1977 done;
1978 [[ ${WANT_AUTOMAKE} == "latest" ]] && die "Cannot find the latest automake! Tried ${_LATEST_AUTOMAKE[*]}";
1979 fi;
1980 [[ ${WANT_AUTOCONF} == "latest" ]] && export WANT_AUTOCONF=2.5
1981}
1982autotools_m4dir_include ()
1983{
1984 _autotools_m4dir_include ${AT_M4DIR}
1985}
1986autotools_m4sysdir_include ()
1987{
1988 local paths=($(eval echo ${AT_SYS_M4DIR}));
1989 if [[ ${#paths[@]} -eq 0 && -n ${SYSROOT} ]]; then
1990 local path="${SYSROOT}/usr/share/aclocal";
1991 [[ -d ${path} ]] && paths+=("${path}");
1992 fi;
1993 _autotools_m4dir_include "${paths[@]}"
1994}
1995autotools_run_tool ()
1996{
1997 local autofail=true m4flags=false missing_ok=false return_output=false;
1998 while [[ -n ${1} ]]; do
1999 case ${1} in
2000 --at-no-fail)
2001 autofail=false
2002 ;;
2003 --at-m4flags)
2004 m4flags=true
2005 ;;
2006 --at-missing)
2007 missing_ok=true
2008 ;;
2009 --at-output)
2010 return_output=true
2011 ;;
2012 *)
2013 break
2014 ;;
2015 esac;
2016 shift;
2017 done;
2018 if [[ ${EBUILD_PHASE_FUNC} != "src_unpack" && ${EBUILD_PHASE_FUNC} != "src_prepare" ]]; then
2019 eqawarn "Running '${1}' in ${EBUILD_PHASE_FUNC} phase";
2020 fi;
2021 if ${missing_ok} && ! type -P ${1} > /dev/null; then
2022 einfo "Skipping '$*' because '${1}' not installed";
2023 return 0;
2024 fi;
2025 autotools_env_setup;
2026 local STDERR_TARGET="${T}/${1##*/}.out";
2027 if [[ -e ${STDERR_TARGET} ]]; then
2028 local i=1;
2029 while :; do
2030 STDERR_TARGET="${T}/${1##*/}-${i}.out";
2031 [[ -e ${STDERR_TARGET} ]] || break;
2032 : $(( i++ ));
2033 done;
2034 fi;
2035 if ${m4flags}; then
2036 set -- "${1}" $(autotools_m4dir_include) $(autotools_m4sysdir_include) "${@:2}";
2037 fi;
2038 if ${return_output}; then
2039 "$@";
2040 return;
2041 fi;
2042 printf "***** ${1} *****\n***** PWD: ${PWD}\n***** $*\n\n" > "${STDERR_TARGET}";
2043 ebegin "Running '$@'";
2044 "$@" >> "${STDERR_TARGET}" 2>&1;
2045 if ! eend $? && ${autofail}; then
2046 echo;
2047 eerror "Failed running '${1}'!";
2048 eerror;
2049 eerror "Include in your bug report the contents of:";
2050 eerror;
2051 eerror " ${STDERR_TARGET}";
2052 echo;
2053 die "Failed running '${1}'!";
2054 fi
2055}
2056check-reqs_disk ()
2057{
2058 [[ ${EAPI} == [67] ]] || die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}.";
2059 _check-reqs_disk "$@"
2060}
2061check-reqs_get_kibibytes ()
2062{
2063 [[ ${EAPI} == [67] ]] || die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}.";
2064 _check-reqs_get_kibibytes "$@"
2065}
2066check-reqs_get_number ()
2067{
2068 [[ ${EAPI} == [67] ]] || die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}.";
2069 _check-reqs_get_number "$@"
2070}
2071check-reqs_get_unit ()
2072{
2073 [[ ${EAPI} == [67] ]] || die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}.";
2074 _check-reqs_get_unit "$@"
2075}
2076check-reqs_memory ()
2077{
2078 [[ ${EAPI} == [67] ]] || die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}.";
2079 _check-reqs_memory "$@"
2080}
2081check-reqs_output ()
2082{
2083 [[ ${EAPI} == [67] ]] || die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}.";
2084 _check-reqs_get_unit "$@"
2085}
2086check-reqs_pkg_pretend ()
2087{
2088 debug-print-function ${FUNCNAME} "$@";
2089 check-reqs_pkg_setup "$@"
2090}
2091check-reqs_pkg_setup ()
2092{
2093 debug-print-function ${FUNCNAME} "$@";
2094 _check-reqs_prepare;
2095 _check-reqs_run;
2096 _check-reqs_output
2097}
2098check-reqs_prepare ()
2099{
2100 [[ ${EAPI} == [67] ]] || die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}.";
2101 _check-reqs_prepare "$@"
2102}
2103check-reqs_run ()
2104{
2105 [[ ${EAPI} == [67] ]] || die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}.";
2106 _check-reqs_run "$@"
2107}
2108check-reqs_start_phase ()
2109{
2110 [[ ${EAPI} == [67] ]] || die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}.";
2111 _check-reqs_start_phase "$@"
2112}
2113check-reqs_unsatisfied ()
2114{
2115 [[ ${EAPI} == [67] ]] || die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}.";
2116 _check-reqs_unsatisfied "$@"
2117}
2118check_extra_config ()
2119{
2120 use kernel_linux || return;
2121 local config negate die error reworkmodulenames;
2122 local soft_errors_count=0 hard_errors_count=0 config_required=0;
2123 local old_LINUX_CONFIG_EXISTS_DONE="${_LINUX_CONFIG_EXISTS_DONE}";
2124 linux-info_get_any_version;
2125 for config in ${CONFIG_CHECK};
2126 do
2127 if [[ "${config:0:1}" != "~" ]]; then
2128 config_required=1;
2129 break;
2130 fi;
2131 done;
2132 if [[ ${config_required} == 0 ]]; then
2133 if ! linux_config_exists; then
2134 ewarn "Unable to check for the following kernel config options due";
2135 ewarn "to absence of any configured kernel sources or compiled";
2136 ewarn "config:";
2137 for config in ${CONFIG_CHECK};
2138 do
2139 config=${config#\~};
2140 config=${config#\!};
2141 local_error="ERROR_${config}";
2142 msg="${!local_error}";
2143 if [[ -z ${msg} ]]; then
2144 local_error="WARNING_${config}";
2145 msg="${!local_error}";
2146 fi;
2147 ewarn " - ${config}${msg:+ - }${msg}";
2148 done;
2149 ewarn "You're on your own to make sure they are set if needed.";
2150 export LINUX_CONFIG_EXISTS_DONE="${old_LINUX_CONFIG_EXISTS_DONE}";
2151 return 0;
2152 fi;
2153 else
2154 require_configured_kernel;
2155 fi;
2156 einfo "Checking for suitable kernel configuration options...";
2157 for config in ${CONFIG_CHECK};
2158 do
2159 die=1;
2160 error=0;
2161 negate=0;
2162 reworkmodulenames=0;
2163 if [[ ${config:0:1} == "~" ]]; then
2164 die=0;
2165 config=${config:1};
2166 else
2167 if [[ ${config:0:1} == "@" ]]; then
2168 die=0;
2169 reworkmodulenames=1;
2170 config=${config:1};
2171 fi;
2172 fi;
2173 if [[ ${config:0:1} == "!" ]]; then
2174 negate=1;
2175 config=${config:1};
2176 fi;
2177 if [[ ${negate} == 1 ]]; then
2178 linux_chkconfig_present ${config} && error=2;
2179 else
2180 if [[ ${reworkmodulenames} == 1 ]]; then
2181 local temp_config="${config//*:}" i n;
2182 config="${config//:*}";
2183 if linux_chkconfig_present ${config}; then
2184 for i in ${MODULE_NAMES};
2185 do
2186 n="${i//${temp_config}}";
2187 [[ -z ${n//\(*} ]] && MODULE_IGNORE="${MODULE_IGNORE} ${temp_config}";
2188 done;
2189 error=2;
2190 fi;
2191 else
2192 linux_chkconfig_present ${config} || error=1;
2193 fi;
2194 fi;
2195 if [[ ${error} -gt 0 ]]; then
2196 local report_func="eerror" local_error;
2197 local_error="ERROR_${config}";
2198 local_error="${!local_error}";
2199 if [[ -z "${local_error}" ]]; then
2200 local_error="${config}_ERROR";
2201 local_error="${!local_error}";
2202 fi;
2203 if [[ ${die} == 0 && -z "${local_error}" ]]; then
2204 local_error="WARNING_${config}";
2205 local_error="${!local_error}";
2206 if [[ -n "${local_error}" ]]; then
2207 report_func="ewarn";
2208 fi;
2209 fi;
2210 if [[ -z "${local_error}" ]]; then
2211 [[ ${error} == 1 ]] && local_error="is not set when it should be." || local_error="should not be set. But it is.";
2212 local_error="CONFIG_${config}:\t ${local_error}";
2213 fi;
2214 if [[ ${die} == 0 ]]; then
2215 ${report_func} " ${local_error}";
2216 soft_errors_count=$[soft_errors_count + 1];
2217 else
2218 ${report_func} " ${local_error}";
2219 hard_errors_count=$[hard_errors_count + 1];
2220 fi;
2221 fi;
2222 done;
2223 if [[ ${hard_errors_count} -gt 0 ]]; then
2224 eerror "Please check to make sure these options are set correctly.";
2225 eerror "Failure to do so may cause unexpected problems.";
2226 eerror "Once you have satisfied these options, please try merging";
2227 eerror "this package again.";
2228 export LINUX_CONFIG_EXISTS_DONE="${old_LINUX_CONFIG_EXISTS_DONE}";
2229 die "Incorrect kernel configuration options";
2230 else
2231 if [[ ${soft_errors_count} -gt 0 ]]; then
2232 ewarn "Please check to make sure these options are set correctly.";
2233 ewarn "Failure to do so may cause unexpected problems.";
2234 else
2235 eend 0;
2236 fi;
2237 fi;
2238 export LINUX_CONFIG_EXISTS_DONE="${old_LINUX_CONFIG_EXISTS_DONE}"
2239}
2240check_kernel_built ()
2241{
2242 if ! use kernel_linux; then
2243 die "${FUNCNAME}() called on non-Linux system, please fix the ebuild";
2244 fi;
2245 require_configured_kernel;
2246 local versionh_path;
2247 if kernel_is -ge 3 7; then
2248 versionh_path="include/generated/uapi/linux/version.h";
2249 else
2250 versionh_path="include/linux/version.h";
2251 fi;
2252 if [ ! -f "${KV_OUT_DIR}/${versionh_path}" ]; then
2253 eerror "These sources have not yet been prepared.";
2254 eerror "We cannot build against an unprepared tree.";
2255 eerror "To resolve this, please type the following:";
2256 eerror;
2257 eerror "# cd ${KV_DIR}";
2258 eerror "# make oldconfig";
2259 eerror "# make modules_prepare";
2260 eerror;
2261 eerror "Then please try merging this module again.";
2262 die "Kernel sources need compiling first";
2263 fi
2264}
2265check_modules_supported ()
2266{
2267 if ! use kernel_linux; then
2268 die "${FUNCNAME}() called on non-Linux system, please fix the ebuild";
2269 fi;
2270 require_configured_kernel;
2271 if ! linux_chkconfig_builtin "MODULES"; then
2272 eerror "These sources do not support loading external modules.";
2273 eerror "to be able to use this module please enable \"Loadable modules support\"";
2274 eerror "in your kernel, recompile and then try merging this module again.";
2275 die "No support for external modules in ${KV_FULL} config";
2276 fi
2277}
2278check_zlibinflate ()
2279{
2280 if ! use kernel_linux; then
2281 die "${FUNCNAME}() called on non-Linux system, please fix the ebuild";
2282 fi;
2283 require_configured_kernel;
2284 local INFLATE;
2285 local DEFLATE;
2286 einfo "Determining the usability of ZLIB_INFLATE support in your kernel";
2287 ebegin "checking ZLIB_INFLATE";
2288 linux_chkconfig_builtin CONFIG_ZLIB_INFLATE;
2289 eend $? || die;
2290 ebegin "checking ZLIB_DEFLATE";
2291 linux_chkconfig_builtin CONFIG_ZLIB_DEFLATE;
2292 eend $? || die;
2293 local LINENO_START;
2294 local LINENO_END;
2295 local SYMBOLS;
2296 local x;
2297 LINENO_END="$(grep -n 'CONFIG_ZLIB_INFLATE y' ${KV_DIR}/lib/Config.in | cut -d : -f 1)";
2298 LINENO_START="$(head -n $LINENO_END ${KV_DIR}/lib/Config.in | grep -n 'if \[' | tail -n 1 | cut -d : -f 1)";
2299 (( LINENO_AMOUNT = $LINENO_END - $LINENO_START ));
2300 (( LINENO_END = $LINENO_END - 1 ));
2301 SYMBOLS="$(head -n $LINENO_END ${KV_DIR}/lib/Config.in | tail -n $LINENO_AMOUNT | sed -e 's/^.*\(CONFIG_[^\" ]*\).*/\1/g;')";
2302 for x in $SYMBOLS;
2303 do
2304 if [ "${!x}" = "y" ]; then
2305 einfo "${x} ensures zlib is linked into your kernel - excellent";
2306 return 0;
2307 fi;
2308 done;
2309 eerror;
2310 eerror "This kernel module requires ZLIB library support.";
2311 eerror "You have enabled zlib support in your kernel, but haven't enabled";
2312 eerror "enabled any option that will ensure that zlib is linked into your";
2313 eerror "kernel.";
2314 eerror;
2315 eerror "Please ensure that you enable at least one of these options:";
2316 eerror;
2317 for x in $SYMBOLS;
2318 do
2319 eerror " * $x";
2320 done;
2321 eerror;
2322 eerror "Please remember to recompile and install your kernel, and reboot";
2323 eerror "into your new kernel before attempting to load this kernel module.";
2324 die "Kernel doesn't include zlib support"
2325}
2326clang-fullversion ()
2327{
2328 _clang_fullversion '$1.$2.$3' "$@"
2329}
2330clang-major-version ()
2331{
2332 _clang_fullversion '$1' "$@"
2333}
2334clang-micro-version ()
2335{
2336 _clang_fullversion '$3' "$@"
2337}
2338clang-minor-version ()
2339{
2340 _clang_fullversion '$2' "$@"
2341}
2342clang-version ()
2343{
2344 _clang_fullversion '$1.$2' "$@"
2345}
2346config_rpath_update ()
2347{
2348 local dst src;
2349 case ${EAPI} in
2350 5 | 6)
2351 src="${EPREFIX}/usr/share/gettext/config.rpath"
2352 ;;
2353 *)
2354 src="${BROOT}/usr/share/gettext/config.rpath"
2355 ;;
2356 esac;
2357 [[ $# -eq 0 ]] && set -- $(find -name config.rpath);
2358 [[ $# -eq 0 ]] && return 0;
2359 einfo "Updating all config.rpath files";
2360 for dst in "$@";
2361 do
2362 einfo " ${dst}";
2363 cp "${src}" "${dst}" || die;
2364 done
2365}
2366eaclocal ()
2367{
2368 [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && autotools_run_tool --at-m4flags aclocal "$@" $(eaclocal_amflags)
2369}
2370eaclocal_amflags ()
2371{
2372 local aclocal_opts amflags_file;
2373 for amflags_file in GNUmakefile.am Makefile.am GNUmakefile.in Makefile.in;
2374 do
2375 [[ -e ${amflags_file} ]] || continue;
2376 autotools_env_setup;
2377 aclocal_opts=$(sed -n "/^ACLOCAL_AMFLAGS[[:space:]]*=/{ # match the first line
2378 s:[^=]*=::p; # then gobble up all escaped lines
2379 : nextline /\\\\$/{ n; p; b nextline; } }" ${amflags_file});
2380 eval aclocal_opts=\""${aclocal_opts}"\";
2381 break;
2382 done;
2383 echo ${aclocal_opts}
2384}
2385eapply ()
2386{
2387 local failed patch_cmd=patch;
2388 local -x LC_COLLATE=POSIX;
2389 type -P gpatch > /dev/null && patch_cmd=gpatch;
2390 function _eapply_patch ()
2391 {
2392 local f=${1};
2393 local prefix=${2};
2394 ebegin "${prefix:-Applying }${f##*/}";
2395 local all_opts=(-p1 -f -g0 --no-backup-if-mismatch "${patch_options[@]}");
2396 if ${patch_cmd} "${all_opts[@]}" --dry-run -s -F0 < "${f}" &> /dev/null; then
2397 all_opts+=(-s -F0);
2398 fi;
2399 ${patch_cmd} "${all_opts[@]}" < "${f}";
2400 failed=${?};
2401 if ! eend "${failed}"; then
2402 __helpers_die "patch -p1 ${patch_options[*]} failed with ${f}";
2403 fi
2404 };
2405 local patch_options=() files=();
2406 local i found_doublehyphen;
2407 for ((i = 1; i <= ${#@}; ++i ))
2408 do
2409 if [[ ${@:i:1} == -- ]]; then
2410 patch_options=("${@:1:i-1}");
2411 files=("${@:i+1}");
2412 found_doublehyphen=1;
2413 break;
2414 fi;
2415 done;
2416 if [[ -z ${found_doublehyphen} ]]; then
2417 for ((i = 1; i <= ${#@}; ++i ))
2418 do
2419 if [[ ${@:i:1} != -* ]]; then
2420 patch_options=("${@:1:i-1}");
2421 files=("${@:i}");
2422 break;
2423 fi;
2424 done;
2425 for i in "${files[@]}";
2426 do
2427 if [[ ${i} == -* ]]; then
2428 die "eapply: all options must be passed before non-options";
2429 fi;
2430 done;
2431 fi;
2432 if [[ ${#files[@]} -eq 0 ]]; then
2433 die "eapply: no files specified";
2434 fi;
2435 local f;
2436 for f in "${files[@]}";
2437 do
2438 if [[ -d ${f} ]]; then
2439 function _eapply_get_files ()
2440 {
2441 local LC_ALL=POSIX;
2442 local prev_shopt=$(shopt -p nullglob);
2443 shopt -s nullglob;
2444 local f;
2445 for f in "${1}"/*;
2446 do
2447 if [[ ${f} == *.diff || ${f} == *.patch ]]; then
2448 files+=("${f}");
2449 fi;
2450 done;
2451 ${prev_shopt}
2452 };
2453 local files=();
2454 _eapply_get_files "${f}";
2455 [[ ${#files[@]} -eq 0 ]] && die "No *.{patch,diff} files in directory ${f}";
2456 einfo "Applying patches from ${f} ...";
2457 local f2;
2458 for f2 in "${files[@]}";
2459 do
2460 _eapply_patch "${f2}" ' ';
2461 [[ ${failed} -ne 0 ]] && return "${failed}";
2462 done;
2463 else
2464 _eapply_patch "${f}";
2465 [[ ${failed} -ne 0 ]] && return "${failed}";
2466 fi;
2467 done;
2468 return 0
2469}
2470eapply_user ()
2471{
2472 [[ ${EBUILD_PHASE} == prepare ]] || die "eapply_user() called during invalid phase: ${EBUILD_PHASE}";
2473 local tagfile=${T}/.portage_user_patches_applied;
2474 [[ -f ${tagfile} ]] && return;
2475 >> "${tagfile}";
2476 local basedir=${PORTAGE_CONFIGROOT%/}/etc/portage/patches;
2477 local applied d f;
2478 local -A _eapply_user_patches;
2479 local prev_shopt=$(shopt -p nullglob);
2480 shopt -s nullglob;
2481 for d in "${basedir}"/${CATEGORY}/{${P}-${PR},${P},${PN}}{:${SLOT%/*},};
2482 do
2483 for f in "${d}"/*;
2484 do
2485 if [[ ( ${f} == *.diff || ${f} == *.patch ) && -z ${_eapply_user_patches[${f##*/}]} ]]; then
2486 _eapply_user_patches[${f##*/}]=${f};
2487 fi;
2488 done;
2489 done;
2490 if [[ ${#_eapply_user_patches[@]} -gt 0 ]]; then
2491 while read -r -d '' f; do
2492 f=${_eapply_user_patches[${f}]};
2493 if [[ -s ${f} ]]; then
2494 eapply "${f}";
2495 applied=1;
2496 fi;
2497 done < <(printf -- '%s\0' "${!_eapply_user_patches[@]}" |
2498 LC_ALL=C sort -z);
2499 fi;
2500 ${prev_shopt};
2501 [[ -n ${applied} ]] && ewarn "User patches applied."
2502}
2503eautoconf ()
2504{
2505 if [[ ! -f configure.ac && ! -f configure.in ]]; then
2506 echo;
2507 eerror "No configure.{ac,in} present in '${PWD}'!";
2508 echo;
2509 die "No configure.{ac,in} present!";
2510 fi;
2511 if [[ ${WANT_AUTOCONF} != "2.1" && -e configure.in ]]; then
2512 case ${EAPI:-0} in
2513 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7)
2514 eqawarn "This package has a configure.in file which has long been deprecated. Please";
2515 eqawarn "update it to use configure.ac instead as newer versions of autotools will die";
2516 eqawarn "when it finds this file. See https://bugs.gentoo.org/426262 for details."
2517 ;;
2518 *)
2519 eqawarn "Moving configure.in to configure.ac (bug #426262)";
2520 mv configure.{in,ac} || die
2521 ;;
2522 esac;
2523 fi;
2524 local _gnuconfig=$(gnuconfig_findnewest);
2525 cp "${_gnuconfig}"/config.{guess,sub} . || die;
2526 autotools_run_tool --at-m4flags autoconf "$@"
2527}
2528eautoheader ()
2529{
2530 _at_uses_autoheader || return 0;
2531 autotools_run_tool --at-no-fail --at-m4flags autoheader "$@"
2532}
2533eautomake ()
2534{
2535 local extra_opts=();
2536 local makefile_name;
2537 for makefile_name in {GNUmakefile,{M,m}akefile}.am "";
2538 do
2539 [[ -f ${makefile_name} ]] && break;
2540 done;
2541 function _automake_version ()
2542 {
2543 autotools_run_tool --at-output automake --version 2> /dev/null | sed -n -e '1{s:.*(GNU automake) ::p;q}'
2544 };
2545 if [[ -z ${makefile_name} ]]; then
2546 _at_uses_automake || return 0;
2547 else
2548 if [[ -z ${FROM_EAUTORECONF} && -f ${makefile_name%.am}.in ]]; then
2549 local used_automake;
2550 local installed_automake;
2551 installed_automake=$(WANT_AUTOMAKE= _automake_version);
2552 used_automake=$(head -n 1 < ${makefile_name%.am}.in | sed -e 's:.*by automake \(.*\) from .*:\1:');
2553 if [[ ${installed_automake} != ${used_automake} ]]; then
2554 ewarn "Automake used for the package (${used_automake}) differs from" "the installed version (${installed_automake}).";
2555 ewarn "Forcing a full rebuild of the autotools to workaround.";
2556 eautoreconf;
2557 return 0;
2558 fi;
2559 fi;
2560 fi;
2561 [[ -f INSTALL && -f AUTHORS && -f ChangeLog && -f NEWS && -f README ]] || extra_opts+=(--foreign);
2562 case $(_automake_version) in
2563 1.4 | 1.4[.-]*)
2564
2565 ;;
2566 *)
2567 extra_opts+=(--force-missing)
2568 ;;
2569 esac;
2570 autotools_run_tool automake --add-missing --copy "${extra_opts[@]}" "$@"
2571}
2572eautopoint ()
2573{
2574 autotools_run_tool autopoint "$@"
2575}
2576eautoreconf ()
2577{
2578 local x g;
2579 if [[ -z ${AT_NO_RECURSIVE} ]]; then
2580 for x in $(autotools_check_macro_val AC_CONFIG_SUBDIRS);
2581 do
2582 if [[ -d ${x} ]]; then
2583 pushd "${x}" > /dev/null;
2584 AT_NOELIBTOOLIZE="yes" eautoreconf || die;
2585 popd > /dev/null;
2586 fi;
2587 done;
2588 fi;
2589 einfo "Running eautoreconf in '${PWD}' ...";
2590 local m4dirs=$(autotools_check_macro_val AC_CONFIG_{AUX,MACRO}_DIR);
2591 [[ -n ${m4dirs} ]] && mkdir -p ${m4dirs};
2592 local i tools=(glibgettext false "autotools_run_tool glib-gettextize --copy --force" gettext false "autotools_run_tool --at-missing autopoint --force" intltool false "autotools_run_tool intltoolize --automake --copy --force" gtkdoc false "autotools_run_tool --at-missing gtkdocize --copy" gnomedoc false "autotools_run_tool --at-missing gnome-doc-prepare --copy --force" libtool false "_elibtoolize --auto-ltdl --install --copy --force");
2593 for ((i = 0; i < ${#tools[@]}; i += 3 ))
2594 do
2595 if _at_uses_${tools[i]}; then
2596 tools[i+1]=true;
2597 ${tools[i+2]};
2598 fi;
2599 done;
2600 local rerun_aclocal=false;
2601 eaclocal;
2602 for ((i = 0; i < ${#tools[@]}; i += 3 ))
2603 do
2604 if ! ${tools[i+1]} && _at_uses_${tools[i]}; then
2605 ${tools[i+2]};
2606 rerun_aclocal=true;
2607 fi;
2608 done;
2609 ${rerun_aclocal} && eaclocal;
2610 if [[ ${WANT_AUTOCONF} == "2.1" ]]; then
2611 eautoconf;
2612 else
2613 eautoconf --force;
2614 fi;
2615 [[ ${AT_NOEAUTOHEADER} != "yes" ]] && eautoheader;
2616 [[ ${AT_NOEAUTOMAKE} != "yes" ]] && FROM_EAUTORECONF="yes" eautomake ${AM_OPTS};
2617 if [[ ${AT_NOELIBTOOLIZE} != "yes" ]]; then
2618 elibtoolize --force "${PWD}";
2619 fi;
2620 return 0
2621}
2622econf_build ()
2623{
2624 local CBUILD=${CBUILD:-${CHOST}};
2625 tc-env_build econf --build=${CBUILD} --host=${CBUILD} "$@"
2626}
2627einstalldocs ()
2628{
2629 ( if [[ $(declare -p DOCS 2>/dev/null) != *=* ]]; then
2630 local d;
2631 for d in README* ChangeLog AUTHORS NEWS TODO CHANGES THANKS BUGS FAQ CREDITS CHANGELOG;
2632 do
2633 [[ -f ${d} && -s ${d} ]] && docinto / && dodoc "${d}";
2634 done;
2635 else
2636 if ___is_indexed_array_var DOCS; then
2637 [[ ${#DOCS[@]} -gt 0 ]] && docinto / && dodoc -r "${DOCS[@]}";
2638 else
2639 [[ -n ${DOCS} ]] && docinto / && dodoc -r ${DOCS};
2640 fi;
2641 fi );
2642 ( if ___is_indexed_array_var HTML_DOCS; then
2643 [[ ${#HTML_DOCS[@]} -gt 0 ]] && docinto html && dodoc -r "${HTML_DOCS[@]}";
2644 else
2645 [[ -n ${HTML_DOCS} ]] && docinto html && dodoc -r ${HTML_DOCS};
2646 fi )
2647}
2648elibtoolize ()
2649{
2650 type -P eltpatch &> /dev/null || die "eltpatch not found; is app-portage/elt-patches installed?";
2651 ELT_LOGDIR=${T} LD=$(tc-getLD) eltpatch "${@}" || die "eltpatch failed"
2652}
2653gcc-fullversion ()
2654{
2655 _gcc_fullversion '$1.$2.$3' "$@"
2656}
2657gcc-major-version ()
2658{
2659 _gcc_fullversion '$1' "$@"
2660}
2661gcc-micro-version ()
2662{
2663 _gcc_fullversion '$3' "$@"
2664}
2665gcc-minor-version ()
2666{
2667 _gcc_fullversion '$2' "$@"
2668}
2669gcc-specs-directive ()
2670{
2671 local directive subdname subdirective;
2672 directive="$(_gcc-specs-directive_raw $1)";
2673 while [[ ${directive} == *%\(*\)* ]]; do
2674 subdname=${directive/*%\(};
2675 subdname=${subdname/\)*};
2676 subdirective="$(_gcc-specs-directive_raw ${subdname})";
2677 directive="${directive//\%(${subdname})/${subdirective}}";
2678 done;
2679 echo "${directive}";
2680 return 0
2681}
2682gcc-specs-nostrict ()
2683{
2684 local directive;
2685 directive=$(gcc-specs-directive cc1);
2686 [[ "${directive/\{!fstrict-overflow:}" != "${directive}" ]]
2687}
2688gcc-specs-now ()
2689{
2690 local directive;
2691 directive=$(gcc-specs-directive link_command);
2692 [[ "${directive/\{!nonow:}" != "${directive}" ]]
2693}
2694gcc-specs-pie ()
2695{
2696 local directive;
2697 directive=$(gcc-specs-directive cc1);
2698 [[ "${directive/\{!nopie:}" != "${directive}" ]]
2699}
2700gcc-specs-relro ()
2701{
2702 local directive;
2703 directive=$(gcc-specs-directive link_command);
2704 [[ "${directive/\{!norelro:}" != "${directive}" ]]
2705}
2706gcc-specs-ssp ()
2707{
2708 local directive;
2709 directive=$(gcc-specs-directive cc1);
2710 [[ "${directive/\{!fno-stack-protector:}" != "${directive}" ]]
2711}
2712gcc-specs-ssp-to-all ()
2713{
2714 local directive;
2715 directive=$(gcc-specs-directive cc1);
2716 [[ "${directive/\{!fno-stack-protector-all:}" != "${directive}" ]]
2717}
2718gcc-specs-stack-check ()
2719{
2720 local directive;
2721 directive=$(gcc-specs-directive cc1);
2722 [[ "${directive/\{!fno-stack-check:}" != "${directive}" ]]
2723}
2724gcc-version ()
2725{
2726 _gcc_fullversion '$1.$2' "$@"
2727}
2728gen_usr_ldscript ()
2729{
2730 ewarn "${FUNCNAME}: Please migrate to usr-ldscript.eclass";
2731 local lib libdir=$(get_libdir) output_format="" auto=false suffix=$(get_libname);
2732 [[ -z ${ED+set} ]] && local ED=${D%/}${EPREFIX}/;
2733 tc-is-static-only && return;
2734 if [[ $(type -t multilib_is_native_abi) == "function" ]]; then
2735 multilib_is_native_abi || return 0;
2736 fi;
2737 case ${CTARGET:-${CHOST}} in
2738 *-darwin*)
2739
2740 ;;
2741 *-android*)
2742 return 0
2743 ;;
2744 *linux* | *-freebsd* | *-openbsd* | *-netbsd*)
2745 use prefix && return 0
2746 ;;
2747 *)
2748 return 0
2749 ;;
2750 esac;
2751 dodir /usr/${libdir};
2752 if [[ $1 == "-a" ]]; then
2753 auto=true;
2754 shift;
2755 dodir /${libdir};
2756 fi;
2757 local flags=(${CFLAGS} ${LDFLAGS} -Wl,--verbose);
2758 if $(tc-getLD) --version | grep -q 'GNU gold'; then
2759 local d="${T}/bfd-linker";
2760 mkdir -p "${d}";
2761 ln -sf $(which ${CHOST}-ld.bfd) "${d}"/ld;
2762 flags+=(-B"${d}");
2763 fi;
2764 output_format=$($(tc-getCC) "${flags[@]}" 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p');
2765 [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )";
2766 for lib in "$@";
2767 do
2768 local tlib;
2769 if ${auto}; then
2770 lib="lib${lib}${suffix}";
2771 else
2772 [[ -r ${ED}/${libdir}/${lib} ]] || continue;
2773 fi;
2774 case ${CTARGET:-${CHOST}} in
2775 *-darwin*)
2776 if ${auto}; then
2777 tlib=$(scanmacho -qF'%S#F' "${ED}"/usr/${libdir}/${lib});
2778 else
2779 tlib=$(scanmacho -qF'%S#F' "${ED}"/${libdir}/${lib});
2780 fi;
2781 [[ -z ${tlib} ]] && die "unable to read install_name from ${lib}";
2782 tlib=${tlib##*/};
2783 if ${auto}; then
2784 mv "${ED}"/usr/${libdir}/${lib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die;
2785 if [[ ${tlib} != ${lib%${suffix}}.*${suffix#.} ]]; then
2786 mv "${ED}"/usr/${libdir}/${tlib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die;
2787 fi;
2788 rm -f "${ED}"/${libdir}/${lib};
2789 fi;
2790 if [[ ! -w "${ED}/${libdir}/${tlib}" ]]; then
2791 chmod u+w "${ED}${libdir}/${tlib}";
2792 local nowrite=yes;
2793 fi;
2794 install_name_tool -id "${EPREFIX}"/${libdir}/${tlib} "${ED}"/${libdir}/${tlib} || die "install_name_tool failed";
2795 [[ -n ${nowrite} ]] && chmod u-w "${ED}${libdir}/${tlib}";
2796 pushd "${ED}/usr/${libdir}" > /dev/null;
2797 ln -snf "../../${libdir}/${tlib}" "${lib}";
2798 popd > /dev/null
2799 ;;
2800 *)
2801 if ${auto}; then
2802 tlib=$(scanelf -qF'%S#F' "${ED}"/usr/${libdir}/${lib});
2803 [[ -z ${tlib} ]] && die "unable to read SONAME from ${lib}";
2804 mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die;
2805 if [[ ${tlib} != ${lib}* ]]; then
2806 mv "${ED}"/usr/${libdir}/${tlib}* "${ED}"/${libdir}/ || die;
2807 fi;
2808 rm -f "${ED}"/${libdir}/${lib};
2809 else
2810 tlib=${lib};
2811 fi;
2812 cat > "${ED}/usr/${libdir}/${lib}" <<-END_LDSCRIPT
2813/* GNU ld script
2814 Since Gentoo has critical dynamic libraries in /lib, and the static versions
2815 in /usr/lib, we need to have a "fake" dynamic lib in /usr/lib, otherwise we
2816 run into linking problems. This "fake" dynamic lib is a linker script that
2817 redirects the linker to the real lib. And yes, this works in the cross-
2818 compiling scenario as the sysroot-ed linker will prepend the real path.
2819
2820 See bug https://bugs.gentoo.org/4411 for more info.
2821 */
2822${output_format}
2823GROUP ( ${EPREFIX}/${libdir}/${tlib} )
2824END_LDSCRIPT
2825
2826 ;;
2827 esac
2828 fperms a+x "/usr/${libdir}/${lib}" || die "could not change perms on ${lib}";
2829 done
2830}
2831get_abi_CFLAGS ()
2832{
2833 get_abi_var CFLAGS "$@"
2834}
2835get_abi_CHOST ()
2836{
2837 get_abi_var CHOST "$@"
2838}
2839get_abi_CTARGET ()
2840{
2841 get_abi_var CTARGET "$@"
2842}
2843get_abi_FAKE_TARGETS ()
2844{
2845 get_abi_var FAKE_TARGETS "$@"
2846}
2847get_abi_LDFLAGS ()
2848{
2849 get_abi_var LDFLAGS "$@"
2850}
2851get_abi_LIBDIR ()
2852{
2853 get_abi_var LIBDIR "$@"
2854}
2855get_abi_var ()
2856{
2857 local flag=$1;
2858 local abi=${2:-${ABI:-${DEFAULT_ABI:-default}}};
2859 local var="${flag}_${abi}";
2860 echo ${!var}
2861}
2862get_all_abis ()
2863{
2864 local x order="" mvar dvar;
2865 mvar="MULTILIB_ABIS";
2866 dvar="DEFAULT_ABI";
2867 if [[ -n $1 ]]; then
2868 mvar="$1_${mvar}";
2869 dvar="$1_${dvar}";
2870 fi;
2871 if [[ -z ${!mvar} ]]; then
2872 echo "default";
2873 return 0;
2874 fi;
2875 for x in ${!mvar};
2876 do
2877 if [[ ${x} != ${!dvar} ]]; then
2878 order="${order:+${order} }${x}";
2879 fi;
2880 done;
2881 order="${order:+${order} }${!dvar}";
2882 echo ${order};
2883 return 0
2884}
2885get_all_libdirs ()
2886{
2887 local libdirs abi;
2888 for abi in ${MULTILIB_ABIS};
2889 do
2890 libdirs+=" $(get_abi_LIBDIR ${abi})";
2891 done;
2892 [[ " ${libdirs} " != *" lib "* ]] && libdirs+=" lib";
2893 echo "${libdirs}"
2894}
2895get_exeext ()
2896{
2897 case ${CHOST} in
2898 *-cygwin* | mingw* | *-mingw*)
2899 echo ".exe"
2900 ;;
2901 esac
2902}
2903get_install_abis ()
2904{
2905 local x order="";
2906 if [[ -z ${MULTILIB_ABIS} ]]; then
2907 echo "default";
2908 return 0;
2909 fi;
2910 if [[ ${EMULTILIB_PKG} == "true" ]]; then
2911 for x in ${MULTILIB_ABIS};
2912 do
2913 if [[ ${x} != "${DEFAULT_ABI}" ]]; then
2914 has ${x} ${ABI_DENY} || order="${order} ${x}";
2915 fi;
2916 done;
2917 has ${DEFAULT_ABI} ${ABI_DENY} || order="${order} ${DEFAULT_ABI}";
2918 if [[ -n ${ABI_ALLOW} ]]; then
2919 local ordera="";
2920 for x in ${order};
2921 do
2922 if has ${x} ${ABI_ALLOW}; then
2923 ordera="${ordera} ${x}";
2924 fi;
2925 done;
2926 order=${ordera};
2927 fi;
2928 else
2929 order=${DEFAULT_ABI};
2930 fi;
2931 if [[ -z ${order} ]]; then
2932 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.";
2933 fi;
2934 echo ${order};
2935 return 0
2936}
2937get_libdir ()
2938{
2939 local libdir_var="LIBDIR_${ABI}";
2940 local libdir="lib";
2941 [[ -n ${ABI} && -n ${!libdir_var} ]] && libdir=${!libdir_var};
2942 echo "${libdir}"
2943}
2944get_libname ()
2945{
2946 local libname;
2947 local ver=$1;
2948 case ${CHOST} in
2949 *-cygwin*)
2950 libname="dll.a"
2951 ;;
2952 mingw* | *-mingw*)
2953 libname="dll"
2954 ;;
2955 *-darwin*)
2956 libname="dylib"
2957 ;;
2958 *-mint*)
2959 libname="irrelevant"
2960 ;;
2961 hppa*-hpux*)
2962 libname="sl"
2963 ;;
2964 *)
2965 libname="so"
2966 ;;
2967 esac;
2968 if [[ -z $* ]]; then
2969 echo ".${libname}";
2970 else
2971 for ver in "$@";
2972 do
2973 case ${CHOST} in
2974 *-cygwin*)
2975 echo ".${ver}.${libname}"
2976 ;;
2977 *-darwin*)
2978 echo ".${ver}.${libname}"
2979 ;;
2980 *-mint*)
2981 echo ".${libname}"
2982 ;;
2983 *)
2984 echo ".${libname}.${ver}"
2985 ;;
2986 esac;
2987 done;
2988 fi
2989}
2990get_localversion ()
2991{
2992 local lv_list i x;
2993 local shopt_save=$(shopt -p nullglob);
2994 shopt -s nullglob;
2995 local files=(${1}/localversion*);
2996 ${shopt_save};
2997 for i in "${files[@]}";
2998 do
2999 [[ -n ${i//*~*} ]] && lv_list="${lv_list} ${i}";
3000 done;
3001 for i in ${lv_list};
3002 do
3003 x="${x}$(<${i})";
3004 done;
3005 x=${x/ /};
3006 echo ${x}
3007}
3008get_makefile_extract_function ()
3009{
3010 local a='' b='' mkfunc='getfilevar';
3011 a="$(getfilevar VERSION ${KERNEL_MAKEFILE})";
3012 b="$(getfilevar_noexec VERSION ${KERNEL_MAKEFILE})";
3013 [[ "${a}" != "${b}" ]] && mkfunc='getfilevar_noexec';
3014 echo "${mkfunc}"
3015}
3016get_modname ()
3017{
3018 local modname;
3019 local ver=$1;
3020 case ${CHOST} in
3021 *-darwin*)
3022 modname="bundle"
3023 ;;
3024 *)
3025 modname="so"
3026 ;;
3027 esac;
3028 echo ".${modname}"
3029}
3030get_running_version ()
3031{
3032 if ! use kernel_linux; then
3033 die "${FUNCNAME}() called on non-Linux system, please fix the ebuild";
3034 fi;
3035 local kv=$(uname -r);
3036 if [[ -f ${ROOT%/}/lib/modules/${kv}/source/Makefile ]]; then
3037 KERNEL_DIR=$(readlink -f "${ROOT%/}/lib/modules/${kv}/source");
3038 if [[ -f ${ROOT%/}/lib/modules/${kv}/build/Makefile ]]; then
3039 KBUILD_OUTPUT=$(readlink -f "${ROOT%/}/lib/modules/${kv}/build");
3040 fi;
3041 get_version && return 0;
3042 fi;
3043 KV_FULL=${kv};
3044 local kv_full=${KV_FULL//[-+_]*};
3045 KV_MAJOR=$(ver_cut 1 ${kv_full});
3046 KV_MINOR=$(ver_cut 2 ${kv_full});
3047 KV_PATCH=$(ver_cut 3 ${kv_full});
3048 KV_EXTRA="${KV_FULL#${KV_MAJOR}.${KV_MINOR}${KV_PATCH:+.${KV_PATCH}}}";
3049 : ${KV_PATCH:=0};
3050 return 0
3051}
3052get_version ()
3053{
3054 if ! use kernel_linux; then
3055 die "${FUNCNAME}() called on non-Linux system, please fix the ebuild";
3056 fi;
3057 local tmplocal;
3058 [ -n "${KV_FULL}" ] && return 0;
3059 unset KV_DIR;
3060 [ -z "${get_version_warning_done}" ] && qeinfo "Determining the location of the kernel source code";
3061 [ -d "${KERNEL_DIR}" ] && KV_DIR="${KERNEL_DIR}";
3062 if [ -z "${KV_DIR}" ]; then
3063 if [ -z "${get_version_warning_done}" ]; then
3064 get_version_warning_done=1;
3065 qewarn "Unable to find kernel sources at ${KERNEL_DIR}";
3066 if [ "${KERNEL_DIR}" == "/usr/src/linux" ]; then
3067 qeinfo "Please make sure that ${KERNEL_DIR} points at your running kernel, ";
3068 qeinfo "(or the kernel you wish to build against).";
3069 qeinfo "Alternatively, set the KERNEL_DIR environment variable to the kernel sources location";
3070 else
3071 qeinfo "Please ensure that the KERNEL_DIR environment variable points at full Linux sources of the kernel you wish to compile against.";
3072 fi;
3073 fi;
3074 return 1;
3075 fi;
3076 if [ -z "${KBUILD_OUTPUT}" -a -L "${KERNEL_DIR}/source" ]; then
3077 KBUILD_OUTPUT=${KERNEL_DIR};
3078 KERNEL_DIR=$(readlink -f "${KERNEL_DIR}/source");
3079 KV_DIR=${KERNEL_DIR};
3080 fi;
3081 if [ -z "${get_version_warning_done}" ]; then
3082 qeinfo "Found kernel source directory:";
3083 qeinfo " ${KV_DIR}";
3084 fi;
3085 kernel_get_makefile;
3086 if [[ ! -s ${KERNEL_MAKEFILE} ]]; then
3087 if [ -z "${get_version_warning_done}" ]; then
3088 get_version_warning_done=1;
3089 qeerror "Could not find a Makefile in the kernel source directory.";
3090 qeerror "Please ensure that ${KERNEL_DIR} points to a complete set of Linux sources";
3091 fi;
3092 return 1;
3093 fi;
3094 local OUTPUT_DIR=${KBUILD_OUTPUT};
3095 if [[ -z ${OUTPUT_DIR} ]]; then
3096 local mkfunc=$(get_makefile_extract_function "${KERNEL_MAKEFILE}");
3097 OUTPUT_DIR=$(${mkfunc} KBUILD_OUTPUT "${KERNEL_MAKEFILE}");
3098 fi;
3099 KV_MAJOR=$(getfilevar VERSION "${KERNEL_MAKEFILE}");
3100 KV_MINOR=$(getfilevar PATCHLEVEL "${KERNEL_MAKEFILE}");
3101 KV_PATCH=$(getfilevar SUBLEVEL "${KERNEL_MAKEFILE}");
3102 KV_EXTRA=$(getfilevar EXTRAVERSION "${KERNEL_MAKEFILE}");
3103 if [ -z "${KV_MAJOR}" -o -z "${KV_MINOR}" -o -z "${KV_PATCH}" ]; then
3104 if [ -z "${get_version_warning_done}" ]; then
3105 get_version_warning_done=1;
3106 qeerror "Could not detect kernel version.";
3107 qeerror "Please ensure that ${KERNEL_DIR} points to a complete set of Linux sources.";
3108 fi;
3109 return 1;
3110 fi;
3111 [ -d "${OUTPUT_DIR}" ] && KV_OUT_DIR="${OUTPUT_DIR}";
3112 if [ -n "${KV_OUT_DIR}" ]; then
3113 qeinfo "Found kernel object directory:";
3114 qeinfo " ${KV_OUT_DIR}";
3115 fi;
3116 KV_OUT_DIR="${KV_OUT_DIR:-${KV_DIR}}";
3117 if [ -s "${KV_OUT_DIR}"/include/config/kernel.release ]; then
3118 KV_LOCAL=$(<"${KV_OUT_DIR}"/include/config/kernel.release);
3119 else
3120 if [ -s "${KV_OUT_DIR}"/.kernelrelease ]; then
3121 KV_LOCAL=$(<"${KV_OUT_DIR}"/.kernelrelease);
3122 else
3123 KV_LOCAL=;
3124 fi;
3125 fi;
3126 tmplocal=${KV_LOCAL#${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}};
3127 if [ "$KV_LOCAL" = "$tmplocal" ]; then
3128 KV_LOCAL=;
3129 else
3130 KV_LOCAL=$tmplocal;
3131 fi;
3132 if [[ -z ${OUTPUT_DIR} ]]; then
3133 for OUTPUT_DIR in "${SYSROOT}" "${ROOT%/}" "";
3134 do
3135 OUTPUT_DIR+="/lib/modules/${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}${KV_LOCAL}/build";
3136 if [[ -e ${OUTPUT_DIR} ]]; then
3137 break;
3138 fi;
3139 done;
3140 fi;
3141 KV_FULL="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}${KV_LOCAL}";
3142 qeinfo "Found sources for kernel version:";
3143 qeinfo " ${KV_FULL}";
3144 return 0
3145}
3146getfilevar ()
3147{
3148 local ERROR basefname basedname myARCH="${ARCH}";
3149 ERROR=0;
3150 [ -z "${1}" ] && ERROR=1;
3151 [ ! -f "${2}" ] && ERROR=1;
3152 if [ "${ERROR}" = 1 ]; then
3153 echo -e "\n";
3154 eerror "getfilevar requires 2 variables, with the second a valid file.";
3155 eerror " getfilevar <VARIABLE> <CONFIGFILE>";
3156 else
3157 basefname="$(basename ${2})";
3158 basedname="$(dirname ${2})";
3159 unset ARCH;
3160 [[ ${EAPI:-0} == [0123] ]] && function nonfatal ()
3161 {
3162 "$@"
3163 };
3164 echo -e "e:\\n\\t@echo \$(${1})\\ninclude ${basefname}" | nonfatal emake -C "${basedname}" --no-print-directory M="${T}" dot-config=0 need-config= ${BUILD_FIXES} -s -f - 2> /dev/null;
3165 ARCH=${myARCH};
3166 fi
3167}
3168getfilevar_noexec ()
3169{
3170 local ERROR basefname basedname mycat myARCH="${ARCH}";
3171 ERROR=0;
3172 mycat='cat';
3173 [ -z "${1}" ] && ERROR=1;
3174 [ ! -f "${2}" ] && ERROR=1;
3175 [ "${2%.gz}" != "${2}" ] && mycat='zcat';
3176 if [ "${ERROR}" = 1 ]; then
3177 echo -e "\n";
3178 eerror "getfilevar_noexec requires 2 variables, with the second a valid file.";
3179 eerror " getfilevar_noexec <VARIABLE> <CONFIGFILE>";
3180 else
3181 ${mycat} "${2}" | sed -n -e "/^[[:space:]]*${1}[[:space:]]*:\\?=[[:space:]]*\(.*\)\$/{
3182 s,^[^=]*[[:space:]]*=[[:space:]]*,,g ;
3183 s,[[:space:]]*\$,,g ;
3184 p
3185 }";
3186 fi
3187}
3188gnuconfig_do_update ()
3189{
3190 local configsubs_dir target targetlist file;
3191 [[ $# -eq 0 ]] && die "do not call gnuconfig_do_update; use gnuconfig_update";
3192 configsubs_dir=$(gnuconfig_findnewest);
3193 einfo "Using GNU config files from ${configsubs_dir}";
3194 for file in "$@";
3195 do
3196 if [[ ! -r ${configsubs_dir}/${file} ]]; then
3197 eerror "Can't read ${configsubs_dir}/${file}, skipping..";
3198 continue;
3199 fi;
3200 targetlist=$(find "${startdir}" -name "${file}");
3201 if [[ -n ${targetlist} ]]; then
3202 for target in ${targetlist};
3203 do
3204 [[ -L ${target} ]] && rm -f "${target}";
3205 einfo " Updating ${target/$startdir\//}";
3206 cp -f "${configsubs_dir}/${file}" "${target}";
3207 eend $?;
3208 done;
3209 else
3210 ewarn " No ${file} found in ${startdir}, skipping ...";
3211 fi;
3212 done;
3213 return 0
3214}
3215gnuconfig_findnewest ()
3216{
3217 local locations=();
3218 local prefix;
3219 case ${EAPI} in
3220 5 | 6)
3221 prefix="${EPREFIX}"
3222 ;;
3223 *)
3224 prefix="${BROOT}"
3225 ;;
3226 esac;
3227 locations+=("${prefix}"/usr/share/misc/config.sub "${prefix}"/usr/share/gnuconfig/config.sub "${prefix}"/usr/share/automake*/config.sub "${prefix}"/usr/share/libtool/config.sub);
3228 grep -s '^timestamp' "${locations[@]}" | sort -r -n -t\' -k2 | sed -n '1{s,/config.sub:.*$,,;p;q}'
3229}
3230gnuconfig_update ()
3231{
3232 local startdir;
3233 if [[ $1 == /* ]]; then
3234 startdir=$1;
3235 shift;
3236 else
3237 startdir=${S};
3238 fi;
3239 if [[ $# -gt 0 ]]; then
3240 gnuconfig_do_update "$@";
3241 else
3242 gnuconfig_do_update config.sub config.guess;
3243 fi;
3244 return $?
3245}
3246has_multilib_profile ()
3247{
3248 [ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ]
3249}
3250host-is-pax ()
3251{
3252 grep -qs ^PaX: /proc/self/status
3253}
3254in_iuse ()
3255{
3256 local use=${1};
3257 if [[ -z "${use}" ]]; then
3258 echo "!!! in_iuse() called without a parameter." 1>&2;
3259 echo "!!! in_iuse <USEFLAG>" 1>&2;
3260 die "in_iuse() called without a parameter";
3261 fi;
3262 local liuse=(${IUSE_EFFECTIVE});
3263 has "${use}" "${liuse[@]#[+-]}"
3264}
3265is_final_abi ()
3266{
3267 has_multilib_profile || return 0;
3268 set -- $(get_install_abis);
3269 local LAST_ABI=$#;
3270 [[ ${!LAST_ABI} == ${ABI} ]]
3271}
3272kernel_get_makefile ()
3273{
3274 [[ -s ${KV_DIR}/GNUMakefile ]] && KERNEL_MAKEFILE="${KV_DIR}/GNUMakefile" && return;
3275 [[ -s ${KV_DIR}/makefile ]] && KERNEL_MAKEFILE="${KV_DIR}/makefile" && return;
3276 [[ -s ${KV_DIR}/Makefile ]] && KERNEL_MAKEFILE="${KV_DIR}/Makefile" && return
3277}
3278kernel_is ()
3279{
3280 if ! use kernel_linux; then
3281 die "${FUNCNAME}() called on non-Linux system, please fix the ebuild";
3282 fi;
3283 linux-info_get_any_version;
3284 local operator;
3285 case ${1#-} in
3286 lt)
3287 operator="-lt";
3288 shift
3289 ;;
3290 gt)
3291 operator="-gt";
3292 shift
3293 ;;
3294 le)
3295 operator="-le";
3296 shift
3297 ;;
3298 ge)
3299 operator="-ge";
3300 shift
3301 ;;
3302 eq)
3303 operator="-eq";
3304 shift
3305 ;;
3306 *)
3307 operator="-eq"
3308 ;;
3309 esac;
3310 [[ $# -gt 3 ]] && die "Error in kernel-2_kernel_is(): too many parameters";
3311 ver_test "${KV_MAJOR:-0}.${KV_MINOR:-0}.${KV_PATCH:-0}" "${operator}" "${1:-${KV_MAJOR:-0}}.${2:-${KV_MINOR:-0}}.${3:-${KV_PATCH:-0}}"
3312}
3313linux-info_get_any_version ()
3314{
3315 if ! use kernel_linux; then
3316 die "${FUNCNAME}() called on non-Linux system, please fix the ebuild";
3317 fi;
3318 if ! get_version; then
3319 ewarn "Unable to calculate Linux Kernel version for build, attempting to use running version";
3320 if ! get_running_version; then
3321 die "Unable to determine any Linux Kernel version, please report a bug";
3322 fi;
3323 fi
3324}
3325linux-info_pkg_setup ()
3326{
3327 use kernel_linux || return;
3328 linux-info_get_any_version;
3329 [ -n "${CONFIG_CHECK}" ] && check_extra_config
3330}
3331linux_chkconfig_builtin ()
3332{
3333 linux_config_qa_check linux_chkconfig_builtin;
3334 [[ $(getfilevar_noexec "CONFIG_$1" "$(linux_config_path)") == y ]]
3335}
3336linux_chkconfig_module ()
3337{
3338 linux_config_qa_check linux_chkconfig_module;
3339 [[ $(getfilevar_noexec "CONFIG_$1" "$(linux_config_path)") == m ]]
3340}
3341linux_chkconfig_present ()
3342{
3343 linux_config_qa_check linux_chkconfig_present;
3344 [[ $(getfilevar_noexec "CONFIG_$1" "$(linux_config_path)") == [my] ]]
3345}
3346linux_chkconfig_string ()
3347{
3348 linux_config_qa_check linux_chkconfig_string;
3349 getfilevar_noexec "CONFIG_$1" "$(linux_config_path)"
3350}
3351linux_config_bin_exists ()
3352{
3353 export _LINUX_CONFIG_EXISTS_DONE=1;
3354 use kernel_linux && [[ -s /proc/config.gz ]]
3355}
3356linux_config_exists ()
3357{
3358 linux_config_src_exists || linux_config_bin_exists
3359}
3360linux_config_path ()
3361{
3362 if linux_config_src_exists; then
3363 echo "${KV_OUT_DIR}/.config";
3364 else
3365 if linux_config_bin_exists; then
3366 echo "/proc/config.gz";
3367 else
3368 return 1;
3369 fi;
3370 fi
3371}
3372linux_config_qa_check ()
3373{
3374 local f="$1";
3375 if [ -z "${_LINUX_CONFIG_EXISTS_DONE}" ]; then
3376 ewarn "QA: You called $f before any linux_config_exists!";
3377 ewarn "QA: The return value of $f will NOT guaranteed later!";
3378 fi;
3379 if ! use kernel_linux; then
3380 die "$f called on non-Linux system, please fix the ebuild";
3381 fi
3382}
3383linux_config_src_exists ()
3384{
3385 export _LINUX_CONFIG_EXISTS_DONE=1;
3386 use kernel_linux && [[ -n ${KV_OUT_DIR} && -s ${KV_OUT_DIR}/.config ]]
3387}
3388list-paxables ()
3389{
3390 file "$@" 2> /dev/null | grep -E 'ELF.*(executable|shared object)' | sed -e 's/: .*$//'
3391}
3392mono-env_pkg_setup ()
3393{
3394 export MONO_SHARED_DIR="${T}";
3395 export MONO_REGISTRY_PATH="${T}/registry";
3396 export XDG_DATA_HOME="${T}/data";
3397 export LC_ALL=C;
3398 export XDG_CONFIG_HOME="${T}";
3399 unset MONO_AOT_CACHE;
3400 QA_MULTILIB_PATHS="usr/lib/"
3401}
3402multibuild_copy_sources ()
3403{
3404 debug-print-function ${FUNCNAME} "${@}";
3405 local _MULTIBUILD_INITIAL_BUILD_DIR=${BUILD_DIR:-${S}};
3406 einfo "Will copy sources from ${_MULTIBUILD_INITIAL_BUILD_DIR}";
3407 local cp_args=();
3408 if cp --reflink=auto --version &> /dev/null; then
3409 cp_args+=(--reflink=auto);
3410 fi;
3411 function _multibuild_create_source_copy ()
3412 {
3413 einfo "${MULTIBUILD_VARIANT}: copying to ${BUILD_DIR}";
3414 cp -p -R "${cp_args[@]}" "${_MULTIBUILD_INITIAL_BUILD_DIR}" "${BUILD_DIR}" || die
3415 };
3416 multibuild_foreach_variant _multibuild_create_source_copy
3417}
3418multibuild_for_best_variant ()
3419{
3420 debug-print-function ${FUNCNAME} "${@}";
3421 [[ -n ${MULTIBUILD_VARIANTS} ]] || die "MULTIBUILD_VARIANTS need to be set";
3422 local MULTIBUILD_VARIANTS=("${MULTIBUILD_VARIANTS[$(( ${#MULTIBUILD_VARIANTS[@]} - 1 ))]}");
3423 multibuild_foreach_variant "${@}"
3424}
3425multibuild_foreach_variant ()
3426{
3427 debug-print-function ${FUNCNAME} "${@}";
3428 [[ -n ${MULTIBUILD_VARIANTS} ]] || die "MULTIBUILD_VARIANTS need to be set";
3429 local bdir=${BUILD_DIR:-${S}};
3430 [[ ${bdir%%/} == ${WORKDIR%%/} ]] && bdir=${WORKDIR}/build;
3431 local prev_id=${MULTIBUILD_ID:+${MULTIBUILD_ID}-};
3432 local ret=0 lret=0 v;
3433 debug-print "${FUNCNAME}: initial build_dir = ${bdir}";
3434 for v in "${MULTIBUILD_VARIANTS[@]}";
3435 do
3436 local MULTIBUILD_VARIANT=${v};
3437 local MULTIBUILD_ID=${prev_id}${v};
3438 local BUILD_DIR=${bdir%%/}-${v};
3439 function _multibuild_run ()
3440 {
3441 local i=1;
3442 while [[ ${!i} == _* ]]; do
3443 (( i += 1 ));
3444 done;
3445 [[ ${i} -le ${#} ]] && einfo "${v}: running ${@:${i}}";
3446 "${@}"
3447 };
3448 _multibuild_run "${@}" > >(exec tee -a "${T}/build-${MULTIBUILD_ID}.log") 2>&1;
3449 lret=${?};
3450 done;
3451 [[ ${ret} -eq 0 && ${lret} -ne 0 ]] && ret=${lret};
3452 return ${ret}
3453}
3454multibuild_merge_root ()
3455{
3456 local src=${1};
3457 local dest=${2};
3458 local ret;
3459 if use userland_BSD; then
3460 tar -C "${src}" -f - -c . | tar -x -f - -C "${dest}";
3461 [[ ${PIPESTATUS[*]} == '0 0' ]];
3462 ret=${?};
3463 else
3464 local cp_args=();
3465 if cp -a --version &> /dev/null; then
3466 cp_args+=(-a);
3467 else
3468 cp_args+=(-P -R -p);
3469 fi;
3470 if cp --reflink=auto --version &> /dev/null; then
3471 cp_args+=(--reflink=auto);
3472 fi;
3473 cp "${cp_args[@]}" "${src}"/. "${dest}"/;
3474 ret=${?};
3475 fi;
3476 if [[ ${ret} -ne 0 ]]; then
3477 die "${MULTIBUILD_VARIANT:-(unknown)}: merging image failed.";
3478 fi;
3479 rm -rf "${src}"
3480}
3481multibuild_parallel_foreach_variant ()
3482{
3483 debug-print-function ${FUNCNAME} "${@}";
3484 [[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}";
3485 multibuild_foreach_variant "${@}"
3486}
3487multilib-minimal_abi_src_configure ()
3488{
3489 debug-print-function ${FUNCNAME} "$@";
3490 mkdir -p "${BUILD_DIR}" || die;
3491 pushd "${BUILD_DIR}" > /dev/null || die;
3492 if declare -f multilib_src_configure > /dev/null; then
3493 multilib_src_configure;
3494 else
3495 default_src_configure;
3496 fi;
3497 popd > /dev/null || die
3498}
3499multilib-minimal_src_compile ()
3500{
3501 debug-print-function ${FUNCNAME} "$@";
3502 function multilib-minimal_abi_src_compile ()
3503 {
3504 debug-print-function ${FUNCNAME} "$@";
3505 pushd "${BUILD_DIR}" > /dev/null || die;
3506 if declare -f multilib_src_compile > /dev/null; then
3507 multilib_src_compile;
3508 else
3509 default_src_compile;
3510 fi;
3511 popd > /dev/null || die
3512 };
3513 multilib_foreach_abi multilib-minimal_abi_src_compile
3514}
3515multilib-minimal_src_configure ()
3516{
3517 debug-print-function ${FUNCNAME} "$@";
3518 function multilib-minimal_abi_src_configure ()
3519 {
3520 debug-print-function ${FUNCNAME} "$@";
3521 mkdir -p "${BUILD_DIR}" || die;
3522 pushd "${BUILD_DIR}" > /dev/null || die;
3523 if declare -f multilib_src_configure > /dev/null; then
3524 multilib_src_configure;
3525 else
3526 default_src_configure;
3527 fi;
3528 popd > /dev/null || die
3529 };
3530 multilib_foreach_abi multilib-minimal_abi_src_configure
3531}
3532multilib-minimal_src_install ()
3533{
3534 debug-print-function ${FUNCNAME} "$@";
3535 function multilib-minimal_abi_src_install ()
3536 {
3537 debug-print-function ${FUNCNAME} "$@";
3538 pushd "${BUILD_DIR}" > /dev/null || die;
3539 if declare -f multilib_src_install > /dev/null; then
3540 multilib_src_install;
3541 else
3542 if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then
3543 emake DESTDIR="${D}" install;
3544 fi;
3545 fi;
3546 multilib_prepare_wrappers;
3547 multilib_check_headers;
3548 popd > /dev/null || die
3549 };
3550 multilib_foreach_abi multilib-minimal_abi_src_install;
3551 multilib_install_wrappers;
3552 if declare -f multilib_src_install_all > /dev/null; then
3553 multilib_src_install_all;
3554 else
3555 einstalldocs;
3556 fi
3557}
3558multilib-minimal_src_test ()
3559{
3560 debug-print-function ${FUNCNAME} "$@";
3561 function multilib-minimal_abi_src_test ()
3562 {
3563 debug-print-function ${FUNCNAME} "$@";
3564 pushd "${BUILD_DIR}" > /dev/null || die;
3565 if declare -f multilib_src_test > /dev/null; then
3566 multilib_src_test;
3567 else
3568 default_src_test;
3569 fi;
3570 popd > /dev/null || die
3571 };
3572 multilib_foreach_abi multilib-minimal_abi_src_test
3573}
3574multilib_build_binaries ()
3575{
3576 debug-print-function ${FUNCNAME} "${@}";
3577 [[ ${EAPI} == 5 ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}, use multilib_is_native_abi() instead";
3578 eqawarn "QA warning: multilib_build_binaries is deprecated. Please use the equivalent";
3579 eqawarn "multilib_is_native_abi function instead.";
3580 multilib_is_native_abi "${@}"
3581}
3582multilib_check_headers ()
3583{
3584 function _multilib_header_cksum ()
3585 {
3586 set -o pipefail;
3587 if [[ -d ${ED%/}/usr/include ]]; then
3588 find "${ED%/}"/usr/include -type f -exec cksum {} + | sort -k2;
3589 fi
3590 };
3591 local cksum cksum_prev;
3592 local cksum_file=${T}/.multilib_header_cksum;
3593 cksum=$(_multilib_header_cksum) || die;
3594 unset -f _multilib_header_cksum;
3595 if [[ -f ${cksum_file} ]]; then
3596 cksum_prev=$(< "${cksum_file}") || die;
3597 if [[ ${cksum} != ${cksum_prev} ]]; then
3598 echo "${cksum}" > "${cksum_file}.new" || die;
3599 eerror "Header files have changed between ABIs.";
3600 if type -p diff &> /dev/null; then
3601 eerror "$(diff -du "${cksum_file}" "${cksum_file}.new")";
3602 else
3603 eerror "Old checksums in: ${cksum_file}";
3604 eerror "New checksums in: ${cksum_file}.new";
3605 fi;
3606 die "Header checksum mismatch, aborting.";
3607 fi;
3608 else
3609 echo "${cksum}" > "${cksum_file}" || die;
3610 fi
3611}
3612multilib_copy_sources ()
3613{
3614 debug-print-function ${FUNCNAME} "${@}";
3615 local MULTIBUILD_VARIANTS=($(multilib_get_enabled_abi_pairs));
3616 multibuild_copy_sources
3617}
3618multilib_env ()
3619{
3620 local CTARGET=${1:-${CTARGET}};
3621 local cpu=${CTARGET%%*-};
3622 if [[ ${CTARGET} = *-musl* ]]; then
3623 : ${MULTILIB_ABIS=default};
3624 : ${DEFAULT_ABI=default};
3625 export MULTILIB_ABIS DEFAULT_ABI;
3626 return;
3627 fi;
3628 case ${cpu} in
3629 aarch64*)
3630 export CFLAGS_arm=${CFLAGS_arm-};
3631 case ${cpu} in
3632 aarch64*be)
3633 export CHOST_arm="armv8b-${CTARGET#*-}"
3634 ;;
3635 *)
3636 export CHOST_arm="armv8l-${CTARGET#*-}"
3637 ;;
3638 esac;
3639 CHOST_arm=${CHOST_arm/%-gnu/-gnueabi};
3640 export CTARGET_arm=${CHOST_arm};
3641 export LIBDIR_arm="lib";
3642 export CFLAGS_arm64=${CFLAGS_arm64-};
3643 export CHOST_arm64=${CTARGET};
3644 export CTARGET_arm64=${CHOST_arm64};
3645 export LIBDIR_arm64="lib64";
3646 : ${MULTILIB_ABIS=arm64};
3647 : ${DEFAULT_ABI=arm64}
3648 ;;
3649 x86_64*)
3650 export CFLAGS_x86=${CFLAGS_x86--m32};
3651 export CHOST_x86=${CTARGET/x86_64/i686};
3652 CHOST_x86=${CHOST_x86/%-gnux32/-gnu};
3653 export CTARGET_x86=${CHOST_x86};
3654 if [[ ${SYMLINK_LIB} == "yes" ]]; then
3655 export LIBDIR_x86="lib32";
3656 else
3657 export LIBDIR_x86="lib";
3658 fi;
3659 export CFLAGS_amd64=${CFLAGS_amd64--m64};
3660 export CHOST_amd64=${CTARGET/%-gnux32/-gnu};
3661 export CTARGET_amd64=${CHOST_amd64};
3662 export LIBDIR_amd64="lib64";
3663 export CFLAGS_x32=${CFLAGS_x32--mx32};
3664 export CHOST_x32=${CTARGET/%-gnu/-gnux32};
3665 export CTARGET_x32=${CHOST_x32};
3666 export LIBDIR_x32="libx32";
3667 case ${CTARGET} in
3668 *-gnux32)
3669 : ${MULTILIB_ABIS=x32 amd64 x86};
3670 : ${DEFAULT_ABI=x32}
3671 ;;
3672 *)
3673 : ${MULTILIB_ABIS=amd64 x86};
3674 : ${DEFAULT_ABI=amd64}
3675 ;;
3676 esac
3677 ;;
3678 loongarch64*)
3679 export CFLAGS_lp64d=${CFLAGS_lp64d--mabi=lp64d};
3680 export CHOST_lp64d=${CTARGET};
3681 export CTARGET_lp64d=${CTARGET};
3682 export LIBDIR_lp64d=${LIBDIR_lp64d-lib64};
3683 : ${MULTILIB_ABIS=lp64d};
3684 : ${DEFAULT_ABI=lp64d}
3685 ;;
3686 mips64* | mipsisa64*)
3687 export CFLAGS_o32=${CFLAGS_o32--mabi=32};
3688 export CHOST_o32=${CTARGET/mips64/mips};
3689 export CHOST_o32=${CHOST_o32/mipsisa64/mipsisa32};
3690 export CTARGET_o32=${CHOST_o32};
3691 export LIBDIR_o32="lib";
3692 export CFLAGS_n32=${CFLAGS_n32--mabi=n32};
3693 export CHOST_n32=${CTARGET};
3694 export CTARGET_n32=${CHOST_n32};
3695 export LIBDIR_n32="lib32";
3696 export CFLAGS_n64=${CFLAGS_n64--mabi=64};
3697 export CHOST_n64=${CTARGET};
3698 export CTARGET_n64=${CHOST_n64};
3699 export LIBDIR_n64="lib64";
3700 : ${MULTILIB_ABIS=n64 n32 o32};
3701 : ${DEFAULT_ABI=n32}
3702 ;;
3703 powerpc64*)
3704 export CFLAGS_ppc=${CFLAGS_ppc--m32};
3705 export CHOST_ppc=${CTARGET/powerpc64/powerpc};
3706 export CTARGET_ppc=${CHOST_ppc};
3707 export LIBDIR_ppc="lib";
3708 export CFLAGS_ppc64=${CFLAGS_ppc64--m64};
3709 export CHOST_ppc64=${CTARGET};
3710 export CTARGET_ppc64=${CHOST_ppc64};
3711 export LIBDIR_ppc64="lib64";
3712 : ${MULTILIB_ABIS=ppc64 ppc};
3713 : ${DEFAULT_ABI=ppc64}
3714 ;;
3715 riscv64*)
3716 : ${MULTILIB_ABIS=lp64d lp64 ilp32d ilp32};
3717 : ${DEFAULT_ABI=lp64d};
3718 local __libdir_riscvdefaultabi_variable="LIBDIR_${DEFAULT_ABI}";
3719 local __libdir_riscvdefaultabi=${!__libdir_riscvdefaultabi_variable};
3720 export ${__libdir_riscvdefaultabi_variable}=${__libdir_riscvdefaultabi:-lib64};
3721 export CFLAGS_lp64d=${CFLAGS_lp64d--mabi=lp64d -march=rv64gc};
3722 export CHOST_lp64d=${CTARGET};
3723 export CTARGET_lp64d=${CTARGET};
3724 export LIBDIR_lp64d=${LIBDIR_lp64d-lib64/lp64d};
3725 export CFLAGS_lp64=${CFLAGS_lp64--mabi=lp64 -march=rv64imac};
3726 export CHOST_lp64=${CTARGET};
3727 export CTARGET_lp64=${CTARGET};
3728 export LIBDIR_lp64=${LIBDIR_lp64-lib64/lp64};
3729 export CFLAGS_ilp32d=${CFLAGS_ilp32d--mabi=ilp32d -march=rv32imafdc};
3730 export CHOST_ilp32d=${CTARGET/riscv64/riscv32};
3731 export CTARGET_ilp32d=${CTARGET/riscv64/riscv32};
3732 export LIBDIR_ilp32d=${LIBDIR_ilp32d-lib32/ilp32d};
3733 export CFLAGS_ilp32=${CFLAGS_ilp32--mabi=ilp32 -march=rv32imac};
3734 export CHOST_ilp32=${CTARGET/riscv64/riscv32};
3735 export CTARGET_ilp32=${CTARGET/riscv64/riscv32};
3736 export LIBDIR_ilp32=${LIBDIR_ilp32-lib32/ilp32}
3737 ;;
3738 riscv32*)
3739 : ${MULTILIB_ABIS=ilp32d ilp32};
3740 : ${DEFAULT_ABI=ilp32d};
3741 local __libdir_riscvdefaultabi_variable="LIBDIR_${DEFAULT_ABI}";
3742 local __libdir_riscvdefaultabi=${!__libdir_riscvdefaultabi_variable};
3743 export ${__libdir_riscvdefaultabi_variable}=${__libdir_riscvdefaultabi:-lib};
3744 export CFLAGS_ilp32d=${CFLAGS_ilp32d--mabi=ilp32d -march=rv32imafdc};
3745 export CHOST_ilp32d=${CTARGET};
3746 export CTARGET_ilp32d=${CTARGET};
3747 export LIBDIR_ilp32d=${LIBDIR_ilp32d-lib32/ilp32d};
3748 export CFLAGS_ilp32=${CFLAGS_ilp32--mabi=ilp32 -march=rv32imac};
3749 export CHOST_ilp32=${CTARGET};
3750 export CTARGET_ilp32=${CTARGET};
3751 export LIBDIR_ilp32=${LIBDIR_ilp32-lib32/ilp32}
3752 ;;
3753 s390x*)
3754 export CFLAGS_s390=${CFLAGS_s390--m31};
3755 export CHOST_s390=${CTARGET/s390x/s390};
3756 export CTARGET_s390=${CHOST_s390};
3757 export LIBDIR_s390="lib";
3758 export CFLAGS_s390x=${CFLAGS_s390x--m64};
3759 export CHOST_s390x=${CTARGET};
3760 export CTARGET_s390x=${CHOST_s390x};
3761 export LIBDIR_s390x="lib64";
3762 : ${MULTILIB_ABIS=s390x s390};
3763 : ${DEFAULT_ABI=s390x}
3764 ;;
3765 sparc64*)
3766 export CFLAGS_sparc32=${CFLAGS_sparc32--m32};
3767 export CHOST_sparc32=${CTARGET/sparc64/sparc};
3768 export CTARGET_sparc32=${CHOST_sparc32};
3769 export LIBDIR_sparc32="lib";
3770 export CFLAGS_sparc64=${CFLAGS_sparc64--m64};
3771 export CHOST_sparc64=${CTARGET};
3772 export CTARGET_sparc64=${CHOST_sparc64};
3773 export LIBDIR_sparc64="lib64";
3774 : ${MULTILIB_ABIS=sparc64 sparc32};
3775 : ${DEFAULT_ABI=sparc64}
3776 ;;
3777 *)
3778 : ${MULTILIB_ABIS=default};
3779 : ${DEFAULT_ABI=default}
3780 ;;
3781 esac;
3782 export MULTILIB_ABIS DEFAULT_ABI
3783}
3784multilib_for_best_abi ()
3785{
3786 debug-print-function ${FUNCNAME} "${@}";
3787 [[ ${EAPI} == 5 ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}, use multilib_is_native_abi() instead";
3788 eqawarn "QA warning: multilib_for_best_abi() function is deprecated and should";
3789 eqawarn "not be used. The multilib_is_native_abi() check may be used instead.";
3790 local MULTIBUILD_VARIANTS=($(multilib_get_enabled_abi_pairs));
3791 multibuild_for_best_variant _multilib_multibuild_wrapper "${@}"
3792}
3793multilib_foreach_abi ()
3794{
3795 debug-print-function ${FUNCNAME} "${@}";
3796 local MULTIBUILD_VARIANTS=($(multilib_get_enabled_abi_pairs));
3797 multibuild_foreach_variant _multilib_multibuild_wrapper "${@}"
3798}
3799multilib_get_enabled_abi_pairs ()
3800{
3801 debug-print-function ${FUNCNAME} "${@}";
3802 local abis=($(get_all_abis));
3803 local abi i found;
3804 for abi in "${abis[@]}";
3805 do
3806 for i in "${_MULTILIB_FLAGS[@]}";
3807 do
3808 local m_abis=${i#*:} m_abi;
3809 local m_flag=${i%:*};
3810 for m_abi in ${m_abis//,/ };
3811 do
3812 if [[ ${m_abi} == ${abi} ]] && {
3813 [[ ! -n "${MULTILIB_COMPAT[@]}" ]] || has "${m_flag}" "${MULTILIB_COMPAT[@]}"
3814 } && use "${m_flag}"; then
3815 echo "${m_flag}.${abi}";
3816 found=1;
3817 break 2;
3818 fi;
3819 done;
3820 done;
3821 done;
3822 if [[ ! -n ${found} ]]; then
3823 local abi=${ABI:-${DEFAULT_ABI}};
3824 debug-print "${FUNCNAME}: no ABIs enabled, fallback to ${abi}";
3825 debug-print "${FUNCNAME}: ABI=${ABI}, DEFAULT_ABI=${DEFAULT_ABI}";
3826 echo ".${abi}";
3827 fi
3828}
3829multilib_get_enabled_abis ()
3830{
3831 debug-print-function ${FUNCNAME} "${@}";
3832 local pairs=($(multilib_get_enabled_abi_pairs));
3833 echo "${pairs[@]#*.}"
3834}
3835multilib_install_wrappers ()
3836{
3837 debug-print-function ${FUNCNAME} "${@}";
3838 [[ ${#} -le 1 ]] || die "${FUNCNAME}: too many arguments";
3839 [[ ${COMPLETE_MULTILIB} == yes ]] && return;
3840 local root=${1:-${ED}};
3841 if [[ -d ${ED%/}/tmp/multilib-include ]]; then
3842 multibuild_merge_root "${ED%/}"/tmp/multilib-include "${root}"/usr/include;
3843 rmdir "${ED%/}"/tmp &> /dev/null;
3844 fi
3845}
3846multilib_is_native_abi ()
3847{
3848 debug-print-function ${FUNCNAME} "${@}";
3849 [[ ${#} -eq 0 ]] || die "${FUNCNAME}: too many arguments";
3850 [[ ${COMPLETE_MULTILIB} == yes || ${ABI} == ${DEFAULT_ABI} ]]
3851}
3852multilib_native_enable ()
3853{
3854 if multilib_is_native_abi; then
3855 echo "--enable-${1}${2+=${2}}";
3856 else
3857 echo "--disable-${1}";
3858 fi
3859}
3860multilib_native_use_enable ()
3861{
3862 if multilib_is_native_abi; then
3863 use_enable "${@}";
3864 else
3865 echo "--disable-${2:-${1}}";
3866 fi
3867}
3868multilib_native_use_with ()
3869{
3870 if multilib_is_native_abi; then
3871 use_with "${@}";
3872 else
3873 echo "--without-${2:-${1}}";
3874 fi
3875}
3876multilib_native_usex ()
3877{
3878 if multilib_is_native_abi; then
3879 usex "${@}";
3880 else
3881 echo "${3-no}${5}";
3882 fi
3883}
3884multilib_native_with ()
3885{
3886 if multilib_is_native_abi; then
3887 echo "--with-${1}${2+=${2}}";
3888 else
3889 echo "--without-${1}";
3890 fi
3891}
3892multilib_parallel_foreach_abi ()
3893{
3894 debug-print-function ${FUNCNAME} "${@}";
3895 local MULTIBUILD_VARIANTS=($(multilib_get_enabled_abi_pairs));
3896 multibuild_foreach_variant _multilib_multibuild_wrapper "${@}"
3897}
3898multilib_prepare_wrappers ()
3899{
3900 debug-print-function ${FUNCNAME} "${@}";
3901 [[ ${#} -le 1 ]] || die "${FUNCNAME}: too many arguments";
3902 local root=${1:-${ED%/}};
3903 local f;
3904 if [[ ${COMPLETE_MULTILIB} == yes ]]; then
3905 for f in "${MULTILIB_CHOST_TOOLS[@]}";
3906 do
3907 f=${f#/};
3908 local dir=${f%/*};
3909 local fn=${f##*/};
3910 ln -s "${fn}" "${root}/${dir}/${CHOST}-${fn}" || die;
3911 done;
3912 return;
3913 fi;
3914 for f in "${MULTILIB_CHOST_TOOLS[@]}";
3915 do
3916 f=${f#/};
3917 local dir=${f%/*};
3918 local fn=${f##*/};
3919 if [[ -L ${root}/${f} ]]; then
3920 local target;
3921 target=$(readlink "${root}/${f}") || die;
3922 local target_dir target_fn=${target##*/};
3923 [[ ${target} == */* ]] && target_dir=${target%/*};
3924 ln -f -s "${target_dir+${target_dir}/}${CHOST}-${target_fn}" "${root}/${f}" || die;
3925 fi;
3926 mv "${root}/${f}" "${root}/${dir}/${CHOST}-${fn}" || die;
3927 if multilib_is_native_abi; then
3928 ln -s "${CHOST}-${fn}" "${root}/${f}" || die;
3929 fi;
3930 done;
3931 if [[ -n ${MULTILIB_WRAPPED_HEADERS[@]} ]]; then
3932 if [[ -n ${MULTILIB_ABI_FLAG} ]]; then
3933 for f in "${MULTILIB_WRAPPED_HEADERS[@]}";
3934 do
3935 f=${f#/};
3936 if [[ ${f} != usr/include/* ]]; then
3937 die "Wrapping headers outside of /usr/include is not supported at the moment.";
3938 fi;
3939 f=${f#usr/include};
3940 local dir=${f%/*};
3941 if [[ -f ${root}/usr/include${f} ]]; then
3942 local wrapper=${ED%/}/tmp/multilib-include${f};
3943 if [[ ! -f ${ED%/}/tmp/multilib-include${f} ]]; then
3944 dodir "/tmp/multilib-include${dir}";
3945 cat > "${wrapper}" <<_EOF_ ||
3946/* This file is auto-generated by multilib-build.eclass
3947 * as a multilib-friendly wrapper. For the original content,
3948 * please see the files that are #included below.
3949 */
3950
3951#if defined(__x86_64__) /* amd64 */
3952# if defined(__ILP32__) /* x32 ABI */
3953# error "abi_x86_x32 not supported by the package."
3954# else /* 64-bit ABI */
3955# error "abi_x86_64 not supported by the package."
3956# endif
3957#elif defined(__i386__) /* plain x86 */
3958# error "abi_x86_32 not supported by the package."
3959#elif defined(__mips__)
3960# if(_MIPS_SIM == _ABIN32) /* n32 */
3961# error "abi_mips_n32 not supported by the package."
3962# elif(_MIPS_SIM == _ABI64) /* n64 */
3963# error "abi_mips_n64 not supported by the package."
3964# elif(_MIPS_SIM == _ABIO32) /* o32 */
3965# error "abi_mips_o32 not supported by the package."
3966# endif
3967#elif defined(__sparc__)
3968# if defined(__arch64__)
3969# error "abi_sparc_64 not supported by the package."
3970# else
3971# error "abi_sparc_32 not supported by the package."
3972# endif
3973#elif defined(__s390__)
3974# if defined(__s390x__)
3975# error "abi_s390_64 not supported by the package."
3976# else
3977# error "abi_s390_32 not supported by the package."
3978# endif
3979#elif defined(__powerpc__) || defined(__ppc__)
3980# if defined(__powerpc64__) || defined(__ppc64__)
3981# error "abi_ppc_64 not supported by the package."
3982# else
3983# error "abi_ppc_32 not supported by the package."
3984# endif
3985#elif defined(SWIG) /* https://sourceforge.net/p/swig/bugs/799/ */
3986# error "Native ABI not supported by the package."
3987#else
3988# error "No ABI matched, please report a bug to bugs.gentoo.org"
3989#endif
3990_EOF_
3991 die;
3992 fi
3993 if ! grep -q "${MULTILIB_ABI_FLAG} " "${wrapper}"; then
3994 die "Flag ${MULTILIB_ABI_FLAG} not listed in wrapper template. Please report a bug to https://bugs.gentoo.org.";
3995 fi;
3996 dodir "/tmp/multilib-include/${CHOST}${dir}";
3997 mv "${root}/usr/include${f}" "${ED%/}/tmp/multilib-include/${CHOST}${dir}/" || die;
3998 sed -e "/${MULTILIB_ABI_FLAG} /s&error.*&include <${CHOST}${f}>&" -i "${wrapper}" || die;
3999 if multilib_is_native_abi; then
4000 sed -e "/Native ABI/s&error.*&include <${CHOST}${f}>&" -i "${wrapper}" || die;
4001 fi;
4002 fi;
4003 done;
4004 fi;
4005 fi
4006}
4007multilib_src_configure ()
4008{
4009 local myeconfargs=($(use_with xen xen_opt) --without-ikvm-native --disable-dtrace --enable-system-aot $(use_with doc mcs-docs) $(use_enable nls));
4010 if multilib_is_native_abi; then
4011 myeconfargs+=(--enable-system-aot);
4012 else
4013 myeconfargs+=(--disable-system-aot);
4014 fi;
4015 econf "${myeconfargs[@]}"
4016}
4017multilib_src_install ()
4018{
4019 default;
4020 rm -f "${ED}"/usr/lib/mono/{2.0,4.5}/mscorlib.dll.so || die;
4021 rm -f "${ED}"/usr/lib/mono/{2.0,4.5}/mcs.exe.so || die
4022}
4023multilib_src_test ()
4024{
4025 cd mcs/tests || die;
4026 emake check
4027}
4028multilib_toolchain_setup ()
4029{
4030 local v vv;
4031 export ABI=$1;
4032 local save_restore_variables=(CBUILD CHOST AR CC CXX F77 FC LD NM OBJCOPY OBJDUMP PKG_CONFIG RANLIB READELF STRINGS STRIP PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG_SYSTEM_INCLUDE_PATH PKG_CONFIG_SYSTEM_LIBRARY_PATH);
4033 if [[ ${_DEFAULT_ABI_SAVED} == "true" ]]; then
4034 for v in "${save_restore_variables[@]}";
4035 do
4036 vv="_abi_saved_${v}";
4037 [[ ${!vv+set} == "set" ]] && export ${v}="${!vv}" || unset ${v};
4038 unset ${vv};
4039 done;
4040 unset _DEFAULT_ABI_SAVED;
4041 fi;
4042 if [[ ${ABI} != ${DEFAULT_ABI} ]]; then
4043 for v in "${save_restore_variables[@]}";
4044 do
4045 vv="_abi_saved_${v}";
4046 [[ ${!v+set} == "set" ]] && export ${vv}="${!v}" || unset ${vv};
4047 done;
4048 export _DEFAULT_ABI_SAVED="true";
4049 if [[ ${CBUILD} == "${CHOST}" ]]; then
4050 export CBUILD=$(get_abi_CHOST $1);
4051 fi;
4052 export CHOST=$(get_abi_CHOST ${DEFAULT_ABI});
4053 export AR="$(tc-getAR)";
4054 export CC="$(tc-getCC) $(get_abi_CFLAGS)";
4055 export CXX="$(tc-getCXX) $(get_abi_CFLAGS)";
4056 export F77="$(tc-getF77) $(get_abi_CFLAGS)";
4057 export FC="$(tc-getFC) $(get_abi_CFLAGS)";
4058 export LD="$(tc-getLD) $(get_abi_LDFLAGS)";
4059 export NM="$(tc-getNM)";
4060 export OBJCOPY="$(tc-getOBJCOPY)";
4061 export OBJDUMP="$(tc-getOBJDUMP)";
4062 export PKG_CONFIG="$(tc-getPKG_CONFIG)";
4063 export RANLIB="$(tc-getRANLIB)";
4064 export READELF="$(tc-getREADELF)";
4065 export STRINGS="$(tc-getSTRINGS)";
4066 export STRIP="$(tc-getSTRIP)";
4067 export CHOST=$(get_abi_CHOST $1);
4068 export PKG_CONFIG_LIBDIR=${EPREFIX}/usr/$(get_libdir)/pkgconfig;
4069 export PKG_CONFIG_PATH=${EPREFIX}/usr/share/pkgconfig;
4070 export PKG_CONFIG_SYSTEM_INCLUDE_PATH=${EPREFIX}/usr/include;
4071 export PKG_CONFIG_SYSTEM_LIBRARY_PATH=${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir);
4072 fi
4073}
4074nocommon_configure ()
4075{
4076 if [[ "${NOCOMMON_OVERRIDE_LIBTOOL}" == "yes" ]]; then
4077 ewarn "lto-overlay: libtool global_symbol_pipe and global_symbol_to_cdecl OVERRIDDEN";
4078 lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'";
4079 export lt_cv_sys_global_symbol_pipe;
4080 lt_cv_sys_global_symbol_to_cdecl="";
4081 export lt_cv_sys_global_symbol_to_cdecl;
4082 fi
4083}
4084number_abis ()
4085{
4086 set -- `get_install_abis`;
4087 echo $#
4088}
4089pax-mark ()
4090{
4091 local f;
4092 local flags;
4093 local ret=0;
4094 flags="${1//[!zPpEeMmRrSs]}";
4095 [[ -n "${flags}" ]] || return 0;
4096 shift;
4097 local dodefault="";
4098 [[ -n "${flags//[!z]}" ]] && dodefault="yes";
4099 if has PT ${PAX_MARKINGS}; then
4100 for f in "$@";
4101 do
4102 if type -p paxctl > /dev/null; then
4103 einfo "PT_PAX marking -${flags} ${f} with paxctl";
4104 paxctl -q${flags} "${f}" > /dev/null 2>&1 && continue;
4105 fi;
4106 if type -p paxctl-ng > /dev/null && paxctl-ng -L; then
4107 einfo "PT_PAX marking -${flags} ${f} with paxctl-ng";
4108 flags="${flags//z}";
4109 [[ ${dodefault} == "yes" ]] && paxctl-ng -L -z "${f}" > /dev/null 2>&1;
4110 [[ -n "${flags}" ]] || continue;
4111 paxctl-ng -L -${flags} "${f}" > /dev/null 2>&1 && continue;
4112 fi;
4113 if type -p scanelf > /dev/null && [[ ${PAX_MARKINGS} != "none" ]]; then
4114 einfo "PT_PAX marking -${flags} ${f} with scanelf";
4115 scanelf -Xxz ${flags} "$f" > /dev/null 2>&1;
4116 else
4117 if [[ ${PAX_MARKINGS} != "none" ]]; then
4118 elog "Failed to set PT_PAX markings -${flags} ${f}.";
4119 ret=1;
4120 fi;
4121 fi;
4122 done;
4123 fi;
4124 if has XT ${PAX_MARKINGS}; then
4125 flags="${flags//z}";
4126 for f in "$@";
4127 do
4128 if type -p paxctl-ng > /dev/null && paxctl-ng -l; then
4129 einfo "XATTR_PAX marking -${flags} ${f} with paxctl-ng";
4130 [[ ${dodefault} == "yes" ]] && paxctl-ng -d "${f}" > /dev/null 2>&1;
4131 [[ -n "${flags}" ]] || continue;
4132 paxctl-ng -l -${flags} "${f}" > /dev/null 2>&1 && continue;
4133 fi;
4134 if type -p setfattr > /dev/null; then
4135 [[ -n "${flags//[!Ee]}" ]] || flags+="e";
4136 einfo "XATTR_PAX marking -${flags} ${f} with setfattr";
4137 [[ ${dodefault} == "yes" ]] && setfattr -x "user.pax.flags" "${f}" > /dev/null 2>&1;
4138 setfattr -n "user.pax.flags" -v "${flags}" "${f}" > /dev/null 2>&1 && continue;
4139 fi;
4140 if [[ ${PAX_MARKINGS} != "none" ]]; then
4141 elog "Failed to set XATTR_PAX markings -${flags} ${f}.";
4142 ret=1;
4143 fi;
4144 done;
4145 fi;
4146 return ${ret}
4147}
4148pkg_nofetch ()
4149{
4150 default
4151}
4152pkg_postinst ()
4153{
4154 cert-sync "${EROOT}"/etc/ssl/certs/ca-certificates.crt
4155}
4156pkg_pretend ()
4157{
4158 linux-info_pkg_setup;
4159 if use kernel_linux; then
4160 if linux_config_exists; then
4161 linux_chkconfig_builtin SYSVIPC || die "SYSVIPC not enabled in the kernel";
4162 else
4163 ewarn "kernel config not found";
4164 ewarn "If CONFIG_SYSVIPC is not set in your kernel .config, mono will hang while compiling.";
4165 ewarn "See https://bugs.gentoo.org/261869 for more info.";
4166 fi;
4167 fi;
4168 check-reqs_pkg_pretend
4169}
4170pkg_setup ()
4171{
4172 mono-env_pkg_setup;
4173 check-reqs_pkg_setup
4174}
4175qeerror ()
4176{
4177 qout eerror "${@}"
4178}
4179qeinfo ()
4180{
4181 qout einfo "${@}"
4182}
4183qewarn ()
4184{
4185 qout ewarn "${@}"
4186}
4187qout ()
4188{
4189 local outputmsg type;
4190 type=${1};
4191 shift;
4192 outputmsg="${@}";
4193 case "${EBUILD_PHASE}" in
4194 depend)
4195 unset outputmsg
4196 ;;
4197 clean)
4198 unset outputmsg
4199 ;;
4200 preinst)
4201 unset outputmsg
4202 ;;
4203 esac;
4204 [ -n "${outputmsg}" ] && ${type} "${outputmsg}"
4205}
4206require_configured_kernel ()
4207{
4208 if ! use kernel_linux; then
4209 die "${FUNCNAME}() called on non-Linux system, please fix the ebuild";
4210 fi;
4211 if ! linux_config_src_exists; then
4212 qeerror "Could not find a usable .config in the kernel source directory.";
4213 qeerror "Please ensure that ${KERNEL_DIR} points to a configured set of Linux sources.";
4214 qeerror "If you are using KBUILD_OUTPUT, please set the environment var so that";
4215 qeerror "it points to the necessary object directory so that it might find .config.";
4216 die "Kernel not configured; no .config found in ${KV_OUT_DIR}";
4217 fi;
4218 get_version || die "Unable to determine configured kernel version"
4219}
4220run_in_build_dir ()
4221{
4222 debug-print-function ${FUNCNAME} "${@}";
4223 local ret;
4224 [[ ${#} -ne 0 ]] || die "${FUNCNAME}: no command specified.";
4225 [[ -n ${BUILD_DIR} ]] || die "${FUNCNAME}: BUILD_DIR not set.";
4226 mkdir -p "${BUILD_DIR}" || die;
4227 pushd "${BUILD_DIR}" > /dev/null || die;
4228 "${@}";
4229 ret=${?};
4230 popd > /dev/null || die;
4231 return ${ret}
4232}
4233set_arch_to_kernel ()
4234{
4235 export ARCH=$(tc-arch-kernel)
4236}
4237set_arch_to_portage ()
4238{
4239 export ARCH=$(tc-arch)
4240}
4241src_compile ()
4242{
4243 multilib-minimal_src_compile "$@"
4244}
4245src_configure ()
4246{
4247 multilib-minimal_src_configure "$@"
4248}
4249src_install ()
4250{
4251 multilib-minimal_src_install "$@"
4252}
4253src_prepare ()
4254{
4255 if use pax-kernel; then
4256 ewarn "We are disabling MPROTECT on the mono binary.";
4257 sed '/exec "/ i\paxmark.sh -mr "$r/@mono_runtime@"' -i "${S}"/runtime/mono-wrapper.in || die "Failed to sed mono-wrapper.in";
4258 fi;
4259 default;
4260 eautoreconf;
4261 multilib_copy_sources
4262}
4263src_test ()
4264{
4265 multilib-minimal_src_test "$@"
4266}
4267src_unpack ()
4268{
4269 default
4270}
4271tc-arch ()
4272{
4273 tc-ninja_magic_to_arch portage "$@"
4274}
4275tc-arch-kernel ()
4276{
4277 tc-ninja_magic_to_arch kern "$@"
4278}
4279tc-check-openmp ()
4280{
4281 if ! tc-has-openmp; then
4282 eerror "Your current compiler does not support OpenMP!";
4283 if tc-is-gcc; then
4284 eerror "Enable OpenMP support by building sys-devel/gcc with USE=\"openmp\".";
4285 else
4286 if tc-is-clang; then
4287 eerror "OpenMP support in sys-devel/clang is provided by sys-libs/libomp.";
4288 fi;
4289 fi;
4290 die "Active compiler does not have required support for OpenMP";
4291 fi
4292}
4293tc-cpp-is-true ()
4294{
4295 local CONDITION=${1};
4296 shift;
4297 $(tc-getTARGET_CPP) "${@}" -P - <<-EOF > /dev/null 2>&1
4298#if ${CONDITION}
4299true
4300#else
4301#error false
4302#endif
4303EOF
4304
4305}
4306tc-detect-is-softfloat ()
4307{
4308 [[ $(tc-getTARGET_CPP) == "gcc -E" ]] && return 1;
4309 case ${CTARGET:-${CHOST}} in
4310 *-newlib | *-elf | *-eabi)
4311 return 1
4312 ;;
4313 arm*)
4314 if tc-cpp-is-true "defined(__ARM_PCS_VFP)"; then
4315 echo "no";
4316 else
4317 if tc-cpp-is-true "defined(__SOFTFP__)"; then
4318 echo "yes";
4319 else
4320 echo "softfp";
4321 fi;
4322 fi;
4323 return 0
4324 ;;
4325 *)
4326 return 1
4327 ;;
4328 esac
4329}
4330tc-enables-pie ()
4331{
4332 tc-cpp-is-true "defined(__PIE__)" ${CPPFLAGS} ${CFLAGS}
4333}
4334tc-enables-ssp ()
4335{
4336 tc-cpp-is-true "defined(__SSP__) || defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS}
4337}
4338tc-enables-ssp-all ()
4339{
4340 tc-cpp-is-true "defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS}
4341}
4342tc-enables-ssp-strong ()
4343{
4344 tc-cpp-is-true "defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS}
4345}
4346tc-endian ()
4347{
4348 local host=$1;
4349 [[ -z ${host} ]] && host=${CTARGET:-${CHOST}};
4350 host=${host%%-*};
4351 case ${host} in
4352 aarch64*be)
4353 echo big
4354 ;;
4355 aarch64)
4356 echo little
4357 ;;
4358 alpha*)
4359 echo little
4360 ;;
4361 arm*b*)
4362 echo big
4363 ;;
4364 arm*)
4365 echo little
4366 ;;
4367 cris*)
4368 echo little
4369 ;;
4370 hppa*)
4371 echo big
4372 ;;
4373 i?86*)
4374 echo little
4375 ;;
4376 ia64*)
4377 echo little
4378 ;;
4379 loongarch*)
4380 echo little
4381 ;;
4382 m68*)
4383 echo big
4384 ;;
4385 mips*l*)
4386 echo little
4387 ;;
4388 mips*)
4389 echo big
4390 ;;
4391 powerpc*le)
4392 echo little
4393 ;;
4394 powerpc*)
4395 echo big
4396 ;;
4397 riscv*)
4398 echo little
4399 ;;
4400 s390*)
4401 echo big
4402 ;;
4403 sh*b*)
4404 echo big
4405 ;;
4406 sh*)
4407 echo little
4408 ;;
4409 sparc*)
4410 echo big
4411 ;;
4412 x86_64*)
4413 echo little
4414 ;;
4415 *)
4416 echo wtf
4417 ;;
4418 esac
4419}
4420tc-env_build ()
4421{
4422 tc-export_build_env;
4423 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) READELF=$(tc-getBUILD_READELF) "$@"
4424}
4425tc-export ()
4426{
4427 local var;
4428 for var in "$@";
4429 do
4430 [[ $(type -t "tc-get${var}") != "function" ]] && die "tc-export: invalid export variable '${var}'";
4431 "tc-get${var}" > /dev/null;
4432 done
4433}
4434tc-export_build_env ()
4435{
4436 tc-export "$@";
4437 if tc-is-cross-compiler; then
4438 : ${BUILD_CFLAGS:=-O1 -pipe};
4439 : ${BUILD_CXXFLAGS:=-O1 -pipe};
4440 : ${BUILD_CPPFLAGS:= };
4441 : ${BUILD_LDFLAGS:= };
4442 else
4443 : ${BUILD_CFLAGS:=${CFLAGS}};
4444 : ${BUILD_CXXFLAGS:=${CXXFLAGS}};
4445 : ${BUILD_CPPFLAGS:=${CPPFLAGS}};
4446 : ${BUILD_LDFLAGS:=${LDFLAGS}};
4447 fi;
4448 export BUILD_{C,CXX,CPP,LD}FLAGS;
4449 local v;
4450 for v in BUILD_{C,CXX,CPP,LD}FLAGS;
4451 do
4452 export ${v#BUILD_}_FOR_BUILD="${!v}";
4453 done
4454}
4455tc-get-compiler-type ()
4456{
4457 local code='
4458#if defined(__PATHSCALE__)
4459 HAVE_PATHCC
4460#elif defined(__clang__)
4461 HAVE_CLANG
4462#elif defined(__GNUC__)
4463 HAVE_GCC
4464#endif
4465';
4466 local res=$($(tc-getCPP "$@") -E -P - <<<"${code}");
4467 case ${res} in
4468 *HAVE_PATHCC*)
4469 echo pathcc
4470 ;;
4471 *HAVE_CLANG*)
4472 echo clang
4473 ;;
4474 *HAVE_GCC*)
4475 echo gcc
4476 ;;
4477 *)
4478 echo unknown
4479 ;;
4480 esac
4481}
4482tc-getAR ()
4483{
4484 tc-getPROG AR ar "$@"
4485}
4486tc-getAS ()
4487{
4488 tc-getPROG AS as "$@"
4489}
4490tc-getBUILD_AR ()
4491{
4492 tc-getBUILD_PROG AR ar "$@"
4493}
4494tc-getBUILD_AS ()
4495{
4496 tc-getBUILD_PROG AS as "$@"
4497}
4498tc-getBUILD_CC ()
4499{
4500 tc-getBUILD_PROG CC gcc "$@"
4501}
4502tc-getBUILD_CPP ()
4503{
4504 tc-getBUILD_PROG CPP "$(tc-getBUILD_CC) -E" "$@"
4505}
4506tc-getBUILD_CXX ()
4507{
4508 tc-getBUILD_PROG CXX g++ "$@"
4509}
4510tc-getBUILD_LD ()
4511{
4512 tc-getBUILD_PROG LD ld "$@"
4513}
4514tc-getBUILD_NM ()
4515{
4516 tc-getBUILD_PROG NM nm "$@"
4517}
4518tc-getBUILD_OBJCOPY ()
4519{
4520 tc-getBUILD_PROG OBJCOPY objcopy "$@"
4521}
4522tc-getBUILD_PKG_CONFIG ()
4523{
4524 tc-getBUILD_PROG PKG_CONFIG pkg-config "$@"
4525}
4526tc-getBUILD_PROG ()
4527{
4528 local vars="BUILD_$1 $1_FOR_BUILD HOST$1";
4529 tc-is-cross-compiler || vars+=" $1";
4530 _tc-getPROG CBUILD "${vars}" "${@:2}"
4531}
4532tc-getBUILD_RANLIB ()
4533{
4534 tc-getBUILD_PROG RANLIB ranlib "$@"
4535}
4536tc-getBUILD_READELF ()
4537{
4538 tc-getBUILD_PROG READELF readelf "$@"
4539}
4540tc-getBUILD_STRINGS ()
4541{
4542 tc-getBUILD_PROG STRINGS strings "$@"
4543}
4544tc-getBUILD_STRIP ()
4545{
4546 tc-getBUILD_PROG STRIP strip "$@"
4547}
4548tc-getCC ()
4549{
4550 tc-getPROG CC gcc "$@"
4551}
4552tc-getCPP ()
4553{
4554 tc-getPROG CPP "${CC:-gcc} -E" "$@"
4555}
4556tc-getCXX ()
4557{
4558 tc-getPROG CXX g++ "$@"
4559}
4560tc-getDLLWRAP ()
4561{
4562 tc-getPROG DLLWRAP dllwrap "$@"
4563}
4564tc-getF77 ()
4565{
4566 tc-getPROG F77 gfortran "$@"
4567}
4568tc-getFC ()
4569{
4570 tc-getPROG FC gfortran "$@"
4571}
4572tc-getGCJ ()
4573{
4574 tc-getPROG GCJ gcj "$@"
4575}
4576tc-getGO ()
4577{
4578 tc-getPROG GO gccgo "$@"
4579}
4580tc-getLD ()
4581{
4582 tc-getPROG LD ld "$@"
4583}
4584tc-getNM ()
4585{
4586 tc-getPROG NM nm "$@"
4587}
4588tc-getOBJCOPY ()
4589{
4590 tc-getPROG OBJCOPY objcopy "$@"
4591}
4592tc-getOBJDUMP ()
4593{
4594 tc-getPROG OBJDUMP objdump "$@"
4595}
4596tc-getPKG_CONFIG ()
4597{
4598 tc-getPROG PKG_CONFIG pkg-config "$@"
4599}
4600tc-getPROG ()
4601{
4602 _tc-getPROG CHOST "$@"
4603}
4604tc-getRANLIB ()
4605{
4606 tc-getPROG RANLIB ranlib "$@"
4607}
4608tc-getRC ()
4609{
4610 tc-getPROG RC windres "$@"
4611}
4612tc-getREADELF ()
4613{
4614 tc-getPROG READELF readelf "$@"
4615}
4616tc-getSTRINGS ()
4617{
4618 tc-getPROG STRINGS strings "$@"
4619}
4620tc-getSTRIP ()
4621{
4622 tc-getPROG STRIP strip "$@"
4623}
4624tc-getTARGET_CPP ()
4625{
4626 if [[ -n ${CTARGET} ]]; then
4627 _tc-getPROG CTARGET TARGET_CPP "gcc -E" "$@";
4628 else
4629 tc-getCPP "$@";
4630 fi
4631}
4632tc-has-openmp ()
4633{
4634 local base="${T}/test-tc-openmp";
4635 cat <<-EOF > "${base}.c"
4636#include <omp.h>
4637int main() {
4638int nthreads, tid, ret = 0;
4639#pragma omp parallel private(nthreads, tid)
4640{
4641tid = omp_get_thread_num();
4642nthreads = omp_get_num_threads(); ret += tid + nthreads;
4643}
4644return ret;
4645}
4646EOF
4647
4648 $(tc-getCC "$@") -fopenmp "${base}.c" -o "${base}" &> /dev/null;
4649 local ret=$?;
4650 rm -f "${base}"*;
4651 return ${ret}
4652}
4653tc-has-tls ()
4654{
4655 local base="${T}/test-tc-tls";
4656 cat <<-EOF > "${base}.c"
4657int foo(int *i) {
4658static __thread int j = 0;
4659return *i ? j : *i;
4660}
4661EOF
4662
4663 local flags;
4664 case $1 in
4665 -s)
4666 flags="-S"
4667 ;;
4668 -c)
4669 flags="-c"
4670 ;;
4671 -l)
4672
4673 ;;
4674 -*)
4675 die "Usage: tc-has-tls [-c|-l] [toolchain prefix]"
4676 ;;
4677 esac;
4678 : ${flags:=-fPIC -shared -Wl,-z,defs};
4679 [[ $1 == -* ]] && shift;
4680 $(tc-getCC "$@") ${flags} "${base}.c" -o "${base}" &> /dev/null;
4681 local ret=$?;
4682 rm -f "${base}"*;
4683 return ${ret}
4684}
4685tc-is-clang ()
4686{
4687 [[ $(tc-get-compiler-type) == clang ]]
4688}
4689tc-is-cross-compiler ()
4690{
4691 [[ ${CBUILD:-${CHOST}} != ${CHOST} ]]
4692}
4693tc-is-gcc ()
4694{
4695 [[ $(tc-get-compiler-type) == gcc ]]
4696}
4697tc-is-softfloat ()
4698{
4699 tc-detect-is-softfloat || tc-tuple-is-softfloat
4700}
4701tc-is-static-only ()
4702{
4703 local host=${CTARGET:-${CHOST}};
4704 [[ ${host} == *-mint* ]]
4705}
4706tc-ld-disable-gold ()
4707{
4708 tc-ld-is-gold "$@" && tc-ld-force-bfd "$@"
4709}
4710tc-ld-force-bfd ()
4711{
4712 if ! tc-ld-is-gold "$@" && ! tc-ld-is-lld "$@"; then
4713 return;
4714 fi;
4715 ewarn "Forcing usage of the BFD linker";
4716 local ld=$(tc-getLD "$@");
4717 local bfd_ld="${ld%% *}.bfd";
4718 local path_ld=$(which "${bfd_ld}" 2>/dev/null);
4719 [[ -e ${path_ld} ]] && export LD=${bfd_ld};
4720 local fallback="true";
4721 if tc-is-gcc; then
4722 local major=$(gcc-major-version "$@");
4723 local minor=$(gcc-minor-version "$@");
4724 if [[ ${major} -gt 4 ]] || [[ ${major} -eq 4 && ${minor} -ge 8 ]]; then
4725 export LDFLAGS="${LDFLAGS} -fuse-ld=bfd";
4726 fallback="false";
4727 fi;
4728 else
4729 if tc-is-clang; then
4730 local major=$(clang-major-version "$@");
4731 local minor=$(clang-minor-version "$@");
4732 if [[ ${major} -gt 3 ]] || [[ ${major} -eq 3 && ${minor} -ge 5 ]]; then
4733 export LDFLAGS="${LDFLAGS} -fuse-ld=bfd";
4734 fallback="false";
4735 fi;
4736 fi;
4737 fi;
4738 if [[ ${fallback} == "true" ]]; then
4739 if [[ -e ${path_ld} ]]; then
4740 local d="${T}/bfd-linker";
4741 mkdir -p "${d}";
4742 ln -sf "${path_ld}" "${d}"/ld;
4743 export LDFLAGS="${LDFLAGS} -B${d}";
4744 else
4745 die "unable to locate a BFD linker";
4746 fi;
4747 fi
4748}
4749tc-ld-is-gold ()
4750{
4751 local out;
4752 out=$($(tc-getLD "$@") --version 2>&1);
4753 if [[ ${out} == *"GNU gold"* ]]; then
4754 return 0;
4755 fi;
4756 local base="${T}/test-tc-gold";
4757 cat <<-EOF > "${base}.c"
4758int main() { return 0; }
4759EOF
4760
4761 out=$($(tc-getCC "$@") ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -Wl,--version "${base}.c" -o "${base}" 2>&1);
4762 rm -f "${base}"*;
4763 if [[ ${out} == *"GNU gold"* ]]; then
4764 return 0;
4765 fi;
4766 return 1
4767}
4768tc-ld-is-lld ()
4769{
4770 local out;
4771 out=$($(tc-getLD "$@") --version 2>&1);
4772 if [[ ${out} == *"LLD"* ]]; then
4773 return 0;
4774 fi;
4775 local base="${T}/test-tc-lld";
4776 cat <<-EOF > "${base}.c"
4777int main() { return 0; }
4778EOF
4779
4780 out=$($(tc-getCC "$@") ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -Wl,--version "${base}.c" -o "${base}" 2>&1);
4781 rm -f "${base}"*;
4782 if [[ ${out} == *"LLD"* ]]; then
4783 return 0;
4784 fi;
4785 return 1
4786}
4787tc-ninja_magic_to_arch ()
4788{
4789 function ninj ()
4790 {
4791 [[ ${type} == "kern" ]] && echo $1 || echo $2
4792 };
4793 local type=$1;
4794 local host=$2;
4795 [[ -z ${host} ]] && host=${CTARGET:-${CHOST}};
4796 case ${host} in
4797 aarch64*)
4798 echo arm64
4799 ;;
4800 alpha*)
4801 echo alpha
4802 ;;
4803 arm*)
4804 echo arm
4805 ;;
4806 avr*)
4807 ninj avr32 avr
4808 ;;
4809 bfin*)
4810 ninj blackfin bfin
4811 ;;
4812 c6x*)
4813 echo c6x
4814 ;;
4815 cris*)
4816 echo cris
4817 ;;
4818 frv*)
4819 echo frv
4820 ;;
4821 hexagon*)
4822 echo hexagon
4823 ;;
4824 hppa*)
4825 ninj parisc hppa
4826 ;;
4827 i?86*)
4828 if [[ ${type} == "kern" && ${host} == *freebsd* ]]; then
4829 echo i386;
4830 else
4831 echo x86;
4832 fi
4833 ;;
4834 ia64*)
4835 echo ia64
4836 ;;
4837 loongarch*)
4838 ninj loongarch loong
4839 ;;
4840 m68*)
4841 echo m68k
4842 ;;
4843 metag*)
4844 echo metag
4845 ;;
4846 microblaze*)
4847 echo microblaze
4848 ;;
4849 mips*)
4850 echo mips
4851 ;;
4852 nios2*)
4853 echo nios2
4854 ;;
4855 nios*)
4856 echo nios
4857 ;;
4858 or1k* | or32*)
4859 echo openrisc
4860 ;;
4861 powerpc*)
4862 if [[ ${type} == "kern" ]]; then
4863 echo powerpc;
4864 else
4865 if [[ ${host} == powerpc64* ]]; then
4866 echo ppc64;
4867 else
4868 echo ppc;
4869 fi;
4870 fi
4871 ;;
4872 riscv*)
4873 echo riscv
4874 ;;
4875 s390*)
4876 echo s390
4877 ;;
4878 score*)
4879 echo score
4880 ;;
4881 sh64*)
4882 ninj sh64 sh
4883 ;;
4884 sh*)
4885 echo sh
4886 ;;
4887 sparc64*)
4888 ninj sparc64 sparc
4889 ;;
4890 sparc*)
4891 [[ ${PROFILE_ARCH} == "sparc64" ]] && ninj sparc64 sparc || echo sparc
4892 ;;
4893 tile*)
4894 echo tile
4895 ;;
4896 vax*)
4897 echo vax
4898 ;;
4899 x86_64*freebsd*)
4900 echo amd64
4901 ;;
4902 x86_64*)
4903 if [[ ${type} == "kern" ]]; then
4904 echo x86;
4905 else
4906 echo amd64;
4907 fi
4908 ;;
4909 xtensa*)
4910 echo xtensa
4911 ;;
4912 *)
4913 echo unknown
4914 ;;
4915 esac
4916}
4917tc-stack-grows-down ()
4918{
4919 case ${ARCH} in
4920 hppa | metag)
4921 return 1
4922 ;;
4923 esac;
4924 return 0
4925}
4926tc-tuple-is-softfloat ()
4927{
4928 local CTARGET=${CTARGET:-${CHOST}};
4929 case ${CTARGET//_/-} in
4930 bfin* | h8300*)
4931 echo "only"
4932 ;;
4933 *-softfloat-*)
4934 echo "yes"
4935 ;;
4936 *-softfp-*)
4937 echo "softfp"
4938 ;;
4939 arm*-hardfloat-* | arm*eabihf)
4940 echo "no"
4941 ;;
4942 *-newlib | *-elf | *-eabi)
4943 echo "no"
4944 ;;
4945 arm*)
4946 echo "yes"
4947 ;;
4948 *)
4949 echo "no"
4950 ;;
4951 esac
4952}
4953ver_cut ()
4954{
4955 local range=${1};
4956 local v=${2:-${PV}};
4957 local start end;
4958 local -a comp;
4959 __eapi7_ver_split "${v}";
4960 local max=$((${#comp[@]}/2));
4961 __eapi7_ver_parse_range "${range}" "${max}";
4962 local IFS=;
4963 if [[ ${start} -gt 0 ]]; then
4964 start=$(( start*2 - 1 ));
4965 fi;
4966 echo "${comp[*]:start:end*2-start}"
4967}
4968ver_rs ()
4969{
4970 local v;
4971 (( ${#} & 1 )) && v=${@: -1} || v=${PV};
4972 local start end i;
4973 local -a comp;
4974 __eapi7_ver_split "${v}";
4975 local max=$((${#comp[@]}/2 - 1));
4976 while [[ ${#} -ge 2 ]]; do
4977 __eapi7_ver_parse_range "${1}" "${max}";
4978 for ((i = start*2; i <= end*2; i+=2 ))
4979 do
4980 [[ ${i} -eq 0 && -z ${comp[i]} ]] && continue;
4981 comp[i]=${2};
4982 done;
4983 shift 2;
4984 done;
4985 local IFS=;
4986 echo "${comp[*]}"
4987}
4988ver_test ()
4989{
4990 local va op vb;
4991 if [[ $# -eq 3 ]]; then
4992 va=${1};
4993 shift;
4994 else
4995 va=${PVR};
4996 fi;
4997 [[ $# -eq 2 ]] || die "${FUNCNAME}: bad number of arguments";
4998 op=${1};
4999 vb=${2};
5000 case ${op} in
5001 -eq | -ne | -lt | -le | -gt | -ge)
5002
5003 ;;
5004 *)
5005 die "${FUNCNAME}: invalid operator: ${op}"
5006 ;;
5007 esac;
5008 __eapi7_ver_compare "${va}" "${vb}";
5009 test $? "${op}" 2
5010}
This log will be saved for 90 days from their last view.
Report abuse