Advertisement
Guest User

Untitled

a guest
Aug 20th, 2017
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 208.49 KB | None | 0 0
  1. declare -x ABI="arm"
  2. declare -a ALL_AUTOTOOLS_MACROS=([0]="AC_PROG_LIBTOOL" [1]="AM_PROG_LIBTOOL" [2]="LT_INIT" [3]="LT_CONFIG_LTDL_DIR" [4]="AC_CONFIG_HEADERS" [5]="AC_CONFIG_HEADER" [6]="AM_CONFIG_HEADERS" [7]="AM_CONFIG_HEADER" [8]="AC_CONFIG_SUBDIRS" [9]="AC_CONFIG_AUX_DIR" [10]="AC_CONFIG_MACRO_DIR" [11]="AM_INIT_AUTOMAKE" [12]="AM_GLIB_GNU_GETTEXT" [13]="AM_GNU_GETTEXT_VERSION" [14]="AM_GNU_GETTEXT_REQUIRE_VERSION" [15]="AC_PROG_INTLTOOL" [16]="IT_PROG_INTLTOOL" [17]="GTK_DOC_CHECK" [18]="GNOME_DOC_INIT")
  3. declare -x ANT_HOME="/usr/share/ant"
  4. 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"
  5. declare -x ARCH="arm"
  6. declare -- AT_M4DIR=""
  7. declare -- AT_SYS_M4DIR=""
  8. declare -- AUTOTOOLS_AUTO_DEPEND="yes"
  9. declare -- AUTOTOOLS_DEPEND="!<sys-devel/gettext-0.18.1.1-r3
  10. || ( >=sys-devel/automake-1.15:1.15 )
  11. >=sys-devel/autoconf-2.69
  12. >=sys-devel/libtool-2.4"
  13. declare -x BOOTSTRAP_USE="cxx unicode internal-glib python_targets_python3_4 python_targets_python2_7"
  14. declare -- BUILD_DIR="/var/tmp/portage/gnome-base/gnome-shell-9999-r1/work/gnome-shell-9999-build"
  15. declare -x CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author"
  16. declare -x CBUILD="armv7a-hardfloat-linux-gnueabi"
  17. declare -x CFLAGS="-O2 -pipe -march=native -mfpu=neon-vfpv4 -mfloat-abi=hard -fomit-frame-pointer"
  18. declare -x CFLAGS_default
  19. declare -x CHOST="armv7a-hardfloat-linux-gnueabi"
  20. declare -x CHOST_arm="arm-unknown-linux-gnu"
  21. declare -x CHOST_default="armv7a-hardfloat-linux-gnueabi"
  22. declare -x COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog"
  23. declare -- COMMON_DEPEND="
  24. dev-util/meson
  25. >=app-accessibility/at-spi2-atk-2.5.3
  26. >=dev-libs/atk-2[introspection]
  27. >=app-crypt/gcr-3.7.5[introspection]
  28. >=dev-libs/glib-2.53.4:2[dbus]
  29. >=dev-libs/gjs-1.49.4
  30. >=dev-libs/gobject-introspection-1.49.1:=
  31. dev-libs/libical:=
  32. >=x11-libs/gtk+-3.15.0:3[introspection]
  33. >=dev-libs/libcroco-0.6.8:0.6
  34. >=gnome-base/gnome-desktop-3.7.90:3=[introspection]
  35. >=gnome-base/gsettings-desktop-schemas-3.21.3
  36. >=gnome-extra/evolution-data-server-3.17.2:=
  37. >=media-libs/gstreamer-0.11.92:1.0
  38. >=net-im/telepathy-logger-0.2.4[introspection]
  39. >=net-libs/telepathy-glib-0.19[introspection]
  40. >=sys-auth/polkit-0.100[introspection]
  41. >=x11-libs/libXfixes-5.0
  42. x11-libs/libXtst
  43. >=x11-wm/mutter-3.25.90[introspection]
  44. >=x11-libs/startup-notification-0.11
  45.  
  46. python_targets_python3_4? ( dev-lang/python:3.4 ) python_targets_python3_5? ( dev-lang/python:3.5 ) python_targets_python3_6? ( dev-lang/python:3.6 ) >=dev-lang/python-exec-2:=[python_targets_python3_4(-)?,python_targets_python3_5(-)?,python_targets_python3_6(-)?,-python_single_target_python3_4(-),-python_single_target_python3_5(-),-python_single_target_python3_6(-)]
  47. dev-python/pygobject:3[python_targets_python3_4(-)?,python_targets_python3_5(-)?,python_targets_python3_6(-)?,-python_single_target_python3_4(-),-python_single_target_python3_5(-),-python_single_target_python3_6(-)]
  48.  
  49. dev-libs/dbus-glib
  50. dev-libs/libxml2:2
  51. media-libs/libcanberra[gtk3]
  52. media-libs/mesa
  53. >=media-sound/pulseaudio-2
  54. >=net-libs/libsoup-2.40:2.4[introspection]
  55. x11-libs/libX11
  56. x11-libs/gdk-pixbuf:2[introspection]
  57.  
  58. x11-apps/mesa-progs
  59.  
  60. >=net-wireless/gnome-bluetooth-3.20[introspection]
  61. networkmanager? (
  62. app-crypt/libsecret
  63. >=gnome-extra/nm-applet-0.9.8
  64. >=net-misc/networkmanager-0.9.8:=[introspection] )
  65. nsplugin? ( >=dev-libs/json-glib-0.13.2 )
  66. "
  67. declare -x CPU_FLAGS_ARM="neon"
  68. declare -x CTARGET_default="armv7a-hardfloat-linux-gnueabi"
  69. declare -x CXXFLAGS="-O2 -pipe -march=native -mfpu=neon-vfpv4 -mfloat-abi=hard -fomit-frame-pointer"
  70. declare -x DEFAULT_ABI="arm"
  71. declare -x DEFINED_PHASES=" compile configure install postinst postrm preinst prepare test unpack"
  72. declare DEPEND="
  73. dev-util/meson
  74. >=app-accessibility/at-spi2-atk-2.5.3
  75. >=dev-libs/atk-2[introspection]
  76. >=app-crypt/gcr-3.7.5[introspection]
  77. >=dev-libs/glib-2.53.4:2[dbus]
  78. >=dev-libs/gjs-1.49.4
  79. >=dev-libs/gobject-introspection-1.49.1:=
  80. dev-libs/libical:=
  81. >=x11-libs/gtk+-3.15.0:3[introspection]
  82. >=dev-libs/libcroco-0.6.8:0.6
  83. >=gnome-base/gnome-desktop-3.7.90:3=[introspection]
  84. >=gnome-base/gsettings-desktop-schemas-3.21.3
  85. >=gnome-extra/evolution-data-server-3.17.2:=
  86. >=media-libs/gstreamer-0.11.92:1.0
  87. >=net-im/telepathy-logger-0.2.4[introspection]
  88. >=net-libs/telepathy-glib-0.19[introspection]
  89. >=sys-auth/polkit-0.100[introspection]
  90. >=x11-libs/libXfixes-5.0
  91. x11-libs/libXtst
  92. >=x11-wm/mutter-3.25.90[introspection]
  93. >=x11-libs/startup-notification-0.11
  94.  
  95. python_targets_python3_4? ( dev-lang/python:3.4 ) python_targets_python3_5? ( dev-lang/python:3.5 ) python_targets_python3_6? ( dev-lang/python:3.6 ) >=dev-lang/python-exec-2:=[python_targets_python3_4(-)?,python_targets_python3_5(-)?,python_targets_python3_6(-)?,-python_single_target_python3_4(-),-python_single_target_python3_5(-),-python_single_target_python3_6(-)]
  96. dev-python/pygobject:3[python_targets_python3_4(-)?,python_targets_python3_5(-)?,python_targets_python3_6(-)?,-python_single_target_python3_4(-),-python_single_target_python3_5(-),-python_single_target_python3_6(-)]
  97.  
  98. dev-libs/dbus-glib
  99. dev-libs/libxml2:2
  100. media-libs/libcanberra[gtk3]
  101. media-libs/mesa
  102. >=media-sound/pulseaudio-2
  103. >=net-libs/libsoup-2.40:2.4[introspection]
  104. x11-libs/libX11
  105. x11-libs/gdk-pixbuf:2[introspection]
  106.  
  107. x11-apps/mesa-progs
  108.  
  109. >=net-wireless/gnome-bluetooth-3.20[introspection]
  110. networkmanager? (
  111. app-crypt/libsecret
  112. >=gnome-extra/nm-applet-0.9.8
  113. >=net-misc/networkmanager-0.9.8:=[introspection] )
  114. nsplugin? ( >=dev-libs/json-glib-0.13.2 )
  115.  
  116. dev-libs/libxslt
  117. >=dev-util/gtk-doc-am-1.17
  118. gnome-base/gnome-common
  119. >=sys-devel/gettext-0.19.6
  120. virtual/pkgconfig
  121. >=app-portage/elt-patches-20170422 !<sys-devel/gettext-0.18.1.1-r3
  122. || ( >=sys-devel/automake-1.15:1.15 )
  123. >=sys-devel/autoconf-2.69
  124. >=sys-devel/libtool-2.4 app-arch/xz-utils >=sys-apps/sed-4
  125. dev-util/desktop-file-utils
  126. x11-misc/shared-mime-info
  127. virtual/pkgconfig >=dev-util/meson-0.40.0
  128. >=dev-util/ninja-1.7.2 app-arch/xz-utils >=sys-apps/sed-4
  129. dev-util/desktop-file-utils
  130. x11-misc/shared-mime-info
  131. >=sys-apps/sed-4 >=dev-vcs/git-1.8.2.1
  132. dev-util/desktop-file-utils
  133. x11-misc/shared-mime-info
  134.  
  135. app-text/gnome-doc-utils
  136. app-text/yelp-tools
  137. dev-util/gtk-doc
  138. dev-util/intltool
  139. gnome-base/gnome-common
  140. sys-devel/gettext"
  141. declare DESCRIPTION="Provides core UI functions for the GNOME 3 desktop"
  142. declare -- DESKTOP_DATABASE_DIR="/usr/share/applications"
  143. declare -- DESKTOP_DATABASE_UPDATE_BIN="/usr/bin/update-desktop-database"
  144. declare -x DESTTREE="/usr"
  145. declare -x DIROPTIONS="-m0755"
  146. declare -x EAPI="6"
  147. declare -- EGIT3_STORE_DIR="/usr/portage/distfiles/git3-src"
  148. declare -- EGIT_BRANCH=""
  149. declare -- EGIT_CLONE_TYPE="single"
  150. declare -- EGIT_COMMIT=""
  151. declare -- EGIT_COMMIT_DATE=""
  152. declare -x EGIT_DIR="/usr/portage/distfiles/git3-src/gnome-shell.git"
  153. declare -- EGIT_MIN_CLONE_TYPE="shallow"
  154. declare -- EGIT_REPO_URI="git://git.gnome.org/gnome-shell"
  155. declare -x EGIT_VERSION="5c3de58279d92794f44031f5647b86a03d71654e"
  156. declare -x ELIBC="glibc"
  157. declare -- ELTCONF=""
  158. declare -- EPATCH_COMMON_OPTS="-g0 -E --no-backup-if-mismatch"
  159. declare -- EPATCH_EXCLUDE=""
  160. declare -- EPATCH_FORCE="no"
  161. declare -- EPATCH_MULTI_MSG="Applying various patches (bugfixes/updates) ..."
  162. declare -- EPATCH_OPTS=""
  163. declare -- EPATCH_SINGLE_MSG=""
  164. declare -- EPATCH_SOURCE="/var/tmp/portage/gnome-base/gnome-shell-9999-r1/work/patch"
  165. declare -- EPATCH_SUFFIX="patch.bz2"
  166. declare -x EXEOPTIONS="-m0755"
  167. declare -- EXPORTED_FUNCTIONS=" "
  168. declare -x FCFLAGS="-O2 -pipe -march=armv7-a"
  169. declare -x FETCHCOMMAND_SSH="bash -c \"x=\\\${2#ssh://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && port= ; exec rsync --rsh=\\\"ssh \\\${port:+-p\\\${port}} \\\${3}\\\" -avP \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" rsync \"\${DISTDIR}/\${FILE}\" \"\${URI}\" \"\${PORTAGE_SSH_OPTS}\""
  170. declare -x FFLAGS="-O2 -pipe -march=armv7-a"
  171. declare -x GCC_SPECS=""
  172. declare -- GCONFTOOL_BIN="/usr/bin/gconftool-2"
  173. declare -- GLIB_COMPILE_SCHEMAS="/usr/bin/glib-compile-schemas"
  174. declare -- GNOME2_EAUTORECONF=""
  175. declare -- GNOME2_LA_PUNT="yes"
  176. declare -- GNOME_LIVE_MODULE="gnome-shell"
  177. declare -- GNOME_ORG_MODULE="gnome-shell"
  178. declare -- GNOME_ORG_PVP="9999"
  179. declare -- GNOME_TARBALL_SUFFIX="xz"
  180. declare -x GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx"
  181. declare -x GRUB_PLATFORMS=""
  182. declare -x GSETTINGS_BACKEND="memory"
  183. declare -x GST_INSPECT="/bin/true"
  184. declare -x GST_REGISTRY="/var/tmp/portage/gnome-base/gnome-shell-9999-r1/temp/registry.xml"
  185. declare -- GTK_UPDATE_ICON_CACHE="/usr/bin/gtk-update-icon-cache"
  186. declare -x G_HOME="/var/tmp/portage/gnome-base/gnome-shell-9999-r1/temp"
  187. declare HDEPEND=""
  188. declare HOMEPAGE="https://wiki.gnome.org/Projects/GnomeShell"
  189. declare -x HUSHLOGIN="FALSE"
  190. declare -x INHERITED=" toolchain-funcs multilib libtool autotools estack epatch ltprune eutils versionator gnome.org xdg-utils gnome2-utils xdg gnome2 pax-utils multibuild python-utils-r1 python-r1 systemd multiprocessing ninja-utils meson git-r3 gnome2-live"
  191. declare -x INPUT_DEVICES="libinput"
  192. declare -x INSDESTTREE=""
  193. declare -x INSOPTIONS="-m0644"
  194. declare -x INVOCATION_ID="5d2df89d727b4cd7a0c0562c9f1e0cb2"
  195. declare IUSE="+bluetooth +networkmanager nsplugin +ibus -openrc-force python_targets_python3_4 python_targets_python3_5 python_targets_python3_6"
  196. declare -x IUSE_EFFECTIVE="alpha amd64 amd64-fbsd amd64-linux arm arm-linux arm64 bluetooth elibc_AIX elibc_Cygwin elibc_Darwin elibc_DragonFly elibc_FreeBSD elibc_HPUX elibc_Interix elibc_NetBSD elibc_OpenBSD elibc_SunOS elibc_Winnt elibc_bionic elibc_glibc elibc_mingw elibc_mintlib elibc_musl elibc_uclibc hppa ia64 ibus kernel_AIX kernel_Darwin kernel_FreeBSD kernel_HPUX kernel_NetBSD kernel_OpenBSD kernel_SunOS kernel_Winnt kernel_freemint kernel_linux m68k m68k-mint mips networkmanager nios2 nsplugin openrc-force ppc ppc-aix ppc-macos ppc64 ppc64-linux prefix prefix-chain prefix-guest python_targets_python3_4 python_targets_python3_5 python_targets_python3_6 riscv s390 sh sparc sparc-fbsd sparc-solaris sparc64-solaris userland_BSD userland_GNU x64-cygwin x64-macos x64-solaris x86 x86-cygwin x86-fbsd x86-linux x86-macos x86-solaris x86-winnt"
  197. declare -x IUSE_IMPLICIT="prefix prefix-chain prefix-guest"
  198. declare -x JAVAC="/etc/java-config-2/current-system-vm/bin/javac"
  199. declare -x JAVA_HOME="/etc/java-config-2/current-system-vm"
  200. declare -x JDK_HOME="/etc/java-config-2/current-system-vm"
  201. declare -x JOURNAL_STREAM="8:17410"
  202. declare -x KERNEL="linux"
  203. declare -x KERNEL_ABI="arm"
  204. declare -x KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc ~x86"
  205. declare -x LANG="en_US.UTF-8"
  206. declare -x LANGUAGE=""
  207. declare -x LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text"
  208. declare -x LC_ADDRESS=""
  209. declare -x LC_COLLATE="C"
  210. declare -x LC_CTYPE=""
  211. declare -x LC_IDENTIFICATION=""
  212. declare -x LC_MEASUREMENT=""
  213. declare -x LC_MESSAGES=""
  214. declare -x LC_MONETARY=""
  215. declare -x LC_NAME=""
  216. declare -x LC_NUMERIC=""
  217. declare -x LC_PAPER=""
  218. declare -x LC_TELEPHONE=""
  219. declare -x LC_TIME=""
  220. declare -x LDFLAGS="-Wl,-O1 -Wl,--as-needed"
  221. declare -x LDFLAGS_default
  222. declare -x LIBDIR_arm="lib"
  223. declare -x LIBDIR_default="lib"
  224. declare -x LIBOPTIONS="-m0644"
  225. declare -x LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer"
  226. declare -x LICENSE="GPL-2+ LGPL-2+"
  227. declare -x MAIL="/var/mail/root"
  228. declare -x MAKEOPTS="-j1"
  229. declare -x MANPAGER="manpager"
  230. declare -- MIMEINFO_DATABASE_DIR="/usr/share/mime"
  231. declare -- MIMEINFO_DATABASE_UPDATE_BIN="/usr/bin/update-mime-database"
  232. declare -x MULTILIB_ABIS="arm"
  233. declare -x NETBEANS="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml"
  234. declare -x OFFICE_IMPLEMENTATION="libreoffice"
  235. declare -x OPENGL_PROFILE="mali"
  236. declare -- PATCHES=""
  237. declare -x PATH="/usr/lib/ccache/bin:/usr/lib/portage/python3.4/ebuild-helpers/xattr:/usr/lib/portage/python3.4/ebuild-helpers:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/armv7a-hardfloat-linux-gnueabi/gcc-bin/6.4.0:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin"
  238. declare -- PAX_MARKINGS="PT XT"
  239. declare PDEPEND="
  240. >=gnome-base/gdm-3.5[introspection]
  241. >=gnome-base/gnome-control-center-3.8.3[bluetooth(+)?,networkmanager(+)?]
  242. "
  243. declare -x PHP_TARGETS="php5-6"
  244. declare -x PKG_CONFIG_PATH="/usr/lib/pkgconfig"
  245. declare -x PORTAGE_COMPRESSION_COMMAND="bzip2"
  246. declare -a PORTAGE_DOCOMPRESS=([0]="/usr/share/doc" [1]="/usr/share/info" [2]="/usr/share/man")
  247. declare -x PORTAGE_DOCOMPRESS_SIZE_LIMIT="128"
  248. declare -a PORTAGE_DOCOMPRESS_SKIP=([0]="/usr/share/doc/gnome-shell-9999-r1/html")
  249. declare -x PORTAGE_NICENESS="15"
  250. declare -x POSTGRES_TARGETS="postgres9_5"
  251. 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"
  252. declare -x PROPERTIES=""
  253. declare -x PROVIDE=""
  254. declare -x PYTHONDONTWRITEBYTECODE="1"
  255. declare -a PYTHON_COMPAT=([0]="python3_4" [1]="python3_5" [2]="python3_6")
  256. declare -- PYTHON_DEPS="python_targets_python3_4? ( dev-lang/python:3.4 ) python_targets_python3_5? ( dev-lang/python:3.5 ) python_targets_python3_6? ( dev-lang/python:3.6 ) >=dev-lang/python-exec-2:=[python_targets_python3_4(-)?,python_targets_python3_5(-)?,python_targets_python3_6(-)?,-python_single_target_python3_4(-),-python_single_target_python3_5(-),-python_single_target_python3_6(-)]"
  257. declare -- PYTHON_REQUIRED_USE="|| ( python_targets_python3_4 python_targets_python3_5 python_targets_python3_6 )"
  258. declare -x PYTHON_SINGLE_TARGET="python3_4"
  259. declare -x PYTHON_TARGETS="python3_4"
  260. declare -- PYTHON_USEDEP="python_targets_python3_4(-)?,python_targets_python3_5(-)?,python_targets_python3_6(-)?,-python_single_target_python3_4(-),-python_single_target_python3_5(-),-python_single_target_python3_6(-)"
  261. declare -x QEMU_SOFTMMU_TARGETS="i386"
  262. declare -x QEMU_USER_TARGETS="i386"
  263. declare RDEPEND="
  264. dev-util/meson
  265. >=app-accessibility/at-spi2-atk-2.5.3
  266. >=dev-libs/atk-2[introspection]
  267. >=app-crypt/gcr-3.7.5[introspection]
  268. >=dev-libs/glib-2.53.4:2[dbus]
  269. >=dev-libs/gjs-1.49.4
  270. >=dev-libs/gobject-introspection-1.49.1:=
  271. dev-libs/libical:=
  272. >=x11-libs/gtk+-3.15.0:3[introspection]
  273. >=dev-libs/libcroco-0.6.8:0.6
  274. >=gnome-base/gnome-desktop-3.7.90:3=[introspection]
  275. >=gnome-base/gsettings-desktop-schemas-3.21.3
  276. >=gnome-extra/evolution-data-server-3.17.2:=
  277. >=media-libs/gstreamer-0.11.92:1.0
  278. >=net-im/telepathy-logger-0.2.4[introspection]
  279. >=net-libs/telepathy-glib-0.19[introspection]
  280. >=sys-auth/polkit-0.100[introspection]
  281. >=x11-libs/libXfixes-5.0
  282. x11-libs/libXtst
  283. >=x11-wm/mutter-3.25.90[introspection]
  284. >=x11-libs/startup-notification-0.11
  285.  
  286. python_targets_python3_4? ( dev-lang/python:3.4 ) python_targets_python3_5? ( dev-lang/python:3.5 ) python_targets_python3_6? ( dev-lang/python:3.6 ) >=dev-lang/python-exec-2:=[python_targets_python3_4(-)?,python_targets_python3_5(-)?,python_targets_python3_6(-)?,-python_single_target_python3_4(-),-python_single_target_python3_5(-),-python_single_target_python3_6(-)]
  287. dev-python/pygobject:3[python_targets_python3_4(-)?,python_targets_python3_5(-)?,python_targets_python3_6(-)?,-python_single_target_python3_4(-),-python_single_target_python3_5(-),-python_single_target_python3_6(-)]
  288.  
  289. dev-libs/dbus-glib
  290. dev-libs/libxml2:2
  291. media-libs/libcanberra[gtk3]
  292. media-libs/mesa
  293. >=media-sound/pulseaudio-2
  294. >=net-libs/libsoup-2.40:2.4[introspection]
  295. x11-libs/libX11
  296. x11-libs/gdk-pixbuf:2[introspection]
  297.  
  298. x11-apps/mesa-progs
  299.  
  300. >=net-wireless/gnome-bluetooth-3.20[introspection]
  301. networkmanager? (
  302. app-crypt/libsecret
  303. >=gnome-extra/nm-applet-0.9.8
  304. >=net-misc/networkmanager-0.9.8:=[introspection] )
  305. nsplugin? ( >=dev-libs/json-glib-0.13.2 )
  306.  
  307. app-accessibility/at-spi2-core:2[introspection]
  308. >=app-accessibility/caribou-0.4.8
  309. dev-libs/libgweather:2[introspection]
  310. >=sys-apps/accountsservice-0.6.14[introspection]
  311. >=sys-power/upower-0.99:=[introspection]
  312. x11-libs/pango[introspection]
  313.  
  314. >=gnome-base/gnome-session-2.91.91
  315. >=gnome-base/gnome-settings-daemon-3.8.3
  316.  
  317. !openrc-force? ( >=sys-apps/systemd-31 )
  318.  
  319. x11-misc/xdg-utils
  320.  
  321. media-fonts/dejavu
  322. >=x11-themes/adwaita-icon-theme-3.19.90
  323.  
  324. networkmanager? (
  325. net-misc/mobile-broadband-provider-info
  326. sys-libs/timezone-data )
  327. ibus? ( >=app-i18n/ibus-1.4.99[dconf(+),gtk,introspection] )
  328. "
  329. declare REPOSITORY
  330. declare REQUIRED_USE="|| ( python_targets_python3_4 python_targets_python3_5 python_targets_python3_6 ) "
  331. declare -x RESTRICT=""
  332. declare -x RESUMECOMMAND_SSH="bash -c \"x=\\\${2#ssh://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && port= ; exec rsync --rsh=\\\"ssh \\\${port:+-p\\\${port}} \\\${3}\\\" -avP \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" rsync \"\${DISTDIR}/\${FILE}\" \"\${URI}\" \"\${PORTAGE_SSH_OPTS}\""
  333. declare -x RUBY_TARGETS="ruby21 ruby22"
  334. declare -x S="/var/tmp/portage/gnome-base/gnome-shell-9999-r1/work/gnome-shell-9999"
  335. declare -x SANDBOX_DEBUG="0"
  336. declare -x SANDBOX_DENY=""
  337. declare -x SANDBOX_PREDICT="/var/tmp/portage/gnome-base/gnome-shell-9999-r1/homedir:/dev/crypto:/proc/self/coredump_filter:/var/cache/fontconfig"
  338. declare -x SANDBOX_READ="/:/home/odroid/.portage_ccache:/var/tmp"
  339. declare -x SANDBOX_VERBOSE="1"
  340. declare -x SANDBOX_WRITE=":/dev/console:/dev/fd:/dev/full:/dev/null:/dev/ptmx:/dev/pts/:/dev/pty:/dev/shm:/dev/tts:/dev/tty:/dev/vc/:/dev/zero:/home/odroid/.portage_ccache:/proc/self/fd:/tmp/:/usr/lib/cf:/usr/lib/conftest:/usr/lib32/cf:/usr/lib32/conftest:/usr/lib64/cf:/usr/lib64/conftest:/usr/portage/distfiles/git3-src:/usr/tmp/cf:/usr/tmp/conftest:/var/tmp:/var/tmp/:/var/tmp/portage/gnome-base/gnome-shell-9999-r1/homedir/.bash_history"
  341. declare -- SCROLLKEEPER_DIR="/var/lib/scrollkeeper"
  342. declare -- SCROLLKEEPER_UPDATE_BIN="/usr/bin/scrollkeeper-update"
  343. declare -x SHELL="/bin/bash"
  344. declare -x SLOT="0"
  345. declare SRC_URI=""
  346. declare -x TWISTED_DISABLE_WRITING_OF_PLUGIN_CACHE="1"
  347. declare -x USE="arm bluetooth elibc_glibc ibus kernel_linux networkmanager python_targets_python3_4 userland_GNU"
  348. declare -x USERLAND="GNU"
  349. declare -x USE_EXPAND_IMPLICIT="ARCH ELIBC KERNEL USERLAND"
  350. declare -x USE_EXPAND_UNPREFIXED="ARCH"
  351. declare -x USE_EXPAND_VALUES_ARCH="alpha amd64 amd64-fbsd amd64-linux arm arm-linux arm64 hppa ia64 m68k m68k-mint mips nios2 ppc ppc64 ppc64-linux ppc-aix ppc-macos riscv s390 sh sparc sparc64-solaris sparc-fbsd sparc-solaris x64-cygwin x64-macos x64-solaris x86 x86-cygwin x86-fbsd x86-linux x86-macos x86-solaris x86-winnt"
  352. declare -x USE_EXPAND_VALUES_ELIBC="AIX bionic Cygwin Darwin DragonFly FreeBSD glibc HPUX Interix mingw mintlib musl NetBSD OpenBSD SunOS uclibc Winnt"
  353. declare -x USE_EXPAND_VALUES_KERNEL="AIX Darwin FreeBSD freemint HPUX linux NetBSD OpenBSD SunOS Winnt"
  354. declare -x USE_EXPAND_VALUES_USERLAND="BSD GNU"
  355. declare -x VIDEO_CARDS="exynos fbdev omap"
  356. declare -x WANT_AUTOCONF="latest"
  357. declare -x WANT_AUTOMAKE="latest"
  358. declare -x WANT_LIBTOOL="latest"
  359. declare -x XDG_CACHE_HOME="/var/tmp/portage/gnome-base/gnome-shell-9999-r1/homedir/.cache"
  360. declare -x XDG_CONFIG_DIRS="/etc/xdg"
  361. declare -x XDG_CONFIG_HOME="/var/tmp/portage/gnome-base/gnome-shell-9999-r1/homedir/.config"
  362. declare -x XDG_DATA_DIRS="/usr/local/share:/usr/share:/usr/share/gdm"
  363. declare -x XDG_DATA_HOME="/var/tmp/portage/gnome-base/gnome-shell-9999-r1/homedir/.local/share"
  364. declare -x XDG_RUNTIME_DIR="/var/tmp/portage/gnome-base/gnome-shell-9999-r1/temp/run"
  365. declare -x XDG_SEAT="seat0"
  366. declare -x XDG_SESSION_ID="c1"
  367. declare -x XDG_VTNR="1"
  368. 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"
  369. declare -- _AUTOTOOLS_ECLASS="1"
  370. declare -- _EPATCH_ECLASS="1"
  371. declare -- _ESTACK_ECLASS="1"
  372. declare -- _EUTILS_ECLASS="1"
  373. declare -x _E_DOCDESTTREE_=""
  374. declare -x _E_EXEDESTTREE_=""
  375. declare -- _GIT_R3="1"
  376. declare -a _LATEST_AUTOMAKE=([0]="1.15:1.15")
  377. declare -- _LIBTOOL_ECLASS="1"
  378. declare -- _LTPRUNE_ECLASS="1"
  379. declare -- _MESON_ECLASS="1"
  380. declare -- _MULTIBUILD="1"
  381. declare -- _MULTILIB_ECLASS="1"
  382. declare -- _MULTIPROCESSING_ECLASS="1"
  383. declare -- _NINJA_UTILS_ECLASS="1"
  384. declare -- _PAX_UTILS_ECLASS="1"
  385. declare -a _PYTHON_ALL_IMPLS=([0]="jython2_7" [1]="pypy" [2]="pypy3" [3]="python2_7" [4]="python3_4" [5]="python3_5" [6]="python3_6")
  386. declare -- _PYTHON_R1="1"
  387. declare -a _PYTHON_SUPPORTED_IMPLS=([0]="python3_4" [1]="python3_5" [2]="python3_6")
  388. declare -a _PYTHON_UNSUPPORTED_IMPLS=([0]="jython2_7" [1]="pypy" [2]="pypy3" [3]="python2_7")
  389. declare -- _PYTHON_UTILS_R1="1"
  390. declare -- _TOOLCHAIN_FUNCS_ECLASS="1"
  391. declare -- _VERSIONATOR_ECLASS="1"
  392. declare -- __AUTOTOOLS_AUTO_DEPEND="yes"
  393. declare -- _libtool_atom=">=sys-devel/libtool-2.4"
  394. declare -- phase_func
  395. declare -- started_applying="1"
  396. PYTHON ()
  397. {
  398. die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#.24.28PYTHON.29.2C_.24.7BEPYTHON.7D"
  399. }
  400. __eapi6_src_install ()
  401. {
  402. if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then
  403. emake DESTDIR="${D}" install;
  404. fi;
  405. einstalldocs
  406. }
  407. __eapi6_src_prepare ()
  408. {
  409. if [[ $(declare -p PATCHES 2>/dev/null) == "declare -a"* ]]; then
  410. [[ -n ${PATCHES[@]} ]] && eapply "${PATCHES[@]}";
  411. else
  412. if [[ -n ${PATCHES} ]]; then
  413. eapply ${PATCHES};
  414. fi;
  415. fi;
  416. eapply_user
  417. }
  418. _at_uses_autoheader ()
  419. {
  420. _at_uses_pkg A{C,M}_CONFIG_HEADER{S,}
  421. }
  422. _at_uses_automake ()
  423. {
  424. _at_uses_pkg AM_INIT_AUTOMAKE
  425. }
  426. _at_uses_gettext ()
  427. {
  428. _at_uses_pkg AM_GNU_GETTEXT_{,REQUIRE_}VERSION
  429. }
  430. _at_uses_glibgettext ()
  431. {
  432. _at_uses_pkg AM_GLIB_GNU_GETTEXT
  433. }
  434. _at_uses_gnomedoc ()
  435. {
  436. _at_uses_pkg GNOME_DOC_INIT
  437. }
  438. _at_uses_gtkdoc ()
  439. {
  440. _at_uses_pkg GTK_DOC_CHECK
  441. }
  442. _at_uses_intltool ()
  443. {
  444. _at_uses_pkg {AC,IT}_PROG_INTLTOOL
  445. }
  446. _at_uses_libltdl ()
  447. {
  448. _at_uses_pkg LT_CONFIG_LTDL_DIR
  449. }
  450. _at_uses_libtool ()
  451. {
  452. _at_uses_pkg A{C,M}_PROG_LIBTOOL LT_INIT
  453. }
  454. _at_uses_pkg ()
  455. {
  456. if [[ -n $(autotools_check_macro "$@") ]]; then
  457. return 0;
  458. else
  459. local macro args=();
  460. for macro in "$@";
  461. do
  462. args+=(-e "^[[:space:]]*${macro}\>");
  463. done;
  464. egrep -q "${args[@]}" configure.??;
  465. fi
  466. }
  467. _autotools_m4dir_include ()
  468. {
  469. local x include_opts flag;
  470. [[ ${WANT_AUTOCONF} == "2.1" ]] && flag="l" || flag="I";
  471. for x in "$@";
  472. do
  473. case ${x} in
  474. -${flag})
  475.  
  476. ;;
  477. *)
  478. [[ ! -d ${x} ]] && ewarn "autotools.eclass: '${x}' does not exist";
  479. include_opts+=" -${flag} ${x}"
  480. ;;
  481. esac;
  482. done;
  483. echo ${include_opts}
  484. }
  485. _clang_fullversion ()
  486. {
  487. local ver="$1";
  488. shift;
  489. set -- $($(tc-getCPP "$@") -E -P - <<<"__clang_major__ __clang_minor__ __clang_patchlevel__");
  490. eval echo "$ver"
  491. }
  492. _eapply_patch ()
  493. {
  494. local f=${1};
  495. local prefix=${2};
  496. started_applying=1;
  497. ebegin "${prefix:-Applying }${f##*/}";
  498. ${patch_cmd} -p1 -f -s -g0 --no-backup-if-mismatch "${patch_options[@]}" < "${f}";
  499. failed=${?};
  500. if ! eend "${failed}"; then
  501. __helpers_die "patch -p1 ${patch_options[*]} failed with ${f}";
  502. fi
  503. }
  504. _elibtoolize ()
  505. {
  506. local LIBTOOLIZE=${LIBTOOLIZE:-$(type -P glibtoolize > /dev/null && echo glibtoolize || echo libtoolize)};
  507. if [[ $1 == "--auto-ltdl" ]]; then
  508. shift;
  509. _at_uses_libltdl && set -- "$@" --ltdl;
  510. fi;
  511. [[ -f GNUmakefile.am || -f Makefile.am ]] && set -- "$@" --automake;
  512. autotools_run_tool ${LIBTOOLIZE} "$@"
  513. }
  514. _eutils_eprefix_init ()
  515. {
  516. has "${EAPI:-0}" 0 1 2 && : ${ED:=${D}} ${EPREFIX:=} ${EROOT:=${ROOT}}
  517. }
  518. _gcc-install-dir ()
  519. {
  520. echo "$(LC_ALL=C $(tc-getCC) -print-search-dirs 2> /dev/null | awk '$1=="install:" {print $2}')"
  521. }
  522. _gcc-specs-directive_raw ()
  523. {
  524. local cc=$(tc-getCC);
  525. local specfiles=$(LC_ALL=C ${cc} -v 2>&1 | awk '$1=="Reading" {print $NF}');
  526. ${cc} -dumpspecs 2> /dev/null | cat - ${specfiles} | awk -v directive=$1 'BEGIN { pspec=""; spec=""; outside=1 }
  527. $1=="*"directive":" { pspec=spec; spec=""; outside=0; next }
  528. outside || NF==0 || ( substr($1,1,1)=="*" && substr($1,length($1),1)==":" ) { outside=1; next }
  529. spec=="" && substr($0,1,1)=="+" { spec=pspec " " substr($0,2); next }
  530. { spec=spec $0 }
  531. END { print spec }';
  532. return 0
  533. }
  534. _gcc-specs-exists ()
  535. {
  536. [[ -f $(_gcc-install-dir)/$1 ]]
  537. }
  538. _gcc_fullversion ()
  539. {
  540. local ver="$1";
  541. shift;
  542. set -- $($(tc-getCPP "$@") -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__");
  543. eval echo "$ver"
  544. }
  545. _git-r3_env_setup ()
  546. {
  547. debug-print-function ${FUNCNAME} "$@";
  548. case "${EGIT_CLONE_TYPE}" in
  549. mirror | single+tags | single | shallow)
  550.  
  551. ;;
  552. *)
  553. die "Invalid EGIT_CLONE_TYPE=${EGIT_CLONE_TYPE}"
  554. ;;
  555. esac;
  556. case "${EGIT_MIN_CLONE_TYPE}" in
  557. shallow)
  558.  
  559. ;;
  560. single)
  561. if [[ ${EGIT_CLONE_TYPE} == shallow ]]; then
  562. einfo "git-r3: ebuild needs to be cloned in '\e[1msingle\e[22m' mode, adjusting";
  563. EGIT_CLONE_TYPE=single;
  564. fi
  565. ;;
  566. single+tags)
  567. if [[ ${EGIT_CLONE_TYPE} == shallow || ${EGIT_CLONE_TYPE} == single ]]; then
  568. einfo "git-r3: ebuild needs to be cloned in '\e[1msingle+tags\e[22m' mode, adjusting";
  569. EGIT_CLONE_TYPE=single+tags;
  570. fi
  571. ;;
  572. mirror)
  573. if [[ ${EGIT_CLONE_TYPE} != mirror ]]; then
  574. einfo "git-r3: ebuild needs to be cloned in '\e[1mmirror\e[22m' mode, adjusting";
  575. EGIT_CLONE_TYPE=mirror;
  576. fi
  577. ;;
  578. *)
  579. die "Invalid EGIT_MIN_CLONE_TYPE=${EGIT_MIN_CLONE_TYPE}"
  580. ;;
  581. esac;
  582. if [[ -n ${EGIT_SUBMODULES[@]+1} && $(declare -p EGIT_SUBMODULES) != "declare -a"* ]]; then
  583. die 'EGIT_SUBMODULES must be an array.';
  584. fi;
  585. local esc_pn livevar;
  586. esc_pn=${PN//[-+]/_};
  587. [[ ${esc_pn} == [0-9]* ]] && esc_pn=_${esc_pn};
  588. livevar=${esc_pn}_LIVE_REPO;
  589. EGIT_REPO_URI=${!livevar-${EGIT_REPO_URI}};
  590. [[ -n ${!livevar} ]] && ewarn "Using ${livevar}, no support will be provided";
  591. livevar=${esc_pn}_LIVE_BRANCH;
  592. EGIT_BRANCH=${!livevar-${EGIT_BRANCH}};
  593. [[ -n ${!livevar} ]] && ewarn "Using ${livevar}, no support will be provided";
  594. livevar=${esc_pn}_LIVE_COMMIT;
  595. EGIT_COMMIT=${!livevar-${EGIT_COMMIT}};
  596. [[ -n ${!livevar} ]] && ewarn "Using ${livevar}, no support will be provided";
  597. livevar=${esc_pn}_LIVE_COMMIT_DATE;
  598. EGIT_COMMIT_DATE=${!livevar-${EGIT_COMMIT_DATE}};
  599. [[ -n ${!livevar} ]] && ewarn "Using ${livevar}, no support will be provided";
  600. if [[ -n ${EGIT_COMMIT} && -n ${EGIT_COMMIT_DATE} ]]; then
  601. die "EGIT_COMMIT and EGIT_COMMIT_DATE can not be specified simultaneously";
  602. fi;
  603. if [[ -n ${EGIT_SOURCEDIR} ]]; then
  604. eerror "EGIT_SOURCEDIR has been replaced by EGIT_CHECKOUT_DIR. While updating";
  605. eerror "your ebuild, please check whether the variable is necessary at all";
  606. eerror "since the default has been changed from \${S} to \${WORKDIR}/\${P}.";
  607. eerror "Therefore, proper setting of S may be sufficient.";
  608. die "EGIT_SOURCEDIR has been replaced by EGIT_CHECKOUT_DIR.";
  609. fi;
  610. if [[ -n ${EGIT_MASTER} ]]; then
  611. eerror "EGIT_MASTER has been removed. Instead, the upstream default (HEAD)";
  612. eerror "is used by the eclass. Please remove the assignment or use EGIT_BRANCH";
  613. eerror "as necessary.";
  614. die "EGIT_MASTER has been removed.";
  615. fi;
  616. if [[ -n ${EGIT_HAS_SUBMODULES} ]]; then
  617. eerror "EGIT_HAS_SUBMODULES has been removed. The eclass no longer needs";
  618. eerror "to switch the clone type in order to support submodules and therefore";
  619. eerror "submodules are detected and fetched automatically. If you need to";
  620. eerror "disable or filter submodules, see EGIT_SUBMODULES.";
  621. die "EGIT_HAS_SUBMODULES is no longer necessary.";
  622. fi;
  623. if [[ -n ${EGIT_PROJECT} ]]; then
  624. eerror "EGIT_PROJECT has been removed. Instead, the eclass determines";
  625. eerror "the local clone path using path in canonical EGIT_REPO_URI.";
  626. eerror "If the current algorithm causes issues for you, please report a bug.";
  627. die "EGIT_PROJECT is no longer necessary.";
  628. fi;
  629. if [[ -n ${EGIT_BOOTSTRAP} ]]; then
  630. eerror "EGIT_BOOTSTRAP has been removed. Please create proper src_prepare()";
  631. eerror "instead.";
  632. die "EGIT_BOOTSTRAP has been removed.";
  633. fi;
  634. if [[ -n ${EGIT_NOUNPACK} ]]; then
  635. eerror "EGIT_NOUNPACK has been removed. The eclass no longer calls default";
  636. eerror "unpack function. If necessary, please declare proper src_unpack().";
  637. die "EGIT_NOUNPACK has been removed.";
  638. fi
  639. }
  640. _git-r3_is_local_repo ()
  641. {
  642. debug-print-function ${FUNCNAME} "$@";
  643. local uri=${1};
  644. [[ ${uri} == file://* || ${uri} == /* ]]
  645. }
  646. _git-r3_set_gitdir ()
  647. {
  648. debug-print-function ${FUNCNAME} "$@";
  649. local repo_name=${1#*://*/};
  650. repo_name=${repo_name%/};
  651. case "${repo_name}" in
  652. browse/*)
  653. repo_name=${repo_name#browse/}
  654. ;;
  655. cgit/*)
  656. repo_name=${repo_name#cgit/}
  657. ;;
  658. git/*)
  659. repo_name=${repo_name#git/}
  660. ;;
  661. gitroot/*)
  662. repo_name=${repo_name#gitroot/}
  663. ;;
  664. p/*)
  665. repo_name=${repo_name#p/}
  666. ;;
  667. pub/scm/*)
  668. repo_name=${repo_name#pub/scm/}
  669. ;;
  670. esac;
  671. repo_name=${repo_name%.git}.git;
  672. repo_name=${repo_name//\//_};
  673. local distdir=${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}};
  674. : ${EGIT3_STORE_DIR:=${distdir}/git3-src};
  675. GIT_DIR=${EGIT3_STORE_DIR}/${repo_name};
  676. if [[ ! -d ${EGIT3_STORE_DIR} && ! -n ${EVCS_OFFLINE} ]]; then
  677. ( addwrite /;
  678. mkdir -p "${EGIT3_STORE_DIR}" ) || die "Unable to create ${EGIT3_STORE_DIR}";
  679. fi;
  680. addwrite "${EGIT3_STORE_DIR}";
  681. if [[ ! -d ${GIT_DIR} ]]; then
  682. if [[ -n ${EVCS_OFFLINE} ]]; then
  683. eerror "A clone of the following repository is required to proceed:";
  684. eerror " ${1}";
  685. eerror "However, networking activity has been disabled using EVCS_OFFLINE and there";
  686. eerror "is no local clone available.";
  687. die "No local clone of ${1}. Unable to proceed with EVCS_OFFLINE.";
  688. fi;
  689. local saved_umask;
  690. if [[ -n ${EVCS_UMASK} ]]; then
  691. saved_umask=$(umask);
  692. umask "${EVCS_UMASK}" || die "Bad options to umask: ${EVCS_UMASK}";
  693. fi;
  694. mkdir "${GIT_DIR}" || die;
  695. git init --bare || die;
  696. if [[ -n ${saved_umask} ]]; then
  697. umask "${saved_umask}" || die;
  698. fi;
  699. fi
  700. }
  701. _git-r3_set_submodules ()
  702. {
  703. debug-print-function ${FUNCNAME} "$@";
  704. local data=${1};
  705. submodules=();
  706. local l;
  707. while read l; do
  708. [[ ${l} == submodule.*.url=* ]] || continue;
  709. l=${l#submodule.};
  710. local subname=${l%%.url=*};
  711. if declare -p EGIT_SUBMODULES &> /dev/null; then
  712. local p l_res res=;
  713. for p in "${EGIT_SUBMODULES[@]}";
  714. do
  715. if [[ ${p} == -* ]]; then
  716. p=${p#-};
  717. l_res=;
  718. else
  719. l_res=1;
  720. fi;
  721. [[ ${subname} == ${p} ]] && res=${l_res};
  722. done;
  723. if [[ ! -n ${res} ]]; then
  724. einfo "Skipping submodule \e[1m${subname}\e[22m";
  725. continue;
  726. fi;
  727. fi;
  728. local upd=$(echo "${data}" | git config -f /dev/fd/0 submodule."${subname}".update);
  729. [[ ${upd} == none ]] && continue;
  730. local enc_subname=${subname//[^a-zA-Z0-9-]/_};
  731. submodules+=("${enc_subname}" "$(echo "${data}" | git config -f /dev/fd/0 submodule."${subname}".url || die)" "$(echo "${data}" | git config -f /dev/fd/0 submodule."${subname}".path || die)");
  732. done < <(echo "${data}" | git config -f /dev/fd/0 -l || die)
  733. }
  734. _git-r3_set_subrepos ()
  735. {
  736. debug-print-function ${FUNCNAME} "$@";
  737. local suburl=${1};
  738. subrepos=("${@:2}");
  739. if [[ ${suburl} == ./* || ${suburl} == ../* ]]; then
  740. subrepos=("${subrepos[@]%%/}");
  741. while true; do
  742. if [[ ${suburl} == ./* ]]; then
  743. suburl=${suburl:2};
  744. else
  745. if [[ ${suburl} == ../* ]]; then
  746. suburl=${suburl:3};
  747. subrepos=("${subrepos[@]%/*}");
  748. subrepos=("${subrepos[@]%%/}");
  749. else
  750. break;
  751. fi;
  752. fi;
  753. done;
  754. subrepos=("${subrepos[@]/%//${suburl}}");
  755. else
  756. subrepos=("${suburl}");
  757. fi
  758. }
  759. _iconins ()
  760. {
  761. ( local funcname=$1;
  762. shift;
  763. local size dir;
  764. local context=apps;
  765. local theme=hicolor;
  766. while [[ $# -gt 0 ]]; do
  767. case $1 in
  768. -s | --size)
  769. if [[ ${2%%x*}x${2%%x*} == "$2" ]]; then
  770. size=${2%%x*};
  771. else
  772. size=${2};
  773. fi;
  774. case ${size} in
  775. 16 | 22 | 24 | 32 | 36 | 48 | 64 | 72 | 96 | 128 | 192 | 256 | 512)
  776. size=${size}x${size}
  777. ;;
  778. scalable)
  779.  
  780. ;;
  781. *)
  782. eerror "${size} is an unsupported icon size!";
  783. exit 1
  784. ;;
  785. esac;
  786. shift 2
  787. ;;
  788. -t | --theme)
  789. theme=${2};
  790. shift 2
  791. ;;
  792. -c | --context)
  793. context=${2};
  794. shift 2
  795. ;;
  796. *)
  797. if [[ -z ${size} ]]; then
  798. insinto /usr/share/pixmaps;
  799. else
  800. insinto /usr/share/icons/${theme}/${size}/${context};
  801. fi;
  802. if [[ ${funcname} == doicon ]]; then
  803. if [[ -f $1 ]]; then
  804. doins "${1}";
  805. else
  806. if [[ -d $1 ]]; then
  807. shopt -s nullglob;
  808. doins "${1}"/*.{png,svg};
  809. shopt -u nullglob;
  810. else
  811. eerror "${1} is not a valid file/directory!";
  812. exit 1;
  813. fi;
  814. fi;
  815. else
  816. break;
  817. fi;
  818. shift 1
  819. ;;
  820. esac;
  821. done;
  822. if [[ ${funcname} == newicon ]]; then
  823. newins "$@";
  824. fi ) || die
  825. }
  826. _meson_create_cross_file ()
  827. {
  828. local system=unknown;
  829. case ${CHOST} in
  830. *-aix*)
  831. system=aix
  832. ;;
  833. *-cygwin*)
  834. system=cygwin
  835. ;;
  836. *-darwin*)
  837. system=darwin
  838. ;;
  839. *-freebsd*)
  840. system=freebsd
  841. ;;
  842. *-linux*)
  843. system=linux
  844. ;;
  845. *-solaris*)
  846. system=sunos
  847. ;;
  848. esac;
  849. local cpu_family=$(tc-arch);
  850. case ${cpu_family} in
  851. amd64)
  852. cpu_family=x86_64
  853. ;;
  854. arm64)
  855. cpu_family=aarch64
  856. ;;
  857. esac;
  858. local cpu=${CHOST%%-*};
  859. cat > "${T}/meson.${CHOST}" <<-EOF
  860. [binaries]
  861. ar = '${AR}'
  862. c = '${CC}'
  863. cpp = '${CXX}'
  864. strip = '${STRIP}'
  865.  
  866. [host_machine]
  867. system = '${system}'
  868. cpu_family = '${cpu_family}'
  869. cpu = '${cpu}'
  870. endian = '$(tc-endian)'
  871. EOF
  872.  
  873. }
  874. _multijob_fork ()
  875. {
  876. [[ $# -eq 1 ]] || die "incorrect number of arguments";
  877. local ret=0;
  878. [[ $1 == "post" ]] && : $(( ++mj_num_jobs ));
  879. if [[ ${mj_num_jobs} -ge ${mj_max_jobs} ]]; then
  880. multijob_finish_one;
  881. ret=$?;
  882. fi;
  883. [[ $1 == "pre" ]] && : $(( ++mj_num_jobs ));
  884. return ${ret}
  885. }
  886. _pax_list_files ()
  887. {
  888. local f cmd;
  889. cmd=$1;
  890. shift;
  891. for f in "$@";
  892. do
  893. ${cmd} " ${f}";
  894. done
  895. }
  896. _python_check_dead_variables ()
  897. {
  898. local v;
  899. for v in PYTHON_DEPEND PYTHON_USE_WITH{,_OR,_OPT} {RESTRICT,SUPPORT}_PYTHON_ABIS;
  900. do
  901. if [[ -n ${!v} ]]; then
  902. die "${v} is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#Ebuild_head";
  903. fi;
  904. done;
  905. for v in PYTHON_{CPPFLAGS,CFLAGS,CXXFLAGS,LDFLAGS};
  906. do
  907. if [[ -n ${!v} ]]; then
  908. die "${v} is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#PYTHON_CFLAGS";
  909. fi;
  910. done;
  911. for v in PYTHON_TESTS_RESTRICTED_ABIS PYTHON_EXPORT_PHASE_FUNCTIONS PYTHON_VERSIONED_{SCRIPTS,EXECUTABLES} PYTHON_NONVERSIONED_EXECUTABLES;
  912. do
  913. if [[ -n ${!v} ]]; then
  914. die "${v} is invalid for python-r1 suite";
  915. fi;
  916. done;
  917. for v in DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES DISTUTILS_SETUP_FILES DISTUTILS_GLOBAL_OPTIONS DISTUTILS_SRC_TEST PYTHON_MODNAME;
  918. do
  919. if [[ -n ${!v} ]]; then
  920. die "${v} is invalid for distutils-r1, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#${v}";
  921. fi;
  922. done;
  923. if [[ -n ${DISTUTILS_DISABLE_TEST_DEPENDENCY} ]]; then
  924. die "${v} is invalid for distutils-r1, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#DISTUTILS_SRC_TEST";
  925. fi;
  926. for v in PYTHON_BDEPEND PYTHON_MULTIPLE_ABIS PYTHON_ABI_TYPE PYTHON_RESTRICTED_ABIS PYTHON_TESTS_FAILURES_TOLERANT_ABIS PYTHON_CFFI_MODULES_GENERATION_COMMANDS;
  927. do
  928. if [[ -n ${!v} ]]; then
  929. die "${v} is invalid for python-r1 suite";
  930. fi;
  931. done
  932. }
  933. _python_check_locale_sanity ()
  934. {
  935. local -x LC_ALL=${1};
  936. local IFS=;
  937. local lc=({a..z});
  938. local uc=({A..Z});
  939. local input="${lc[*]}${uc[*]}";
  940. local output=$(tr '[:lower:][:upper:]' '[:upper:][:lower:]' <<<"${input}");
  941. [[ ${output} == "${uc[*]}${lc[*]}" ]]
  942. }
  943. _python_impl_matches ()
  944. {
  945. [[ ${#} -ge 2 ]] || die "${FUNCNAME}: takes at least 2 parameters";
  946. local impl=${1} pattern;
  947. shift;
  948. for pattern in "$@";
  949. do
  950. if [[ ${pattern} == -2 ]]; then
  951. ! python_is_python3 "${impl}";
  952. return;
  953. else
  954. if [[ ${pattern} == -3 ]]; then
  955. python_is_python3 "${impl}";
  956. return;
  957. else
  958. if [[ ${impl/./_} == ${pattern/./_} ]]; then
  959. return 0;
  960. fi;
  961. fi;
  962. fi;
  963. done;
  964. return 1
  965. }
  966. _python_impl_supported ()
  967. {
  968. debug-print-function ${FUNCNAME} "${@}";
  969. [[ ${#} -eq 1 ]] || die "${FUNCNAME}: takes exactly 1 argument (impl).";
  970. local impl=${1};
  971. case "${impl}" in
  972. python2_7 | python3_[456] | jython2_7)
  973. return 0
  974. ;;
  975. pypy1_[89] | pypy2_0 | python2_[56] | python3_[123])
  976. return 1
  977. ;;
  978. pypy | pypy3)
  979. if [[ ${EAPI:-0} == [01234] ]]; then
  980. die "PyPy is supported in EAPI 5 and newer only.";
  981. fi
  982. ;;
  983. *)
  984. [[ -n ${PYTHON_COMPAT_NO_STRICT} ]] && return 1;
  985. die "Invalid implementation in PYTHON_COMPAT: ${impl}"
  986. ;;
  987. esac
  988. }
  989. _python_ln_rel ()
  990. {
  991. debug-print-function ${FUNCNAME} "${@}";
  992. local target=${1};
  993. local symname=${2};
  994. local tgpath=${target%/*}/;
  995. local sympath=${symname%/*}/;
  996. local rel_target=;
  997. while [[ -n ${sympath} ]]; do
  998. local tgseg= symseg=;
  999. while [[ ! -n ${tgseg} && -n ${tgpath} ]]; do
  1000. tgseg=${tgpath%%/*};
  1001. tgpath=${tgpath#${tgseg}/};
  1002. done;
  1003. while [[ ! -n ${symseg} && -n ${sympath} ]]; do
  1004. symseg=${sympath%%/*};
  1005. sympath=${sympath#${symseg}/};
  1006. done;
  1007. if [[ ${tgseg} != ${symseg} ]]; then
  1008. rel_target=../${rel_target}${tgseg:+${tgseg}/};
  1009. fi;
  1010. done;
  1011. rel_target+=${tgpath}${target##*/};
  1012. debug-print "${FUNCNAME}: ${symname} -> ${target}";
  1013. debug-print "${FUNCNAME}: rel_target = ${rel_target}";
  1014. ln -fs "${rel_target}" "${symname}"
  1015. }
  1016. _python_multibuild_wrapper ()
  1017. {
  1018. debug-print-function ${FUNCNAME} "${@}";
  1019. local -x EPYTHON PYTHON;
  1020. local -x PATH=${PATH} PKG_CONFIG_PATH=${PKG_CONFIG_PATH};
  1021. python_export "${MULTIBUILD_VARIANT}" EPYTHON PYTHON;
  1022. python_wrapper_setup;
  1023. "${@}"
  1024. }
  1025. _python_obtain_impls ()
  1026. {
  1027. _python_validate_useflags;
  1028. if [[ -n ${PYTHON_COMPAT_OVERRIDE} ]]; then
  1029. MULTIBUILD_VARIANTS=(${PYTHON_COMPAT_OVERRIDE});
  1030. return;
  1031. fi;
  1032. MULTIBUILD_VARIANTS=();
  1033. local impl;
  1034. for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}";
  1035. do
  1036. has "${impl}" "${PYTHON_COMPAT[@]}" && use "python_targets_${impl}" && MULTIBUILD_VARIANTS+=("${impl}");
  1037. done
  1038. }
  1039. _python_set_impls ()
  1040. {
  1041. local i;
  1042. if ! declare -p PYTHON_COMPAT &> /dev/null; then
  1043. die 'PYTHON_COMPAT not declared.';
  1044. fi;
  1045. if [[ $(declare -p PYTHON_COMPAT) != "declare -a"* ]]; then
  1046. die 'PYTHON_COMPAT must be an array.';
  1047. fi;
  1048. for i in "${PYTHON_COMPAT[@]}";
  1049. do
  1050. _python_impl_supported "${i}";
  1051. done;
  1052. local supp=() unsupp=();
  1053. for i in "${_PYTHON_ALL_IMPLS[@]}";
  1054. do
  1055. if has "${i}" "${PYTHON_COMPAT[@]}"; then
  1056. supp+=("${i}");
  1057. else
  1058. unsupp+=("${i}");
  1059. fi;
  1060. done;
  1061. if [[ ! -n ${supp[@]} ]]; then
  1062. die "No supported implementation in PYTHON_COMPAT.";
  1063. fi;
  1064. if [[ -n ${_PYTHON_SUPPORTED_IMPLS[@]} ]]; then
  1065. if [[ ${_PYTHON_SUPPORTED_IMPLS[@]} != ${supp[@]} ]]; then
  1066. eerror "Supported impls (PYTHON_COMPAT) changed between inherits!";
  1067. eerror "Before: ${_PYTHON_SUPPORTED_IMPLS[*]}";
  1068. eerror "Now : ${supp[*]}";
  1069. die "_PYTHON_SUPPORTED_IMPLS integrity check failed";
  1070. fi;
  1071. if [[ ${_PYTHON_UNSUPPORTED_IMPLS[@]} != ${unsupp[@]} ]]; then
  1072. eerror "Unsupported impls changed between inherits!";
  1073. eerror "Before: ${_PYTHON_UNSUPPORTED_IMPLS[*]}";
  1074. eerror "Now : ${unsupp[*]}";
  1075. die "_PYTHON_UNSUPPORTED_IMPLS integrity check failed";
  1076. fi;
  1077. else
  1078. _PYTHON_SUPPORTED_IMPLS=("${supp[@]}");
  1079. _PYTHON_UNSUPPORTED_IMPLS=("${unsupp[@]}");
  1080. readonly _PYTHON_SUPPORTED_IMPLS _PYTHON_UNSUPPORTED_IMPLS;
  1081. fi
  1082. }
  1083. _python_validate_useflags ()
  1084. {
  1085. debug-print-function ${FUNCNAME} "${@}";
  1086. if [[ -n ${PYTHON_COMPAT_OVERRIDE} ]]; then
  1087. if [[ ! -n ${_PYTHON_COMPAT_OVERRIDE_WARNED} ]]; then
  1088. ewarn "WARNING: PYTHON_COMPAT_OVERRIDE in effect. The following Python";
  1089. ewarn "implementations will be enabled:";
  1090. ewarn;
  1091. ewarn " ${PYTHON_COMPAT_OVERRIDE}";
  1092. ewarn;
  1093. ewarn "Dependencies won't be satisfied, and PYTHON_TARGETS will be ignored.";
  1094. _PYTHON_COMPAT_OVERRIDE_WARNED=1;
  1095. fi;
  1096. return;
  1097. fi;
  1098. local i;
  1099. for i in "${_PYTHON_SUPPORTED_IMPLS[@]}";
  1100. do
  1101. use "python_targets_${i}" && return 0;
  1102. done;
  1103. eerror "No Python implementation selected for the build. Please add one";
  1104. eerror "of the following values to your PYTHON_TARGETS (in make.conf):";
  1105. eerror;
  1106. eerror "${PYTHON_COMPAT[@]}";
  1107. echo;
  1108. die "No supported Python implementation in PYTHON_TARGETS."
  1109. }
  1110. _systemd_get_dir ()
  1111. {
  1112. [[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} <variable-name> <fallback-directory>";
  1113. local variable=${1} fallback=${2} d;
  1114. if $(tc-getPKG_CONFIG) --exists systemd; then
  1115. d=$($(tc-getPKG_CONFIG) --variable="${variable}" systemd) || die;
  1116. else
  1117. d=${fallback};
  1118. fi;
  1119. echo "${d}"
  1120. }
  1121. _systemd_get_systemunitdir ()
  1122. {
  1123. _systemd_get_dir systemdsystemunitdir /usr/lib/systemd/system
  1124. }
  1125. _systemd_get_userunitdir ()
  1126. {
  1127. _systemd_get_dir systemduserunitdir /usr/lib/systemd/user
  1128. }
  1129. _systemd_get_utildir ()
  1130. {
  1131. _systemd_get_dir systemdutildir /usr/lib/systemd
  1132. }
  1133. _tc-getPROG ()
  1134. {
  1135. local tuple=$1;
  1136. local v var vars=$2;
  1137. local prog=($3);
  1138. var=${vars%% *};
  1139. for v in ${vars};
  1140. do
  1141. if [[ -n ${!v} ]]; then
  1142. export ${var}="${!v}";
  1143. echo "${!v}";
  1144. return 0;
  1145. fi;
  1146. done;
  1147. local search=;
  1148. [[ -n $4 ]] && search=$(type -p $4-${prog[0]});
  1149. [[ -z ${search} && -n ${!tuple} ]] && search=$(type -p ${!tuple}-${prog[0]});
  1150. [[ -n ${search} ]] && prog[0]=${search##*/};
  1151. export ${var}="${prog[*]}";
  1152. echo "${!var}"
  1153. }
  1154. autotools_check_macro ()
  1155. {
  1156. [[ -f configure.ac || -f configure.in ]] || return 0;
  1157. local trace_file=".__autoconf_trace_data";
  1158. if [[ ! -e ${trace_file} ]] || [[ ! aclocal.m4 -ot ${trace_file} ]]; then
  1159. WANT_AUTOCONF="2.5" autoconf $(autotools_m4dir_include) ${ALL_AUTOTOOLS_MACROS[@]/#/--trace=} > ${trace_file} 2> /dev/null;
  1160. fi;
  1161. local macro args=();
  1162. for macro in "$@";
  1163. do
  1164. has ${macro} ${ALL_AUTOTOOLS_MACROS[@]} || die "internal error: add ${macro} to ALL_AUTOTOOLS_MACROS";
  1165. args+=(-e ":${macro}:");
  1166. done;
  1167. grep "${args[@]}" ${trace_file}
  1168. }
  1169. autotools_check_macro_val ()
  1170. {
  1171. local macro scan_out;
  1172. for macro in "$@";
  1173. do
  1174. autotools_check_macro "${macro}" | gawk -v macro="${macro}" '($0 !~ /^[[:space:]]*(#|dnl)/) {
  1175. if (match($0, macro ":(.*)$", res))
  1176. print res[1]
  1177. }' | uniq;
  1178. done;
  1179. return 0
  1180. }
  1181. autotools_env_setup ()
  1182. {
  1183. if [[ ${WANT_AUTOMAKE} == "latest" ]]; then
  1184. local pv;
  1185. for pv in ${_LATEST_AUTOMAKE[@]/#*:};
  1186. do
  1187. ROOT=/ has_version "=sys-devel/automake-${pv}*" && export WANT_AUTOMAKE="${pv}";
  1188. done;
  1189. [[ ${WANT_AUTOMAKE} == "latest" ]] && die "Cannot find the latest automake! Tried ${_LATEST_AUTOMAKE[*]}";
  1190. fi;
  1191. [[ ${WANT_AUTOCONF} == "latest" ]] && export WANT_AUTOCONF=2.5
  1192. }
  1193. autotools_m4dir_include ()
  1194. {
  1195. _autotools_m4dir_include ${AT_M4DIR}
  1196. }
  1197. autotools_m4sysdir_include ()
  1198. {
  1199. local paths=($(eval echo ${AT_SYS_M4DIR}));
  1200. if [[ ${#paths[@]} -eq 0 && -n ${SYSROOT} ]]; then
  1201. local path="${SYSROOT}/usr/share/aclocal";
  1202. [[ -d ${path} ]] && paths+=("${path}");
  1203. fi;
  1204. _autotools_m4dir_include "${paths[@]}"
  1205. }
  1206. autotools_run_tool ()
  1207. {
  1208. local autofail=true m4flags=false missing_ok=false return_output=false;
  1209. while [[ -n $1 ]]; do
  1210. case $1 in
  1211. --at-no-fail)
  1212. autofail=false
  1213. ;;
  1214. --at-m4flags)
  1215. m4flags=true
  1216. ;;
  1217. --at-missing)
  1218. missing_ok=true
  1219. ;;
  1220. --at-output)
  1221. return_output=true
  1222. ;;
  1223. *)
  1224. break
  1225. ;;
  1226. esac;
  1227. shift;
  1228. done;
  1229. if [[ ${EBUILD_PHASE} != "unpack" && ${EBUILD_PHASE} != "prepare" ]]; then
  1230. ewarn "QA Warning: running $1 in ${EBUILD_PHASE} phase";
  1231. fi;
  1232. if ${missing_ok} && ! type -P ${1} > /dev/null; then
  1233. einfo "Skipping '$*' due $1 not installed";
  1234. return 0;
  1235. fi;
  1236. autotools_env_setup;
  1237. local STDERR_TARGET="${T}/${1##*/}.out";
  1238. if [[ -e ${STDERR_TARGET} ]]; then
  1239. local i=1;
  1240. while :; do
  1241. STDERR_TARGET="${T}/${1##*/}-${i}.out";
  1242. [[ -e ${STDERR_TARGET} ]] || break;
  1243. : $(( i++ ));
  1244. done;
  1245. fi;
  1246. if ${m4flags}; then
  1247. set -- "${1}" $(autotools_m4dir_include) "${@:2}" $(autotools_m4sysdir_include);
  1248. fi;
  1249. if ${return_output}; then
  1250. "$@";
  1251. return;
  1252. fi;
  1253. printf "***** $1 *****\n***** PWD: ${PWD}\n***** $*\n\n" > "${STDERR_TARGET}";
  1254. ebegin "Running $@";
  1255. "$@" >> "${STDERR_TARGET}" 2>&1;
  1256. if ! eend $? && ${autofail}; then
  1257. echo;
  1258. eerror "Failed Running $1 !";
  1259. eerror;
  1260. eerror "Include in your bugreport the contents of:";
  1261. eerror;
  1262. eerror " ${STDERR_TARGET}";
  1263. echo;
  1264. die "Failed Running $1 !";
  1265. fi
  1266. }
  1267. bashpid ()
  1268. {
  1269. sh -c 'echo ${PPID}'
  1270. }
  1271. built_with_use ()
  1272. {
  1273. _eutils_eprefix_init;
  1274. local hidden="no";
  1275. if [[ $1 == "--hidden" ]]; then
  1276. hidden="yes";
  1277. shift;
  1278. fi;
  1279. local missing_action="die";
  1280. if [[ $1 == "--missing" ]]; then
  1281. missing_action=$2;
  1282. shift;
  1283. shift;
  1284. case ${missing_action} in
  1285. true | false | die)
  1286.  
  1287. ;;
  1288. *)
  1289. die "unknown action '${missing_action}'"
  1290. ;;
  1291. esac;
  1292. fi;
  1293. local opt=$1;
  1294. [[ ${opt:0:1} = "-" ]] && shift || opt="-a";
  1295. local PKG=$(best_version $1);
  1296. [[ -z ${PKG} ]] && die "Unable to resolve $1 to an installed package";
  1297. shift;
  1298. local USEFILE=${EROOT}/var/db/pkg/${PKG}/USE;
  1299. local IUSEFILE=${EROOT}/var/db/pkg/${PKG}/IUSE;
  1300. if [[ ! -e ${USEFILE} ]] || [[ ! -e ${IUSEFILE} && ${hidden} == "no" ]]; then
  1301. case ${missing_action} in
  1302. true)
  1303. return 0
  1304. ;;
  1305. false)
  1306. return 1
  1307. ;;
  1308. die)
  1309. die "Unable to determine what USE flags $PKG was built with"
  1310. ;;
  1311. esac;
  1312. fi;
  1313. if [[ ${hidden} == "no" ]]; then
  1314. local IUSE_BUILT=($(<"${IUSEFILE}"));
  1315. local expand;
  1316. for expand in $(echo ${USE_EXPAND} | tr '[:upper:]' '[:lower:]');
  1317. do
  1318. if [[ $1 == ${expand}_* ]]; then
  1319. expand="";
  1320. break;
  1321. fi;
  1322. done;
  1323. if [[ -n ${expand} ]]; then
  1324. if ! has $1 ${IUSE_BUILT[@]#[-+]}; then
  1325. case ${missing_action} in
  1326. true)
  1327. return 0
  1328. ;;
  1329. false)
  1330. return 1
  1331. ;;
  1332. die)
  1333. die "$PKG does not actually support the $1 USE flag!"
  1334. ;;
  1335. esac;
  1336. fi;
  1337. fi;
  1338. fi;
  1339. local USE_BUILT=$(<${USEFILE});
  1340. while [[ $# -gt 0 ]]; do
  1341. if [[ ${opt} = "-o" ]]; then
  1342. has $1 ${USE_BUILT} && return 0;
  1343. else
  1344. has $1 ${USE_BUILT} || return 1;
  1345. fi;
  1346. shift;
  1347. done;
  1348. [[ ${opt} = "-a" ]]
  1349. }
  1350. check_license ()
  1351. {
  1352. die "you no longer need this as portage supports ACCEPT_LICENSE itself"
  1353. }
  1354. clang-fullversion ()
  1355. {
  1356. _clang_fullversion '$1.$2.$3' "$@"
  1357. }
  1358. clang-major-version ()
  1359. {
  1360. _clang_fullversion '$1' "$@"
  1361. }
  1362. clang-micro-version ()
  1363. {
  1364. _clang_fullversion '$3' "$@"
  1365. }
  1366. clang-minor-version ()
  1367. {
  1368. _clang_fullversion '$2' "$@"
  1369. }
  1370. clang-version ()
  1371. {
  1372. _clang_fullversion '$1.$2' "$@"
  1373. }
  1374. config_rpath_update ()
  1375. {
  1376. local dst src=$(type -P gettext | sed 's:bin/gettext:share/gettext/config.rpath:');
  1377. [[ $# -eq 0 ]] && set -- $(find -name config.rpath);
  1378. [[ $# -eq 0 ]] && return 0;
  1379. einfo "Updating all config.rpath files";
  1380. for dst in "$@";
  1381. do
  1382. einfo " ${dst}";
  1383. cp "${src}" "${dst}" || die;
  1384. done
  1385. }
  1386. darwintoolize ()
  1387. {
  1388. die "Use elibtoolize"
  1389. }
  1390. delete_all_version_separators ()
  1391. {
  1392. replace_all_version_separators "" "${1}"
  1393. }
  1394. delete_version_separator ()
  1395. {
  1396. replace_version_separator "${1}" "" "${2}"
  1397. }
  1398. doicon ()
  1399. {
  1400. _iconins ${FUNCNAME} "$@"
  1401. }
  1402. domenu ()
  1403. {
  1404. ( local i j ret=0;
  1405. insinto /usr/share/applications;
  1406. for i in "$@";
  1407. do
  1408. if [[ -f ${i} ]]; then
  1409. doins "${i}";
  1410. ((ret+=$?));
  1411. else
  1412. if [[ -d ${i} ]]; then
  1413. for j in "${i}"/*.desktop;
  1414. do
  1415. doins "${j}";
  1416. ((ret+=$?));
  1417. done;
  1418. else
  1419. ((++ret));
  1420. fi;
  1421. fi;
  1422. done;
  1423. exit ${ret} )
  1424. }
  1425. eaclocal ()
  1426. {
  1427. [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && autotools_run_tool --at-m4flags aclocal "$@" $(eaclocal_amflags)
  1428. }
  1429. eaclocal_amflags ()
  1430. {
  1431. local aclocal_opts amflags_file;
  1432. for amflags_file in GNUmakefile.am Makefile.am GNUmakefile.in Makefile.in;
  1433. do
  1434. [[ -e ${amflags_file} ]] || continue;
  1435. autotools_env_setup;
  1436. aclocal_opts=$(sed -n "/^ACLOCAL_AMFLAGS[[:space:]]*=/{ # match the first line
  1437. s:[^=]*=::p; # then gobble up all escaped lines
  1438. : nextline /\\\\$/{ n; p; b nextline; } }" ${amflags_file});
  1439. eval aclocal_opts=\""${aclocal_opts}"\";
  1440. break;
  1441. done;
  1442. echo ${aclocal_opts}
  1443. }
  1444. eapply ()
  1445. {
  1446. local failed patch_cmd=patch;
  1447. local -x LC_COLLATE=POSIX;
  1448. type -P gpatch > /dev/null && patch_cmd=gpatch;
  1449. function _eapply_patch ()
  1450. {
  1451. local f=${1};
  1452. local prefix=${2};
  1453. started_applying=1;
  1454. ebegin "${prefix:-Applying }${f##*/}";
  1455. ${patch_cmd} -p1 -f -s -g0 --no-backup-if-mismatch "${patch_options[@]}" < "${f}";
  1456. failed=${?};
  1457. if ! eend "${failed}"; then
  1458. __helpers_die "patch -p1 ${patch_options[*]} failed with ${f}";
  1459. fi
  1460. };
  1461. local patch_options=() files=();
  1462. local i found_doublehyphen;
  1463. for ((i = 1; i <= ${#@}; ++i ))
  1464. do
  1465. if [[ ${@:i:1} == -- ]]; then
  1466. patch_options=("${@:1:i-1}");
  1467. files=("${@:i+1}");
  1468. found_doublehyphen=1;
  1469. break;
  1470. fi;
  1471. done;
  1472. if [[ -z ${found_doublehyphen} ]]; then
  1473. for ((i = 1; i <= ${#@}; ++i ))
  1474. do
  1475. if [[ ${@:i:1} != -* ]]; then
  1476. patch_options=("${@:1:i-1}");
  1477. files=("${@:i}");
  1478. break;
  1479. fi;
  1480. done;
  1481. for i in "${files[@]}";
  1482. do
  1483. if [[ ${i} == -* ]]; then
  1484. die "eapply: all options must be passed before non-options";
  1485. fi;
  1486. done;
  1487. fi;
  1488. if [[ -z ${files[@]} ]]; then
  1489. die "eapply: no files specified";
  1490. fi;
  1491. local f;
  1492. for f in "${files[@]}";
  1493. do
  1494. if [[ -d ${f} ]]; then
  1495. function _eapply_get_files ()
  1496. {
  1497. local LC_ALL=POSIX;
  1498. local prev_shopt=$(shopt -p nullglob);
  1499. shopt -s nullglob;
  1500. local f;
  1501. for f in "${1}"/*;
  1502. do
  1503. if [[ ${f} == *.diff || ${f} == *.patch ]]; then
  1504. files+=("${f}");
  1505. fi;
  1506. done;
  1507. ${prev_shopt}
  1508. };
  1509. local files=();
  1510. _eapply_get_files "${f}";
  1511. [[ -z ${files[@]} ]] && die "No *.{patch,diff} files in directory ${f}";
  1512. einfo "Applying patches from ${f} ...";
  1513. local f2;
  1514. for f2 in "${files[@]}";
  1515. do
  1516. _eapply_patch "${f2}" ' ';
  1517. [[ ${failed} -ne 0 ]] && return "${failed}";
  1518. done;
  1519. else
  1520. _eapply_patch "${f}";
  1521. [[ ${failed} -ne 0 ]] && return "${failed}";
  1522. fi;
  1523. done;
  1524. return 0
  1525. }
  1526. eapply_user ()
  1527. {
  1528. [[ ${EBUILD_PHASE} == prepare ]] || die "eapply_user() called during invalid phase: ${EBUILD_PHASE}";
  1529. local tagfile=${T}/.portage_user_patches_applied;
  1530. [[ -f ${tagfile} ]] && return;
  1531. >> "${tagfile}";
  1532. local basedir=${PORTAGE_CONFIGROOT%/}/etc/portage/patches;
  1533. local applied d f;
  1534. local -A _eapply_user_patches;
  1535. local prev_shopt=$(shopt -p nullglob);
  1536. shopt -s nullglob;
  1537. for d in "${basedir}"/${CATEGORY}/{${P}-${PR},${P},${PN}}{:${SLOT%/*},};
  1538. do
  1539. for f in "${d}"/*;
  1540. do
  1541. if [[ ( ${f} == *.diff || ${f} == *.patch ) && -z ${_eapply_user_patches[${f##*/}]} ]]; then
  1542. _eapply_user_patches[${f##*/}]=${f};
  1543. fi;
  1544. done;
  1545. done;
  1546. if [[ ${#_eapply_user_patches[@]} -gt 0 ]]; then
  1547. while read -r -d '' f; do
  1548. f=${_eapply_user_patches[${f}]};
  1549. if [[ -s ${f} ]]; then
  1550. eapply "${f}";
  1551. applied=1;
  1552. fi;
  1553. done < <(printf -- '%s\0' "${!_eapply_user_patches[@]}" |
  1554. LC_ALL=C sort -z);
  1555. fi;
  1556. ${prev_shopt};
  1557. [[ -n ${applied} ]] && ewarn "User patches applied."
  1558. }
  1559. eautoconf ()
  1560. {
  1561. if [[ ! -f configure.ac && ! -f configure.in ]]; then
  1562. echo;
  1563. eerror "No configure.{ac,in} present in '${PWD}'!";
  1564. echo;
  1565. die "No configure.{ac,in} present!";
  1566. fi;
  1567. if [[ ${WANT_AUTOCONF} != "2.1" && -e configure.in ]]; then
  1568. eqawarn "This package has a configure.in file which has long been deprecated. Please";
  1569. eqawarn "update it to use configure.ac instead as newer versions of autotools will die";
  1570. eqawarn "when it finds this file. See https://bugs.gentoo.org/426262 for details.";
  1571. fi;
  1572. autotools_run_tool --at-m4flags autoconf "$@"
  1573. }
  1574. eautoheader ()
  1575. {
  1576. _at_uses_autoheader || return 0;
  1577. autotools_run_tool --at-no-fail --at-m4flags autoheader "$@"
  1578. }
  1579. eautomake ()
  1580. {
  1581. local extra_opts=();
  1582. local makefile_name;
  1583. for makefile_name in {GNUmakefile,{M,m}akefile}.am "";
  1584. do
  1585. [[ -f ${makefile_name} ]] && break;
  1586. done;
  1587. function _automake_version ()
  1588. {
  1589. autotools_run_tool --at-output automake --version 2> /dev/null | sed -n -e '1{s:.*(GNU automake) ::p;q}'
  1590. };
  1591. if [[ -z ${makefile_name} ]]; then
  1592. _at_uses_automake || return 0;
  1593. else
  1594. if [[ -z ${FROM_EAUTORECONF} && -f ${makefile_name%.am}.in ]]; then
  1595. local used_automake;
  1596. local installed_automake;
  1597. installed_automake=$(WANT_AUTOMAKE= _automake_version);
  1598. used_automake=$(head -n 1 < ${makefile_name%.am}.in | sed -e 's:.*by automake \(.*\) from .*:\1:');
  1599. if [[ ${installed_automake} != ${used_automake} ]]; then
  1600. ewarn "Automake used for the package (${used_automake}) differs from" "the installed version (${installed_automake}).";
  1601. ewarn "Forcing a full rebuild of the autotools to workaround.";
  1602. eautoreconf;
  1603. return 0;
  1604. fi;
  1605. fi;
  1606. fi;
  1607. [[ -f INSTALL && -f AUTHORS && -f ChangeLog && -f NEWS && -f README ]] || extra_opts+=(--foreign);
  1608. case $(_automake_version) in
  1609. 1.4 | 1.4[.-]*)
  1610.  
  1611. ;;
  1612. *)
  1613. extra_opts+=(--force-missing)
  1614. ;;
  1615. esac;
  1616. autotools_run_tool automake --add-missing --copy "${extra_opts[@]}" "$@"
  1617. }
  1618. eautopoint ()
  1619. {
  1620. autotools_run_tool autopoint "$@"
  1621. }
  1622. eautoreconf ()
  1623. {
  1624. local x g;
  1625. if [[ -z ${AT_NO_RECURSIVE} ]]; then
  1626. for x in $(autotools_check_macro_val AC_CONFIG_SUBDIRS);
  1627. do
  1628. if [[ -d ${x} ]]; then
  1629. pushd "${x}" > /dev/null;
  1630. AT_NOELIBTOOLIZE="yes" eautoreconf || die;
  1631. popd > /dev/null;
  1632. fi;
  1633. done;
  1634. fi;
  1635. einfo "Running eautoreconf in '${PWD}' ...";
  1636. local m4dirs=$(autotools_check_macro_val AC_CONFIG_{AUX,MACRO}_DIR);
  1637. [[ -n ${m4dirs} ]] && mkdir -p ${m4dirs};
  1638. local i tools=(glibgettext false "autotools_run_tool glib-gettextize --copy --force" gettext false "autotools_run_tool --at-missing autopoint --force" intltool false "autotools_run_tool intltoolize --automake --copy --force" gtkdoc false "autotools_run_tool --at-missing gtkdocize --copy" gnomedoc false "autotools_run_tool --at-missing gnome-doc-prepare --copy --force" libtool false "_elibtoolize --auto-ltdl --install --copy --force");
  1639. for ((i = 0; i < ${#tools[@]}; i += 3 ))
  1640. do
  1641. if _at_uses_${tools[i]}; then
  1642. tools[i+1]=true;
  1643. ${tools[i+2]};
  1644. fi;
  1645. done;
  1646. local rerun_aclocal=false;
  1647. eaclocal;
  1648. for ((i = 0; i < ${#tools[@]}; i += 3 ))
  1649. do
  1650. if ! ${tools[i+1]} && _at_uses_${tools[i]}; then
  1651. ${tools[i+2]};
  1652. rerun_aclocal=true;
  1653. fi;
  1654. done;
  1655. ${rerun_aclocal} && eaclocal;
  1656. if [[ ${WANT_AUTOCONF} = 2.1 ]]; then
  1657. eautoconf;
  1658. else
  1659. eautoconf --force;
  1660. fi;
  1661. eautoheader;
  1662. [[ ${AT_NOEAUTOMAKE} != "yes" ]] && FROM_EAUTORECONF="yes" eautomake ${AM_OPTS};
  1663. if [[ ${AT_NOELIBTOOLIZE} != "yes" ]]; then
  1664. elibtoolize --force "${PWD}";
  1665. fi;
  1666. return 0
  1667. }
  1668. ebeep ()
  1669. {
  1670. ewarn "QA Notice: ebeep is not defined in EAPI=${EAPI}, please file a bug at https://bugs.gentoo.org"
  1671. }
  1672. econf_build ()
  1673. {
  1674. local CBUILD=${CBUILD:-${CHOST}};
  1675. tc-env_build econf --build=${CBUILD} --host=${CBUILD} "$@"
  1676. }
  1677. ecvs_clean ()
  1678. {
  1679. [[ $# -eq 0 ]] && set -- .;
  1680. find "$@" -type d -name 'CVS' -prune -print0 | xargs -0 rm -rf;
  1681. find "$@" -type f -name '.cvs*' -print0 | xargs -0 rm -rf
  1682. }
  1683. edos2unix ()
  1684. {
  1685. [[ $# -eq 0 ]] && return 0;
  1686. sed -i 's/\r$//' -- "$@" || die
  1687. }
  1688. egit_clean ()
  1689. {
  1690. [[ $# -eq 0 ]] && set -- .;
  1691. find "$@" -type d -name '.git*' -prune -print0 | xargs -0 rm -rf
  1692. }
  1693. einstalldocs ()
  1694. {
  1695. ( if ! declare -p DOCS &> /dev/null; then
  1696. local d;
  1697. for d in README* ChangeLog AUTHORS NEWS TODO CHANGES THANKS BUGS FAQ CREDITS CHANGELOG;
  1698. do
  1699. [[ -f ${d} && -s ${d} ]] && docinto / && dodoc "${d}";
  1700. done;
  1701. else
  1702. if [[ $(declare -p DOCS) == "declare -a"* ]]; then
  1703. [[ -n ${DOCS[@]} ]] && docinto / && dodoc -r "${DOCS[@]}";
  1704. else
  1705. [[ -n ${DOCS} ]] && docinto / && dodoc -r ${DOCS};
  1706. fi;
  1707. fi );
  1708. ( if [[ $(declare -p HTML_DOCS 2>/dev/null) == "declare -a"* ]]; then
  1709. [[ -n ${HTML_DOCS[@]} ]] && docinto html && dodoc -r "${HTML_DOCS[@]}";
  1710. else
  1711. [[ -n ${HTML_DOCS} ]] && docinto html && dodoc -r ${HTML_DOCS};
  1712. fi )
  1713. }
  1714. elibtoolize ()
  1715. {
  1716. type -P eltpatch &> /dev/null || die "eltpatch not found; is app-portage/elt-patches installed?";
  1717. ELT_LOGDIR=${T} LD=$(tc-getLD) eltpatch "${@}" || die "eltpatch failed"
  1718. }
  1719. emktemp ()
  1720. {
  1721. local exe="touch";
  1722. [[ $1 == -d ]] && exe="mkdir" && shift;
  1723. local topdir=$1;
  1724. if [[ -z ${topdir} ]]; then
  1725. [[ -z ${T} ]] && topdir="/tmp" || topdir=${T};
  1726. fi;
  1727. if ! type -P mktemp > /dev/null; then
  1728. local tmp=/;
  1729. while [[ -e ${tmp} ]]; do
  1730. tmp=${topdir}/tmp.${RANDOM}.${RANDOM}.${RANDOM};
  1731. done;
  1732. ${exe} "${tmp}" || ${exe} -p "${tmp}";
  1733. echo "${tmp}";
  1734. else
  1735. if [[ ${exe} == "touch" ]]; then
  1736. TMPDIR="${topdir}" mktemp -t tmp.XXXXXXXXXX;
  1737. else
  1738. TMPDIR="${topdir}" mktemp -dt tmp.XXXXXXXXXX;
  1739. fi;
  1740. fi
  1741. }
  1742. eninja ()
  1743. {
  1744. local nonfatal_args=();
  1745. [[ ${EAPI:-0} != [245] ]] && nonfatal_args+=(-n);
  1746. if [[ -z ${NINJAOPTS+set} ]]; then
  1747. NINJAOPTS="-j$(makeopts_jobs) -l$(makeopts_loadavg "${MAKEOPTS}" 0)";
  1748. fi;
  1749. set -- ninja -v ${NINJAOPTS} "$@";
  1750. echo "$@" 1>&2;
  1751. "$@" || die "${nonfatal_args[@]}" "${*} failed"
  1752. }
  1753. epatch ()
  1754. {
  1755. function _epatch_draw_line ()
  1756. {
  1757. [[ -z $1 ]] && set "$(printf "%65s" '')";
  1758. echo "${1//?/=}"
  1759. };
  1760. unset P4CONFIG P4PORT P4USER;
  1761. local EPATCH_OPTS=(${EPATCH_OPTS[*]});
  1762. while [[ $# -gt 0 ]]; do
  1763. case $1 in
  1764. -*)
  1765. EPATCH_OPTS+=("$1")
  1766. ;;
  1767. *)
  1768. break
  1769. ;;
  1770. esac;
  1771. shift;
  1772. done;
  1773. if [[ $# -gt 1 ]]; then
  1774. local m;
  1775. for m in "$@";
  1776. do
  1777. epatch "${m}";
  1778. done;
  1779. return 0;
  1780. fi;
  1781. local SINGLE_PATCH="no";
  1782. [[ $# -eq 0 ]] && set -- "${EPATCH_SOURCE}";
  1783. if [[ -f $1 ]]; then
  1784. SINGLE_PATCH="yes";
  1785. set -- "$1";
  1786. local EPATCH_SUFFIX=$1;
  1787. else
  1788. if [[ -d $1 ]]; then
  1789. evar_push_set LC_COLLATE C;
  1790. set -- "$1"/*${EPATCH_SUFFIX:+."${EPATCH_SUFFIX}"};
  1791. evar_pop;
  1792. else
  1793. if [[ -f ${EPATCH_SOURCE}/$1 ]]; then
  1794. epatch "${EPATCH_SOURCE}/$1";
  1795. return $?;
  1796. else
  1797. [[ $# -ne 0 ]] && EPATCH_SOURCE=$1;
  1798. echo;
  1799. eerror "Cannot find \$EPATCH_SOURCE! Value for \$EPATCH_SOURCE is:";
  1800. eerror;
  1801. eerror " ${EPATCH_SOURCE}";
  1802. eerror " ( ${EPATCH_SOURCE##*/} )";
  1803. echo;
  1804. die "Cannot find \$EPATCH_SOURCE!";
  1805. fi;
  1806. fi;
  1807. fi;
  1808. EPATCH_OPTS="${EPATCH_COMMON_OPTS} ${EPATCH_OPTS[*]}";
  1809. local PIPE_CMD;
  1810. case ${EPATCH_SUFFIX##*\.} in
  1811. xz)
  1812. PIPE_CMD="xz -dc"
  1813. ;;
  1814. lzma)
  1815. PIPE_CMD="lzma -dc"
  1816. ;;
  1817. bz2)
  1818. PIPE_CMD="bzip2 -dc"
  1819. ;;
  1820. gz | Z | z)
  1821. PIPE_CMD="gzip -dc"
  1822. ;;
  1823. ZIP | zip)
  1824. PIPE_CMD="unzip -p"
  1825. ;;
  1826. *)
  1827.  
  1828. ;;
  1829. esac;
  1830. [[ ${SINGLE_PATCH} == "no" ]] && einfo "${EPATCH_MULTI_MSG}";
  1831. local x;
  1832. for x in "$@";
  1833. do
  1834. [[ ! -f ${x} ]] && continue;
  1835. local patchname=${x##*/};
  1836. local a=${patchname#*_};
  1837. a=${a%%_*};
  1838. if ! [[ ${SINGLE_PATCH} == "yes" || ${EPATCH_FORCE} == "yes" || ${a} == all || ${a} == ${ARCH} ]]; then
  1839. continue;
  1840. fi;
  1841. if [[ -n ${EPATCH_EXCLUDE}${EPATCH_USER_EXCLUDE} ]]; then
  1842. eshopts_push -o noglob;
  1843. local ex;
  1844. for ex in ${EPATCH_EXCLUDE};
  1845. do
  1846. if [[ ${patchname} == ${ex} ]]; then
  1847. einfo " Skipping ${patchname} due to EPATCH_EXCLUDE ...";
  1848. eshopts_pop;
  1849. continue 2;
  1850. fi;
  1851. done;
  1852. for ex in ${EPATCH_USER_EXCLUDE};
  1853. do
  1854. if [[ ${patchname} == ${ex} ]]; then
  1855. einfo " Skipping ${patchname} due to EPATCH_USER_EXCLUDE ...";
  1856. eshopts_pop;
  1857. continue 2;
  1858. fi;
  1859. done;
  1860. eshopts_pop;
  1861. fi;
  1862. if [[ ${SINGLE_PATCH} == "yes" ]]; then
  1863. if [[ -n ${EPATCH_SINGLE_MSG} ]]; then
  1864. einfo "${EPATCH_SINGLE_MSG}";
  1865. else
  1866. einfo "Applying ${patchname} ...";
  1867. fi;
  1868. else
  1869. einfo " ${patchname} ...";
  1870. fi;
  1871. local patch="patch";
  1872. eval $(alias patch 2>/dev/null | sed 's:^alias ::');
  1873. local STDERR_TARGET="${T}/${patchname}.out";
  1874. if [[ -e ${STDERR_TARGET} ]]; then
  1875. STDERR_TARGET="${T}/${patchname}-$$.out";
  1876. fi;
  1877. printf "***** %s *****\nPWD: %s\nPATCH TOOL: %s -> %s\nVERSION INFO:\n%s\n\n" "${patchname}" "${PWD}" "${patch}" "$(type -P "${patch}")" "$(${patch} --version)" > "${STDERR_TARGET}";
  1878. local count=0;
  1879. local PATCH_TARGET;
  1880. if [[ -n ${PIPE_CMD} ]]; then
  1881. PATCH_TARGET="${T}/$$.patch";
  1882. echo "PIPE_COMMAND: ${PIPE_CMD} ${x} > ${PATCH_TARGET}" >> "${STDERR_TARGET}";
  1883. if ! ( ${PIPE_CMD} "${x}" > "${PATCH_TARGET}" ) >> "${STDERR_TARGET}" 2>&1; then
  1884. echo;
  1885. eerror "Could not extract patch!";
  1886. count=5;
  1887. break;
  1888. fi;
  1889. else
  1890. PATCH_TARGET=${x};
  1891. fi;
  1892. local abs_paths=$(egrep -n '^[-+]{3} /' "${PATCH_TARGET}" | awk '$2 != "/dev/null" { print }');
  1893. if [[ -n ${abs_paths} ]]; then
  1894. count=1;
  1895. printf "NOTE: skipping -p0 due to absolute paths in patch:\n%s\n" "${abs_paths}" >> "${STDERR_TARGET}";
  1896. fi;
  1897. local rel_paths=$(egrep -n '^[-+]{3} [^ ]*[.][.]/' "${PATCH_TARGET}");
  1898. if [[ -n ${rel_paths} ]]; then
  1899. echo;
  1900. eerror "Rejected Patch: ${patchname} !";
  1901. eerror " ( ${PATCH_TARGET} )";
  1902. eerror;
  1903. eerror "Your patch uses relative paths '../':";
  1904. eerror "${rel_paths}";
  1905. echo;
  1906. die "you need to fix the relative paths in patch";
  1907. fi;
  1908. local patch_cmd;
  1909. while [[ ${count} -lt 5 ]]; do
  1910. patch_cmd="${patch} -p${count} ${EPATCH_OPTS}";
  1911. ( _epatch_draw_line "***** ${patchname} *****";
  1912. echo;
  1913. echo "PATCH COMMAND: ${patch_cmd} --dry-run -f < '${PATCH_TARGET}'";
  1914. echo;
  1915. _epatch_draw_line "***** ${patchname} *****";
  1916. ${patch_cmd} --dry-run -f < "${PATCH_TARGET}" 2>&1;
  1917. ret=$?;
  1918. echo;
  1919. echo "patch program exited with status ${ret}";
  1920. exit ${ret} ) >> "${STDERR_TARGET}";
  1921. if [ $? -eq 0 ]; then
  1922. ( _epatch_draw_line "***** ${patchname} *****";
  1923. echo;
  1924. echo "ACTUALLY APPLYING ${patchname} ...";
  1925. echo "PATCH COMMAND: ${patch_cmd} < '${PATCH_TARGET}'";
  1926. echo;
  1927. _epatch_draw_line "***** ${patchname} *****";
  1928. ${patch_cmd} < "${PATCH_TARGET}" 2>&1;
  1929. ret=$?;
  1930. echo;
  1931. echo "patch program exited with status ${ret}";
  1932. exit ${ret} ) >> "${STDERR_TARGET}";
  1933. if [ $? -ne 0 ]; then
  1934. echo;
  1935. eerror "A dry-run of patch command succeeded, but actually";
  1936. eerror "applying the patch failed!";
  1937. count=5;
  1938. fi;
  1939. break;
  1940. fi;
  1941. : $(( count++ ));
  1942. done;
  1943. (( EPATCH_N_APPLIED_PATCHES++ ));
  1944. if [[ -n ${PIPE_CMD} ]]; then
  1945. rm -f "${PATCH_TARGET}";
  1946. fi;
  1947. if [[ ${count} -ge 5 ]]; then
  1948. echo;
  1949. eerror "Failed Patch: ${patchname} !";
  1950. eerror " ( ${PATCH_TARGET} )";
  1951. eerror;
  1952. eerror "Include in your bugreport the contents of:";
  1953. eerror;
  1954. eerror " ${STDERR_TARGET}";
  1955. echo;
  1956. die "Failed Patch: ${patchname}!";
  1957. fi;
  1958. rm -f "${STDERR_TARGET}";
  1959. cat >> "${T}/epatch.log" <<-EOF
  1960. PATCH: ${x}
  1961. CMD: ${patch_cmd}
  1962. PWD: ${PWD}
  1963.  
  1964. EOF
  1965.  
  1966. eend 0;
  1967. done;
  1968. [[ ${SINGLE_PATCH} == "no" ]] && einfo "Done with patching";
  1969. :
  1970. }
  1971. epause ()
  1972. {
  1973. ewarn "QA Notice: epause is not defined in EAPI=${EAPI}, please file a bug at https://bugs.gentoo.org"
  1974. }
  1975. eshopts_pop ()
  1976. {
  1977. local s;
  1978. estack_pop eshopts s || die "${FUNCNAME}: unbalanced push";
  1979. eval "${s}" || die "${FUNCNAME}: sanity: invalid shopt options: ${s}"
  1980. }
  1981. eshopts_push ()
  1982. {
  1983. if [[ $1 == -[su] ]]; then
  1984. estack_push eshopts "$(shopt -p)";
  1985. [[ $# -eq 0 ]] && return 0;
  1986. shopt "$@" || die "${FUNCNAME}: bad options to shopt: $*";
  1987. else
  1988. estack_push eshopts "$(shopt -p -o)";
  1989. [[ $# -eq 0 ]] && return 0;
  1990. set "$@" || die "${FUNCNAME}: bad options to set: $*";
  1991. fi
  1992. }
  1993. estack_pop ()
  1994. {
  1995. [[ $# -eq 0 || $# -gt 2 ]] && die "estack_pop: incorrect # of arguments";
  1996. local _estack_name="_ESTACK_$1_";
  1997. shift;
  1998. local _estack_retvar=$1;
  1999. shift;
  2000. eval local _estack_i=\${#${_estack_name}\[@\]};
  2001. [[ $(( --_estack_i )) -eq -1 ]] && return 1;
  2002. if [[ -n ${_estack_retvar} ]]; then
  2003. eval ${_estack_retvar}=\"\${${_estack_name}\[${_estack_i}\]}\";
  2004. fi;
  2005. eval unset \"${_estack_name}\[${_estack_i}\]\"
  2006. }
  2007. estack_push ()
  2008. {
  2009. [[ $# -eq 0 ]] && die "estack_push: incorrect # of arguments";
  2010. local stack_name="_ESTACK_$1_";
  2011. shift;
  2012. eval ${stack_name}+=\( \"\$@\" \)
  2013. }
  2014. esvn_clean ()
  2015. {
  2016. [[ $# -eq 0 ]] && set -- .;
  2017. find "$@" -type d -name '.svn' -prune -print0 | xargs -0 rm -rf
  2018. }
  2019. eumask_pop ()
  2020. {
  2021. [[ $# -eq 0 ]] || die "${FUNCNAME}: we take no options";
  2022. local s;
  2023. estack_pop eumask s || die "${FUNCNAME}: unbalanced push";
  2024. umask ${s} || die "${FUNCNAME}: sanity: could not restore umask: ${s}"
  2025. }
  2026. eumask_push ()
  2027. {
  2028. estack_push eumask "$(umask)";
  2029. umask "$@" || die "${FUNCNAME}: bad options to umask: $*"
  2030. }
  2031. evar_pop ()
  2032. {
  2033. local cnt=${1:-bad};
  2034. case $# in
  2035. 0)
  2036. cnt=1
  2037. ;;
  2038. 1)
  2039. isdigit "${cnt}" || die "${FUNCNAME}: first arg must be a number: $*"
  2040. ;;
  2041. *)
  2042. die "${FUNCNAME}: only accepts one arg: $*"
  2043. ;;
  2044. esac;
  2045. local var val;
  2046. while (( cnt-- )); do
  2047. estack_pop evar val || die "${FUNCNAME}: unbalanced push";
  2048. estack_pop evar var || die "${FUNCNAME}: unbalanced push";
  2049. [[ ${val} == "unset_76fc3c462065bb4ca959f939e6793f94" ]] && unset ${var} || printf -v "${var}" '%s' "${val}";
  2050. done
  2051. }
  2052. evar_push ()
  2053. {
  2054. local var val;
  2055. for var in "$@";
  2056. do
  2057. [[ ${!var+set} == "set" ]] && val=${!var} || val="unset_76fc3c462065bb4ca959f939e6793f94";
  2058. estack_push evar "${var}" "${val}";
  2059. done
  2060. }
  2061. evar_push_set ()
  2062. {
  2063. local var=$1;
  2064. evar_push ${var};
  2065. case $# in
  2066. 1)
  2067. unset ${var}
  2068. ;;
  2069. 2)
  2070. printf -v "${var}" '%s' "$2"
  2071. ;;
  2072. *)
  2073. die "${FUNCNAME}: incorrect # of args: $*"
  2074. ;;
  2075. esac
  2076. }
  2077. gcc-fullversion ()
  2078. {
  2079. _gcc_fullversion '$1.$2.$3' "$@"
  2080. }
  2081. gcc-major-version ()
  2082. {
  2083. _gcc_fullversion '$1' "$@"
  2084. }
  2085. gcc-micro-version ()
  2086. {
  2087. _gcc_fullversion '$3' "$@"
  2088. }
  2089. gcc-minor-version ()
  2090. {
  2091. _gcc_fullversion '$2' "$@"
  2092. }
  2093. gcc-specs-directive ()
  2094. {
  2095. local directive subdname subdirective;
  2096. directive="$(_gcc-specs-directive_raw $1)";
  2097. while [[ ${directive} == *%\(*\)* ]]; do
  2098. subdname=${directive/*%\(};
  2099. subdname=${subdname/\)*};
  2100. subdirective="$(_gcc-specs-directive_raw ${subdname})";
  2101. directive="${directive//\%(${subdname})/${subdirective}}";
  2102. done;
  2103. echo "${directive}";
  2104. return 0
  2105. }
  2106. gcc-specs-nostrict ()
  2107. {
  2108. local directive;
  2109. directive=$(gcc-specs-directive cc1);
  2110. [[ "${directive/\{!fstrict-overflow:}" != "${directive}" ]]
  2111. }
  2112. gcc-specs-now ()
  2113. {
  2114. local directive;
  2115. directive=$(gcc-specs-directive link_command);
  2116. [[ "${directive/\{!nonow:}" != "${directive}" ]]
  2117. }
  2118. gcc-specs-pie ()
  2119. {
  2120. local directive;
  2121. directive=$(gcc-specs-directive cc1);
  2122. [[ "${directive/\{!nopie:}" != "${directive}" ]]
  2123. }
  2124. gcc-specs-relro ()
  2125. {
  2126. local directive;
  2127. directive=$(gcc-specs-directive link_command);
  2128. [[ "${directive/\{!norelro:}" != "${directive}" ]]
  2129. }
  2130. gcc-specs-ssp ()
  2131. {
  2132. local directive;
  2133. directive=$(gcc-specs-directive cc1);
  2134. [[ "${directive/\{!fno-stack-protector:}" != "${directive}" ]]
  2135. }
  2136. gcc-specs-ssp-to-all ()
  2137. {
  2138. local directive;
  2139. directive=$(gcc-specs-directive cc1);
  2140. [[ "${directive/\{!fno-stack-protector-all:}" != "${directive}" ]]
  2141. }
  2142. gcc-specs-stack-check ()
  2143. {
  2144. local directive;
  2145. directive=$(gcc-specs-directive cc1);
  2146. [[ "${directive/\{!fno-stack-check:}" != "${directive}" ]]
  2147. }
  2148. gcc-version ()
  2149. {
  2150. _gcc_fullversion '$1.$2' "$@"
  2151. }
  2152. gen_usr_ldscript ()
  2153. {
  2154. local lib libdir=$(get_libdir) output_format="" auto=false suffix=$(get_libname);
  2155. [[ -z ${ED+set} ]] && local ED=${D%/}${EPREFIX}/;
  2156. tc-is-static-only && return;
  2157. if [[ $(type -t multilib_is_native_abi) == "function" ]]; then
  2158. multilib_is_native_abi || return 0;
  2159. fi;
  2160. case ${CTARGET:-${CHOST}} in
  2161. *-darwin*)
  2162.  
  2163. ;;
  2164. *-android*)
  2165. return 0
  2166. ;;
  2167. *linux* | *-freebsd* | *-openbsd* | *-netbsd*)
  2168. use prefix && return 0
  2169. ;;
  2170. *)
  2171. return 0
  2172. ;;
  2173. esac;
  2174. dodir /usr/${libdir};
  2175. if [[ $1 == "-a" ]]; then
  2176. auto=true;
  2177. shift;
  2178. dodir /${libdir};
  2179. fi;
  2180. local flags=(${CFLAGS} ${LDFLAGS} -Wl,--verbose);
  2181. if $(tc-getLD) --version | grep -q 'GNU gold'; then
  2182. local d="${T}/bfd-linker";
  2183. mkdir -p "${d}";
  2184. ln -sf $(which ${CHOST}-ld.bfd) "${d}"/ld;
  2185. flags+=(-B"${d}");
  2186. fi;
  2187. output_format=$($(tc-getCC) "${flags[@]}" 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p');
  2188. [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )";
  2189. for lib in "$@";
  2190. do
  2191. local tlib;
  2192. if ${auto}; then
  2193. lib="lib${lib}${suffix}";
  2194. else
  2195. [[ -r ${ED}/${libdir}/${lib} ]] || continue;
  2196. fi;
  2197. case ${CTARGET:-${CHOST}} in
  2198. *-darwin*)
  2199. if ${auto}; then
  2200. tlib=$(scanmacho -qF'%S#F' "${ED}"/usr/${libdir}/${lib});
  2201. else
  2202. tlib=$(scanmacho -qF'%S#F' "${ED}"/${libdir}/${lib});
  2203. fi;
  2204. [[ -z ${tlib} ]] && die "unable to read install_name from ${lib}";
  2205. tlib=${tlib##*/};
  2206. if ${auto}; then
  2207. mv "${ED}"/usr/${libdir}/${lib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die;
  2208. if [[ ${tlib} != ${lib%${suffix}}.*${suffix#.} ]]; then
  2209. mv "${ED}"/usr/${libdir}/${tlib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die;
  2210. fi;
  2211. rm -f "${ED}"/${libdir}/${lib};
  2212. fi;
  2213. if [[ ! -w "${ED}/${libdir}/${tlib}" ]]; then
  2214. chmod u+w "${ED}${libdir}/${tlib}";
  2215. local nowrite=yes;
  2216. fi;
  2217. install_name_tool -id "${EPREFIX}"/${libdir}/${tlib} "${ED}"/${libdir}/${tlib} || die "install_name_tool failed";
  2218. [[ -n ${nowrite} ]] && chmod u-w "${ED}${libdir}/${tlib}";
  2219. pushd "${ED}/usr/${libdir}" > /dev/null;
  2220. ln -snf "../../${libdir}/${tlib}" "${lib}";
  2221. popd > /dev/null
  2222. ;;
  2223. *)
  2224. if ${auto}; then
  2225. tlib=$(scanelf -qF'%S#F' "${ED}"/usr/${libdir}/${lib});
  2226. [[ -z ${tlib} ]] && die "unable to read SONAME from ${lib}";
  2227. mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die;
  2228. if [[ ${tlib} != ${lib}* ]]; then
  2229. mv "${ED}"/usr/${libdir}/${tlib}* "${ED}"/${libdir}/ || die;
  2230. fi;
  2231. rm -f "${ED}"/${libdir}/${lib};
  2232. else
  2233. tlib=${lib};
  2234. fi;
  2235. cat > "${ED}/usr/${libdir}/${lib}" <<-END_LDSCRIPT
  2236. /* GNU ld script
  2237. Since Gentoo has critical dynamic libraries in /lib, and the static versions
  2238. in /usr/lib, we need to have a "fake" dynamic lib in /usr/lib, otherwise we
  2239. run into linking problems. This "fake" dynamic lib is a linker script that
  2240. redirects the linker to the real lib. And yes, this works in the cross-
  2241. compiling scenario as the sysroot-ed linker will prepend the real path.
  2242.  
  2243. See bug https://bugs.gentoo.org/4411 for more info.
  2244. */
  2245. ${output_format}
  2246. GROUP ( ${EPREFIX}/${libdir}/${tlib} )
  2247. END_LDSCRIPT
  2248.  
  2249. ;;
  2250. esac
  2251. fperms a+x "/usr/${libdir}/${lib}" || die "could not change perms on ${lib}";
  2252. done
  2253. }
  2254. get_abi_CFLAGS ()
  2255. {
  2256. get_abi_var CFLAGS "$@"
  2257. }
  2258. get_abi_CHOST ()
  2259. {
  2260. get_abi_var CHOST "$@"
  2261. }
  2262. get_abi_CTARGET ()
  2263. {
  2264. get_abi_var CTARGET "$@"
  2265. }
  2266. get_abi_FAKE_TARGETS ()
  2267. {
  2268. get_abi_var FAKE_TARGETS "$@"
  2269. }
  2270. get_abi_LDFLAGS ()
  2271. {
  2272. get_abi_var LDFLAGS "$@"
  2273. }
  2274. get_abi_LIBDIR ()
  2275. {
  2276. get_abi_var LIBDIR "$@"
  2277. }
  2278. get_abi_var ()
  2279. {
  2280. local flag=$1;
  2281. local abi=${2:-${ABI:-${DEFAULT_ABI:-default}}};
  2282. local var="${flag}_${abi}";
  2283. echo ${!var}
  2284. }
  2285. get_after_major_version ()
  2286. {
  2287. echo $(get_version_component_range 2- "${1:-${PV}}")
  2288. }
  2289. get_all_abis ()
  2290. {
  2291. local x order="" mvar dvar;
  2292. mvar="MULTILIB_ABIS";
  2293. dvar="DEFAULT_ABI";
  2294. if [[ -n $1 ]]; then
  2295. mvar="$1_${mvar}";
  2296. dvar="$1_${dvar}";
  2297. fi;
  2298. if [[ -z ${!mvar} ]]; then
  2299. echo "default";
  2300. return 0;
  2301. fi;
  2302. for x in ${!mvar};
  2303. do
  2304. if [[ ${x} != ${!dvar} ]]; then
  2305. order="${order:+${order} }${x}";
  2306. fi;
  2307. done;
  2308. order="${order:+${order} }${!dvar}";
  2309. echo ${order};
  2310. return 0
  2311. }
  2312. get_all_libdirs ()
  2313. {
  2314. local libdirs abi;
  2315. for abi in ${MULTILIB_ABIS};
  2316. do
  2317. libdirs+=" $(get_abi_LIBDIR ${abi})";
  2318. done;
  2319. [[ " ${libdirs} " != *" lib "* ]] && libdirs+=" lib";
  2320. echo "${libdirs}"
  2321. }
  2322. get_all_version_components ()
  2323. {
  2324. eshopts_push -s extglob;
  2325. local ver_str=${1:-${PV}} result;
  2326. result=();
  2327. if [[ ${VERSIONATOR_CACHE_VER_STR} == ${ver_str} ]]; then
  2328. echo ${VERSIONATOR_CACHE_RESULT};
  2329. eshopts_pop;
  2330. return;
  2331. fi;
  2332. export VERSIONATOR_CACHE_VER_STR=${ver_str};
  2333. while [[ -n $ver_str ]]; do
  2334. case "${ver_str::1}" in
  2335. [[:digit:]])
  2336. result+=("${ver_str%%[^[:digit:]]*}");
  2337. ver_str=${ver_str##+([[:digit:]])}
  2338. ;;
  2339. [-_.])
  2340. result+=("${ver_str::1}");
  2341. ver_str=${ver_str:1}
  2342. ;;
  2343. [[:alpha:]])
  2344. local not_match=${ver_str##+([[:alpha:]])*([[:digit:]])};
  2345. result+=("${ver_str::${#ver_str} - ${#not_match}}");
  2346. ver_str=${not_match}
  2347. ;;
  2348. *)
  2349. result+=("${ver_str::1}");
  2350. ver_str=${ver_str:1}
  2351. ;;
  2352. esac;
  2353. done;
  2354. export VERSIONATOR_CACHE_RESULT=${result[*]};
  2355. echo ${result[@]};
  2356. eshopts_pop
  2357. }
  2358. get_exeext ()
  2359. {
  2360. case ${CHOST} in
  2361. *-cygwin* | mingw* | *-mingw*)
  2362. echo ".exe"
  2363. ;;
  2364. esac
  2365. }
  2366. get_install_abis ()
  2367. {
  2368. local x order="";
  2369. if [[ -z ${MULTILIB_ABIS} ]]; then
  2370. echo "default";
  2371. return 0;
  2372. fi;
  2373. if [[ ${EMULTILIB_PKG} == "true" ]]; then
  2374. for x in ${MULTILIB_ABIS};
  2375. do
  2376. if [[ ${x} != "${DEFAULT_ABI}" ]]; then
  2377. has ${x} ${ABI_DENY} || order="${order} ${x}";
  2378. fi;
  2379. done;
  2380. has ${DEFAULT_ABI} ${ABI_DENY} || order="${order} ${DEFAULT_ABI}";
  2381. if [[ -n ${ABI_ALLOW} ]]; then
  2382. local ordera="";
  2383. for x in ${order};
  2384. do
  2385. if has ${x} ${ABI_ALLOW}; then
  2386. ordera="${ordera} ${x}";
  2387. fi;
  2388. done;
  2389. order=${ordera};
  2390. fi;
  2391. else
  2392. order=${DEFAULT_ABI};
  2393. fi;
  2394. if [[ -z ${order} ]]; then
  2395. 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.";
  2396. fi;
  2397. echo ${order};
  2398. return 0
  2399. }
  2400. get_last_version_component_index ()
  2401. {
  2402. echo $(($(get_version_component_count "${1:-${PV}}" ) - 1))
  2403. }
  2404. get_libdir ()
  2405. {
  2406. local libdir_var="LIBDIR_${ABI}";
  2407. local libdir="lib";
  2408. [[ -n ${ABI} && -n ${!libdir_var} ]] && libdir=${!libdir_var};
  2409. echo "${libdir}"
  2410. }
  2411. get_libname ()
  2412. {
  2413. local libname;
  2414. local ver=$1;
  2415. case ${CHOST} in
  2416. *-cygwin*)
  2417. libname="dll.a"
  2418. ;;
  2419. mingw* | *-mingw*)
  2420. libname="dll"
  2421. ;;
  2422. *-darwin*)
  2423. libname="dylib"
  2424. ;;
  2425. *-mint*)
  2426. libname="irrelevant"
  2427. ;;
  2428. hppa*-hpux*)
  2429. libname="sl"
  2430. ;;
  2431. *)
  2432. libname="so"
  2433. ;;
  2434. esac;
  2435. if [[ -z $* ]]; then
  2436. echo ".${libname}";
  2437. else
  2438. for ver in "$@";
  2439. do
  2440. case ${CHOST} in
  2441. *-cygwin*)
  2442. echo ".${ver}.${libname}"
  2443. ;;
  2444. *-darwin*)
  2445. echo ".${ver}.${libname}"
  2446. ;;
  2447. *-mint*)
  2448. echo ".${libname}"
  2449. ;;
  2450. *)
  2451. echo ".${libname}.${ver}"
  2452. ;;
  2453. esac;
  2454. done;
  2455. fi
  2456. }
  2457. get_major_version ()
  2458. {
  2459. local c=($(get_all_version_components "${1:-${PV}}"));
  2460. echo ${c[0]}
  2461. }
  2462. get_modname ()
  2463. {
  2464. local modname;
  2465. local ver=$1;
  2466. case ${CHOST} in
  2467. *-darwin*)
  2468. modname="bundle"
  2469. ;;
  2470. *)
  2471. modname="so"
  2472. ;;
  2473. esac;
  2474. echo ".${modname}"
  2475. }
  2476. get_nproc ()
  2477. {
  2478. local nproc;
  2479. if type -P nproc &> /dev/null; then
  2480. nproc=$(nproc);
  2481. fi;
  2482. if [[ -z ${nproc} ]] && type -P sysctl &> /dev/null; then
  2483. nproc=$(sysctl -n hw.ncpu 2>/dev/null);
  2484. fi;
  2485. if [[ -z ${nproc} ]] && type -P python &> /dev/null; then
  2486. nproc=$(python -c 'import multiprocessing; print(multiprocessing.cpu_count());' 2>/dev/null);
  2487. fi;
  2488. if [[ -n ${nproc} ]]; then
  2489. echo "${nproc}";
  2490. else
  2491. echo "${1:-1}";
  2492. fi
  2493. }
  2494. get_version_component_count ()
  2495. {
  2496. local a=($(get_version_components "${1:-${PV}}"));
  2497. echo ${#a[@]}
  2498. }
  2499. get_version_component_range ()
  2500. {
  2501. eshopts_push -s extglob;
  2502. local c v="${2:-${PV}}" range="${1}" range_start range_end;
  2503. local -i i=-1 j=0;
  2504. c=($(get_all_version_components "${v}"));
  2505. range_start=${range%-*};
  2506. range_start=${range_start:-1};
  2507. range_end=${range#*-};
  2508. range_end=${range_end:-${#c[@]}};
  2509. while ((j < range_start)); do
  2510. i+=1;
  2511. ((i > ${#c[@]})) && eshopts_pop && return;
  2512. [[ -n "${c[i]//[-._]}" ]] && j+=1;
  2513. done;
  2514. while ((j <= range_end)); do
  2515. echo -n ${c[i]};
  2516. ((i > ${#c[@]})) && eshopts_pop && return;
  2517. [[ -n "${c[i]//[-._]}" ]] && j+=1;
  2518. i+=1;
  2519. done;
  2520. eshopts_pop
  2521. }
  2522. get_version_components ()
  2523. {
  2524. local c=$(get_all_version_components "${1:-${PV}}");
  2525. echo ${c//[-._]/ }
  2526. }
  2527. git-r3_checkout ()
  2528. {
  2529. debug-print-function ${FUNCNAME} "$@";
  2530. local repos;
  2531. if [[ -n ${1} ]]; then
  2532. repos=(${1});
  2533. else
  2534. if [[ $(declare -p EGIT_REPO_URI) == "declare -a"* ]]; then
  2535. repos=("${EGIT_REPO_URI[@]}");
  2536. else
  2537. repos=(${EGIT_REPO_URI});
  2538. fi;
  2539. fi;
  2540. local out_dir=${2:-${EGIT_CHECKOUT_DIR:-${WORKDIR}/${P}}};
  2541. local local_id=${3:-${CATEGORY}/${PN}/${SLOT%/*}};
  2542. local -x GIT_DIR;
  2543. _git-r3_set_gitdir "${repos[0]}";
  2544. einfo "Checking out \e[1m${repos[0]}\e[22m to \e[1m${out_dir}\e[22m ...";
  2545. if ! git cat-file -e refs/git-r3/"${local_id}"/__main__; then
  2546. die "Logic error: no local clone of ${repos[0]}. git-r3_fetch not used?";
  2547. fi;
  2548. local remote_ref=$(
  2549. git symbolic-ref --quiet refs/git-r3/"${local_id}"/__main__
  2550. );
  2551. local new_commit_id=$(
  2552. git rev-parse --verify refs/git-r3/"${local_id}"/__main__
  2553. );
  2554. function git-r3_sub_checkout ()
  2555. {
  2556. local orig_repo=${GIT_DIR};
  2557. local -x GIT_DIR=${out_dir}/.git;
  2558. local -x GIT_WORK_TREE=${out_dir};
  2559. mkdir -p "${out_dir}" || die;
  2560. git init --quiet || die;
  2561. echo "${orig_repo}/objects" > "${GIT_DIR}"/objects/info/alternates || die;
  2562. cp -R "${orig_repo}"/refs/* "${GIT_DIR}"/refs/ || die;
  2563. if [[ -f ${orig_repo}/shallow ]]; then
  2564. cp "${orig_repo}"/shallow "${GIT_DIR}"/ || die;
  2565. fi;
  2566. set -- git checkout --quiet;
  2567. if [[ -n ${remote_ref} ]]; then
  2568. set -- "${@}" "${remote_ref#refs/heads/}";
  2569. else
  2570. set -- "${@}" "${new_commit_id}";
  2571. fi;
  2572. echo "${@}" 1>&2;
  2573. "${@}" || die "git checkout ${remote_ref:-${new_commit_id}} failed"
  2574. };
  2575. git-r3_sub_checkout;
  2576. unset -f git-r3_sub_checkout;
  2577. local old_commit_id=$(
  2578. git rev-parse --quiet --verify refs/git-r3/"${local_id}"/__old__
  2579. );
  2580. if [[ ! -n ${old_commit_id} ]]; then
  2581. echo "GIT NEW branch -->";
  2582. echo " repository: ${repos[0]}";
  2583. echo " at the commit: ${new_commit_id}";
  2584. else
  2585. echo "GIT update -->";
  2586. echo " repository: ${repos[0]}";
  2587. if [[ "${old_commit_id}" != "${new_commit_id}" ]]; then
  2588. echo " updating from commit: ${old_commit_id}";
  2589. echo " to commit: ${new_commit_id}";
  2590. git --no-pager diff --stat ${old_commit_id}..${new_commit_id};
  2591. else
  2592. echo " at the commit: ${new_commit_id}";
  2593. fi;
  2594. fi;
  2595. git update-ref --no-deref refs/git-r3/"${local_id}"/{__old__,__main__} || die;
  2596. if [[ -f ${out_dir}/.gitmodules ]]; then
  2597. local submodules;
  2598. _git-r3_set_submodules "$(<"${out_dir}"/.gitmodules)";
  2599. while [[ -n ${submodules[@]} ]]; do
  2600. local subname=${submodules[0]};
  2601. local url=${submodules[1]};
  2602. local path=${submodules[2]};
  2603. if [[ -d ${out_dir}/${path} ]]; then
  2604. local subrepos;
  2605. _git-r3_set_subrepos "${url}" "${repos[@]}";
  2606. git-r3_checkout "${subrepos[*]}" "${out_dir}/${path}" "${local_id}/${subname}";
  2607. fi;
  2608. submodules=("${submodules[@]:3}");
  2609. done;
  2610. fi;
  2611. export EGIT_DIR=${GIT_DIR};
  2612. export EGIT_VERSION=${new_commit_id}
  2613. }
  2614. git-r3_fetch ()
  2615. {
  2616. debug-print-function ${FUNCNAME} "$@";
  2617. local repos;
  2618. if [[ -n ${1} ]]; then
  2619. repos=(${1});
  2620. else
  2621. if [[ $(declare -p EGIT_REPO_URI) == "declare -a"* ]]; then
  2622. repos=("${EGIT_REPO_URI[@]}");
  2623. else
  2624. repos=(${EGIT_REPO_URI});
  2625. fi;
  2626. fi;
  2627. local branch=${EGIT_BRANCH:+refs/heads/${EGIT_BRANCH}};
  2628. local remote_ref=${2:-${EGIT_COMMIT:-${branch:-HEAD}}};
  2629. local local_id=${3:-${CATEGORY}/${PN}/${SLOT%/*}};
  2630. local local_ref=refs/git-r3/${local_id}/__main__;
  2631. local commit_date=${4:-${EGIT_COMMIT_DATE}};
  2632. [[ -n ${repos[@]} ]] || die "No URI provided and EGIT_REPO_URI unset";
  2633. local -x GIT_DIR;
  2634. _git-r3_set_gitdir "${repos[0]}";
  2635. if [[ -n ${EGIT_MIRROR_URI} ]]; then
  2636. repos=("${EGIT_MIRROR_URI%/}/${GIT_DIR##*/}" "${repos[@]}");
  2637. fi;
  2638. local r success saved_umask;
  2639. if [[ -n ${EVCS_UMASK} ]]; then
  2640. saved_umask=$(umask);
  2641. umask "${EVCS_UMASK}" || die "Bad options to umask: ${EVCS_UMASK}";
  2642. fi;
  2643. for r in "${repos[@]}";
  2644. do
  2645. if [[ ! -n ${EVCS_OFFLINE} ]]; then
  2646. einfo "Fetching \e[1m${r}\e[22m ...";
  2647. local fetch_command=(git fetch "${r}");
  2648. local clone_type=${EGIT_CLONE_TYPE};
  2649. if [[ ${r} == http://* || ${r} == https://* ]] && [[ ! -n ${EGIT_CURL_WARNED} ]] && ! ROOT=/ has_version 'dev-vcs/git[curl]'; then
  2650. ewarn "git-r3: fetching from HTTP(S) requested. In order to support HTTP(S),";
  2651. ewarn "dev-vcs/git needs to be built with USE=curl. Example solution:";
  2652. ewarn;
  2653. ewarn " echo dev-vcs/git curl >> /etc/portage/package.use";
  2654. ewarn " emerge -1v dev-vcs/git";
  2655. ewarn;
  2656. ewarn "HTTP(S) URIs will be skipped.";
  2657. EGIT_CURL_WARNED=1;
  2658. fi;
  2659. if [[ ${clone_type} == mirror ]]; then
  2660. fetch_command+=(--prune "+refs/heads/*:refs/heads/*" "+refs/tags/*:refs/tags/*" "+refs/notes/*:refs/notes/*" "+HEAD:refs/git-r3/HEAD");
  2661. else
  2662. local fetch_l fetch_r;
  2663. if [[ ${remote_ref} == HEAD ]]; then
  2664. fetch_l=HEAD;
  2665. else
  2666. if [[ ${remote_ref} == refs/* ]]; then
  2667. fetch_l=${remote_ref};
  2668. else
  2669. local tagref=$(git ls-remote "${r}" "refs/tags/${remote_ref}");
  2670. if [[ -n ${tagref} ]]; then
  2671. fetch_l=refs/tags/${remote_ref};
  2672. else
  2673. if [[ -n ${branch} ]]; then
  2674. fetch_l=${branch};
  2675. else
  2676. fetch_l=HEAD;
  2677. fi;
  2678. if [[ ${clone_type} == shallow ]]; then
  2679. clone_type=single;
  2680. fi;
  2681. fi;
  2682. fi;
  2683. fi;
  2684. if [[ -n ${commit_date} && ${clone_type} == shallow ]]; then
  2685. clone_type=single;
  2686. fi;
  2687. if [[ ${fetch_l} == HEAD ]]; then
  2688. fetch_r=refs/git-r3/HEAD;
  2689. else
  2690. fetch_r=${fetch_l};
  2691. fi;
  2692. fetch_command+=("+${fetch_l}:${fetch_r}");
  2693. if [[ ${clone_type} == single+tags ]]; then
  2694. fetch_command+=("+refs/tags/*:refs/tags/*");
  2695. fi;
  2696. fi;
  2697. if [[ ${clone_type} == shallow ]]; then
  2698. if _git-r3_is_local_repo; then
  2699. clone_type=single;
  2700. else
  2701. if [[ ! -n $(git rev-parse --quiet --verify "${fetch_r}") ]]; then
  2702. fetch_command+=(--depth 1);
  2703. fi;
  2704. fi;
  2705. else
  2706. if [[ -f ${GIT_DIR}/shallow ]]; then
  2707. fetch_command+=(--unshallow);
  2708. fi;
  2709. fi;
  2710. set -- "${fetch_command[@]}";
  2711. echo "${@}" 1>&2;
  2712. "${@}" || continue;
  2713. if [[ ${clone_type} == mirror || ${fetch_l} == HEAD ]]; then
  2714. git symbolic-ref HEAD refs/git-r3/HEAD || die "Unable to update HEAD";
  2715. fi;
  2716. fi;
  2717. if [[ -n ${commit_date} ]]; then
  2718. local dated_commit_id=$(
  2719. git rev-list --first-parent --before="${commit_date}" -n 1 "${remote_ref}"
  2720. );
  2721. if [[ ${?} -ne 0 ]]; then
  2722. die "Listing ${remote_ref} failed (wrong ref?).";
  2723. else
  2724. if [[ ! -n ${dated_commit_id} ]]; then
  2725. die "Unable to find commit for date ${commit_date}.";
  2726. else
  2727. set -- git update-ref --no-deref "${local_ref}" "${dated_commit_id}";
  2728. fi;
  2729. fi;
  2730. else
  2731. local full_remote_ref=$(
  2732. git rev-parse --verify --symbolic-full-name "${remote_ref}"
  2733. );
  2734. if [[ -n ${full_remote_ref} ]]; then
  2735. set -- git symbolic-ref "${local_ref}" "${full_remote_ref}";
  2736. else
  2737. set -- git update-ref --no-deref "${local_ref}" "${remote_ref}";
  2738. fi;
  2739. fi;
  2740. echo "${@}" 1>&2;
  2741. if ! "${@}"; then
  2742. if [[ -n ${EVCS_OFFLINE} ]]; then
  2743. eerror "A clone of the following repository is required to proceed:";
  2744. eerror " ${r}";
  2745. eerror "However, networking activity has been disabled using EVCS_OFFLINE and the local";
  2746. eerror "clone does not have requested ref:";
  2747. eerror " ${remote_ref}";
  2748. die "Local clone of ${r} does not have requested ref: ${remote_ref}. Unable to proceed with EVCS_OFFLINE.";
  2749. else
  2750. die "Referencing ${remote_ref} failed (wrong ref?).";
  2751. fi;
  2752. fi;
  2753. success=1;
  2754. break;
  2755. done;
  2756. if [[ -n ${saved_umask} ]]; then
  2757. umask "${saved_umask}" || die;
  2758. fi;
  2759. [[ -n ${success} ]] || die "Unable to fetch from any of EGIT_REPO_URI";
  2760. local EGIT_CLONE_TYPE=mirror;
  2761. if git cat-file -e "${local_ref}":.gitmodules &> /dev/null; then
  2762. local submodules;
  2763. _git-r3_set_submodules "$(git cat-file -p "${local_ref}":.gitmodules || die)";
  2764. while [[ -n ${submodules[@]} ]]; do
  2765. local subname=${submodules[0]};
  2766. local url=${submodules[1]};
  2767. local path=${submodules[2]};
  2768. if [[ -n $(git ls-tree -d "${local_ref}" "${path}") ]]; then
  2769. local commit=$(git rev-parse "${local_ref}:${path}" || die);
  2770. if [[ ! -n ${commit} ]]; then
  2771. die "Unable to get commit id for submodule ${subname}";
  2772. fi;
  2773. local subrepos;
  2774. _git-r3_set_subrepos "${url}" "${repos[@]}";
  2775. git-r3_fetch "${subrepos[*]}" "${commit}" "${local_id}/${subname}";
  2776. fi;
  2777. submodules=("${submodules[@]:3}");
  2778. done;
  2779. fi
  2780. }
  2781. git-r3_peek_remote_ref ()
  2782. {
  2783. debug-print-function ${FUNCNAME} "$@";
  2784. local repos;
  2785. if [[ -n ${1} ]]; then
  2786. repos=(${1});
  2787. else
  2788. if [[ $(declare -p EGIT_REPO_URI) == "declare -a"* ]]; then
  2789. repos=("${EGIT_REPO_URI[@]}");
  2790. else
  2791. repos=(${EGIT_REPO_URI});
  2792. fi;
  2793. fi;
  2794. local branch=${EGIT_BRANCH:+refs/heads/${EGIT_BRANCH}};
  2795. local remote_ref=${2:-${EGIT_COMMIT:-${branch:-HEAD}}};
  2796. [[ -n ${repos[@]} ]] || die "No URI provided and EGIT_REPO_URI unset";
  2797. local r success;
  2798. for r in "${repos[@]}";
  2799. do
  2800. einfo "Peeking \e[1m${remote_ref}\e[22m on \e[1m${r}\e[22m ..." 1>&2;
  2801. local lookup_ref;
  2802. if [[ ${remote_ref} == refs/* || ${remote_ref} == HEAD ]]; then
  2803. lookup_ref=${remote_ref};
  2804. else
  2805. lookup_ref=refs/tags/${remote_ref};
  2806. fi;
  2807. local ref=($(git ls-remote "${r}" "${lookup_ref}"));
  2808. if [[ -n ${ref[0]} ]]; then
  2809. echo "${ref[0]}";
  2810. return 0;
  2811. fi;
  2812. done;
  2813. return 1
  2814. }
  2815. git-r3_pkg_needrebuild ()
  2816. {
  2817. debug-print-function ${FUNCNAME} "$@";
  2818. local new_commit_id=$(git-r3_peek_remote_ref);
  2819. [[ -n ${new_commit_id} && -n ${EGIT_VERSION} ]] || die "Lookup failed";
  2820. if [[ ${EGIT_VERSION} != ${new_commit_id} ]]; then
  2821. einfo "Update from \e[1m${EGIT_VERSION}\e[22m to \e[1m${new_commit_id}\e[22m";
  2822. else
  2823. einfo "Local and remote at \e[1m${EGIT_VERSION}\e[22m";
  2824. fi;
  2825. [[ ${EGIT_VERSION} != ${new_commit_id} ]]
  2826. }
  2827. git-r3_src_fetch ()
  2828. {
  2829. debug-print-function ${FUNCNAME} "$@";
  2830. if [[ ! -n ${EGIT3_STORE_DIR} && -n ${EGIT_STORE_DIR} ]]; then
  2831. ewarn "You have set EGIT_STORE_DIR but not EGIT3_STORE_DIR. Please consider";
  2832. ewarn "setting EGIT3_STORE_DIR for git-r3.eclass. It is recommended to use";
  2833. ewarn "a different directory than EGIT_STORE_DIR to ease removing old clones";
  2834. ewarn "when git-2 eclass becomes deprecated.";
  2835. fi;
  2836. _git-r3_env_setup;
  2837. git-r3_fetch
  2838. }
  2839. git-r3_src_unpack ()
  2840. {
  2841. debug-print-function ${FUNCNAME} "$@";
  2842. _git-r3_env_setup;
  2843. git-r3_src_fetch;
  2844. git-r3_checkout
  2845. }
  2846. gnome2-live_get_var ()
  2847. {
  2848. local var f;
  2849. var="$1";
  2850. f="$2";
  2851. echo $(sed -ne "s/${var}(\(.*\))/\1/p" "${f}" | tr -d '[]')
  2852. }
  2853. gnome2-live_pkg_postinst ()
  2854. {
  2855. gnome2_pkg_postinst;
  2856. ewarn "This is a live ebuild, upstream trunks will mostly be UNstable";
  2857. ewarn "Do NOT report bugs about this package to Gentoo";
  2858. ewarn "Report upstream bugs (with patches if possible) instead."
  2859. }
  2860. gnome2-live_src_prepare ()
  2861. {
  2862. if has ${EAPI:-0} 4 5; then
  2863. for i in ${PATCHES};
  2864. do
  2865. epatch "${i}";
  2866. done;
  2867. epatch_user;
  2868. fi;
  2869. if ! test -e ChangeLog; then
  2870. echo > ChangeLog;
  2871. fi;
  2872. xdg_src_prepare;
  2873. gnome2_environment_reset;
  2874. has ${EAPI:-0} 4 5 && gnome2_omf_fix
  2875. }
  2876. gnome2-live_src_unpack ()
  2877. {
  2878. if has ${EAPI:-0} 4 5; then
  2879. if test -n "${A}"; then
  2880. unpack ${A};
  2881. fi;
  2882. git-r3_src_unpack;
  2883. gnome2-live_src_prepare;
  2884. else
  2885. die "gnome2-live_src_unpack is banned starting with EAPI=6";
  2886. fi
  2887. }
  2888. gnome2_disable_deprecation_warning ()
  2889. {
  2890. local retval=0;
  2891. local fails=();
  2892. local makefile;
  2893. ebegin "Disabling deprecation warnings";
  2894. while read makefile; do
  2895. if ! grep -qE "(DISABLE_DEPRECATED|GSEAL_ENABLE)" "${makefile}"; then
  2896. continue;
  2897. fi;
  2898. LC_ALL=C sed -r -i -e 's:-D[A-Z_]+_DISABLE_DEPRECATED:$(/bin/true):g' -e 's:-DGSEAL_ENABLE(=[A-Za-z0-9_]*)?:$(/bin/true):g' -i "${makefile}";
  2899. if [[ $? -ne 0 ]]; then
  2900. fails+=("${makefile}");
  2901. retval=2;
  2902. fi;
  2903. done < <(find "${S}" -name "Makefile.in" -o -name "Makefile.am" -o -name "Makefile.decl" | sort; [[ -f "${S}"/configure ]] && echo configure);
  2904. eend ${retval};
  2905. for makefile in "${fails[@]}";
  2906. do
  2907. ewarn "Failed to disable deprecation warnings in ${makefile}";
  2908. done
  2909. }
  2910. gnome2_environment_reset ()
  2911. {
  2912. xdg_environment_reset;
  2913. export G_HOME="${T}";
  2914. export GST_REGISTRY="${T}/registry.xml";
  2915. export GSETTINGS_BACKEND="memory";
  2916. if has ${EAPI:-0} 6; then
  2917. export GST_INSPECT="$(type -P true)";
  2918. unset DISPLAY;
  2919. fi
  2920. }
  2921. gnome2_gconf_install ()
  2922. {
  2923. has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}";
  2924. local updater="${EROOT}${GCONFTOOL_BIN}";
  2925. if [[ ! -x "${updater}" ]]; then
  2926. debug-print "${updater} is not executable";
  2927. return;
  2928. fi;
  2929. if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
  2930. debug-print "No GNOME 2 GConf schemas found";
  2931. return;
  2932. fi;
  2933. unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL;
  2934. export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT};")";
  2935. einfo "Installing GNOME 2 GConf schemas";
  2936. local F;
  2937. for F in ${GNOME2_ECLASS_SCHEMAS};
  2938. do
  2939. if [[ -e "${EROOT}${F}" ]]; then
  2940. debug-print "Installing schema: ${F}";
  2941. "${updater}" --makefile-install-rule "${EROOT}${F}" > /dev/null;
  2942. fi;
  2943. done;
  2944. pids=$(pgrep -x gconfd-2);
  2945. if [[ $? == 0 ]]; then
  2946. ebegin "Reloading GConf schemas";
  2947. kill -HUP ${pids};
  2948. eend $?;
  2949. fi
  2950. }
  2951. gnome2_gconf_savelist ()
  2952. {
  2953. has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}";
  2954. pushd "${ED}" > /dev/null || die;
  2955. export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas' 2> /dev/null);
  2956. popd > /dev/null || die
  2957. }
  2958. gnome2_gconf_uninstall ()
  2959. {
  2960. has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}";
  2961. local updater="${EROOT}${GCONFTOOL_BIN}";
  2962. if [[ ! -x "${updater}" ]]; then
  2963. debug-print "${updater} is not executable";
  2964. return;
  2965. fi;
  2966. if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
  2967. debug-print "No GNOME 2 GConf schemas found";
  2968. return;
  2969. fi;
  2970. unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL;
  2971. export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT};")";
  2972. einfo "Uninstalling GNOME 2 GConf schemas";
  2973. local F;
  2974. for F in ${GNOME2_ECLASS_SCHEMAS};
  2975. do
  2976. if [[ -e "${EROOT}${F}" ]]; then
  2977. debug-print "Uninstalling gconf schema: ${F}";
  2978. "${updater}" --makefile-uninstall-rule "${EROOT}${F}" > /dev/null;
  2979. fi;
  2980. done;
  2981. pids=$(pgrep -x gconfd-2);
  2982. if [[ $? == 0 ]]; then
  2983. ebegin "Reloading GConf schemas";
  2984. kill -HUP ${pids};
  2985. eend $?;
  2986. fi
  2987. }
  2988. gnome2_gdk_pixbuf_savelist ()
  2989. {
  2990. has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}";
  2991. pushd "${ED}" > /dev/null || die;
  2992. export GNOME2_ECLASS_GDK_PIXBUF_LOADERS=$(find usr/lib*/gdk-pixbuf-2.0 -type f 2>/dev/null);
  2993. popd > /dev/null || die
  2994. }
  2995. gnome2_gdk_pixbuf_update ()
  2996. {
  2997. has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}";
  2998. local updater="${EROOT}/usr/bin/${CHOST}-gdk-pixbuf-query-loaders";
  2999. if [[ ! -x ${updater} ]]; then
  3000. updater="${EROOT}/usr/bin/gdk-pixbuf-query-loaders";
  3001. fi;
  3002. if [[ ! -x ${updater} ]]; then
  3003. debug-print "${updater} is not executable";
  3004. return;
  3005. fi;
  3006. if [[ -z ${GNOME2_ECLASS_GDK_PIXBUF_LOADERS} ]]; then
  3007. debug-print "gdk-pixbuf loader cache does not need an update";
  3008. return;
  3009. fi;
  3010. ebegin "Updating gdk-pixbuf loader cache";
  3011. local tmp_file=$(emktemp);
  3012. ${updater} > "${tmp_file}" && chmod 0644 "${tmp_file}" && cp -f "${tmp_file}" "${EROOT}usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache" && rm "${tmp_file}";
  3013. eend $?
  3014. }
  3015. gnome2_giomodule_cache_update ()
  3016. {
  3017. has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}";
  3018. local updater="${EROOT}/usr/bin/${CHOST}-gio-querymodules";
  3019. if [[ ! -x ${updater} ]]; then
  3020. updater="${EROOT}/usr/bin/gio-querymodules";
  3021. fi;
  3022. if [[ ! -x ${updater} ]]; then
  3023. debug-print "${updater} is not executable";
  3024. return;
  3025. fi;
  3026. ebegin "Updating GIO modules cache";
  3027. ${updater} "${EROOT%/}"/usr/$(get_libdir)/gio/modules;
  3028. eend $?
  3029. }
  3030. gnome2_icon_cache_update ()
  3031. {
  3032. has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}";
  3033. local updater="${EROOT}${GTK_UPDATE_ICON_CACHE}";
  3034. if [[ ! -x "${updater}" ]]; then
  3035. debug-print "${updater} is not executable";
  3036. return;
  3037. fi;
  3038. ebegin "Updating icons cache";
  3039. local retval=0;
  3040. local fails=();
  3041. for dir in "${EROOT%/}"/usr/share/icons/*;
  3042. do
  3043. if [[ -f "${dir}/index.theme" ]]; then
  3044. local rv=0;
  3045. "${updater}" -qf "${dir}";
  3046. rv=$?;
  3047. if [[ ! $rv -eq 0 ]]; then
  3048. debug-print "Updating cache failed on ${dir}";
  3049. fails+=("${dir}");
  3050. retval=2;
  3051. fi;
  3052. else
  3053. if [[ $(ls "${dir}") = "icon-theme.cache" ]]; then
  3054. rm "${dir}/icon-theme.cache";
  3055. fi;
  3056. fi;
  3057. if [[ -z $(ls "${dir}") ]]; then
  3058. rmdir "${dir}";
  3059. fi;
  3060. done;
  3061. eend ${retval};
  3062. for f in "${fails[@]}";
  3063. do
  3064. eerror "Failed to update cache with icon $f";
  3065. done
  3066. }
  3067. gnome2_icon_savelist ()
  3068. {
  3069. has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}";
  3070. pushd "${ED}" > /dev/null || die;
  3071. export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null);
  3072. popd > /dev/null || die
  3073. }
  3074. gnome2_omf_fix ()
  3075. {
  3076. local omf_makefiles filename;
  3077. omf_makefiles="$@";
  3078. if [[ -f ${S}/omf.make ]]; then
  3079. omf_makefiles="${omf_makefiles} ${S}/omf.make";
  3080. fi;
  3081. if [[ -f ${S}/gnome-doc-utils.make ]]; then
  3082. omf_makefiles="${omf_makefiles} ${S}/gnome-doc-utils.make";
  3083. fi;
  3084. for filename in $(find "${S}" -name "Makefile.in" -o -name "Makefile.am" |sort);
  3085. do
  3086. omf_makefiles="${omf_makefiles} ${filename}";
  3087. done;
  3088. ebegin "Fixing OMF Makefiles";
  3089. local retval=0;
  3090. local fails=();
  3091. for omf in ${omf_makefiles};
  3092. do
  3093. sed -i -e 's:scrollkeeper-update:true:' "${omf}";
  3094. retval=$?;
  3095. if [[ $retval -ne 0 ]]; then
  3096. debug-print "updating of ${omf} failed";
  3097. fails[$(( ${#fails[@]} + 1 ))]=$omf;
  3098. retval=2;
  3099. fi;
  3100. done;
  3101. eend $retval;
  3102. for f in "${fails[@]}";
  3103. do
  3104. eerror "Failed to update OMF Makefile $f";
  3105. done
  3106. }
  3107. gnome2_pkg_postinst ()
  3108. {
  3109. xdg_pkg_postinst;
  3110. gnome2_gconf_install;
  3111. if [[ -n ${GNOME2_ECLASS_ICONS} ]]; then
  3112. gnome2_icon_cache_update;
  3113. fi;
  3114. gnome2_schemas_update;
  3115. gnome2_scrollkeeper_update;
  3116. gnome2_gdk_pixbuf_update;
  3117. if [[ ${#GNOME2_ECLASS_GIO_MODULES[@]} -gt 0 ]]; then
  3118. gnome2_giomodule_cache_update;
  3119. fi
  3120. }
  3121. gnome2_pkg_postrm ()
  3122. {
  3123. xdg_pkg_postrm;
  3124. gnome2_icon_cache_update;
  3125. gnome2_schemas_update;
  3126. gnome2_scrollkeeper_update;
  3127. if [[ ${#GNOME2_ECLASS_GIO_MODULES[@]} -gt 0 ]]; then
  3128. gnome2_giomodule_cache_update;
  3129. fi
  3130. }
  3131. gnome2_pkg_preinst ()
  3132. {
  3133. xdg_pkg_preinst;
  3134. gnome2_gconf_savelist;
  3135. gnome2_icon_savelist;
  3136. gnome2_schemas_savelist;
  3137. gnome2_scrollkeeper_savelist;
  3138. gnome2_gdk_pixbuf_savelist;
  3139. local f;
  3140. GNOME2_ECLASS_GIO_MODULES=();
  3141. while IFS= read -r -d '' f; do
  3142. GNOME2_ECLASS_GIO_MODULES+=(${f});
  3143. done < <(cd "${D}" && find usr/$(get_libdir)/gio/modules -type f -print0 2>/dev/null);
  3144. export GNOME2_ECLASS_GIO_MODULES
  3145. }
  3146. gnome2_query_immodules_gtk2 ()
  3147. {
  3148. local updater=${EPREFIX}/usr/bin/${CHOST}-gtk-query-immodules-2.0;
  3149. [[ ! -x ${updater} ]] && updater=${EPREFIX}/usr/bin/gtk-query-immodules-2.0;
  3150. ebegin "Updating gtk2 input method module cache";
  3151. GTK_IM_MODULE_FILE="${EROOT}usr/$(get_libdir)/gtk-2.0/2.10.0/immodules.cache" "${updater}" --update-cache;
  3152. eend $?
  3153. }
  3154. gnome2_query_immodules_gtk3 ()
  3155. {
  3156. local updater=${EPREFIX}/usr/bin/${CHOST}-gtk-query-immodules-3.0;
  3157. [[ ! -x ${updater} ]] && updater=${EPREFIX}/usr/bin/gtk-query-immodules-3.0;
  3158. ebegin "Updating gtk3 input method module cache";
  3159. GTK_IM_MODULE_FILE="${EROOT}usr/$(get_libdir)/gtk-3.0/3.0.0/immodules.cache" "${updater}" --update-cache;
  3160. eend $?
  3161. }
  3162. gnome2_schemas_savelist ()
  3163. {
  3164. has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}";
  3165. pushd "${ED}" > /dev/null || die;
  3166. export GNOME2_ECLASS_GLIB_SCHEMAS=$(find 'usr/share/glib-2.0/schemas' -name '*.gschema.xml' 2>/dev/null);
  3167. popd > /dev/null || die
  3168. }
  3169. gnome2_schemas_update ()
  3170. {
  3171. has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}";
  3172. local updater="${EROOT}${GLIB_COMPILE_SCHEMAS}";
  3173. if [[ ! -x ${updater} ]]; then
  3174. debug-print "${updater} is not executable";
  3175. return;
  3176. fi;
  3177. if [[ -z ${GNOME2_ECLASS_GLIB_SCHEMAS} ]]; then
  3178. debug-print "No GSettings schemas to update";
  3179. return;
  3180. fi;
  3181. ebegin "Updating GSettings schemas";
  3182. ${updater} --allow-any-name "$@" "${EROOT%/}/usr/share/glib-2.0/schemas" &> /dev/null;
  3183. eend $?
  3184. }
  3185. gnome2_scrollkeeper_savelist ()
  3186. {
  3187. has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}";
  3188. pushd "${ED}" > /dev/null || die;
  3189. export GNOME2_ECLASS_SCROLLS=$(find 'usr/share/omf' -type f -name "*.omf" 2> /dev/null);
  3190. popd > /dev/null || die
  3191. }
  3192. gnome2_scrollkeeper_update ()
  3193. {
  3194. has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}";
  3195. local updater="${EROOT}${SCROLLKEEPER_UPDATE_BIN}";
  3196. if [[ ! -x "${updater}" ]]; then
  3197. debug-print "${updater} is not executable";
  3198. return;
  3199. fi;
  3200. if [[ -z "${GNOME2_ECLASS_SCROLLS}" ]]; then
  3201. debug-print "No scroll cache to update";
  3202. return;
  3203. fi;
  3204. ebegin "Updating scrollkeeper database ...";
  3205. "${updater}" -q -p "${EROOT}${SCROLLKEEPER_DIR}";
  3206. eend $?
  3207. }
  3208. gnome2_src_compile ()
  3209. {
  3210. if has ${EAPI:-0} 4 5; then
  3211. emake;
  3212. else
  3213. default;
  3214. fi
  3215. }
  3216. gnome2_src_configure ()
  3217. {
  3218. if [[ -n ${G2CONF} ]]; then
  3219. if has ${EAPI:-0} 4 5; then
  3220. eqawarn "G2CONF set, please review documentation at https://wiki.gentoo.org/wiki/Project:GNOME/Gnome_Team_Ebuild_Policies#G2CONF_and_src_configure";
  3221. else
  3222. die "G2CONF set, please review documentation at https://wiki.gentoo.org/wiki/Project:GNOME/Gnome_Team_Ebuild_Policies#G2CONF_and_src_configure";
  3223. fi;
  3224. fi;
  3225. local g2conf=();
  3226. if has ${EAPI:-0} 4 5; then
  3227. if [[ ${GCONF_DEBUG} != 'no' ]]; then
  3228. if use debug; then
  3229. g2conf+=(--enable-debug=yes);
  3230. fi;
  3231. fi;
  3232. else
  3233. if [[ -n ${GCONF_DEBUG} ]]; then
  3234. die "GCONF_DEBUG is banned since eapi6 in favor of each ebuild taking care of the proper handling of debug configure option";
  3235. fi;
  3236. fi;
  3237. if grep -q "enable-gtk-doc" "${ECONF_SOURCE:-.}"/configure; then
  3238. if has ${EAPI:-0} 4 && in_iuse doc; then
  3239. g2conf+=($(use_enable doc gtk-doc));
  3240. else
  3241. g2conf+=(--disable-gtk-doc);
  3242. fi;
  3243. fi;
  3244. if grep -q "^[[:space:]]*AM_MAINTAINER_MODE(\[enable\])" "${ECONF_SOURCE:-.}"/configure.*; then
  3245. g2conf+=(--disable-maintainer-mode);
  3246. fi;
  3247. if grep -q "disable-scrollkeeper" "${ECONF_SOURCE:-.}"/configure; then
  3248. g2conf+=(--disable-scrollkeeper);
  3249. fi;
  3250. if has ${EAPI:-0} 4; then
  3251. if grep -q "disable-silent-rules" "${ECONF_SOURCE:-.}"/configure; then
  3252. g2conf+=(--disable-silent-rules);
  3253. fi;
  3254. fi;
  3255. if grep -q "disable-schemas-install" "${ECONF_SOURCE:-.}"/configure; then
  3256. g2conf+=(--disable-schemas-install);
  3257. fi;
  3258. if grep -q "disable-schemas-compile" "${ECONF_SOURCE:-.}"/configure; then
  3259. g2conf+=(--disable-schemas-compile);
  3260. fi;
  3261. if grep -q "disable-update-mimedb" "${ECONF_SOURCE:-.}"/configure; then
  3262. g2conf+=(--disable-update-mimedb);
  3263. fi;
  3264. if grep -q "enable-compile-warnings" "${ECONF_SOURCE:-.}"/configure; then
  3265. g2conf+=(--enable-compile-warnings=minimum);
  3266. fi;
  3267. if has ${EAPI:-0} 4 5; then
  3268. if grep -q "^ *--docdir=" "${ECONF_SOURCE:-.}"/configure; then
  3269. g2conf+=(--docdir="${EPREFIX}"/usr/share/doc/${PF});
  3270. fi;
  3271. fi;
  3272. if has ${EAPI:-0} 4 5; then
  3273. addwrite "$(unset HOME; echo ~)/.gnome2";
  3274. else
  3275. addpredict "$(unset HOME; echo ~)/.gnome2";
  3276. fi;
  3277. if has ${EAPI:-0} 4 5; then
  3278. econf ${g2conf[@]} ${G2CONF} "$@";
  3279. else
  3280. econf ${g2conf[@]} "$@";
  3281. fi
  3282. }
  3283. gnome2_src_install ()
  3284. {
  3285. export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL="1";
  3286. local sk_tmp_dir="/var/lib/scrollkeeper";
  3287. if has ${EAPI:-0} 4 5; then
  3288. dodir "${sk_tmp_dir}" || die "dodir failed";
  3289. emake DESTDIR="${D}" "scrollkeeper_localstate_dir=${ED}${sk_tmp_dir} " "$@" install || die "install failed";
  3290. else
  3291. default;
  3292. fi;
  3293. unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL;
  3294. if has ${EAPI:-0} 4; then
  3295. if [[ -n "${DOCS}" ]]; then
  3296. dodoc ${DOCS} || die "dodoc failed";
  3297. fi;
  3298. else
  3299. if has ${EAPI:-0} 5; then
  3300. einstalldocs;
  3301. else
  3302. local d;
  3303. for d in HACKING MAINTAINERS;
  3304. do
  3305. [[ -s "${d}" ]] && dodoc "${d}";
  3306. done;
  3307. fi;
  3308. fi;
  3309. rm -rf "${ED}${sk_tmp_dir}";
  3310. rmdir "${ED}/var/lib" 2> /dev/null;
  3311. rmdir "${ED}/var" 2> /dev/null;
  3312. rm -fr "${ED}/usr/share/applications/mimeinfo.cache";
  3313. if has ${EAPI:-0} 4; then
  3314. if [[ "${GNOME2_LA_PUNT}" != "no" ]]; then
  3315. ebegin "Removing .la files";
  3316. if ! use_if_iuse static-libs; then
  3317. find "${D}" -name '*.la' -exec rm -f {} + || die "la file removal failed";
  3318. fi;
  3319. eend;
  3320. fi;
  3321. else
  3322. case "${GNOME2_LA_PUNT}" in
  3323. yes)
  3324. prune_libtool_files --modules
  3325. ;;
  3326. no)
  3327.  
  3328. ;;
  3329. *)
  3330. prune_libtool_files
  3331. ;;
  3332. esac;
  3333. fi
  3334. }
  3335. gnome2_src_prepare ()
  3336. {
  3337. gnome2-live_src_prepare
  3338. }
  3339. gnome2_src_unpack ()
  3340. {
  3341. gnome2-live_src_unpack
  3342. }
  3343. has_multilib_profile ()
  3344. {
  3345. [ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ]
  3346. }
  3347. host-is-pax ()
  3348. {
  3349. grep -qs ^PaX: /proc/self/status
  3350. }
  3351. in_iuse ()
  3352. {
  3353. local use=${1};
  3354. if [[ -z "${use}" ]]; then
  3355. echo "!!! in_iuse() called without a parameter." 1>&2;
  3356. echo "!!! in_iuse <USEFLAG>" 1>&2;
  3357. die "in_iuse() called without a parameter";
  3358. fi;
  3359. local liuse=(${IUSE_EFFECTIVE});
  3360. has "${use}" "${liuse[@]#[+-]}"
  3361. }
  3362. is_final_abi ()
  3363. {
  3364. has_multilib_profile || return 0;
  3365. set -- $(get_install_abis);
  3366. local LAST_ABI=$#;
  3367. [[ ${!LAST_ABI} == ${ABI} ]]
  3368. }
  3369. isdigit ()
  3370. {
  3371. local d;
  3372. for d in "$@";
  3373. do
  3374. [[ ${d:-bad} == *[!0-9]* ]] && return 1;
  3375. done;
  3376. return 0
  3377. }
  3378. list-paxables ()
  3379. {
  3380. file "$@" 2> /dev/null | grep -E 'ELF.*(executable|shared object)' | sed -e 's/: .*$//'
  3381. }
  3382. make_desktop_entry ()
  3383. {
  3384. [[ -z $1 ]] && die "make_desktop_entry: You must specify the executable";
  3385. local exec=${1};
  3386. local name=${2:-${PN}};
  3387. local icon=${3:-${PN}};
  3388. local type=${4};
  3389. local fields=${5};
  3390. if [[ -z ${type} ]]; then
  3391. local catmaj=${CATEGORY%%-*};
  3392. local catmin=${CATEGORY##*-};
  3393. case ${catmaj} in
  3394. app)
  3395. case ${catmin} in
  3396. accessibility)
  3397. type="Utility;Accessibility"
  3398. ;;
  3399. admin)
  3400. type=System
  3401. ;;
  3402. antivirus)
  3403. type=System
  3404. ;;
  3405. arch)
  3406. type="Utility;Archiving"
  3407. ;;
  3408. backup)
  3409. type="Utility;Archiving"
  3410. ;;
  3411. cdr)
  3412. type="AudioVideo;DiscBurning"
  3413. ;;
  3414. dicts)
  3415. type="Office;Dictionary"
  3416. ;;
  3417. doc)
  3418. type=Documentation
  3419. ;;
  3420. editors)
  3421. type="Utility;TextEditor"
  3422. ;;
  3423. emacs)
  3424. type="Development;TextEditor"
  3425. ;;
  3426. emulation)
  3427. type="System;Emulator"
  3428. ;;
  3429. laptop)
  3430. type="Settings;HardwareSettings"
  3431. ;;
  3432. office)
  3433. type=Office
  3434. ;;
  3435. pda)
  3436. type="Office;PDA"
  3437. ;;
  3438. vim)
  3439. type="Development;TextEditor"
  3440. ;;
  3441. xemacs)
  3442. type="Development;TextEditor"
  3443. ;;
  3444. esac
  3445. ;;
  3446. dev)
  3447. type="Development"
  3448. ;;
  3449. games)
  3450. case ${catmin} in
  3451. action | fps)
  3452. type=ActionGame
  3453. ;;
  3454. arcade)
  3455. type=ArcadeGame
  3456. ;;
  3457. board)
  3458. type=BoardGame
  3459. ;;
  3460. emulation)
  3461. type=Emulator
  3462. ;;
  3463. kids)
  3464. type=KidsGame
  3465. ;;
  3466. puzzle)
  3467. type=LogicGame
  3468. ;;
  3469. roguelike)
  3470. type=RolePlaying
  3471. ;;
  3472. rpg)
  3473. type=RolePlaying
  3474. ;;
  3475. simulation)
  3476. type=Simulation
  3477. ;;
  3478. sports)
  3479. type=SportsGame
  3480. ;;
  3481. strategy)
  3482. type=StrategyGame
  3483. ;;
  3484. esac;
  3485. type="Game;${type}"
  3486. ;;
  3487. gnome)
  3488. type="Gnome;GTK"
  3489. ;;
  3490. kde)
  3491. type="KDE;Qt"
  3492. ;;
  3493. mail)
  3494. type="Network;Email"
  3495. ;;
  3496. media)
  3497. case ${catmin} in
  3498. gfx)
  3499. type=Graphics
  3500. ;;
  3501. *)
  3502. case ${catmin} in
  3503. radio)
  3504. type=Tuner
  3505. ;;
  3506. sound)
  3507. type=Audio
  3508. ;;
  3509. tv)
  3510. type=TV
  3511. ;;
  3512. video)
  3513. type=Video
  3514. ;;
  3515. esac;
  3516. type="AudioVideo;${type}"
  3517. ;;
  3518. esac
  3519. ;;
  3520. net)
  3521. case ${catmin} in
  3522. dialup)
  3523. type=Dialup
  3524. ;;
  3525. ftp)
  3526. type=FileTransfer
  3527. ;;
  3528. im)
  3529. type=InstantMessaging
  3530. ;;
  3531. irc)
  3532. type=IRCClient
  3533. ;;
  3534. mail)
  3535. type=Email
  3536. ;;
  3537. news)
  3538. type=News
  3539. ;;
  3540. nntp)
  3541. type=News
  3542. ;;
  3543. p2p)
  3544. type=FileTransfer
  3545. ;;
  3546. voip)
  3547. type=Telephony
  3548. ;;
  3549. esac;
  3550. type="Network;${type}"
  3551. ;;
  3552. sci)
  3553. case ${catmin} in
  3554. astro*)
  3555. type=Astronomy
  3556. ;;
  3557. bio*)
  3558. type=Biology
  3559. ;;
  3560. calc*)
  3561. type=Calculator
  3562. ;;
  3563. chem*)
  3564. type=Chemistry
  3565. ;;
  3566. elec*)
  3567. type=Electronics
  3568. ;;
  3569. geo*)
  3570. type=Geology
  3571. ;;
  3572. math*)
  3573. type=Math
  3574. ;;
  3575. physics)
  3576. type=Physics
  3577. ;;
  3578. visual*)
  3579. type=DataVisualization
  3580. ;;
  3581. esac;
  3582. type="Education;Science;${type}"
  3583. ;;
  3584. sys)
  3585. type="System"
  3586. ;;
  3587. www)
  3588. case ${catmin} in
  3589. client)
  3590. type=WebBrowser
  3591. ;;
  3592. esac;
  3593. type="Network;${type}"
  3594. ;;
  3595. *)
  3596. type=
  3597. ;;
  3598. esac;
  3599. fi;
  3600. local slot=${SLOT%/*};
  3601. if [[ ${slot} == "0" ]]; then
  3602. local desktop_name="${PN}";
  3603. else
  3604. local desktop_name="${PN}-${slot}";
  3605. fi;
  3606. local desktop="${T}/$(echo ${exec} | sed 's:[[:space:]/:]:_:g')-${desktop_name}.desktop";
  3607. type=${type%;}${type:+;};
  3608. if [[ -n ${icon} && ${icon} != /* ]] && [[ ${icon} == *.xpm || ${icon} == *.png || ${icon} == *.svg ]]; then
  3609. ewarn "As described in the Icon Theme Specification, icon file extensions are not";
  3610. ewarn "allowed in .desktop files if the value is not an absolute path.";
  3611. icon=${icon%.*};
  3612. fi;
  3613. cat > "${desktop}" <<-EOF
  3614. [Desktop Entry]
  3615. Name=${name}
  3616. Type=Application
  3617. Comment=${DESCRIPTION}
  3618. Exec=${exec}
  3619. TryExec=${exec%% *}
  3620. Icon=${icon}
  3621. Categories=${type}
  3622. EOF
  3623.  
  3624. if [[ ${fields:-=} != *=* ]]; then
  3625. ewarn "make_desktop_entry: update your 5th arg to read Path=${fields}";
  3626. fields="Path=${fields}";
  3627. fi;
  3628. [[ -n ${fields} ]] && printf '%b\n' "${fields}" >> "${desktop}";
  3629. ( insinto /usr/share/applications;
  3630. doins "${desktop}" ) || die "installing desktop file failed"
  3631. }
  3632. make_session_desktop ()
  3633. {
  3634. [[ -z $1 ]] && eerror "$0: You must specify the title" && return 1;
  3635. [[ -z $2 ]] && eerror "$0: You must specify the command" && return 1;
  3636. local title=$1;
  3637. local command=$2;
  3638. local desktop=${T}/${wm:-${PN}}.desktop;
  3639. shift 2;
  3640. cat > "${desktop}" <<-EOF
  3641. [Desktop Entry]
  3642. Name=${title}
  3643. Comment=This session logs you into ${title}
  3644. Exec=${command} $*
  3645. TryExec=${command}
  3646. Type=XSession
  3647. EOF
  3648.  
  3649. ( insinto /usr/share/xsessions;
  3650. doins "${desktop}" )
  3651. }
  3652. make_wrapper ()
  3653. {
  3654. _eutils_eprefix_init;
  3655. local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5;
  3656. local tmpwrapper=$(emktemp);
  3657. ( echo '#!/bin/sh';
  3658. [[ -n ${chdir} ]] && printf 'cd "%s"\n' "${EPREFIX}${chdir}";
  3659. if [[ -n ${libdir} ]]; then
  3660. local var;
  3661. if [[ ${CHOST} == *-darwin* ]]; then
  3662. var=DYLD_LIBRARY_PATH;
  3663. else
  3664. var=LD_LIBRARY_PATH;
  3665. fi;
  3666. cat <<-EOF
  3667. if [ "\${${var}+set}" = "set" ] ; then
  3668. export ${var}="\${${var}}:${EPREFIX}${libdir}"
  3669. else
  3670. export ${var}="${EPREFIX}${libdir}"
  3671. fi
  3672. EOF
  3673.  
  3674. fi
  3675. printf 'exec %s "$@"\n' "${bin/#\//${EPREFIX}/}" ) > "${tmpwrapper}";
  3676. chmod go+rx "${tmpwrapper}";
  3677. if [[ -n ${path} ]]; then
  3678. ( exeinto "${path}";
  3679. newexe "${tmpwrapper}" "${wrapper}" ) || die;
  3680. else
  3681. newbin "${tmpwrapper}" "${wrapper}" || die;
  3682. fi
  3683. }
  3684. makeopts_jobs ()
  3685. {
  3686. [[ $# -eq 0 ]] && set -- "${MAKEOPTS}";
  3687. local jobs=$(echo " $* " | sed -r -n -e 's:.*[[:space:]](-[a-z]*j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p' -e "s:.*[[:space:]](-[a-z]*j|--jobs)[[:space:]].*:${2:-999}:p");
  3688. echo ${jobs:-1}
  3689. }
  3690. makeopts_loadavg ()
  3691. {
  3692. [[ $# -eq 0 ]] && set -- "${MAKEOPTS}";
  3693. local lavg=$(echo " $* " | sed -r -n -e 's:.*[[:space:]](-[a-z]*l|--(load-average|max-load)[=[:space:]])[[:space:]]*([0-9]+|[0-9]+\.[0-9]+).*:\3:p' -e "s:.*[[:space:]](-[a-z]*l|--(load-average|max-load))[[:space:]].*:${2:-999}:p");
  3694. echo ${lavg:-${2:-999}}
  3695. }
  3696. meson_src_compile ()
  3697. {
  3698. debug-print-function ${FUNCNAME} "$@";
  3699. eninja -C "${BUILD_DIR}"
  3700. }
  3701. meson_src_configure ()
  3702. {
  3703. debug-print-function ${FUNCNAME} "$@";
  3704. local mesonargs=(--buildtype plain --libdir "$(get_libdir)" --localstatedir "${EPREFIX}/var/lib" --prefix "${EPREFIX}/usr" --sysconfdir "${EPREFIX}/etc" --wrap-mode nodownload);
  3705. local -x AR=$(tc-getAR);
  3706. local -x CC=$(tc-getCC);
  3707. local -x CXX=$(tc-getCXX);
  3708. local -x STRIP=$(tc-getSTRIP);
  3709. if tc-is-cross-compiler; then
  3710. _meson_create_cross_file || die "unable to write meson cross file";
  3711. mesonargs+=(--cross-file "${T}/meson.${CHOST}");
  3712. AR=$(tc-getBUILD_AR);
  3713. CC=$(tc-getBUILD_CC);
  3714. CXX=$(tc-getBUILD_CXX);
  3715. STRIP=$(tc-getBUILD_STRIP);
  3716. fi;
  3717. python_export_utf8_locale;
  3718. mesonargs+=("${emesonargs[@]}");
  3719. BUILD_DIR="${BUILD_DIR:-${WORKDIR}/${P}-build}";
  3720. set -- meson "${mesonargs[@]}" "$@" "${EMESON_SOURCE:-${S}}" "${BUILD_DIR}";
  3721. echo "$@";
  3722. "$@" || die
  3723. }
  3724. meson_src_install ()
  3725. {
  3726. debug-print-function ${FUNCNAME} "$@";
  3727. DESTDIR="${D}" eninja -C "${BUILD_DIR}" install;
  3728. einstalldocs
  3729. }
  3730. meson_src_test ()
  3731. {
  3732. debug-print-function ${FUNCNAME} "$@";
  3733. eninja -C "${BUILD_DIR}" test
  3734. }
  3735. multibuild_copy_sources ()
  3736. {
  3737. debug-print-function ${FUNCNAME} "${@}";
  3738. local _MULTIBUILD_INITIAL_BUILD_DIR=${BUILD_DIR:-${S}};
  3739. einfo "Will copy sources from ${_MULTIBUILD_INITIAL_BUILD_DIR}";
  3740. local cp_args=();
  3741. if cp --reflink=auto --version &> /dev/null; then
  3742. cp_args+=(--reflink=auto);
  3743. fi;
  3744. function _multibuild_create_source_copy ()
  3745. {
  3746. einfo "${MULTIBUILD_VARIANT}: copying to ${BUILD_DIR}";
  3747. cp -p -R "${cp_args[@]}" "${_MULTIBUILD_INITIAL_BUILD_DIR}" "${BUILD_DIR}" || die
  3748. };
  3749. multibuild_foreach_variant _multibuild_create_source_copy
  3750. }
  3751. multibuild_for_best_variant ()
  3752. {
  3753. debug-print-function ${FUNCNAME} "${@}";
  3754. [[ -n ${MULTIBUILD_VARIANTS} ]] || die "MULTIBUILD_VARIANTS need to be set";
  3755. local MULTIBUILD_VARIANTS=("${MULTIBUILD_VARIANTS[$(( ${#MULTIBUILD_VARIANTS[@]} - 1 ))]}");
  3756. multibuild_foreach_variant "${@}"
  3757. }
  3758. multibuild_foreach_variant ()
  3759. {
  3760. debug-print-function ${FUNCNAME} "${@}";
  3761. [[ -n ${MULTIBUILD_VARIANTS} ]] || die "MULTIBUILD_VARIANTS need to be set";
  3762. local bdir=${BUILD_DIR:-${S}};
  3763. [[ ${bdir%%/} == ${WORKDIR%%/} ]] && bdir=${WORKDIR}/build;
  3764. local prev_id=${MULTIBUILD_ID:+${MULTIBUILD_ID}-};
  3765. local ret=0 lret=0 v;
  3766. debug-print "${FUNCNAME}: initial build_dir = ${bdir}";
  3767. for v in "${MULTIBUILD_VARIANTS[@]}";
  3768. do
  3769. local MULTIBUILD_VARIANT=${v};
  3770. local MULTIBUILD_ID=${prev_id}${v};
  3771. local BUILD_DIR=${bdir%%/}-${v};
  3772. function _multibuild_run ()
  3773. {
  3774. local i=1;
  3775. while [[ ${!i} == _* ]]; do
  3776. (( i += 1 ));
  3777. done;
  3778. [[ ${i} -le ${#} ]] && einfo "${v}: running ${@:${i}}";
  3779. "${@}"
  3780. };
  3781. _multibuild_run "${@}" > >(exec tee -a "${T}/build-${MULTIBUILD_ID}.log") 2>&1;
  3782. lret=${?};
  3783. done;
  3784. [[ ${ret} -eq 0 && ${lret} -ne 0 ]] && ret=${lret};
  3785. return ${ret}
  3786. }
  3787. multibuild_merge_root ()
  3788. {
  3789. local src=${1};
  3790. local dest=${2};
  3791. local ret;
  3792. if use userland_BSD; then
  3793. tar -C "${src}" -f - -c . | tar -x -f - -C "${dest}";
  3794. [[ ${PIPESTATUS[*]} == '0 0' ]];
  3795. ret=${?};
  3796. else
  3797. local cp_args=();
  3798. if cp -a --version &> /dev/null; then
  3799. cp_args+=(-a);
  3800. else
  3801. cp_args+=(-P -R -p);
  3802. fi;
  3803. if cp --reflink=auto --version &> /dev/null; then
  3804. cp_args+=(--reflink=auto);
  3805. fi;
  3806. cp "${cp_args[@]}" "${src}"/. "${dest}"/;
  3807. ret=${?};
  3808. fi;
  3809. if [[ ${ret} -ne 0 ]]; then
  3810. die "${MULTIBUILD_VARIANT:-(unknown)}: merging image failed.";
  3811. fi;
  3812. rm -rf "${src}"
  3813. }
  3814. multibuild_parallel_foreach_variant ()
  3815. {
  3816. debug-print-function ${FUNCNAME} "${@}";
  3817. [[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}";
  3818. multibuild_foreach_variant "${@}"
  3819. }
  3820. multijob_child_init ()
  3821. {
  3822. local mode="pre";
  3823. case $1 in
  3824. --pre)
  3825. mode="pre";
  3826. shift
  3827. ;;
  3828. --post)
  3829. mode="post";
  3830. shift
  3831. ;;
  3832. esac;
  3833. if [[ $# -eq 0 ]]; then
  3834. trap 'echo ${BASHPID:-$(bashpid)} $? >&'${mj_write_fd} EXIT;
  3835. trap 'exit 1' INT TERM;
  3836. else
  3837. local ret;
  3838. [[ ${mode} == "pre" ]] && {
  3839. multijob_pre_fork;
  3840. ret=$?
  3841. };
  3842. ( multijob_child_init;
  3843. "$@" ) & [[ ${mode} == "post" ]] && {
  3844. multijob_post_fork;
  3845. ret=$?
  3846. };
  3847. return ${ret};
  3848. fi
  3849. }
  3850. multijob_finish ()
  3851. {
  3852. local ret=0;
  3853. while [[ ${mj_num_jobs} -gt 0 ]]; do
  3854. multijob_finish_one;
  3855. : $(( ret |= $? ));
  3856. done;
  3857. wait;
  3858. [[ $# -eq 0 ]] || die "${FUNCNAME} takes no arguments";
  3859. EBUILD_DEATH_HOOKS=${EBUILD_DEATH_HOOKS/ wait / };
  3860. return ${ret}
  3861. }
  3862. multijob_finish_one ()
  3863. {
  3864. [[ $# -eq 0 ]] || die "${FUNCNAME} takes no arguments";
  3865. local pid ret;
  3866. read -r -u ${mj_read_fd} pid ret || die;
  3867. : $(( --mj_num_jobs ));
  3868. return ${ret}
  3869. }
  3870. multijob_init ()
  3871. {
  3872. has wait ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS+=" wait ";
  3873. local pipe="${T}/multijob.pipe";
  3874. mkfifo -m 600 "${pipe}";
  3875. redirect_alloc_fd mj_read_fd "${pipe}";
  3876. redirect_alloc_fd mj_write_fd "${pipe}" '>';
  3877. rm -f "${pipe}";
  3878. mj_max_jobs=$(makeopts_jobs "$@");
  3879. mj_num_jobs=0
  3880. }
  3881. multijob_post_fork ()
  3882. {
  3883. _multijob_fork post "$@"
  3884. }
  3885. multijob_pre_fork ()
  3886. {
  3887. _multijob_fork pre "$@"
  3888. }
  3889. multilib_env ()
  3890. {
  3891. local CTARGET=${1:-${CTARGET}};
  3892. local cpu=${CTARGET%%*-};
  3893. case ${cpu} in
  3894. aarch64*)
  3895. export CFLAGS_arm=${CFLAGS_arm-};
  3896. case ${cpu} in
  3897. aarch64*be)
  3898. export CHOST_arm="armv8b-${CTARGET#*-}"
  3899. ;;
  3900. *)
  3901. export CHOST_arm="armv8l-${CTARGET#*-}"
  3902. ;;
  3903. esac;
  3904. CHOST_arm=${CHOST_arm/%-gnu/-gnueabi};
  3905. export CTARGET_arm=${CHOST_arm};
  3906. export LIBDIR_arm="lib";
  3907. export CFLAGS_arm64=${CFLAGS_arm64-};
  3908. export CHOST_arm64=${CTARGET};
  3909. export CTARGET_arm64=${CHOST_arm64};
  3910. export LIBDIR_arm64="lib64";
  3911. : ${MULTILIB_ABIS=arm64};
  3912. : ${DEFAULT_ABI=arm64}
  3913. ;;
  3914. x86_64*)
  3915. export CFLAGS_x86=${CFLAGS_x86--m32};
  3916. export CHOST_x86=${CTARGET/x86_64/i686};
  3917. CHOST_x86=${CHOST_x86/%-gnux32/-gnu};
  3918. export CTARGET_x86=${CHOST_x86};
  3919. if [[ ${SYMLINK_LIB} == "yes" ]]; then
  3920. export LIBDIR_x86="lib32";
  3921. else
  3922. export LIBDIR_x86="lib";
  3923. fi;
  3924. export CFLAGS_amd64=${CFLAGS_amd64--m64};
  3925. export CHOST_amd64=${CTARGET/%-gnux32/-gnu};
  3926. export CTARGET_amd64=${CHOST_amd64};
  3927. export LIBDIR_amd64="lib64";
  3928. export CFLAGS_x32=${CFLAGS_x32--mx32};
  3929. export CHOST_x32=${CTARGET/%-gnu/-gnux32};
  3930. export CTARGET_x32=${CHOST_x32};
  3931. export LIBDIR_x32="libx32";
  3932. case ${CTARGET} in
  3933. *-gnux32)
  3934. : ${MULTILIB_ABIS=x32 amd64 x86};
  3935. : ${DEFAULT_ABI=x32}
  3936. ;;
  3937. *)
  3938. : ${MULTILIB_ABIS=amd64 x86};
  3939. : ${DEFAULT_ABI=amd64}
  3940. ;;
  3941. esac
  3942. ;;
  3943. mips64*)
  3944. export CFLAGS_o32=${CFLAGS_o32--mabi=32};
  3945. export CHOST_o32=${CTARGET/mips64/mips};
  3946. export CTARGET_o32=${CHOST_o32};
  3947. export LIBDIR_o32="lib";
  3948. export CFLAGS_n32=${CFLAGS_n32--mabi=n32};
  3949. export CHOST_n32=${CTARGET};
  3950. export CTARGET_n32=${CHOST_n32};
  3951. export LIBDIR_n32="lib32";
  3952. export CFLAGS_n64=${CFLAGS_n64--mabi=64};
  3953. export CHOST_n64=${CTARGET};
  3954. export CTARGET_n64=${CHOST_n64};
  3955. export LIBDIR_n64="lib64";
  3956. : ${MULTILIB_ABIS=n64 n32 o32};
  3957. : ${DEFAULT_ABI=n32}
  3958. ;;
  3959. powerpc64*)
  3960. export CFLAGS_ppc=${CFLAGS_ppc--m32};
  3961. export CHOST_ppc=${CTARGET/powerpc64/powerpc};
  3962. export CTARGET_ppc=${CHOST_ppc};
  3963. export LIBDIR_ppc="lib";
  3964. export CFLAGS_ppc64=${CFLAGS_ppc64--m64};
  3965. export CHOST_ppc64=${CTARGET};
  3966. export CTARGET_ppc64=${CHOST_ppc64};
  3967. export LIBDIR_ppc64="lib64";
  3968. : ${MULTILIB_ABIS=ppc64 ppc};
  3969. : ${DEFAULT_ABI=ppc64}
  3970. ;;
  3971. s390x*)
  3972. export CFLAGS_s390=${CFLAGS_s390--m31};
  3973. export CHOST_s390=${CTARGET/s390x/s390};
  3974. export CTARGET_s390=${CHOST_s390};
  3975. export LIBDIR_s390="lib";
  3976. export CFLAGS_s390x=${CFLAGS_s390x--m64};
  3977. export CHOST_s390x=${CTARGET};
  3978. export CTARGET_s390x=${CHOST_s390x};
  3979. export LIBDIR_s390x="lib64";
  3980. : ${MULTILIB_ABIS=s390x s390};
  3981. : ${DEFAULT_ABI=s390x}
  3982. ;;
  3983. sparc64*)
  3984. export CFLAGS_sparc32=${CFLAGS_sparc32--m32};
  3985. export CHOST_sparc32=${CTARGET/sparc64/sparc};
  3986. export CTARGET_sparc32=${CHOST_sparc32};
  3987. export LIBDIR_sparc32="lib";
  3988. export CFLAGS_sparc64=${CFLAGS_sparc64--m64};
  3989. export CHOST_sparc64=${CTARGET};
  3990. export CTARGET_sparc64=${CHOST_sparc64};
  3991. export LIBDIR_sparc64="lib64";
  3992. : ${MULTILIB_ABIS=sparc64 sparc32};
  3993. : ${DEFAULT_ABI=sparc64}
  3994. ;;
  3995. *)
  3996. : ${MULTILIB_ABIS=default};
  3997. : ${DEFAULT_ABI=default}
  3998. ;;
  3999. esac;
  4000. export MULTILIB_ABIS DEFAULT_ABI
  4001. }
  4002. multilib_src_compile ()
  4003. {
  4004. cd "${BUILD_DIR}";
  4005. meson_src_compile
  4006. }
  4007. multilib_src_install ()
  4008. {
  4009. cd "${BUILD_DIR}";
  4010. DESTDIR="${D}" eninja install
  4011. }
  4012. multilib_toolchain_setup ()
  4013. {
  4014. local v vv;
  4015. export ABI=$1;
  4016. if [[ ${_DEFAULT_ABI_SAVED} == "true" ]]; then
  4017. for v in CHOST CBUILD AS CC CXX F77 FC LD PKG_CONFIG_{LIBDIR,PATH};
  4018. do
  4019. vv="_abi_saved_${v}";
  4020. [[ ${!vv+set} == "set" ]] && export ${v}="${!vv}" || unset ${v};
  4021. unset ${vv};
  4022. done;
  4023. unset _DEFAULT_ABI_SAVED;
  4024. fi;
  4025. if [[ ${ABI} != ${DEFAULT_ABI} ]]; then
  4026. for v in CHOST CBUILD AS CC CXX F77 FC LD PKG_CONFIG_{LIBDIR,PATH};
  4027. do
  4028. vv="_abi_saved_${v}";
  4029. [[ ${!v+set} == "set" ]] && export ${vv}="${!v}" || unset ${vv};
  4030. done;
  4031. export _DEFAULT_ABI_SAVED="true";
  4032. if [[ ${CBUILD} == "${CHOST}" ]]; then
  4033. export CBUILD=$(get_abi_CHOST $1);
  4034. fi;
  4035. export CHOST=$(get_abi_CHOST ${DEFAULT_ABI});
  4036. export CC="$(tc-getCC) $(get_abi_CFLAGS)";
  4037. export CXX="$(tc-getCXX) $(get_abi_CFLAGS)";
  4038. export F77="$(tc-getF77) $(get_abi_CFLAGS)";
  4039. export FC="$(tc-getFC) $(get_abi_CFLAGS)";
  4040. export LD="$(tc-getLD) $(get_abi_LDFLAGS)";
  4041. export CHOST=$(get_abi_CHOST $1);
  4042. export PKG_CONFIG_LIBDIR=${EPREFIX}/usr/$(get_libdir)/pkgconfig;
  4043. export PKG_CONFIG_PATH=${EPREFIX}/usr/share/pkgconfig;
  4044. fi
  4045. }
  4046. newicon ()
  4047. {
  4048. _iconins ${FUNCNAME} "$@"
  4049. }
  4050. newmenu ()
  4051. {
  4052. ( insinto /usr/share/applications;
  4053. newins "$@" )
  4054. }
  4055. number_abis ()
  4056. {
  4057. set -- `get_install_abis`;
  4058. echo $#
  4059. }
  4060. optfeature ()
  4061. {
  4062. debug-print-function ${FUNCNAME} "$@";
  4063. local i j msg;
  4064. local desc=$1;
  4065. local flag=0;
  4066. shift;
  4067. for i in "$@";
  4068. do
  4069. for j in ${i};
  4070. do
  4071. if has_version "${j}"; then
  4072. flag=1;
  4073. else
  4074. flag=0;
  4075. break;
  4076. fi;
  4077. done;
  4078. if [[ ${flag} -eq 1 ]]; then
  4079. break;
  4080. fi;
  4081. done;
  4082. if [[ ${flag} -eq 0 ]]; then
  4083. for i in "$@";
  4084. do
  4085. msg=" ";
  4086. for j in ${i};
  4087. do
  4088. msg+=" ${j} and";
  4089. done;
  4090. msg="${msg:0: -4} for ${desc}";
  4091. elog "${msg}";
  4092. done;
  4093. fi
  4094. }
  4095. path_exists ()
  4096. {
  4097. local opt=$1;
  4098. [[ ${opt} == -[ao] ]] && shift || opt="-a";
  4099. [[ $# -eq 0 ]] && return 1;
  4100. local p r=0;
  4101. for p in "$@";
  4102. do
  4103. [[ -e ${p} ]];
  4104. : $(( r += $? ));
  4105. done;
  4106. case ${opt} in
  4107. -a)
  4108. return $(( r != 0 ))
  4109. ;;
  4110. -o)
  4111. return $(( r == $# ))
  4112. ;;
  4113. esac
  4114. }
  4115. pax-mark ()
  4116. {
  4117. local f;
  4118. local flags;
  4119. local ret=0;
  4120. flags="${1//[!zPpEeMmRrSs]}";
  4121. [[ -n "${flags}" ]] || return 0;
  4122. shift;
  4123. local dodefault="";
  4124. [[ -n "${flags//[!z]}" ]] && dodefault="yes";
  4125. if has PT ${PAX_MARKINGS}; then
  4126. for f in "$@";
  4127. do
  4128. if type -p paxctl > /dev/null; then
  4129. einfo "PT_PAX marking -${flags} ${f} with paxctl";
  4130. paxctl -q${flags} "${f}" > /dev/null 2>&1 && continue;
  4131. fi;
  4132. if type -p paxctl-ng > /dev/null && paxctl-ng -L; then
  4133. einfo "PT_PAX marking -${flags} ${f} with paxctl-ng";
  4134. flags="${flags//z}";
  4135. [[ ${dodefault} == "yes" ]] && paxctl-ng -L -z "${f}" > /dev/null 2>&1;
  4136. [[ -n "${flags}" ]] || continue;
  4137. paxctl-ng -L -${flags} "${f}" > /dev/null 2>&1 && continue;
  4138. fi;
  4139. if type -p scanelf > /dev/null && [[ ${PAX_MARKINGS} != "none" ]]; then
  4140. einfo "PT_PAX marking -${flags} ${f} with scanelf";
  4141. scanelf -Xxz ${flags} "$f" > /dev/null 2>&1;
  4142. else
  4143. if [[ ${PAX_MARKINGS} != "none" ]]; then
  4144. elog "Failed to set PT_PAX markings -${flags} ${f}.";
  4145. ret=1;
  4146. fi;
  4147. fi;
  4148. done;
  4149. fi;
  4150. if has XT ${PAX_MARKINGS}; then
  4151. flags="${flags//z}";
  4152. for f in "$@";
  4153. do
  4154. if type -p paxctl-ng > /dev/null && paxctl-ng -l; then
  4155. einfo "XATTR_PAX marking -${flags} ${f} with paxctl-ng";
  4156. [[ ${dodefault} == "yes" ]] && paxctl-ng -d "${f}" > /dev/null 2>&1;
  4157. [[ -n "${flags}" ]] || continue;
  4158. paxctl-ng -l -${flags} "${f}" > /dev/null 2>&1 && continue;
  4159. fi;
  4160. if type -p setfattr > /dev/null; then
  4161. [[ -n "${flags//[!Ee]}" ]] || flags+="e";
  4162. einfo "XATTR_PAX marking -${flags} ${f} with setfattr";
  4163. [[ ${dodefault} == "yes" ]] && setfattr -x "user.pax.flags" "${f}" > /dev/null 2>&1;
  4164. setfattr -n "user.pax.flags" -v "${flags}" "${f}" > /dev/null 2>&1 && continue;
  4165. fi;
  4166. if [[ ${PAX_MARKINGS} != "none" ]]; then
  4167. elog "Failed to set XATTR_PAX markings -${flags} ${f}.";
  4168. ret=1;
  4169. fi;
  4170. done;
  4171. fi;
  4172. return ${ret}
  4173. }
  4174. pkg_needrebuild ()
  4175. {
  4176. git-r3_pkg_needrebuild
  4177. }
  4178. pkg_nofetch ()
  4179. {
  4180. default
  4181. }
  4182. pkg_postinst ()
  4183. {
  4184. gnome2_pkg_postinst;
  4185. if ! has_version 'media-libs/gst-plugins-good:1.0' || ! has_version 'media-plugins/gst-plugins-vpx:1.0'; then
  4186. ewarn "To make use of GNOME Shell's built-in screen recording utility,";
  4187. ewarn "you need to either install media-libs/gst-plugins-good:1.0";
  4188. ewarn "and media-plugins/gst-plugins-vpx:1.0, or use dconf-editor to change";
  4189. ewarn "apps.gnome-shell.recorder/pipeline to what you want to use.";
  4190. fi;
  4191. if has_version "<x11-drivers/ati-drivers-12"; then
  4192. ewarn "GNOME Shell has been reported to show graphical corruption under";
  4193. ewarn "x11-drivers/ati-drivers-11.*; you may want to switch to open-source";
  4194. ewarn "drivers.";
  4195. fi;
  4196. if ! has_version "media-libs/mesa[llvm]"; then
  4197. elog "llvmpipe is used as fallback when no 3D acceleration";
  4198. elog "is available. You will need to enable llvm USE for";
  4199. elog "media-libs/mesa.";
  4200. fi;
  4201. if has_version "x11-drivers/nvidia-drivers[-kms]"; then
  4202. ewarn "You will need to enable kms support in x11-drivers/nvidia-drivers,";
  4203. ewarn "otherwise Gnome will fail to start";
  4204. fi;
  4205. if ! systemd_is_booted; then
  4206. ewarn "${PN} needs Systemd to be *running* for working";
  4207. ewarn "properly. Please follow this guide to migrate:";
  4208. ewarn "https://wiki.gentoo.org/wiki/Systemd";
  4209. fi;
  4210. if use openrc-force; then
  4211. ewarn "You are enabling 'openrc-force' USE flag to skip systemd requirement,";
  4212. ewarn "this can lead to unexpected problems and is not supported neither by";
  4213. ewarn "upstream neither by Gnome Gentoo maintainers. If you suffer any problem,";
  4214. ewarn "you will need to disable this USE flag system wide and retest before";
  4215. ewarn "opening any bug report.";
  4216. fi
  4217. }
  4218. pkg_postrm ()
  4219. {
  4220. xdg_pkg_postrm "$@"
  4221. }
  4222. pkg_preinst ()
  4223. {
  4224. xdg_pkg_preinst "$@"
  4225. }
  4226. preserve_old_lib ()
  4227. {
  4228. _eutils_eprefix_init;
  4229. if [[ ${EBUILD_PHASE} != "preinst" ]]; then
  4230. eerror "preserve_old_lib() must be called from pkg_preinst() only";
  4231. die "Invalid preserve_old_lib() usage";
  4232. fi;
  4233. [[ -z $1 ]] && die "Usage: preserve_old_lib <library to preserve> [more libraries to preserve]";
  4234. has preserve-libs ${FEATURES} && return 0;
  4235. local lib dir;
  4236. for lib in "$@";
  4237. do
  4238. [[ -e ${EROOT}/${lib} ]] || continue;
  4239. dir=${lib%/*};
  4240. dodir ${dir} || die "dodir ${dir} failed";
  4241. cp "${EROOT}"/${lib} "${ED}"/${lib} || die "cp ${lib} failed";
  4242. touch "${ED}"/${lib};
  4243. done
  4244. }
  4245. preserve_old_lib_notify ()
  4246. {
  4247. if [[ ${EBUILD_PHASE} != "postinst" ]]; then
  4248. eerror "preserve_old_lib_notify() must be called from pkg_postinst() only";
  4249. die "Invalid preserve_old_lib_notify() usage";
  4250. fi;
  4251. has preserve-libs ${FEATURES} && return 0;
  4252. _eutils_eprefix_init;
  4253. local lib notice=0;
  4254. for lib in "$@";
  4255. do
  4256. [[ -e ${EROOT}/${lib} ]] || continue;
  4257. if [[ ${notice} -eq 0 ]]; then
  4258. notice=1;
  4259. ewarn "Old versions of installed libraries were detected on your system.";
  4260. ewarn "In order to avoid breaking packages that depend on these old libs,";
  4261. ewarn "the libraries are not being removed. You need to run revdep-rebuild";
  4262. ewarn "in order to remove these old dependencies. If you do not have this";
  4263. ewarn "helper program, simply emerge the 'gentoolkit' package.";
  4264. ewarn;
  4265. fi;
  4266. ewarn " # revdep-rebuild --library '${lib}' && rm '${lib}'";
  4267. done
  4268. }
  4269. prune_libtool_files ()
  4270. {
  4271. debug-print-function ${FUNCNAME} "$@";
  4272. local removing_all removing_modules opt;
  4273. for opt in "$@";
  4274. do
  4275. case "${opt}" in
  4276. --all)
  4277. removing_all=1;
  4278. removing_modules=1
  4279. ;;
  4280. --modules)
  4281. removing_modules=1
  4282. ;;
  4283. *)
  4284. die "Invalid argument to ${FUNCNAME}(): ${opt}"
  4285. ;;
  4286. esac;
  4287. done;
  4288. local f;
  4289. local queue=();
  4290. while IFS= read -r -d '' f; do
  4291. local archivefile=${f/%.la/.a};
  4292. if ! sed -n -e '/^# Generated by .*libtool/q0;4q1' "${f}"; then
  4293. continue;
  4294. fi;
  4295. [[ ${f} != ${archivefile} ]] || die 'regex sanity check failed';
  4296. local reason= pkgconfig_scanned=;
  4297. local snotlink=$(sed -n -e 's:^shouldnotlink=::p' "${f}");
  4298. if [[ ${snotlink} == yes ]]; then
  4299. if [[ -f ${archivefile} ]]; then
  4300. einfo "Removing unnecessary ${archivefile#${D%/}} (static plugin)";
  4301. queue+=("${archivefile}");
  4302. fi;
  4303. if [[ -n ${removing_modules} ]]; then
  4304. reason='module';
  4305. fi;
  4306. else
  4307. if [[ -n ${removing_all} ]]; then
  4308. reason='requested';
  4309. else
  4310. if [[ ! -f ${archivefile} ]]; then
  4311. reason='no static archive';
  4312. else
  4313. if [[ ! -n $(sed -nre "s/^(dependency_libs|inherited_linker_flags)='(.*)'$/\2/p" "${f}") ]]; then
  4314. reason='no libs & flags';
  4315. else
  4316. if [[ ! -n ${pkgconfig_scanned} ]]; then
  4317. local pc_libs=();
  4318. if [[ ! -n ${removing_all} ]]; then
  4319. local pc;
  4320. local tf=${T}/prune-lt-files.pc;
  4321. local pkgconf=$(tc-getPKG_CONFIG);
  4322. while IFS= read -r -d '' pc; do
  4323. local arg libs;
  4324. if ${pkgconf} --exists "${pc}" &> /dev/null; then
  4325. sed -e '/^Requires:/d' "${pc}" > "${tf}";
  4326. libs=$(${pkgconf} --libs "${tf}");
  4327. else
  4328. libs=$(sed -ne 's/^Libs://p' "${pc}");
  4329. fi;
  4330. for arg in ${libs};
  4331. do
  4332. if [[ ${arg} == -l* ]]; then
  4333. if [[ ${arg} == '*$*' ]]; then
  4334. eerror "${FUNCNAME}: variable substitution likely failed in ${pc}";
  4335. eerror "(arg: ${arg})";
  4336. eerror "Most likely, you need to add virtual/pkgconfig to DEPEND.";
  4337. die "${FUNCNAME}: unsubstituted variable found in .pc";
  4338. fi;
  4339. pc_libs+=(lib${arg#-l}.la);
  4340. fi;
  4341. done;
  4342. done < <(find "${D}" -type f -name '*.pc' -print0);
  4343. rm -f "${tf}";
  4344. fi;
  4345. pkgconfig_scanned=1;
  4346. fi;
  4347. has "${f##*/}" "${pc_libs[@]}" && reason='covered by .pc';
  4348. fi;
  4349. fi;
  4350. fi;
  4351. fi;
  4352. if [[ -n ${reason} ]]; then
  4353. einfo "Removing unnecessary ${f#${D%/}} (${reason})";
  4354. queue+=("${f}");
  4355. fi;
  4356. done < <(find "${D}" -xtype f -name '*.la' -print0);
  4357. if [[ -n ${queue[@]} ]]; then
  4358. rm -f "${queue[@]}";
  4359. fi
  4360. }
  4361. python_abi_depend ()
  4362. {
  4363. die "${FUNCNAME}() is invalid for python-r1 suite"
  4364. }
  4365. python_byte-compile_modules ()
  4366. {
  4367. die "${FUNCNAME}() is invalid for python-r1 suite"
  4368. }
  4369. python_clean_byte-compiled_modules ()
  4370. {
  4371. die "${FUNCNAME}() is invalid for python-r1 suite"
  4372. }
  4373. python_clean_installation_image ()
  4374. {
  4375. die "${FUNCNAME}() is invalid for python-r1 suite"
  4376. }
  4377. python_clean_py-compile_files ()
  4378. {
  4379. die "${FUNCNAME}() is invalid for python-r1 suite"
  4380. }
  4381. python_convert_shebangs ()
  4382. {
  4383. die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#python_convert_shebangs"
  4384. }
  4385. python_copy_sources ()
  4386. {
  4387. debug-print-function ${FUNCNAME} "${@}";
  4388. local MULTIBUILD_VARIANTS;
  4389. _python_obtain_impls;
  4390. multibuild_copy_sources
  4391. }
  4392. python_disable_pyc ()
  4393. {
  4394. die "${FUNCNAME}() is invalid for python-r1 suite"
  4395. }
  4396. python_doexe ()
  4397. {
  4398. debug-print-function ${FUNCNAME} "${@}";
  4399. local f;
  4400. for f in "$@";
  4401. do
  4402. python_newexe "${f}" "${f##*/}";
  4403. done
  4404. }
  4405. python_doheader ()
  4406. {
  4407. debug-print-function ${FUNCNAME} "${@}";
  4408. [[ -n ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).';
  4409. if [[ ${EAPI:-0} == [0123] ]]; then
  4410. die "python_do* and python_new* helpers are banned in EAPIs older than 4.";
  4411. fi;
  4412. local d PYTHON_INCLUDEDIR=${PYTHON_INCLUDEDIR};
  4413. [[ -n ${PYTHON_INCLUDEDIR} ]] || python_export PYTHON_INCLUDEDIR;
  4414. d=${PYTHON_INCLUDEDIR#${EPREFIX}};
  4415. ( insinto "${d}";
  4416. doins -r "${@}" || return ${?} )
  4417. }
  4418. python_domodule ()
  4419. {
  4420. debug-print-function ${FUNCNAME} "${@}";
  4421. [[ -n ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).';
  4422. if [[ ${EAPI:-0} == [0123] ]]; then
  4423. die "python_do* and python_new* helpers are banned in EAPIs older than 4.";
  4424. fi;
  4425. local d;
  4426. if [[ ${python_moduleroot} == /* ]]; then
  4427. d=${python_moduleroot};
  4428. else
  4429. local PYTHON_SITEDIR=${PYTHON_SITEDIR};
  4430. [[ -n ${PYTHON_SITEDIR} ]] || python_export PYTHON_SITEDIR;
  4431. d=${PYTHON_SITEDIR#${EPREFIX}}/${python_moduleroot//.//};
  4432. fi;
  4433. ( insinto "${d}";
  4434. doins -r "${@}" || return ${?} );
  4435. python_optimize "${ED}/${d}"
  4436. }
  4437. python_doscript ()
  4438. {
  4439. debug-print-function ${FUNCNAME} "${@}";
  4440. local _PYTHON_REWRITE_SHEBANG=1;
  4441. python_doexe "${@}"
  4442. }
  4443. python_enable_pyc ()
  4444. {
  4445. die "${FUNCNAME}() is invalid for python-r1 suite"
  4446. }
  4447. python_execute_function ()
  4448. {
  4449. die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#python_execute_function"
  4450. }
  4451. python_execute_nosetests ()
  4452. {
  4453. die "${FUNCNAME}() is invalid for python-r1 suite"
  4454. }
  4455. python_execute_py.test ()
  4456. {
  4457. die "${FUNCNAME}() is invalid for python-r1 suite"
  4458. }
  4459. python_execute_trial ()
  4460. {
  4461. die "${FUNCNAME}() is invalid for python-r1 suite"
  4462. }
  4463. python_export ()
  4464. {
  4465. debug-print-function ${FUNCNAME} "${@}";
  4466. local impl var;
  4467. case "${1}" in
  4468. python* | jython*)
  4469. impl=${1/_/.};
  4470. shift
  4471. ;;
  4472. pypy | pypy3)
  4473. impl=${1};
  4474. shift
  4475. ;;
  4476. *)
  4477. impl=${EPYTHON};
  4478. if [[ -z ${impl} ]]; then
  4479. die "python_export called without a python implementation and EPYTHON is unset";
  4480. fi
  4481. ;;
  4482. esac;
  4483. debug-print "${FUNCNAME}: implementation: ${impl}";
  4484. for var in "$@";
  4485. do
  4486. case "${var}" in
  4487. EPYTHON)
  4488. export EPYTHON=${impl};
  4489. debug-print "${FUNCNAME}: EPYTHON = ${EPYTHON}"
  4490. ;;
  4491. PYTHON)
  4492. export PYTHON=${EPREFIX}/usr/bin/${impl};
  4493. debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
  4494. ;;
  4495. PYTHON_SITEDIR)
  4496. [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it";
  4497. PYTHON_SITEDIR=$("${PYTHON}" -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())') || die;
  4498. export PYTHON_SITEDIR;
  4499. debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}"
  4500. ;;
  4501. PYTHON_INCLUDEDIR)
  4502. [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it";
  4503. PYTHON_INCLUDEDIR=$("${PYTHON}" -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_inc())') || die;
  4504. export PYTHON_INCLUDEDIR;
  4505. debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR = ${PYTHON_INCLUDEDIR}";
  4506. if [[ ! -d ${PYTHON_INCLUDEDIR} ]]; then
  4507. die "${impl} does not install any header files!";
  4508. fi
  4509. ;;
  4510. PYTHON_LIBPATH)
  4511. [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it";
  4512. PYTHON_LIBPATH=$("${PYTHON}" -c 'import os.path, sysconfig; print(os.path.join(sysconfig.get_config_var("LIBDIR"), sysconfig.get_config_var("LDLIBRARY")) if sysconfig.get_config_var("LDLIBRARY") else "")') || die;
  4513. export PYTHON_LIBPATH;
  4514. debug-print "${FUNCNAME}: PYTHON_LIBPATH = ${PYTHON_LIBPATH}";
  4515. if [[ ! -n ${PYTHON_LIBPATH} ]]; then
  4516. die "${impl} lacks a (usable) dynamic library";
  4517. fi
  4518. ;;
  4519. PYTHON_CFLAGS)
  4520. local val;
  4521. case "${impl}" in
  4522. python*)
  4523. val=$($(tc-getPKG_CONFIG) --cflags ${impl/n/n-}) || die
  4524. ;;
  4525. *)
  4526. die "${impl}: obtaining ${var} not supported"
  4527. ;;
  4528. esac;
  4529. export PYTHON_CFLAGS=${val};
  4530. debug-print "${FUNCNAME}: PYTHON_CFLAGS = ${PYTHON_CFLAGS}"
  4531. ;;
  4532. PYTHON_LIBS)
  4533. local val;
  4534. case "${impl}" in
  4535. python*)
  4536. val=$($(tc-getPKG_CONFIG) --libs ${impl/n/n-}) || die
  4537. ;;
  4538. *)
  4539. die "${impl}: obtaining ${var} not supported"
  4540. ;;
  4541. esac;
  4542. export PYTHON_LIBS=${val};
  4543. debug-print "${FUNCNAME}: PYTHON_LIBS = ${PYTHON_LIBS}"
  4544. ;;
  4545. PYTHON_CONFIG)
  4546. local flags val;
  4547. case "${impl}" in
  4548. python*)
  4549. [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it";
  4550. flags=$("${PYTHON}" -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS") or "")') || die;
  4551. val=${PYTHON}${flags}-config
  4552. ;;
  4553. *)
  4554. die "${impl}: obtaining ${var} not supported"
  4555. ;;
  4556. esac;
  4557. export PYTHON_CONFIG=${val};
  4558. debug-print "${FUNCNAME}: PYTHON_CONFIG = ${PYTHON_CONFIG}"
  4559. ;;
  4560. PYTHON_PKG_DEP)
  4561. local d;
  4562. case ${impl} in
  4563. python2.7)
  4564. PYTHON_PKG_DEP='>=dev-lang/python-2.7.5-r2:2.7'
  4565. ;;
  4566. python3.3)
  4567. PYTHON_PKG_DEP='>=dev-lang/python-3.3.2-r2:3.3'
  4568. ;;
  4569. python*)
  4570. PYTHON_PKG_DEP="dev-lang/python:${impl#python}"
  4571. ;;
  4572. pypy)
  4573. PYTHON_PKG_DEP='>=virtual/pypy-5:0='
  4574. ;;
  4575. pypy3)
  4576. PYTHON_PKG_DEP='>=virtual/pypy3-5:0='
  4577. ;;
  4578. jython2.7)
  4579. PYTHON_PKG_DEP='dev-java/jython:2.7'
  4580. ;;
  4581. *)
  4582. die "Invalid implementation: ${impl}"
  4583. ;;
  4584. esac;
  4585. if [[ -n ${PYTHON_REQ_USE} ]]; then
  4586. PYTHON_PKG_DEP+=[${PYTHON_REQ_USE}];
  4587. fi;
  4588. export PYTHON_PKG_DEP;
  4589. debug-print "${FUNCNAME}: PYTHON_PKG_DEP = ${PYTHON_PKG_DEP}"
  4590. ;;
  4591. PYTHON_SCRIPTDIR)
  4592. local dir;
  4593. export PYTHON_SCRIPTDIR=${EPREFIX}/usr/lib/python-exec/${impl};
  4594. debug-print "${FUNCNAME}: PYTHON_SCRIPTDIR = ${PYTHON_SCRIPTDIR}"
  4595. ;;
  4596. *)
  4597. die "python_export: unknown variable ${var}"
  4598. ;;
  4599. esac;
  4600. done
  4601. }
  4602. python_export_best ()
  4603. {
  4604. debug-print-function ${FUNCNAME} "${@}";
  4605. [[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}";
  4606. eqawarn "python_export_best() is deprecated. Please use python_setup instead,";
  4607. eqawarn "combined with python_export if necessary.";
  4608. [[ ${#} -gt 0 ]] || set -- EPYTHON PYTHON;
  4609. local best MULTIBUILD_VARIANTS;
  4610. _python_obtain_impls;
  4611. function _python_set_best ()
  4612. {
  4613. best=${MULTIBUILD_VARIANT}
  4614. };
  4615. multibuild_for_best_variant _python_set_best;
  4616. unset -f _python_set_best;
  4617. debug-print "${FUNCNAME}: Best implementation is: ${best}";
  4618. python_export "${best}" "${@}";
  4619. python_wrapper_setup
  4620. }
  4621. python_export_utf8_locale ()
  4622. {
  4623. debug-print-function ${FUNCNAME} "${@}";
  4624. type locale > /dev/null || return 0;
  4625. if [[ $(locale charmap) != UTF-8 ]]; then
  4626. local lang locales="C.UTF-8 en_US.UTF-8 en_GB.UTF-8 $(locale -a)";
  4627. for lang in ${locales};
  4628. do
  4629. if [[ $(LC_ALL=${lang} locale charmap 2>/dev/null) == UTF-8 ]]; then
  4630. if _python_check_locale_sanity "${lang}"; then
  4631. export LC_CTYPE=${lang};
  4632. if [[ -n ${LC_ALL} ]]; then
  4633. export LC_NUMERIC=${LC_ALL};
  4634. export LC_TIME=${LC_ALL};
  4635. export LC_COLLATE=${LC_ALL};
  4636. export LC_MONETARY=${LC_ALL};
  4637. export LC_MESSAGES=${LC_ALL};
  4638. export LC_PAPER=${LC_ALL};
  4639. export LC_NAME=${LC_ALL};
  4640. export LC_ADDRESS=${LC_ALL};
  4641. export LC_TELEPHONE=${LC_ALL};
  4642. export LC_MEASUREMENT=${LC_ALL};
  4643. export LC_IDENTIFICATION=${LC_ALL};
  4644. export LC_ALL=;
  4645. fi;
  4646. return 0;
  4647. fi;
  4648. fi;
  4649. done;
  4650. ewarn "Could not find a UTF-8 locale. This may trigger build failures in";
  4651. ewarn "some python packages. Please ensure that a UTF-8 locale is listed in";
  4652. ewarn "/etc/locale.gen and run locale-gen.";
  4653. return 1;
  4654. fi;
  4655. return 0
  4656. }
  4657. python_fix_shebang ()
  4658. {
  4659. debug-print-function ${FUNCNAME} "${@}";
  4660. [[ -n ${EPYTHON} ]] || die "${FUNCNAME}: EPYTHON unset (pkg_setup not called?)";
  4661. local force quiet;
  4662. while [[ -n ${@} ]]; do
  4663. case "${1}" in
  4664. -f | --force)
  4665. force=1;
  4666. shift
  4667. ;;
  4668. -q | --quiet)
  4669. quiet=1;
  4670. shift
  4671. ;;
  4672. --)
  4673. shift;
  4674. break
  4675. ;;
  4676. *)
  4677. break
  4678. ;;
  4679. esac;
  4680. done;
  4681. [[ -n ${1} ]] || die "${FUNCNAME}: no paths given";
  4682. local path f;
  4683. for path in "$@";
  4684. do
  4685. local any_correct any_fixed is_recursive;
  4686. [[ -d ${path} ]] && is_recursive=1;
  4687. while IFS= read -r -d '' f; do
  4688. local shebang i;
  4689. local error= from=;
  4690. IFS= read -r shebang < "${f}";
  4691. if [[ ${shebang} == '#!'* ]]; then
  4692. local split_shebang=();
  4693. read -r -a split_shebang <<< ${shebang} || die;
  4694. for i in "${split_shebang[@]}";
  4695. do
  4696. case "${i}" in
  4697. *"${EPYTHON}")
  4698. debug-print "${FUNCNAME}: in file ${f#${D}}";
  4699. debug-print "${FUNCNAME}: shebang matches EPYTHON: ${shebang}";
  4700. any_correct=1;
  4701. from=${EPYTHON};
  4702. break
  4703. ;;
  4704. *python | *python[23])
  4705. debug-print "${FUNCNAME}: in file ${f#${D}}";
  4706. debug-print "${FUNCNAME}: rewriting shebang: ${shebang}";
  4707. if [[ ${i} == *python2 ]]; then
  4708. from=python2;
  4709. if [[ ! -n ${force} ]]; then
  4710. python_is_python3 "${EPYTHON}" && error=1;
  4711. fi;
  4712. else
  4713. if [[ ${i} == *python3 ]]; then
  4714. from=python3;
  4715. if [[ ! -n ${force} ]]; then
  4716. python_is_python3 "${EPYTHON}" || error=1;
  4717. fi;
  4718. else
  4719. from=python;
  4720. fi;
  4721. fi;
  4722. break
  4723. ;;
  4724. *python[23].[0123456789] | *pypy | *pypy3 | *jython[23].[0123456789])
  4725. if [[ ! -n ${force} ]]; then
  4726. error=1;
  4727. else
  4728. case "${i}" in
  4729. *python[23].[0123456789])
  4730. from="python[23].[0123456789]"
  4731. ;;
  4732. *pypy)
  4733. from="pypy"
  4734. ;;
  4735. *pypy3)
  4736. from="pypy3"
  4737. ;;
  4738. *jython[23].[0123456789])
  4739. from="jython[23].[0123456789]"
  4740. ;;
  4741. *)
  4742. die "${FUNCNAME}: internal error in 2nd pattern match"
  4743. ;;
  4744. esac;
  4745. fi;
  4746. break
  4747. ;;
  4748. esac;
  4749. done;
  4750. fi;
  4751. if [[ ! -n ${error} && ! -n ${from} ]]; then
  4752. [[ -n ${is_recursive} ]] && continue;
  4753. error=1;
  4754. fi;
  4755. if [[ ! -n ${quiet} ]]; then
  4756. einfo "Fixing shebang in ${f#${D}}.";
  4757. fi;
  4758. if [[ ! -n ${error} ]]; then
  4759. if [[ ${shebang} == *${from}" "* ]]; then
  4760. sed -i -e "1s:${from} :${EPYTHON} :" "${f}" || die;
  4761. else
  4762. sed -i -e "1s:${from}$:${EPYTHON}:" "${f}" || die;
  4763. fi;
  4764. any_fixed=1;
  4765. else
  4766. eerror "The file has incompatible shebang:";
  4767. eerror " file: ${f#${D}}";
  4768. eerror " current shebang: ${shebang}";
  4769. eerror " requested impl: ${EPYTHON}";
  4770. die "${FUNCNAME}: conversion of incompatible shebang requested";
  4771. fi;
  4772. done < <(find -H "${path}" -type f -print0 || die);
  4773. if [[ ! -n ${any_fixed} ]]; then
  4774. local cmd=eerror;
  4775. [[ ${EAPI:-0} == [012345] ]] && cmd=eqawarn;
  4776. "${cmd}" "QA warning: ${FUNCNAME}, ${path#${D}} did not match any fixable files.";
  4777. if [[ -n ${any_correct} ]]; then
  4778. "${cmd}" "All files have ${EPYTHON} shebang already.";
  4779. else
  4780. "${cmd}" "There are no Python files in specified directory.";
  4781. fi;
  4782. [[ ${cmd} == eerror ]] && die "${FUNCNAME} did not match any fixable files (QA warning fatal in EAPI ${EAPI})";
  4783. fi;
  4784. done
  4785. }
  4786. python_foreach_impl ()
  4787. {
  4788. debug-print-function ${FUNCNAME} "${@}";
  4789. local MULTIBUILD_VARIANTS;
  4790. _python_obtain_impls;
  4791. multibuild_foreach_variant _python_multibuild_wrapper "${@}"
  4792. }
  4793. python_gen_any_dep ()
  4794. {
  4795. debug-print-function ${FUNCNAME} "${@}";
  4796. local depstr=${1};
  4797. [[ -n ${depstr} ]] || die "No dependency string provided";
  4798. shift;
  4799. local i PYTHON_PKG_DEP out=;
  4800. for i in "${_PYTHON_SUPPORTED_IMPLS[@]}";
  4801. do
  4802. if _python_impl_matches "${i}" "${@-*}"; then
  4803. local PYTHON_USEDEP="python_targets_${i}(-),python_single_target_${i}(+)";
  4804. python_export "${i}" PYTHON_PKG_DEP;
  4805. local i_depstr=${depstr//\$\{PYTHON_USEDEP\}/${PYTHON_USEDEP}};
  4806. out="( ${PYTHON_PKG_DEP%=} ${i_depstr} ) ${out}";
  4807. fi;
  4808. done;
  4809. echo "|| ( ${out})"
  4810. }
  4811. python_gen_cond_dep ()
  4812. {
  4813. debug-print-function ${FUNCNAME} "${@}";
  4814. local impl matches=();
  4815. local dep=${1};
  4816. shift;
  4817. for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}";
  4818. do
  4819. if _python_impl_matches "${impl}" "${@}"; then
  4820. if [[ ${dep} == *'${PYTHON_USEDEP}'* ]]; then
  4821. local usedep=$(python_gen_usedep "${@}");
  4822. dep=${dep//\$\{PYTHON_USEDEP\}/${usedep}};
  4823. fi;
  4824. matches+=("python_targets_${impl}? ( ${dep} )");
  4825. fi;
  4826. done;
  4827. echo "${matches[@]}"
  4828. }
  4829. python_gen_impl_dep ()
  4830. {
  4831. debug-print-function ${FUNCNAME} "${@}";
  4832. local impl matches=();
  4833. local PYTHON_REQ_USE=${1};
  4834. shift;
  4835. local patterns=("${@-*}");
  4836. for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}";
  4837. do
  4838. if _python_impl_matches "${impl}" "${patterns[@]}"; then
  4839. local PYTHON_PKG_DEP;
  4840. python_export "${impl}" PYTHON_PKG_DEP;
  4841. matches+=("python_targets_${impl}? ( ${PYTHON_PKG_DEP} )");
  4842. fi;
  4843. done;
  4844. echo "${matches[@]}"
  4845. }
  4846. python_gen_usedep ()
  4847. {
  4848. debug-print-function ${FUNCNAME} "${@}";
  4849. local impl matches=();
  4850. for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}";
  4851. do
  4852. if _python_impl_matches "${impl}" "${@}"; then
  4853. matches+=("python_targets_${impl}(-)?" "-python_single_target_${impl}(-)");
  4854. fi;
  4855. done;
  4856. [[ -n ${matches[@]} ]] || die "No supported implementations match python_gen_usedep patterns: ${@}";
  4857. local out=${matches[@]};
  4858. echo "${out// /,}"
  4859. }
  4860. python_gen_useflags ()
  4861. {
  4862. debug-print-function ${FUNCNAME} "${@}";
  4863. local impl matches=();
  4864. for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}";
  4865. do
  4866. if _python_impl_matches "${impl}" "${@}"; then
  4867. matches+=("python_targets_${impl}");
  4868. fi;
  4869. done;
  4870. echo "${matches[@]}"
  4871. }
  4872. python_generate_cffi_modules ()
  4873. {
  4874. die "${FUNCNAME}() is invalid for python-r1 suite"
  4875. }
  4876. python_generate_wrapper_scripts ()
  4877. {
  4878. die "${FUNCNAME}() is invalid for python-r1 suite"
  4879. }
  4880. python_get_CFLAGS ()
  4881. {
  4882. debug-print-function ${FUNCNAME} "${@}";
  4883. python_export "${@}" PYTHON_CFLAGS;
  4884. echo "${PYTHON_CFLAGS}"
  4885. }
  4886. python_get_LIBS ()
  4887. {
  4888. debug-print-function ${FUNCNAME} "${@}";
  4889. python_export "${@}" PYTHON_LIBS;
  4890. echo "${PYTHON_LIBS}"
  4891. }
  4892. python_get_PYTHON_CONFIG ()
  4893. {
  4894. debug-print-function ${FUNCNAME} "${@}";
  4895. python_export "${@}" PYTHON_CONFIG;
  4896. echo "${PYTHON_CONFIG}"
  4897. }
  4898. python_get_extension_module_suffix ()
  4899. {
  4900. die "${FUNCNAME}() is invalid for python-r1 suite"
  4901. }
  4902. python_get_implementation ()
  4903. {
  4904. die "${FUNCNAME}() is invalid for python-r1 suite"
  4905. }
  4906. python_get_implementation_and_version ()
  4907. {
  4908. die "${FUNCNAME}() is invalid for python-r1 suite"
  4909. }
  4910. python_get_implementational_package ()
  4911. {
  4912. die "${FUNCNAME}() is invalid for python-r1 suite"
  4913. }
  4914. python_get_includedir ()
  4915. {
  4916. debug-print-function ${FUNCNAME} "${@}";
  4917. python_export "${@}" PYTHON_INCLUDEDIR;
  4918. echo "${PYTHON_INCLUDEDIR}"
  4919. }
  4920. python_get_libdir ()
  4921. {
  4922. die "${FUNCNAME}() is invalid for python-r1 suite"
  4923. }
  4924. python_get_library ()
  4925. {
  4926. die "${FUNCNAME}() is invalid for python-r1 suite"
  4927. }
  4928. python_get_library_path ()
  4929. {
  4930. debug-print-function ${FUNCNAME} "${@}";
  4931. python_export "${@}" PYTHON_LIBPATH;
  4932. echo "${PYTHON_LIBPATH}"
  4933. }
  4934. python_get_scriptdir ()
  4935. {
  4936. debug-print-function ${FUNCNAME} "${@}";
  4937. python_export "${@}" PYTHON_SCRIPTDIR;
  4938. echo "${PYTHON_SCRIPTDIR}"
  4939. }
  4940. python_get_sitedir ()
  4941. {
  4942. debug-print-function ${FUNCNAME} "${@}";
  4943. python_export "${@}" PYTHON_SITEDIR;
  4944. echo "${PYTHON_SITEDIR}"
  4945. }
  4946. python_get_version ()
  4947. {
  4948. die "${FUNCNAME}() is invalid for python-r1 suite"
  4949. }
  4950. python_install_executables ()
  4951. {
  4952. die "${FUNCNAME}() is invalid for python-r1 suite"
  4953. }
  4954. python_is_installed ()
  4955. {
  4956. local impl=${1:-${EPYTHON}};
  4957. [[ -n ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON";
  4958. local -x ROOT=/;
  4959. case "${impl}" in
  4960. pypy | pypy3)
  4961. local append=;
  4962. if [[ -n ${PYTHON_REQ_USE} ]]; then
  4963. append=[${PYTHON_REQ_USE}];
  4964. fi;
  4965. has_version "dev-python/${impl}${append}" || has_version "dev-python/${impl}-bin${append}"
  4966. ;;
  4967. *)
  4968. local PYTHON_PKG_DEP;
  4969. python_export "${impl}" PYTHON_PKG_DEP;
  4970. has_version "${PYTHON_PKG_DEP}"
  4971. ;;
  4972. esac
  4973. }
  4974. python_is_python3 ()
  4975. {
  4976. local impl=${1:-${EPYTHON}};
  4977. [[ -n ${impl} ]] || die "python_is_python3: no impl nor EPYTHON";
  4978. [[ ${impl} == python3* || ${impl} == pypy3 ]]
  4979. }
  4980. python_merge_intermediate_installation_images ()
  4981. {
  4982. die "${FUNCNAME}() is invalid for python-r1 suite"
  4983. }
  4984. python_mod_cleanup ()
  4985. {
  4986. die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#Python_byte-code_compilation"
  4987. }
  4988. python_mod_optimize ()
  4989. {
  4990. die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#Python_byte-code_compilation"
  4991. }
  4992. python_moduleinto ()
  4993. {
  4994. debug-print-function ${FUNCNAME} "${@}";
  4995. python_moduleroot=${1}
  4996. }
  4997. python_need_rebuild ()
  4998. {
  4999. die "${FUNCNAME}() is invalid for python-r1 suite"
  5000. }
  5001. python_newexe ()
  5002. {
  5003. debug-print-function ${FUNCNAME} "${@}";
  5004. [[ -n ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).';
  5005. [[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} <path> <new-name>";
  5006. if [[ ${EAPI:-0} == [0123] ]]; then
  5007. die "python_do* and python_new* helpers are banned in EAPIs older than 4.";
  5008. fi;
  5009. local wrapd=${python_scriptroot:-/usr/bin};
  5010. local f=${1};
  5011. local newfn=${2};
  5012. local PYTHON_SCRIPTDIR d;
  5013. python_export PYTHON_SCRIPTDIR;
  5014. d=${PYTHON_SCRIPTDIR#${EPREFIX}};
  5015. ( dodir "${wrapd}";
  5016. exeinto "${d}";
  5017. newexe "${f}" "${newfn}" || return ${?} );
  5018. _python_ln_rel "${ED%/}"/usr/lib/python-exec/python-exec2 "${ED%/}/${wrapd}/${newfn}" || die;
  5019. if [[ -n ${_PYTHON_REWRITE_SHEBANG} ]]; then
  5020. python_fix_shebang -q "${ED%/}/${d}/${newfn}";
  5021. fi
  5022. }
  5023. python_newscript ()
  5024. {
  5025. debug-print-function ${FUNCNAME} "${@}";
  5026. local _PYTHON_REWRITE_SHEBANG=1;
  5027. python_newexe "${@}"
  5028. }
  5029. python_optimize ()
  5030. {
  5031. debug-print-function ${FUNCNAME} "${@}";
  5032. if [[ ${EBUILD_PHASE} == pre* || ${EBUILD_PHASE} == post* ]]; then
  5033. eerror "The new Python eclasses expect the compiled Python files to";
  5034. eerror "be controlled by the Package Manager. For this reason,";
  5035. eerror "the python_optimize function can be used only during src_* phases";
  5036. eerror "(src_install most commonly) and not during pkg_* phases.";
  5037. echo;
  5038. die "python_optimize is not to be used in pre/post* phases";
  5039. fi;
  5040. [[ -n ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).';
  5041. local PYTHON=${PYTHON};
  5042. [[ -n ${PYTHON} ]] || python_export PYTHON;
  5043. if [[ ${#} -eq 0 ]]; then
  5044. local f;
  5045. while IFS= read -r -d '' f; do
  5046. if [[ ${f} == /* && -d ${D}${f} ]]; then
  5047. set -- "${D}${f}" "${@}";
  5048. fi;
  5049. done < <("${PYTHON}" -c 'import sys; print("\0".join(sys.path))' || die);
  5050. debug-print "${FUNCNAME}: using sys.path: ${*/%/;}";
  5051. fi;
  5052. local d;
  5053. for d in "$@";
  5054. do
  5055. local instpath=${d#${D}};
  5056. instpath=/${instpath##/};
  5057. case "${EPYTHON}" in
  5058. python2.7 | python3.[34])
  5059. "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}";
  5060. "${PYTHON}" -OO -m compileall -q -f -d "${instpath}" "${d}"
  5061. ;;
  5062. python* | pypy3)
  5063. "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}";
  5064. "${PYTHON}" -O -m compileall -q -f -d "${instpath}" "${d}";
  5065. "${PYTHON}" -OO -m compileall -q -f -d "${instpath}" "${d}"
  5066. ;;
  5067. *)
  5068. "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}"
  5069. ;;
  5070. esac;
  5071. done
  5072. }
  5073. python_pkg_setup ()
  5074. {
  5075. die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#pkg_setup"
  5076. }
  5077. python_replicate_script ()
  5078. {
  5079. debug-print-function ${FUNCNAME} "${@}";
  5080. function _python_replicate_script ()
  5081. {
  5082. local _PYTHON_FIX_SHEBANG_QUIET=1;
  5083. local PYTHON_SCRIPTDIR;
  5084. python_export PYTHON_SCRIPTDIR;
  5085. ( exeinto "${PYTHON_SCRIPTDIR#${EPREFIX}}";
  5086. doexe "${files[@]}" );
  5087. python_fix_shebang -q "${files[@]/*\//${D%/}/${PYTHON_SCRIPTDIR}/}"
  5088. };
  5089. local files=("${@}");
  5090. python_foreach_impl _python_replicate_script;
  5091. unset -f _python_replicate_script;
  5092. local f;
  5093. for f in "$@";
  5094. do
  5095. _python_ln_rel "${ED%/}/usr/lib/python-exec/python-exec2" "${f}" || die;
  5096. done
  5097. }
  5098. python_scriptinto ()
  5099. {
  5100. debug-print-function ${FUNCNAME} "${@}";
  5101. python_scriptroot=${1}
  5102. }
  5103. python_set_active_version ()
  5104. {
  5105. die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#pkg_setup"
  5106. }
  5107. python_setup ()
  5108. {
  5109. debug-print-function ${FUNCNAME} "${@}";
  5110. _python_validate_useflags;
  5111. local pycompat=("${PYTHON_COMPAT[@]}");
  5112. if [[ -n ${PYTHON_COMPAT_OVERRIDE} ]]; then
  5113. pycompat=(${PYTHON_COMPAT_OVERRIDE});
  5114. fi;
  5115. local has_check_deps;
  5116. declare -f python_check_deps > /dev/null && has_check_deps=1;
  5117. local found;
  5118. for ((i = ${#_PYTHON_SUPPORTED_IMPLS[@]} - 1; i >= 0; i-- ))
  5119. do
  5120. local impl=${_PYTHON_SUPPORTED_IMPLS[i]};
  5121. has "${impl}" "${pycompat[@]}" || continue;
  5122. if [[ ! -n ${PYTHON_COMPAT_OVERRIDE} && ! -n ${has_check_deps} ]]; then
  5123. use "python_targets_${impl}" || continue;
  5124. fi;
  5125. _python_impl_matches "${impl}" "${@-*}" || continue;
  5126. python_export "${impl}" EPYTHON PYTHON;
  5127. if [[ -n ${has_check_deps} ]]; then
  5128. python_is_installed "${impl}" || continue;
  5129. local PYTHON_USEDEP="python_targets_${impl}(-),python_single_target_${impl}(+)";
  5130. python_check_deps || continue;
  5131. fi;
  5132. found=1;
  5133. break;
  5134. done;
  5135. if [[ ! -n ${found} ]]; then
  5136. eerror "${FUNCNAME}: none of the enabled implementation matched the patterns.";
  5137. eerror " patterns: ${@-'(*)'}";
  5138. eerror "Likely a REQUIRED_USE constraint (possibly USE-conditional) is missing.";
  5139. eerror " suggested: || ( \$(python_gen_useflags ${@}) )";
  5140. eerror "(remember to quote all the patterns with '')";
  5141. die "${FUNCNAME}: no enabled implementation satisfy requirements";
  5142. fi;
  5143. python_wrapper_setup
  5144. }
  5145. python_wrapper_setup ()
  5146. {
  5147. debug-print-function ${FUNCNAME} "${@}";
  5148. local workdir=${1:-${T}/${EPYTHON}};
  5149. local impl=${2:-${EPYTHON}};
  5150. [[ -n ${workdir} ]] || die "${FUNCNAME}: no workdir specified.";
  5151. [[ -n ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON specified.";
  5152. if [[ ! -x ${workdir}/bin/python ]]; then
  5153. _python_check_dead_variables;
  5154. mkdir -p "${workdir}"/{bin,pkgconfig} || die;
  5155. rm -f "${workdir}"/bin/python{,2,3}{,-config} || die;
  5156. rm -f "${workdir}"/bin/2to3 || die;
  5157. rm -f "${workdir}"/pkgconfig/python{,2,3}.pc || die;
  5158. local EPYTHON PYTHON;
  5159. python_export "${impl}" EPYTHON PYTHON;
  5160. local pyver pyother;
  5161. if python_is_python3; then
  5162. pyver=3;
  5163. pyother=2;
  5164. else
  5165. pyver=2;
  5166. pyother=3;
  5167. fi;
  5168. cat > "${workdir}/bin/python" <<-_EOF_ ||
  5169. #!/bin/sh
  5170. exec "${PYTHON}" "\${@}"
  5171. _EOF_
  5172. die
  5173. cp "${workdir}/bin/python" "${workdir}/bin/python${pyver}" || die;
  5174. chmod +x "${workdir}/bin/python" "${workdir}/bin/python${pyver}" || die;
  5175. local nonsupp=("python${pyother}" "python${pyother}-config");
  5176. if [[ ${EPYTHON} == python* ]]; then
  5177. cat > "${workdir}/bin/python-config" <<-_EOF_ ||
  5178. #!/bin/sh
  5179. exec "${PYTHON}-config" "\${@}"
  5180. _EOF_
  5181. die
  5182. cp "${workdir}/bin/python-config" "${workdir}/bin/python${pyver}-config" || die;
  5183. chmod +x "${workdir}/bin/python-config" "${workdir}/bin/python${pyver}-config" || die;
  5184. ln -s "${PYTHON/python/2to3-}" "${workdir}"/bin/2to3 || die;
  5185. ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}.pc "${workdir}"/pkgconfig/python.pc || die;
  5186. ln -s python.pc "${workdir}"/pkgconfig/python${pyver}.pc || die;
  5187. else
  5188. nonsupp+=(2to3 python-config "python${pyver}-config");
  5189. fi;
  5190. local x;
  5191. for x in "${nonsupp[@]}";
  5192. do
  5193. cat > "${workdir}"/bin/${x} <<-_EOF_ ||
  5194. #!/bin/sh
  5195. echo "${ECLASS}: ${FUNCNAME}: ${x} is not supported by ${EPYTHON} (PYTHON_COMPAT)" >&2
  5196. exit 127
  5197. _EOF_
  5198. die
  5199. chmod +x "${workdir}"/bin/${x} || die;
  5200. done;
  5201. fi;
  5202. if [[ ${PATH##:*} != ${workdir}/bin ]]; then
  5203. PATH=${workdir}/bin${PATH:+:${PATH}};
  5204. fi;
  5205. if [[ ${PKG_CONFIG_PATH##:*} != ${workdir}/pkgconfig ]]; then
  5206. PKG_CONFIG_PATH=${workdir}/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}};
  5207. fi;
  5208. export PATH PKG_CONFIG_PATH
  5209. }
  5210. redirect_alloc_fd ()
  5211. {
  5212. local var=$1 file=$2 redir=${3:-"<>"};
  5213. if [[ ! -L /dev/fd && ${CBUILD} == *linux* ]]; then
  5214. eerror "You're missing a /dev/fd symlink to /proc/self/fd.";
  5215. eerror "Please fix the symlink and check your boot scripts (udev/etc...).";
  5216. die "/dev/fd is broken";
  5217. fi;
  5218. if [[ $(( (BASH_VERSINFO[0] << 8) + BASH_VERSINFO[1] )) -ge $(( (4 << 8) + 1 )) ]]; then
  5219. eval "exec {${var}}${redir}'${file}'";
  5220. else
  5221. local fd=10;
  5222. while :; do
  5223. if [[ ! -e /dev/fd/${fd} ]] && [[ ! -L /dev/fd/${fd} ]]; then
  5224. eval "exec ${fd}${redir}'${file}'" && break;
  5225. fi;
  5226. [[ ${fd} -gt 1024 ]] && die 'could not locate a free temp fd !?';
  5227. : $(( ++fd ));
  5228. done;
  5229. : $(( ${var} = fd ));
  5230. fi
  5231. }
  5232. replace_all_version_separators ()
  5233. {
  5234. local c=($(get_all_version_components "${2:-${PV}}"));
  5235. c=${c[@]//[-._]/$1};
  5236. echo ${c// }
  5237. }
  5238. replace_version_separator ()
  5239. {
  5240. eshopts_push -s extglob;
  5241. local w c v="${3:-${PV}}";
  5242. declare -i i found=0;
  5243. w=${1:-1};
  5244. c=($(get_all_version_components ${v}));
  5245. if [[ ${w} != *[[:digit:]]* ]]; then
  5246. for ((i = 0; i < ${#c[@]}; i++))
  5247. do
  5248. if [[ ${c[i]} == ${w} ]]; then
  5249. c[i]=${2};
  5250. break;
  5251. fi;
  5252. done;
  5253. else
  5254. for ((i = 0; i < ${#c[@]}; i++))
  5255. do
  5256. if [[ -n "${c[i]//[^-._]}" ]]; then
  5257. found+=1;
  5258. if ((found == w)); then
  5259. c[i]=${2};
  5260. break;
  5261. fi;
  5262. fi;
  5263. done;
  5264. fi;
  5265. c=${c[*]};
  5266. echo ${c// };
  5267. eshopts_pop
  5268. }
  5269. run_in_build_dir ()
  5270. {
  5271. debug-print-function ${FUNCNAME} "${@}";
  5272. local ret;
  5273. [[ ${#} -ne 0 ]] || die "${FUNCNAME}: no command specified.";
  5274. [[ -n ${BUILD_DIR} ]] || die "${FUNCNAME}: BUILD_DIR not set.";
  5275. mkdir -p "${BUILD_DIR}" || die;
  5276. pushd "${BUILD_DIR}" > /dev/null || die;
  5277. "${@}";
  5278. ret=${?};
  5279. popd > /dev/null || die;
  5280. return ${ret}
  5281. }
  5282. src_compile ()
  5283. {
  5284. cd "${BUILD_DIR}";
  5285. meson_src_compile
  5286. }
  5287. src_configure ()
  5288. {
  5289. local emesonargs=(-Denable-systemd=yes -Dwith_bluetooth=$(usex bluetooth true false) -Denable-networkmanager=$(usex networkmanager yes no) -DBROWSER_PLUGIN_DIR="${EPREFIX}"/usr/$(get_libdir)/nsbrowser/plugins);
  5290. meson_src_configure
  5291. }
  5292. src_install ()
  5293. {
  5294. cd "${BUILD_DIR}";
  5295. DESTDIR="${D}" eninja install
  5296. }
  5297. src_prepare ()
  5298. {
  5299. eapply "${FILESDIR}"/${PN}-3.22.0-defaults.patch;
  5300. gnome2_src_prepare
  5301. }
  5302. src_test ()
  5303. {
  5304. meson_src_test "$@"
  5305. }
  5306. src_unpack ()
  5307. {
  5308. git-r3_src_unpack "$@"
  5309. }
  5310. strip-linguas ()
  5311. {
  5312. local ls newls nols;
  5313. if [[ $1 == "-i" ]] || [[ $1 == "-u" ]]; then
  5314. local op=$1;
  5315. shift;
  5316. ls=$(find "$1" -name '*.po' -exec basename {} .po ';');
  5317. shift;
  5318. local d f;
  5319. for d in "$@";
  5320. do
  5321. if [[ ${op} == "-u" ]]; then
  5322. newls=${ls};
  5323. else
  5324. newls="";
  5325. fi;
  5326. for f in $(find "$d" -name '*.po' -exec basename {} .po ';');
  5327. do
  5328. if [[ ${op} == "-i" ]]; then
  5329. has ${f} ${ls} && newls="${newls} ${f}";
  5330. else
  5331. has ${f} ${ls} || newls="${newls} ${f}";
  5332. fi;
  5333. done;
  5334. ls=${newls};
  5335. done;
  5336. else
  5337. ls="$@";
  5338. fi;
  5339. nols="";
  5340. newls="";
  5341. for f in ${LINGUAS};
  5342. do
  5343. if has ${f} ${ls}; then
  5344. newls="${newls} ${f}";
  5345. else
  5346. nols="${nols} ${f}";
  5347. fi;
  5348. done;
  5349. [[ -n ${nols} ]] && einfo "Sorry, but ${PN} does not support the LINGUAS:" ${nols};
  5350. export LINGUAS=${newls:1}
  5351. }
  5352. systemd_dotmpfilesd ()
  5353. {
  5354. debug-print-function ${FUNCNAME} "${@}";
  5355. for f in "$@";
  5356. do
  5357. [[ ${f} == *.conf ]] || die 'tmpfiles.d files need to have .conf suffix.';
  5358. done;
  5359. ( insinto /usr/lib/tmpfiles.d/;
  5360. doins "${@}" )
  5361. }
  5362. systemd_dounit ()
  5363. {
  5364. debug-print-function ${FUNCNAME} "${@}";
  5365. ( insinto "$(_systemd_get_systemunitdir)";
  5366. doins "${@}" )
  5367. }
  5368. systemd_douserunit ()
  5369. {
  5370. debug-print-function ${FUNCNAME} "${@}";
  5371. ( insinto "$(_systemd_get_userunitdir)";
  5372. doins "${@}" )
  5373. }
  5374. systemd_enable_ntpunit ()
  5375. {
  5376. debug-print-function ${FUNCNAME} "${@}";
  5377. if [[ ${#} -lt 2 ]]; then
  5378. die "Usage: systemd_enable_ntpunit <NN-name> <service>...";
  5379. fi;
  5380. local ntpunit_name=${1};
  5381. local services=("${@:2}");
  5382. if [[ ${ntpunit_name} != [0-9][0-9]-* ]]; then
  5383. die "ntpunit.d file must be named NN-name where NN are digits.";
  5384. else
  5385. if [[ ${ntpunit_name} == *.list ]]; then
  5386. die "The .list suffix is appended implicitly to ntpunit.d name.";
  5387. fi;
  5388. fi;
  5389. local unitdir=$(systemd_get_systemunitdir);
  5390. local s;
  5391. for s in "${services[@]}";
  5392. do
  5393. if [[ ! -f "${D}${unitdir}/${s}" ]]; then
  5394. die "ntp-units.d provider ${s} not installed (yet?) in \${D}.";
  5395. fi;
  5396. echo "${s}" >> "${T}"/${ntpunit_name}.list || die;
  5397. done;
  5398. ( insinto "$(_systemd_get_utildir)"/ntp-units.d;
  5399. doins "${T}"/${ntpunit_name}.list );
  5400. local ret=${?};
  5401. rm "${T}"/${ntpunit_name}.list || die;
  5402. return ${ret}
  5403. }
  5404. systemd_enable_service ()
  5405. {
  5406. debug-print-function ${FUNCNAME} "${@}";
  5407. [[ ${#} -eq 2 ]] || die "Synopsis: systemd_enable_service target service";
  5408. local target=${1};
  5409. local service=${2};
  5410. local ud=$(_systemd_get_systemunitdir);
  5411. local destname=${service##*/};
  5412. dodir "${ud}"/"${target}".wants && dosym ../"${service}" "${ud}"/"${target}".wants/"${destname}"
  5413. }
  5414. systemd_get_systemunitdir ()
  5415. {
  5416. has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=;
  5417. debug-print-function ${FUNCNAME} "${@}";
  5418. echo "${EPREFIX}$(_systemd_get_systemunitdir)"
  5419. }
  5420. systemd_get_unitdir ()
  5421. {
  5422. [[ ${EAPI} == [012345] ]] || die "${FUNCNAME} is banned in EAPI 6, use systemd_get_systemunitdir instead";
  5423. systemd_get_systemunitdir
  5424. }
  5425. systemd_get_userunitdir ()
  5426. {
  5427. has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=;
  5428. debug-print-function ${FUNCNAME} "${@}";
  5429. echo "${EPREFIX}$(_systemd_get_userunitdir)"
  5430. }
  5431. systemd_get_utildir ()
  5432. {
  5433. has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=;
  5434. debug-print-function ${FUNCNAME} "${@}";
  5435. echo "${EPREFIX}$(_systemd_get_utildir)"
  5436. }
  5437. systemd_install_serviced ()
  5438. {
  5439. debug-print-function ${FUNCNAME} "${@}";
  5440. local src=${1};
  5441. local service=${2};
  5442. [[ -n ${src} ]] || die "No file specified";
  5443. if [[ ! -n ${service} ]]; then
  5444. [[ ${src} == *.conf ]] || die "Source file needs .conf suffix";
  5445. service=${src##*/};
  5446. service=${service%.conf};
  5447. fi;
  5448. [[ ${service} == *.d ]] && die "Service must not have .d suffix";
  5449. ( insinto /etc/systemd/system/"${service}".d;
  5450. newins "${src}" 00gentoo.conf )
  5451. }
  5452. systemd_is_booted ()
  5453. {
  5454. debug-print-function ${FUNCNAME} "${@}";
  5455. [[ -d /run/systemd/system ]];
  5456. local ret=${?};
  5457. debug-print "${FUNCNAME}: [[ -d /run/systemd/system ]] -> ${ret}";
  5458. return ${ret}
  5459. }
  5460. systemd_newtmpfilesd ()
  5461. {
  5462. debug-print-function ${FUNCNAME} "${@}";
  5463. [[ ${2} == *.conf ]] || die 'tmpfiles.d files need to have .conf suffix.';
  5464. ( insinto /usr/lib/tmpfiles.d/;
  5465. newins "${@}" )
  5466. }
  5467. systemd_newunit ()
  5468. {
  5469. debug-print-function ${FUNCNAME} "${@}";
  5470. ( insinto "$(_systemd_get_systemunitdir)";
  5471. newins "${@}" )
  5472. }
  5473. systemd_newuserunit ()
  5474. {
  5475. debug-print-function ${FUNCNAME} "${@}";
  5476. ( insinto "$(_systemd_get_userunitdir)";
  5477. newins "${@}" )
  5478. }
  5479. systemd_tmpfiles_create ()
  5480. {
  5481. debug-print-function ${FUNCNAME} "${@}";
  5482. [[ ${EBUILD_PHASE} == postinst ]] || die "${FUNCNAME}: Only valid in pkg_postinst";
  5483. [[ ${#} -gt 0 ]] || die "${FUNCNAME}: Must specify at least one filename";
  5484. [[ ${ROOT} == / ]] || return 0;
  5485. type systemd-tmpfiles &> /dev/null || return 0;
  5486. systemd-tmpfiles --create "${@}"
  5487. }
  5488. systemd_update_catalog ()
  5489. {
  5490. debug-print-function ${FUNCNAME} "${@}";
  5491. [[ ${EBUILD_PHASE} == post* ]] || die "${FUNCNAME} disallowed during ${EBUILD_PHASE_FUNC:-${EBUILD_PHASE}}";
  5492. local journalctl=${EPREFIX}/usr/bin/journalctl;
  5493. if [[ -x ${journalctl} ]]; then
  5494. ebegin "Updating systemd journal catalogs";
  5495. journalctl --update-catalog;
  5496. eend $?;
  5497. else
  5498. debug-print "${FUNCNAME}: journalctl not found.";
  5499. fi
  5500. }
  5501. systemd_with_unitdir ()
  5502. {
  5503. [[ ${EAPI:-0} != [012345] ]] && die "${FUNCNAME} is banned in EAPI ${EAPI}, use --with-${1:-systemdsystemunitdir}=\"\$(systemd_get_systemunitdir)\" instead";
  5504. debug-print-function ${FUNCNAME} "${@}";
  5505. local optname=${1:-systemdsystemunitdir};
  5506. echo --with-${optname}="$(systemd_get_systemunitdir)"
  5507. }
  5508. systemd_with_utildir ()
  5509. {
  5510. [[ ${EAPI:-0} != [012345] ]] && die "${FUNCNAME} is banned in EAPI ${EAPI}, use --with-systemdutildir=\"\$(systemd_get_utildir)\" instead";
  5511. debug-print-function ${FUNCNAME} "${@}";
  5512. echo --with-systemdutildir="$(systemd_get_utildir)"
  5513. }
  5514. tc-arch ()
  5515. {
  5516. tc-ninja_magic_to_arch portage "$@"
  5517. }
  5518. tc-arch-kernel ()
  5519. {
  5520. tc-ninja_magic_to_arch kern "$@"
  5521. }
  5522. tc-check-openmp ()
  5523. {
  5524. if ! tc-has-openmp; then
  5525. eerror "Your current compiler does not support OpenMP!";
  5526. if tc-is-gcc; then
  5527. eerror "Enable OpenMP support by building sys-devel/gcc with USE=\"openmp\".";
  5528. else
  5529. if tc-is-clang; then
  5530. eerror "OpenMP support in sys-devel/clang is provided by sys-libs/libomp.";
  5531. fi;
  5532. fi;
  5533. die "Active compiler does not have required support for OpenMP";
  5534. fi
  5535. }
  5536. tc-enables-pie ()
  5537. {
  5538. local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> /dev/null | grep '^true$'
  5539. #if defined(__PIE__)
  5540. true
  5541. #endif
  5542. EOF
  5543. )";
  5544. [[ ${ret} == true ]]
  5545. }
  5546. tc-enables-ssp ()
  5547. {
  5548. local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> /dev/null | grep '^true$'
  5549. #if defined(__SSP__) || defined(__SSP_STRONG__) || defined(__SSP_ALL__)
  5550. true
  5551. #endif
  5552. EOF
  5553. )";
  5554. [[ ${ret} == true ]]
  5555. }
  5556. tc-enables-ssp-all ()
  5557. {
  5558. local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> /dev/null | grep '^true$'
  5559. #if defined(__SSP_ALL__)
  5560. true
  5561. #endif
  5562. EOF
  5563. )";
  5564. [[ ${ret} == true ]]
  5565. }
  5566. tc-enables-ssp-strong ()
  5567. {
  5568. local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> /dev/null | grep '^true$'
  5569. #if defined(__SSP_STRONG__) || defined(__SSP_ALL__)
  5570. true
  5571. #endif
  5572. EOF
  5573. )";
  5574. [[ ${ret} == true ]]
  5575. }
  5576. tc-endian ()
  5577. {
  5578. local host=$1;
  5579. [[ -z ${host} ]] && host=${CTARGET:-${CHOST}};
  5580. host=${host%%-*};
  5581. case ${host} in
  5582. aarch64*be)
  5583. echo big
  5584. ;;
  5585. aarch64)
  5586. echo little
  5587. ;;
  5588. alpha*)
  5589. echo little
  5590. ;;
  5591. arm*b*)
  5592. echo big
  5593. ;;
  5594. arm*)
  5595. echo little
  5596. ;;
  5597. cris*)
  5598. echo little
  5599. ;;
  5600. hppa*)
  5601. echo big
  5602. ;;
  5603. i?86*)
  5604. echo little
  5605. ;;
  5606. ia64*)
  5607. echo little
  5608. ;;
  5609. m68*)
  5610. echo big
  5611. ;;
  5612. mips*l*)
  5613. echo little
  5614. ;;
  5615. mips*)
  5616. echo big
  5617. ;;
  5618. powerpc*le)
  5619. echo little
  5620. ;;
  5621. powerpc*)
  5622. echo big
  5623. ;;
  5624. s390*)
  5625. echo big
  5626. ;;
  5627. sh*b*)
  5628. echo big
  5629. ;;
  5630. sh*)
  5631. echo little
  5632. ;;
  5633. sparc*)
  5634. echo big
  5635. ;;
  5636. x86_64*)
  5637. echo little
  5638. ;;
  5639. *)
  5640. echo wtf
  5641. ;;
  5642. esac
  5643. }
  5644. tc-env_build ()
  5645. {
  5646. tc-export_build_env;
  5647. 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) "$@"
  5648. }
  5649. tc-export ()
  5650. {
  5651. local var;
  5652. for var in "$@";
  5653. do
  5654. [[ $(type -t "tc-get${var}") != "function" ]] && die "tc-export: invalid export variable '${var}'";
  5655. "tc-get${var}" > /dev/null;
  5656. done
  5657. }
  5658. tc-export_build_env ()
  5659. {
  5660. tc-export "$@";
  5661. : ${BUILD_CFLAGS:=-O1 -pipe};
  5662. : ${BUILD_CXXFLAGS:=-O1 -pipe};
  5663. : ${BUILD_CPPFLAGS:= };
  5664. : ${BUILD_LDFLAGS:= };
  5665. export BUILD_{C,CXX,CPP,LD}FLAGS;
  5666. local v;
  5667. for v in BUILD_{C,CXX,CPP,LD}FLAGS;
  5668. do
  5669. export ${v#BUILD_}_FOR_BUILD="${!v}";
  5670. done
  5671. }
  5672. tc-get-compiler-type ()
  5673. {
  5674. local code='
  5675. #if defined(__PATHSCALE__)
  5676. HAVE_PATHCC
  5677. #elif defined(__clang__)
  5678. HAVE_CLANG
  5679. #elif defined(__GNUC__)
  5680. HAVE_GCC
  5681. #endif
  5682. ';
  5683. local res=$($(tc-getCPP "$@") -E -P - <<<"${code}");
  5684. case ${res} in
  5685. *HAVE_PATHCC*)
  5686. echo pathcc
  5687. ;;
  5688. *HAVE_CLANG*)
  5689. echo clang
  5690. ;;
  5691. *HAVE_GCC*)
  5692. echo gcc
  5693. ;;
  5694. *)
  5695. echo unknown
  5696. ;;
  5697. esac
  5698. }
  5699. tc-getAR ()
  5700. {
  5701. tc-getPROG AR ar "$@"
  5702. }
  5703. tc-getAS ()
  5704. {
  5705. tc-getPROG AS as "$@"
  5706. }
  5707. tc-getBUILD_AR ()
  5708. {
  5709. tc-getBUILD_PROG AR ar "$@"
  5710. }
  5711. tc-getBUILD_AS ()
  5712. {
  5713. tc-getBUILD_PROG AS as "$@"
  5714. }
  5715. tc-getBUILD_CC ()
  5716. {
  5717. tc-getBUILD_PROG CC gcc "$@"
  5718. }
  5719. tc-getBUILD_CPP ()
  5720. {
  5721. tc-getBUILD_PROG CPP "$(tc-getBUILD_CC) -E" "$@"
  5722. }
  5723. tc-getBUILD_CXX ()
  5724. {
  5725. tc-getBUILD_PROG CXX g++ "$@"
  5726. }
  5727. tc-getBUILD_LD ()
  5728. {
  5729. tc-getBUILD_PROG LD ld "$@"
  5730. }
  5731. tc-getBUILD_NM ()
  5732. {
  5733. tc-getBUILD_PROG NM nm "$@"
  5734. }
  5735. tc-getBUILD_OBJCOPY ()
  5736. {
  5737. tc-getBUILD_PROG OBJCOPY objcopy "$@"
  5738. }
  5739. tc-getBUILD_PKG_CONFIG ()
  5740. {
  5741. tc-getBUILD_PROG PKG_CONFIG pkg-config "$@"
  5742. }
  5743. tc-getBUILD_PROG ()
  5744. {
  5745. _tc-getPROG CBUILD "BUILD_$1 $1_FOR_BUILD HOST$1" "${@:2}"
  5746. }
  5747. tc-getBUILD_RANLIB ()
  5748. {
  5749. tc-getBUILD_PROG RANLIB ranlib "$@"
  5750. }
  5751. tc-getBUILD_STRIP ()
  5752. {
  5753. tc-getBUILD_PROG STRIP strip "$@"
  5754. }
  5755. tc-getCC ()
  5756. {
  5757. tc-getPROG CC gcc "$@"
  5758. }
  5759. tc-getCPP ()
  5760. {
  5761. tc-getPROG CPP "${CC:-gcc} -E" "$@"
  5762. }
  5763. tc-getCXX ()
  5764. {
  5765. tc-getPROG CXX g++ "$@"
  5766. }
  5767. tc-getDLLWRAP ()
  5768. {
  5769. tc-getPROG DLLWRAP dllwrap "$@"
  5770. }
  5771. tc-getF77 ()
  5772. {
  5773. tc-getPROG F77 gfortran "$@"
  5774. }
  5775. tc-getFC ()
  5776. {
  5777. tc-getPROG FC gfortran "$@"
  5778. }
  5779. tc-getGCJ ()
  5780. {
  5781. tc-getPROG GCJ gcj "$@"
  5782. }
  5783. tc-getGO ()
  5784. {
  5785. tc-getPROG GO gccgo "$@"
  5786. }
  5787. tc-getLD ()
  5788. {
  5789. tc-getPROG LD ld "$@"
  5790. }
  5791. tc-getNM ()
  5792. {
  5793. tc-getPROG NM nm "$@"
  5794. }
  5795. tc-getOBJCOPY ()
  5796. {
  5797. tc-getPROG OBJCOPY objcopy "$@"
  5798. }
  5799. tc-getOBJDUMP ()
  5800. {
  5801. tc-getPROG OBJDUMP objdump "$@"
  5802. }
  5803. tc-getPKG_CONFIG ()
  5804. {
  5805. tc-getPROG PKG_CONFIG pkg-config "$@"
  5806. }
  5807. tc-getPROG ()
  5808. {
  5809. _tc-getPROG CHOST "$@"
  5810. }
  5811. tc-getRANLIB ()
  5812. {
  5813. tc-getPROG RANLIB ranlib "$@"
  5814. }
  5815. tc-getRC ()
  5816. {
  5817. tc-getPROG RC windres "$@"
  5818. }
  5819. tc-getSTRIP ()
  5820. {
  5821. tc-getPROG STRIP strip "$@"
  5822. }
  5823. tc-has-openmp ()
  5824. {
  5825. local base="${T}/test-tc-openmp";
  5826. cat > "${base}.c" <<-EOF
  5827. #include <omp.h>
  5828. int main() {
  5829. int nthreads, tid, ret = 0;
  5830. #pragma omp parallel private(nthreads, tid)
  5831. {
  5832. tid = omp_get_thread_num();
  5833. nthreads = omp_get_num_threads(); ret += tid + nthreads;
  5834. }
  5835. return ret;
  5836. }
  5837. EOF
  5838.  
  5839. $(tc-getCC "$@") -fopenmp "${base}.c" -o "${base}" &> /dev/null;
  5840. local ret=$?;
  5841. rm -f "${base}"*;
  5842. return ${ret}
  5843. }
  5844. tc-has-tls ()
  5845. {
  5846. local base="${T}/test-tc-tls";
  5847. cat > "${base}.c" <<-EOF
  5848. int foo(int *i) {
  5849. static __thread int j = 0;
  5850. return *i ? j : *i;
  5851. }
  5852. EOF
  5853.  
  5854. local flags;
  5855. case $1 in
  5856. -s)
  5857. flags="-S"
  5858. ;;
  5859. -c)
  5860. flags="-c"
  5861. ;;
  5862. -l)
  5863.  
  5864. ;;
  5865. -*)
  5866. die "Usage: tc-has-tls [-c|-l] [toolchain prefix]"
  5867. ;;
  5868. esac;
  5869. : ${flags:=-fPIC -shared -Wl,-z,defs};
  5870. [[ $1 == -* ]] && shift;
  5871. $(tc-getCC "$@") ${flags} "${base}.c" -o "${base}" &> /dev/null;
  5872. local ret=$?;
  5873. rm -f "${base}"*;
  5874. return ${ret}
  5875. }
  5876. tc-is-clang ()
  5877. {
  5878. [[ $(tc-get-compiler-type) == clang ]]
  5879. }
  5880. tc-is-cross-compiler ()
  5881. {
  5882. [[ ${CBUILD:-${CHOST}} != ${CHOST} ]]
  5883. }
  5884. tc-is-gcc ()
  5885. {
  5886. [[ $(tc-get-compiler-type) == gcc ]]
  5887. }
  5888. tc-is-softfloat ()
  5889. {
  5890. local CTARGET=${CTARGET:-${CHOST}};
  5891. case ${CTARGET} in
  5892. bfin* | h8300*)
  5893. echo "only"
  5894. ;;
  5895. *)
  5896. if [[ ${CTARGET//_/-} == *-softfloat-* ]]; then
  5897. echo "yes";
  5898. else
  5899. if [[ ${CTARGET//_/-} == *-softfp-* ]]; then
  5900. echo "softfp";
  5901. else
  5902. echo "no";
  5903. fi;
  5904. fi
  5905. ;;
  5906. esac
  5907. }
  5908. tc-is-static-only ()
  5909. {
  5910. local host=${CTARGET:-${CHOST}};
  5911. [[ ${host} == *-mint* ]]
  5912. }
  5913. tc-ld-disable-gold ()
  5914. {
  5915. if ! tc-ld-is-gold "$@"; then
  5916. return;
  5917. fi;
  5918. ewarn "Forcing usage of the BFD linker instead of GOLD";
  5919. local ld=$(tc-getLD "$@");
  5920. local bfd_ld="${ld%% *}.bfd";
  5921. local path_ld=$(which "${bfd_ld}" 2>/dev/null);
  5922. [[ -e ${path_ld} ]] && export LD=${bfd_ld};
  5923. local major=$(gcc-major-version "$@");
  5924. local minor=$(gcc-minor-version "$@");
  5925. if [[ ${major} -lt 4 ]] || [[ ${major} -eq 4 && ${minor} -lt 8 ]]; then
  5926. if [[ -e ${path_ld} ]]; then
  5927. local d="${T}/bfd-linker";
  5928. mkdir -p "${d}";
  5929. ln -sf "${path_ld}" "${d}"/ld;
  5930. export LDFLAGS="${LDFLAGS} -B${d}";
  5931. else
  5932. die "unable to locate a BFD linker to bypass gold";
  5933. fi;
  5934. else
  5935. export LDFLAGS="${LDFLAGS} -fuse-ld=bfd";
  5936. fi
  5937. }
  5938. tc-ld-is-gold ()
  5939. {
  5940. local out;
  5941. out=$($(tc-getLD "$@") --version 2>&1);
  5942. if [[ ${out} == *"GNU gold"* ]]; then
  5943. return 0;
  5944. fi;
  5945. local base="${T}/test-tc-gold";
  5946. cat > "${base}.c" <<-EOF
  5947. int main() { return 0; }
  5948. EOF
  5949.  
  5950. out=$($(tc-getCC "$@") ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -Wl,--version "${base}.c" -o "${base}" 2>&1);
  5951. rm -f "${base}"*;
  5952. if [[ ${out} == *"GNU gold"* ]]; then
  5953. return 0;
  5954. fi;
  5955. return 1
  5956. }
  5957. tc-ninja_magic_to_arch ()
  5958. {
  5959. function ninj ()
  5960. {
  5961. [[ ${type} == "kern" ]] && echo $1 || echo $2
  5962. };
  5963. local type=$1;
  5964. local host=$2;
  5965. [[ -z ${host} ]] && host=${CTARGET:-${CHOST}};
  5966. case ${host} in
  5967. aarch64*)
  5968. echo arm64
  5969. ;;
  5970. alpha*)
  5971. echo alpha
  5972. ;;
  5973. arm*)
  5974. echo arm
  5975. ;;
  5976. avr*)
  5977. ninj avr32 avr
  5978. ;;
  5979. bfin*)
  5980. ninj blackfin bfin
  5981. ;;
  5982. c6x*)
  5983. echo c6x
  5984. ;;
  5985. cris*)
  5986. echo cris
  5987. ;;
  5988. frv*)
  5989. echo frv
  5990. ;;
  5991. hexagon*)
  5992. echo hexagon
  5993. ;;
  5994. hppa*)
  5995. ninj parisc hppa
  5996. ;;
  5997. i?86*)
  5998. if [[ ${type} == "kern" && ${host} == *freebsd* ]]; then
  5999. echo i386;
  6000. else
  6001. echo x86;
  6002. fi
  6003. ;;
  6004. ia64*)
  6005. echo ia64
  6006. ;;
  6007. m68*)
  6008. echo m68k
  6009. ;;
  6010. metag*)
  6011. echo metag
  6012. ;;
  6013. microblaze*)
  6014. echo microblaze
  6015. ;;
  6016. mips*)
  6017. echo mips
  6018. ;;
  6019. nios2*)
  6020. echo nios2
  6021. ;;
  6022. nios*)
  6023. echo nios
  6024. ;;
  6025. or1k | or32*)
  6026. echo openrisc
  6027. ;;
  6028. powerpc*)
  6029. if [[ ${type} == "kern" ]]; then
  6030. echo powerpc;
  6031. else
  6032. if [[ ${host} == powerpc64* ]]; then
  6033. echo ppc64;
  6034. else
  6035. echo ppc;
  6036. fi;
  6037. fi
  6038. ;;
  6039. riscv*)
  6040. echo riscv
  6041. ;;
  6042. s390*)
  6043. echo s390
  6044. ;;
  6045. score*)
  6046. echo score
  6047. ;;
  6048. sh64*)
  6049. ninj sh64 sh
  6050. ;;
  6051. sh*)
  6052. echo sh
  6053. ;;
  6054. sparc64*)
  6055. ninj sparc64 sparc
  6056. ;;
  6057. sparc*)
  6058. [[ ${PROFILE_ARCH} == "sparc64" ]] && ninj sparc64 sparc || echo sparc
  6059. ;;
  6060. tile*)
  6061. echo tile
  6062. ;;
  6063. vax*)
  6064. echo vax
  6065. ;;
  6066. x86_64*freebsd*)
  6067. echo amd64
  6068. ;;
  6069. x86_64*)
  6070. if [[ ${type} == "kern" ]]; then
  6071. echo x86;
  6072. else
  6073. echo amd64;
  6074. fi
  6075. ;;
  6076. xtensa*)
  6077. echo xtensa
  6078. ;;
  6079. *)
  6080. echo unknown
  6081. ;;
  6082. esac
  6083. }
  6084. tc-stack-grows-down ()
  6085. {
  6086. case ${ARCH} in
  6087. hppa | metag)
  6088. return 1
  6089. ;;
  6090. esac;
  6091. return 0
  6092. }
  6093. uclibctoolize ()
  6094. {
  6095. die "Use elibtoolize"
  6096. }
  6097. use_if_iuse ()
  6098. {
  6099. in_iuse $1 || return 1;
  6100. use $1
  6101. }
  6102. validate_desktop_entries ()
  6103. {
  6104. eqawarn "validate_desktop_entries is deprecated and should be not be used.";
  6105. eqawarn ".desktop file validation is done implicitly by Portage now.";
  6106. _eutils_eprefix_init;
  6107. if [[ -x "${EPREFIX}"/usr/bin/desktop-file-validate ]]; then
  6108. einfo "Checking desktop entry validity";
  6109. local directories="";
  6110. for d in /usr/share/applications $@;
  6111. do
  6112. [[ -d ${ED}${d} ]] && directories="${directories} ${ED}${d}";
  6113. done;
  6114. if [[ -n ${directories} ]]; then
  6115. for FILE in $(find ${directories} -name "*\.desktop" -not -path '*.hidden*' | sort -u 2>/dev/null);
  6116. do
  6117. local temp=$(desktop-file-validate ${FILE} | grep -v "warning:" | sed -e "s|error: ||" -e "s|${FILE}:|--|g" );
  6118. [[ -n $temp ]] && elog ${temp/--/${FILE/${ED}/}:};
  6119. done;
  6120. fi;
  6121. echo "";
  6122. else
  6123. einfo "Passing desktop entry validity check. Install dev-util/desktop-file-utils, if you want to help to improve Gentoo.";
  6124. fi
  6125. }
  6126. version_compare ()
  6127. {
  6128. eshopts_push -s extglob;
  6129. local ver_a=${1} ver_b=${2} parts_a parts_b;
  6130. local cur_tok_a cur_tok_b num_part_a num_part_b;
  6131. local -i cur_idx_a=0 cur_idx_b=0 prev_idx_a prev_idx_b;
  6132. parts_a=($(get_all_version_components "${ver_a}" ));
  6133. parts_b=($(get_all_version_components "${ver_b}" ));
  6134. local -i inf_loop=0;
  6135. while true; do
  6136. inf_loop+=1;
  6137. ((inf_loop > 20)) && die "versionator compare bug [numbers, ${ver_a}, ${ver_b}]";
  6138. prev_idx_a=cur_idx_a;
  6139. prev_idx_b=cur_idx_b;
  6140. cur_tok_a=${parts_a[cur_idx_a]};
  6141. cur_tok_b=${parts_b[cur_idx_b]};
  6142. if [[ -n ${cur_tok_a} ]] && [[ -z ${cur_tok_a//[[:digit:]]} ]]; then
  6143. cur_idx_a+=1;
  6144. [[ ${parts_a[cur_idx_a]} == . ]] && cur_idx_a+=1;
  6145. else
  6146. cur_tok_a=;
  6147. fi;
  6148. if [[ -n ${cur_tok_b} ]] && [[ -z ${cur_tok_b//[[:digit:]]} ]]; then
  6149. cur_idx_b+=1;
  6150. [[ ${parts_b[cur_idx_b]} == . ]] && cur_idx_b+=1;
  6151. else
  6152. cur_tok_b=;
  6153. fi;
  6154. [[ -z ${cur_tok_a} && -z ${cur_tok_b} ]] && break;
  6155. [[ -z ${cur_tok_a} ]] && eshopts_pop && return 1;
  6156. [[ -z ${cur_tok_b} ]] && eshopts_pop && return 3;
  6157. if (( prev_idx_a != 0 && prev_idx_b != 0 )) && [[ ${cur_tok_a} == 0* || ${cur_tok_b} == 0* ]]; then
  6158. cur_tok_a=${cur_tok_a%%+(0)};
  6159. cur_tok_b=${cur_tok_b%%+(0)};
  6160. [[ ${cur_tok_a} < ${cur_tok_b} ]] && eshopts_pop && return 1;
  6161. [[ ${cur_tok_a} > ${cur_tok_b} ]] && eshopts_pop && return 3;
  6162. else
  6163. cur_tok_a=${cur_tok_a##+(0)};
  6164. cur_tok_b=${cur_tok_b##+(0)};
  6165. : ${cur_tok_a:=0};
  6166. : ${cur_tok_b:=0};
  6167. ((cur_tok_a < cur_tok_b)) && eshopts_pop && return 1;
  6168. ((cur_tok_a > cur_tok_b)) && eshopts_pop && return 3;
  6169. fi;
  6170. done;
  6171. local letter_a=;
  6172. letter_a=${parts_a[cur_idx_a]};
  6173. if [[ ${#letter_a} -eq 1 && -z ${letter_a/[a-z]} ]]; then
  6174. cur_idx_a+=1;
  6175. else
  6176. letter_a=@;
  6177. fi;
  6178. local letter_b=;
  6179. letter_b=${parts_b[cur_idx_b]};
  6180. if [[ ${#letter_b} -eq 1 && -z ${letter_b/[a-z]} ]]; then
  6181. cur_idx_b+=1;
  6182. else
  6183. letter_b=@;
  6184. fi;
  6185. [[ ${letter_a} < ${letter_b} ]] && eshopts_pop && return 1;
  6186. [[ ${letter_a} > ${letter_b} ]] && eshopts_pop && return 3;
  6187. inf_loop=0;
  6188. while true; do
  6189. inf_loop+=1;
  6190. ((inf_loop > 20)) && die "versionator compare bug [numbers, ${ver_a}, ${ver_b}]";
  6191. [[ ${parts_a[cur_idx_a]} == _ ]] && ((cur_idx_a++));
  6192. [[ ${parts_b[cur_idx_b]} == _ ]] && ((cur_idx_b++));
  6193. cur_tok_a=${parts_a[cur_idx_a]};
  6194. cur_tok_b=${parts_b[cur_idx_b]};
  6195. num_part_a=0;
  6196. num_part_b=0;
  6197. if has ${cur_tok_a%%+([0-9])} "alpha" "beta" "pre" "rc" "p"; then
  6198. cur_idx_a+=1;
  6199. num_part_a=${cur_tok_a##+([a-z])};
  6200. num_part_a=${num_part_a##+(0)};
  6201. : ${num_part_a:=0};
  6202. cur_tok_a=${cur_tok_a%%+([0-9])};
  6203. else
  6204. cur_tok_a=;
  6205. fi;
  6206. if has ${cur_tok_b%%+([0-9])} alpha beta pre rc p; then
  6207. cur_idx_b+=1;
  6208. num_part_b=${cur_tok_b##+([a-z])};
  6209. num_part_b=${num_part_b##+(0)};
  6210. : ${num_part_b:=0};
  6211. cur_tok_b=${cur_tok_b%%+([0-9])};
  6212. else
  6213. cur_tok_b=;
  6214. fi;
  6215. if [[ ${cur_tok_a} != ${cur_tok_b} ]]; then
  6216. local suffix;
  6217. for suffix in alpha beta pre rc "" p;
  6218. do
  6219. [[ ${cur_tok_a} == ${suffix} ]] && eshopts_pop && return 1;
  6220. [[ ${cur_tok_b} == ${suffix} ]] && eshopts_pop && return 3;
  6221. done;
  6222. else
  6223. if [[ -z ${cur_tok_a} && -z ${cur_tok_b} ]]; then
  6224. break;
  6225. else
  6226. ((num_part_a < num_part_b)) && eshopts_pop && return 1;
  6227. ((num_part_a > num_part_b)) && eshopts_pop && return 3;
  6228. fi;
  6229. fi;
  6230. done;
  6231. [[ ${parts_a[cur_idx_a]} == - ]] && ((cur_idx_a++));
  6232. [[ ${parts_b[cur_idx_b]} == - ]] && ((cur_idx_b++));
  6233. if [[ -n ${parts_a[cur_idx_a]/r+([0-9])} || -n ${parts_b[cur_idx_b]/r+([0-9])} ]]; then
  6234. die "versionator compare bug [revisions, ${ver_a}, ${ver_b}]";
  6235. fi;
  6236. num_part_a=${parts_a[cur_idx_a]#r};
  6237. num_part_a=${num_part_a##+(0)};
  6238. : ${num_part_a:=0};
  6239. num_part_b=${parts_b[cur_idx_b]#r};
  6240. num_part_b=${num_part_b##+(0)};
  6241. : ${num_part_b:=0};
  6242. ((num_part_a < num_part_b)) && eshopts_pop && return 1;
  6243. ((num_part_a > num_part_b)) && eshopts_pop && return 3;
  6244. eshopts_pop;
  6245. return 2
  6246. }
  6247. version_format_string ()
  6248. {
  6249. local fstr=$1;
  6250. shift;
  6251. set -- $(get_version_components "$@");
  6252. eval echo "${fstr}"
  6253. }
  6254. version_is_at_least ()
  6255. {
  6256. local want_s="$1" have_s="${2:-${PVR}}" r;
  6257. version_compare "${want_s}" "${have_s}";
  6258. r=$?;
  6259. case $r in
  6260. 1 | 2)
  6261. return 0
  6262. ;;
  6263. 3)
  6264. return 1
  6265. ;;
  6266. *)
  6267. die "versionator compare bug [atleast, ${want_s}, ${have_s}, ${r}]"
  6268. ;;
  6269. esac
  6270. }
  6271. version_sort ()
  6272. {
  6273. eshopts_push -s extglob;
  6274. local items=;
  6275. local -i left=0;
  6276. items=("$@");
  6277. while ((left < ${#items[@]})); do
  6278. local -i lowest_idx=left;
  6279. local -i idx=lowest_idx+1;
  6280. while ((idx < ${#items[@]})); do
  6281. version_compare "${items[lowest_idx]}" "${items[idx]}";
  6282. [[ $? -eq 3 ]] && lowest_idx=idx;
  6283. idx+=1;
  6284. done;
  6285. local tmp=${items[lowest_idx]};
  6286. items[lowest_idx]=${items[left]};
  6287. items[left]=${tmp};
  6288. left+=1;
  6289. done;
  6290. echo ${items[@]};
  6291. eshopts_pop
  6292. }
  6293. xdg_desktop_database_update ()
  6294. {
  6295. local updater="${EROOT}${DESKTOP_DATABASE_UPDATE_BIN}";
  6296. if [[ ${EBUILD_PHASE} != post* ]]; then
  6297. die "xdg_desktop_database_update must be used in pkg_post* phases.";
  6298. fi;
  6299. if [[ ! -x "${updater}" ]]; then
  6300. debug-print "${updater} is not executable";
  6301. return;
  6302. fi;
  6303. ebegin "Updating .desktop files database";
  6304. "${updater}" -q "${EROOT}${DESKTOP_DATABASE_DIR}";
  6305. eend $?
  6306. }
  6307. xdg_environment_reset ()
  6308. {
  6309. export XDG_DATA_HOME="${HOME}/.local/share";
  6310. export XDG_CONFIG_HOME="${HOME}/.config";
  6311. export XDG_CACHE_HOME="${HOME}/.cache";
  6312. export XDG_RUNTIME_DIR="${T}/run";
  6313. mkdir -p "${XDG_DATA_HOME}" "${XDG_CONFIG_HOME}" "${XDG_CACHE_HOME}" "${XDG_RUNTIME_DIR}" || die;
  6314. chmod 0700 "${XDG_RUNTIME_DIR}" || die;
  6315. unset DBUS_SESSION_BUS_ADDRESS
  6316. }
  6317. xdg_mimeinfo_database_update ()
  6318. {
  6319. local updater="${EROOT}${MIMEINFO_DATABASE_UPDATE_BIN}";
  6320. if [[ ${EBUILD_PHASE} != post* ]]; then
  6321. die "xdg_mimeinfo_database_update must be used in pkg_post* phases.";
  6322. fi;
  6323. if [[ ! -x "${updater}" ]]; then
  6324. debug-print "${updater} is not executable";
  6325. return;
  6326. fi;
  6327. ebegin "Updating shared mime info database";
  6328. "${updater}" "${EROOT}${MIMEINFO_DATABASE_DIR}";
  6329. eend $?
  6330. }
  6331. xdg_pkg_postinst ()
  6332. {
  6333. if [[ ${#XDG_ECLASS_DESKTOPFILES[@]} -gt 0 ]]; then
  6334. xdg_desktop_database_update;
  6335. else
  6336. debug-print "No .desktop files to add to database";
  6337. fi;
  6338. if [[ ${#XDG_ECLASS_MIMEINFOFILES[@]} -gt 0 ]]; then
  6339. xdg_mimeinfo_database_update;
  6340. else
  6341. debug-print "No mime info files to add to database";
  6342. fi
  6343. }
  6344. xdg_pkg_postrm ()
  6345. {
  6346. if [[ ${#XDG_ECLASS_DESKTOPFILES[@]} -gt 0 ]]; then
  6347. xdg_desktop_database_update;
  6348. else
  6349. debug-print "No .desktop files to add to database";
  6350. fi;
  6351. if [[ ${#XDG_ECLASS_MIMEINFOFILES[@]} -gt 0 ]]; then
  6352. xdg_mimeinfo_database_update;
  6353. else
  6354. debug-print "No mime info files to add to database";
  6355. fi
  6356. }
  6357. xdg_pkg_preinst ()
  6358. {
  6359. local f;
  6360. XDG_ECLASS_DESKTOPFILES=();
  6361. while IFS= read -r -d '' f; do
  6362. XDG_ECLASS_DESKTOPFILES+=(${f});
  6363. done < <(cd "${D}" && find 'usr/share/applications' -type f -print0 2>/dev/null);
  6364. XDG_ECLASS_MIMEINFOFILES=();
  6365. while IFS= read -r -d '' f; do
  6366. XDG_ECLASS_MIMEINFOFILES+=(${f});
  6367. done < <(cd "${D}" && find 'usr/share/mime' -type f -print0 2>/dev/null);
  6368. export XDG_ECLASS_DESKTOPFILES XDG_ECLASS_MIMEINFOFILES
  6369. }
  6370. xdg_src_prepare ()
  6371. {
  6372. xdg_environment_reset;
  6373. has ${EAPI:-0} 6 && default
  6374. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement