Advertisement
Guest User

Untitled

a guest
Feb 13th, 2015
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 111.10 KB | None | 0 0
  1. declare -x ABI="amd64"
  2. declare -x ABI_X86="64"
  3. declare -x ALSA_CARDS="ctxfi"
  4. declare -x ANT_HOME="/usr/share/ant"
  5. declare -x APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_d
  6. efault authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex
  7. cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers
  8. ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp pr
  9. oxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack v
  10. host_alias"
  11. declare -x ARCH="amd64"
  12. declare -x BOOTSTRAP_USE="cxx unicode internal-glib python_targets_python3_3 python_targets_python2_7 m
  13. ultilib"
  14. declare -x CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author"
  15. declare -x CAMERAS="canon ptp2"
  16. declare -x CBUILD="x86_64-pc-linux-gnu"
  17. declare -x CFLAGS="-march=native -O2 -pipe"
  18. declare -x CFLAGS_amd64="-m64"
  19. declare -x CFLAGS_default
  20. declare -x CFLAGS_x32="-mx32"
  21. declare -x CFLAGS_x86="-m32"
  22. declare -x CG_COMPILER_EXE="/opt/bin/cgc"
  23. declare -x CG_INC_PATH="/opt/nvidia-cg-toolkit/include"
  24. declare -x CG_LIB_PATH="/opt/nvidia-cg-toolkit/lib32:/opt/nvidia-cg-toolkit/lib64"
  25. declare -x CHOST="x86_64-pc-linux-gnu"
  26. declare -x CHOST_amd64="x86_64-pc-linux-gnu"
  27. declare -x CHOST_default="x86_64-pc-linux-gnu"
  28. declare -x CHOST_x32="x86_64-pc-linux-gnux32"
  29. declare -x CHOST_x86="i686-pc-linux-gnu"
  30. declare -x COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog"
  31. declare -x COLORFGBG="15;0"
  32. declare -- COMMON_DEPEND="virtual/libusb
  33. virtual/udev"
  34. declare -x CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3"
  35. declare -x CTARGET_default="x86_64-pc-linux-gnu"
  36. declare -x CXXFLAGS="-march=native -O2 -pipe"
  37. declare -x DBUS_SESSION_BUS_ADDRESS="unix:abstract=/tmp/dbus-f41DxhTU1f,guid=7e6b5803b5521be2a29f384654
  38. ddd6e8"
  39. declare -x DEFAULT_ABI="amd64"
  40. declare -x DEFINED_PHASES=" compile install test unpack"
  41. declare DEPEND="virtual/libusb
  42. virtual/udev
  43. dev-libs/go-fuse
  44. dev-lang/go
  45. media-libs/libmtp >=dev-vcs/git-1.8.2.1"
  46. declare DESCRIPTION="a simple FUSE filesystem for mounting Android devices as a MTP device"
  47. declare -x DESTTREE="/usr"
  48. declare -x DIROPTIONS="-m0755"
  49. declare -x EAPI="5"
  50. declare -- EGIT3_STORE_DIR="/usr/portage/distfiles/git3-src"
  51. declare -- EGIT_BRANCH=""
  52. declare -- EGIT_CHECKOUT_DIR="/var/tmp/portage/sys-fs/go-mtpfs-9999/work/go-mtpfs-9999/src/github.com/h
  53. anwen/go-mtpfs"
  54. declare -- EGIT_CLONE_TYPE="single"
  55. declare -- EGIT_COMMIT=""
  56. declare -x EGIT_DIR="/usr/portage/distfiles/git3-src/hanwen_go-mtpfs.git"
  57. declare -- EGIT_MIN_CLONE_TYPE="shallow"
  58. declare -- EGIT_REPO_URI="https://github.com/hanwen/go-mtpfs.git"
  59. declare -x EGIT_VERSION="64741576bfecbce625480a923229871e0a3bf9c3"
  60. declare -x ELIBC="glibc"
  61. declare -- EPATCH_COMMON_OPTS="-g0 -E --no-backup-if-mismatch"
  62. declare -- EPATCH_EXCLUDE=""
  63. declare -- EPATCH_FORCE="no"
  64. declare -- EPATCH_MULTI_MSG="Applying various patches (bugfixes/updates) ..."
  65. declare -- EPATCH_OPTS=""
  66. declare -- EPATCH_SINGLE_MSG=""
  67. declare -- EPATCH_SOURCE="/var/tmp/portage/sys-fs/go-mtpfs-9999/work/patch"
  68. declare -- EPATCH_SUFFIX="patch.bz2"
  69. declare -x ES_BASHCOMP_DIRS="/usr/share/bash-completion/completions"
  70. declare -x EXEOPTIONS="-m0755"
  71. declare -x FCFLAGS="-O2 -pipe"
  72. declare -x FETCHCOMMAND_SSH="bash -c \"x=\\\${2#ssh://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host
  73. =\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && port=22 ; exec rsync --rsh=\\\"ssh -p\\\${port} \\\${
  74. 3}\\\" -avP \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" rsync \"\${DISTDIR}/\${FILE}\" \"\${URI}\" \
  75. "\${PORTAGE_SSH_OPTS}\""
  76. declare -x FFLAGS="-O2 -pipe"
  77. declare -x FLTK_DOCDIR="/usr/share/doc/fltk-1.3.2/html"
  78. declare -x GCC_SPECS=""
  79. declare -x GDM_LANG="de_DE.UTF-8"
  80. declare -x GOPATH="/var/tmp/portage/sys-fs/go-mtpfs-9999/work/go-mtpfs-9999"
  81. declare -- GO_PN="github.com/hanwen/go-mtpfs"
  82. declare -x GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk330
  83. 1 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmat
  84. e tnt ublox ubx"
  85. declare -x GRUB_PLATFORMS=""
  86. declare -x GSETTINGS_BACKEND="dconf"
  87. declare -x GS_LIB="/home/liki/.fonts"
  88. declare -x GTK2_RC_FILES="/etc/gtk-2.0/gtkrc:/home/liki/.gtkrc-2.0:/home/liki/.kde4/share/config/gtkrc-
  89. 2.0"
  90. declare -x GTK_RC_FILES="/etc/gtk/gtkrc:/home/liki/.gtkrc:/home/liki/.kde4/share/config/gtkrc"
  91. declare -x GUILE_LOAD_PATH="/usr/share/guile/1.8"
  92. declare HDEPEND=""
  93. declare -x HG="/usr/bin/hg"
  94. declare HOMEPAGE="https://github.com/hanwen/go-mtpfs"
  95. declare -x HUSHLOGIN="FALSE"
  96. declare -x INHERITED=" multilib toolchain-funcs eutils git-r3 flag-o-matic"
  97. declare -x INPUT_DEVICES="evdev keyboard mouse"
  98. declare -x INSDESTTREE=""
  99. declare -x INSOPTIONS="-m0644"
  100. declare IUSE=""
  101. declare -x IUSE_EFFECTIVE="abi_x86_64 alpha amd64 amd64-fbsd amd64-linux arm arm-linux arm64 elibc_AIX
  102. elibc_Cygwin elibc_Darwin elibc_DragonFly elibc_FreeBSD elibc_HPUX elibc_Interix elibc_NetBSD elibc_Ope
  103. nBSD elibc_SunOS elibc_Winnt elibc_glibc elibc_mintlib elibc_musl elibc_uclibc hppa hppa-hpux ia64 ia64
  104. -hpux ia64-linux kernel_AIX kernel_Cygwin kernel_Darwin kernel_FreeBSD kernel_HPUX kernel_Interix kerne
  105. l_NetBSD kernel_OpenBSD kernel_SunOS kernel_Winnt kernel_freemint kernel_linux m68k m68k-mint mips ppc
  106. ppc-aix ppc-macos ppc-openbsd ppc64 ppc64-linux prefix prefix-guest s390 sh sparc sparc-fbsd sparc-sola
  107. ris sparc64-freebsd sparc64-solaris userland_BSD userland_GNU x64-freebsd x64-macos x64-openbsd x64-sol
  108. aris x86 x86-cygwin x86-fbsd x86-freebsd x86-interix x86-linux x86-macos x86-netbsd x86-openbsd x86-sol
  109. aris x86-winnt"
  110. declare -x IUSE_IMPLICIT="abi_x86_64 prefix prefix-guest"
  111. declare -x JAVAC="/etc/java-config-2/current-system-vm/bin/javac"
  112. declare -x JAVA_HOME="/etc/java-config-2/current-system-vm"
  113. declare -x JDK_HOME="/etc/java-config-2/current-system-vm"
  114. declare -x KDE_FULL_SESSION="true"
  115. declare -x KDE_MULTIHEAD="false"
  116. declare -x KDE_SESSION_UID="500"
  117. declare -x KDE_SESSION_VERSION="4"
  118. declare -x KERNEL="linux"
  119. declare -x KERNEL_ABI="amd64"
  120. declare -x KEYWORDS=""
  121. declare -x KONSOLE_DBUS_SERVICE=":1.51"
  122. declare -x KONSOLE_DBUS_SESSION="/Sessions/1"
  123. declare -x KONSOLE_PROFILE_NAME="Shell"
  124. declare -x LANG="de_DE.UTF-8"
  125. declare -x LANGUAGE=""
  126. declare -x LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text"
  127. declare -x LC_ADDRESS="de_DE.UTF-8"
  128. declare -x LC_ALL=""
  129. declare -x LC_COLLATE="C"
  130. declare -x LC_CTYPE="de_DE.UTF-8"
  131. declare -x LC_IDENTIFICATION="de_DE.UTF-8"
  132. declare -x LC_MEASUREMENT="de_DE.UTF-8"
  133. declare -x LC_MESSAGES="C"
  134. declare -x LC_MONETARY="de_DE.UTF-8"
  135. declare -x LC_NAME="de_DE.UTF-8"
  136. declare -x LC_NUMERIC="de_DE.UTF-8"
  137. declare -x LC_PAPER="de_DE.UTF-8"
  138. declare -x LC_TELEPHONE="de_DE.UTF-8"
  139. declare -x LC_TIME="de_DE.UTF-8"
  140. declare -x LDFLAGS="-Wl,-O1 -Wl,--as-needed"
  141. declare -x LDFLAGS_amd64="-m elf_x86_64"
  142. declare -x LDFLAGS_default
  143. declare -x LDFLAGS_x32="-m elf32_x86_64"
  144. declare -x LDFLAGS_x86="-m elf_i386"
  145. declare -x LIBDIR_amd64="lib64"
  146. declare -x LIBDIR_amd64_fbsd="lib64"
  147. declare -x LIBDIR_arm="lib"
  148. declare -x LIBDIR_arm64="lib64"
  149. declare -x LIBDIR_default="lib"
  150. declare -x LIBDIR_n32="lib32"
  151. declare -x LIBDIR_n64="lib64"
  152. declare -x LIBDIR_o32="lib"
  153. declare -x LIBDIR_ppc="lib32"
  154. declare -x LIBDIR_ppc64="lib64"
  155. declare -x LIBDIR_s390="lib32"
  156. declare -x LIBDIR_s390x="lib64"
  157. declare -x LIBDIR_sparc32="lib32"
  158. declare -x LIBDIR_sparc64="lib64"
  159. declare -x LIBDIR_x32="libx32"
  160. declare -x LIBDIR_x86="lib32"
  161. declare -x LIBDIR_x86_fbsd="lib32"
  162. declare -x LIBOPTIONS="-m0644"
  163. declare -x LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer"
  164. declare -x LICENSE="BSD"
  165. declare -x LINGUAS="de"
  166. declare -x MAIL="/var/mail/liki"
  167. declare -x MAKEOPTS="-j5"
  168. declare -x MULTILIB_ABIS="amd64 x86"
  169. declare -x MULTILIB_STRICT_DENY="64-bit.*shared object"
  170. declare -x MULTILIB_STRICT_DIRS="/lib32 /lib /usr/lib32 /usr/lib /usr/kde/*/lib32 /usr/kde/*/lib /usr/q
  171. t/*/lib32 /usr/qt/*/lib /usr/X11R6/lib32 /usr/X11R6/lib"
  172. declare -x MULTILIB_STRICT_EXEMPT="(perl5|gcc|gcc-lib|binutils|eclipse-3|debug|portage|udev|systemd|cla
  173. ng|python-exec)"
  174. declare -x MULTIOSDIRS="../lib64:../lib32"
  175. declare -x NETBEANS="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler
  176. soa visualweb webcommon websvccommon xml"
  177. declare -x OFFICE_IMPLEMENTATION="libreoffice"
  178. declare -x OPENCL_PROFILE="nvidia"
  179. declare -x OPENGL_PROFILE="nvidia"
  180. declare -x PATH="/usr/lib/portage/python3.4/ebuild-helpers:/usr/local/sbin:/usr/local/bin:/usr/sbin:/us
  181. r/bin:/sbin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.3:/opt/nvidia-cg-toolkit/bin"
  182. declare PDEPEND=""
  183. declare -x PHP_INI_VERSION="production"
  184. declare -x PHP_TARGETS="php5-3"
  185. declare -x PKG_CONFIG_PATH="/usr/lib64/pkgconfig"
  186. declare -a PORTAGE_DOCOMPRESS='([0]="/usr/share/doc" [1]="/usr/share/info" [2]="/usr/share/man")'
  187. declare -x PORTAGE_DOCOMPRESS_SIZE_LIMIT="128"
  188. declare -a PORTAGE_DOCOMPRESS_SKIP='([0]="/usr/share/doc/go-mtpfs-9999/html")'
  189. declare -x PRELINK_PATH_MASK="/usr/lib64/klibc:/usr/lib64/libfreebl3.so:/usr/lib64/libnssdbm3.so:/usr/l
  190. ib64/libsoftokn3.so:/opt/bin/skype"
  191. declare -x PROFILEHOME=""
  192. declare -x PROFILE_ONLY_VARIABLES="ARCH ELIBC IUSE_IMPLICIT KERNEL USERLAND USE_EXPAND_IMPLICIT USE_EXP
  193. AND_UNPREFIXED USE_EXPAND_VALUES_ARCH USE_EXPAND_VALUES_ELIBC USE_EXPAND_VALUES_KERNEL USE_EXPAND_VALUE
  194. S_USERLAND"
  195. declare -x PROPERTIES=""
  196. declare -x PROVIDE=""
  197. declare -x PYTHONDONTWRITEBYTECODE="1"
  198. declare -x PYTHON_SINGLE_TARGET="python2_7"
  199. declare -x PYTHON_TARGETS="python2_7 python3_4"
  200. declare -- QA_FLAGS_IGNORED="usr/bin/go-mtpfs"
  201. declare -x QT_GRAPHICSSYSTEM="raster"
  202. declare -x QT_PLUGIN_PATH="/usr/lib64/kde4/plugins:/home/liki/.kde4/lib64/kde4/plugins/:/usr/lib64/kde4
  203. /plugins/:/usr/lib64/plugins/"
  204. declare RDEPEND="virtual/libusb
  205. virtual/udev "
  206. declare REPOSITORY
  207. declare REQUIRED_USE=""
  208. declare -x RESTRICT="test"
  209. declare -x RESUMECOMMAND_SSH="bash -c \"x=\\\${2#ssh://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; hos
  210. t=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && port=22 ; exec rsync --rsh=\\\"ssh -p\\\${port} \\\$
  211. {3}\\\" -avP \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" rsync \"\${DISTDIR}/\${FILE}\" \"\${URI}\"
  212. \"\${PORTAGE_SSH_OPTS}\""
  213. declare -x RUBY_TARGETS="ruby19 ruby20"
  214. declare -x R_HOME="/usr/lib64/R"
  215. declare -x S="/var/tmp/portage/sys-fs/go-mtpfs-9999/work/go-mtpfs-9999"
  216. declare -x SANDBOX_DEBUG="0"
  217. declare -x SANDBOX_DENY=""
  218. declare -x SANDBOX_PID="1026"
  219. declare -x SANDBOX_PREDICT="/var/tmp/portage/sys-fs/go-mtpfs-9999/homedir:/dev/crypto:/proc/self/coredu
  220. mp_filter:/var/cache/fontconfig"
  221. declare -x SANDBOX_READ="/:/var/tmp"
  222. declare -x SANDBOX_VERBOSE="1"
  223. declare -x SANDBOX_WRITE=":/dev/console:/dev/fd:/dev/full:/dev/null:/dev/pts/:/dev/pty:/dev/shm:/dev/tt
  224. s:/dev/tty:/dev/vc/:/dev/zero:/proc/self/fd:/tmp/:/usr/lib/cf:/usr/lib/conftest:/usr/lib32/cf:/usr/lib3
  225. 2/conftest:/usr/lib64/cf:/usr/lib64/conftest:/usr/portage/distfiles/git3-src:/usr/tmp/cf:/usr/tmp/conft
  226. est:/var/tmp:/var/tmp/:/var/tmp/portage/sys-fs/go-mtpfs-9999/homedir/.bash_history"
  227. declare -x SANE_BACKENDS="genesys"
  228. declare -x SESSION_MANAGER="local/aldebaran:@/tmp/.ICE-unix/3489,unix/aldebaran:/tmp/.ICE-unix/3489"
  229. declare -x SHELL="/bin/bash"
  230. declare -x SHELL_SESSION_ID="dd781cd25c0640009ebc2b3eee8257a0"
  231. declare -x SLOT="0"
  232. declare SRC_URI
  233. declare -x NETBEANS="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler
  234. soa visualweb webcommon websvccommon xml"
  235. declare -x OFFICE_IMPLEMENTATION="libreoffice"
  236. declare -x OPENCL_PROFILE="nvidia"
  237. declare -x OPENGL_PROFILE="nvidia"
  238. declare -x PATH="/usr/lib/portage/python3.4/ebuild-helpers:/usr/local/sbin:/usr/local/bin:/usr/sbin:/us
  239. r/bin:/sbin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.3:/opt/nvidia-cg-toolkit/bin"
  240. declare PDEPEND=""
  241. declare -x PHP_INI_VERSION="production"
  242. declare -x PHP_TARGETS="php5-3"
  243. declare -x PKG_CONFIG_PATH="/usr/lib64/pkgconfig"
  244. declare -a PORTAGE_DOCOMPRESS='([0]="/usr/share/doc" [1]="/usr/share/info" [2]="/usr/share/man")'
  245. declare -x PORTAGE_DOCOMPRESS_SIZE_LIMIT="128"
  246. declare -a PORTAGE_DOCOMPRESS_SKIP='([0]="/usr/share/doc/go-mtpfs-9999/html")'
  247. declare -x PRELINK_PATH_MASK="/usr/lib64/klibc:/usr/lib64/libfreebl3.so:/usr/lib64/libnssdbm3.so:/usr/l
  248. ib64/libsoftokn3.so:/opt/bin/skype"
  249. declare -x PROFILEHOME=""
  250. declare -x PROFILE_ONLY_VARIABLES="ARCH ELIBC IUSE_IMPLICIT KERNEL USERLAND USE_EXPAND_IMPLICIT USE_EXP
  251. AND_UNPREFIXED USE_EXPAND_VALUES_ARCH USE_EXPAND_VALUES_ELIBC USE_EXPAND_VALUES_KERNEL USE_EXPAND_VALUE
  252. S_USERLAND"
  253. declare -x PROPERTIES=""
  254. declare -x PROVIDE=""
  255. declare -x PYTHONDONTWRITEBYTECODE="1"
  256. declare -x PYTHON_SINGLE_TARGET="python2_7"
  257. declare -x PYTHON_TARGETS="python2_7 python3_4"
  258. declare -- QA_FLAGS_IGNORED="usr/bin/go-mtpfs"
  259. declare -x QT_GRAPHICSSYSTEM="raster"
  260. declare -x QT_PLUGIN_PATH="/usr/lib64/kde4/plugins:/home/liki/.kde4/lib64/kde4/plugins/:/usr/lib64/kde4
  261. /plugins/:/usr/lib64/plugins/"
  262. declare RDEPEND="virtual/libusb
  263. virtual/udev "
  264. declare REPOSITORY
  265. declare REQUIRED_USE=""
  266. declare -x RESTRICT="test"
  267. declare -x RESUMECOMMAND_SSH="bash -c \"x=\\\${2#ssh://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; hos
  268. t=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && port=22 ; exec rsync --rsh=\\\"ssh -p\\\${port} \\\$
  269. {3}\\\" -avP \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" rsync \"\${DISTDIR}/\${FILE}\" \"\${URI}\"
  270. \"\${PORTAGE_SSH_OPTS}\""
  271. declare -x RUBY_TARGETS="ruby19 ruby20"
  272. declare -x R_HOME="/usr/lib64/R"
  273. declare -x S="/var/tmp/portage/sys-fs/go-mtpfs-9999/work/go-mtpfs-9999"
  274. declare -x SANDBOX_DEBUG="0"
  275. declare -x SANDBOX_DENY=""
  276. declare -x SANDBOX_PID="1026"
  277. declare -x SANDBOX_PREDICT="/var/tmp/portage/sys-fs/go-mtpfs-9999/homedir:/dev/crypto:/proc/self/coredu
  278. mp_filter:/var/cache/fontconfig"
  279. declare -x SANDBOX_READ="/:/var/tmp"
  280. declare -x SANDBOX_VERBOSE="1"
  281. declare -x SANDBOX_WRITE=":/dev/console:/dev/fd:/dev/full:/dev/null:/dev/pts/:/dev/pty:/dev/shm:/dev/tt
  282. s:/dev/tty:/dev/vc/:/dev/zero:/proc/self/fd:/tmp/:/usr/lib/cf:/usr/lib/conftest:/usr/lib32/cf:/usr/lib3
  283. 2/conftest:/usr/lib64/cf:/usr/lib64/conftest:/usr/portage/distfiles/git3-src:/usr/tmp/cf:/usr/tmp/conft
  284. est:/var/tmp:/var/tmp/:/var/tmp/portage/sys-fs/go-mtpfs-9999/homedir/.bash_history"
  285. declare -x SANE_BACKENDS="genesys"
  286. declare -x SESSION_MANAGER="local/aldebaran:@/tmp/.ICE-unix/3489,unix/aldebaran:/tmp/.ICE-unix/3489"
  287. declare -x SHELL="/bin/bash"
  288. declare -x SHELL_SESSION_ID="dd781cd25c0640009ebc2b3eee8257a0"
  289. declare -x SLOT="0"
  290. declare SRC_URI
  291. declare -x SYMLINK_LIB="yes"
  292. declare -x USE="abi_x86_64 amd64 elibc_glibc kernel_linux userland_GNU"
  293. declare -x USERLAND="GNU"
  294. declare -x USE_EXPAND_IMPLICIT="ARCH ELIBC KERNEL USERLAND"
  295. declare -x USE_EXPAND_UNPREFIXED="ARCH"
  296. declare -x USE_EXPAND_VALUES_ARCH="alpha amd64 amd64-fbsd amd64-linux arm arm-linux arm64 hppa hppa-hpu
  297. x ia64 ia64-hpux ia64-linux m68k m68k-mint mips ppc ppc64 ppc64-linux ppc-aix ppc-macos ppc-openbsd s39
  298. 0 sh sparc sparc64-freebsd sparc64-solaris sparc-fbsd sparc-solaris x64-freebsd x64-macos x64-openbsd x
  299. 64-solaris x86 x86-cygwin x86-fbsd x86-freebsd x86-interix x86-linux x86-macos x86-netbsd x86-openbsd x
  300. 86-solaris x86-winnt"
  301. declare -x USE_EXPAND_VALUES_ELIBC="AIX Cygwin Darwin DragonFly FreeBSD glibc HPUX Interix mintlib musl
  302. NetBSD OpenBSD SunOS uclibc Winnt"
  303. declare -x USE_EXPAND_VALUES_KERNEL="AIX Cygwin Darwin FreeBSD freemint HPUX Interix linux NetBSD OpenB
  304. SD SunOS Winnt"
  305. declare -x USE_EXPAND_VALUES_USERLAND="BSD GNU"
  306. declare -x VBOX_APP_HOME="/usr/lib64/virtualbox"
  307. declare -x VIDEO_CARDS="nvidia"
  308. declare -x WINDOWID="37748762"
  309. declare -x WINDOWPATH="7"
  310. declare -x XCURSOR_THEME="Oxygen_White"
  311. declare -x XDG_CONFIG_DIRS="/etc/xdg"
  312. declare -x XDG_CURRENT_DESKTOP="KDE"
  313. declare -x XDG_DATA_DIRS="/usr/share:/usr/local/share:/usr/share"
  314. declare -x XDG_SESSION_COOKIE="811a9aa4aa44c5fc8022411a00000014-1423824606.648492-75475604"
  315. declare -x XSESSION="kde"
  316. declare -x XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy co
  317. ndition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
  318. declare -- _EUTILS_ECLASS="1"
  319. declare -x _E_DOCDESTTREE_=""
  320. declare -x _E_EXEDESTTREE_=""
  321. declare -- _FLAG_O_MATIC_ECLASS="1"
  322. declare -- _GIT_R3="1"
  323. declare -- _MULTILIB_ECLASS="1"
  324. declare -- _TOOLCHAIN_FUNCS_ECLASS="1"
  325. declare -- phase_func
  326. __bashpid ()
  327. {
  328. sh -c 'echo ${PPID}'
  329. }
  330. __start_distcc ()
  331. {
  332. if has distcc $FEATURES && has distcc-pump $FEATURES; then
  333. if [[ -z $INCLUDE_SERVER_PORT ]] || [[ ! -w $INCLUDE_SERVER_PORT ]]; then
  334. eval $(pump --startup | grep -v PATH);
  335. trap "pump --shutdown >/dev/null" EXIT;
  336. fi;
  337. fi
  338. }
  339. _eutils_eprefix_init ()
  340. {
  341. has "${EAPI:-0}" 0 1 2 && : ${ED:=${D}} ${EPREFIX:=} ${EROOT:=${ROOT}}
  342. }
  343. _filter-hardened ()
  344. {
  345. local f;
  346. for f in "$@";
  347. do
  348. case "${f}" in
  349. -fPIC | -fpic | -fPIE | -fpie | -Wl,pie | -pie)
  350. gcc-specs-pie || continue;
  351. is-flagq -nopie || append-flags -nopie
  352. ;;
  353. -fstack-protector)
  354. gcc-specs-ssp || continue;
  355. is-flagq -fno-stack-protector || append-flags $(test-flags -fno-stack-protector)
  356. ;;
  357. -fstack-protector-all)
  358. gcc-specs-ssp-to-all || continue;
  359. is-flagq -fno-stack-protector-all || append-flags $(test-flags -fno-stack-protector-all
  360. )
  361. ;;
  362. -fno-strict-overflow)
  363. gcc-specs-nostrict || continue;
  364. is-flagq -fstrict-overflow || append-flags $(test-flags -fstrict-overflow)
  365. ;;
  366. esac;
  367. done
  368. }
  369. _filter-var ()
  370. {
  371. local f x var=$1 new=();
  372. shift;
  373. for f in ${!var};
  374. do
  375. for x in "$@";
  376. do
  377. [[ ${f} == ${x} ]] && continue 2;
  378. done;
  379. new+=("${f}");
  380. done;
  381. eval export ${var}=\""${new[*]}"\"
  382. }
  383. _gcc-install-dir ()
  384. {
  385. echo "$(LC_ALL=C $(tc-getCC) -print-search-dirs 2> /dev/null | awk '$1=="install:" {pr
  386. int $2}')"
  387. }
  388. _gcc-specs-directive_raw ()
  389. {
  390. local cc=$(tc-getCC);
  391. local specfiles=$(LC_ALL=C ${cc} -v 2>&1 | awk '$1=="Reading" {print $NF}');
  392. ${cc} -dumpspecs 2> /dev/null | cat - ${specfiles} | awk -v directive=$1 'BEGIN { pspec=""; spe
  393. c=""; outside=1 }
  394. $1=="*"directive":" { pspec=spec; spec=""; outside=0; next }
  395. outside || NF==0 || ( substr($1,1,1)=="*" && substr($1,length($1),1)==":" ) { outside=1; next }
  396. spec=="" && substr($0,1,1)=="+" { spec=pspec " " substr($0,2); next }
  397. { spec=spec $0 }
  398. END { print spec }';
  399. return 0
  400. }
  401. _gcc-specs-exists ()
  402. {
  403. [[ -f $(_gcc-install-dir)/$1 ]]
  404. }
  405. _gcc_fullversion ()
  406. {
  407. local ver="$1";
  408. shift;
  409. set -- `$(tc-getCPP "$@") -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__"`;
  410. eval echo "$ver"
  411. }
  412. _git-r3_env_setup ()
  413. {
  414. debug-print-function ${FUNCNAME} "$@";
  415. case "${EGIT_CLONE_TYPE}" in
  416. mirror | single+tags | single | shallow)
  417.  
  418. ;;
  419. *)
  420. die "Invalid EGIT_CLONE_TYPE=${EGIT_CLONE_TYPE}"
  421. ;;
  422. esac;
  423. case "${EGIT_MIN_CLONE_TYPE}" in
  424. shallow)
  425.  
  426. ;;
  427. single)
  428. if [[ ${EGIT_CLONE_TYPE} == shallow ]]; then
  429. einfo "git-r3: ebuild needs to be cloned in 'single' mode, adjusting";
  430. EGIT_CLONE_TYPE=single;
  431. fi
  432. ;;
  433. single+tags)
  434. if [[ ${EGIT_CLONE_TYPE} == shallow || ${EGIT_CLONE_TYPE} == single ]]; then
  435. einfo "git-r3: ebuild needs to be cloned in 'single+tags' mode, adjusting";
  436. EGIT_CLONE_TYPE=single+tags;
  437. fi
  438. ;;
  439. mirror)
  440. if [[ ${EGIT_CLONE_TYPE} != mirror ]]; then
  441. einfo "git-r3: ebuild needs to be cloned in 'mirror' mode, adjusting";
  442. EGIT_CLONE_TYPE=mirror;
  443. fi
  444. ;;
  445. *)
  446. die "Invalid EGIT_MIN_CLONE_TYPE=${EGIT_MIN_CLONE_TYPE}"
  447. ;;
  448. esac;
  449. local esc_pn livevar;
  450. esc_pn=${PN//[-+]/_};
  451. livevar=${esc_pn}_LIVE_REPO;
  452. EGIT_REPO_URI=${!livevar:-${EGIT_REPO_URI}};
  453. [[ -n ${!livevar} ]] && ewarn "Using ${livevar}, no support will be provided";
  454. livevar=${esc_pn}_LIVE_BRANCH;
  455. EGIT_BRANCH=${!livevar:-${EGIT_BRANCH}};
  456. [[ -n ${!livevar} ]] && ewarn "Using ${livevar}, no support will be provided";
  457. livevar=${esc_pn}_LIVE_COMMIT;
  458. EGIT_COMMIT=${!livevar:-${EGIT_COMMIT}};
  459. [[ -n ${!livevar} ]] && ewarn "Using ${livevar}, no support will be provided";
  460. if [[ -n ${EGIT_SOURCEDIR} ]]; then
  461. eerror "EGIT_SOURCEDIR has been replaced by EGIT_CHECKOUT_DIR. While updating";
  462. eerror "your ebuild, please check whether the variable is necessary at all";
  463. eerror "since the default has been changed from \${S} to \${WORKDIR}/\${P}.";
  464. eerror "Therefore, proper setting of S may be sufficient.";
  465. die "EGIT_SOURCEDIR has been replaced by EGIT_CHECKOUT_DIR.";
  466. fi;
  467. if [[ -n ${EGIT_MASTER} ]]; then
  468. eerror "EGIT_MASTER has been removed. Instead, the upstream default (HEAD)";
  469. eerror "is used by the eclass. Please remove the assignment or use EGIT_BRANCH";
  470. eerror "as necessary.";
  471. die "EGIT_MASTER has been removed.";
  472. fi;
  473. if [[ -n ${EGIT_HAS_SUBMODULES} ]]; then
  474. eerror "EGIT_HAS_SUBMODULES has been removed. The eclass no longer needs";
  475. eerror "to switch the clone type in order to support submodules and therefore";
  476. eerror "submodules are detected and fetched automatically.";
  477. die "EGIT_HAS_SUBMODULES is no longer necessary.";
  478. fi;
  479. if [[ -n ${EGIT_PROJECT} ]]; then
  480. eerror "EGIT_PROJECT has been removed. Instead, the eclass determines";
  481. eerror "the local clone path using path in canonical EGIT_REPO_URI.";
  482. eerror "If the current algorithm causes issues for you, please report a bug.";
  483. die "EGIT_PROJECT is no longer necessary.";
  484. fi;
  485. if [[ -n ${EGIT_BOOTSTRAP} ]]; then
  486. eerror "EGIT_BOOTSTRAP has been removed. Please create proper src_prepare()";
  487. eerror "instead.";
  488. die "EGIT_BOOTSTRAP has been removed.";
  489. fi;
  490. if [[ -n ${EGIT_NOUNPACK} ]]; then
  491. eerror "EGIT_NOUNPACK has been removed. The eclass no longer calls default";
  492. eerror "unpack function. If necessary, please declare proper src_unpack().";
  493. die "EGIT_NOUNPACK has been removed.";
  494. fi
  495. }
  496. _git-r3_find_head ()
  497. {
  498. debug-print-function ${FUNCNAME} "$@";
  499. local head_ref=${1};
  500. local head_hash=$(git rev-parse --verify "${1}" || die);
  501. local matching_ref;
  502. local h ref;
  503. while read h ref; do
  504. if [[ ${h} == ${head_hash} ]]; then
  505. if [[ ! -n ${matching_ref} || ${ref} == refs/heads/master ]]; then
  506. matching_ref=${ref};
  507. fi;
  508. fi;
  509. done;
  510. if [[ ! -n ${matching_ref} ]]; then
  511. die "Unable to find a matching branch for remote HEAD (${head_hash})";
  512. fi;
  513. echo "${matching_ref}"
  514. }
  515. _git-r3_is_local_repo ()
  516. {
  517. debug-print-function ${FUNCNAME} "$@";
  518. local uri=${1};
  519. [[ ${uri} == file://* || ${uri} == /* ]]
  520. }
  521. _git-r3_set_gitdir ()
  522. {
  523. debug-print-function ${FUNCNAME} "$@";
  524. local repo_name=${1#*://*/};
  525. repo_name=${repo_name%/};
  526. case "${repo_name}" in
  527. browse/*)
  528. repo_name=${repo_name#browse/}
  529. ;;
  530. cgit/*)
  531. repo_name=${repo_name#cgit/}
  532. ;;
  533. git/*)
  534. repo_name=${repo_name#git/}
  535. ;;
  536. gitroot/*)
  537. repo_name=${repo_name#gitroot/}
  538. ;;
  539. p/*)
  540. repo_name=${repo_name#p/}
  541. ;;
  542. pub/scm/*)
  543. repo_name=${repo_name#pub/scm/}
  544. ;;
  545. esac;
  546. repo_name=${repo_name%.git}.git;
  547. repo_name=${repo_name//\//_};
  548. local distdir=${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}};
  549. : ${EGIT3_STORE_DIR:=${distdir}/git3-src};
  550. GIT_DIR=${EGIT3_STORE_DIR}/${repo_name};
  551. if [[ ! -d ${EGIT3_STORE_DIR} ]]; then
  552. ( addwrite /;
  553. mkdir -p "${EGIT3_STORE_DIR}" || die ) || die "Unable to create ${EGIT3_STORE_DIR}";
  554. fi;
  555. addwrite "${EGIT3_STORE_DIR}";
  556. if [[ ! -d ${GIT_DIR} ]]; then
  557. local saved_umask;
  558. if [[ -n ${EVCS_UMASK} ]]; then
  559. saved_umask=$(umask);
  560. umask "${EVCS_UMASK}" || die "Bad options to umask: ${EVCS_UMASK}";
  561. fi;
  562. mkdir "${GIT_DIR}" || die;
  563. git init --bare || die;
  564. if [[ -n ${saved_umask} ]]; then
  565. umask "${saved_umask}" || die;
  566. fi;
  567. fi
  568. }
  569. _git-r3_set_submodules ()
  570. {
  571. debug-print-function ${FUNCNAME} "$@";
  572. local data=${1};
  573. submodules=();
  574. local l;
  575. while read l; do
  576. [[ ${l} == submodule.*.url=* ]] || continue;
  577. l=${l#submodule.};
  578. local subname=${l%%.url=*};
  579. local upd=$(echo "${data}" | git config -f /dev/fd/0 submodule."${subname}".
  580. update);
  581. [[ ${upd} == none ]] && continue;
  582. submodules+=("${subname}" "$(echo "${data}" | git config -f /dev/fd/0 submodule."${subname}".url || die)" "$(echo "${data}" | git config -f /dev/fd/0 submodule."${subname}".path || die)");
  583. done < <(echo "${data}" | git config -f /dev/fd/0 -l || die)
  584. }
  585. _git-r3_set_subrepos ()
  586. {
  587. debug-print-function ${FUNCNAME} "$@";
  588. local suburl=${1};
  589. subrepos=("${@:2}");
  590. if [[ ${suburl} == ./* || ${suburl} == ../* ]]; then
  591. subrepos=("${subrepos[@]%%/}");
  592. while true; do
  593. if [[ ${suburl} == ./* ]]; then
  594. suburl=${suburl:2};
  595. else
  596. if [[ ${suburl} == ../* ]]; then
  597. suburl=${suburl:3};
  598. subrepos=("${subrepos[@]%/*}");
  599. subrepos=("${subrepos[@]%%/}");
  600. else
  601. break;
  602. fi;
  603. fi;
  604. done;
  605. subrepos=("${subrepos[@]/%//${suburl}}");
  606. else
  607. subrepos=("${suburl}");
  608. fi
  609. }
  610. _iconins ()
  611. {
  612. ( local funcname=$1;
  613. shift;
  614. local size dir;
  615. local context=apps;
  616. local theme=hicolor;
  617. while [[ $# -gt 0 ]]; do
  618. case $1 in
  619. -s | --size)
  620. if [[ ${2%%x*}x${2%%x*} == "$2" ]]; then
  621. size=${2%%x*};
  622. else
  623. size=${2};
  624. fi;
  625. case ${size} in
  626. 16 | 22 | 24 | 32 | 36 | 48 | 64 | 72 | 96 | 128 | 192 | 256 | 512)
  627. size=${size}x${size}
  628. ;;
  629. scalable)
  630.  
  631. ;;
  632. *)
  633. eerror "${size} is an unsupported icon size!";
  634. exit 1
  635. ;;
  636. esac;
  637. shift 2
  638. ;;
  639. -t | --theme)
  640. theme=${2};
  641. shift 2
  642. ;;
  643. -c | --context)
  644. context=${2};
  645. shift 2
  646. ;;
  647. *)
  648. if [[ -z ${size} ]]; then
  649. insinto /usr/share/pixmaps;
  650. else
  651. insinto /usr/share/icons/${theme}/${size}/${context};
  652. fi;
  653. if [[ ${funcname} == doicon ]]; then
  654. if [[ -f $1 ]]; then
  655. doins "${1}";
  656. else
  657. if [[ -d $1 ]]; then
  658. shopt -s nullglob;
  659. doins "${1}"/*.{png,svg};
  660. shopt -u nullglob;
  661. else
  662. eerror "${1} is not a valid file/directory!";
  663. exit 1;
  664. fi;
  665. fi;
  666. else
  667. break;
  668. fi;
  669. shift 1
  670. ;;
  671. esac;
  672. done;
  673. if [[ ${funcname} == newicon ]]; then
  674. newins "$@";
  675. fi ) || die
  676. }
  677. _is_flagq ()
  678. {
  679. local x var;
  680. eval var=\""\${$1[*]}"\";
  681. for x in ${var};
  682. do
  683. [[ ${x} == $2 ]] && return 0;
  684. done;
  685. return 1
  686. }
  687. _tc-getPROG ()
  688. {
  689. local tuple=$1;
  690. local v var vars=$2;
  691. local prog=$3;
  692. var=${vars%% *};
  693. for v in ${vars};
  694. do
  695. if [[ -n ${!v} ]]; then
  696. export ${var}="${!v}";
  697. echo "${!v}";
  698. return 0;
  699. fi;
  700. done;
  701. local search=;
  702. [[ -n $4 ]] && search=$(type -p "$4-${prog}");
  703. [[ -z ${search} && -n ${!tuple} ]] && search=$(type -p "${!tuple}-${prog}");
  704. [[ -n ${search} ]] && prog=${search##*/};
  705. export ${var}=${prog};
  706. echo "${!var}"
  707. }
  708. all-flag-vars ()
  709. {
  710. echo {C,CPP,CXX,CCAS,F,FC,LD}FLAGS
  711. }
  712. append-cflags ()
  713. {
  714. [[ $# -eq 0 ]] && return 0;
  715. export CFLAGS+=" $*";
  716. return 0
  717. }
  718. append-cppflags ()
  719. {
  720. [[ $# -eq 0 ]] && return 0;
  721. export CPPFLAGS+=" $*";
  722. return 0
  723. }
  724. append-cxxflags ()
  725. {
  726. [[ $# -eq 0 ]] && return 0;
  727. export CXXFLAGS+=" $*";
  728. return 0
  729. }
  730. append-fflags ()
  731. {
  732. [[ $# -eq 0 ]] && return 0;
  733. export FFLAGS+=" $*";
  734. export FCFLAGS+=" $*";
  735. return 0
  736. }
  737. append-flags ()
  738. {
  739. [[ $# -eq 0 ]] && return 0;
  740. case " $* " in
  741. *' '-[DIU]*)
  742. eqawarn 'please use append-cppflags for preprocessor flags'
  743. ;;
  744. *' '-L* | *' '-Wl,*)
  745. eqawarn 'please use append-ldflags for linker flags'
  746. ;;
  747. esac;
  748. append-cflags "$@";
  749. append-cxxflags "$@";
  750. append-fflags "$@";
  751. return 0
  752. }
  753. append-ldflags ()
  754. {
  755. [[ $# -eq 0 ]] && return 0;
  756. local flag;
  757. for flag in "$@";
  758. do
  759. [[ ${flag} == -l* ]] && eqawarn "Appending a library link instruction (${flag}); libraries to l
  760. ink to should not be passed through LDFLAGS";
  761. done;
  762. export LDFLAGS="${LDFLAGS} $*";
  763. return 0
  764. }
  765. append-lfs-flags ()
  766. {
  767. [[ $# -ne 0 ]] && die "append-lfs-flags takes no arguments";
  768. append-cppflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
  769. }
  770. append-libs ()
  771. {
  772. [[ $# -eq 0 ]] && return 0;
  773. local flag;
  774. for flag in "$@";
  775. do
  776. if [[ -z "${flag// }" ]]; then
  777. eqawarn "Appending an empty argument to LIBS is invalid! Skipping.";
  778. continue;
  779. fi;
  780. case $flag in
  781. -[lL]*)
  782. export LIBS="${LIBS} ${flag}"
  783. ;;
  784. -*)
  785. eqawarn "Appending non-library to LIBS (${flag}); Other linker flags should be passed v
  786. ia LDFLAGS";
  787. export LIBS="${LIBS} ${flag}"
  788. ;;
  789. *)
  790. export LIBS="${LIBS} -l${flag}"
  791. ;;
  792. esac;
  793. done;
  794. return 0
  795. }
  796. built_with_use ()
  797. {
  798. _eutils_eprefix_init;
  799. local hidden="no";
  800. if [[ $1 == "--hidden" ]]; then
  801. hidden="yes";
  802. shift;
  803. fi;
  804. local missing_action="die";
  805. if [[ $1 == "--missing" ]]; then
  806. missing_action=$2;
  807. shift;
  808. shift;
  809. case ${missing_action} in
  810. true | false | die)
  811.  
  812. ;;
  813. *)
  814. die "unknown action '${missing_action}'"
  815. ;;
  816. esac;
  817. fi;
  818. local opt=$1;
  819. [[ ${opt:0:1} = "-" ]] && shift || opt="-a";
  820. local PKG=$(best_version $1);
  821. [[ -z ${PKG} ]] && die "Unable to resolve $1 to an installed package";
  822. shift;
  823. local USEFILE=${EROOT}/var/db/pkg/${PKG}/USE;
  824. local IUSEFILE=${EROOT}/var/db/pkg/${PKG}/IUSE;
  825. if [[ ! -e ${USEFILE} ]] || [[ ! -e ${IUSEFILE} && ${hidden} == "no" ]]; then
  826. case ${missing_action} in
  827. true)
  828. return 0
  829. ;;
  830. false)
  831. return 1
  832. ;;
  833. die)
  834. die "Unable to determine what USE flags $PKG was built with"
  835. ;;
  836. esac;
  837. fi;
  838. if [[ ${hidden} == "no" ]]; then
  839. local IUSE_BUILT=($(<"${IUSEFILE}"));
  840. local expand;
  841. for expand in $(echo ${USE_EXPAND} | tr '[:upper:]' '[:lower:]');
  842. do
  843. if [[ $1 == ${expand}_* ]]; then
  844. expand="";
  845. break;
  846. fi;
  847. done;
  848. if [[ -n ${expand} ]]; then
  849. if ! has $1 ${IUSE_BUILT[@]#[-+]}; then
  850. case ${missing_action} in
  851. true)
  852. return 0
  853. ;;
  854. false)
  855. return 1
  856. ;;
  857. die)
  858. die "$PKG does not actually support the $1 USE flag!"
  859. ;;
  860. esac;
  861. fi;
  862. fi;
  863. fi;
  864. local USE_BUILT=$(<${USEFILE});
  865. while [[ $# -gt 0 ]]; do
  866. if [[ ${opt} = "-o" ]]; then
  867. has $1 ${USE_BUILT} && return 0;
  868. else
  869. has $1 ${USE_BUILT} || return 1;
  870. fi;
  871. shift;
  872. done;
  873. [[ ${opt} = "-a" ]]
  874. }
  875. check_license ()
  876. {
  877. die "you no longer need this as portage supports ACCEPT_LICENSE itself"
  878. }
  879. doicon ()
  880. {
  881. _iconins ${FUNCNAME} "$@"
  882. }
  883. domenu ()
  884. {
  885. ( local i j ret=0;
  886. insinto /usr/share/applications;
  887. for i in "$@";
  888. do
  889. if [[ -f ${i} ]]; then
  890. doins "${i}";
  891. ((ret+=$?));
  892. else
  893. if [[ -d ${i} ]]; then
  894. for j in "${i}"/*.desktop;
  895. do
  896. doins "${j}";
  897. ((ret+=$?));
  898. done;
  899. else
  900. ((++ret));
  901. fi;
  902. fi;
  903. done;
  904. exit ${ret} )
  905. }
  906. ebeep ()
  907. {
  908. ewarn "QA Notice: ebeep is not defined in EAPI=${EAPI}, please file a bug at http://bugs.gentoo.org
  909. "
  910. }
  911. econf_build ()
  912. {
  913. tc-env_build econf --build=${CBUILD:-${CHOST}} "$@"
  914. }
  915. ecvs_clean ()
  916. {
  917. [[ -z $* ]] && set -- .;
  918. find "$@" -type d -name 'CVS' -prune -print0 | xargs -0 rm -rf;
  919. find "$@" -type f -name '.cvs*' -print0 | xargs -0 rm -rf
  920. }
  921. edos2unix ()
  922. {
  923. [[ $# -eq 0 ]] && return 0;
  924. sed -i 's/\r$//' -- "$@" || die
  925. }
  926. einstalldocs ()
  927. {
  928. debug-print-function ${FUNCNAME} "${@}";
  929. local dodoc_opts=-r;
  930. has ${EAPI} 0 1 2 3 && dodoc_opts=;
  931. if ! declare -p DOCS &>/dev/null; then
  932. local d;
  933. for d in README* ChangeLog AUTHORS NEWS TODO CHANGES THANKS BUGS FAQ CREDITS CHANGELOG;
  934. do
  935. if [[ -s ${d} ]]; then
  936. dodoc "${d}" || die;
  937. fi;
  938. done;
  939. else
  940. if [[ $(declare -p DOCS) == "declare -a"* ]]; then
  941. if [[ -n ${DOCS[@]} ]]; then
  942. dodoc ${dodoc_opts} "${DOCS[@]}" || die;
  943. fi;
  944. else
  945. if [[ -n ${DOCS} ]]; then
  946. dodoc ${dodoc_opts} ${DOCS} || die;
  947. fi;
  948. fi;
  949. fi;
  950. if [[ $(declare -p HTML_DOCS 2>/dev/null) == "declare -a"* ]]; then
  951. if [[ -n ${HTML_DOCS[@]} ]]; then
  952. dohtml -r "${HTML_DOCS[@]}" || die;
  953. fi;
  954. else
  955. if [[ -n ${HTML_DOCS} ]]; then
  956. dohtml -r ${HTML_DOCS} || die;
  957. fi;
  958. fi;
  959. return 0
  960. }
  961. emktemp ()
  962. {
  963. local exe="touch";
  964. [[ $1 == -d ]] && exe="mkdir" && shift;
  965. local topdir=$1;
  966. if [[ -z ${topdir} ]]; then
  967. [[ -z ${T} ]] && topdir="/tmp" || topdir=${T};
  968. fi;
  969. if ! type -P mktemp > /dev/null; then
  970. local tmp=/;
  971. while [[ -e ${tmp} ]]; do
  972. tmp=${topdir}/tmp.${RANDOM}.${RANDOM}.${RANDOM};
  973. done;
  974. ${exe} "${tmp}" || ${exe} -p "${tmp}";
  975. echo "${tmp}";
  976. else
  977. if [[ ${exe} == "touch" ]]; then
  978. TMPDIR="${topdir}" mktemp -t tmp.XXXXXXXXXX;
  979. else
  980. TMPDIR="${topdir}" mktemp -dt tmp.XXXXXXXXXX;
  981. fi;
  982. fi
  983. }
  984. epatch ()
  985. {
  986. function _epatch_draw_line ()
  987. {
  988. [[ -z $1 ]] && set "$(printf "%65s" '')";
  989. echo "${1//?/=}"
  990. };
  991. unset P4CONFIG P4PORT P4USER;
  992. local EPATCH_OPTS=(${EPATCH_OPTS[*]});
  993. while [[ $# -gt 0 ]]; do
  994. case $1 in
  995. -*)
  996. EPATCH_OPTS+=("$1")
  997. ;;
  998. *)
  999. break
  1000. ;;
  1001. esac;
  1002. shift;
  1003. done;
  1004. if [[ $# -gt 1 ]]; then
  1005. local m;
  1006. for m in "$@";
  1007. do
  1008. epatch "${m}";
  1009. done;
  1010. return 0;
  1011. fi;
  1012. local SINGLE_PATCH="no";
  1013. [[ $# -eq 0 ]] && set -- "${EPATCH_SOURCE}";
  1014. if [[ -f $1 ]]; then
  1015. SINGLE_PATCH="yes";
  1016. set -- "$1";
  1017. local EPATCH_SUFFIX=$1;
  1018. else
  1019. if [[ -d $1 ]]; then
  1020. evar_push_set LC_COLLATE C;
  1021. set -- "$1"/*${EPATCH_SUFFIX:+."${EPATCH_SUFFIX}"};
  1022. evar_pop;
  1023. else
  1024. if [[ -f ${EPATCH_SOURCE}/$1 ]]; then
  1025. epatch "${EPATCH_SOURCE}/$1";
  1026. return $?;
  1027. else
  1028. [[ $# -ne 0 ]] && EPATCH_SOURCE=$1;
  1029. echo;
  1030. eerror "Cannot find \$EPATCH_SOURCE! Value for \$EPATCH_SOURCE is:";
  1031. eerror;
  1032. eerror " ${EPATCH_SOURCE}";
  1033. eerror " ( ${EPATCH_SOURCE##*/} )";
  1034. echo;
  1035. die "Cannot find \$EPATCH_SOURCE!";
  1036. fi;
  1037. fi;
  1038. fi;
  1039. EPATCH_OPTS="${EPATCH_COMMON_OPTS} ${EPATCH_OPTS[*]}";
  1040. local PIPE_CMD;
  1041. case ${EPATCH_SUFFIX##*\.} in
  1042. xz)
  1043. PIPE_CMD="xz -dc"
  1044. ;;
  1045. lzma)
  1046. PIPE_CMD="lzma -dc"
  1047. ;;
  1048. bz2)
  1049. PIPE_CMD="bzip2 -dc"
  1050. ;;
  1051. gz | Z | z)
  1052. PIPE_CMD="gzip -dc"
  1053. ;;
  1054. ZIP | zip)
  1055. PIPE_CMD="unzip -p"
  1056. ;;
  1057. *)
  1058.  
  1059. ;;
  1060. esac;
  1061. [[ ${SINGLE_PATCH} == "no" ]] && einfo "${EPATCH_MULTI_MSG}";
  1062. local x;
  1063. for x in "$@";
  1064. do
  1065. [[ ! -f ${x} ]] && continue;
  1066. local patchname=${x##*/};
  1067. local a=${patchname#*_};
  1068. a=${a%%_*};
  1069. if ! [[ ${SINGLE_PATCH} == "yes" || ${EPATCH_FORCE} == "yes" || ${a} == all || ${a} == ${ARCH}
  1070. ]]; then
  1071. continue;
  1072. fi;
  1073. if [[ -n ${EPATCH_EXCLUDE}${EPATCH_USER_EXCLUDE} ]]; then
  1074. eshopts_push -o noglob;
  1075. local ex;
  1076. for ex in ${EPATCH_EXCLUDE};
  1077. do
  1078. if [[ ${patchname} == ${ex} ]]; then
  1079. einfo " Skipping ${patchname} due to EPATCH_EXCLUDE ...";
  1080. eshopts_pop;
  1081. continue 2;
  1082. fi;
  1083. done;
  1084. for ex in ${EPATCH_USER_EXCLUDE};
  1085. do
  1086. if [[ ${patchname} == ${ex} ]]; then
  1087. einfo " Skipping ${patchname} due to EPATCH_USER_EXCLUDE ...";
  1088. eshopts_pop;
  1089. continue 2;
  1090. fi;
  1091. done;
  1092. eshopts_pop;
  1093. fi;
  1094. if [[ ${SINGLE_PATCH} == "yes" ]]; then
  1095. if [[ -n ${EPATCH_SINGLE_MSG} ]]; then
  1096. einfo "${EPATCH_SINGLE_MSG}";
  1097. else
  1098. einfo "Applying ${patchname} ...";
  1099. fi;
  1100. else
  1101. einfo " ${patchname} ...";
  1102. fi;
  1103. local STDERR_TARGET="${T}/${patchname}.out";
  1104. if [[ -e ${STDERR_TARGET} ]]; then
  1105. STDERR_TARGET="${T}/${patchname}-$$.out";
  1106. fi;
  1107. printf "***** %s *****\nPWD: %s\n\n" "${patchname}" "${PWD}" > "${STDERR_TARGET}";
  1108. local count=0;
  1109. local PATCH_TARGET;
  1110. if [[ -n ${PIPE_CMD} ]]; then
  1111. PATCH_TARGET="${T}/$$.patch";
  1112. echo "PIPE_COMMAND: ${PIPE_CMD} ${x} > ${PATCH_TARGET}" >> "${STDERR_TARGET}";
  1113. if ! ( ${PIPE_CMD} "${x}" > "${PATCH_TARGET}" ) >> "${STDERR_TARGET}" 2>&1; then
  1114. echo;
  1115. eerror "Could not extract patch!";
  1116. count=5;
  1117. break;
  1118. fi;
  1119. else
  1120. PATCH_TARGET=${x};
  1121. fi;
  1122. local abs_paths=$(egrep -n '^[-+]{3} /' "${PATCH_TARGET}" | awk '$2 != "/dev/null" { print }');
  1123. if [[ -n ${abs_paths} ]]; then
  1124. count=1;
  1125. printf "NOTE: skipping -p0 due to absolute paths in patch:\n%s\n" "${abs_paths}" >> "${STDE
  1126. RR_TARGET}";
  1127. fi;
  1128. local rel_paths=$(egrep -n '^[-+]{3} [^ ]*[.][.]/' "${PATCH_TARGET}");
  1129. if [[ -n ${rel_paths} ]]; then
  1130. echo;
  1131. eerror "Rejected Patch: ${patchname} !";
  1132. eerror " ( ${PATCH_TARGET} )";
  1133. eerror;
  1134. eerror "Your patch uses relative paths '../':";
  1135. eerror "${rel_paths}";
  1136. echo;
  1137. die "you need to fix the relative paths in patch";
  1138. fi;
  1139. local patch_cmd;
  1140. local patch="patch";
  1141. eval $(alias patch 2>/dev/null | sed 's:^alias ::');
  1142. while [[ ${count} -lt 5 ]]; do
  1143. patch_cmd="${patch} -p${count} ${EPATCH_OPTS}";
  1144. ( _epatch_draw_line "***** ${patchname} *****";
  1145. echo;
  1146. echo "PATCH COMMAND: ${patch_cmd} < '${PATCH_TARGET}'";
  1147. echo;
  1148. _epatch_draw_line "***** ${patchname} *****";
  1149. ${patch_cmd} --dry-run -f < "${PATCH_TARGET}" 2>&1;
  1150. ret=$?;
  1151. echo;
  1152. echo "patch program exited with status ${ret}";
  1153. exit ${ret} ) >> "${STDERR_TARGET}";
  1154. if [ $? -eq 0 ]; then
  1155. ( _epatch_draw_line "***** ${patchname} *****";
  1156. echo;
  1157. echo "ACTUALLY APPLYING ${patchname} ...";
  1158. echo;
  1159. _epatch_draw_line "***** ${patchname} *****";
  1160. ${patch_cmd} < "${PATCH_TARGET}" 2>&1;
  1161. ret=$?;
  1162. echo;
  1163. echo "patch program exited with status ${ret}";
  1164. exit ${ret} ) >> "${STDERR_TARGET}";
  1165. if [ $? -ne 0 ]; then
  1166. echo;
  1167. eerror "A dry-run of patch command succeeded, but actually";
  1168. eerror "applying the patch failed!";
  1169. count=5;
  1170. fi;
  1171. break;
  1172. fi;
  1173. : $(( count++ ));
  1174. done;
  1175. if [[ -n ${PIPE_CMD} ]]; then
  1176. rm -f "${PATCH_TARGET}";
  1177. fi;
  1178. if [[ ${count} -ge 5 ]]; then
  1179. echo;
  1180. eerror "Failed Patch: ${patchname} !";
  1181. eerror " ( ${PATCH_TARGET} )";
  1182. eerror;
  1183. eerror "Include in your bugreport the contents of:";
  1184. eerror;
  1185. eerror " ${STDERR_TARGET}";
  1186. echo;
  1187. die "Failed Patch: ${patchname}!";
  1188. fi;
  1189. rm -f "${STDERR_TARGET}";
  1190. cat >> "${T}/epatch.log" <<-EOF
  1191. PATCH: ${x}
  1192. CMD: ${patch_cmd}
  1193. PWD: ${PWD}
  1194.  
  1195. EOF
  1196.  
  1197. eend 0;
  1198. done;
  1199. [[ ${SINGLE_PATCH} == "no" ]] && einfo "Done with patching";
  1200. :
  1201. }
  1202. epatch_user ()
  1203. {
  1204. [[ $# -ne 0 ]] && die "epatch_user takes no options";
  1205. local applied="${T}/epatch_user.log";
  1206. [[ -e ${applied} ]] && return 2;
  1207. local EPATCH_SOURCE check base=${PORTAGE_CONFIGROOT%/}/etc/portage/patches;
  1208. for check in ${CATEGORY}/{${P}-${PR},${P},${PN}}{,:${SLOT}};
  1209. do
  1210. EPATCH_SOURCE=${base}/${CTARGET}/${check};
  1211. [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${base}/${CHOST}/${check};
  1212. [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${base}/${check};
  1213. if [[ -d ${EPATCH_SOURCE} ]]; then
  1214. EPATCH_SOURCE=${EPATCH_SOURCE} EPATCH_SUFFIX="patch" EPATCH_FORCE="yes" EPATCH_MULTI_MSG="A
  1215. pplying user patches from ${EPATCH_SOURCE} ..." epatch;
  1216. echo "${EPATCH_SOURCE}" > "${applied}";
  1217. return 0;
  1218. fi;
  1219. done;
  1220. echo "none" > "${applied}";
  1221. return 1
  1222. }
  1223. epause ()
  1224. {
  1225. ewarn "QA Notice: epause is not defined in EAPI=${EAPI}, please file a bug at http://bugs.gentoo.or
  1226. g"
  1227. }
  1228. epunt_cxx ()
  1229. {
  1230. local dir=$1;
  1231. [[ -z ${dir} ]] && dir=${S};
  1232. ebegin "Removing useless C++ checks";
  1233. local f p any_found;
  1234. while IFS= read -r -d '' f; do
  1235. for p in "${PORTDIR}"/eclass/ELT-patches/nocxx/*.patch;
  1236. do
  1237. if patch --no-backup-if-mismatch -p1 "${f}" "${p}" > /dev/null; then
  1238. any_found=1;
  1239. break;
  1240. fi;
  1241. done;
  1242. done < <(find "${dir}" -name configure -print0);
  1243. if [[ -z ${any_found} ]]; then
  1244. eqawarn "epunt_cxx called unnecessarily (no C++ checks to punt).";
  1245. fi;
  1246. eend 0
  1247. }
  1248. eshopts_pop ()
  1249. {
  1250. local s;
  1251. estack_pop eshopts s || die "${FUNCNAME}: unbalanced push";
  1252. if [[ ${s} == "shopt -"* ]]; then
  1253. eval "${s}" || die "${FUNCNAME}: sanity: invalid shopt options: ${s}";
  1254. else
  1255. set +$- || die "${FUNCNAME}: sanity: invalid shell settings: $-";
  1256. set -${s} || die "${FUNCNAME}: sanity: unable to restore saved shell settings: ${s}";
  1257. fi
  1258. }
  1259. eshopts_push ()
  1260. {
  1261. if [[ $1 == -[su] ]]; then
  1262. estack_push eshopts "$(shopt -p)";
  1263. [[ $# -eq 0 ]] && return 0;
  1264. shopt "$@" || die "${FUNCNAME}: bad options to shopt: $*";
  1265. else
  1266. estack_push eshopts $-;
  1267. [[ $# -eq 0 ]] && return 0;
  1268. set "$@" || die "${FUNCNAME}: bad options to set: $*";
  1269. fi
  1270. }
  1271. estack_pop ()
  1272. {
  1273. [[ $# -eq 0 || $# -gt 2 ]] && die "estack_pop: incorrect # of arguments";
  1274. local _estack_name="_ESTACK_$1_";
  1275. shift;
  1276. local _estack_retvar=$1;
  1277. shift;
  1278. eval local _estack_i=\${#${_estack_name}\[@\]};
  1279. [[ $(( --_estack_i )) -eq -1 ]] && return 1;
  1280. if [[ -n ${_estack_retvar} ]]; then
  1281. eval ${_estack_retvar}=\"\${${_estack_name}\[${_estack_i}\]}\";
  1282. fi;
  1283. eval unset ${_estack_name}\[${_estack_i}\]
  1284. }
  1285. estack_push ()
  1286. {
  1287. [[ $# -eq 0 ]] && die "estack_push: incorrect # of arguments";
  1288. local stack_name="_ESTACK_$1_";
  1289. shift;
  1290. eval ${stack_name}+=\( \"\$@\" \)
  1291. }
  1292. esvn_clean ()
  1293. {
  1294. [[ -z $* ]] && set -- .;
  1295. find "$@" -type d -name '.svn' -prune -print0 | xargs -0 rm -rf
  1296. }
  1297. eumask_pop ()
  1298. {
  1299. [[ $# -eq 0 ]] || die "${FUNCNAME}: we take no options";
  1300. local s;
  1301. estack_pop eumask s || die "${FUNCNAME}: unbalanced push";
  1302. umask ${s} || die "${FUNCNAME}: sanity: could not restore umask: ${s}"
  1303. }
  1304. eumask_push ()
  1305. {
  1306. estack_push eumask "$(umask)";
  1307. umask "$@" || die "${FUNCNAME}: bad options to umask: $*"
  1308. }
  1309. evar_pop ()
  1310. {
  1311. local cnt=${1:-bad};
  1312. case $# in
  1313. 0)
  1314. cnt=1
  1315. ;;
  1316. 1)
  1317. isdigit "${cnt}" || die "${FUNCNAME}: first arg must be a number: $*"
  1318. ;;
  1319. *)
  1320. die "${FUNCNAME}: only accepts one arg: $*"
  1321. ;;
  1322. esac;
  1323. local var val;
  1324. while (( cnt-- )); do
  1325. estack_pop evar val || die "${FUNCNAME}: unbalanced push";
  1326. estack_pop evar var || die "${FUNCNAME}: unbalanced push";
  1327. [[ ${val} == "unset_76fc3c462065bb4ca959f939e6793f94" ]] && unset ${var} || printf -v "${var}"
  1328. '%s' "${val}";
  1329. done
  1330. }
  1331. evar_push ()
  1332. {
  1333. local var val;
  1334. for var in "$@";
  1335. do
  1336. [[ ${!var+set} == "set" ]] && val=${!var} || val="unset_76fc3c462065bb4ca959f939e6793f94";
  1337. estack_push evar "${var}" "${val}";
  1338. done
  1339. }
  1340. evar_push_set ()
  1341. {
  1342. local var=$1;
  1343. evar_push ${var};
  1344. case $# in
  1345. 1)
  1346. unset ${var}
  1347. ;;
  1348. 2)
  1349. printf -v "${var}" '%s' "$2"
  1350. ;;
  1351. *)
  1352. die "${FUNCNAME}: incorrect # of args: $*"
  1353. ;;
  1354. esac
  1355. }
  1356. filter-flags ()
  1357. {
  1358. _filter-hardened "$@";
  1359. local v;
  1360. for v in $(all-flag-vars);
  1361. do
  1362. _filter-var ${v} "$@";
  1363. done;
  1364. return 0
  1365. }
  1366. filter-ldflags ()
  1367. {
  1368. _filter-var LDFLAGS "$@";
  1369. return 0
  1370. }
  1371. filter-lfs-flags ()
  1372. {
  1373. [[ $# -ne 0 ]] && die "filter-lfs-flags takes no arguments";
  1374. filter-flags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
  1375. }
  1376. filter-mfpmath ()
  1377. {
  1378. local orig_mfpmath new_math prune_math;
  1379. orig_mfpmath=$(get-flag -mfpmath);
  1380. new_math=$(get-flag mfpmath);
  1381. new_math=${new_math/both/387,sse};
  1382. new_math=" ${new_math//[,+]/ } ";
  1383. prune_math="";
  1384. for prune_math in "$@";
  1385. do
  1386. new_math=${new_math/ ${prune_math} / };
  1387. done;
  1388. new_math=$(echo ${new_math});
  1389. new_math=${new_math// /,};
  1390. if [[ -z ${new_math} ]]; then
  1391. filter-flags ${orig_mfpmath};
  1392. else
  1393. replace-flags ${orig_mfpmath} -mfpmath=${new_math};
  1394. fi;
  1395. return 0
  1396. }
  1397. gcc-fullversion ()
  1398. {
  1399. _gcc_fullversion '$1.$2.$3' "$@"
  1400. }
  1401. gcc-major-version ()
  1402. {
  1403. _gcc_fullversion '$1' "$@"
  1404. }
  1405. gcc-micro-version ()
  1406. {
  1407. _gcc_fullversion '$3' "$@"
  1408. }
  1409. gcc-minor-version ()
  1410. {
  1411. _gcc_fullversion '$2' "$@"
  1412. }
  1413. gcc-specs-directive ()
  1414. {
  1415. local directive subdname subdirective;
  1416. directive="$(_gcc-specs-directive_raw $1)";
  1417. while [[ ${directive} == *%\(*\)* ]]; do
  1418. subdname=${directive/*%\(};
  1419. subdname=${subdname/\)*};
  1420. subdirective="$(_gcc-specs-directive_raw ${subdname})";
  1421. directive="${directive//\%(${subdname})/${subdirective}}";
  1422. done;
  1423. echo "${directive}";
  1424. return 0
  1425. }
  1426. gcc-specs-nostrict ()
  1427. {
  1428. local directive;
  1429. directive=$(gcc-specs-directive cc1);
  1430. [[ "${directive/\{!fstrict-overflow:}" != "${directive}" ]]
  1431. }
  1432. gcc-specs-now ()
  1433. {
  1434. local directive;
  1435. directive=$(gcc-specs-directive link_command);
  1436. [[ "${directive/\{!nonow:}" != "${directive}" ]]
  1437. }
  1438. gcc-specs-pie ()
  1439. {
  1440. local directive;
  1441. directive=$(gcc-specs-directive cc1);
  1442. [[ "${directive/\{!nopie:}" != "${directive}" ]]
  1443. }
  1444. gcc-specs-relro ()
  1445. {
  1446. local directive;
  1447. directive=$(gcc-specs-directive link_command);
  1448. [[ "${directive/\{!norelro:}" != "${directive}" ]]
  1449. }
  1450. gcc-specs-ssp ()
  1451. {
  1452. local directive;
  1453. directive=$(gcc-specs-directive cc1);
  1454. [[ "${directive/\{!fno-stack-protector:}" != "${directive}" ]]
  1455. }
  1456. gcc-specs-ssp-to-all ()
  1457. {
  1458. local directive;
  1459. directive=$(gcc-specs-directive cc1);
  1460. [[ "${directive/\{!fno-stack-protector-all:}" != "${directive}" ]]
  1461. }
  1462. gcc-specs-stack-check ()
  1463. {
  1464. local directive;
  1465. directive=$(gcc-specs-directive cc1);
  1466. [[ "${directive/\{!fno-stack-check:}" != "${directive}" ]]
  1467. }
  1468. gcc-version ()
  1469. {
  1470. _gcc_fullversion '$1.$2' "$@"
  1471. }
  1472. gen_usr_ldscript ()
  1473. {
  1474. local lib libdir=$(get_libdir) output_format="" auto=false suffix=$(get_libname);
  1475. [[ -z ${ED+set} ]] && local ED=${D%/}${EPREFIX}/;
  1476. tc-is-static-only && return;
  1477. case ${CTARGET:-${CHOST}} in
  1478. *-darwin*)
  1479.  
  1480. ;;
  1481. *linux* | *-freebsd* | *-openbsd* | *-netbsd*)
  1482. use prefix && return 0
  1483. ;;
  1484. *)
  1485. return 0
  1486. ;;
  1487. esac;
  1488. dodir /usr/${libdir};
  1489. if [[ $1 == "-a" ]]; then
  1490. auto=true;
  1491. shift;
  1492. dodir /${libdir};
  1493. fi;
  1494. local flags=(${CFLAGS} ${LDFLAGS} -Wl,--verbose);
  1495. if $(tc-getLD) --version | grep -q 'GNU gold'; then
  1496. local d="${T}/bfd-linker";
  1497. mkdir -p "${d}";
  1498. ln -sf $(which ${CHOST}-ld.bfd) "${d}"/ld;
  1499. flags+=(-B"${d}");
  1500. fi;
  1501. output_format=$($(tc-getCC) "${flags[@]}" 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p');
  1502. [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )";
  1503. for lib in "$@";
  1504. do
  1505. local tlib;
  1506. if ${auto}; then
  1507. lib="lib${lib}${suffix}";
  1508. else
  1509. [[ -r ${ED}/${libdir}/${lib} ]] || continue;
  1510. fi;
  1511. case ${CTARGET:-${CHOST}} in
  1512. *-darwin*)
  1513. if ${auto}; then
  1514. tlib=$(scanmacho -qF'%S#F' "${ED}"/usr/${libdir}/${lib});
  1515. else
  1516. tlib=$(scanmacho -qF'%S#F' "${ED}"/${libdir}/${lib});
  1517. fi;
  1518. [[ -z ${tlib} ]] && die "unable to read install_name from ${lib}";
  1519. tlib=${tlib##*/};
  1520. if ${auto}; then
  1521. mv "${ED}"/usr/${libdir}/${lib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die;
  1522. if [[ ${tlib} != ${lib%${suffix}}.*${suffix#.} ]]; then
  1523. mv "${ED}"/usr/${libdir}/${tlib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || d
  1524. ie;
  1525. fi;
  1526. rm -f "${ED}"/${libdir}/${lib};
  1527. fi;
  1528. if [[ ! -w "${ED}/${libdir}/${tlib}" ]]; then
  1529. chmod u+w "${ED}${libdir}/${tlib}";
  1530. local nowrite=yes;
  1531. fi;
  1532. install_name_tool -id "${EPREFIX}"/${libdir}/${tlib} "${ED}"/${libdir}/${tlib} || die "
  1533. install_name_tool failed";
  1534. [[ -n ${nowrite} ]] && chmod u-w "${ED}${libdir}/${tlib}";
  1535. pushd "${ED}/usr/${libdir}" > /dev/null;
  1536. ln -snf "../../${libdir}/${tlib}" "${lib}";
  1537. popd > /dev/null
  1538. ;;
  1539. *)
  1540. if ${auto}; then
  1541. tlib=$(scanelf -qF'%S#F' "${ED}"/usr/${libdir}/${lib});
  1542. [[ -z ${tlib} ]] && die "unable to read SONAME from ${lib}";
  1543. mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die;
  1544. if [[ ${tlib} != ${lib}* ]]; then
  1545. mv "${ED}"/usr/${libdir}/${tlib}* "${ED}"/${libdir}/ || die;
  1546. fi;
  1547. rm -f "${ED}"/${libdir}/${lib};
  1548. else
  1549. tlib=${lib};
  1550. fi;
  1551. cat > "${ED}/usr/${libdir}/${lib}" <<-END_LDSCRIPT
  1552. /* GNU ld script
  1553. Since Gentoo has critical dynamic libraries in /lib, and the static versions
  1554. in /usr/lib, we need to have a "fake" dynamic lib in /usr/lib, otherwise we
  1555. run into linking problems. This "fake" dynamic lib is a linker script that
  1556. redirects the linker to the real lib. And yes, this works in the cross-
  1557. compiling scenario as the sysroot-ed linker will prepend the real path.
  1558.  
  1559. See bug http://bugs.gentoo.org/4411 for more info.
  1560. */
  1561. ${output_format}
  1562. GROUP ( ${EPREFIX}/${libdir}/${tlib} )
  1563. END_LDSCRIPT
  1564. ;;
  1565. esac
  1566. fperms a+x "/usr/${libdir}/${lib}" || die "could not change perms on ${lib}";
  1567. done
  1568. }
  1569. get-flag ()
  1570. {
  1571. local f var findflag="$1";
  1572. for var in $(all-flag-vars);
  1573. do
  1574. for f in ${!var};
  1575. do
  1576. if [ "${f/${findflag}}" != "${f}" ]; then
  1577. printf "%s\n" "${f/-${findflag}=}";
  1578. return 0;
  1579. fi;
  1580. done;
  1581. done;
  1582. return 1
  1583. }
  1584. get_abi_CFLAGS ()
  1585. {
  1586. get_abi_var CFLAGS "$@"
  1587. }
  1588. get_abi_CHOST ()
  1589. {
  1590. get_abi_var CHOST "$@"
  1591. }
  1592. get_abi_CTARGET ()
  1593. {
  1594. get_abi_var CTARGET "$@"
  1595. }
  1596. get_abi_FAKE_TARGETS ()
  1597. {
  1598. get_abi_var FAKE_TARGETS "$@"
  1599. }
  1600. get_abi_LDFLAGS ()
  1601. {
  1602. get_abi_var LDFLAGS "$@"
  1603. }
  1604. get_abi_LIBDIR ()
  1605. {
  1606. get_abi_var LIBDIR "$@"
  1607. }
  1608. get_abi_var ()
  1609. {
  1610. local flag=$1;
  1611. local abi=${2:-${ABI:-${DEFAULT_ABI:-default}}};
  1612. local var="${flag}_${abi}";
  1613. echo ${!var}
  1614. }
  1615. get_all_abis ()
  1616. {
  1617. local x order="" mvar dvar;
  1618. mvar="MULTILIB_ABIS";
  1619. dvar="DEFAULT_ABI";
  1620. if [[ -n $1 ]]; then
  1621. mvar="$1_${mvar}";
  1622. dvar="$1_${dvar}";
  1623. fi;
  1624. if [[ -z ${!mvar} ]]; then
  1625. echo "default";
  1626. return 0;
  1627. fi;
  1628. for x in ${!mvar};
  1629. do
  1630. if [[ ${x} != ${!dvar} ]]; then
  1631. order="${order:+${order} }${x}";
  1632. fi;
  1633. done;
  1634. order="${order:+${order} }${!dvar}";
  1635. echo ${order};
  1636. return 0
  1637. }
  1638. get_all_libdirs ()
  1639. {
  1640. local libdirs abi;
  1641. for abi in ${MULTILIB_ABIS};
  1642. do
  1643. libdirs+=" $(get_abi_LIBDIR ${abi})";
  1644. done;
  1645. [[ " ${libdirs} " != *" lib "* ]] && libdirs+=" lib";
  1646. echo "${libdirs}"
  1647. }
  1648. get_install_abis ()
  1649. {
  1650. local x order="";
  1651. if [[ -z ${MULTILIB_ABIS} ]]; then
  1652. echo "default";
  1653. return 0;
  1654. fi;
  1655. if [[ ${EMULTILIB_PKG} == "true" ]]; then
  1656. for x in ${MULTILIB_ABIS};
  1657. do
  1658. if [[ ${x} != "${DEFAULT_ABI}" ]]; then
  1659. has ${x} ${ABI_DENY} || order="${order} ${x}";
  1660. fi;
  1661. done;
  1662. has ${DEFAULT_ABI} ${ABI_DENY} || order="${order} ${DEFAULT_ABI}";
  1663. if [[ -n ${ABI_ALLOW} ]]; then
  1664. local ordera="";
  1665. for x in ${order};
  1666. do
  1667. if has ${x} ${ABI_ALLOW}; then
  1668. ordera="${ordera} ${x}";
  1669. fi;
  1670. done;
  1671. order=${ordera};
  1672. fi;
  1673. else
  1674. order=${DEFAULT_ABI};
  1675. fi;
  1676. if [[ -z ${order} ]]; then
  1677. die "The ABI list is empty. Are you using a proper multilib profile? Perhaps your USE flags o
  1678. r MULTILIB_ABIS are too restrictive for this package.";
  1679. fi;
  1680. echo ${order};
  1681. return 0
  1682. }
  1683. get_libdir ()
  1684. {
  1685. local CONF_LIBDIR;
  1686. if [ -n "${CONF_LIBDIR_OVERRIDE}" ]; then
  1687. echo ${CONF_LIBDIR_OVERRIDE};
  1688. else
  1689. get_abi_LIBDIR;
  1690. fi
  1691. }
  1692. get_libname ()
  1693. {
  1694. local libname;
  1695. local ver=$1;
  1696. case ${CHOST} in
  1697. *-cygwin | mingw* | *-mingw*)
  1698. libname="dll"
  1699. ;;
  1700. *-darwin*)
  1701. libname="dylib"
  1702. ;;
  1703. *-mint*)
  1704. libname="irrelevant"
  1705. ;;
  1706. hppa*-hpux*)
  1707. libname="sl"
  1708. ;;
  1709. *)
  1710. libname="so"
  1711. ;;
  1712. esac;
  1713. if [[ -z $* ]]; then
  1714. echo ".${libname}";
  1715. else
  1716. for ver in "$@";
  1717. do
  1718. case ${CHOST} in
  1719. *-darwin*)
  1720. echo ".${ver}.${libname}"
  1721. ;;
  1722. *-mint*)
  1723. echo ".${libname}"
  1724. ;;
  1725. *)
  1726. echo ".${libname}.${ver}"
  1727. ;;
  1728. esac;
  1729. done;
  1730. fi
  1731. }
  1732. get_modname ()
  1733. {
  1734. local modname;
  1735. local ver=$1;
  1736. case ${CHOST} in
  1737. *-darwin*)
  1738. modname="bundle"
  1739. ;;
  1740. *)
  1741. modname="so"
  1742. ;;
  1743. esac;
  1744. echo ".${modname}"
  1745. }
  1746. git-r3_checkout ()
  1747. {
  1748. debug-print-function ${FUNCNAME} "$@";
  1749. local repos;
  1750. if [[ -n ${1} ]]; then
  1751. repos=(${1});
  1752. else
  1753. if [[ $(declare -p EGIT_REPO_URI) == "declare -a"* ]]; then
  1754. repos=("${EGIT_REPO_URI[@]}");
  1755. else
  1756. repos=(${EGIT_REPO_URI});
  1757. fi;
  1758. fi;
  1759. local out_dir=${2:-${EGIT_CHECKOUT_DIR:-${WORKDIR}/${P}}};
  1760. local local_id=${3:-${CATEGORY}/${PN}/${SLOT%/*}};
  1761. local -x GIT_DIR;
  1762. _git-r3_set_gitdir "${repos[0]}";
  1763. einfo "Checking out ${repos[0]} to ${out_dir} ...";
  1764. if ! git cat-file -e refs/git-r3/"${local_id}"/__main__; then
  1765. if [[ -n ${EVCS_OFFLINE} ]]; then
  1766. die "No local clone of ${repos[0]}. Unable to work with EVCS_OFFLINE.";
  1767. else
  1768. die "Logic error: no local clone of ${repos[0]}. git-r3_fetch not used?";
  1769. fi;
  1770. fi;
  1771. local remote_ref=$(
  1772. git symbolic-ref --quiet refs/git-r3/"${local_id}"/__main__
  1773. );
  1774. local new_commit_id=$(
  1775. git rev-parse --verify refs/git-r3/"${local_id}"/__main__
  1776. );
  1777. function git-r3_sub_checkout ()
  1778. {
  1779. local orig_repo=${GIT_DIR};
  1780. local -x GIT_DIR=${out_dir}/.git;
  1781. local -x GIT_WORK_TREE=${out_dir};
  1782. mkdir -p "${out_dir}" || die;
  1783. git init --quiet || die;
  1784. echo "${orig_repo}/objects" > "${GIT_DIR}"/objects/info/alternates || die;
  1785. cp -R "${orig_repo}"/refs/[htn]* "${GIT_DIR}"/refs/ || die;
  1786. if [[ -f ${orig_repo}/shallow ]]; then
  1787. cp "${orig_repo}"/shallow "${GIT_DIR}"/ || die;
  1788. fi;
  1789. set -- git checkout --quiet;
  1790. if [[ -n ${remote_ref} ]]; then
  1791. set -- "${@}" "${remote_ref#refs/heads/}";
  1792. else
  1793. set -- "${@}" "${new_commit_id}";
  1794. fi;
  1795. echo "${@}" 1>&2;
  1796. "${@}" || die "git checkout ${remote_ref:-${new_commit_id}} failed"
  1797. };
  1798. git-r3_sub_checkout;
  1799. local old_commit_id=$(
  1800. git rev-parse --quiet --verify refs/git-r3/"${local_id}"/__old__
  1801. );
  1802. if [[ ! -n ${old_commit_id} ]]; then
  1803. echo "GIT NEW branch -->";
  1804. echo " repository: ${repos[0]}";
  1805. echo " at the commit: ${new_commit_id}";
  1806. else
  1807. echo "GIT update -->";
  1808. echo " repository: ${repos[0]}";
  1809. if [[ "${old_commit_id}" != "${new_commit_id}" ]]; then
  1810. echo " updating from commit: ${old_commit_id}";
  1811. echo " to commit: ${new_commit_id}";
  1812. git --no-pager diff --stat ${old_commit_id}..${new_commit_id};
  1813. else
  1814. echo " at the commit: ${new_commit_id}";
  1815. fi;
  1816. fi;
  1817. git update-ref --no-deref refs/git-r3/"${local_id}"/{__old__,__main__} || die;
  1818. if [[ -f ${out_dir}/.gitmodules ]]; then
  1819. local submodules;
  1820. _git-r3_set_submodules "$(<"${out_dir}"/.gitmodules)";
  1821. while [[ -n ${submodules[@]} ]]; do
  1822. local subname=${submodules[0]};
  1823. local url=${submodules[1]};
  1824. local path=${submodules[2]};
  1825. local subrepos;
  1826. _git-r3_set_subrepos "${url}" "${repos[@]}";
  1827. git-r3_checkout "${subrepos[*]}" "${out_dir}/${path}" "${local_id}/${subname}";
  1828. submodules=("${submodules[@]:3}");
  1829. done;
  1830. fi;
  1831. export EGIT_DIR=${GIT_DIR};
  1832. export EGIT_VERSION=${new_commit_id}
  1833. }
  1834. git-r3_fetch ()
  1835. {
  1836. debug-print-function ${FUNCNAME} "$@";
  1837. [[ -n ${EVCS_OFFLINE} ]] && return;
  1838. local repos;
  1839. if [[ -n ${1} ]]; then
  1840. repos=(${1});
  1841. else
  1842. if [[ $(declare -p EGIT_REPO_URI) == "declare -a"* ]]; then
  1843. repos=("${EGIT_REPO_URI[@]}");
  1844. else
  1845. repos=(${EGIT_REPO_URI});
  1846. fi;
  1847. fi;
  1848. local branch=${EGIT_BRANCH:+refs/heads/${EGIT_BRANCH}};
  1849. local remote_ref=${2:-${EGIT_COMMIT:-${branch:-HEAD}}};
  1850. local local_id=${3:-${CATEGORY}/${PN}/${SLOT%/*}};
  1851. local local_ref=refs/git-r3/${local_id}/__main__;
  1852. [[ -n ${repos[@]} ]] || die "No URI provided and EGIT_REPO_URI unset";
  1853. local -x GIT_DIR;
  1854. _git-r3_set_gitdir "${repos[0]}";
  1855. if [[ -n ${EGIT_MIRROR_URI} ]]; then
  1856. repos=("${EGIT_MIRROR_URI%/}/${GIT_DIR##*/}" "${repos[@]}");
  1857. fi;
  1858. local r success saved_umask;
  1859. if [[ -n ${EVCS_UMASK} ]]; then
  1860. saved_umask=$(umask);
  1861. umask "${EVCS_UMASK}" || die "Bad options to umask: ${EVCS_UMASK}";
  1862. fi;
  1863. for r in "${repos[@]}";
  1864. do
  1865. einfo "Fetching ${r} ...";
  1866. local fetch_command=(git fetch "${r}");
  1867. local clone_type=${EGIT_CLONE_TYPE};
  1868. if [[ ${r} == https://* ]] && ! ROOT=/ has_version 'dev-vcs/git[curl]'; then
  1869. eerror "git-r3: fetching from https:// requested. In order to support https,";
  1870. eerror "dev-vcs/git needs to be built with USE=curl. Example solution:";
  1871. eerror;
  1872. eerror " echo dev-vcs/git curl >> /etc/portage/package.use";
  1873. eerror " emerge -1v dev-vcs/git";
  1874. die "dev-vcs/git built with USE=curl required.";
  1875. fi;
  1876. if [[ ${r} == https://code.google.com/* ]]; then
  1877. if [[ ${clone_type} == shallow ]]; then
  1878. einfo " Google Code does not support shallow clones";
  1879. einfo " using EGIT_CLONE_TYPE=single+tags";
  1880. clone_type=single+tags;
  1881. else
  1882. if [[ ${clone_type} == single ]]; then
  1883. einfo " git-r3: Google Code does not send tags properly in 'single' mode";
  1884. einfo " using EGIT_CLONE_TYPE=single+tags";
  1885. clone_type=single+tags;
  1886. fi;
  1887. fi;
  1888. fi;
  1889. if [[ ${clone_type} == mirror ]]; then
  1890. fetch_command+=(--prune "+refs/heads/*:refs/heads/*" "+refs/tags/*:refs/tags/*" "+refs/note
  1891. s/*:refs/notes/*" "+HEAD:refs/git-r3/HEAD");
  1892. else
  1893. local fetch_l fetch_r;
  1894. if [[ ${remote_ref} == HEAD ]]; then
  1895. fetch_l=HEAD;
  1896. else
  1897. if [[ ${remote_ref} == refs/heads/* ]]; then
  1898. fetch_l=${remote_ref};
  1899. else
  1900. local tagref=$(git ls-remote "${r}" "refs/tags/${remote_ref}");
  1901. if [[ -n ${tagref} ]]; then
  1902. fetch_l=refs/tags/${remote_ref};
  1903. else
  1904. if [[ -n ${branch} ]]; then
  1905. fetch_l=${branch};
  1906. else
  1907. fetch_l=HEAD;
  1908. fi;
  1909. if [[ ${clone_type} == shallow ]]; then
  1910. clone_type=single;
  1911. fi;
  1912. fi;
  1913. fi;
  1914. fi;
  1915. if [[ ${fetch_l} == HEAD ]]; then
  1916. fetch_r=refs/git-r3/HEAD;
  1917. else
  1918. fetch_r=${fetch_l};
  1919. fi;
  1920. fetch_command+=("+${fetch_l}:${fetch_r}");
  1921. if [[ ${clone_type} == single+tags ]]; then
  1922. fetch_command+=("+refs/tags/*:refs/tags/*");
  1923. fi;
  1924. fi;
  1925. if [[ ${clone_type} == shallow ]]; then
  1926. if _git-r3_is_local_repo; then
  1927. clone_type=single;
  1928. else
  1929. if [[ ! -n $(git rev-parse --quiet --verify "${fetch_r}") ]]; then
  1930. fetch_command+=(--depth 1);
  1931. fi;
  1932. fi;
  1933. else
  1934. if [[ -f ${GIT_DIR}/shallow ]]; then
  1935. fetch_command+=(--unshallow);
  1936. fi;
  1937. fi;
  1938. set -- "${fetch_command[@]}";
  1939. echo "${@}" 1>&2;
  1940. if "${@}"; then
  1941. if [[ ${clone_type} == mirror ]]; then
  1942. git symbolic-ref HEAD "$(_git-r3_find_head refs/git-r3/HEAD < <(git show-ref --heads || die))" || die "Unable to update HEAD";
  1943. else
  1944. if [[ ${fetch_l} == HEAD ]]; then
  1945. local head_branch=$(_git-r3_find_head refs/git-r3/HEAD < <(git ls-remote --heads "${r}" || die
  1946. ));
  1947. git update-ref --no-deref "${head_branch}" refs/git-r3/HEAD || die "Unable to sync
  1948. HEAD branch ${head_branch}";
  1949. git symbolic-ref HEAD "${head_branch}" || die "Unable to update HEAD";
  1950. fi;
  1951. fi;
  1952. local full_remote_ref=$(
  1953. git rev-parse --verify --symbolic-full-name "${remote_ref}"
  1954. );
  1955. if [[ -n ${full_remote_ref} ]]; then
  1956. set -- git symbolic-ref "${local_ref}" "${full_remote_ref}";
  1957. else
  1958. set -- git update-ref --no-deref "${local_ref}" "${remote_ref}";
  1959. fi;
  1960. echo "${@}" 1>&2;
  1961. if ! "${@}"; then
  1962. die "Referencing ${remote_ref} failed (wrong ref?).";
  1963. fi;
  1964. success=1;
  1965. break;
  1966. fi;
  1967. done;
  1968. if [[ -n ${saved_umask} ]]; then
  1969. umask "${saved_umask}" || die;
  1970. fi;
  1971. [[ -n ${success} ]] || die "Unable to fetch from any of EGIT_REPO_URI";
  1972. local EGIT_CLONE_TYPE=mirror;
  1973. if git cat-file -e "${local_ref}":.gitmodules &>/dev/null; then
  1974. local submodules;
  1975. _git-r3_set_submodules "$(git cat-file -p "${local_ref}":.gitmodules || die)";
  1976. while [[ -n ${submodules[@]} ]]; do
  1977. local subname=${submodules[0]};
  1978. local url=${submodules[1]};
  1979. local path=${submodules[2]};
  1980. local commit=$(git rev-parse "${local_ref}:${path}");
  1981. if [[ ! -n ${commit} ]]; then
  1982. die "Unable to get commit id for submodule ${subname}";
  1983. fi;
  1984. local subrepos;
  1985. _git-r3_set_subrepos "${url}" "${repos[@]}";
  1986. git-r3_fetch "${subrepos[*]}" "${commit}" "${local_id}/${subname}";
  1987. submodules=("${submodules[@]:3}");
  1988. done;
  1989. fi
  1990. }
  1991. git-r3_peek_remote_ref ()
  1992. {
  1993. debug-print-function ${FUNCNAME} "$@";
  1994. local repos;
  1995. if [[ -n ${1} ]]; then
  1996. repos=(${1});
  1997. else
  1998. if [[ $(declare -p EGIT_REPO_URI) == "declare -a"* ]]; then
  1999. repos=("${EGIT_REPO_URI[@]}");
  2000. else
  2001. repos=(${EGIT_REPO_URI});
  2002. fi;
  2003. fi;
  2004. local branch=${EGIT_BRANCH:+refs/heads/${EGIT_BRANCH}};
  2005. local remote_ref=${2:-${EGIT_COMMIT:-${branch:-HEAD}}};
  2006. [[ -n ${repos[@]} ]] || die "No URI provided and EGIT_REPO_URI unset";
  2007. local r success;
  2008. for r in "${repos[@]}";
  2009. do
  2010. einfo "Peeking ${remote_ref} on ${r} ..." 1>&2;
  2011. local is_branch lookup_ref;
  2012. if [[ ${remote_ref} == refs/heads/* || ${remote_ref} == HEAD ]]; then
  2013. is_branch=1;
  2014. lookup_ref=${remote_ref};
  2015. else
  2016. lookup_ref=refs/tags/${remote_ref};
  2017. fi;
  2018. local ref=($(git ls-remote "${r}" "${lookup_ref}"));
  2019. if [[ -n ${ref[0]} ]]; then
  2020. echo "${ref[0]}";
  2021. return 0;
  2022. fi;
  2023. done;
  2024. return 1
  2025. }
  2026. git-r3_pkg_outofdate ()
  2027. {
  2028. debug-print-function ${FUNCNAME} "$@";
  2029. local new_commit_id=$(git-r3_peek_remote_ref);
  2030. ewarn "old: ${EGIT_VERSION}";
  2031. ewarn "new: ${new_commit_id}";
  2032. [[ -n ${new_commit_id} && -n ${old_commit_id} ]] || return 2;
  2033. [[ ${EGIT_VERSION} != ${new_commit_id} ]]
  2034. }
  2035. git-r3_src_fetch ()
  2036. {
  2037. debug-print-function ${FUNCNAME} "$@";
  2038. if [[ ! -n ${EGIT3_STORE_DIR} && -n ${EGIT_STORE_DIR} ]]; then
  2039. ewarn "You have set EGIT_STORE_DIR but not EGIT3_STORE_DIR. Please consider";
  2040. ewarn "setting EGIT3_STORE_DIR for git-r3.eclass. It is recommended to use";
  2041. ewarn "a different directory than EGIT_STORE_DIR to ease removing old clones";
  2042. ewarn "when git-2 eclass becomes deprecated.";
  2043. fi;
  2044. _git-r3_env_setup;
  2045. git-r3_fetch
  2046. }
  2047. git-r3_src_unpack ()
  2048. {
  2049. debug-print-function ${FUNCNAME} "$@";
  2050. _git-r3_env_setup;
  2051. git-r3_src_fetch;
  2052. git-r3_checkout
  2053. }
  2054. git-r3_sub_checkout ()
  2055. {
  2056. local orig_repo=${GIT_DIR};
  2057. local -x GIT_DIR=${out_dir}/.git;
  2058. local -x GIT_WORK_TREE=${out_dir};
  2059. mkdir -p "${out_dir}" || die;
  2060. git init --quiet || die;
  2061. echo "${orig_repo}/objects" > "${GIT_DIR}"/objects/info/alternates || die;
  2062. cp -R "${orig_repo}"/refs/[htn]* "${GIT_DIR}"/refs/ || die;
  2063. if [[ -f ${orig_repo}/shallow ]]; then
  2064. cp "${orig_repo}"/shallow "${GIT_DIR}"/ || die;
  2065. fi;
  2066. set -- git checkout --quiet;
  2067. if [[ -n ${remote_ref} ]]; then
  2068. set -- "${@}" "${remote_ref#refs/heads/}";
  2069. else
  2070. set -- "${@}" "${new_commit_id}";
  2071. fi;
  2072. echo "${@}" 1>&2;
  2073. "${@}" || die "git checkout ${remote_ref:-${new_commit_id}} failed"
  2074. }
  2075. has_m32 ()
  2076. {
  2077. die "${FUNCNAME}: don't use this anymore"
  2078. }
  2079. has_m64 ()
  2080. {
  2081. eqawarn "${FUNCNAME}: don't use this anymore";
  2082. local temp="$(emktemp)";
  2083. echo "int main() { return(0); }" > "${temp}".c;
  2084. MY_CC=$(tc-getCC);
  2085. ${MY_CC/ .*/} -m64 -o "$(emktemp)" "${temp}".c > /dev/null 2>&1;
  2086. local ret=$?;
  2087. rm -f "${temp}".c;
  2088. [[ ${ret} != 1 ]] && return 0;
  2089. return 1
  2090. }
  2091. has_multilib_profile ()
  2092. {
  2093. [ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ]
  2094. }
  2095. in_iuse ()
  2096. {
  2097. debug-print-function ${FUNCNAME} "${@}";
  2098. [[ ${#} -eq 1 ]] || die "Invalid args to ${FUNCNAME}()";
  2099. local flag=${1};
  2100. local liuse=(${IUSE});
  2101. has "${flag}" "${liuse[@]#[+-]}"
  2102. }
  2103. is-flag ()
  2104. {
  2105. is-flagq "$@" && echo true
  2106. }
  2107. is-flagq ()
  2108. {
  2109. [[ -n $2 ]] && die "Usage: is-flag <flag>";
  2110. local var;
  2111. for var in $(all-flag-vars);
  2112. do
  2113. _is_flagq ${var} "$1" && return 0;
  2114. done;
  2115. return 1
  2116. }
  2117. is-ldflag ()
  2118. {
  2119. is-ldflagq "$@" && echo true
  2120. }
  2121. is-ldflagq ()
  2122. {
  2123. [[ -n $2 ]] && die "Usage: is-ldflag <flag>";
  2124. _is_flagq LDFLAGS $1
  2125. }
  2126. is_final_abi ()
  2127. {
  2128. has_multilib_profile || return 0;
  2129. set -- $(get_install_abis);
  2130. local LAST_ABI=$#;
  2131. [[ ${!LAST_ABI} == ${ABI} ]]
  2132. }
  2133. isdigit ()
  2134. {
  2135. local d;
  2136. for d in "$@";
  2137. do
  2138. [[ ${d:-bad} == *[!0-9]* ]] && return 1;
  2139. done;
  2140. return 0
  2141. }
  2142. make_desktop_entry ()
  2143. {
  2144. [[ -z $1 ]] && die "make_desktop_entry: You must specify the executable";
  2145. local exec=${1};
  2146. local name=${2:-${PN}};
  2147. local icon=${3:-${PN}};
  2148. local type=${4};
  2149. local fields=${5};
  2150. if [[ -z ${type} ]]; then
  2151. local catmaj=${CATEGORY%%-*};
  2152. local catmin=${CATEGORY##*-};
  2153. case ${catmaj} in
  2154. app)
  2155. case ${catmin} in
  2156. accessibility)
  2157. type="Utility;Accessibility"
  2158. ;;
  2159. admin)
  2160. type=System
  2161. ;;
  2162. antivirus)
  2163. type=System
  2164. ;;
  2165. arch)
  2166. type="Utility;Archiving"
  2167. ;;
  2168. backup)
  2169. type="Utility;Archiving"
  2170. ;;
  2171. cdr)
  2172. type="AudioVideo;DiscBurning"
  2173. ;;
  2174. dicts)
  2175. type="Office;Dictionary"
  2176. ;;
  2177. doc)
  2178. type=Documentation
  2179. ;;
  2180. editors)
  2181. type="Utility;TextEditor"
  2182. ;;
  2183. emacs)
  2184. type="Development;TextEditor"
  2185. ;;
  2186. emulation)
  2187. type="System;Emulator"
  2188. ;;
  2189. laptop)
  2190. type="Settings;HardwareSettings"
  2191. ;;
  2192. office)
  2193. type=Office
  2194. ;;
  2195. pda)
  2196. type="Office;PDA"
  2197. ;;
  2198. vim)
  2199. type="Development;TextEditor"
  2200. ;;
  2201. xemacs)
  2202. type="Development;TextEditor"
  2203. ;;
  2204. esac
  2205. ;;
  2206. dev)
  2207. type="Development"
  2208. ;;
  2209. games)
  2210. case ${catmin} in
  2211. action | fps)
  2212. type=ActionGame
  2213. ;;
  2214. arcade)
  2215. type=ArcadeGame
  2216. ;;
  2217. board)
  2218. type=BoardGame
  2219. ;;
  2220. emulation)
  2221. type=Emulator
  2222. ;;
  2223. kids)
  2224. type=KidsGame
  2225. ;;
  2226. puzzle)
  2227. type=LogicGame
  2228. ;;
  2229. roguelike)
  2230. type=RolePlaying
  2231. ;;
  2232. rpg)
  2233. type=RolePlaying
  2234. ;;
  2235. simulation)
  2236. type=Simulation
  2237. ;;
  2238. sports)
  2239. type=SportsGame
  2240. ;;
  2241. strategy)
  2242. type=StrategyGame
  2243. ;;
  2244. esac;
  2245. type="Game;${type}"
  2246. ;;
  2247. gnome)
  2248. type="Gnome;GTK"
  2249. ;;
  2250. kde)
  2251. type="KDE;Qt"
  2252. ;;
  2253. mail)
  2254. type="Network;Email"
  2255. ;;
  2256. media)
  2257. case ${catmin} in
  2258. gfx)
  2259. type=Graphics
  2260. ;;
  2261. *)
  2262. case ${catmin} in
  2263. radio)
  2264. type=Tuner
  2265. ;;
  2266. sound)
  2267. type=Audio
  2268. ;;
  2269. tv)
  2270. type=TV
  2271. ;;
  2272. video)
  2273. type=Video
  2274. ;;
  2275. esac;
  2276. type="AudioVideo;${type}"
  2277. ;;
  2278. esac
  2279. ;;
  2280. net)
  2281. case ${catmin} in
  2282. dialup)
  2283. type=Dialup
  2284. ;;
  2285. ftp)
  2286. type=FileTransfer
  2287. ;;
  2288. im)
  2289. type=InstantMessaging
  2290. ;;
  2291. irc)
  2292. type=IRCClient
  2293. ;;
  2294. mail)
  2295. type=Email
  2296. ;;
  2297. news)
  2298. type=News
  2299. ;;
  2300. nntp)
  2301. type=News
  2302. ;;
  2303. p2p)
  2304. type=FileTransfer
  2305. ;;
  2306. voip)
  2307. type=Telephony
  2308. ;;
  2309. esac;
  2310. type="Network;${type}"
  2311. ;;
  2312. sci)
  2313. case ${catmin} in
  2314. astro*)
  2315. type=Astronomy
  2316. ;;
  2317. bio*)
  2318. type=Biology
  2319. ;;
  2320. calc*)
  2321. type=Calculator
  2322. ;;
  2323. chem*)
  2324. type=Chemistry
  2325. ;;
  2326. elec*)
  2327. type=Electronics
  2328. ;;
  2329. geo*)
  2330. type=Geology
  2331. ;;
  2332. math*)
  2333. type=Math
  2334. ;;
  2335. physics)
  2336. type=Physics
  2337. ;;
  2338. visual*)
  2339. type=DataVisualization
  2340. ;;
  2341. esac;
  2342. type="Education;Science;${type}"
  2343. ;;
  2344. sys)
  2345. type="System"
  2346. ;;
  2347. www)
  2348. case ${catmin} in
  2349. client)
  2350. type=WebBrowser
  2351. ;;
  2352. esac;
  2353. type="Network;${type}"
  2354. ;;
  2355. *)
  2356. type=
  2357. ;;
  2358. esac;
  2359. fi;
  2360. local slot=${SLOT%/*};
  2361. if [[ ${slot} == "0" ]]; then
  2362. local desktop_name="${PN}";
  2363. else
  2364. local desktop_name="${PN}-${slot}";
  2365. fi;
  2366. local desktop="${T}/$(echo ${exec} | sed 's:[[:space:]/:]:_:g')-${desktop_name}.desktop";
  2367. type=${type%;}${type:+;};
  2368. eshopts_push -s extglob;
  2369. if [[ -n ${icon} && ${icon} != /* ]] && [[ ${icon} == *.xpm || ${icon} == *.png || ${icon} == *.svg
  2370. ]]; then
  2371. ewarn "As described in the Icon Theme Specification, icon file extensions are not";
  2372. ewarn "allowed in .desktop files if the value is not an absolute path.";
  2373. icon=${icon%.@(xpm|png|svg)};
  2374. fi;
  2375. eshopts_pop;
  2376. cat > "${desktop}" <<-EOF
  2377. [Desktop Entry]
  2378. Name=${name}
  2379. Type=Application
  2380. Comment=${DESCRIPTION}
  2381. Exec=${exec}
  2382. TryExec=${exec%% *}
  2383. Icon=${icon}
  2384. Categories=${type}
  2385. EOF
  2386.  
  2387. if [[ ${fields:-=} != *=* ]]; then
  2388. ewarn "make_desktop_entry: update your 5th arg to read Path=${fields}";
  2389. fields="Path=${fields}";
  2390. fi;
  2391. [[ -n ${fields} ]] && printf '%b\n' "${fields}" >> "${desktop}";
  2392. ( insinto /usr/share/applications;
  2393. doins "${desktop}" ) || die "installing desktop file failed"
  2394. }
  2395. make_session_desktop ()
  2396. {
  2397. [[ -z $1 ]] && eerror "$0: You must specify the title" && return 1;
  2398. [[ -z $2 ]] && eerror "$0: You must specify the command" && return 1;
  2399. local title=$1;
  2400. local command=$2;
  2401. local desktop=${T}/${wm:-${PN}}.desktop;
  2402. shift 2;
  2403. cat > "${desktop}" <<-EOF
  2404. [Desktop Entry]
  2405. Name=${title}
  2406. Comment=This session logs you into ${title}
  2407. Exec=${command} $*
  2408. TryExec=${command}
  2409. Type=XSession
  2410. EOF
  2411.  
  2412. ( insinto /usr/share/xsessions;
  2413. doins "${desktop}" )
  2414. }
  2415. make_wrapper ()
  2416. {
  2417. _eutils_eprefix_init;
  2418. local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5;
  2419. local tmpwrapper=$(emktemp);
  2420. ( echo '#!/bin/sh';
  2421. [[ -n ${chdir} ]] && printf 'cd "%s"\n' "${EPREFIX}${chdir}";
  2422. if [[ -n ${libdir} ]]; then
  2423. local var;
  2424. if [[ ${CHOST} == *-darwin* ]]; then
  2425. var=DYLD_LIBRARY_PATH;
  2426. else
  2427. var=LD_LIBRARY_PATH;
  2428. fi;
  2429. cat <<-EOF
  2430. if [ "\${${var}+set}" = "set" ] ; then
  2431. export ${var}="\${${var}}:${EPREFIX}${libdir}"
  2432. else
  2433. export ${var}="${EPREFIX}${libdir}"
  2434. fi
  2435. EOF
  2436.  
  2437. fi
  2438. printf 'exec %s "$@"\n' "${bin/#\//${EPREFIX}/}" ) > "${tmpwrapper}";
  2439. chmod go+rx "${tmpwrapper}";
  2440. if [[ -n ${path} ]]; then
  2441. ( exeinto "${path}";
  2442. newexe "${tmpwrapper}" "${wrapper}" ) || die;
  2443. else
  2444. newbin "${tmpwrapper}" "${wrapper}" || die;
  2445. fi
  2446. }
  2447. multilib_env ()
  2448. {
  2449. local CTARGET=${1:-${CTARGET}};
  2450. local cpu=${CTARGET%%*-};
  2451. case ${cpu} in
  2452. aarch64*)
  2453. export CFLAGS_arm=${CFLAGS_arm-};
  2454. case ${cpu} in
  2455. aarch64*be)
  2456. export CHOST_arm="armv8b-${CTARGET#*-}"
  2457. ;;
  2458. *)
  2459. export CHOST_arm="armv8l-${CTARGET#*-}"
  2460. ;;
  2461. esac;
  2462. CHOST_arm=${CHOST_arm/%-gnu/-gnueabi};
  2463. export CTARGET_arm=${CHOST_arm};
  2464. export LIBDIR_arm="lib";
  2465. export CFLAGS_arm64=${CFLAGS_arm64-};
  2466. export CHOST_arm64=${CTARGET};
  2467. export CTARGET_arm64=${CHOST_arm64};
  2468. export LIBDIR_arm64="lib64";
  2469. : ${MULTILIB_ABIS=arm64};
  2470. : ${DEFAULT_ABI=arm64}
  2471. ;;
  2472. x86_64*)
  2473. export CFLAGS_x86=${CFLAGS_x86--m32};
  2474. export CHOST_x86=${CTARGET/x86_64/i686};
  2475. CHOST_x86=${CHOST_x86/%-gnux32/-gnu};
  2476. export CTARGET_x86=${CHOST_x86};
  2477. if [[ ${SYMLINK_LIB} == "yes" ]]; then
  2478. export LIBDIR_x86="lib32";
  2479. else
  2480. export LIBDIR_x86="lib";
  2481. fi;
  2482. export CFLAGS_amd64=${CFLAGS_amd64--m64};
  2483. export CHOST_amd64=${CTARGET/%-gnux32/-gnu};
  2484. export CTARGET_amd64=${CHOST_amd64};
  2485. export LIBDIR_amd64="lib64";
  2486. export CFLAGS_x32=${CFLAGS_x32--mx32};
  2487. export CHOST_x32=${CTARGET/%-gnu/-gnux32};
  2488. export CTARGET_x32=${CHOST_x32};
  2489. export LIBDIR_x32="libx32";
  2490. case ${CTARGET} in
  2491. *-gnux32)
  2492. : ${MULTILIB_ABIS=x32 amd64 x86};
  2493. : ${DEFAULT_ABI=x32}
  2494. ;;
  2495. *)
  2496. : ${MULTILIB_ABIS=amd64 x86};
  2497. : ${DEFAULT_ABI=amd64}
  2498. ;;
  2499. esac
  2500. ;;
  2501. mips64*)
  2502. export CFLAGS_o32=${CFLAGS_o32--mabi=32};
  2503. export CHOST_o32=${CTARGET/mips64/mips};
  2504. export CTARGET_o32=${CHOST_o32};
  2505. export LIBDIR_o32="lib";
  2506. export CFLAGS_n32=${CFLAGS_n32--mabi=n32};
  2507. export CHOST_n32=${CTARGET};
  2508. export CTARGET_n32=${CHOST_n32};
  2509. export LIBDIR_n32="lib32";
  2510. export CFLAGS_n64=${CFLAGS_n64--mabi=64};
  2511. export CHOST_n64=${CTARGET};
  2512. export CTARGET_n64=${CHOST_n64};
  2513. export LIBDIR_n64="lib64";
  2514. : ${MULTILIB_ABIS=n64 n32 o32};
  2515. : ${DEFAULT_ABI=n32}
  2516. ;;
  2517. powerpc64*)
  2518. export CFLAGS_ppc=${CFLAGS_ppc--m32};
  2519. export CHOST_ppc=${CTARGET/powerpc64/powerpc};
  2520. export CTARGET_ppc=${CHOST_ppc};
  2521. export LIBDIR_ppc="lib";
  2522. export CFLAGS_ppc64=${CFLAGS_ppc64--m64};
  2523. export CHOST_ppc64=${CTARGET};
  2524. export CTARGET_ppc64=${CHOST_ppc64};
  2525. export LIBDIR_ppc64="lib64";
  2526. : ${MULTILIB_ABIS=ppc64 ppc};
  2527. : ${DEFAULT_ABI=ppc64}
  2528. ;;
  2529. s390x*)
  2530. export CFLAGS_s390=${CFLAGS_s390--m31};
  2531. export CHOST_s390=${CTARGET/s390x/s390};
  2532. export CTARGET_s390=${CHOST_s390};
  2533. export LIBDIR_s390="lib";
  2534. export CFLAGS_s390x=${CFLAGS_s390x--m64};
  2535. export CHOST_s390x=${CTARGET};
  2536. export CTARGET_s390x=${CHOST_s390x};
  2537. export LIBDIR_s390x="lib64";
  2538. : ${MULTILIB_ABIS=s390x s390};
  2539. : ${DEFAULT_ABI=s390x}
  2540. ;;
  2541. sparc64*)
  2542. export CFLAGS_sparc32=${CFLAGS_sparc32--m32};
  2543. export CHOST_sparc32=${CTARGET/sparc64/sparc};
  2544. export CTARGET_sparc32=${CHOST_sparc32};
  2545. export LIBDIR_sparc32="lib";
  2546. export CFLAGS_sparc64=${CFLAGS_sparc64--m64};
  2547. export CHOST_sparc64=${CTARGET};
  2548. export CTARGET_sparc64=${CHOST_sparc64};
  2549. export LIBDIR_sparc64="lib64";
  2550. : ${MULTILIB_ABIS=sparc64 sparc32};
  2551. : ${DEFAULT_ABI=sparc64}
  2552. ;;
  2553. *)
  2554. : ${MULTILIB_ABIS=default};
  2555. : ${DEFAULT_ABI=default}
  2556. ;;
  2557. esac;
  2558. export MULTILIB_ABIS DEFAULT_ABI
  2559. }
  2560. multilib_toolchain_setup ()
  2561. {
  2562. local v vv;
  2563. export ABI=$1;
  2564. if [[ ${_DEFAULT_ABI_SAVED} == "true" ]]; then
  2565. for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH};
  2566. do
  2567. vv="_abi_saved_${v}";
  2568. [[ ${!vv+set} == "set" ]] && export ${v}="${!vv}" || unset ${v};
  2569. unset ${vv};
  2570. done;
  2571. unset _DEFAULT_ABI_SAVED;
  2572. fi;
  2573. if [[ ${ABI} != ${DEFAULT_ABI} ]]; then
  2574. for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH};
  2575. do
  2576. vv="_abi_saved_${v}";
  2577. [[ ${!v+set} == "set" ]] && export ${vv}="${!v}" || unset ${vv};
  2578. done;
  2579. export _DEFAULT_ABI_SAVED="true";
  2580. export CHOST=$(get_abi_CHOST ${DEFAULT_ABI});
  2581. export CC="$(tc-getCC) $(get_abi_CFLAGS)";
  2582. export CXX="$(tc-getCXX) $(get_abi_CFLAGS)";
  2583. export LD="$(tc-getLD) $(get_abi_LDFLAGS)";
  2584. export CHOST=$(get_abi_CHOST $1);
  2585. export CBUILD=$(get_abi_CHOST $1);
  2586. export PKG_CONFIG_LIBDIR=${EPREFIX}/usr/$(get_libdir)/pkgconfig;
  2587. export PKG_CONFIG_PATH=${EPREFIX}/usr/share/pkgconfig;
  2588. fi
  2589. }
  2590. newicon ()
  2591. {
  2592. _iconins ${FUNCNAME} "$@"
  2593. }
  2594. newmenu ()
  2595. {
  2596. ( insinto /usr/share/applications;
  2597. newins "$@" )
  2598. }
  2599. no-as-needed ()
  2600. {
  2601. case $($(tc-getLD) -v 2>&1 </dev/null) in
  2602. *GNU*)
  2603. echo "-Wl,--no-as-needed"
  2604. ;;
  2605. esac
  2606. }
  2607. number_abis ()
  2608. {
  2609. set -- `get_install_abis`;
  2610. echo $#
  2611. }
  2612. optfeature ()
  2613. {
  2614. debug-print-function ${FUNCNAME} "$@";
  2615. local i j msg;
  2616. local desc=$1;
  2617. local flag=0;
  2618. shift;
  2619. for i in "$@";
  2620. do
  2621. for j in ${i};
  2622. do
  2623. if has_version "${j}"; then
  2624. flag=1;
  2625. else
  2626. flag=0;
  2627. break;
  2628. fi;
  2629. done;
  2630. if [[ ${flag} -eq 1 ]]; then
  2631. break;
  2632. fi;
  2633. done;
  2634. if [[ ${flag} -eq 0 ]]; then
  2635. for i in "$@";
  2636. do
  2637. msg=" ";
  2638. for j in ${i};
  2639. do
  2640. msg+=" ${j} and";
  2641. done;
  2642. msg="${msg:0: -4} for ${desc}";
  2643. elog "${msg}";
  2644. done;
  2645. fi
  2646. }
  2647. path_exists ()
  2648. {
  2649. local opt=$1;
  2650. [[ ${opt} == -[ao] ]] && shift || opt="-a";
  2651. [[ $# -eq 0 ]] && return 1;
  2652. local p r=0;
  2653. for p in "$@";
  2654. do
  2655. [[ -e ${p} ]];
  2656. : $(( r += $? ));
  2657. done;
  2658. case ${opt} in
  2659. -a)
  2660. return $(( r != 0 ))
  2661. ;;
  2662. -o)
  2663. return $(( r == $# ))
  2664. ;;
  2665. esac
  2666. }
  2667. pkg_nofetch ()
  2668. {
  2669. default
  2670. }
  2671. preserve_old_lib ()
  2672. {
  2673. _eutils_eprefix_init;
  2674. if [[ ${EBUILD_PHASE} != "preinst" ]]; then
  2675. eerror "preserve_old_lib() must be called from pkg_preinst() only";
  2676. die "Invalid preserve_old_lib() usage";
  2677. fi;
  2678. [[ -z $1 ]] && die "Usage: preserve_old_lib <library to preserve> [more libraries to preserve]";
  2679. has preserve-libs ${FEATURES} && return 0;
  2680. local lib dir;
  2681. for lib in "$@";
  2682. do
  2683. [[ -e ${EROOT}/${lib} ]] || continue;
  2684. dir=${lib%/*};
  2685. dodir ${dir} || die "dodir ${dir} failed";
  2686. cp "${EROOT}"/${lib} "${ED}"/${lib} || die "cp ${lib} failed";
  2687. touch "${ED}"/${lib};
  2688. done
  2689. }
  2690. preserve_old_lib_notify ()
  2691. {
  2692. if [[ ${EBUILD_PHASE} != "postinst" ]]; then
  2693. eerror "preserve_old_lib_notify() must be called from pkg_postinst() only";
  2694. die "Invalid preserve_old_lib_notify() usage";
  2695. fi;
  2696. has preserve-libs ${FEATURES} && return 0;
  2697. _eutils_eprefix_init;
  2698. local lib notice=0;
  2699. for lib in "$@";
  2700. do
  2701. [[ -e ${EROOT}/${lib} ]] || continue;
  2702. if [[ ${notice} -eq 0 ]]; then
  2703. notice=1;
  2704. ewarn "Old versions of installed libraries were detected on your system.";
  2705. ewarn "In order to avoid breaking packages that depend on these old libs,";
  2706. ewarn "the libraries are not being removed. You need to run revdep-rebuild";
  2707. ewarn "in order to remove these old dependencies. If you do not have this";
  2708. ewarn "helper program, simply emerge the 'gentoolkit' package.";
  2709. ewarn;
  2710. fi;
  2711. ewarn " # revdep-rebuild --library '${lib}' && rm '${lib}'";
  2712. done
  2713. }
  2714. prune_libtool_files ()
  2715. {
  2716. debug-print-function ${FUNCNAME} "$@";
  2717. local removing_all removing_modules opt;
  2718. _eutils_eprefix_init;
  2719. for opt in "$@";
  2720. do
  2721. case "${opt}" in
  2722. --all)
  2723. removing_all=1;
  2724. removing_modules=1
  2725. ;;
  2726. --modules)
  2727. removing_modules=1
  2728. ;;
  2729. *)
  2730. die "Invalid argument to ${FUNCNAME}(): ${opt}"
  2731. ;;
  2732. esac;
  2733. done;
  2734. local f;
  2735. local queue=();
  2736. while IFS= read -r -d '' f; do
  2737. local archivefile=${f/%.la/.a};
  2738. if ! sed -n -e '/^# Generated by .*libtool/q0;4q1' "${f}"; then
  2739. continue;
  2740. fi;
  2741. [[ ${f} != ${archivefile} ]] || die 'regex sanity check failed';
  2742. local reason= pkgconfig_scanned=;
  2743. local snotlink=$(sed -n -e 's:^shouldnotlink=::p' "${f}");
  2744. if [[ ${snotlink} == yes ]]; then
  2745. if [[ -f ${archivefile} ]]; then
  2746. einfo "Removing unnecessary ${archivefile#${D%/}} (static plugin)";
  2747. queue+=("${archivefile}");
  2748. fi;
  2749. if [[ -n ${removing_modules} ]]; then
  2750. reason='module';
  2751. fi;
  2752. else
  2753. if [[ -n ${removing_all} ]]; then
  2754. reason='requested';
  2755. else
  2756. if [[ ! -f ${archivefile} ]]; then
  2757. reason='no static archive';
  2758. else
  2759. if [[ ! -n $(sed -nre "s/^(dependency_libs|in
  2760. herited_linker_flags)='(.*)'$/\2/p" "${f}") ]]; then
  2761. reason='no libs & flags';
  2762. else
  2763. if [[ ! -n ${pkgconfig_scanned} ]]; then
  2764. local pc_libs=();
  2765. if [[ ! -n ${removing_all} ]]; then
  2766. local pc;
  2767. local tf=${T}/prune-lt-files.pc;
  2768. local pkgconf=$(tc-getPKG_CONFIG);
  2769. while IFS= read -r -d '' pc; do
  2770. local arg libs;
  2771. if ${pkgconf} --exists "${pc}" &>/dev/null; then
  2772. sed -e '/^Requires:/d' "${pc}" > "${tf}";
  2773. libs=$(${pkgconf} --libs "${tf}");
  2774. else
  2775. libs=$(sed -ne 's/^Libs://p' "${pc}");
  2776. fi;
  2777. for arg in ${libs};
  2778. do
  2779. if [[ ${arg} == -l* ]]; then
  2780. if [[ ${arg} == '*$*' ]]; then
  2781. eqawarn "${FUNCNAME}: variable substitution likely fail
  2782. ed in ${pc}";
  2783. eqawarn "(arg: ${arg})";
  2784. eqawarn "Most likely, you need to add virtual/pkgconfig
  2785. to DEPEND.";
  2786. fi;
  2787. pc_libs+=(lib${arg#-l}.la);
  2788. fi;
  2789. done;
  2790. done < <(find "${D}" -type f -name '*.pc' -print0);
  2791. rm -f "${tf}";
  2792. fi;
  2793. pkgconfig_scanned=1;
  2794. fi;
  2795. has "${f##*/}" "${pc_libs[@]}" && reason='covered by .pc';
  2796. fi;
  2797. fi;
  2798. fi;
  2799. fi;
  2800. if [[ -n ${reason} ]]; then
  2801. einfo "Removing unnecessary ${f#${D%/}} (${reason})";
  2802. queue+=("${f}");
  2803. fi;
  2804. done < <(find "${ED}" -xtype f -name '*.la' -print0);
  2805. if [[ -n ${queue[@]} ]]; then
  2806. rm -f "${queue[@]}";
  2807. fi
  2808. }
  2809. raw-ldflags ()
  2810. {
  2811. local x input="$@";
  2812. [[ -z ${input} ]] && input=${LDFLAGS};
  2813. set --;
  2814. for x in ${input};
  2815. do
  2816. case ${x} in
  2817. -Wl,*)
  2818. x=${x#-Wl,};
  2819. set -- "$@" ${x//,/ }
  2820. ;;
  2821. *)
  2822.  
  2823. ;;
  2824. esac;
  2825. done;
  2826. echo "$@"
  2827. }
  2828. replace-cpu-flags ()
  2829. {
  2830. local newcpu="$#";
  2831. newcpu="${!newcpu}";
  2832. while [ $# -gt 1 ]; do
  2833. replace-flags "-march=${1}" "-march=${newcpu}";
  2834. replace-flags "-mcpu=${1}" "-mcpu=${newcpu}";
  2835. replace-flags "-mtune=${1}" "-mtune=${newcpu}";
  2836. shift;
  2837. done;
  2838. return 0
  2839. }
  2840. replace-flags ()
  2841. {
  2842. [[ $# != 2 ]] && die "Usage: replace-flags <old flag> <new flag>";
  2843. local f var new;
  2844. for var in $(all-flag-vars);
  2845. do
  2846. new=();
  2847. for f in ${!var};
  2848. do
  2849. [[ ${f} == ${1} ]] && f=${2};
  2850. new+=("${f}");
  2851. done;
  2852. eval export ${var}=\""${new[*]}"\";
  2853. done;
  2854. return 0
  2855. }
  2856. replace-sparc64-flags ()
  2857. {
  2858. local SPARC64_CPUS="ultrasparc3 ultrasparc v9";
  2859. if [ "${CFLAGS/mtune}" != "${CFLAGS}" ]; then
  2860. for x in ${SPARC64_CPUS};
  2861. do
  2862. CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8}";
  2863. done;
  2864. else
  2865. for x in ${SPARC64_CPUS};
  2866. do
  2867. CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}";
  2868. done;
  2869. fi;
  2870. if [ "${CXXFLAGS/mtune}" != "${CXXFLAGS}" ]; then
  2871. for x in ${SPARC64_CPUS};
  2872. do
  2873. CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8}";
  2874. done;
  2875. else
  2876. for x in ${SPARC64_CPUS};
  2877. do
  2878. CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}";
  2879. done;
  2880. fi;
  2881. export CFLAGS CXXFLAGS
  2882. }
  2883. setup-allowed-flags ()
  2884. {
  2885. ALLOWED_FLAGS="-pipe";
  2886. ALLOWED_FLAGS+=" -O -O1 -O2 -Os -Og -mcpu -march -mtune";
  2887. ALLOWED_FLAGS+=" -fstack-protector* -fsanitize=*";
  2888. ALLOWED_FLAGS+=" -fbounds-checking -fno-strict-overflow";
  2889. ALLOWED_FLAGS+=" -fno-PIE -fno-pie -nopie -fno-unit-at-a-time";
  2890. ALLOWED_FLAGS+=" -g -g[0-9] -ggdb -ggdb[0-9] -gdwarf-* gstabs -gstabs+";
  2891. ALLOWED_FLAGS+=" -fno-ident -fpermissive -frecord-gcc-switches";
  2892. ALLOWED_FLAGS+=" -fdiagnostics*";
  2893. ALLOWED_FLAGS+=" -W* -w";
  2894. ALLOWED_FLAGS+=" -fno-stack-protector* -fabi-version=* -fno-strict-aliasing -fno-bound
  2895. s-checking -fstrict-overflow -fno-omit-frame-pointer -fno-builtin*";
  2896. ALLOWED_FLAGS+=" -mregparm -mno-app-regs -mapp-regs -mno-mmx -mno-sse -mno-sse2 -mno-
  2897. sse3 -mno-ssse3 -mno-sse4 -mno-sse4.1 -mno-sse4.2 -mno-avx -mno-aes -mno-pclmul -mno-sse4
  2898. a -mno-3dnow -mno-popcnt -mno-abm -mips1 -mips2 -mips3 -mips4 -mips32 -mips64 -mips16 -m
  2899. plt -msoft-float -mno-soft-float -mhard-float -mno-hard-float -mfpu -mieee
  2900. -mieee-with-inexact -mschedule -mfloat-gprs -mspe -mno-spe -mtls-direct-seg-refs -mno-tls-
  2901. direct-seg-refs -mflat -mno-flat -mno-faster-structs -mfaster-structs -m32 -m64 -mx32 -m
  2902. abi -mlittle-endian -mbig-endian -EL -EB -fPIC -mlive-g0 -mcmodel -mstack-bias -m
  2903. no-stack-bias -msecure-plt -m*-toc -mfloat-abi -mfix-r10000 -mno-fix-r10000 -D* -U*";
  2904. ALLOWED_FLAGS+=" -mno-fma4 -mno-movbe -mno-xop -mno-lwp";
  2905. ALLOWED_FLAGS+=" -mno-fsgsbase -mno-rdrnd -mno-f16c -mno-bmi -mno-tbm";
  2906. ALLOWED_FLAGS+=" -mno-avx2 -mno-bmi2 -mno-fma -mno-lzcnt";
  2907. ALLOWED_FLAGS+=" -mno-fxsr -mno-rtm -mno-xsave -mno-xsaveopt";
  2908. ALLOWED_FLAGS+=" -mno-avx512cd -mno-avx512er -mno-avx512f -mno-avx512pf -mno-sha";
  2909. ALLOWED_FLAGS+=" -I* -L* -R* -Wl,*";
  2910. export ALLOWED_FLAGS;
  2911. return 0
  2912. }
  2913. src_compile ()
  2914. {
  2915. go build -ldflags '-extldflags=-fno-PIC' -v -x -work ${GO_PN} || die
  2916. }
  2917. src_configure ()
  2918. {
  2919. default
  2920. }
  2921. src_install ()
  2922. {
  2923. dobin go-mtpfs
  2924. }
  2925. src_prepare ()
  2926. {
  2927. default
  2928. }
  2929. src_test ()
  2930. {
  2931. go test -ldflags '-extldflags=-fno-PIC' ${GO_PN}/fs || die;
  2932. go test -ldflags '-extldflags=-fno-PIC' ${GO_PN}/usb || die;
  2933. go test -ldflags '-extldflags=-fno-PIC' ${GO_PN}/mtp || die
  2934. }
  2935. src_unpack ()
  2936. {
  2937. git-r3_src_unpack "$@"
  2938. }
  2939. strip-flags ()
  2940. {
  2941. local x y var;
  2942. setup-allowed-flags;
  2943. set -f;
  2944. for var in $(all-flag-vars);
  2945. do
  2946. local new=();
  2947. for x in ${!var};
  2948. do
  2949. local flag=${x%%=*};
  2950. for y in ${ALLOWED_FLAGS};
  2951. do
  2952. if [[ -z ${flag%%${y}} ]]; then
  2953. new+=("${x}");
  2954. break;
  2955. fi;
  2956. done;
  2957. done;
  2958. if _is_flagq ${var} "-O*" && ! _is_flagq new "-O*"; then
  2959. new+=(-O2);
  2960. fi;
  2961. if [[ ${!var} != "${new[*]}" ]]; then
  2962. einfo "strip-flags: ${var}: changed '${!var}' to '${new[*]}'";
  2963. fi;
  2964. eval export ${var}=\""${new[*]}"\";
  2965. done;
  2966. set +f;
  2967. return 0
  2968. }
  2969. strip-linguas ()
  2970. {
  2971. local ls newls nols;
  2972. if [[ $1 == "-i" ]] || [[ $1 == "-u" ]]; then
  2973. local op=$1;
  2974. shift;
  2975. ls=$(find "$1" -name '*.po' -exec basename {} .po ';');
  2976. shift;
  2977. local d f;
  2978. for d in "$@";
  2979. do
  2980. if [[ ${op} == "-u" ]]; then
  2981. newls=${ls};
  2982. else
  2983. newls="";
  2984. fi;
  2985. for f in $(find "$d" -name '*.po' -exec basename {} .po ';');
  2986. do
  2987. if [[ ${op} == "-i" ]]; then
  2988. has ${f} ${ls} && newls="${newls} ${f}";
  2989. else
  2990. has ${f} ${ls} || newls="${newls} ${f}";
  2991. fi;
  2992. done;
  2993. ls=${newls};
  2994. done;
  2995. else
  2996. ls="$@";
  2997. fi;
  2998. nols="";
  2999. newls="";
  3000. for f in ${LINGUAS};
  3001. do
  3002. if has ${f} ${ls}; then
  3003. newls="${newls} ${f}";
  3004. else
  3005. nols="${nols} ${f}";
  3006. fi;
  3007. done;
  3008. [[ -n ${nols} ]] && einfo "Sorry, but ${PN} does not support the LINGUAS:" ${nols};
  3009. export LINGUAS=${newls:1}
  3010. }
  3011. strip-unsupported-flags ()
  3012. {
  3013. export CFLAGS=$(test-flags-CC ${CFLAGS});
  3014. export CXXFLAGS=$(test-flags-CXX ${CXXFLAGS});
  3015. export FFLAGS=$(test-flags-F77 ${FFLAGS});
  3016. export FCFLAGS=$(test-flags-FC ${FCFLAGS})
  3017. }
  3018. tc-arch ()
  3019. {
  3020. tc-ninja_magic_to_arch portage "$@"
  3021. }
  3022. tc-arch-kernel ()
  3023. {
  3024. tc-ninja_magic_to_arch kern "$@"
  3025. }
  3026. tc-endian ()
  3027. {
  3028. local host=$1;
  3029. [[ -z ${host} ]] && host=${CTARGET:-${CHOST}};
  3030. host=${host%%-*};
  3031. case ${host} in
  3032. aarch64*be)
  3033. echo big
  3034. ;;
  3035. aarch64)
  3036. echo little
  3037. ;;
  3038. alpha*)
  3039. echo big
  3040. ;;
  3041. arm*b*)
  3042. echo big
  3043. ;;
  3044. arm*)
  3045. echo little
  3046. ;;
  3047. cris*)
  3048. echo little
  3049. ;;
  3050. hppa*)
  3051. echo big
  3052. ;;
  3053. i?86*)
  3054. echo little
  3055. ;;
  3056. ia64*)
  3057. echo little
  3058. ;;
  3059. m68*)
  3060. echo big
  3061. ;;
  3062. mips*l*)
  3063. echo little
  3064. ;;
  3065. mips*)
  3066. echo big
  3067. ;;
  3068. powerpc*le)
  3069. echo little
  3070. ;;
  3071. powerpc*)
  3072. echo big
  3073. ;;
  3074. s390*)
  3075. echo big
  3076. ;;
  3077. sh*b*)
  3078. echo big
  3079. ;;
  3080. sh*)
  3081. echo little
  3082. ;;
  3083. sparc*)
  3084. echo big
  3085. ;;
  3086. x86_64*)
  3087. echo little
  3088. ;;
  3089. *)
  3090. echo wtf
  3091. ;;
  3092. esac
  3093. }
  3094. tc-env_build ()
  3095. {
  3096. tc-export_build_env;
  3097. CFLAGS=${BUILD_CFLAGS} CXXFLAGS=${BUILD_CXXFLAGS} CPPFLAGS=${BUILD_CPPFLAGS} LDFLAGS=${BUILD_LDFLAG
  3098. S} AR=$(tc-getBUILD_AR) AS=$(tc-getBUILD_AS) CC=$(tc-getBUILD_CC) CPP=$(tc-getBUILD_CPP) CXX=$(tc-getBU
  3099. ILD_CXX) LD=$(tc-getBUILD_LD) NM=$(tc-getBUILD_NM) PKG_CONFIG=$(tc-getBUILD_PKG_CONFIG) RANLIB=$(tc-get
  3100. BUILD_RANLIB) "$@"
  3101. }
  3102. tc-export ()
  3103. {
  3104. local var;
  3105. for var in "$@";
  3106. do
  3107. [[ $(type -t tc-get${var}) != "function" ]] && die "tc-export: invalid export variable '${var}'
  3108. ";
  3109. eval tc-get${var} > /dev/null;
  3110. done
  3111. }
  3112. tc-export_build_env ()
  3113. {
  3114. tc-export "$@";
  3115. : ${BUILD_CFLAGS:=-O1 -pipe};
  3116. : ${BUILD_CXXFLAGS:=-O1 -pipe};
  3117. : ${BUILD_CPPFLAGS:=};
  3118. : ${BUILD_LDFLAGS:=};
  3119. export BUILD_{C,CXX,CPP,LD}FLAGS;
  3120. local v;
  3121. for v in BUILD_{C,CXX,CPP,LD}FLAGS;
  3122. do
  3123. export ${v#BUILD_}_FOR_BUILD="${!v}";
  3124. done
  3125. }
  3126. tc-getAR ()
  3127. {
  3128. tc-getPROG AR ar "$@"
  3129. }
  3130. tc-getAS ()
  3131. {
  3132. tc-getPROG AS as "$@"
  3133. }
  3134. tc-getBUILD_AR ()
  3135. {
  3136. tc-getBUILD_PROG AR ar "$@"
  3137. }
  3138. tc-getBUILD_AS ()
  3139. {
  3140. tc-getBUILD_PROG AS as "$@"
  3141. }
  3142. tc-getBUILD_CC ()
  3143. {
  3144. tc-getBUILD_PROG CC gcc "$@"
  3145. }
  3146. tc-getBUILD_CPP ()
  3147. {
  3148. tc-getBUILD_PROG CPP cpp "$@"
  3149. }
  3150. tc-getBUILD_CXX ()
  3151. {
  3152. tc-getBUILD_PROG CXX g++ "$@"
  3153. }
  3154. tc-getBUILD_LD ()
  3155. {
  3156. tc-getBUILD_PROG LD ld "$@"
  3157. }
  3158. tc-getBUILD_NM ()
  3159. {
  3160. tc-getBUILD_PROG NM nm "$@"
  3161. }
  3162. tc-getBUILD_OBJCOPY ()
  3163. {
  3164. tc-getBUILD_PROG OBJCOPY objcopy "$@"
  3165. }
  3166. tc-getBUILD_PKG_CONFIG ()
  3167. {
  3168. tc-getBUILD_PROG PKG_CONFIG pkg-config "$@"
  3169. }
  3170. tc-getBUILD_PROG ()
  3171. {
  3172. _tc-getPROG CBUILD "BUILD_$1 $1_FOR_BUILD HOST$1" "${@:2}"
  3173. }
  3174. tc-getBUILD_RANLIB ()
  3175. {
  3176. tc-getBUILD_PROG RANLIB ranlib "$@"
  3177. }
  3178. tc-getBUILD_STRIP ()
  3179. {
  3180. tc-getBUILD_PROG STRIP strip "$@"
  3181. }
  3182. tc-getCC ()
  3183. {
  3184. tc-getPROG CC gcc "$@"
  3185. }
  3186. tc-getCPP ()
  3187. {
  3188. tc-getPROG CPP cpp "$@"
  3189. }
  3190. tc-getCXX ()
  3191. {
  3192. tc-getPROG CXX g++ "$@"
  3193. }
  3194. tc-getDLLWRAP ()
  3195. {
  3196. tc-getPROG DLLWRAP dllwrap "$@"
  3197. }
  3198. tc-getF77 ()
  3199. {
  3200. tc-getPROG F77 gfortran "$@"
  3201. }
  3202. tc-getFC ()
  3203. {
  3204. tc-getPROG FC gfortran "$@"
  3205. }
  3206. tc-getGCJ ()
  3207. {
  3208. tc-getPROG GCJ gcj "$@"
  3209. }
  3210. tc-getLD ()
  3211. {
  3212. tc-getPROG LD ld "$@"
  3213. }
  3214. tc-getNM ()
  3215. {
  3216. tc-getPROG NM nm "$@"
  3217. }
  3218. tc-getOBJCOPY ()
  3219. {
  3220. tc-getPROG OBJCOPY objcopy "$@"
  3221. }
  3222. tc-getPKG_CONFIG ()
  3223. {
  3224. tc-getPROG PKG_CONFIG pkg-config "$@"
  3225. }
  3226. tc-getPROG ()
  3227. {
  3228. _tc-getPROG CHOST "$@"
  3229. }
  3230. tc-getRANLIB ()
  3231. {
  3232. tc-getPROG RANLIB ranlib "$@"
  3233. }
  3234. tc-getRC ()
  3235. {
  3236. tc-getPROG RC windres "$@"
  3237. }
  3238. tc-getSTRIP ()
  3239. {
  3240. tc-getPROG STRIP strip "$@"
  3241. }
  3242. tc-has-openmp ()
  3243. {
  3244. local base="${T}/test-tc-openmp";
  3245. cat > "${base}.c" <<-EOF
  3246. #include <omp.h>
  3247. int main() {
  3248. int nthreads, tid, ret = 0;
  3249. #pragma omp parallel private(nthreads, tid)
  3250. {
  3251. tid = omp_get_thread_num();
  3252. nthreads = omp_get_num_threads(); ret += tid + nthreads;
  3253. }
  3254. return ret;
  3255. }
  3256. EOF
  3257.  
  3258. $(tc-getCC "$@") -fopenmp "${base}.c" -o "${base}" &>/dev/null;
  3259. local ret=$?;
  3260. rm -f "${base}"*;
  3261. return ${ret}
  3262. }
  3263. tc-has-tls ()
  3264. {
  3265. local base="${T}/test-tc-tls";
  3266. cat > "${base}.c" <<-EOF
  3267. int foo(int *i) {
  3268. static __thread int j = 0;
  3269. return *i ? j : *i;
  3270. }
  3271. EOF
  3272.  
  3273. local flags;
  3274. case $1 in
  3275. -s)
  3276. flags="-S"
  3277. ;;
  3278. -c)
  3279. flags="-c"
  3280. ;;
  3281. -l)
  3282.  
  3283. ;;
  3284. -*)
  3285. die "Usage: tc-has-tls [-c|-l] [toolchain prefix]"
  3286. ;;
  3287. esac;
  3288. : ${flags:=-fPIC -shared -Wl,-z,defs};
  3289. [[ $1 == -* ]] && shift;
  3290. $(tc-getCC "$@") ${flags} "${base}.c" -o "${base}" &>/dev/null;
  3291. local ret=$?;
  3292. rm -f "${base}"*;
  3293. return ${ret}
  3294. }
  3295. tc-is-cross-compiler ()
  3296. {
  3297. [[ ${CBUILD:-${CHOST}} != ${CHOST} ]]
  3298. }
  3299. tc-is-softfloat ()
  3300. {
  3301. local CTARGET=${CTARGET:-${CHOST}};
  3302. case ${CTARGET} in
  3303. bfin* | h8300*)
  3304. echo "only"
  3305. ;;
  3306. *)
  3307. if [[ ${CTARGET//_/-} == *-softfloat-* ]]; then
  3308. echo "yes";
  3309. else
  3310. if [[ ${CTARGET//_/-} == *-softfp-* ]]; then
  3311. echo "softfp";
  3312. else
  3313. echo "no";
  3314. fi;
  3315. fi
  3316. ;;
  3317. esac
  3318. }
  3319. tc-is-static-only ()
  3320. {
  3321. local host=${CTARGET:-${CHOST}};
  3322. [[ ${host} == *-mint* ]]
  3323. }
  3324. tc-ninja_magic_to_arch ()
  3325. {
  3326. function ninj ()
  3327. {
  3328. [[ ${type} == "kern" ]] && echo $1 || echo $2
  3329. };
  3330. local type=$1;
  3331. local host=$2;
  3332. [[ -z ${host} ]] && host=${CTARGET:-${CHOST}};
  3333. local KV=${KV:-${KV_FULL}};
  3334. [[ ${type} == "kern" ]] && [[ -z ${KV} ]] && ewarn "QA: Kernel version could not be determined, ple
  3335. ase inherit kernel-2 or linux-info";
  3336. case ${host} in
  3337. aarch64*)
  3338. echo arm64
  3339. ;;
  3340. alpha*)
  3341. echo alpha
  3342. ;;
  3343. arm*)
  3344. echo arm
  3345. ;;
  3346. avr*)
  3347. ninj avr32 avr
  3348. ;;
  3349. bfin*)
  3350. ninj blackfin bfin
  3351. ;;
  3352. c6x)
  3353. echo c6x
  3354. ;;
  3355. cris*)
  3356. echo cris
  3357. ;;
  3358. frv)
  3359. echo frv
  3360. ;;
  3361. hexagon)
  3362. echo hexagon
  3363. ;;
  3364. hppa*)
  3365. ninj parisc hppa
  3366. ;;
  3367. i?86*)
  3368. if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -lt $(KV_to_int 2.6.24) || ${host} == *
  3369. freebsd* ]]; then
  3370. echo i386;
  3371. else
  3372. echo x86;
  3373. fi
  3374. ;;
  3375. ia64*)
  3376. echo ia64
  3377. ;;
  3378. m68*)
  3379. echo m68k
  3380. ;;
  3381. metag)
  3382. echo metag
  3383. ;;
  3384. mips*)
  3385. echo mips
  3386. ;;
  3387. nios2*)
  3388. echo nios2
  3389. ;;
  3390. nios*)
  3391. echo nios
  3392. ;;
  3393. or32)
  3394. echo openrisc
  3395. ;;
  3396. powerpc*)
  3397. if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -ge $(KV_to_int 2.6.16) ]]; then
  3398. echo powerpc;
  3399. else
  3400. if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -eq $(KV_to_int 2.6.15) ]]; then
  3401. if [[ ${host} == powerpc64* ]] || [[ ${PROFILE_ARCH} == "ppc64" ]]; then
  3402. echo powerpc;
  3403. else
  3404. echo ppc;
  3405. fi;
  3406. else
  3407. if [[ ${host} == powerpc64* ]]; then
  3408. echo ppc64;
  3409. else
  3410. if [[ ${PROFILE_ARCH} == "ppc64" ]]; then
  3411. ninj ppc64 ppc;
  3412. else
  3413. echo ppc;
  3414. fi;
  3415. fi;
  3416. fi;
  3417. fi
  3418. ;;
  3419. riscv*)
  3420. echo riscv
  3421. ;;
  3422. s390*)
  3423. echo s390
  3424. ;;
  3425. score)
  3426. echo score
  3427. ;;
  3428. sh64*)
  3429. ninj sh64 sh
  3430. ;;
  3431. sh*)
  3432. echo sh
  3433. ;;
  3434. sparc64*)
  3435. ninj sparc64 sparc
  3436. ;;
  3437. sparc*)
  3438. [[ ${PROFILE_ARCH} == "sparc64" ]] && ninj sparc64 sparc || echo sparc
  3439. ;;
  3440. tile*)
  3441. echo tile
  3442. ;;
  3443. vax*)
  3444. echo vax
  3445. ;;
  3446. x86_64*freebsd*)
  3447. echo amd64
  3448. ;;
  3449. x86_64*)
  3450. if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -ge $(KV_to_int 2.6.24) ]]; then
  3451. echo x86;
  3452. else
  3453. ninj x86_64 amd64;
  3454. fi
  3455. ;;
  3456. xtensa*)
  3457. echo xtensa
  3458. ;;
  3459. *)
  3460. echo unknown
  3461. ;;
  3462. esac
  3463. }
  3464. test-flag-CC ()
  3465. {
  3466. test-flag-PROG "CC" c "$1"
  3467. }
  3468. test-flag-CXX ()
  3469. {
  3470. test-flag-PROG "CXX" c++ "$1"
  3471. }
  3472. test-flag-F77 ()
  3473. {
  3474. test-flag-PROG "F77" f77 "$1"
  3475. }
  3476. test-flag-FC ()
  3477. {
  3478. test-flag-PROG "FC" f95 "$1"
  3479. }
  3480. test-flag-PROG ()
  3481. {
  3482. local comp=$1;
  3483. local lang=$2;
  3484. local flag=$3;
  3485. [[ -z ${comp} || -z ${flag} ]] && return 1;
  3486. local PROG=$(tc-get${comp});
  3487. if ${PROG} -c -o /dev/null -x${lang} - < /dev/null > /dev/null 2>&1; then
  3488. ${PROG} "${flag}" -c -o /dev/null -x${lang} - < /dev/null > /dev/null 2>&1;
  3489. else
  3490. ${PROG} "${flag}" -c -o /dev/null /dev/null > /dev/null 2>&1;
  3491. fi
  3492. }
  3493. test-flags ()
  3494. {
  3495. test-flags-CC "$@"
  3496. }
  3497. test-flags-CC ()
  3498. {
  3499. test-flags-PROG "CC" "$@"
  3500. }
  3501. test-flags-CXX ()
  3502. {
  3503. test-flags-PROG "CXX" "$@"
  3504. }
  3505. test-flags-F77 ()
  3506. {
  3507. test-flags-PROG "F77" "$@"
  3508. }
  3509. test-flags-FC ()
  3510. {
  3511. test-flags-PROG "FC" "$@"
  3512. }
  3513. test-flags-PROG ()
  3514. {
  3515. local comp=$1;
  3516. local flags=();
  3517. local x;
  3518. shift;
  3519. [[ -z ${comp} ]] && return 1;
  3520. for x in "$@";
  3521. do
  3522. test-flag-${comp} "${x}" && flags+=("${x}");
  3523. done;
  3524. echo "${flags[*]}";
  3525. [[ ${#flags[@]} -gt 0 ]]
  3526. }
  3527. test_version_info ()
  3528. {
  3529. if [[ $($(tc-getCC) --version 2>&1) == *$1* ]]; then
  3530. return 0;
  3531. else
  3532. return 1;
  3533. fi
  3534. }
  3535. use_if_iuse ()
  3536. {
  3537. in_iuse $1 || return 1;
  3538. use $1
  3539. }
  3540. validate_desktop_entries ()
  3541. {
  3542. _eutils_eprefix_init;
  3543. if [[ -x "${EPREFIX}"/usr/bin/desktop-file-validate ]]; then
  3544. einfo "Checking desktop entry validity";
  3545. local directories="";
  3546. for d in /usr/share/applications $@;
  3547. do
  3548. [[ -d ${ED}${d} ]] && directories="${directories} ${ED}${d}";
  3549. done;
  3550. if [[ -n ${directories} ]]; then
  3551. for FILE in $(find ${directories} -name "*\.desktop" -not -path '*.hidden*' | sort -u 2>/dev/null);
  3552. do
  3553. local temp=$(desktop-file-validate ${FILE} | grep -v "warning:" | sed -e "s|error: ||" -e "s|${FILE}:|--|g" );
  3554. [[ -n $temp ]] && elog ${temp/--/${FILE/${ED}/}:};
  3555. done;
  3556. fi;
  3557. echo "";
  3558. else
  3559. einfo "Passing desktop entry validity check. Install dev-util/desktop-file-utils, if you want t
  3560. o help to improve Gentoo.";
  3561. fi
  3562. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement