Advertisement
Guest User

gnome-applets-3.6.0-r1/temp/environment

a guest
Aug 14th, 2013
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 142.30 KB | None | 0 0
  1. declare -x ABI="amd64"
  2. declare -x ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci"
  3. declare -x APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias"
  4. declare -x ARCH="amd64"
  5. declare -x BOOTSTRAP_USE="cxx unicode python_targets_python3_2 python_targets_python2_7 multilib"
  6. declare -x CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author"
  7. declare -x CAMERAS="ptp2"
  8. declare -x CBUILD="x86_64-pc-linux-gnu"
  9. declare -x CFLAGS="-march=native -O2 -pipe"
  10. declare -x CFLAGS_amd64="-m64"
  11. declare -x CFLAGS_default
  12. declare -x CFLAGS_x32="-mx32"
  13. declare -x CFLAGS_x86="-m32"
  14. declare -x CHOST="x86_64-pc-linux-gnu"
  15. declare -x CHOST_amd64="x86_64-pc-linux-gnu"
  16. declare -x CHOST_default="x86_64-pc-linux-gnu"
  17. declare -x CHOST_x32="x86_64-pc-linux-gnux32"
  18. declare -x CHOST_x86="i686-pc-linux-gnu"
  19. declare -x COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog"
  20. declare -x CONF_PREFIX="/usr"
  21. declare -x CTARGET_default="x86_64-pc-linux-gnu"
  22. declare -x CXXFLAGS="-march=native -O2 -pipe"
  23. declare -x DEFAULT_ABI="amd64"
  24. declare -x DEFINED_PHASES=" compile configure install postinst postrm preinst prepare setup test unpack"
  25. declare DEPEND="
  26. >=x11-libs/gtk+-3.0.0:3
  27. dev-libs/atk
  28. >=dev-libs/glib-2.22:2
  29. >=gnome-base/gconf-2.8:2
  30. >=gnome-base/gnome-panel-2.91.91
  31. x11-libs/cairo
  32. >=x11-libs/libxklavier-4
  33. >=x11-libs/libwnck-2.91.0:3
  34. >=x11-libs/libnotify-0.7:=
  35. x11-libs/pango
  36. >=sys-apps/dbus-1.1.2
  37. >=dev-libs/dbus-glib-0.74
  38. >=dev-libs/libxml2-2.5
  39. >=x11-themes/gnome-icon-theme-2.15.91
  40. >=dev-libs/libgweather-3.5:=
  41. x11-libs/libX11
  42.  
  43. gnome? (
  44. gnome-base/gnome-settings-daemon
  45.  
  46. >=gnome-extra/gucharmap-2.33.0:2.90
  47. >=gnome-base/libgtop-2.11.92
  48.  
  49. python_single_target_python2_6? ( dev-lang/python:2.6 ) python_single_target_python2_7? ( dev-lang/python:2.7 ) dev-python/python-exec[python_targets_python2_6(-)?,python_targets_python2_7(-)?,python_single_target_python2_6(+)?,python_single_target_python2_7(+)?]
  50. dev-python/pygobject:3[python_targets_python2_6(-)?,python_targets_python2_7(-)?,python_single_target_python2_6(+)?,python_single_target_python2_7(+)?]
  51. gnome-base/gconf[introspection]
  52. gnome-base/gnome-panel[introspection]
  53. x11-libs/gdk-pixbuf[introspection]
  54. x11-libs/gtk+:3[introspection]
  55. x11-libs/pango[introspection] )
  56. networkmanager? ( >=net-misc/networkmanager-0.7.0 )
  57. policykit? ( >=sys-auth/polkit-0.92 )
  58.  
  59. app-text/docbook-xml-dtd:4.1.2
  60. app-text/docbook-xml-dtd:4.3
  61. >=app-text/gnome-doc-utils-0.3.2
  62. >=app-text/scrollkeeper-0.1.4
  63. >=dev-util/intltool-0.35
  64. dev-libs/libxslt
  65. virtual/pkgconfig
  66. app-arch/xz-utils >=sys-apps/sed-4"
  67. declare DESCRIPTION="Applets for the GNOME Desktop and Panel"
  68. declare -x DESTTREE="/usr"
  69. declare -x DIROPTIONS="-m0755"
  70. declare -x EAPI="5"
  71. declare -- ECLASSDIR_LOCAL="/usr/portage/eclass"
  72. declare -- ECONF_SOURCE="."
  73. declare -x ELIBC="glibc"
  74. declare -- ELTCONF=""
  75. declare -x ELT_APPLIED_PATCHES=" portage/1.2.0 sed/1.5.6 as-needed/2.4.2 target-nm/2.4.2"
  76. declare -- EPATCH_COMMON_OPTS="-g0 -E --no-backup-if-mismatch"
  77. declare -- EPATCH_EXCLUDE=""
  78. declare -- EPATCH_FORCE="no"
  79. declare -- EPATCH_MULTI_MSG="Applying various patches (bugfixes/updates) ..."
  80. declare -- EPATCH_OPTS=""
  81. declare -- EPATCH_SINGLE_MSG=""
  82. declare -- EPATCH_SOURCE="/var/tmp/portage/gnome-base/gnome-applets-3.6.0-r1/work/patch"
  83. declare -- EPATCH_SUFFIX="patch.bz2"
  84. declare -x EPYTHON="python2.7"
  85. declare -x EXEOPTIONS="-m0755"
  86. declare -x FCFLAGS="-O2 -pipe"
  87. declare -x FETCHCOMMAND_SSH="bash -c \"x=\\\${2#ssh://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && port=22 ; exec rsync --rsh=\\\"ssh -p\\\${port} \\\${3}\\\" -avP \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" rsync \"\${DISTDIR}/\${FILE}\" \"\${URI}\" \"\${PORTAGE_SSH_OPTS}\""
  88. declare -x FFLAGS="-O2 -pipe"
  89. declare -- G2CONF="--enable-compile-warnings=minimum --disable-schemas-compile --disable-schemas-install --disable-scrollkeeper
  90. --without-hal
  91. --disable-battstat
  92. --disable-mixer-applet
  93. --enable-ipv6
  94. --disable-networkmanager
  95. --enable-polkit"
  96. declare -x GCC_SPECS=""
  97. declare -- GCONFTOOL_BIN="/usr/bin/gconftool-2"
  98. declare -- GCONF_DEBUG="no"
  99. declare -- GLIB_COMPILE_SCHEMAS="/usr/bin/glib-compile-schemas"
  100. declare -- GNOME2_LA_PUNT="no"
  101. declare -- GNOME_ORG_MODULE="gnome-applets"
  102. declare -- GNOME_ORG_PVP="3.6"
  103. declare -- GNOME_TARBALL_SUFFIX="xz"
  104. declare -x GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx"
  105. declare -x GRUB_PLATFORMS=""
  106. declare -x GSETTINGS_BACKEND="dconf"
  107. declare -x GST_REGISTRY="/var/tmp/portage/gnome-base/gnome-applets-3.6.0-r1/temp/registry.xml"
  108. declare -- GTK_UPDATE_ICON_CACHE="/usr/bin/gtk-update-icon-cache"
  109. declare -x GUILE_LOAD_PATH="/usr/share/guile/1.8"
  110. declare -x G_HOME="/var/tmp/portage/gnome-base/gnome-applets-3.6.0-r1/temp"
  111. declare HDEPEND=""
  112. declare HOMEPAGE="http://www.gnome.org/"
  113. declare -x INHERITED=" multilib toolchain-funcs user eutils fdo-mime libtool versionator gnome.org gnome2-utils gnome2 python-utils-r1 python-single-r1"
  114. declare -x INPUT_DEVICES="evdev synaptics"
  115. declare -x INSDESTTREE=""
  116. declare -x INSOPTIONS="-m0644"
  117. declare IUSE="gnome ipv6 networkmanager policykit python_targets_python2_6 python_targets_python2_7 python_single_target_python2_6 python_single_target_python2_7"
  118. declare -x IUSE_EFFECTIVE="alpha amd64 amd64-fbsd amd64-linux arm arm-linux elibc_AIX elibc_Cygwin elibc_Darwin elibc_FreeBSD elibc_HPUX elibc_Interix elibc_NetBSD elibc_OpenBSD elibc_SunOS elibc_Winnt elibc_glibc elibc_mintlib elibc_musl elibc_uclibc gnome hppa hppa-hpux ia64 ia64-hpux ia64-linux ipv6 kernel_AIX kernel_Cygwin kernel_Darwin kernel_FreeBSD kernel_HPUX kernel_Interix kernel_NetBSD kernel_OpenBSD kernel_SunOS kernel_Winnt kernel_freemint kernel_linux m68k m68k-mint mips networkmanager policykit ppc ppc-aix ppc-macos ppc-openbsd ppc64 ppc64-linux prefix python_single_target_python2_6 python_single_target_python2_7 python_targets_python2_6 python_targets_python2_7 s390 sh sparc sparc-fbsd sparc-solaris sparc64-freebsd sparc64-solaris userland_BSD userland_GNU x64-freebsd x64-macos x64-openbsd x64-solaris x86 x86-cygwin x86-fbsd x86-freebsd x86-interix x86-linux x86-macos x86-netbsd x86-openbsd x86-solaris x86-winnt"
  119. declare -x IUSE_IMPLICIT="prefix"
  120. declare -x KERNEL="linux"
  121. declare -x KERNEL_ABI="amd64"
  122. declare -x KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux"
  123. declare -x LANG="en_US.utf8"
  124. declare -x LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text"
  125. declare -x LC_COLLATE="C"
  126. declare -x LDFLAGS="-Wl,-O1 -Wl,--as-needed"
  127. declare -x LDFLAGS_amd64="-m elf_x86_64"
  128. declare -x LDFLAGS_default
  129. declare -x LDFLAGS_x32="-m elf32_x86_64"
  130. declare -x LDFLAGS_x86="-m elf_i386"
  131. declare -x LIBDIR_amd64="lib64"
  132. declare -x LIBDIR_amd64_fbsd="lib64"
  133. declare -x LIBDIR_default="lib"
  134. declare -x LIBDIR_n32="lib32"
  135. declare -x LIBDIR_n64="lib64"
  136. declare -x LIBDIR_o32="lib"
  137. declare -x LIBDIR_ppc="lib32"
  138. declare -x LIBDIR_ppc64="lib64"
  139. declare -x LIBDIR_s390="lib32"
  140. declare -x LIBDIR_s390x="lib64"
  141. declare -x LIBDIR_sparc32="lib32"
  142. declare -x LIBDIR_sparc64="lib64"
  143. declare -x LIBDIR_x32="libx32"
  144. declare -x LIBDIR_x86="lib32"
  145. declare -x LIBDIR_x86_fbsd="lib32"
  146. declare -x LIBOPTIONS="-m0644"
  147. declare -x LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer"
  148. declare -x LICENSE="GPL-2 FDL-1.1 LGPL-2"
  149. declare -x LINGUAS="en en_US zh zh_CN zh_HK zh_TW"
  150. declare -x MAKEOPTS="-j5"
  151. declare -x MULTILIB_ABIS="amd64 x86"
  152. declare -x MULTILIB_STRICT_DENY="64-bit.*shared object"
  153. declare -x MULTILIB_STRICT_DIRS="/lib32 /lib /usr/lib32 /usr/lib /usr/kde/*/lib32 /usr/kde/*/lib /usr/qt/*/lib32 /usr/qt/*/lib /usr/X11R6/lib32 /usr/X11R6/lib"
  154. declare -x MULTILIB_STRICT_EXEMPT="(perl5|gcc|gcc-lib|binutils|eclipse-3|debug|portage|udev|systemd|clang)"
  155. declare -x NETBEANS="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml"
  156. declare -x OFFICE_IMPLEMENTATION="libreoffice"
  157. declare -x OPENGL_PROFILE="xorg-x11"
  158. declare -x PATH="/var/tmp/portage/gnome-base/gnome-applets-3.6.0-r1/temp/python2.7/bin:/usr/lib64/portage/bin/ebuild-helpers:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.3"
  159. declare PDEPEND=""
  160. declare -x PHP_TARGETS="php5-4"
  161. declare -x PKG_CONFIG_PATH="/var/tmp/portage/gnome-base/gnome-applets-3.6.0-r1/temp/python2.7/pkgconfig"
  162. declare -a PORTAGE_DOCOMPRESS='([0]="/usr/share/doc" [1]="/usr/share/info" [2]="/usr/share/man")'
  163. declare -a PORTAGE_DOCOMPRESS_SKIP='([0]="/usr/share/doc/gnome-applets-3.6.0-r1/html")'
  164. declare -x PRELINK_PATH_MASK="/usr/lib64/libfreebl3.so:/usr/lib64/libnssdbm3.so:/usr/lib64/libsoftokn3.so"
  165. declare -x PROFILE_ONLY_VARIABLES="ARCH ELIBC IUSE_IMPLICIT KERNEL USERLAND USE_EXPAND_IMPLICIT USE_EXPAND_UNPREFIXED USE_EXPAND_VALUES_ARCH USE_EXPAND_VALUES_ELIBC USE_EXPAND_VALUES_KERNEL USE_EXPAND_VALUES_USERLAND"
  166. declare -x PROPERTIES=""
  167. declare -x PROVIDE=""
  168. declare -x PYTHON="/usr/bin/python2.7"
  169. declare -x PYTHONDONTWRITEBYTECODE="1"
  170. declare -a PYTHON_COMPAT='([0]="python2_6" [1]="python2_7")'
  171. declare -- PYTHON_DEPS="python_single_target_python2_6? ( dev-lang/python:2.6 ) python_single_target_python2_7? ( dev-lang/python:2.7 ) dev-python/python-exec[python_targets_python2_6(-)?,python_targets_python2_7(-)?,python_single_target_python2_6(+)?,python_single_target_python2_7(+)?]"
  172. declare -- PYTHON_REQUIRED_USE=" python_single_target_python2_6? ( python_targets_python2_6 ) python_single_target_python2_7? ( python_targets_python2_7 ) ^^ ( python_single_target_python2_6 python_single_target_python2_7 )"
  173. declare -x PYTHON_SINGLE_TARGET="python2_7"
  174. declare -x PYTHON_TARGETS="python2_7"
  175. declare -- PYTHON_USEDEP="python_targets_python2_6(-)?,python_targets_python2_7(-)?,python_single_target_python2_6(+)?,python_single_target_python2_7(+)?"
  176. declare RDEPEND="
  177. >=x11-libs/gtk+-3.0.0:3
  178. dev-libs/atk
  179. >=dev-libs/glib-2.22:2
  180. >=gnome-base/gconf-2.8:2
  181. >=gnome-base/gnome-panel-2.91.91
  182. x11-libs/cairo
  183. >=x11-libs/libxklavier-4
  184. >=x11-libs/libwnck-2.91.0:3
  185. >=x11-libs/libnotify-0.7:=
  186. x11-libs/pango
  187. >=sys-apps/dbus-1.1.2
  188. >=dev-libs/dbus-glib-0.74
  189. >=dev-libs/libxml2-2.5
  190. >=x11-themes/gnome-icon-theme-2.15.91
  191. >=dev-libs/libgweather-3.5:=
  192. x11-libs/libX11
  193.  
  194. gnome? (
  195. gnome-base/gnome-settings-daemon
  196.  
  197. >=gnome-extra/gucharmap-2.33.0:2.90
  198. >=gnome-base/libgtop-2.11.92
  199.  
  200. python_single_target_python2_6? ( dev-lang/python:2.6 ) python_single_target_python2_7? ( dev-lang/python:2.7 ) dev-python/python-exec[python_targets_python2_6(-)?,python_targets_python2_7(-)?,python_single_target_python2_6(+)?,python_single_target_python2_7(+)?]
  201. dev-python/pygobject:3[python_targets_python2_6(-)?,python_targets_python2_7(-)?,python_single_target_python2_6(+)?,python_single_target_python2_7(+)?]
  202. gnome-base/gconf[introspection]
  203. gnome-base/gnome-panel[introspection]
  204. x11-libs/gdk-pixbuf[introspection]
  205. x11-libs/gtk+:3[introspection]
  206. x11-libs/pango[introspection] )
  207. networkmanager? ( >=net-misc/networkmanager-0.7.0 )
  208. policykit? ( >=sys-auth/polkit-0.92 )
  209. "
  210. declare REPOSITORY
  211. declare REQUIRED_USE=""
  212. declare -x RESTRICT=""
  213. declare -x RESUMECOMMAND_SSH="bash -c \"x=\\\${2#ssh://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && port=22 ; exec rsync --rsh=\\\"ssh -p\\\${port} \\\${3}\\\" -avP \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" rsync \"\${DISTDIR}/\${FILE}\" \"\${URI}\" \"\${PORTAGE_SSH_OPTS}\""
  214. declare -x RUBYOPT="-rauto_gem"
  215. declare -x RUBY_TARGETS="ruby19 ruby18"
  216. declare -x S="/var/tmp/portage/gnome-base/gnome-applets-3.6.0-r1/work/gnome-applets-3.6.0"
  217. declare -x SANDBOX_DEBUG="0"
  218. declare -x SANDBOX_DENY=""
  219. declare -x SANDBOX_PID="3728"
  220. declare -x SANDBOX_PREDICT="/var/tmp/portage/gnome-base/gnome-applets-3.6.0-r1/homedir:/dev/crypto:/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/tts:/dev/tty:/dev/vc/:/dev/zero:/proc/self/fd:/tmp/:/usr/lib/cf:/usr/lib/conftest:/usr/lib32/cf:/usr/lib32/conftest:/usr/lib64/cf:/usr/lib64/conftest:/usr/tmp/cf:/usr/tmp/conftest:/var/tmp:/var/tmp/:/var/tmp/portage/gnome-base/gnome-applets-3.6.0-r1/homedir/.bash_history:/var/tmp/portage/.gnome2"
  224. declare -- SCROLLKEEPER_DIR="/var/lib/scrollkeeper"
  225. declare -- SCROLLKEEPER_UPDATE_BIN="/usr/bin/scrollkeeper-update"
  226. declare -x SHELL="/bin/bash"
  227. declare -x SLOT="0"
  228. declare SRC_URI="http://dev.gentoo.org/~tetromino/distfiles/gnome-applets/gnome-applets-3.6.0-unofficial.tar.xz"
  229. declare -x SSH_ASKPASS="/usr/bin/ssh-askpass-fullscreen"
  230. declare -x SYMLINK_LIB="yes"
  231. declare -x USE="amd64 elibc_glibc gnome ipv6 kernel_linux policykit python_single_target_python2_7 python_targets_python2_7 userland_GNU"
  232. declare -x USERLAND="GNU"
  233. declare -- USE_EINSTALL=""
  234. declare -x USE_EXPAND_IMPLICIT="ARCH ELIBC KERNEL USERLAND"
  235. declare -x USE_EXPAND_UNPREFIXED="ARCH"
  236. declare -x USE_EXPAND_VALUES_ARCH="alpha amd64 amd64-fbsd amd64-linux arm arm-linux hppa hppa-hpux ia64 ia64-hpux ia64-linux m68k m68k-mint mips ppc ppc64 ppc64-linux ppc-aix ppc-macos ppc-openbsd s390 sh sparc sparc64-freebsd sparc64-solaris sparc-fbsd sparc-solaris x64-freebsd x64-macos x64-openbsd x64-solaris x86 x86-cygwin x86-fbsd x86-freebsd x86-interix x86-linux x86-macos x86-netbsd x86-openbsd x86-solaris x86-winnt"
  237. declare -x USE_EXPAND_VALUES_ELIBC="AIX Cygwin Darwin FreeBSD glibc HPUX Interix mintlib musl NetBSD OpenBSD SunOS uclibc Winnt"
  238. declare -x USE_EXPAND_VALUES_KERNEL="AIX Cygwin Darwin FreeBSD freemint HPUX Interix linux NetBSD OpenBSD SunOS Winnt"
  239. declare -x USE_EXPAND_VALUES_USERLAND="BSD GNU"
  240. declare -x VIDEO_CARDS="radeon"
  241. declare -x XDG_CACHE_HOME="/var/tmp/portage/gnome-base/gnome-applets-3.6.0-r1/temp/.cache"
  242. declare -x XDG_CONFIG_DIRS="/etc/xdg"
  243. declare -x XDG_CONFIG_HOME="/var/tmp/portage/gnome-base/gnome-applets-3.6.0-r1/temp/.config"
  244. declare -x XDG_DATA_DIRS="/usr/local/share:/usr/share:/usr/share/gdm"
  245. declare -x XDG_DATA_HOME="/var/tmp/portage/gnome-base/gnome-applets-3.6.0-r1/temp/.local/share"
  246. declare -x XDG_RUNTIME_DIR="/var/tmp/portage/gnome-base/gnome-applets-3.6.0-r1/temp/run"
  247. declare -x XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
  248. declare -x _E_DOCDESTTREE_=""
  249. declare -x _E_EXEDESTTREE_=""
  250. declare -a _PYTHON_ALL_IMPLS='([0]="jython2_5" [1]="jython2_7" [2]="pypy1_9" [3]="pypy2_0" [4]="python3_1" [5]="python3_2" [6]="python3_3" [7]="python2_5" [8]="python2_6" [9]="python2_7")'
  251. declare -- _PYTHON_SINGLE_R1="1"
  252. declare -- _PYTHON_UTILS_R1="1"
  253. declare -- __ELT_NOTED_TMP="true"
  254. declare -- ___ECLASS_ONCE_EUTILS="recur -_+^+_- spank"
  255. declare -- ___ECLASS_ONCE_LIBTOOL="recur -_+^+_- spank"
  256. declare -- ___ECLASS_ONCE_MULTILIB="recur -_+^+_- spank"
  257. declare -- ___ECLASS_ONCE_TOOLCHAIN_FUNCS="recur -_+^+_- spank"
  258. declare -- ___ECLASS_ONCE_USER="recur -_+^+_- spank"
  259. declare -- ___ECLASS_ONCE_VERSIONATOR="recur -_+^+_- spank"
  260. declare -- omf="/var/tmp/portage/gnome-base/gnome-applets-3.6.0-r1/work/gnome-applets-3.6.0/trashapplet/src/Makefile.in"
  261. declare -- phase_func
  262. ELT_libtool_version ()
  263. {
  264. ( unset VERSION;
  265. eval $(grep -e '^[[:space:]]*VERSION=' "$1");
  266. echo "${VERSION:-0}" )
  267. }
  268. ELT_try_and_apply_patch ()
  269. {
  270. local ret=0;
  271. local file=$1;
  272. local patch=$2;
  273. local src=$3;
  274. local disp="${src} patch";
  275. local log="${T}/elibtool.log";
  276. if [[ -z ${__ELT_NOTED_TMP} ]]; then
  277. __ELT_NOTED_TMP=true;
  278. printf 'temp patch: %s\n' "${patch}" > "${log}";
  279. fi;
  280. printf '\nTrying %s\n' "${disp}" >> "${log}";
  281. if [[ ! -e ${file} ]]; then
  282. echo "File not found: ${file}" >> "${log}";
  283. return 1;
  284. fi;
  285. local perms="$(find ${file} -maxdepth 0 -printf '%m')";
  286. if patch -p0 --dry-run "${file}" "${patch}" >> "${log}" 2>&1; then
  287. einfo " Applying ${disp} ...";
  288. patch -p0 -g0 --no-backup-if-mismatch "${file}" "${patch}" >> "${log}" 2>&1;
  289. ret=$?;
  290. export ELT_APPLIED_PATCHES="${ELT_APPLIED_PATCHES} ${src}";
  291. else
  292. ret=1;
  293. fi;
  294. chmod "${perms}" "${file}";
  295. return "${ret}"
  296. }
  297. ELT_walk_patches ()
  298. {
  299. local patch tmp;
  300. local ret=1;
  301. local file=$1;
  302. local patch_set=$2;
  303. local patch_dir="$(elt_patch_dir)/${patch_set}";
  304. local rem_int_dep=$3;
  305. [[ -z ${patch_set} ]] && return 1;
  306. [[ ! -d ${patch_dir} ]] && return 1;
  307. local sed_args=(-e "s:@GENTOO_LIBDIR@:$(get_libdir):g");
  308. if [[ -n ${rem_int_dep} ]]; then
  309. sed_args+=(-e "s|@REM_INT_DEP@|${rem_int_dep}|g");
  310. fi;
  311. pushd "$(elt_patch_dir)" > /dev/null || die;
  312. for patch in $(find "${patch_set}" -maxdepth 1 -type f | LC_ALL=C sort -r);
  313. do
  314. tmp="${T}/libtool-elt.patch";
  315. sed "${sed_args[@]}" "${patch}" > "${tmp}" || die;
  316. if ELT_try_and_apply_patch "${file}" "${tmp}" "${patch}"; then
  317. ret=0;
  318. break;
  319. fi;
  320. done;
  321. popd > /dev/null;
  322. return ${ret}
  323. }
  324. VER_major ()
  325. {
  326. [[ -z $1 ]] && return 1;
  327. local VER=$@;
  328. echo "${VER%%[^[:digit:]]*}"
  329. }
  330. VER_micro ()
  331. {
  332. [[ -z $1 ]] && return 1;
  333. local VER=$@;
  334. VER=${VER#*.*.};
  335. echo "${VER%%[^[:digit:]]*}"
  336. }
  337. VER_minor ()
  338. {
  339. [[ -z $1 ]] && return 1;
  340. local VER=$@;
  341. VER=${VER#*.};
  342. echo "${VER%%[^[:digit:]]*}"
  343. }
  344. VER_to_int ()
  345. {
  346. [[ -z $1 ]] && return 1;
  347. local VER_MAJOR=$(VER_major "$1");
  348. local VER_MINOR=$(VER_minor "$1");
  349. local VER_MICRO=$(VER_micro "$1");
  350. local VER_int=$(( VER_MAJOR * 65536 + VER_MINOR * 256 + VER_MICRO ));
  351. if [[ ${VER_int} -ge 65536 ]]; then
  352. echo "${VER_int}";
  353. return 0;
  354. fi;
  355. echo 1;
  356. return 1
  357. }
  358. _assert_pkg_ebuild_phase ()
  359. {
  360. case ${EBUILD_PHASE} in
  361. setup | preinst | postinst)
  362.  
  363. ;;
  364. *)
  365. eerror "'$1()' called from '${EBUILD_PHASE}' phase which is not OK:";
  366. eerror "You may only call from pkg_{setup,preinst,postinst} functions.";
  367. eerror "Package fails at QA and at life. Please file a bug.";
  368. die "Bad package! $1 is only for use in some pkg_* functions!"
  369. ;;
  370. esac
  371. }
  372. _gcc-install-dir ()
  373. {
  374. echo "$(LC_ALL=C $(tc-getCC) -print-search-dirs 2> /dev/null | awk '$1=="install:" {print $2}')"
  375. }
  376. _gcc-specs-directive_raw ()
  377. {
  378. local cc=$(tc-getCC);
  379. local specfiles=$(LC_ALL=C ${cc} -v 2>&1 | awk '$1=="Reading" {print $NF}');
  380. ${cc} -dumpspecs 2> /dev/null | cat - ${specfiles} | awk -v directive=$1 'BEGIN { pspec=""; spec=""; outside=1 }
  381. $1=="*"directive":" { pspec=spec; spec=""; outside=0; next }
  382. outside || NF==0 || ( substr($1,1,1)=="*" && substr($1,length($1),1)==":" ) { outside=1; next }
  383. spec=="" && substr($0,1,1)=="+" { spec=pspec " " substr($0,2); next }
  384. { spec=spec $0 }
  385. END { print spec }';
  386. return 0
  387. }
  388. _gcc-specs-exists ()
  389. {
  390. [[ -f $(_gcc-install-dir)/$1 ]]
  391. }
  392. _gcc_fullversion ()
  393. {
  394. local ver="$1";
  395. shift;
  396. set -- `$(tc-getCPP "$@") -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__"`;
  397. eval echo "$ver"
  398. }
  399. _iconins ()
  400. {
  401. ( local funcname=$1;
  402. shift;
  403. local size dir;
  404. local context=apps;
  405. local theme=hicolor;
  406. while [[ $# -gt 0 ]]; do
  407. case $1 in
  408. -s | --size)
  409. if [[ ${2%%x*}x${2%%x*} == "$2" ]]; then
  410. size=${2%%x*};
  411. else
  412. size=${2};
  413. fi;
  414. case ${size} in
  415. 16 | 22 | 24 | 32 | 36 | 48 | 64 | 72 | 96 | 128 | 192 | 256)
  416. size=${size}x${size}
  417. ;;
  418. scalable)
  419.  
  420. ;;
  421. *)
  422. eerror "${size} is an unsupported icon size!";
  423. exit 1
  424. ;;
  425. esac;
  426. shift 2
  427. ;;
  428. -t | --theme)
  429. theme=${2};
  430. shift 2
  431. ;;
  432. -c | --context)
  433. context=${2};
  434. shift 2
  435. ;;
  436. *)
  437. if [[ -z ${size} ]]; then
  438. insinto /usr/share/pixmaps;
  439. else
  440. insinto /usr/share/icons/${theme}/${size}/${context};
  441. fi;
  442. if [[ ${funcname} == doicon ]]; then
  443. if [[ -f $1 ]]; then
  444. doins "${1}";
  445. else
  446. if [[ -d $1 ]]; then
  447. shopt -s nullglob;
  448. doins "${1}"/*.{png,svg};
  449. shopt -u nullglob;
  450. else
  451. eerror "${1} is not a valid file/directory!";
  452. exit 1;
  453. fi;
  454. fi;
  455. else
  456. break;
  457. fi;
  458. shift 1
  459. ;;
  460. esac;
  461. done;
  462. if [[ ${funcname} == newicon ]]; then
  463. newins "$@";
  464. fi ) || die
  465. }
  466. _python_impl_supported ()
  467. {
  468. debug-print-function ${FUNCNAME} "${@}";
  469. [[ ${#} -eq 1 ]] || die "${FUNCNAME}: takes exactly 1 argument (impl).";
  470. local impl=${1};
  471. case "${impl}" in
  472. python2_[567] | python3_[123] | pypy1_9 | pypy2_0 | jython2_[57])
  473. return 0
  474. ;;
  475. pypy1_8)
  476. return 1
  477. ;;
  478. *)
  479. die "Invalid implementation in PYTHON_COMPAT: ${impl}"
  480. ;;
  481. esac
  482. }
  483. _python_ln_rel ()
  484. {
  485. debug-print-function ${FUNCNAME} "${@}";
  486. local from=${1};
  487. local to=${2};
  488. local frpath=${from%/*}/;
  489. local topath=${to%/*}/;
  490. local rel_path=;
  491. while [[ -n ${topath} ]]; do
  492. local frseg= toseg=;
  493. while [[ ! -n ${frseg} && -n ${frpath} ]]; do
  494. frseg=${frpath%%/*};
  495. frpath=${frpath#${frseg}/};
  496. done;
  497. while [[ ! -n ${toseg} && -n ${topath} ]]; do
  498. toseg=${topath%%/*};
  499. topath=${topath#${toseg}/};
  500. done;
  501. if [[ ${frseg} != ${toseg} ]]; then
  502. rel_path=../${rel_path}${frseg:+${frseg}/};
  503. fi;
  504. done;
  505. rel_path+=${frpath}${1##*/};
  506. debug-print "${FUNCNAME}: ${from} -> ${to}";
  507. debug-print "${FUNCNAME}: rel_path = ${rel_path}";
  508. ln -fs "${rel_path}" "${to}"
  509. }
  510. _python_rewrite_shebang ()
  511. {
  512. debug-print-function ${FUNCNAME} "${@}";
  513. local impl;
  514. case "${1}" in
  515. python* | jython* | pypy-c*)
  516. impl=${1};
  517. shift
  518. ;;
  519. *)
  520. impl=${EPYTHON};
  521. [[ -n ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON"
  522. ;;
  523. esac;
  524. debug-print "${FUNCNAME}: implementation: ${impl}";
  525. local f;
  526. for f in "$@";
  527. do
  528. local from shebang;
  529. read -r shebang < "${f}";
  530. shebang=${shebang%'
  531. '};
  532. debug-print "${FUNCNAME}: path = ${f}";
  533. debug-print "${FUNCNAME}: shebang = ${shebang}";
  534. if [[ "${shebang} " == *'python '* ]]; then
  535. from=python;
  536. else
  537. if [[ "${shebang} " == *'python2 '* ]]; then
  538. from=python2;
  539. else
  540. if [[ "${shebang} " == *'python3 '* ]]; then
  541. from=python3;
  542. else
  543. eerror "A file does not seem to have a supported shebang:";
  544. eerror " file: ${f}";
  545. eerror " shebang: ${shebang}";
  546. die "${FUNCNAME}: ${f} does not seem to have a valid shebang";
  547. fi;
  548. fi;
  549. fi;
  550. if [[ ${from} == python2 && ${impl} == python3* || ${from} == python3 && ${impl} != python3* ]]; then
  551. eerror "A file does have shebang not supporting requested impl:";
  552. eerror " file: ${f}";
  553. eerror " shebang: ${shebang}";
  554. eerror " impl: ${impl}";
  555. die "${FUNCNAME}: ${f} does have shebang not supporting ${EPYTHON}";
  556. fi;
  557. sed -i -e "1s:${from}:${impl}:" "${f}" || die;
  558. done
  559. }
  560. _python_single_set_globals ()
  561. {
  562. local impls=();
  563. PYTHON_DEPS=;
  564. local i PYTHON_PKG_DEP;
  565. for i in "${PYTHON_COMPAT[@]}";
  566. do
  567. _python_impl_supported "${i}" || continue;
  568. PYTHON_REQUIRED_USE+=" python_single_target_${i}? ( python_targets_${i} )";
  569. python_export "${i}" PYTHON_PKG_DEP;
  570. PYTHON_DEPS+="python_single_target_${i}? ( ${PYTHON_PKG_DEP} ) ";
  571. impls+=("${i}");
  572. done;
  573. if [[ ${#impls[@]} -eq 0 ]]; then
  574. die "No supported implementation in PYTHON_COMPAT.";
  575. fi;
  576. local flags_mt=("${impls[@]/#/python_targets_}");
  577. local flags=("${impls[@]/#/python_single_target_}");
  578. local optflags=${flags_mt[@]/%/(-)?};
  579. optflags+=,${flags[@]/%/(+)?};
  580. IUSE="${flags_mt[*]} ${flags[*]}";
  581. PYTHON_REQUIRED_USE+=" ^^ ( ${flags[*]} )";
  582. PYTHON_USEDEP=${optflags// /,};
  583. PYTHON_DEPS+="dev-python/python-exec[${PYTHON_USEDEP}]"
  584. }
  585. _tc-getPROG ()
  586. {
  587. local tuple=$1;
  588. local v var vars=$2;
  589. local prog=$3;
  590. var=${vars%% *};
  591. for v in ${vars};
  592. do
  593. if [[ -n ${!v} ]]; then
  594. export ${var}="${!v}";
  595. echo "${!v}";
  596. return 0;
  597. fi;
  598. done;
  599. local search=;
  600. [[ -n $4 ]] && search=$(type -p "$4-${prog}");
  601. [[ -z ${search} && -n ${!tuple} ]] && search=$(type -p "${!tuple}-${prog}");
  602. [[ -n ${search} ]] && prog=${search##*/};
  603. export ${var}=${prog};
  604. echo "${!var}"
  605. }
  606. built_with_use ()
  607. {
  608. local hidden="no";
  609. if [[ $1 == "--hidden" ]]; then
  610. hidden="yes";
  611. shift;
  612. fi;
  613. local missing_action="die";
  614. if [[ $1 == "--missing" ]]; then
  615. missing_action=$2;
  616. shift;
  617. shift;
  618. case ${missing_action} in
  619. true | false | die)
  620.  
  621. ;;
  622. *)
  623. die "unknown action '${missing_action}'"
  624. ;;
  625. esac;
  626. fi;
  627. local opt=$1;
  628. [[ ${opt:0:1} = "-" ]] && shift || opt="-a";
  629. local PKG=$(best_version $1);
  630. [[ -z ${PKG} ]] && die "Unable to resolve $1 to an installed package";
  631. shift;
  632. local USEFILE=${ROOT}/var/db/pkg/${PKG}/USE;
  633. local IUSEFILE=${ROOT}/var/db/pkg/${PKG}/IUSE;
  634. if [[ ! -e ${USEFILE} ]] || [[ ! -e ${IUSEFILE} && ${hidden} == "no" ]]; then
  635. case ${missing_action} in
  636. true)
  637. return 0
  638. ;;
  639. false)
  640. return 1
  641. ;;
  642. die)
  643. die "Unable to determine what USE flags $PKG was built with"
  644. ;;
  645. esac;
  646. fi;
  647. if [[ ${hidden} == "no" ]]; then
  648. local IUSE_BUILT=($(<"${IUSEFILE}"));
  649. local expand;
  650. for expand in $(echo ${USE_EXPAND} | tr '[:upper:]' '[:lower:]');
  651. do
  652. if [[ $1 == ${expand}_* ]]; then
  653. expand="";
  654. break;
  655. fi;
  656. done;
  657. if [[ -n ${expand} ]]; then
  658. if ! has $1 ${IUSE_BUILT[@]#[-+]}; then
  659. case ${missing_action} in
  660. true)
  661. return 0
  662. ;;
  663. false)
  664. return 1
  665. ;;
  666. die)
  667. die "$PKG does not actually support the $1 USE flag!"
  668. ;;
  669. esac;
  670. fi;
  671. fi;
  672. fi;
  673. local USE_BUILT=$(<${USEFILE});
  674. while [[ $# -gt 0 ]]; do
  675. if [[ ${opt} = "-o" ]]; then
  676. has $1 ${USE_BUILT} && return 0;
  677. else
  678. has $1 ${USE_BUILT} || return 1;
  679. fi;
  680. shift;
  681. done;
  682. [[ ${opt} = "-a" ]]
  683. }
  684. check_license ()
  685. {
  686. die "you no longer need this as portage supports ACCEPT_LICENSE itself"
  687. }
  688. darwintoolize ()
  689. {
  690. die "Use elibtoolize"
  691. }
  692. delete_all_version_separators ()
  693. {
  694. replace_all_version_separators "" "${1}"
  695. }
  696. delete_version_separator ()
  697. {
  698. replace_version_separator "${1}" "" "${2}"
  699. }
  700. doicon ()
  701. {
  702. _iconins ${FUNCNAME} "$@"
  703. }
  704. domenu ()
  705. {
  706. ( local i j ret=0;
  707. insinto /usr/share/applications;
  708. for i in "$@";
  709. do
  710. if [[ -f ${i} ]]; then
  711. doins "${i}";
  712. ((ret+=$?));
  713. else
  714. if [[ -d ${i} ]]; then
  715. for j in "${i}"/*.desktop;
  716. do
  717. doins "${j}";
  718. ((ret+=$?));
  719. done;
  720. else
  721. ((++ret));
  722. fi;
  723. fi;
  724. done;
  725. exit ${ret} )
  726. }
  727. ebeep ()
  728. {
  729. ewarn "QA Notice: ebeep is not defined in EAPI=${EAPI}, please file a bug at http://bugs.gentoo.org"
  730. }
  731. econf_build ()
  732. {
  733. tc-env_build econf --build=${CBUILD:-${CHOST}} "$@"
  734. }
  735. ecvs_clean ()
  736. {
  737. [[ -z $* ]] && set -- .;
  738. find "$@" -type d -name 'CVS' -prune -print0 | xargs -0 rm -rf;
  739. find "$@" -type f -name '.cvs*' -print0 | xargs -0 rm -rf
  740. }
  741. edos2unix ()
  742. {
  743. [[ $# -eq 0 ]] && return 0;
  744. sed -i 's/\r$//' -- "$@" || die
  745. }
  746. egetent ()
  747. {
  748. local db=$1 key=$2;
  749. [[ $# -ge 3 ]] && die "usage: egetent <database> <key>";
  750. case ${db} in
  751. passwd | group)
  752.  
  753. ;;
  754. *)
  755. die "sorry, database '${db}' not yet supported; file a bug"
  756. ;;
  757. esac;
  758. case ${CHOST} in
  759. *-darwin[678])
  760. case ${key} in
  761. *[!0-9]*)
  762. nidump ${db} . | awk -F: "(\$1 ~ /^${key}\$/) {print;exit;}"
  763. ;;
  764. *)
  765. nidump ${db} . | awk -F: "(\$3 == ${key}) {print;exit;}"
  766. ;;
  767. esac
  768. ;;
  769. *-darwin*)
  770. local mykey;
  771. case ${db} in
  772. passwd)
  773. db="Users" mykey="UniqueID"
  774. ;;
  775. group)
  776. db="Groups" mykey="PrimaryGroupID"
  777. ;;
  778. esac;
  779. case ${key} in
  780. *[!0-9]*)
  781. dscl . -read /${db}/${key} 2> /dev/null | grep RecordName
  782. ;;
  783. *)
  784. dscl . -search /${db} ${mykey} ${key} 2> /dev/null
  785. ;;
  786. esac
  787. ;;
  788. *-freebsd* | *-dragonfly*)
  789. case ${db} in
  790. passwd)
  791. db="user"
  792. ;;
  793. *)
  794.  
  795. ;;
  796. esac;
  797. local opts;
  798. if [[ ${key} == [[:digit:]]* ]]; then
  799. [[ ${db} == "user" ]] && opts="-u" || opts="-g";
  800. fi;
  801. pw show ${db} ${opts} "${key}" -q
  802. ;;
  803. *-netbsd* | *-openbsd*)
  804. grep "${key}:\*:" /etc/${db}
  805. ;;
  806. *)
  807. nscd -i "${db}" 2> /dev/null;
  808. getent "${db}" "${key}"
  809. ;;
  810. esac
  811. }
  812. egethome ()
  813. {
  814. local pos;
  815. [[ $# -eq 1 ]] || die "usage: egethome <user>";
  816. case ${CHOST} in
  817. *-darwin* | *-freebsd* | *-dragonfly*)
  818. pos=9
  819. ;;
  820. *)
  821. pos=6
  822. ;;
  823. esac;
  824. egetent passwd "$1" | cut -d: -f${pos}
  825. }
  826. egetshell ()
  827. {
  828. local pos;
  829. [[ $# -eq 1 ]] || die "usage: egetshell <user>";
  830. case ${CHOST} in
  831. *-darwin* | *-freebsd* | *-dragonfly*)
  832. pos=10
  833. ;;
  834. *)
  835. pos=7
  836. ;;
  837. esac;
  838. egetent passwd "$1" | cut -d: -f${pos}
  839. }
  840. elibtoolize ()
  841. {
  842. local x;
  843. local do_portage="no";
  844. local do_reversedeps="no";
  845. local do_only_patches="no";
  846. local do_uclibc="yes";
  847. local deptoremove=;
  848. local do_shallow="no";
  849. local force="false";
  850. local elt_patches="install-sh ltmain portage relink max_cmd_len sed test tmp cross as-needed target-nm";
  851. for x in "$@";
  852. do
  853. case ${x} in
  854. --portage)
  855. do_portage="yes"
  856. ;;
  857. --reverse-deps)
  858. do_reversedeps="yes";
  859. elt_patches+=" fix-relink"
  860. ;;
  861. --patch-only)
  862. do_only_patches="yes"
  863. ;;
  864. --remove-internal-dep=*)
  865. deptoremove=${x#--remove-internal-dep=};
  866. [[ -n ${deptoremove} ]] && elt_patches+=" rem-int-dep"
  867. ;;
  868. --shallow)
  869. do_shallow="yes"
  870. ;;
  871. --no-uclibc)
  872. do_uclibc="no"
  873. ;;
  874. --force)
  875. force="true"
  876. ;;
  877. *)
  878. eerror "Invalid elibtoolize option: ${x}";
  879. die "elibtoolize called with ${x} ??"
  880. ;;
  881. esac;
  882. done;
  883. [[ ${do_uclibc} == "yes" ]] && elt_patches+=" uclibc-conf uclibc-ltconf";
  884. case ${CHOST} in
  885. *-aix*)
  886. elt_patches+=" hardcode aixrtl aix-noundef"
  887. ;;
  888. *-darwin*)
  889. elt_patches+=" darwin-ltconf darwin-ltmain darwin-conf"
  890. ;;
  891. *-solaris*)
  892. elt_patches+=" sol2-conf sol2-ltmain"
  893. ;;
  894. *-freebsd*)
  895. elt_patches+=" fbsd-conf fbsd-ltconf"
  896. ;;
  897. *-hpux*)
  898. elt_patches+=" hpux-conf deplibs hc-flag-ld hardcode hardcode-relink relink-prog no-lc"
  899. ;;
  900. *-irix*)
  901. elt_patches+=" irix-ltmain"
  902. ;;
  903. *-mint*)
  904. elt_patches+=" mint-conf"
  905. ;;
  906. esac;
  907. if $(tc-getLD) --version 2>&1 | grep -qs 'GNU gold'; then
  908. elt_patches+=" gold-conf";
  909. fi;
  910. set --;
  911. if [[ ${do_shallow} == "yes" ]]; then
  912. [[ -f ${S}/ltmain.sh ]] && set -- "${S}";
  913. else
  914. set -- $(find "${S}" -name ltmain.sh -printf '%h ');
  915. fi;
  916. local d p;
  917. for d in "$@";
  918. do
  919. export ELT_APPLIED_PATCHES=;
  920. if [[ -f ${d}/.elibtoolized ]]; then
  921. ${force} || continue;
  922. fi;
  923. local outfunc="einfo";
  924. [[ -f ${d}/.elibtoolized ]] && outfunc="ewarn";
  925. ${outfunc} "Running elibtoolize in: ${d#${WORKDIR}/}/";
  926. if [[ ${outfunc} == "ewarn" ]]; then
  927. ewarn " We've already been run in this tree; you should";
  928. ewarn " avoid this if possible (perhaps by filing a bug)";
  929. fi;
  930. for p in ${elt_patches};
  931. do
  932. local ret=0;
  933. case ${p} in
  934. portage)
  935. if ! grep -qs 'We do not want portage' "${d}/ltmain.sh"; then
  936. ELT_walk_patches "${d}/ltmain.sh" "${p}";
  937. ret=$?;
  938. fi
  939. ;;
  940. rem-int-dep)
  941. ELT_walk_patches "${d}/ltmain.sh" "${p}" "${deptoremove}";
  942. ret=$?
  943. ;;
  944. fix-relink)
  945. if grep -qs 'inst_prefix_dir' "${d}/ltmain.sh"; then
  946. ELT_walk_patches "${d}/ltmain.sh" "${p}";
  947. ret=$?;
  948. fi
  949. ;;
  950. max_cmd_len)
  951. if grep -qs 'max_cmd_len' "${d}/ltmain.sh"; then
  952. ELT_walk_patches "${d}/ltmain.sh" "${p}";
  953. ret=$?;
  954. fi
  955. ;;
  956. as-needed)
  957. ELT_walk_patches "${d}/ltmain.sh" "${p}";
  958. ret=$?
  959. ;;
  960. uclibc-conf)
  961. if grep -qs 'Transform linux' "${d}/configure"; then
  962. ELT_walk_patches "${d}/configure" "${p}";
  963. ret=$?;
  964. else
  965. if [[ ! -e ${d}/configure ]] && grep -qs 'Transform linux' "${d}/../configure"; then
  966. ELT_walk_patches "${d}/../configure" "${p}";
  967. ret=$?;
  968. fi;
  969. fi
  970. ;;
  971. uclibc-ltconf)
  972. if [[ -s ${d}/ltconfig ]]; then
  973. ELT_walk_patches "${d}/ltconfig" "${p}";
  974. ret=$?;
  975. fi
  976. ;;
  977. fbsd-conf)
  978. if grep -qs 'version_type=freebsd-' "${d}/configure"; then
  979. ELT_walk_patches "${d}/configure" "${p}";
  980. ret=$?;
  981. else
  982. if [[ ! -e ${d}/configure ]] && grep -qs 'version_type=freebsd-' "${d}/../configure"; then
  983. ELT_walk_patches "${d}/../configure" "${p}";
  984. ret=$?;
  985. fi;
  986. fi
  987. ;;
  988. fbsd-ltconf)
  989. if [[ -s ${d}/ltconfig ]]; then
  990. ELT_walk_patches "${d}/ltconfig" "${p}";
  991. ret=$?;
  992. fi
  993. ;;
  994. darwin-conf)
  995. if grep -qs '&& echo \.so ||' "${d}/configure"; then
  996. ELT_walk_patches "${d}/configure" "${p}";
  997. ret=$?;
  998. else
  999. if [[ ! -e ${d}/configure ]] && grep -qs '&& echo \.so ||' "${d}/../configure"; then
  1000. ELT_walk_patches "${d}/../configure" "${p}";
  1001. ret=$?;
  1002. fi;
  1003. fi
  1004. ;;
  1005. darwin-ltconf)
  1006. if [[ -s ${d}/ltconfig ]]; then
  1007. ELT_walk_patches "${d}/ltconfig" "${p}";
  1008. ret=$?;
  1009. fi
  1010. ;;
  1011. darwin-ltmain)
  1012. if [[ -e ${d}/ltmain.sh ]] && ! grep -qs 'verstring="-compatibility_version' "${d}/ltmain.sh"; then
  1013. ELT_walk_patches "${d}/ltmain.sh" "${p}";
  1014. ret=$?;
  1015. fi
  1016. ;;
  1017. aixrtl | hpux-conf)
  1018. ret=1;
  1019. local subret=0;
  1020. while [[ $subret -eq 0 ]]; do
  1021. subret=1;
  1022. if [[ -e ${d}/configure ]]; then
  1023. ELT_walk_patches "${d}/configure" "${p}";
  1024. subret=$?;
  1025. else
  1026. if [[ ! -e ${d}/configure && -e ${d}/../configure ]]; then
  1027. ELT_walk_patches "${d}/../configure" "${p}";
  1028. subret=$?;
  1029. fi;
  1030. fi;
  1031. if [[ $subret -eq 0 ]]; then
  1032. ret=0;
  1033. fi;
  1034. done
  1035. ;;
  1036. mint-conf | gold-conf | sol2-conf)
  1037. ret=1;
  1038. local subret=1;
  1039. if [[ -e ${d}/configure ]]; then
  1040. ELT_walk_patches "${d}/configure" "${p}";
  1041. subret=$?;
  1042. else
  1043. if [[ -e ${d}/../configure ]]; then
  1044. ELT_walk_patches "${d}/../configure" "${p}";
  1045. subret=$?;
  1046. else
  1047. if [[ -e ${d}/../../configure ]]; then
  1048. ELT_walk_patches "${d}/../../configure" "${p}";
  1049. subret=$?;
  1050. fi;
  1051. fi;
  1052. fi;
  1053. if [[ $subret -eq 0 ]]; then
  1054. ret=0;
  1055. fi
  1056. ;;
  1057. target-nm)
  1058. ELT_walk_patches "${d}/configure" "${p}";
  1059. ret=$?
  1060. ;;
  1061. install-sh)
  1062. ELT_walk_patches "${d}/install-sh" "${p}";
  1063. ret=$?
  1064. ;;
  1065. cross)
  1066. if tc-is-cross-compiler; then
  1067. ELT_walk_patches "${d}/ltmain.sh" "${p}";
  1068. ret=$?;
  1069. fi
  1070. ;;
  1071. *)
  1072. ELT_walk_patches "${d}/ltmain.sh" "${p}";
  1073. ret=$?
  1074. ;;
  1075. esac;
  1076. if [[ ${ret} -ne 0 ]]; then
  1077. case ${p} in
  1078. relink)
  1079. local version=$(ELT_libtool_version "${d}/ltmain.sh");
  1080. if ! grep -qs 'inst_prefix_dir' "${d}/ltmain.sh" && [[ $(VER_to_int "${version}") -ge $(VER_to_int "1.4.0") ]]; then
  1081. ewarn " Could not apply relink.patch!";
  1082. fi
  1083. ;;
  1084. portage)
  1085. if [[ ${do_portage} == "yes" ]]; then
  1086. if ! grep -qs 'We do not want portage' "${d}/ltmain.sh"; then
  1087. echo;
  1088. eerror "Portage patch requested, but failed to apply!";
  1089. eerror "Please file a bug report to add a proper patch.";
  1090. die "Portage patch requested, but failed to apply!";
  1091. fi;
  1092. else
  1093. if grep -qs 'We do not want portage' "${d}/ltmain.sh"; then
  1094. :;
  1095. else
  1096. local version=$(ELT_libtool_version "${d}"/ltmain.sh);
  1097. echo;
  1098. eerror "Portage patch failed to apply (ltmain.sh version ${version})!";
  1099. eerror "Please file a bug report to add a proper patch.";
  1100. die "Portage patch failed to apply!";
  1101. fi;
  1102. ELT_APPLIED_PATCHES="portage";
  1103. fi
  1104. ;;
  1105. uclibc-*)
  1106. [[ ${CHOST} == *-uclibc ]] && ewarn " uClibc patch set '${p}' failed to apply!"
  1107. ;;
  1108. fbsd-*)
  1109. if [[ ${CHOST} == *-freebsd* ]]; then
  1110. if [[ -z $(grep 'Handle Gentoo/FreeBSD as it was Linux' "${d}/configure" "${d}/../configure" 2>/dev/null) ]]; then
  1111. eerror " FreeBSD patch set '${p}' failed to apply!";
  1112. die "FreeBSD patch set '${p}' failed to apply!";
  1113. fi;
  1114. fi
  1115. ;;
  1116. darwin-*)
  1117. [[ ${CHOST} == *"-darwin"* ]] && ewarn " Darwin patch set '${p}' failed to apply!"
  1118. ;;
  1119. esac;
  1120. fi;
  1121. done;
  1122. if [[ -z ${ELT_APPLIED_PATCHES} ]]; then
  1123. if [[ ${do_portage} == "no" && ${do_reversedeps} == "no" && ${do_only_patches} == "no" && ${deptoremove} == "" ]]; then
  1124. ewarn "Cannot apply any patches, please file a bug about this";
  1125. die;
  1126. fi;
  1127. fi;
  1128. rm -f "${d}/libtool";
  1129. > "${d}/.elibtoolized";
  1130. done
  1131. }
  1132. elt_patch_dir ()
  1133. {
  1134. local d="${ECLASSDIR}/ELT-patches";
  1135. if [[ ! -d ${d} ]]; then
  1136. d="${ECLASSDIR_LOCAL}/ELT-patches";
  1137. fi;
  1138. echo "${d}"
  1139. }
  1140. emktemp ()
  1141. {
  1142. local exe="touch";
  1143. [[ $1 == -d ]] && exe="mkdir" && shift;
  1144. local topdir=$1;
  1145. if [[ -z ${topdir} ]]; then
  1146. [[ -z ${T} ]] && topdir="/tmp" || topdir=${T};
  1147. fi;
  1148. if ! type -P mktemp > /dev/null; then
  1149. local tmp=/;
  1150. while [[ -e ${tmp} ]]; do
  1151. tmp=${topdir}/tmp.${RANDOM}.${RANDOM}.${RANDOM};
  1152. done;
  1153. ${exe} "${tmp}" || ${exe} -p "${tmp}";
  1154. echo "${tmp}";
  1155. else
  1156. if [[ ${exe} == "touch" ]]; then
  1157. TMPDIR="${topdir}" mktemp -t tmp.XXXXXXXXXX;
  1158. else
  1159. TMPDIR="${topdir}" mktemp -dt tmp.XXXXXXXXXX;
  1160. fi;
  1161. fi
  1162. }
  1163. enewgroup ()
  1164. {
  1165. _assert_pkg_ebuild_phase ${FUNCNAME};
  1166. local egroup=$1;
  1167. shift;
  1168. if [[ -z ${egroup} ]]; then
  1169. eerror "No group specified !";
  1170. die "Cannot call enewgroup without a group";
  1171. fi;
  1172. if [[ -n $(egetent group "${egroup}") ]]; then
  1173. return 0;
  1174. fi;
  1175. einfo "Adding group '${egroup}' to your system ...";
  1176. local egid=$1;
  1177. shift;
  1178. if [[ ! -z ${egid} ]]; then
  1179. if [[ ${egid} -gt 0 ]]; then
  1180. if [[ -n $(egetent group ${egid}) ]]; then
  1181. egid="next available; requested gid taken";
  1182. fi;
  1183. else
  1184. eerror "Groupid given but is not greater than 0 !";
  1185. die "${egid} is not a valid GID";
  1186. fi;
  1187. else
  1188. egid="next available";
  1189. fi;
  1190. einfo " - Groupid: ${egid}";
  1191. if [[ $# -gt 0 ]]; then
  1192. die "extra arguments no longer supported; please file a bug";
  1193. fi;
  1194. function _enewgroup_next_gid ()
  1195. {
  1196. if [[ ${egid} == *[!0-9]* ]]; then
  1197. for ((egid = 101; egid <= 999; egid++))
  1198. do
  1199. [[ -z $(egetent group ${egid}) ]] && break;
  1200. done;
  1201. fi
  1202. };
  1203. case ${CHOST} in
  1204. *-darwin*)
  1205. _enewgroup_next_gid;
  1206. dscl . create "/groups/${egroup}" gid ${egid};
  1207. dscl . create "/groups/${egroup}" passwd '*'
  1208. ;;
  1209. *-freebsd* | *-dragonfly*)
  1210. _enewgroup_next_gid;
  1211. pw groupadd "${egroup}" -g ${egid} || die
  1212. ;;
  1213. *-netbsd*)
  1214. _enewgroup_next_gid;
  1215. groupadd -g ${egid} "${egroup}" || die
  1216. ;;
  1217. *)
  1218. local opts;
  1219. if [[ ${egid} == *[!0-9]* ]]; then
  1220. opts="";
  1221. else
  1222. opts="-g ${egid}";
  1223. fi;
  1224. groupadd -r ${opts} "${egroup}" || die
  1225. ;;
  1226. esac
  1227. }
  1228. enewuser ()
  1229. {
  1230. _assert_pkg_ebuild_phase ${FUNCNAME};
  1231. local euser=$1;
  1232. shift;
  1233. if [[ -z ${euser} ]]; then
  1234. eerror "No username specified !";
  1235. die "Cannot call enewuser without a username";
  1236. fi;
  1237. if [[ -n $(egetent passwd "${euser}") ]]; then
  1238. return 0;
  1239. fi;
  1240. einfo "Adding user '${euser}' to your system ...";
  1241. local opts=();
  1242. local euid=$1;
  1243. shift;
  1244. if [[ -n ${euid} && ${euid} != -1 ]]; then
  1245. if [[ ${euid} -gt 0 ]]; then
  1246. if [[ -n $(egetent passwd ${euid}) ]]; then
  1247. euid="next";
  1248. fi;
  1249. else
  1250. eerror "Userid given but is not greater than 0 !";
  1251. die "${euid} is not a valid UID";
  1252. fi;
  1253. else
  1254. euid="next";
  1255. fi;
  1256. if [[ ${euid} == "next" ]]; then
  1257. for ((euid = 101; euid <= 999; euid++))
  1258. do
  1259. [[ -z $(egetent passwd ${euid}) ]] && break;
  1260. done;
  1261. fi;
  1262. opts+=(-u ${euid});
  1263. einfo " - Userid: ${euid}";
  1264. local eshell=$1;
  1265. shift;
  1266. if [[ ! -z ${eshell} ]] && [[ ${eshell} != "-1" ]]; then
  1267. if [[ ! -e ${ROOT}${eshell} ]]; then
  1268. eerror "A shell was specified but it does not exist !";
  1269. die "${eshell} does not exist in ${ROOT}";
  1270. fi;
  1271. if [[ ${eshell} == */false || ${eshell} == */nologin ]]; then
  1272. eerror "Do not specify ${eshell} yourself, use -1";
  1273. die "Pass '-1' as the shell parameter";
  1274. fi;
  1275. else
  1276. for eshell in /sbin/nologin /usr/sbin/nologin /bin/false /usr/bin/false /dev/null;
  1277. do
  1278. [[ -x ${ROOT}${eshell} ]] && break;
  1279. done;
  1280. if [[ ${eshell} == "/dev/null" ]]; then
  1281. eerror "Unable to identify the shell to use, proceeding with userland default.";
  1282. case ${USERLAND} in
  1283. GNU)
  1284. eshell="/bin/false"
  1285. ;;
  1286. BSD)
  1287. eshell="/sbin/nologin"
  1288. ;;
  1289. Darwin)
  1290. eshell="/usr/sbin/nologin"
  1291. ;;
  1292. *)
  1293. die "Unable to identify the default shell for userland ${USERLAND}"
  1294. ;;
  1295. esac;
  1296. fi;
  1297. fi;
  1298. einfo " - Shell: ${eshell}";
  1299. opts+=(-s "${eshell}");
  1300. local ehome=$1;
  1301. shift;
  1302. if [[ -z ${ehome} ]] || [[ ${ehome} == "-1" ]]; then
  1303. ehome="/dev/null";
  1304. fi;
  1305. einfo " - Home: ${ehome}";
  1306. opts+=(-d "${ehome}");
  1307. local egroups=$1;
  1308. shift;
  1309. local g egroups_arr;
  1310. IFS="," read -r -a egroups_arr <<< "${egroups}";
  1311. shift;
  1312. if [[ ${#egroups_arr[@]} -gt 0 ]]; then
  1313. local defgroup exgroups;
  1314. for g in "${egroups_arr[@]}";
  1315. do
  1316. if [[ -z $(egetent group "${g}") ]]; then
  1317. eerror "You must add group ${g} to the system first";
  1318. die "${g} is not a valid GID";
  1319. fi;
  1320. if [[ -z ${defgroup} ]]; then
  1321. defgroup=${g};
  1322. else
  1323. exgroups+=",${g}";
  1324. fi;
  1325. done;
  1326. opts+=(-g "${defgroup}");
  1327. if [[ ! -z ${exgroups} ]]; then
  1328. opts+=(-G "${exgroups:1}");
  1329. fi;
  1330. fi;
  1331. einfo " - Groups: ${egroups:-(none)}";
  1332. if [[ $# -gt 0 ]]; then
  1333. die "extra arguments no longer supported; please file a bug";
  1334. else
  1335. local comment="added by portage for ${PN}";
  1336. opts+=(-c "${comment}");
  1337. einfo " - GECOS: ${comment}";
  1338. fi;
  1339. case ${CHOST} in
  1340. *-darwin*)
  1341. dscl . create "/users/${euser}" uid ${euid};
  1342. dscl . create "/users/${euser}" shell "${eshell}";
  1343. dscl . create "/users/${euser}" home "${ehome}";
  1344. dscl . create "/users/${euser}" realname "added by portage for ${PN}";
  1345. for g in "${egroups_arr[@]}";
  1346. do
  1347. dscl . merge "/groups/${g}" users "${euser}";
  1348. done
  1349. ;;
  1350. *-freebsd* | *-dragonfly*)
  1351. pw useradd "${euser}" "${opts[@]}" || die
  1352. ;;
  1353. *-netbsd*)
  1354. useradd "${opts[@]}" "${euser}" || die
  1355. ;;
  1356. *-openbsd*)
  1357. useradd -u ${euid} -s "${eshell}" -d "${ehome}" -g "${egroups}" "${euser}" || die
  1358. ;;
  1359. *)
  1360. useradd -r "${opts[@]}" "${euser}" || die
  1361. ;;
  1362. esac;
  1363. if [[ ! -e ${ROOT}/${ehome} ]]; then
  1364. einfo " - Creating ${ehome} in ${ROOT}";
  1365. mkdir -p "${ROOT}/${ehome}";
  1366. chown "${euser}" "${ROOT}/${ehome}";
  1367. chmod 755 "${ROOT}/${ehome}";
  1368. fi
  1369. }
  1370. epatch ()
  1371. {
  1372. function _epatch_draw_line ()
  1373. {
  1374. [[ -z $1 ]] && set "$(printf "%65s" '')";
  1375. echo "${1//?/=}"
  1376. };
  1377. unset P4CONFIG P4PORT P4USER;
  1378. local EPATCH_OPTS=(${EPATCH_OPTS[*]});
  1379. while [[ $# -gt 0 ]]; do
  1380. case $1 in
  1381. -*)
  1382. EPATCH_OPTS+=("$1")
  1383. ;;
  1384. *)
  1385. break
  1386. ;;
  1387. esac;
  1388. shift;
  1389. done;
  1390. if [[ $# -gt 1 ]]; then
  1391. local m;
  1392. for m in "$@";
  1393. do
  1394. epatch "${m}";
  1395. done;
  1396. return 0;
  1397. fi;
  1398. local SINGLE_PATCH="no";
  1399. [[ $# -eq 0 ]] && set -- "${EPATCH_SOURCE}";
  1400. if [[ -f $1 ]]; then
  1401. SINGLE_PATCH="yes";
  1402. set -- "$1";
  1403. local EPATCH_SUFFIX=$1;
  1404. else
  1405. if [[ -d $1 ]]; then
  1406. evar_push_set LC_COLLATE C;
  1407. set -- "$1"/*${EPATCH_SUFFIX:+."${EPATCH_SUFFIX}"};
  1408. evar_pop;
  1409. else
  1410. if [[ -f ${EPATCH_SOURCE}/$1 ]]; then
  1411. epatch "${EPATCH_SOURCE}/$1";
  1412. return $?;
  1413. else
  1414. [[ $# -ne 0 ]] && EPATCH_SOURCE=$1;
  1415. echo;
  1416. eerror "Cannot find \$EPATCH_SOURCE! Value for \$EPATCH_SOURCE is:";
  1417. eerror;
  1418. eerror " ${EPATCH_SOURCE}";
  1419. eerror " ( ${EPATCH_SOURCE##*/} )";
  1420. echo;
  1421. die "Cannot find \$EPATCH_SOURCE!";
  1422. fi;
  1423. fi;
  1424. fi;
  1425. EPATCH_OPTS="${EPATCH_COMMON_OPTS} ${EPATCH_OPTS[*]}";
  1426. local PIPE_CMD;
  1427. case ${EPATCH_SUFFIX##*\.} in
  1428. xz)
  1429. PIPE_CMD="xz -dc"
  1430. ;;
  1431. lzma)
  1432. PIPE_CMD="lzma -dc"
  1433. ;;
  1434. bz2)
  1435. PIPE_CMD="bzip2 -dc"
  1436. ;;
  1437. gz | Z | z)
  1438. PIPE_CMD="gzip -dc"
  1439. ;;
  1440. ZIP | zip)
  1441. PIPE_CMD="unzip -p"
  1442. ;;
  1443. *)
  1444.  
  1445. ;;
  1446. esac;
  1447. [[ ${SINGLE_PATCH} == "no" ]] && einfo "${EPATCH_MULTI_MSG}";
  1448. local x;
  1449. for x in "$@";
  1450. do
  1451. [[ ! -f ${x} ]] && continue;
  1452. local patchname=${x##*/};
  1453. local a=${patchname#*_};
  1454. a=${a%%_*};
  1455. if ! [[ ${SINGLE_PATCH} == "yes" || ${EPATCH_FORCE} == "yes" || ${a} == all || ${a} == ${ARCH} ]]; then
  1456. continue;
  1457. fi;
  1458. if [[ -n ${EPATCH_EXCLUDE} ]]; then
  1459. eshopts_push -o noglob;
  1460. local ex;
  1461. for ex in ${EPATCH_EXCLUDE};
  1462. do
  1463. if [[ ${patchname} == ${ex} ]]; then
  1464. einfo " Skipping ${patchname} due to EPATCH_EXCLUDE ...";
  1465. eshopts_pop;
  1466. continue 2;
  1467. fi;
  1468. done;
  1469. for ex in ${EPATCH_USER_EXCLUDE};
  1470. do
  1471. if [[ ${patchname} == ${ex} ]]; then
  1472. einfo " Skipping ${patchname} due to EPATCH_USER_EXCLUDE ...";
  1473. eshopts_pop;
  1474. continue 2;
  1475. fi;
  1476. done;
  1477. eshopts_pop;
  1478. fi;
  1479. if [[ ${SINGLE_PATCH} == "yes" ]]; then
  1480. if [[ -n ${EPATCH_SINGLE_MSG} ]]; then
  1481. einfo "${EPATCH_SINGLE_MSG}";
  1482. else
  1483. einfo "Applying ${patchname} ...";
  1484. fi;
  1485. else
  1486. einfo " ${patchname} ...";
  1487. fi;
  1488. local STDERR_TARGET="${T}/${patchname}.out";
  1489. if [[ -e ${STDERR_TARGET} ]]; then
  1490. STDERR_TARGET="${T}/${patchname}-$$.out";
  1491. fi;
  1492. printf "***** %s *****\nPWD: %s\n\n" "${patchname}" "${PWD}" > "${STDERR_TARGET}";
  1493. local count=0;
  1494. local PATCH_TARGET;
  1495. if [[ -n ${PIPE_CMD} ]]; then
  1496. PATCH_TARGET="${T}/$$.patch";
  1497. echo "PIPE_COMMAND: ${PIPE_CMD} ${x} > ${PATCH_TARGET}" >> "${STDERR_TARGET}";
  1498. if ! ( ${PIPE_CMD} "${x}" > "${PATCH_TARGET}" ) >> "${STDERR_TARGET}" 2>&1; then
  1499. echo;
  1500. eerror "Could not extract patch!";
  1501. count=5;
  1502. break;
  1503. fi;
  1504. else
  1505. PATCH_TARGET=${x};
  1506. fi;
  1507. local abs_paths=$(egrep -n '^[-+]{3} /' "${PATCH_TARGET}" | awk '$2 != "/dev/null" { print }');
  1508. if [[ -n ${abs_paths} ]]; then
  1509. count=1;
  1510. printf "NOTE: skipping -p0 due to absolute paths in patch:\n%s\n" "${abs_paths}" >> "${STDERR_TARGET}";
  1511. fi;
  1512. local rel_paths=$(egrep -n '^[-+]{3} [^ ]*[.][.]/' "${PATCH_TARGET}");
  1513. if [[ -n ${rel_paths} ]]; then
  1514. echo;
  1515. eerror "Rejected Patch: ${patchname} !";
  1516. eerror " ( ${PATCH_TARGET} )";
  1517. eerror;
  1518. eerror "Your patch uses relative paths '../':";
  1519. eerror "${rel_paths}";
  1520. echo;
  1521. die "you need to fix the relative paths in patch";
  1522. fi;
  1523. local patch_cmd;
  1524. local patch="patch";
  1525. eval $(alias patch 2>/dev/null | sed 's:^alias ::');
  1526. while [[ ${count} -lt 5 ]]; do
  1527. patch_cmd="${patch} -p${count} ${EPATCH_OPTS}";
  1528. ( _epatch_draw_line "***** ${patchname} *****";
  1529. echo;
  1530. echo "PATCH COMMAND: ${patch_cmd} < '${PATCH_TARGET}'";
  1531. echo;
  1532. _epatch_draw_line "***** ${patchname} *****";
  1533. ${patch_cmd} --dry-run -f < "${PATCH_TARGET}" 2>&1;
  1534. ret=$?;
  1535. echo;
  1536. echo "patch program exited with status ${ret}";
  1537. exit ${ret} ) >> "${STDERR_TARGET}";
  1538. if [ $? -eq 0 ]; then
  1539. ( _epatch_draw_line "***** ${patchname} *****";
  1540. echo;
  1541. echo "ACTUALLY APPLYING ${patchname} ...";
  1542. echo;
  1543. _epatch_draw_line "***** ${patchname} *****";
  1544. ${patch_cmd} < "${PATCH_TARGET}" 2>&1;
  1545. ret=$?;
  1546. echo;
  1547. echo "patch program exited with status ${ret}";
  1548. exit ${ret} ) >> "${STDERR_TARGET}";
  1549. if [ $? -ne 0 ]; then
  1550. echo;
  1551. eerror "A dry-run of patch command succeeded, but actually";
  1552. eerror "applying the patch failed!";
  1553. count=5;
  1554. fi;
  1555. break;
  1556. fi;
  1557. : $(( count++ ));
  1558. done;
  1559. if [[ -n ${PIPE_CMD} ]]; then
  1560. rm -f "${PATCH_TARGET}";
  1561. fi;
  1562. if [[ ${count} -ge 5 ]]; then
  1563. echo;
  1564. eerror "Failed Patch: ${patchname} !";
  1565. eerror " ( ${PATCH_TARGET} )";
  1566. eerror;
  1567. eerror "Include in your bugreport the contents of:";
  1568. eerror;
  1569. eerror " ${STDERR_TARGET}";
  1570. echo;
  1571. die "Failed Patch: ${patchname}!";
  1572. fi;
  1573. rm -f "${STDERR_TARGET}";
  1574. cat >> "${T}/epatch.log" <<-EOF
  1575. PATCH: ${x}
  1576. CMD: ${patch_cmd}
  1577. PWD: ${PWD}
  1578.  
  1579. EOF
  1580.  
  1581. eend 0;
  1582. done;
  1583. [[ ${SINGLE_PATCH} == "no" ]] && einfo "Done with patching";
  1584. :
  1585. }
  1586. epatch_user ()
  1587. {
  1588. [[ $# -ne 0 ]] && die "epatch_user takes no options";
  1589. local applied="${T}/epatch_user.log";
  1590. [[ -e ${applied} ]] && return 2;
  1591. local EPATCH_SOURCE check base=${PORTAGE_CONFIGROOT%/}/etc/portage/patches;
  1592. for check in ${CATEGORY}/{${P}-${PR},${P},${PN}}{,:${SLOT}};
  1593. do
  1594. EPATCH_SOURCE=${base}/${CTARGET}/${check};
  1595. [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${base}/${CHOST}/${check};
  1596. [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${base}/${check};
  1597. if [[ -d ${EPATCH_SOURCE} ]]; then
  1598. EPATCH_SOURCE=${EPATCH_SOURCE} EPATCH_SUFFIX="patch" EPATCH_FORCE="yes" EPATCH_MULTI_MSG="Applying user patches from ${EPATCH_SOURCE} ..." epatch;
  1599. echo "${EPATCH_SOURCE}" > "${applied}";
  1600. return 0;
  1601. fi;
  1602. done;
  1603. echo "none" > "${applied}";
  1604. return 1
  1605. }
  1606. epause ()
  1607. {
  1608. ewarn "QA Notice: epause is not defined in EAPI=${EAPI}, please file a bug at http://bugs.gentoo.org"
  1609. }
  1610. epunt_cxx ()
  1611. {
  1612. local dir=$1;
  1613. [[ -z ${dir} ]] && dir=${S};
  1614. ebegin "Removing useless C++ checks";
  1615. local f p any_found;
  1616. while IFS= read -r -d '' f; do
  1617. for p in "${PORTDIR}"/eclass/ELT-patches/nocxx/*.patch;
  1618. do
  1619. if patch --no-backup-if-mismatch -p1 "${f}" "${p}" > /dev/null; then
  1620. any_found=1;
  1621. break;
  1622. fi;
  1623. done;
  1624. done < <(find "${dir}" -name configure -print0);
  1625. if [[ -z ${any_found} ]]; then
  1626. eqawarn "epunt_cxx called unnecessarily (no C++ checks to punt).";
  1627. fi;
  1628. eend 0
  1629. }
  1630. esethome ()
  1631. {
  1632. _assert_pkg_ebuild_phase ${FUNCNAME};
  1633. local euser=$1;
  1634. shift;
  1635. if [[ -z ${euser} ]]; then
  1636. eerror "No username specified !";
  1637. die "Cannot call esethome without a username";
  1638. fi;
  1639. if [[ -z $(egetent passwd "${euser}") ]]; then
  1640. ewarn "User does not exist, cannot set home dir -- skipping.";
  1641. return 1;
  1642. fi;
  1643. local ehome=$1;
  1644. shift;
  1645. if [[ -z ${ehome} ]]; then
  1646. eerror "No home directory specified !";
  1647. die "Cannot call esethome without a home directory or '-1'";
  1648. fi;
  1649. if [[ ${ehome} == "-1" ]]; then
  1650. ehome="/dev/null";
  1651. fi;
  1652. if [[ $(egethome "${euser}") == ${ehome} ]]; then
  1653. return 0;
  1654. fi;
  1655. einfo "Updating home for user '${euser}' ...";
  1656. einfo " - Home: ${ehome}";
  1657. if [[ ! -e ${ROOT}/${ehome} ]]; then
  1658. einfo " - Creating ${ehome} in ${ROOT}";
  1659. mkdir -p "${ROOT}/${ehome}";
  1660. chown "${euser}" "${ROOT}/${ehome}";
  1661. chmod 755 "${ROOT}/${ehome}";
  1662. fi;
  1663. case ${CHOST} in
  1664. *-darwin*)
  1665. dscl . change "/users/${euser}" home "${ehome}"
  1666. ;;
  1667. *-freebsd* | *-dragonfly*)
  1668. pw usermod "${euser}" -d "${ehome}" && return 0;
  1669. [[ $? == 8 ]] && eerror "${euser} is in use, cannot update home";
  1670. eerror "There was an error when attempting to update the home directory for ${euser}";
  1671. eerror "Please update it manually on your system:";
  1672. eerror "\t pw usermod \"${euser}\" -d \"${ehome}\""
  1673. ;;
  1674. *)
  1675. usermod -d "${ehome}" "${euser}" && return 0;
  1676. [[ $? == 8 ]] && eerror "${euser} is in use, cannot update home";
  1677. eerror "There was an error when attempting to update the home directory for ${euser}";
  1678. eerror "Please update it manually on your system (as root):";
  1679. eerror "\t usermod -d \"${ehome}\" \"${euser}\""
  1680. ;;
  1681. esac
  1682. }
  1683. eshopts_pop ()
  1684. {
  1685. local s;
  1686. estack_pop eshopts s || die "${FUNCNAME}: unbalanced push";
  1687. if [[ ${s} == "shopt -"* ]]; then
  1688. eval "${s}" || die "${FUNCNAME}: sanity: invalid shopt options: ${s}";
  1689. else
  1690. set +$- || die "${FUNCNAME}: sanity: invalid shell settings: $-";
  1691. set -${s} || die "${FUNCNAME}: sanity: unable to restore saved shell settings: ${s}";
  1692. fi
  1693. }
  1694. eshopts_push ()
  1695. {
  1696. if [[ $1 == -[su] ]]; then
  1697. estack_push eshopts "$(shopt -p)";
  1698. [[ $# -eq 0 ]] && return 0;
  1699. shopt "$@" || die "${FUNCNAME}: bad options to shopt: $*";
  1700. else
  1701. estack_push eshopts $-;
  1702. [[ $# -eq 0 ]] && return 0;
  1703. set "$@" || die "${FUNCNAME}: bad options to set: $*";
  1704. fi
  1705. }
  1706. estack_pop ()
  1707. {
  1708. [[ $# -eq 0 || $# -gt 2 ]] && die "estack_pop: incorrect # of arguments";
  1709. local __estack_name="__ESTACK_$1__";
  1710. shift;
  1711. local __estack_retvar=$1;
  1712. shift;
  1713. eval local __estack_i=\${#${__estack_name}\[@\]};
  1714. [[ $(( --__estack_i )) -eq -1 ]] && return 1;
  1715. if [[ -n ${__estack_retvar} ]]; then
  1716. eval ${__estack_retvar}=\"\${${__estack_name}\[${__estack_i}\]}\";
  1717. fi;
  1718. eval unset ${__estack_name}\[${__estack_i}\]
  1719. }
  1720. estack_push ()
  1721. {
  1722. [[ $# -eq 0 ]] && die "estack_push: incorrect # of arguments";
  1723. local stack_name="__ESTACK_$1__";
  1724. shift;
  1725. eval ${stack_name}+=\( \"\$@\" \)
  1726. }
  1727. esvn_clean ()
  1728. {
  1729. [[ -z $* ]] && set -- .;
  1730. find "$@" -type d -name '.svn' -prune -print0 | xargs -0 rm -rf
  1731. }
  1732. eumask_pop ()
  1733. {
  1734. [[ $# -eq 0 ]] || die "${FUNCNAME}: we take no options";
  1735. local s;
  1736. estack_pop eumask s || die "${FUNCNAME}: unbalanced push";
  1737. umask ${s} || die "${FUNCNAME}: sanity: could not restore umask: ${s}"
  1738. }
  1739. eumask_push ()
  1740. {
  1741. estack_push eumask "$(umask)";
  1742. umask "$@" || die "${FUNCNAME}: bad options to umask: $*"
  1743. }
  1744. evar_pop ()
  1745. {
  1746. local cnt=${1:-bad};
  1747. case $# in
  1748. 0)
  1749. cnt=1
  1750. ;;
  1751. 1)
  1752. isdigit "${cnt}" || die "${FUNCNAME}: first arg must be a number: $*"
  1753. ;;
  1754. *)
  1755. die "${FUNCNAME}: only accepts one arg: $*"
  1756. ;;
  1757. esac;
  1758. local var val;
  1759. while (( cnt-- )); do
  1760. estack_pop evar val || die "${FUNCNAME}: unbalanced push";
  1761. estack_pop evar var || die "${FUNCNAME}: unbalanced push";
  1762. [[ ${val} == "${___ECLASS_ONCE_EUTILS}" ]] && unset ${var} || printf -v "${var}" '%s' "${val}";
  1763. done
  1764. }
  1765. evar_push ()
  1766. {
  1767. local var val;
  1768. for var in "$@";
  1769. do
  1770. [[ ${!var+set} == "set" ]] && val=${!var} || val="${___ECLASS_ONCE_EUTILS}";
  1771. estack_push evar "${var}" "${val}";
  1772. done
  1773. }
  1774. evar_push_set ()
  1775. {
  1776. local var=$1;
  1777. evar_push ${var};
  1778. case $# in
  1779. 1)
  1780. unset ${var}
  1781. ;;
  1782. 2)
  1783. printf -v "${var}" '%s' "$2"
  1784. ;;
  1785. *)
  1786. die "${FUNCNAME}: incorrect # of args: $*"
  1787. ;;
  1788. esac
  1789. }
  1790. fdo-mime_desktop_database_update ()
  1791. {
  1792. has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=;
  1793. has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}";
  1794. if [ -x "${EPREFIX}/usr/bin/update-desktop-database" ]; then
  1795. einfo "Updating desktop mime database ...";
  1796. "${EPREFIX}/usr/bin/update-desktop-database" -q "${EROOT}usr/share/applications";
  1797. fi
  1798. }
  1799. fdo-mime_mime_database_update ()
  1800. {
  1801. has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=;
  1802. has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}";
  1803. if [ -x "${EPREFIX}/usr/bin/update-mime-database" ]; then
  1804. einfo "Updating shared mime info database ...";
  1805. "${EPREFIX}/usr/bin/update-mime-database" "${EROOT}usr/share/mime";
  1806. fi
  1807. }
  1808. gcc-fullversion ()
  1809. {
  1810. _gcc_fullversion '$1.$2.$3' "$@"
  1811. }
  1812. gcc-major-version ()
  1813. {
  1814. _gcc_fullversion '$1' "$@"
  1815. }
  1816. gcc-micro-version ()
  1817. {
  1818. _gcc_fullversion '$3' "$@"
  1819. }
  1820. gcc-minor-version ()
  1821. {
  1822. _gcc_fullversion '$2' "$@"
  1823. }
  1824. gcc-specs-directive ()
  1825. {
  1826. local directive subdname subdirective;
  1827. directive="$(_gcc-specs-directive_raw $1)";
  1828. while [[ ${directive} == *%\(*\)* ]]; do
  1829. subdname=${directive/*%\(};
  1830. subdname=${subdname/\)*};
  1831. subdirective="$(_gcc-specs-directive_raw ${subdname})";
  1832. directive="${directive//\%(${subdname})/${subdirective}}";
  1833. done;
  1834. echo "${directive}";
  1835. return 0
  1836. }
  1837. gcc-specs-nostrict ()
  1838. {
  1839. local directive;
  1840. directive=$(gcc-specs-directive cc1);
  1841. return $([[ "${directive/\{!fstrict-overflow:}" != "${directive}" ]])
  1842. }
  1843. gcc-specs-now ()
  1844. {
  1845. local directive;
  1846. directive=$(gcc-specs-directive link_command);
  1847. return $([[ "${directive/\{!nonow:}" != "${directive}" ]])
  1848. }
  1849. gcc-specs-pie ()
  1850. {
  1851. local directive;
  1852. directive=$(gcc-specs-directive cc1);
  1853. return $([[ "${directive/\{!nopie:}" != "${directive}" ]])
  1854. }
  1855. gcc-specs-relro ()
  1856. {
  1857. local directive;
  1858. directive=$(gcc-specs-directive link_command);
  1859. return $([[ "${directive/\{!norelro:}" != "${directive}" ]])
  1860. }
  1861. gcc-specs-ssp ()
  1862. {
  1863. local directive;
  1864. directive=$(gcc-specs-directive cc1);
  1865. return $([[ "${directive/\{!fno-stack-protector:}" != "${directive}" ]])
  1866. }
  1867. gcc-specs-ssp-to-all ()
  1868. {
  1869. local directive;
  1870. directive=$(gcc-specs-directive cc1);
  1871. return $([[ "${directive/\{!fno-stack-protector-all:}" != "${directive}" ]])
  1872. }
  1873. gcc-version ()
  1874. {
  1875. _gcc_fullversion '$1.$2' "$@"
  1876. }
  1877. gen_usr_ldscript ()
  1878. {
  1879. local lib libdir=$(get_libdir) output_format="" auto=false suffix=$(get_libname);
  1880. [[ -z ${ED+set} ]] && local ED=${D%/}${EPREFIX}/;
  1881. tc-is-static-only && return;
  1882. case ${CTARGET:-${CHOST}} in
  1883. *-darwin*)
  1884.  
  1885. ;;
  1886. *linux* | *-freebsd* | *-openbsd* | *-netbsd*)
  1887. use prefix && return 0
  1888. ;;
  1889. *)
  1890. return 0
  1891. ;;
  1892. esac;
  1893. dodir /usr/${libdir};
  1894. if [[ $1 == "-a" ]]; then
  1895. auto=true;
  1896. shift;
  1897. dodir /${libdir};
  1898. fi;
  1899. output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p');
  1900. [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )";
  1901. for lib in "$@";
  1902. do
  1903. local tlib;
  1904. if ${auto}; then
  1905. lib="lib${lib}${suffix}";
  1906. else
  1907. [[ -r ${ED}/${libdir}/${lib} ]] || continue;
  1908. fi;
  1909. case ${CTARGET:-${CHOST}} in
  1910. *-darwin*)
  1911. if ${auto}; then
  1912. tlib=$(scanmacho -qF'%S#F' "${ED}"/usr/${libdir}/${lib});
  1913. else
  1914. tlib=$(scanmacho -qF'%S#F' "${ED}"/${libdir}/${lib});
  1915. fi;
  1916. [[ -z ${tlib} ]] && die "unable to read install_name from ${lib}";
  1917. tlib=${tlib##*/};
  1918. if ${auto}; then
  1919. mv "${ED}"/usr/${libdir}/${lib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die;
  1920. if [[ ${tlib} != ${lib%${suffix}}.*${suffix#.} ]]; then
  1921. mv "${ED}"/usr/${libdir}/${tlib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die;
  1922. fi;
  1923. rm -f "${ED}"/${libdir}/${lib};
  1924. fi;
  1925. if [[ ! -w "${ED}/${libdir}/${tlib}" ]]; then
  1926. chmod u+w "${ED}${libdir}/${tlib}";
  1927. local nowrite=yes;
  1928. fi;
  1929. install_name_tool -id "${EPREFIX}"/${libdir}/${tlib} "${ED}"/${libdir}/${tlib} || die "install_name_tool failed";
  1930. [[ -n ${nowrite} ]] && chmod u-w "${ED}${libdir}/${tlib}";
  1931. pushd "${ED}/usr/${libdir}" > /dev/null;
  1932. ln -snf "../../${libdir}/${tlib}" "${lib}";
  1933. popd > /dev/null
  1934. ;;
  1935. *)
  1936. if ${auto}; then
  1937. tlib=$(scanelf -qF'%S#F' "${ED}"/usr/${libdir}/${lib});
  1938. [[ -z ${tlib} ]] && die "unable to read SONAME from ${lib}";
  1939. mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die;
  1940. if [[ ${tlib} != ${lib}* ]]; then
  1941. mv "${ED}"/usr/${libdir}/${tlib}* "${ED}"/${libdir}/ || die;
  1942. fi;
  1943. rm -f "${ED}"/${libdir}/${lib};
  1944. else
  1945. tlib=${lib};
  1946. fi;
  1947. cat > "${ED}/usr/${libdir}/${lib}" <<-END_LDSCRIPT
  1948. /* GNU ld script
  1949. Since Gentoo has critical dynamic libraries in /lib, and the static versions
  1950. in /usr/lib, we need to have a "fake" dynamic lib in /usr/lib, otherwise we
  1951. run into linking problems. This "fake" dynamic lib is a linker script that
  1952. redirects the linker to the real lib. And yes, this works in the cross-
  1953. compiling scenario as the sysroot-ed linker will prepend the real path.
  1954.  
  1955. See bug http://bugs.gentoo.org/4411 for more info.
  1956. */
  1957. ${output_format}
  1958. GROUP ( ${EPREFIX}/${libdir}/${tlib} )
  1959. END_LDSCRIPT
  1960.  
  1961. ;;
  1962. esac
  1963. fperms a+x "/usr/${libdir}/${lib}" || die "could not change perms on ${lib}";
  1964. done
  1965. }
  1966. get_abi_CFLAGS ()
  1967. {
  1968. get_abi_var CFLAGS "$@"
  1969. }
  1970. get_abi_CHOST ()
  1971. {
  1972. get_abi_var CHOST "$@"
  1973. }
  1974. get_abi_CTARGET ()
  1975. {
  1976. get_abi_var CTARGET "$@"
  1977. }
  1978. get_abi_FAKE_TARGETS ()
  1979. {
  1980. get_abi_var FAKE_TARGETS "$@"
  1981. }
  1982. get_abi_LDFLAGS ()
  1983. {
  1984. get_abi_var LDFLAGS "$@"
  1985. }
  1986. get_abi_LIBDIR ()
  1987. {
  1988. get_abi_var LIBDIR "$@"
  1989. }
  1990. get_abi_var ()
  1991. {
  1992. local flag=$1;
  1993. local abi=${2:-${ABI:-${DEFAULT_ABI:-default}}};
  1994. local var="${flag}_${abi}";
  1995. echo ${!var}
  1996. }
  1997. get_after_major_version ()
  1998. {
  1999. echo $(get_version_component_range 2- "${1:-${PV}}")
  2000. }
  2001. get_all_abis ()
  2002. {
  2003. local x order="" mvar dvar;
  2004. mvar="MULTILIB_ABIS";
  2005. dvar="DEFAULT_ABI";
  2006. if [[ -n $1 ]]; then
  2007. mvar="$1_${mvar}";
  2008. dvar="$1_${dvar}";
  2009. fi;
  2010. if [[ -z ${!mvar} ]]; then
  2011. echo "default";
  2012. return 0;
  2013. fi;
  2014. for x in ${!mvar};
  2015. do
  2016. if [[ ${x} != ${!dvar} ]]; then
  2017. order="${order:+${order} }${x}";
  2018. fi;
  2019. done;
  2020. order="${order:+${order} }${!dvar}";
  2021. echo ${order};
  2022. return 0
  2023. }
  2024. get_all_libdirs ()
  2025. {
  2026. local libdirs abi;
  2027. for abi in ${MULTILIB_ABIS};
  2028. do
  2029. libdirs+=" $(get_abi_LIBDIR ${abi})";
  2030. done;
  2031. [[ " ${libdirs} " != *" lib "* ]] && libdirs+=" lib";
  2032. echo "${libdirs}"
  2033. }
  2034. get_all_version_components ()
  2035. {
  2036. eshopts_push -s extglob;
  2037. local ver_str=${1:-${PV}} result;
  2038. result=();
  2039. if [[ ${VERSIONATOR_CACHE_VER_STR} == ${ver_str} ]]; then
  2040. echo ${VERSIONATOR_CACHE_RESULT};
  2041. eshopts_pop;
  2042. return;
  2043. fi;
  2044. export VERSIONATOR_CACHE_VER_STR=${ver_str};
  2045. while [[ -n $ver_str ]]; do
  2046. case "${ver_str::1}" in
  2047. [[:digit:]])
  2048. result+=("${ver_str%%[^[:digit:]]*}");
  2049. ver_str=${ver_str##+([[:digit:]])}
  2050. ;;
  2051. [-_.])
  2052. result+=("${ver_str::1}");
  2053. ver_str=${ver_str:1}
  2054. ;;
  2055. [[:alpha:]])
  2056. local not_match=${ver_str##+([[:alpha:]])*([[:digit:]])};
  2057. result+=("${ver_str::${#ver_str} - ${#not_match}}");
  2058. ver_str=${not_match}
  2059. ;;
  2060. *)
  2061. result+=("${ver_str::1}");
  2062. ver_str=${ver_str:1}
  2063. ;;
  2064. esac;
  2065. done;
  2066. export VERSIONATOR_CACHE_RESULT=${result[*]};
  2067. echo ${result[@]};
  2068. eshopts_pop
  2069. }
  2070. get_install_abis ()
  2071. {
  2072. local x order="";
  2073. if [[ -z ${MULTILIB_ABIS} ]]; then
  2074. echo "default";
  2075. return 0;
  2076. fi;
  2077. if [[ ${EMULTILIB_PKG} == "true" ]]; then
  2078. for x in ${MULTILIB_ABIS};
  2079. do
  2080. if [[ ${x} != "${DEFAULT_ABI}" ]]; then
  2081. has ${x} ${ABI_DENY} || order="${order} ${x}";
  2082. fi;
  2083. done;
  2084. has ${DEFAULT_ABI} ${ABI_DENY} || order="${order} ${DEFAULT_ABI}";
  2085. if [[ -n ${ABI_ALLOW} ]]; then
  2086. local ordera="";
  2087. for x in ${order};
  2088. do
  2089. if has ${x} ${ABI_ALLOW}; then
  2090. ordera="${ordera} ${x}";
  2091. fi;
  2092. done;
  2093. order=${ordera};
  2094. fi;
  2095. else
  2096. order=${DEFAULT_ABI};
  2097. fi;
  2098. if [[ -z ${order} ]]; then
  2099. die "The ABI list is empty. Are you using a proper multilib profile? Perhaps your USE flags or MULTILIB_ABIS are too restrictive for this package.";
  2100. fi;
  2101. echo ${order};
  2102. return 0
  2103. }
  2104. get_last_version_component_index ()
  2105. {
  2106. echo $(($(get_version_component_count "${1:-${PV}}" ) - 1))
  2107. }
  2108. get_libdir ()
  2109. {
  2110. local CONF_LIBDIR;
  2111. if [ -n "${CONF_LIBDIR_OVERRIDE}" ]; then
  2112. echo ${CONF_LIBDIR_OVERRIDE};
  2113. else
  2114. get_abi_LIBDIR;
  2115. fi
  2116. }
  2117. get_libname ()
  2118. {
  2119. local libname;
  2120. local ver=$1;
  2121. case ${CHOST} in
  2122. *-cygwin | mingw* | *-mingw*)
  2123. libname="dll"
  2124. ;;
  2125. *-darwin*)
  2126. libname="dylib"
  2127. ;;
  2128. *-mint*)
  2129. libname="irrelevant"
  2130. ;;
  2131. hppa*-hpux*)
  2132. libname="sl"
  2133. ;;
  2134. *)
  2135. libname="so"
  2136. ;;
  2137. esac;
  2138. if [[ -z $* ]]; then
  2139. echo ".${libname}";
  2140. else
  2141. for ver in "$@";
  2142. do
  2143. case ${CHOST} in
  2144. *-darwin*)
  2145. echo ".${ver}.${libname}"
  2146. ;;
  2147. *-mint*)
  2148. echo ".${libname}"
  2149. ;;
  2150. *)
  2151. echo ".${libname}.${ver}"
  2152. ;;
  2153. esac;
  2154. done;
  2155. fi
  2156. }
  2157. get_major_version ()
  2158. {
  2159. local c=($(get_all_version_components "${1:-${PV}}"));
  2160. echo ${c[0]}
  2161. }
  2162. get_modname ()
  2163. {
  2164. local modname;
  2165. local ver=$1;
  2166. case ${CHOST} in
  2167. *-darwin*)
  2168. modname="bundle"
  2169. ;;
  2170. *)
  2171. modname="so"
  2172. ;;
  2173. esac;
  2174. echo ".${modname}"
  2175. }
  2176. get_version_component_count ()
  2177. {
  2178. local a=($(get_version_components "${1:-${PV}}"));
  2179. echo ${#a[@]}
  2180. }
  2181. get_version_component_range ()
  2182. {
  2183. eshopts_push -s extglob;
  2184. local c v="${2:-${PV}}" range="${1}" range_start range_end;
  2185. local -i i=-1 j=0;
  2186. c=($(get_all_version_components "${v}"));
  2187. range_start=${range%-*};
  2188. range_start=${range_start:-1};
  2189. range_end=${range#*-};
  2190. range_end=${range_end:-${#c[@]}};
  2191. while ((j < range_start)); do
  2192. i+=1;
  2193. ((i > ${#c[@]})) && eshopts_pop && return;
  2194. [[ -n "${c[i]//[-._]}" ]] && j+=1;
  2195. done;
  2196. while ((j <= range_end)); do
  2197. echo -n ${c[i]};
  2198. ((i > ${#c[@]})) && eshopts_pop && return;
  2199. [[ -n "${c[i]//[-._]}" ]] && j+=1;
  2200. i+=1;
  2201. done;
  2202. eshopts_pop
  2203. }
  2204. get_version_components ()
  2205. {
  2206. local c=$(get_all_version_components "${1:-${PV}}");
  2207. echo ${c//[-._]/ }
  2208. }
  2209. gnome2_disable_deprecation_warning ()
  2210. {
  2211. local retval=0;
  2212. local fails=();
  2213. local makefile;
  2214. ebegin "Disabling deprecation warnings";
  2215. while read makefile; do
  2216. if ! grep -qE "(DISABLE_DEPRECATED|GSEAL_ENABLE)" "${makefile}"; then
  2217. continue;
  2218. fi;
  2219. LC_ALL=C sed -r -i -e 's:-D[A-Z_]+_DISABLE_DEPRECATED:$(NULL):g' -e 's:-DGSEAL_ENABLE:$(NULL):g' -i "${makefile}";
  2220. if [[ $? -ne 0 ]]; then
  2221. fails+=("${makefile}");
  2222. retval=2;
  2223. fi;
  2224. done < <(find "${S}" -name "Makefile.in" -o -name "Makefile.am" -o -name "Makefile.decl" | sort; echo configure);
  2225. eend ${retval};
  2226. for makefile in "${fails[@]}";
  2227. do
  2228. ewarn "Failed to disable deprecation warnings in ${makefile}";
  2229. done
  2230. }
  2231. gnome2_environment_reset ()
  2232. {
  2233. export G_HOME="${T}";
  2234. export GST_REGISTRY="${T}/registry.xml";
  2235. export XDG_DATA_HOME="${T}/.local/share";
  2236. export XDG_CONFIG_HOME="${T}/.config";
  2237. export XDG_CACHE_HOME="${T}/.cache";
  2238. export XDG_RUNTIME_DIR="${T}/run";
  2239. mkdir -p "${XDG_DATA_HOME}" "${XDG_CONFIG_HOME}" "${XDG_CACHE_HOME}" "${XDG_RUNTIME_DIR}";
  2240. chmod 0700 "${XDG_RUNTIME_DIR}"
  2241. }
  2242. gnome2_gconf_install ()
  2243. {
  2244. has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}";
  2245. local updater="${EROOT}${GCONFTOOL_BIN}";
  2246. if [[ ! -x "${updater}" ]]; then
  2247. debug-print "${updater} is not executable";
  2248. return;
  2249. fi;
  2250. if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
  2251. debug-print "No GNOME 2 GConf schemas found";
  2252. return;
  2253. fi;
  2254. unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL;
  2255. export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT};")";
  2256. einfo "Installing GNOME 2 GConf schemas";
  2257. local F;
  2258. for F in ${GNOME2_ECLASS_SCHEMAS};
  2259. do
  2260. if [[ -e "${EROOT}${F}" ]]; then
  2261. debug-print "Installing schema: ${F}";
  2262. "${updater}" --makefile-install-rule "${EROOT}${F}" > /dev/null;
  2263. fi;
  2264. done;
  2265. pids=$(pgrep -x gconfd-2);
  2266. if [[ $? == 0 ]]; then
  2267. ebegin "Reloading GConf schemas";
  2268. kill -HUP ${pids};
  2269. eend $?;
  2270. fi
  2271. }
  2272. gnome2_gconf_savelist ()
  2273. {
  2274. has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}";
  2275. pushd "${ED}" &>/dev/null;
  2276. export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas' 2> /dev/null);
  2277. popd &>/dev/null
  2278. }
  2279. gnome2_gconf_uninstall ()
  2280. {
  2281. has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}";
  2282. local updater="${EROOT}${GCONFTOOL_BIN}";
  2283. if [[ ! -x "${updater}" ]]; then
  2284. debug-print "${updater} is not executable";
  2285. return;
  2286. fi;
  2287. if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
  2288. debug-print "No GNOME 2 GConf schemas found";
  2289. return;
  2290. fi;
  2291. unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL;
  2292. export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT};")";
  2293. einfo "Uninstalling GNOME 2 GConf schemas";
  2294. local F;
  2295. for F in ${GNOME2_ECLASS_SCHEMAS};
  2296. do
  2297. if [[ -e "${EROOT}${F}" ]]; then
  2298. debug-print "Uninstalling gconf schema: ${F}";
  2299. "${updater}" --makefile-uninstall-rule "${EROOT}${F}" > /dev/null;
  2300. fi;
  2301. done;
  2302. pids=$(pgrep -x gconfd-2);
  2303. if [[ $? == 0 ]]; then
  2304. ebegin "Reloading GConf schemas";
  2305. kill -HUP ${pids};
  2306. eend $?;
  2307. fi
  2308. }
  2309. gnome2_icon_cache_update ()
  2310. {
  2311. has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}";
  2312. local updater="${EROOT}${GTK_UPDATE_ICON_CACHE}";
  2313. if [[ ! -x "${updater}" ]]; then
  2314. debug-print "${updater} is not executable";
  2315. return;
  2316. fi;
  2317. if [[ -z "${GNOME2_ECLASS_ICONS}" ]]; then
  2318. debug-print "No icon cache to update";
  2319. return;
  2320. fi;
  2321. ebegin "Updating icons cache";
  2322. local retval=0;
  2323. local fails=();
  2324. for dir in ${GNOME2_ECLASS_ICONS};
  2325. do
  2326. if [[ -f "${EROOT}${dir}/index.theme" ]]; then
  2327. local rv=0;
  2328. "${updater}" -qf "${EROOT}${dir}";
  2329. rv=$?;
  2330. if [[ ! $rv -eq 0 ]]; then
  2331. debug-print "Updating cache failed on ${EROOT}${dir}";
  2332. fails[$(( ${#fails[@]} + 1 ))]="${EROOT}${dir}";
  2333. retval=2;
  2334. fi;
  2335. else
  2336. if [[ $(ls "${EROOT}${dir}") = "icon-theme.cache" ]]; then
  2337. rm "${EROOT}${dir}/icon-theme.cache";
  2338. fi;
  2339. fi;
  2340. if [[ -z $(ls "${EROOT}${dir}") ]]; then
  2341. rmdir "${EROOT}${dir}";
  2342. fi;
  2343. done;
  2344. eend ${retval};
  2345. for f in "${fails[@]}";
  2346. do
  2347. eerror "Failed to update cache with icon $f";
  2348. done
  2349. }
  2350. gnome2_icon_savelist ()
  2351. {
  2352. has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}";
  2353. pushd "${ED}" &>/dev/null;
  2354. export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null);
  2355. popd &>/dev/null
  2356. }
  2357. gnome2_omf_fix ()
  2358. {
  2359. local omf_makefiles filename;
  2360. omf_makefiles="$@";
  2361. if [[ -f ${S}/omf.make ]]; then
  2362. omf_makefiles="${omf_makefiles} ${S}/omf.make";
  2363. fi;
  2364. if [[ -f ${S}/gnome-doc-utils.make ]]; then
  2365. omf_makefiles="${omf_makefiles} ${S}/gnome-doc-utils.make";
  2366. fi;
  2367. for filename in $(find "${S}" -name "Makefile.in" -o -name "Makefile.am" |sort);
  2368. do
  2369. omf_makefiles="${omf_makefiles} ${filename}";
  2370. done;
  2371. ebegin "Fixing OMF Makefiles";
  2372. local retval=0;
  2373. local fails=();
  2374. for omf in ${omf_makefiles};
  2375. do
  2376. sed -i -e 's:scrollkeeper-update:true:' "${omf}";
  2377. retval=$?;
  2378. if [[ $retval -ne 0 ]]; then
  2379. debug-print "updating of ${omf} failed";
  2380. fails[$(( ${#fails[@]} + 1 ))]=$omf;
  2381. retval=2;
  2382. fi;
  2383. done;
  2384. eend $retval;
  2385. for f in "${fails[@]}";
  2386. do
  2387. eerror "Failed to update OMF Makefile $f";
  2388. done
  2389. }
  2390. gnome2_pkg_postinst ()
  2391. {
  2392. gnome2_gconf_install;
  2393. fdo-mime_desktop_database_update;
  2394. fdo-mime_mime_database_update;
  2395. gnome2_icon_cache_update;
  2396. gnome2_schemas_update;
  2397. gnome2_scrollkeeper_update
  2398. }
  2399. gnome2_pkg_postrm ()
  2400. {
  2401. fdo-mime_desktop_database_update;
  2402. fdo-mime_mime_database_update;
  2403. gnome2_icon_cache_update;
  2404. gnome2_schemas_update;
  2405. gnome2_scrollkeeper_update
  2406. }
  2407. gnome2_pkg_preinst ()
  2408. {
  2409. gnome2_gconf_savelist;
  2410. gnome2_icon_savelist;
  2411. gnome2_schemas_savelist;
  2412. gnome2_scrollkeeper_savelist
  2413. }
  2414. gnome2_query_immodules_gtk2 ()
  2415. {
  2416. local GTK2_CONFDIR="/etc/gtk-2.0/$(get_abi_CHOST)";
  2417. local query_exec="${EPREFIX}/usr/bin/gtk-query-immodules-2.0";
  2418. local gtk_conf="${EPREFIX}${GTK2_CONFDIR}/gtk.immodules";
  2419. local gtk_conf_dir=$(dirname "${gtk_conf}");
  2420. einfo "Generating Gtk2 immodules/gdk-pixbuf loaders listing:";
  2421. einfo "-> ${gtk_conf}";
  2422. mkdir -p "${gtk_conf_dir}";
  2423. local tmp_file=$(mktemp -t tmp.XXXXXXXXXXgtk_query_immodules);
  2424. if [ -z "${tmp_file}" ]; then
  2425. ewarn "gtk_query_immodules: cannot create temporary file";
  2426. return 1;
  2427. fi;
  2428. if ${query_exec} > "${tmp_file}"; then
  2429. cat "${tmp_file}" > "${gtk_conf}" || ewarn "Failed to write to ${gtk_conf}";
  2430. else
  2431. ewarn "Cannot update gtk.immodules, file generation failed";
  2432. fi;
  2433. rm "${tmp_file}"
  2434. }
  2435. gnome2_query_immodules_gtk3 ()
  2436. {
  2437. "${EPREFIX}/usr/bin/gtk-query-immodules-3.0" --update-cache
  2438. }
  2439. gnome2_schemas_savelist ()
  2440. {
  2441. has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}";
  2442. pushd "${ED}" &>/dev/null;
  2443. export GNOME2_ECLASS_GLIB_SCHEMAS=$(find 'usr/share/glib-2.0/schemas' -name '*.gschema.xml' 2>/dev/null);
  2444. popd &>/dev/null
  2445. }
  2446. gnome2_schemas_update ()
  2447. {
  2448. has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}";
  2449. local updater="${EROOT}${GLIB_COMPILE_SCHEMAS}";
  2450. if [[ ! -x ${updater} ]]; then
  2451. debug-print "${updater} is not executable";
  2452. return;
  2453. fi;
  2454. if [[ -z ${GNOME2_ECLASS_GLIB_SCHEMAS} ]]; then
  2455. debug-print "No GSettings schemas to update";
  2456. return;
  2457. fi;
  2458. ebegin "Updating GSettings schemas";
  2459. ${updater} --allow-any-name "$@" "${EROOT%/}/usr/share/glib-2.0/schemas" &>/dev/null;
  2460. eend $?
  2461. }
  2462. gnome2_scrollkeeper_savelist ()
  2463. {
  2464. has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}";
  2465. pushd "${ED}" &>/dev/null;
  2466. export GNOME2_ECLASS_SCROLLS=$(find 'usr/share/omf' -type f -name "*.omf" 2> /dev/null);
  2467. popd &>/dev/null
  2468. }
  2469. gnome2_scrollkeeper_update ()
  2470. {
  2471. has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}";
  2472. local updater="${EROOT}${SCROLLKEEPER_UPDATE_BIN}";
  2473. if [[ ! -x "${updater}" ]]; then
  2474. debug-print "${updater} is not executable";
  2475. return;
  2476. fi;
  2477. if [[ -z "${GNOME2_ECLASS_SCROLLS}" ]]; then
  2478. debug-print "No scroll cache to update";
  2479. return;
  2480. fi;
  2481. ebegin "Updating scrollkeeper database ...";
  2482. "${updater}" -q -p "${EROOT}${SCROLLKEEPER_DIR}";
  2483. eend $?
  2484. }
  2485. gnome2_src_compile ()
  2486. {
  2487. has ${EAPI:-0} 0 1 && gnome2_src_configure "$@";
  2488. emake || die "compile failure"
  2489. }
  2490. gnome2_src_configure ()
  2491. {
  2492. if [[ ${GCONF_DEBUG} != 'no' ]]; then
  2493. if use debug; then
  2494. G2CONF="--enable-debug=yes ${G2CONF}";
  2495. fi;
  2496. fi;
  2497. if grep -q "enable-gtk-doc" "${ECONF_SOURCE:-.}"/configure; then
  2498. if has ${EAPI:-0} 0 1 2 3 4 && in_iuse doc; then
  2499. G2CONF="$(use_enable doc gtk-doc) ${G2CONF}";
  2500. else
  2501. G2CONF="--disable-gtk-doc ${G2CONF}";
  2502. fi;
  2503. fi;
  2504. if grep -q "^[[:space:]]*AM_MAINTAINER_MODE(\[enable\])" "${ECONF_SOURCE:-.}"/configure.*; then
  2505. G2CONF="--disable-maintainer-mode ${G2CONF}";
  2506. fi;
  2507. if grep -q "disable-scrollkeeper" "${ECONF_SOURCE:-.}"/configure; then
  2508. G2CONF="--disable-scrollkeeper ${G2CONF}";
  2509. fi;
  2510. if has ${EAPI:-0} 0 1 2 3 4; then
  2511. if grep -q "disable-silent-rules" "${ECONF_SOURCE:-.}"/configure; then
  2512. G2CONF="--disable-silent-rules ${G2CONF}";
  2513. fi;
  2514. fi;
  2515. if grep -q "disable-schemas-install" "${ECONF_SOURCE:-.}"/configure; then
  2516. G2CONF="--disable-schemas-install ${G2CONF}";
  2517. fi;
  2518. if grep -q "disable-schemas-compile" "${ECONF_SOURCE:-.}"/configure; then
  2519. G2CONF="--disable-schemas-compile ${G2CONF}";
  2520. fi;
  2521. if grep -q "enable-compile-warnings" "${ECONF_SOURCE:-.}"/configure; then
  2522. G2CONF="--enable-compile-warnings=minimum ${G2CONF}";
  2523. fi;
  2524. addwrite "$(unset HOME; echo ~)/.gnome2";
  2525. econf ${G2CONF} "$@"
  2526. }
  2527. gnome2_src_install ()
  2528. {
  2529. has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}";
  2530. local sk_tmp_dir="/var/lib/scrollkeeper";
  2531. dodir "${sk_tmp_dir}" || die "dodir failed";
  2532. export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL="1";
  2533. if [[ -z "${USE_EINSTALL}" || "${USE_EINSTALL}" = "0" ]]; then
  2534. debug-print "Installing with 'make install'";
  2535. emake DESTDIR="${D}" "scrollkeeper_localstate_dir=${ED}${sk_tmp_dir} " "$@" install || die "install failed";
  2536. else
  2537. debug-print "Installing with 'einstall'";
  2538. einstall "scrollkeeper_localstate_dir=${ED}${sk_tmp_dir} " "$@" || die "einstall failed";
  2539. fi;
  2540. unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL;
  2541. if has ${EAPI:-0} 0 1 2 3 4; then
  2542. if [[ -n "${DOCS}" ]]; then
  2543. dodoc ${DOCS} || die "dodoc failed";
  2544. fi;
  2545. else
  2546. if ! declare -p DOCS > /dev/null 2>&1; then
  2547. local d;
  2548. for d in README* ChangeLog AUTHORS NEWS TODO CHANGES THANKS BUGS FAQ CREDITS CHANGELOG;
  2549. do
  2550. [[ -s "${d}" ]] && dodoc "${d}";
  2551. done;
  2552. else
  2553. if declare -p DOCS | grep -q '^declare -a'; then
  2554. dodoc "${DOCS[@]}";
  2555. else
  2556. dodoc ${DOCS};
  2557. fi;
  2558. fi;
  2559. fi;
  2560. rm -rf "${ED}${sk_tmp_dir}";
  2561. rmdir "${ED}/var/lib" 2> /dev/null;
  2562. rmdir "${ED}/var" 2> /dev/null;
  2563. rm -fr "${ED}/usr/share/applications/mimeinfo.cache";
  2564. if has ${EAPI:-0} 0 1 2 3 4; then
  2565. if [[ "${GNOME2_LA_PUNT}" != "no" ]]; then
  2566. ebegin "Removing .la files";
  2567. if ! use_if_iuse static-libs; then
  2568. find "${D}" -name '*.la' -exec rm -f {} + || die "la file removal failed";
  2569. fi;
  2570. eend;
  2571. fi;
  2572. else
  2573. case "${GNOME2_LA_PUNT}" in
  2574. yes)
  2575. prune_libtool_files --modules
  2576. ;;
  2577. no)
  2578.  
  2579. ;;
  2580. *)
  2581. prune_libtool_files
  2582. ;;
  2583. esac;
  2584. fi
  2585. }
  2586. gnome2_src_prepare ()
  2587. {
  2588. gnome2_environment_reset;
  2589. gnome2_omf_fix;
  2590. gnome2_disable_deprecation_warning;
  2591. if has ${EAPI:-0} 0 1 2 3; then
  2592. elibtoolize ${ELTCONF};
  2593. else
  2594. nonfatal elibtoolize ${ELTCONF};
  2595. fi
  2596. }
  2597. gnome2_src_unpack ()
  2598. {
  2599. unpack ${A};
  2600. cd "${S}";
  2601. has ${EAPI:-0} 0 1 && gnome2_src_prepare
  2602. }
  2603. has_multilib_profile ()
  2604. {
  2605. [ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ]
  2606. }
  2607. in_iuse ()
  2608. {
  2609. debug-print-function ${FUNCNAME} "${@}";
  2610. [[ ${#} -eq 1 ]] || die "Invalid args to ${FUNCNAME}()";
  2611. local flag=${1};
  2612. local liuse=(${IUSE});
  2613. has "${flag}" "${liuse[@]#[+-]}"
  2614. }
  2615. is_final_abi ()
  2616. {
  2617. has_multilib_profile || return 0;
  2618. set -- $(get_install_abis);
  2619. local LAST_ABI=$#;
  2620. [[ ${!LAST_ABI} == ${ABI} ]]
  2621. }
  2622. isdigit ()
  2623. {
  2624. local d;
  2625. for d in "$@";
  2626. do
  2627. [[ ${d:-bad} == *[!0-9]* ]] && return 1;
  2628. done;
  2629. return 0
  2630. }
  2631. make_desktop_entry ()
  2632. {
  2633. [[ -z $1 ]] && die "make_desktop_entry: You must specify the executable";
  2634. local exec=${1};
  2635. local name=${2:-${PN}};
  2636. local icon=${3:-${PN}};
  2637. local type=${4};
  2638. local fields=${5};
  2639. if [[ -z ${type} ]]; then
  2640. local catmaj=${CATEGORY%%-*};
  2641. local catmin=${CATEGORY##*-};
  2642. case ${catmaj} in
  2643. app)
  2644. case ${catmin} in
  2645. accessibility)
  2646. type="Utility;Accessibility"
  2647. ;;
  2648. admin)
  2649. type=System
  2650. ;;
  2651. antivirus)
  2652. type=System
  2653. ;;
  2654. arch)
  2655. type="Utility;Archiving"
  2656. ;;
  2657. backup)
  2658. type="Utility;Archiving"
  2659. ;;
  2660. cdr)
  2661. type="AudioVideo;DiscBurning"
  2662. ;;
  2663. dicts)
  2664. type="Office;Dictionary"
  2665. ;;
  2666. doc)
  2667. type=Documentation
  2668. ;;
  2669. editors)
  2670. type="Utility;TextEditor"
  2671. ;;
  2672. emacs)
  2673. type="Development;TextEditor"
  2674. ;;
  2675. emulation)
  2676. type="System;Emulator"
  2677. ;;
  2678. laptop)
  2679. type="Settings;HardwareSettings"
  2680. ;;
  2681. office)
  2682. type=Office
  2683. ;;
  2684. pda)
  2685. type="Office;PDA"
  2686. ;;
  2687. vim)
  2688. type="Development;TextEditor"
  2689. ;;
  2690. xemacs)
  2691. type="Development;TextEditor"
  2692. ;;
  2693. esac
  2694. ;;
  2695. dev)
  2696. type="Development"
  2697. ;;
  2698. games)
  2699. case ${catmin} in
  2700. action | fps)
  2701. type=ActionGame
  2702. ;;
  2703. arcade)
  2704. type=ArcadeGame
  2705. ;;
  2706. board)
  2707. type=BoardGame
  2708. ;;
  2709. emulation)
  2710. type=Emulator
  2711. ;;
  2712. kids)
  2713. type=KidsGame
  2714. ;;
  2715. puzzle)
  2716. type=LogicGame
  2717. ;;
  2718. roguelike)
  2719. type=RolePlaying
  2720. ;;
  2721. rpg)
  2722. type=RolePlaying
  2723. ;;
  2724. simulation)
  2725. type=Simulation
  2726. ;;
  2727. sports)
  2728. type=SportsGame
  2729. ;;
  2730. strategy)
  2731. type=StrategyGame
  2732. ;;
  2733. esac;
  2734. type="Game;${type}"
  2735. ;;
  2736. gnome)
  2737. type="Gnome;GTK"
  2738. ;;
  2739. kde)
  2740. type="KDE;Qt"
  2741. ;;
  2742. mail)
  2743. type="Network;Email"
  2744. ;;
  2745. media)
  2746. case ${catmin} in
  2747. gfx)
  2748. type=Graphics
  2749. ;;
  2750. *)
  2751. case ${catmin} in
  2752. radio)
  2753. type=Tuner
  2754. ;;
  2755. sound)
  2756. type=Audio
  2757. ;;
  2758. tv)
  2759. type=TV
  2760. ;;
  2761. video)
  2762. type=Video
  2763. ;;
  2764. esac;
  2765. type="AudioVideo;${type}"
  2766. ;;
  2767. esac
  2768. ;;
  2769. net)
  2770. case ${catmin} in
  2771. dialup)
  2772. type=Dialup
  2773. ;;
  2774. ftp)
  2775. type=FileTransfer
  2776. ;;
  2777. im)
  2778. type=InstantMessaging
  2779. ;;
  2780. irc)
  2781. type=IRCClient
  2782. ;;
  2783. mail)
  2784. type=Email
  2785. ;;
  2786. news)
  2787. type=News
  2788. ;;
  2789. nntp)
  2790. type=News
  2791. ;;
  2792. p2p)
  2793. type=FileTransfer
  2794. ;;
  2795. voip)
  2796. type=Telephony
  2797. ;;
  2798. esac;
  2799. type="Network;${type}"
  2800. ;;
  2801. sci)
  2802. case ${catmin} in
  2803. astro*)
  2804. type=Astronomy
  2805. ;;
  2806. bio*)
  2807. type=Biology
  2808. ;;
  2809. calc*)
  2810. type=Calculator
  2811. ;;
  2812. chem*)
  2813. type=Chemistry
  2814. ;;
  2815. elec*)
  2816. type=Electronics
  2817. ;;
  2818. geo*)
  2819. type=Geology
  2820. ;;
  2821. math*)
  2822. type=Math
  2823. ;;
  2824. physics)
  2825. type=Physics
  2826. ;;
  2827. visual*)
  2828. type=DataVisualization
  2829. ;;
  2830. esac;
  2831. type="Education;Science;${type}"
  2832. ;;
  2833. sys)
  2834. type="System"
  2835. ;;
  2836. www)
  2837. case ${catmin} in
  2838. client)
  2839. type=WebBrowser
  2840. ;;
  2841. esac;
  2842. type="Network;${type}"
  2843. ;;
  2844. *)
  2845. type=
  2846. ;;
  2847. esac;
  2848. fi;
  2849. if [ "${SLOT}" == "0" ]; then
  2850. local desktop_name="${PN}";
  2851. else
  2852. local desktop_name="${PN}-${SLOT}";
  2853. fi;
  2854. local desktop="${T}/$(echo ${exec} | sed 's:[[:space:]/:]:_:g')-${desktop_name}.desktop";
  2855. type=${type%;}${type:+;};
  2856. eshopts_push -s extglob;
  2857. if [[ -n ${icon} && ${icon} != /* ]] && [[ ${icon} == *.xpm || ${icon} == *.png || ${icon} == *.svg ]]; then
  2858. ewarn "As described in the Icon Theme Specification, icon file extensions are not";
  2859. ewarn "allowed in .desktop files if the value is not an absolute path.";
  2860. icon=${icon%.@(xpm|png|svg)};
  2861. fi;
  2862. eshopts_pop;
  2863. cat > "${desktop}" <<-EOF
  2864. [Desktop Entry]
  2865. Name=${name}
  2866. Type=Application
  2867. Comment=${DESCRIPTION}
  2868. Exec=${exec}
  2869. TryExec=${exec%% *}
  2870. Icon=${icon}
  2871. Categories=${type}
  2872. EOF
  2873.  
  2874. if [[ ${fields:-=} != *=* ]]; then
  2875. ewarn "make_desktop_entry: update your 5th arg to read Path=${fields}";
  2876. fields="Path=${fields}";
  2877. fi;
  2878. [[ -n ${fields} ]] && printf '%b\n' "${fields}" >> "${desktop}";
  2879. ( insinto /usr/share/applications;
  2880. doins "${desktop}" ) || die "installing desktop file failed"
  2881. }
  2882. make_session_desktop ()
  2883. {
  2884. [[ -z $1 ]] && eerror "$0: You must specify the title" && return 1;
  2885. [[ -z $2 ]] && eerror "$0: You must specify the command" && return 1;
  2886. local title=$1;
  2887. local command=$2;
  2888. local desktop=${T}/${wm:-${PN}}.desktop;
  2889. shift 2;
  2890. cat > "${desktop}" <<-EOF
  2891. [Desktop Entry]
  2892. Name=${title}
  2893. Comment=This session logs you into ${title}
  2894. Exec=${command} $*
  2895. TryExec=${command}
  2896. Type=XSession
  2897. EOF
  2898.  
  2899. ( insinto /usr/share/xsessions;
  2900. doins "${desktop}" )
  2901. }
  2902. make_wrapper ()
  2903. {
  2904. local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5;
  2905. local tmpwrapper=$(emktemp);
  2906. ( echo '#!/bin/sh';
  2907. [[ -n ${chdir} ]] && printf 'cd "%s"\n' "${chdir}";
  2908. if [[ -n ${libdir} ]]; then
  2909. cat <<-EOF
  2910. if [ "\${LD_LIBRARY_PATH+set}" = "set" ] ; then
  2911. export LD_LIBRARY_PATH="\${LD_LIBRARY_PATH}:${libdir}"
  2912. else
  2913. export LD_LIBRARY_PATH="${libdir}"
  2914. fi
  2915. EOF
  2916.  
  2917. fi
  2918. printf 'exec %s "$@"\n' "${bin}" ) > "${tmpwrapper}";
  2919. chmod go+rx "${tmpwrapper}";
  2920. if [[ -n ${path} ]]; then
  2921. ( exeinto "${path}";
  2922. newexe "${tmpwrapper}" "${wrapper}" ) || die;
  2923. else
  2924. newbin "${tmpwrapper}" "${wrapper}" || die;
  2925. fi
  2926. }
  2927. multilib_env ()
  2928. {
  2929. local CTARGET=${1:-${CTARGET}};
  2930. case ${CTARGET} in
  2931. x86_64*)
  2932. export CFLAGS_x86=${CFLAGS_x86--m32};
  2933. export CHOST_x86=${CTARGET/x86_64/i686};
  2934. CHOST_x86=${CHOST_x86/%-gnux32/-gnu};
  2935. export CTARGET_x86=${CHOST_x86};
  2936. if [[ ${SYMLINK_LIB} == "yes" ]]; then
  2937. export LIBDIR_x86="lib32";
  2938. else
  2939. export LIBDIR_x86="lib";
  2940. fi;
  2941. export CFLAGS_amd64=${CFLAGS_amd64--m64};
  2942. export CHOST_amd64=${CTARGET/%-gnux32/-gnu};
  2943. export CTARGET_amd64=${CHOST_amd64};
  2944. export LIBDIR_amd64="lib64";
  2945. export CFLAGS_x32=${CFLAGS_x32--mx32};
  2946. export CHOST_x32=${CTARGET/%-gnu/-gnux32};
  2947. export CTARGET_x32=${CHOST_x32};
  2948. export LIBDIR_x32="libx32";
  2949. case ${CTARGET} in
  2950. *-gnux32)
  2951. : ${MULTILIB_ABIS=x32 amd64 x86};
  2952. : ${DEFAULT_ABI=x32}
  2953. ;;
  2954. *)
  2955. : ${MULTILIB_ABIS=amd64 x86};
  2956. : ${DEFAULT_ABI=amd64}
  2957. ;;
  2958. esac
  2959. ;;
  2960. mips64*)
  2961. export CFLAGS_o32=${CFLAGS_o32--mabi=32};
  2962. export CHOST_o32=${CTARGET/mips64/mips};
  2963. export CTARGET_o32=${CHOST_o32};
  2964. export LIBDIR_o32="lib";
  2965. export CFLAGS_n32=${CFLAGS_n32--mabi=n32};
  2966. export CHOST_n32=${CTARGET};
  2967. export CTARGET_n32=${CHOST_n32};
  2968. export LIBDIR_n32="lib32";
  2969. export CFLAGS_n64=${CFLAGS_n64--mabi=64};
  2970. export CHOST_n64=${CTARGET};
  2971. export CTARGET_n64=${CHOST_n64};
  2972. export LIBDIR_n64="lib64";
  2973. : ${MULTILIB_ABIS=n64 n32 o32};
  2974. : ${DEFAULT_ABI=n32}
  2975. ;;
  2976. powerpc64*)
  2977. export CFLAGS_ppc=${CFLAGS_ppc--m32};
  2978. export CHOST_ppc=${CTARGET/powerpc64/powerpc};
  2979. export CTARGET_ppc=${CHOST_ppc};
  2980. export LIBDIR_ppc="lib";
  2981. export CFLAGS_ppc64=${CFLAGS_ppc64--m64};
  2982. export CHOST_ppc64=${CTARGET};
  2983. export CTARGET_ppc64=${CHOST_ppc64};
  2984. export LIBDIR_ppc64="lib64";
  2985. : ${MULTILIB_ABIS=ppc64 ppc};
  2986. : ${DEFAULT_ABI=ppc64}
  2987. ;;
  2988. s390x*)
  2989. export CFLAGS_s390=${CFLAGS_s390--m31};
  2990. export CHOST_s390=${CTARGET/s390x/s390};
  2991. export CTARGET_s390=${CHOST_s390};
  2992. export LIBDIR_s390="lib";
  2993. export CFLAGS_s390x=${CFLAGS_s390x--m64};
  2994. export CHOST_s390x=${CTARGET};
  2995. export CTARGET_s390x=${CHOST_s390x};
  2996. export LIBDIR_s390x="lib64";
  2997. : ${MULTILIB_ABIS=s390x s390};
  2998. : ${DEFAULT_ABI=s390x}
  2999. ;;
  3000. sparc64*)
  3001. export CFLAGS_sparc32=${CFLAGS_sparc32--m32};
  3002. export CHOST_sparc32=${CTARGET/sparc64/sparc};
  3003. export CTARGET_sparc32=${CHOST_sparc32};
  3004. export LIBDIR_sparc32="lib";
  3005. export CFLAGS_sparc64=${CFLAGS_sparc64--m64};
  3006. export CHOST_sparc64=${CTARGET};
  3007. export CTARGET_sparc64=${CHOST_sparc64};
  3008. export LIBDIR_sparc64="lib64";
  3009. : ${MULTILIB_ABIS=sparc64 sparc32};
  3010. : ${DEFAULT_ABI=sparc64}
  3011. ;;
  3012. *)
  3013. : ${MULTILIB_ABIS=default};
  3014. : ${DEFAULT_ABI=default}
  3015. ;;
  3016. esac;
  3017. export MULTILIB_ABIS DEFAULT_ABI
  3018. }
  3019. multilib_toolchain_setup ()
  3020. {
  3021. local v vv;
  3022. export ABI=$1;
  3023. if [[ ${__DEFAULT_ABI_SAVED} == "true" ]]; then
  3024. for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH};
  3025. do
  3026. vv="__abi_saved_${v}";
  3027. [[ ${!vv+set} == "set" ]] && export ${v}="${!vv}" || unset ${v};
  3028. unset ${vv};
  3029. done;
  3030. unset __DEFAULT_ABI_SAVED;
  3031. fi;
  3032. if [[ ${ABI} != ${DEFAULT_ABI} ]]; then
  3033. for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH};
  3034. do
  3035. vv="__abi_saved_${v}";
  3036. [[ ${!v+set} == "set" ]] && export ${vv}="${!v}" || unset ${vv};
  3037. done;
  3038. export __DEFAULT_ABI_SAVED="true";
  3039. export CHOST=$(get_abi_CHOST ${DEFAULT_ABI});
  3040. export CC="$(tc-getCC) $(get_abi_CFLAGS)";
  3041. export CXX="$(tc-getCXX) $(get_abi_CFLAGS)";
  3042. export LD="$(tc-getLD) $(get_abi_LDFLAGS)";
  3043. export CHOST=$(get_abi_CHOST $1);
  3044. export CBUILD=$(get_abi_CHOST $1);
  3045. export PKG_CONFIG_LIBDIR=${EPREFIX}/usr/$(get_libdir)/pkgconfig;
  3046. export PKG_CONFIG_PATH=${EPREFIX}/usr/share/pkgconfig;
  3047. fi
  3048. }
  3049. newicon ()
  3050. {
  3051. _iconins ${FUNCNAME} "$@"
  3052. }
  3053. newmenu ()
  3054. {
  3055. ( insinto /usr/share/applications;
  3056. newins "$@" )
  3057. }
  3058. number_abis ()
  3059. {
  3060. set -- `get_install_abis`;
  3061. echo $#
  3062. }
  3063. path_exists ()
  3064. {
  3065. local opt=$1;
  3066. [[ ${opt} == -[ao] ]] && shift || opt="-a";
  3067. [[ $# -eq 0 ]] && return 1;
  3068. local p r=0;
  3069. for p in "$@";
  3070. do
  3071. [[ -e ${p} ]];
  3072. : $(( r += $? ));
  3073. done;
  3074. case ${opt} in
  3075. -a)
  3076. return $(( r != 0 ))
  3077. ;;
  3078. -o)
  3079. return $(( r == $# ))
  3080. ;;
  3081. esac
  3082. }
  3083. pkg_nofetch ()
  3084. {
  3085. __eapi0_pkg_nofetch "$@"
  3086. }
  3087. pkg_postinst ()
  3088. {
  3089. gnome2_pkg_postinst "$@"
  3090. }
  3091. pkg_postrm ()
  3092. {
  3093. gnome2_pkg_postrm "$@"
  3094. }
  3095. pkg_preinst ()
  3096. {
  3097. gnome2_pkg_preinst "$@"
  3098. }
  3099. pkg_setup ()
  3100. {
  3101. python-single-r1_pkg_setup "$@"
  3102. }
  3103. preserve_old_lib ()
  3104. {
  3105. if [[ ${EBUILD_PHASE} != "preinst" ]]; then
  3106. eerror "preserve_old_lib() must be called from pkg_preinst() only";
  3107. die "Invalid preserve_old_lib() usage";
  3108. fi;
  3109. [[ -z $1 ]] && die "Usage: preserve_old_lib <library to preserve> [more libraries to preserve]";
  3110. has preserve-libs ${FEATURES} && return 0;
  3111. local lib dir;
  3112. for lib in "$@";
  3113. do
  3114. [[ -e ${ROOT}/${lib} ]] || continue;
  3115. dir=${lib%/*};
  3116. dodir ${dir} || die "dodir ${dir} failed";
  3117. cp "${ROOT}"/${lib} "${D}"/${lib} || die "cp ${lib} failed";
  3118. touch "${D}"/${lib};
  3119. done
  3120. }
  3121. preserve_old_lib_notify ()
  3122. {
  3123. if [[ ${EBUILD_PHASE} != "postinst" ]]; then
  3124. eerror "preserve_old_lib_notify() must be called from pkg_postinst() only";
  3125. die "Invalid preserve_old_lib_notify() usage";
  3126. fi;
  3127. has preserve-libs ${FEATURES} && return 0;
  3128. local lib notice=0;
  3129. for lib in "$@";
  3130. do
  3131. [[ -e ${ROOT}/${lib} ]] || continue;
  3132. if [[ ${notice} -eq 0 ]]; then
  3133. notice=1;
  3134. ewarn "Old versions of installed libraries were detected on your system.";
  3135. ewarn "In order to avoid breaking packages that depend on these old libs,";
  3136. ewarn "the libraries are not being removed. You need to run revdep-rebuild";
  3137. ewarn "in order to remove these old dependencies. If you do not have this";
  3138. ewarn "helper program, simply emerge the 'gentoolkit' package.";
  3139. ewarn;
  3140. fi;
  3141. ewarn " # revdep-rebuild --library '${lib}' && rm '${lib}'";
  3142. done
  3143. }
  3144. prune_libtool_files ()
  3145. {
  3146. debug-print-function ${FUNCNAME} "$@";
  3147. local removing_all removing_modules opt;
  3148. for opt in "$@";
  3149. do
  3150. case "${opt}" in
  3151. --all)
  3152. removing_all=1;
  3153. removing_modules=1
  3154. ;;
  3155. --modules)
  3156. removing_modules=1
  3157. ;;
  3158. *)
  3159. die "Invalid argument to ${FUNCNAME}(): ${opt}"
  3160. ;;
  3161. esac;
  3162. done;
  3163. local f;
  3164. local queue=();
  3165. while IFS= read -r -d '' f; do
  3166. local archivefile=${f/%.la/.a};
  3167. if ! sed -n -e '/^# Generated by .*libtool/q0;4q1' "${f}"; then
  3168. continue;
  3169. fi;
  3170. [[ ${f} != ${archivefile} ]] || die 'regex sanity check failed';
  3171. local reason pkgconfig_scanned;
  3172. local snotlink=$(sed -n -e 's:^shouldnotlink=::p' "${f}");
  3173. if [[ ${snotlink} == yes ]]; then
  3174. if [[ -f ${archivefile} ]]; then
  3175. einfo "Removing unnecessary ${archivefile#${D%/}} (static plugin)";
  3176. queue+=("${archivefile}");
  3177. fi;
  3178. if [[ -n ${removing_modules} ]]; then
  3179. reason='module';
  3180. fi;
  3181. else
  3182. if [[ -n ${removing_all} ]]; then
  3183. reason='requested';
  3184. else
  3185. if [[ ! -f ${archivefile} ]]; then
  3186. reason='no static archive';
  3187. else
  3188. if [[ ! -n $(sed -nre "s/^(dependency_libs|inherited_linker_flags)='(.*)'$/\2/p" "${f}") ]]; then
  3189. reason='no libs & flags';
  3190. else
  3191. if [[ ! -n ${pkgconfig_scanned} ]]; then
  3192. local pc_libs=();
  3193. if [[ ! -n ${removing_all} ]]; then
  3194. local pc;
  3195. local tf=${T}/prune-lt-files.pc;
  3196. local pkgconf=$(tc-getPKG_CONFIG);
  3197. while IFS= read -r -d '' pc; do
  3198. local arg libs;
  3199. if ${pkgconf} --exists "${pc}" &>/dev/null; then
  3200. sed -e '/^Requires:/d' "${pc}" > "${tf}";
  3201. libs=$(${pkgconf} --libs "${tf}");
  3202. else
  3203. libs=$(sed -ne 's/^Libs://p' "${pc}");
  3204. fi;
  3205. for arg in ${libs};
  3206. do
  3207. if [[ ${arg} == -l* ]]; then
  3208. if [[ ${arg} == '*$*' ]]; then
  3209. eqawarn "${FUNCNAME}: variable substitution likely failed in ${pc}";
  3210. eqawarn "(arg: ${arg})";
  3211. eqawarn "Most likely, you need to add virtual/pkgconfig to DEPEND.";
  3212. fi;
  3213. pc_libs+=(lib${arg#-l}.la);
  3214. fi;
  3215. done;
  3216. done < <(find "${D}" -type f -name '*.pc' -print0);
  3217. rm -f "${tf}";
  3218. fi;
  3219. pkgconfig_scanned=1;
  3220. fi;
  3221. has "${f##*/}" "${pc_libs[@]}" && reason='covered by .pc';
  3222. fi;
  3223. fi;
  3224. fi;
  3225. fi;
  3226. if [[ -n ${reason} ]]; then
  3227. einfo "Removing unnecessary ${f#${D%/}} (${reason})";
  3228. queue+=("${f}");
  3229. fi;
  3230. done < <(find "${D}" -xtype f -name '*.la' -print0);
  3231. if [[ -n ${queue[@]} ]]; then
  3232. rm -f "${queue[@]}";
  3233. fi
  3234. }
  3235. python-single-r1_pkg_setup ()
  3236. {
  3237. debug-print-function ${FUNCNAME} "${@}";
  3238. unset EPYTHON;
  3239. local impl;
  3240. for impl in "${_PYTHON_ALL_IMPLS[@]}";
  3241. do
  3242. if has "${impl}" "${PYTHON_COMPAT[@]}" && use "python_single_target_${impl}"; then
  3243. if [[ -n ${EPYTHON} ]]; then
  3244. eerror "Your PYTHON_SINGLE_TARGET setting lists more than a single Python";
  3245. eerror "implementation. Please set it to just one value. If you need";
  3246. eerror "to override the value for a single package, please use package.env";
  3247. eerror "or an equivalent solution (man 5 portage).";
  3248. echo;
  3249. die "More than one implementation in PYTHON_SINGLE_TARGET.";
  3250. fi;
  3251. if ! use "python_targets_${impl}"; then
  3252. eerror "The implementation chosen as PYTHON_SINGLE_TARGET must be added";
  3253. eerror "to PYTHON_TARGETS as well. This is in order to ensure that";
  3254. eerror "dependencies are satisfied correctly. We're sorry";
  3255. eerror "for the inconvenience.";
  3256. echo;
  3257. die "Build target (${impl}) not in PYTHON_TARGETS.";
  3258. fi;
  3259. python_export "${impl}" EPYTHON PYTHON;
  3260. python_wrapper_setup;
  3261. fi;
  3262. done;
  3263. if [[ ! -n ${EPYTHON} ]]; then
  3264. eerror "No Python implementation selected for the build. Please set";
  3265. eerror "the PYTHON_SINGLE_TARGET variable in your make.conf to one";
  3266. eerror "of the following values:";
  3267. eerror;
  3268. eerror "${PYTHON_COMPAT[@]}";
  3269. echo;
  3270. die "No supported Python implementation in PYTHON_SINGLE_TARGET.";
  3271. fi
  3272. }
  3273. python_doheader ()
  3274. {
  3275. debug-print-function ${FUNCNAME} "${@}";
  3276. [[ -n ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).';
  3277. local d PYTHON_INCLUDEDIR=${PYTHON_INCLUDEDIR};
  3278. [[ -n ${PYTHON_INCLUDEDIR} ]] || python_export PYTHON_INCLUDEDIR;
  3279. d=${PYTHON_INCLUDEDIR#${EPREFIX}};
  3280. local INSDESTTREE;
  3281. insinto "${d}";
  3282. doins -r "${@}" || die
  3283. }
  3284. python_domodule ()
  3285. {
  3286. debug-print-function ${FUNCNAME} "${@}";
  3287. [[ -n ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).';
  3288. local d;
  3289. if [[ ${python_moduleroot} == /* ]]; then
  3290. d=${python_moduleroot};
  3291. else
  3292. local PYTHON_SITEDIR=${PYTHON_SITEDIR};
  3293. [[ -n ${PYTHON_SITEDIR} ]] || python_export PYTHON_SITEDIR;
  3294. d=${PYTHON_SITEDIR#${EPREFIX}}/${python_moduleroot};
  3295. fi;
  3296. local INSDESTTREE;
  3297. insinto "${d}";
  3298. doins -r "${@}" || die;
  3299. python_optimize "${ED}/${d}"
  3300. }
  3301. python_doscript ()
  3302. {
  3303. debug-print-function ${FUNCNAME} "${@}";
  3304. local f;
  3305. for f in "$@";
  3306. do
  3307. python_newscript "${f}" "${f##*/}";
  3308. done
  3309. }
  3310. python_export ()
  3311. {
  3312. debug-print-function ${FUNCNAME} "${@}";
  3313. local impl var;
  3314. case "${1}" in
  3315. python* | jython*)
  3316. impl=${1/_/.};
  3317. shift
  3318. ;;
  3319. pypy-c*)
  3320. impl=${1};
  3321. shift
  3322. ;;
  3323. pypy*)
  3324. local v=${1#pypy};
  3325. impl=pypy-c${v/_/.};
  3326. shift
  3327. ;;
  3328. *)
  3329. impl=${EPYTHON};
  3330. [[ -n ${impl} ]] || die "python_export: no impl nor EPYTHON"
  3331. ;;
  3332. esac;
  3333. debug-print "${FUNCNAME}: implementation: ${impl}";
  3334. for var in "$@";
  3335. do
  3336. case "${var}" in
  3337. EPYTHON)
  3338. export EPYTHON=${impl};
  3339. debug-print "${FUNCNAME}: EPYTHON = ${EPYTHON}"
  3340. ;;
  3341. PYTHON)
  3342. export PYTHON=${EPREFIX}/usr/bin/${impl};
  3343. debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
  3344. ;;
  3345. PYTHON_SITEDIR)
  3346. local dir;
  3347. case "${impl}" in
  3348. python*)
  3349. dir=/usr/$(get_libdir)/${impl}
  3350. ;;
  3351. jython*)
  3352. dir=/usr/share/${impl}/Lib
  3353. ;;
  3354. pypy*)
  3355. dir=/usr/$(get_libdir)/${impl/-c/}
  3356. ;;
  3357. esac;
  3358. export PYTHON_SITEDIR=${EPREFIX}${dir}/site-packages;
  3359. debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}"
  3360. ;;
  3361. PYTHON_INCLUDEDIR)
  3362. local dir;
  3363. case "${impl}" in
  3364. python*)
  3365. dir=/usr/include/${impl}
  3366. ;;
  3367. jython*)
  3368. dir=/usr/share/${impl}/Include
  3369. ;;
  3370. pypy*)
  3371. dir=/usr/$(get_libdir)/${impl/-c/}/include
  3372. ;;
  3373. esac;
  3374. export PYTHON_INCLUDEDIR=${EPREFIX}${dir};
  3375. debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR = ${PYTHON_INCLUDEDIR}"
  3376. ;;
  3377. PYTHON_LIBPATH)
  3378. local libname;
  3379. case "${impl}" in
  3380. python*)
  3381. libname=lib${impl}
  3382. ;;
  3383. *)
  3384. die "${impl} lacks a dynamic library"
  3385. ;;
  3386. esac;
  3387. local path=${EPREFIX}/usr/$(get_libdir);
  3388. export PYTHON_LIBPATH=${path}/${libname}$(get_libname);
  3389. debug-print "${FUNCNAME}: PYTHON_LIBPATH = ${PYTHON_LIBPATH}"
  3390. ;;
  3391. PYTHON_CFLAGS)
  3392. local val;
  3393. case "${impl}" in
  3394. python2.5 | python2.6)
  3395. val=$("${impl}-config" --includes)
  3396. ;;
  3397. python*)
  3398. val=$($(tc-getPKG_CONFIG) --cflags ${impl/n/n-})
  3399. ;;
  3400. *)
  3401. die "${impl}: obtaining ${var} not supported"
  3402. ;;
  3403. esac;
  3404. export PYTHON_CFLAGS=${val};
  3405. debug-print "${FUNCNAME}: PYTHON_CFLAGS = ${PYTHON_CFLAGS}"
  3406. ;;
  3407. PYTHON_LIBS)
  3408. local val;
  3409. case "${impl}" in
  3410. python2.5 | python2.6)
  3411. val=$("${impl}-config" --libs)
  3412. ;;
  3413. python*)
  3414. val=$($(tc-getPKG_CONFIG) --libs ${impl/n/n-})
  3415. ;;
  3416. *)
  3417. die "${impl}: obtaining ${var} not supported"
  3418. ;;
  3419. esac;
  3420. export PYTHON_LIBS=${val};
  3421. debug-print "${FUNCNAME}: PYTHON_LIBS = ${PYTHON_LIBS}"
  3422. ;;
  3423. PYTHON_PKG_DEP)
  3424. local d;
  3425. case ${impl} in
  3426. python*)
  3427. PYTHON_PKG_DEP='dev-lang/python'
  3428. ;;
  3429. jython*)
  3430. PYTHON_PKG_DEP='dev-java/jython'
  3431. ;;
  3432. pypy*)
  3433. PYTHON_PKG_DEP='virtual/pypy'
  3434. ;;
  3435. *)
  3436. die "Invalid implementation: ${impl}"
  3437. ;;
  3438. esac;
  3439. PYTHON_PKG_DEP+=:${impl##*[a-z-]};
  3440. if [[ -n ${PYTHON_REQ_USE} ]]; then
  3441. PYTHON_PKG_DEP+=[${PYTHON_REQ_USE}];
  3442. fi;
  3443. export PYTHON_PKG_DEP;
  3444. debug-print "${FUNCNAME}: PYTHON_PKG_DEP = ${PYTHON_PKG_DEP}"
  3445. ;;
  3446. *)
  3447. die "python_export: unknown variable ${var}"
  3448. ;;
  3449. esac;
  3450. done
  3451. }
  3452. python_fix_shebang ()
  3453. {
  3454. debug-print-function ${FUNCNAME} "${@}";
  3455. [[ -n ${1} ]] || die "${FUNCNAME}: no paths given";
  3456. [[ -n ${EPYTHON} ]] || die "${FUNCNAME}: EPYTHON unset (pkg_setup not called?)";
  3457. local path f;
  3458. for path in "$@";
  3459. do
  3460. while IFS= read -r -d '' f; do
  3461. local shebang=$(head -n 1 "${f}");
  3462. case "${shebang}" in
  3463. '#!'*${EPYTHON}*)
  3464. debug-print "${FUNCNAME}: in file ${f#${D}}";
  3465. debug-print "${FUNCNAME}: shebang matches EPYTHON: ${shebang}"
  3466. ;;
  3467. '#!'*python[23].[0123456789]* | '#!'*pypy-c* | '#!'*jython*)
  3468. debug-print "${FUNCNAME}: in file ${f#${D}}";
  3469. debug-print "${FUNCNAME}: incorrect specific shebang: ${shebang}";
  3470. die "${f#${D}} has a specific Python shebang not matching EPYTHON"
  3471. ;;
  3472. '#!'*python*)
  3473. debug-print "${FUNCNAME}: in file ${f#${D}}";
  3474. debug-print "${FUNCNAME}: rewriting shebang: ${shebang}";
  3475. einfo "Fixing shebang in ${f#${D}}";
  3476. _python_rewrite_shebang "${f}"
  3477. ;;
  3478. esac;
  3479. done < <(find "${path}" -type f -print0);
  3480. done
  3481. }
  3482. python_get_CFLAGS ()
  3483. {
  3484. debug-print-function ${FUNCNAME} "${@}";
  3485. python_export "${@}" PYTHON_CFLAGS;
  3486. echo "${PYTHON_CFLAGS}"
  3487. }
  3488. python_get_EPYTHON ()
  3489. {
  3490. debug-print-function ${FUNCNAME} "${@}";
  3491. python_export "${@}" EPYTHON;
  3492. echo "${EPYTHON}"
  3493. }
  3494. python_get_LIBS ()
  3495. {
  3496. debug-print-function ${FUNCNAME} "${@}";
  3497. python_export "${@}" PYTHON_LIBS;
  3498. echo "${PYTHON_LIBS}"
  3499. }
  3500. python_get_PYTHON ()
  3501. {
  3502. debug-print-function ${FUNCNAME} "${@}";
  3503. python_export "${@}" PYTHON;
  3504. echo "${PYTHON}"
  3505. }
  3506. python_get_includedir ()
  3507. {
  3508. debug-print-function ${FUNCNAME} "${@}";
  3509. python_export "${@}" PYTHON_INCLUDEDIR;
  3510. echo "${PYTHON_INCLUDEDIR}"
  3511. }
  3512. python_get_library_path ()
  3513. {
  3514. debug-print-function ${FUNCNAME} "${@}";
  3515. python_export "${@}" PYTHON_LIBPATH;
  3516. echo "${PYTHON_LIBPATH}"
  3517. }
  3518. python_get_sitedir ()
  3519. {
  3520. debug-print-function ${FUNCNAME} "${@}";
  3521. python_export "${@}" PYTHON_SITEDIR;
  3522. echo "${PYTHON_SITEDIR}"
  3523. }
  3524. python_moduleinto ()
  3525. {
  3526. debug-print-function ${FUNCNAME} "${@}";
  3527. python_moduleroot=${1}
  3528. }
  3529. python_newscript ()
  3530. {
  3531. debug-print-function ${FUNCNAME} "${@}";
  3532. [[ -n ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).';
  3533. [[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} <path> <new-name>";
  3534. local d=${python_scriptroot:-${DESTTREE}/bin};
  3535. local INSDESTTREE INSOPTIONS;
  3536. insinto "${d}";
  3537. insopts -m755;
  3538. local f=${1};
  3539. local barefn=${2};
  3540. local newfn=${barefn}-${EPYTHON};
  3541. debug-print "${FUNCNAME}: ${f} -> ${d}/${newfn}";
  3542. newins "${f}" "${newfn}" || die;
  3543. _python_rewrite_shebang "${ED}/${d}/${newfn}";
  3544. _python_ln_rel "${ED}"/usr/bin/python-exec "${ED}/${d}/${barefn}" || die
  3545. }
  3546. python_optimize ()
  3547. {
  3548. debug-print-function ${FUNCNAME} "${@}";
  3549. if [[ ${EBUILD_PHASE} == pre* || ${EBUILD_PHASE} == post* ]]; then
  3550. eerror "The new Python eclasses expect the compiled Python files to";
  3551. eerror "be controlled by the Package Manager. For this reason,";
  3552. eerror "the python_optimize function can be used only during src_* phases";
  3553. eerror "(src_install most commonly) and not during pkg_* phases.";
  3554. echo;
  3555. die "python_optimize is not to be used in pre/post* phases";
  3556. fi;
  3557. [[ -n ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).';
  3558. local PYTHON=${PYTHON};
  3559. [[ -n ${PYTHON} ]] || python_export PYTHON;
  3560. if [[ ${#} -eq 0 ]]; then
  3561. local f;
  3562. while IFS= read -r -d '' f; do
  3563. if [[ ${f} == /* && -d ${D}${f} ]]; then
  3564. set -- "${D}${f}" "${@}";
  3565. fi;
  3566. done < <("${PYTHON}" -c 'import sys; print("\0".join(sys.path))');
  3567. debug-print "${FUNCNAME}: using sys.path: ${*/%/;}";
  3568. fi;
  3569. local d;
  3570. for d in "$@";
  3571. do
  3572. local instpath=${d#${D}};
  3573. instpath=/${instpath##/};
  3574. case "${EPYTHON}" in
  3575. python*)
  3576. "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}";
  3577. "${PYTHON}" -OO -m compileall -q -f -d "${instpath}" "${d}"
  3578. ;;
  3579. *)
  3580. "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}"
  3581. ;;
  3582. esac;
  3583. done
  3584. }
  3585. python_scriptinto ()
  3586. {
  3587. debug-print-function ${FUNCNAME} "${@}";
  3588. python_scriptroot=${1}
  3589. }
  3590. python_wrapper_setup ()
  3591. {
  3592. debug-print-function ${FUNCNAME} "${@}";
  3593. local workdir=${1:-${T}/${EPYTHON}};
  3594. local impl=${2:-${EPYTHON}};
  3595. [[ -n ${workdir} ]] || die "${FUNCNAME}: no workdir specified.";
  3596. [[ -n ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON specified.";
  3597. if [[ ! -x ${workdir}/bin/python ]]; then
  3598. mkdir -p "${workdir}"/{bin,pkgconfig} || die;
  3599. rm -f "${workdir}"/bin/python{,2,3,-config};
  3600. rm -f "${workdir}"/bin/2to3;
  3601. rm -f "${workdir}"/pkgconfig/python{,2,3}.pc;
  3602. local EPYTHON PYTHON;
  3603. python_export "${impl}" EPYTHON PYTHON;
  3604. local pyver;
  3605. if [[ ${EPYTHON} == python3* ]]; then
  3606. pyver=3;
  3607. else
  3608. pyver=2;
  3609. fi;
  3610. ln -s "${PYTHON}" "${workdir}"/bin/python || die;
  3611. ln -s python "${workdir}"/bin/python${pyver} || die;
  3612. local nonsupp=();
  3613. if [[ ${EPYTHON} == python* ]]; then
  3614. ln -s "${PYTHON}-config" "${workdir}"/bin/python-config || die;
  3615. if [[ ${EPYTHON} != python2.5 ]]; then
  3616. ln -s "${PYTHON/python/2to3-}" "${workdir}"/bin/2to3 || die;
  3617. else
  3618. nonsupp+=(2to3);
  3619. fi;
  3620. if [[ ${EPYTHON} != python2.[56] ]]; then
  3621. ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}.pc "${workdir}"/pkgconfig/python.pc || die;
  3622. else
  3623. ln -s /dev/null "${workdir}"/pkgconfig/python.pc || die;
  3624. fi;
  3625. ln -s python.pc "${workdir}"/pkgconfig/python${pyver}.pc || die;
  3626. else
  3627. nonsupp+=(2to3 python-config);
  3628. fi;
  3629. local x;
  3630. for x in "${nonsupp[@]}";
  3631. do
  3632. cat > "${workdir}"/bin/${x} <<__EOF__
  3633. #!/bin/sh
  3634. echo "${x} is not supported by ${EPYTHON}" >&2
  3635. exit 1
  3636. __EOF__
  3637.  
  3638. chmod +x "${workdir}"/bin/${x} || die;
  3639. done
  3640. if [[ ${PATH##:*} != ${workdir}/bin ]]; then
  3641. PATH=${workdir}/bin${PATH:+:${PATH}};
  3642. fi;
  3643. if [[ ${PKG_CONFIG_PATH##:*} != ${workdir}/pkgconfig ]]; then
  3644. PKG_CONFIG_PATH=${workdir}/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}};
  3645. fi;
  3646. export PATH PKG_CONFIG_PATH;
  3647. fi
  3648. }
  3649. replace_all_version_separators ()
  3650. {
  3651. local c=($(get_all_version_components "${2:-${PV}}"));
  3652. c=${c[@]//[-._]/$1};
  3653. echo ${c// }
  3654. }
  3655. replace_version_separator ()
  3656. {
  3657. eshopts_push -s extglob;
  3658. local w c v="${3:-${PV}}";
  3659. declare -i i found=0;
  3660. w=${1:-1};
  3661. c=($(get_all_version_components ${v}));
  3662. if [[ ${w} != *[[:digit:]]* ]]; then
  3663. for ((i = 0; i < ${#c[@]}; i++))
  3664. do
  3665. if [[ ${c[i]} == ${w} ]]; then
  3666. c[i]=${2};
  3667. break;
  3668. fi;
  3669. done;
  3670. else
  3671. for ((i = 0; i < ${#c[@]}; i++))
  3672. do
  3673. if [[ -n "${c[i]//[^-._]}" ]]; then
  3674. found+=1;
  3675. if ((found == w)); then
  3676. c[i]=${2};
  3677. break;
  3678. fi;
  3679. fi;
  3680. done;
  3681. fi;
  3682. c=${c[*]};
  3683. echo ${c// };
  3684. eshopts_pop
  3685. }
  3686. src_compile ()
  3687. {
  3688. gnome2_src_compile "$@"
  3689. }
  3690. src_configure ()
  3691. {
  3692. G2CONF="${G2CONF}
  3693. --without-hal
  3694. --disable-battstat
  3695. --disable-mixer-applet
  3696. $(use_enable ipv6)
  3697. $(use_enable networkmanager)
  3698. $(use_enable policykit polkit)";
  3699. gnome2_src_configure
  3700. }
  3701. src_install ()
  3702. {
  3703. python_fix_shebang invest-applet;
  3704. gnome2_src_install;
  3705. local APPLETS="accessx-status charpick cpufreq drivemount geyes
  3706. gweather invest-applet mini-commander
  3707. multiload null_applet stickynotes trashapplet";
  3708. for applet in ${APPLETS};
  3709. do
  3710. docinto ${applet};
  3711. for d in AUTHORS ChangeLog NEWS README README.themes TODO;
  3712. do
  3713. [ -s ${applet}/${d} ] && dodoc ${applet}/${d};
  3714. done;
  3715. done
  3716. }
  3717. src_prepare ()
  3718. {
  3719. sed -e 's/pygobject-2.0/pygobject-3.0/' -i configure || die "sed failed";
  3720. gnome2_src_prepare
  3721. }
  3722. src_test ()
  3723. {
  3724. unset DBUS_SESSION_BUS_ADDRESS;
  3725. default
  3726. }
  3727. src_unpack ()
  3728. {
  3729. gnome2_src_unpack "$@"
  3730. }
  3731. strip-linguas ()
  3732. {
  3733. local ls newls nols;
  3734. if [[ $1 == "-i" ]] || [[ $1 == "-u" ]]; then
  3735. local op=$1;
  3736. shift;
  3737. ls=$(find "$1" -name '*.po' -exec basename {} .po ';');
  3738. shift;
  3739. local d f;
  3740. for d in "$@";
  3741. do
  3742. if [[ ${op} == "-u" ]]; then
  3743. newls=${ls};
  3744. else
  3745. newls="";
  3746. fi;
  3747. for f in $(find "$d" -name '*.po' -exec basename {} .po ';');
  3748. do
  3749. if [[ ${op} == "-i" ]]; then
  3750. has ${f} ${ls} && newls="${newls} ${f}";
  3751. else
  3752. has ${f} ${ls} || newls="${newls} ${f}";
  3753. fi;
  3754. done;
  3755. ls=${newls};
  3756. done;
  3757. else
  3758. ls="$@";
  3759. fi;
  3760. nols="";
  3761. newls="";
  3762. for f in ${LINGUAS};
  3763. do
  3764. if has ${f} ${ls}; then
  3765. newls="${newls} ${f}";
  3766. else
  3767. nols="${nols} ${f}";
  3768. fi;
  3769. done;
  3770. [[ -n ${nols} ]] && einfo "Sorry, but ${PN} does not support the LINGUAS:" ${nols};
  3771. export LINGUAS=${newls:1}
  3772. }
  3773. tc-arch ()
  3774. {
  3775. tc-ninja_magic_to_arch portage "$@"
  3776. }
  3777. tc-arch-kernel ()
  3778. {
  3779. tc-ninja_magic_to_arch kern "$@"
  3780. }
  3781. tc-endian ()
  3782. {
  3783. local host=$1;
  3784. [[ -z ${host} ]] && host=${CTARGET:-${CHOST}};
  3785. host=${host%%-*};
  3786. case ${host} in
  3787. aarch64*be)
  3788. echo big
  3789. ;;
  3790. aarch64)
  3791. echo little
  3792. ;;
  3793. alpha*)
  3794. echo big
  3795. ;;
  3796. arm*b*)
  3797. echo big
  3798. ;;
  3799. arm*)
  3800. echo little
  3801. ;;
  3802. cris*)
  3803. echo little
  3804. ;;
  3805. hppa*)
  3806. echo big
  3807. ;;
  3808. i?86*)
  3809. echo little
  3810. ;;
  3811. ia64*)
  3812. echo little
  3813. ;;
  3814. m68*)
  3815. echo big
  3816. ;;
  3817. mips*l*)
  3818. echo little
  3819. ;;
  3820. mips*)
  3821. echo big
  3822. ;;
  3823. powerpc*)
  3824. echo big
  3825. ;;
  3826. s390*)
  3827. echo big
  3828. ;;
  3829. sh*b*)
  3830. echo big
  3831. ;;
  3832. sh*)
  3833. echo little
  3834. ;;
  3835. sparc*)
  3836. echo big
  3837. ;;
  3838. x86_64*)
  3839. echo little
  3840. ;;
  3841. *)
  3842. echo wtf
  3843. ;;
  3844. esac
  3845. }
  3846. tc-env_build ()
  3847. {
  3848. tc-export_build_env;
  3849. CFLAGS=${BUILD_CFLAGS} CXXFLAGS=${BUILD_CXXFLAGS} CPPFLAGS=${BUILD_CPPFLAGS} LDFLAGS=${BUILD_LDFLAGS} AR=$(tc-getBUILD_AR) AS=$(tc-getBUILD_AS) CC=$(tc-getBUILD_CC) CPP=$(tc-getBUILD_CPP) CXX=$(tc-getBUILD_CXX) LD=$(tc-getBUILD_LD) NM=$(tc-getBUILD_NM) PKG_CONFIG=$(tc-getBUILD_PKG_CONFIG) RANLIB=$(tc-getBUILD_RANLIB) "$@"
  3850. }
  3851. tc-export ()
  3852. {
  3853. local var;
  3854. for var in "$@";
  3855. do
  3856. [[ $(type -t tc-get${var}) != "function" ]] && die "tc-export: invalid export variable '${var}'";
  3857. eval tc-get${var} > /dev/null;
  3858. done
  3859. }
  3860. tc-export_build_env ()
  3861. {
  3862. tc-export "$@";
  3863. : ${BUILD_CFLAGS:=-O1 -pipe};
  3864. : ${BUILD_CXXFLAGS:=-O1 -pipe};
  3865. : ${BUILD_CPPFLAGS:=};
  3866. : ${BUILD_LDFLAGS:=};
  3867. export BUILD_{C,CXX,CPP,LD}FLAGS
  3868. }
  3869. tc-getAR ()
  3870. {
  3871. tc-getPROG AR ar "$@"
  3872. }
  3873. tc-getAS ()
  3874. {
  3875. tc-getPROG AS as "$@"
  3876. }
  3877. tc-getBUILD_AR ()
  3878. {
  3879. tc-getBUILD_PROG AR ar "$@"
  3880. }
  3881. tc-getBUILD_AS ()
  3882. {
  3883. tc-getBUILD_PROG AS as "$@"
  3884. }
  3885. tc-getBUILD_CC ()
  3886. {
  3887. tc-getBUILD_PROG CC gcc "$@"
  3888. }
  3889. tc-getBUILD_CPP ()
  3890. {
  3891. tc-getBUILD_PROG CPP cpp "$@"
  3892. }
  3893. tc-getBUILD_CXX ()
  3894. {
  3895. tc-getBUILD_PROG CXX g++ "$@"
  3896. }
  3897. tc-getBUILD_LD ()
  3898. {
  3899. tc-getBUILD_PROG LD ld "$@"
  3900. }
  3901. tc-getBUILD_NM ()
  3902. {
  3903. tc-getBUILD_PROG NM nm "$@"
  3904. }
  3905. tc-getBUILD_OBJCOPY ()
  3906. {
  3907. tc-getBUILD_PROG OBJCOPY objcopy "$@"
  3908. }
  3909. tc-getBUILD_PKG_CONFIG ()
  3910. {
  3911. tc-getBUILD_PROG PKG_CONFIG pkg-config "$@"
  3912. }
  3913. tc-getBUILD_PROG ()
  3914. {
  3915. _tc-getPROG CBUILD "BUILD_$1 $1_FOR_BUILD HOST$1" "${@:2}"
  3916. }
  3917. tc-getBUILD_RANLIB ()
  3918. {
  3919. tc-getBUILD_PROG RANLIB ranlib "$@"
  3920. }
  3921. tc-getBUILD_STRIP ()
  3922. {
  3923. tc-getBUILD_PROG STRIP strip "$@"
  3924. }
  3925. tc-getCC ()
  3926. {
  3927. tc-getPROG CC gcc "$@"
  3928. }
  3929. tc-getCPP ()
  3930. {
  3931. tc-getPROG CPP cpp "$@"
  3932. }
  3933. tc-getCXX ()
  3934. {
  3935. tc-getPROG CXX g++ "$@"
  3936. }
  3937. tc-getDLLWRAP ()
  3938. {
  3939. tc-getPROG DLLWRAP dllwrap "$@"
  3940. }
  3941. tc-getF77 ()
  3942. {
  3943. tc-getPROG F77 gfortran "$@"
  3944. }
  3945. tc-getFC ()
  3946. {
  3947. tc-getPROG FC gfortran "$@"
  3948. }
  3949. tc-getGCJ ()
  3950. {
  3951. tc-getPROG GCJ gcj "$@"
  3952. }
  3953. tc-getLD ()
  3954. {
  3955. tc-getPROG LD ld "$@"
  3956. }
  3957. tc-getNM ()
  3958. {
  3959. tc-getPROG NM nm "$@"
  3960. }
  3961. tc-getOBJCOPY ()
  3962. {
  3963. tc-getPROG OBJCOPY objcopy "$@"
  3964. }
  3965. tc-getPKG_CONFIG ()
  3966. {
  3967. tc-getPROG PKG_CONFIG pkg-config "$@"
  3968. }
  3969. tc-getPROG ()
  3970. {
  3971. _tc-getPROG CHOST "$@"
  3972. }
  3973. tc-getRANLIB ()
  3974. {
  3975. tc-getPROG RANLIB ranlib "$@"
  3976. }
  3977. tc-getRC ()
  3978. {
  3979. tc-getPROG RC windres "$@"
  3980. }
  3981. tc-getSTRIP ()
  3982. {
  3983. tc-getPROG STRIP strip "$@"
  3984. }
  3985. tc-has-openmp ()
  3986. {
  3987. local base="${T}/test-tc-openmp";
  3988. cat > "${base}.c" <<-EOF
  3989. #include <omp.h>
  3990. int main() {
  3991. int nthreads, tid, ret = 0;
  3992. #pragma omp parallel private(nthreads, tid)
  3993. {
  3994. tid = omp_get_thread_num();
  3995. nthreads = omp_get_num_threads(); ret += tid + nthreads;
  3996. }
  3997. return ret;
  3998. }
  3999. EOF
  4000.  
  4001. $(tc-getCC "$@") -fopenmp "${base}.c" -o "${base}" &>/dev/null;
  4002. local ret=$?;
  4003. rm -f "${base}"*;
  4004. return ${ret}
  4005. }
  4006. tc-has-tls ()
  4007. {
  4008. local base="${T}/test-tc-tls";
  4009. cat > "${base}.c" <<-EOF
  4010. int foo(int *i) {
  4011. static __thread int j = 0;
  4012. return *i ? j : *i;
  4013. }
  4014. EOF
  4015.  
  4016. local flags;
  4017. case $1 in
  4018. -s)
  4019. flags="-S"
  4020. ;;
  4021. -c)
  4022. flags="-c"
  4023. ;;
  4024. -l)
  4025.  
  4026. ;;
  4027. -*)
  4028. die "Usage: tc-has-tls [-c|-l] [toolchain prefix]"
  4029. ;;
  4030. esac;
  4031. : ${flags:=-fPIC -shared -Wl,-z,defs};
  4032. [[ $1 == -* ]] && shift;
  4033. $(tc-getCC "$@") ${flags} "${base}.c" -o "${base}" &>/dev/null;
  4034. local ret=$?;
  4035. rm -f "${base}"*;
  4036. return ${ret}
  4037. }
  4038. tc-is-cross-compiler ()
  4039. {
  4040. return $([[ ${CBUILD:-${CHOST}} != ${CHOST} ]])
  4041. }
  4042. tc-is-softfloat ()
  4043. {
  4044. local CTARGET=${CTARGET:-${CHOST}};
  4045. case ${CTARGET} in
  4046. bfin* | h8300*)
  4047. echo "only"
  4048. ;;
  4049. *)
  4050. if [[ ${CTARGET//_/-} == *-softfloat-* ]]; then
  4051. echo "yes";
  4052. else
  4053. if [[ ${CTARGET//_/-} == *-softfp-* ]]; then
  4054. echo "softfp";
  4055. else
  4056. echo "no";
  4057. fi;
  4058. fi
  4059. ;;
  4060. esac
  4061. }
  4062. tc-is-static-only ()
  4063. {
  4064. local host=${CTARGET:-${CHOST}};
  4065. return $([[ ${host} == *-mint* ]])
  4066. }
  4067. tc-ninja_magic_to_arch ()
  4068. {
  4069. function ninj ()
  4070. {
  4071. [[ ${type} == "kern" ]] && echo $1 || echo $2
  4072. };
  4073. local type=$1;
  4074. local host=$2;
  4075. [[ -z ${host} ]] && host=${CTARGET:-${CHOST}};
  4076. local KV=${KV:-${KV_FULL}};
  4077. [[ ${type} == "kern" ]] && [[ -z ${KV} ]] && ewarn "QA: Kernel version could not be determined, please inherit kernel-2 or linux-info";
  4078. case ${host} in
  4079. aarch64*)
  4080. ninj arm64 arm
  4081. ;;
  4082. alpha*)
  4083. echo alpha
  4084. ;;
  4085. arm*)
  4086. echo arm
  4087. ;;
  4088. avr*)
  4089. ninj avr32 avr
  4090. ;;
  4091. bfin*)
  4092. ninj blackfin bfin
  4093. ;;
  4094. c6x)
  4095. echo c6x
  4096. ;;
  4097. cris*)
  4098. echo cris
  4099. ;;
  4100. frv)
  4101. echo frv
  4102. ;;
  4103. hexagon)
  4104. echo hexagon
  4105. ;;
  4106. hppa*)
  4107. ninj parisc hppa
  4108. ;;
  4109. i?86*)
  4110. if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -lt $(KV_to_int 2.6.24) || ${host} == *freebsd* ]]; then
  4111. echo i386;
  4112. else
  4113. echo x86;
  4114. fi
  4115. ;;
  4116. ia64*)
  4117. echo ia64
  4118. ;;
  4119. m68*)
  4120. echo m68k
  4121. ;;
  4122. metag)
  4123. echo metag
  4124. ;;
  4125. mips*)
  4126. echo mips
  4127. ;;
  4128. nios2*)
  4129. echo nios2
  4130. ;;
  4131. nios*)
  4132. echo nios
  4133. ;;
  4134. or32)
  4135. echo openrisc
  4136. ;;
  4137. powerpc*)
  4138. if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -ge $(KV_to_int 2.6.16) ]]; then
  4139. echo powerpc;
  4140. else
  4141. if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -eq $(KV_to_int 2.6.15) ]]; then
  4142. if [[ ${host} == powerpc64* ]] || [[ ${PROFILE_ARCH} == "ppc64" ]]; then
  4143. echo powerpc;
  4144. else
  4145. echo ppc;
  4146. fi;
  4147. else
  4148. if [[ ${host} == powerpc64* ]]; then
  4149. echo ppc64;
  4150. else
  4151. if [[ ${PROFILE_ARCH} == "ppc64" ]]; then
  4152. ninj ppc64 ppc;
  4153. else
  4154. echo ppc;
  4155. fi;
  4156. fi;
  4157. fi;
  4158. fi
  4159. ;;
  4160. s390*)
  4161. echo s390
  4162. ;;
  4163. score)
  4164. echo score
  4165. ;;
  4166. sh64*)
  4167. ninj sh64 sh
  4168. ;;
  4169. sh*)
  4170. echo sh
  4171. ;;
  4172. sparc64*)
  4173. ninj sparc64 sparc
  4174. ;;
  4175. sparc*)
  4176. [[ ${PROFILE_ARCH} == "sparc64" ]] && ninj sparc64 sparc || echo sparc
  4177. ;;
  4178. tile*)
  4179. echo tile
  4180. ;;
  4181. vax*)
  4182. echo vax
  4183. ;;
  4184. x86_64*freebsd*)
  4185. echo amd64
  4186. ;;
  4187. x86_64*)
  4188. if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -ge $(KV_to_int 2.6.24) ]]; then
  4189. echo x86;
  4190. else
  4191. ninj x86_64 amd64;
  4192. fi
  4193. ;;
  4194. xtensa*)
  4195. echo xtensa
  4196. ;;
  4197. *)
  4198. echo unknown
  4199. ;;
  4200. esac
  4201. }
  4202. uclibctoolize ()
  4203. {
  4204. die "Use elibtoolize"
  4205. }
  4206. use_if_iuse ()
  4207. {
  4208. in_iuse $1 || return 1;
  4209. use $1
  4210. }
  4211. validate_desktop_entries ()
  4212. {
  4213. if [[ -x /usr/bin/desktop-file-validate ]]; then
  4214. einfo "Checking desktop entry validity";
  4215. local directories="";
  4216. for d in /usr/share/applications $@;
  4217. do
  4218. [[ -d ${D}${d} ]] && directories="${directories} ${D}${d}";
  4219. done;
  4220. if [[ -n ${directories} ]]; then
  4221. for FILE in $(find ${directories} -name "*\.desktop" -not -path '*.hidden*' | sort -u 2>/dev/null);
  4222. do
  4223. local temp=$(desktop-file-validate ${FILE} | grep -v "warning:" | sed -e "s|error: ||" -e "s|${FILE}:|--|g" );
  4224. [[ -n $temp ]] && elog ${temp/--/${FILE/${D}/}:};
  4225. done;
  4226. fi;
  4227. echo "";
  4228. else
  4229. einfo "Passing desktop entry validity check. Install dev-util/desktop-file-utils, if you want to help to improve Gentoo.";
  4230. fi
  4231. }
  4232. version_compare ()
  4233. {
  4234. eshopts_push -s extglob;
  4235. local ver_a=${1} ver_b=${2} parts_a parts_b;
  4236. local cur_tok_a cur_tok_b num_part_a num_part_b;
  4237. local -i cur_idx_a=0 cur_idx_b=0 prev_idx_a prev_idx_b;
  4238. parts_a=($(get_all_version_components "${ver_a}" ));
  4239. parts_b=($(get_all_version_components "${ver_b}" ));
  4240. local -i inf_loop=0;
  4241. while true; do
  4242. inf_loop+=1;
  4243. ((inf_loop > 20)) && die "versionator compare bug [numbers, ${ver_a}, ${ver_b}]";
  4244. prev_idx_a=cur_idx_a;
  4245. prev_idx_b=cur_idx_b;
  4246. cur_tok_a=${parts_a[cur_idx_a]};
  4247. cur_tok_b=${parts_b[cur_idx_b]};
  4248. if [[ -n ${cur_tok_a} ]] && [[ -z ${cur_tok_a//[[:digit:]]} ]]; then
  4249. cur_idx_a+=1;
  4250. [[ ${parts_a[cur_idx_a]} == . ]] && cur_idx_a+=1;
  4251. else
  4252. cur_tok_a=;
  4253. fi;
  4254. if [[ -n ${cur_tok_b} ]] && [[ -z ${cur_tok_b//[[:digit:]]} ]]; then
  4255. cur_idx_b+=1;
  4256. [[ ${parts_b[cur_idx_b]} == . ]] && cur_idx_b+=1;
  4257. else
  4258. cur_tok_b=;
  4259. fi;
  4260. [[ -z ${cur_tok_a} && -z ${cur_tok_b} ]] && break;
  4261. [[ -z ${cur_tok_a} ]] && eshopts_pop && return 1;
  4262. [[ -z ${cur_tok_b} ]] && eshopts_pop && return 3;
  4263. if (( prev_idx_a != 0 && prev_idx_b != 0 )) && [[ ${cur_tok_a} == 0* || ${cur_tok_b} == 0* ]]; then
  4264. cur_tok_a=${cur_tok_a%%+(0)};
  4265. cur_tok_b=${cur_tok_b%%+(0)};
  4266. [[ ${cur_tok_a} < ${cur_tok_b} ]] && eshopts_pop && return 1;
  4267. [[ ${cur_tok_a} > ${cur_tok_b} ]] && eshopts_pop && return 3;
  4268. else
  4269. cur_tok_a=${cur_tok_a##+(0)};
  4270. cur_tok_b=${cur_tok_b##+(0)};
  4271. : ${cur_tok_a:=0};
  4272. : ${cur_tok_b:=0};
  4273. ((cur_tok_a < cur_tok_b)) && eshopts_pop && return 1;
  4274. ((cur_tok_a > cur_tok_b)) && eshopts_pop && return 3;
  4275. fi;
  4276. done;
  4277. local letter_a=;
  4278. letter_a=${parts_a[cur_idx_a]};
  4279. if [[ ${#letter_a} -eq 1 && -z ${letter_a/[a-z]} ]]; then
  4280. cur_idx_a+=1;
  4281. else
  4282. letter_a=@;
  4283. fi;
  4284. local letter_b=;
  4285. letter_b=${parts_b[cur_idx_b]};
  4286. if [[ ${#letter_b} -eq 1 && -z ${letter_b/[a-z]} ]]; then
  4287. cur_idx_b+=1;
  4288. else
  4289. letter_b=@;
  4290. fi;
  4291. [[ ${letter_a} < ${letter_b} ]] && eshopts_pop && return 1;
  4292. [[ ${letter_a} > ${letter_b} ]] && eshopts_pop && return 3;
  4293. inf_loop=0;
  4294. while true; do
  4295. inf_loop+=1;
  4296. ((inf_loop > 20)) && die "versionator compare bug [numbers, ${ver_a}, ${ver_b}]";
  4297. [[ ${parts_a[cur_idx_a]} == _ ]] && ((cur_idx_a++));
  4298. [[ ${parts_b[cur_idx_b]} == _ ]] && ((cur_idx_b++));
  4299. cur_tok_a=${parts_a[cur_idx_a]};
  4300. cur_tok_b=${parts_b[cur_idx_b]};
  4301. num_part_a=0;
  4302. num_part_b=0;
  4303. if has ${cur_tok_a%%+([0-9])} "alpha" "beta" "pre" "rc" "p"; then
  4304. cur_idx_a+=1;
  4305. num_part_a=${cur_tok_a##+([a-z])};
  4306. num_part_a=${num_part_a##+(0)};
  4307. : ${num_part_a:=0};
  4308. cur_tok_a=${cur_tok_a%%+([0-9])};
  4309. else
  4310. cur_tok_a=;
  4311. fi;
  4312. if has ${cur_tok_b%%+([0-9])} alpha beta pre rc p; then
  4313. cur_idx_b+=1;
  4314. num_part_b=${cur_tok_b##+([a-z])};
  4315. num_part_b=${num_part_b##+(0)};
  4316. : ${num_part_b:=0};
  4317. cur_tok_b=${cur_tok_b%%+([0-9])};
  4318. else
  4319. cur_tok_b=;
  4320. fi;
  4321. if [[ ${cur_tok_a} != ${cur_tok_b} ]]; then
  4322. local suffix;
  4323. for suffix in alpha beta pre rc "" p;
  4324. do
  4325. [[ ${cur_tok_a} == ${suffix} ]] && eshopts_pop && return 1;
  4326. [[ ${cur_tok_b} == ${suffix} ]] && eshopts_pop && return 3;
  4327. done;
  4328. else
  4329. if [[ -z ${cur_tok_a} && -z ${cur_tok_b} ]]; then
  4330. break;
  4331. else
  4332. ((num_part_a < num_part_b)) && eshopts_pop && return 1;
  4333. ((num_part_a > num_part_b)) && eshopts_pop && return 3;
  4334. fi;
  4335. fi;
  4336. done;
  4337. [[ ${parts_a[cur_idx_a]} == - ]] && ((cur_idx_a++));
  4338. [[ ${parts_b[cur_idx_b]} == - ]] && ((cur_idx_b++));
  4339. if [[ -n ${parts_a[cur_idx_a]/r+([0-9])} || -n ${parts_b[cur_idx_b]/r+([0-9])} ]]; then
  4340. die "versionator compare bug [revisions, ${ver_a}, ${ver_b}]";
  4341. fi;
  4342. num_part_a=${parts_a[cur_idx_a]#r};
  4343. num_part_a=${num_part_a##+(0)};
  4344. : ${num_part_a:=0};
  4345. num_part_b=${parts_b[cur_idx_b]#r};
  4346. num_part_b=${num_part_b##+(0)};
  4347. : ${num_part_b:=0};
  4348. ((num_part_a < num_part_b)) && eshopts_pop && return 1;
  4349. ((num_part_a > num_part_b)) && eshopts_pop && return 3;
  4350. eshopts_pop;
  4351. return 2
  4352. }
  4353. version_format_string ()
  4354. {
  4355. local fstr=$1;
  4356. shift;
  4357. set -- $(get_version_components "$@");
  4358. eval echo "${fstr}"
  4359. }
  4360. version_is_at_least ()
  4361. {
  4362. local want_s="$1" have_s="${2:-${PVR}}" r;
  4363. version_compare "${want_s}" "${have_s}";
  4364. r=$?;
  4365. case $r in
  4366. 1 | 2)
  4367. return 0
  4368. ;;
  4369. 3)
  4370. return 1
  4371. ;;
  4372. *)
  4373. die "versionator compare bug [atleast, ${want_s}, ${have_s}, ${r}]"
  4374. ;;
  4375. esac
  4376. }
  4377. version_sort ()
  4378. {
  4379. eshopts_push -s extglob;
  4380. local items=;
  4381. local -i left=0;
  4382. items=("$@");
  4383. while ((left < ${#items[@]})); do
  4384. local -i lowest_idx=left;
  4385. local -i idx=lowest_idx+1;
  4386. while ((idx < ${#items[@]})); do
  4387. version_compare "${items[lowest_idx]}" "${items[idx]}";
  4388. [[ $? -eq 3 ]] && lowest_idx=idx;
  4389. idx+=1;
  4390. done;
  4391. local tmp=${items[lowest_idx]};
  4392. items[lowest_idx]=${items[left]};
  4393. items[left]=${tmp};
  4394. left+=1;
  4395. done;
  4396. echo ${items[@]};
  4397. eshopts_pop
  4398. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement