Advertisement
Metalhead33

envorniment

Mar 27th, 2015
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 100.41 KB | None | 0 0
  1. declare -x ABI="amd64"
  2. declare -x ABI_X86="64"
  3. declare -a ALL_AUTOTOOLS_MACROS='([0]="AC_PROG_LIBTOOL" [1]="AM_PROG_LIBTOOL" [2]="LT_INIT" [3]="AC_CONFIG_HEADERS" [4]="AC_CONFIG_HEADER" [5]="AM_CONFIG_HEADERS" [6]="AM_CONFIG_HEADER" [7]="AC_CONFIG_SUBDIRS" [8]="AC_CONFIG_AUX_DIR" [9]="AC_CONFIG_MACRO_DIR" [10]="AM_INIT_AUTOMAKE" [11]="AM_GLIB_GNU_GETTEXT" [12]="AM_GNU_GETTEXT_VERSION" [13]="AC_PROG_INTLTOOL" [14]="IT_PROG_INTLTOOL" [15]="GTK_DOC_CHECK" [16]="GNOME_DOC_INIT")'
  4. declare -x ALSA_CARDS=""
  5. 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"
  6. declare -x ARCH="amd64"
  7. declare -- AT_M4DIR=""
  8. declare -- AT_SYS_M4DIR=""
  9. declare -- AUTOTOOLS_AUTO_DEPEND="yes"
  10. declare -- AUTOTOOLS_DEPEND="!<sys-devel/gettext-0.18.1.1-r3
  11. || ( >=sys-devel/automake-1.13:1.13 >=sys-devel/automake-1.15:1.15 )
  12. >=sys-devel/autoconf-2.69
  13. >=sys-devel/libtool-2.4"
  14. declare -x BOOTSTRAP_USE="cxx unicode internal-glib python_targets_python3_3 python_targets_python2_7 multilib"
  15. declare -x CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author"
  16. declare -x CAMERAS="ptp2"
  17. declare -x CBUILD="x86_64-pc-linux-gnu"
  18. declare -x CFLAGS="-march=native -O2 -pipe"
  19. declare -x CFLAGS_amd64="-m64"
  20. declare -x CFLAGS_default
  21. declare -x CFLAGS_x32="-mx32"
  22. declare -x CFLAGS_x86="-m32"
  23. declare -x CHOST="x86_64-pc-linux-gnu"
  24. declare -x CHOST_amd64="x86_64-pc-linux-gnu"
  25. declare -x CHOST_default="x86_64-pc-linux-gnu"
  26. declare -x CHOST_x32="x86_64-pc-linux-gnux32"
  27. declare -x CHOST_x86="i686-pc-linux-gnu"
  28. declare -x COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog"
  29. declare -x CONF_PREFIX="/usr"
  30. declare -x CPU_FLAGS_X86="mmx mmxext sse sse2"
  31. declare -x CTARGET_default="x86_64-pc-linux-gnu"
  32. declare -x CXXFLAGS="-march=native -O2 -pipe"
  33. declare -x DEFAULT_ABI="amd64"
  34. declare -x DEFINED_PHASES=" configure install postinst prepare unpack"
  35. declare DEPEND="x11-libs/libSM
  36. x11-libs/libICE
  37. x11-libs/libX11
  38. x11-libs/libXext
  39. x11-libs/libXv
  40. x11-libs/libXxf86vm
  41. xinerama? ( x11-libs/libXinerama )
  42. x11-libs/libXtst
  43. x11-libs/libXau
  44. x11-libs/libXdmcp
  45. >=media-libs/freetype-2
  46. >=sys-libs/zlib-1.1.4
  47. >=media-libs/libpng-1.2
  48. >=dev-libs/libxml2-2.5.11
  49. nls? ( virtual/libintl )
  50. nls? ( sys-devel/gettext )
  51. dev-util/pkgconfig !<sys-devel/gettext-0.18.1.1-r3
  52. || ( >=sys-devel/automake-1.13:1.13 >=sys-devel/automake-1.15:1.15 )
  53. >=sys-devel/autoconf-2.69
  54. >=sys-devel/libtool-2.4"
  55. declare DESCRIPTION="High quality television application for use with video capture cards"
  56. declare -x DESTTREE="/usr"
  57. declare -x DIROPTIONS="-m0755"
  58. declare -x EAPI="4"
  59. declare -- ECONF_SOURCE="."
  60. declare -x ELIBC="glibc"
  61. declare -x ELT_APPLIED_PATCHES=" portage/1.2.0 sed/1.5.6"
  62. declare -- EPATCH_COMMON_OPTS="-g0 -E --no-backup-if-mismatch"
  63. declare -- EPATCH_EXCLUDE=""
  64. declare -- EPATCH_FORCE="no"
  65. declare -- EPATCH_MULTI_MSG="Applying various patches (bugfixes/updates) ..."
  66. declare -- EPATCH_OPTS=""
  67. declare -- EPATCH_SINGLE_MSG=""
  68. declare -- EPATCH_SOURCE="/var/tmp/portage/media-tv/tvtime-1.0.2_p20110405/work/patch"
  69. declare -- EPATCH_SUFFIX="patch.bz2"
  70. declare -x EXEOPTIONS="-m0755"
  71. declare -x FCFLAGS="-O2 -pipe"
  72. declare -x FETCHCOMMAND_SSH="bash -c \"x=\\\${2#ssh://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && port=22 ; exec rsync --rsh=\\\"ssh -p\\\${port} \\\${3}\\\" -avP \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" rsync \"\${DISTDIR}/\${FILE}\" \"\${URI}\" \"\${PORTAGE_SSH_OPTS}\""
  73. declare -x FFLAGS="-O2 -pipe"
  74. declare -x FLTK_DOCDIR="/usr/share/doc/fltk-1.3.2/html"
  75. declare -x GCC_SPECS=""
  76. declare -x GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx"
  77. declare -x GRUB_PLATFORMS=""
  78. declare -x GSETTINGS_BACKEND="dconf"
  79. declare -x GUILE_LOAD_PATH="/usr/share/guile/1.8"
  80. declare HDEPEND=""
  81. declare -x HG="/usr/bin/hg"
  82. declare HOMEPAGE="http://tvtime.sourceforge.net/"
  83. declare -x INHERITED=" multilib toolchain-funcs eutils libtool autotools"
  84. declare -x INPUT_DEVICES=""
  85. declare -x INSDESTTREE=""
  86. declare -x INSOPTIONS="-m0644"
  87. declare IUSE="nls xinerama "
  88. declare -x IUSE_IMPLICIT="abi_x86_64 prefix prefix-guest"
  89. declare -x JAVAC="/etc/java-config-2/current-system-vm/bin/javac"
  90. declare -x JAVA_HOME="/etc/java-config-2/current-system-vm"
  91. declare -x JDK_HOME="/etc/java-config-2/current-system-vm"
  92. declare -x KERNEL="linux"
  93. declare -x KERNEL_ABI="amd64"
  94. declare -x KEYWORDS="~amd64 ~ppc ~x86"
  95. declare -x LADSPA_PATH="/usr/lib64/ladspa"
  96. declare -x LANG="en_US.utf8"
  97. declare -x LCD_DEVICES=""
  98. declare -x LC_MESSAGES="C"
  99. declare -x LDFLAGS="-Wl,-O1 -Wl,--as-needed"
  100. declare -x LDFLAGS_amd64="-m elf_x86_64"
  101. declare -x LDFLAGS_default
  102. declare -x LDFLAGS_x32="-m elf32_x86_64"
  103. declare -x LDFLAGS_x86="-m elf_i386"
  104. declare -x LIBDIR_amd64="lib64"
  105. declare -x LIBDIR_amd64_fbsd="lib64"
  106. declare -x LIBDIR_arm="lib"
  107. declare -x LIBDIR_arm64="lib64"
  108. declare -x LIBDIR_default="lib"
  109. declare -x LIBDIR_n32="lib32"
  110. declare -x LIBDIR_n64="lib64"
  111. declare -x LIBDIR_o32="lib"
  112. declare -x LIBDIR_ppc="lib32"
  113. declare -x LIBDIR_ppc64="lib64"
  114. declare -x LIBDIR_s390="lib32"
  115. declare -x LIBDIR_s390x="lib64"
  116. declare -x LIBDIR_sparc32="lib32"
  117. declare -x LIBDIR_sparc64="lib64"
  118. declare -x LIBDIR_x32="libx32"
  119. declare -x LIBDIR_x86="lib32"
  120. declare -x LIBDIR_x86_fbsd="lib32"
  121. declare -x LIBOPTIONS="-m0644"
  122. declare -x LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer"
  123. declare -x LICENSE="GPL-2"
  124. declare -x MAKEOPTS="-j2"
  125. declare -x MULTILIB_ABIS="amd64 x86"
  126. declare -x MULTILIB_STRICT_DENY="64-bit.*shared object"
  127. declare -x MULTILIB_STRICT_DIRS="/lib32 /lib /usr/lib32 /usr/lib /usr/kde/*/lib32 /usr/kde/*/lib /usr/qt/*/lib32 /usr/qt/*/lib /usr/X11R6/lib32 /usr/X11R6/lib"
  128. declare -x MULTILIB_STRICT_EXEMPT="(perl5|gcc|gcc-lib|binutils|eclipse-3|debug|portage|udev|systemd|clang|python-exec)"
  129. declare -x MULTIOSDIRS="../lib64:../lib32"
  130. declare -- MY_PN="tvtime_kernellabs"
  131. declare -x NETBEANS="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml"
  132. declare -x OFFICE_IMPLEMENTATION="libreoffice"
  133. declare -x OPENCL_PROFILE="nvidia"
  134. declare -x OPENGL_PROFILE="xorg-x11"
  135. declare -x PATH="/usr/lib/portage/python2.7/ebuild-helpers:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.3"
  136. declare PDEPEND=""
  137. declare -x PHP_TARGETS=""
  138. declare -x PKG_CONFIG_PATH="/usr/lib64/pkgconfig"
  139. declare -a PORTAGE_DOCOMPRESS='([0]="/usr/share/doc" [1]="/usr/share/info" [2]="/usr/share/man")'
  140. declare -x PORTAGE_DOCOMPRESS_SIZE_LIMIT="128"
  141. declare -a PORTAGE_DOCOMPRESS_SKIP='([0]="/usr/share/doc/tvtime-1.0.2_p20110405/html")'
  142. declare -x PRELINK_PATH_MASK="/usr/lib64/libfreebl3.so:/usr/lib64/libnssdbm3.so:/usr/lib64/libsoftokn3.so:/opt/bin/skype"
  143. 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"
  144. declare -x PROPERTIES=""
  145. declare -x PROVIDE=""
  146. declare -x PYTHONDONTWRITEBYTECODE="1"
  147. declare -x PYTHON_SINGLE_TARGET=""
  148. declare -x PYTHON_TARGETS=""
  149. declare -x QT_GRAPHICSSYSTEM="raster"
  150. declare RDEPEND="x11-libs/libSM
  151. x11-libs/libICE
  152. x11-libs/libX11
  153. x11-libs/libXext
  154. x11-libs/libXv
  155. x11-libs/libXxf86vm
  156. xinerama? ( x11-libs/libXinerama )
  157. x11-libs/libXtst
  158. x11-libs/libXau
  159. x11-libs/libXdmcp
  160. >=media-libs/freetype-2
  161. >=sys-libs/zlib-1.1.4
  162. >=media-libs/libpng-1.2
  163. >=dev-libs/libxml2-2.5.11
  164. nls? ( virtual/libintl ) "
  165. declare REPOSITORY
  166. declare REQUIRED_USE=""
  167. declare -x RESTRICT=""
  168. declare -x RESUMECOMMAND_SSH="bash -c \"x=\\\${2#ssh://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && port=22 ; exec rsync --rsh=\\\"ssh -p\\\${port} \\\${3}\\\" -avP \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" rsync \"\${DISTDIR}/\${FILE}\" \"\${URI}\" \"\${PORTAGE_SSH_OPTS}\""
  169. declare -x RUBY_TARGETS=""
  170. declare -x S="/var/tmp/portage/media-tv/tvtime-1.0.2_p20110405/work/tvtime-1.0.2_p20110405"
  171. declare -x SANDBOX_DEBUG="0"
  172. declare -x SANDBOX_DENY=""
  173. declare -x SANDBOX_PID="32468"
  174. declare -x SANDBOX_PREDICT="/var/tmp/portage/media-tv/tvtime-1.0.2_p20110405/homedir:/dev/crypto:/proc/self/coredump_filter:/var/cache/fontconfig:/dev/nvidiactl:/dev/ati/card:/dev/dri/card"
  175. declare -x SANDBOX_READ="/:/var/tmp"
  176. declare -x SANDBOX_VERBOSE="1"
  177. declare -x SANDBOX_WRITE=":/dev/console:/dev/fd:/dev/full:/dev/null:/dev/pts/:/dev/pty:/dev/shm:/dev/tts:/dev/tty:/dev/vc/:/dev/zero:/proc/self/fd:/tmp/:/usr/lib32/cf:/usr/lib32/conftest:/usr/lib64/cf:/usr/lib64/conftest:/usr/lib/cf:/usr/lib/conftest:/usr/tmp/cf:/usr/tmp/conftest:/var/tmp:/var/tmp/:/var/tmp/portage/media-tv/tvtime-1.0.2_p20110405/homedir/.bash_history"
  178. declare -x SHELL="/bin/bash"
  179. declare -x SLOT="0"
  180. declare SRC_URI="http://linuxized.com/distfiles/tvtime_kernellabs-1.0.2_p20110405.tar.bz2"
  181. declare -x SYMLINK_LIB="yes"
  182. declare -x USE="abi_x86_64 amd64 elibc_glibc kernel_linux nls userland_GNU xinerama"
  183. declare -x USERLAND="GNU"
  184. declare -x USE_EXPAND_IMPLICIT="ARCH ELIBC KERNEL USERLAND"
  185. declare -x USE_EXPAND_UNPREFIXED="ARCH"
  186. declare -x USE_EXPAND_VALUES_ARCH="alpha amd64 amd64-fbsd amd64-linux arm arm-linux arm64 hppa hppa-hpux ia64 ia64-hpux ia64-linux m68k m68k-mint mips ppc ppc64 ppc64-linux ppc-aix ppc-macos ppc-openbsd s390 sh sparc sparc64-freebsd sparc64-solaris sparc-fbsd sparc-solaris x64-freebsd x64-macos x64-openbsd x64-solaris x86 x86-cygwin x86-fbsd x86-freebsd x86-interix x86-linux x86-macos x86-netbsd x86-openbsd x86-solaris x86-winnt"
  187. declare -x USE_EXPAND_VALUES_ELIBC="AIX Cygwin Darwin DragonFly FreeBSD glibc HPUX Interix mintlib musl NetBSD OpenBSD SunOS uclibc Winnt"
  188. declare -x USE_EXPAND_VALUES_KERNEL="AIX Cygwin Darwin FreeBSD freemint HPUX Interix linux NetBSD OpenBSD SunOS Winnt"
  189. declare -x USE_EXPAND_VALUES_USERLAND="BSD GNU"
  190. declare -x VIDEO_CARDS=""
  191. declare -x WANT_AUTOCONF="2.5"
  192. declare -x WANT_AUTOMAKE="1.13"
  193. declare -x WANT_LIBTOOL="latest"
  194. declare -x XDG_CONFIG_DIRS="/etc/xdg"
  195. declare -x XDG_DATA_DIRS="/usr/local/share:/usr/share"
  196. declare -x XFCE_PLUGINS="trash"
  197. 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"
  198. declare -- _AUTOTOOLS_ECLASS="1"
  199. declare -- _ELT_NOTED_TMP="true"
  200. declare -- _EUTILS_ECLASS="1"
  201. declare -x _E_DOCDESTTREE_=""
  202. declare -x _E_EXEDESTTREE_=""
  203. declare -a _LATEST_AUTOMAKE='([0]="1.13:1.13" [1]="1.15:1.15")'
  204. declare -- _LIBTOOL_ECLASS="1"
  205. declare -- _LIBTOOL_ECLASSDIR_LOCAL="/usr/portage/eclass"
  206. declare -- _MULTILIB_ECLASS="1"
  207. declare -- _TOOLCHAIN_FUNCS_ECLASS="1"
  208. declare -- __AUTOTOOLS_AUTO_DEPEND="yes"
  209. declare -- _libtool_atom=">=sys-devel/libtool-2.4"
  210. declare -- phase_func
  211. ELT_libtool_version ()
  212. {
  213. ( unset VERSION;
  214. eval $(grep -e '^[[:space:]]*VERSION=' "$1");
  215. echo "${VERSION:-0}" )
  216. }
  217. ELT_try_and_apply_patch ()
  218. {
  219. local ret=0;
  220. local file=$1;
  221. local patch=$2;
  222. local src=$3;
  223. local disp="${src} patch";
  224. local log="${T}/elibtool.log";
  225. if [[ -z ${_ELT_NOTED_TMP} ]]; then
  226. _ELT_NOTED_TMP=true;
  227. printf 'temp patch: %s\n' "${patch}" > "${log}";
  228. fi;
  229. printf '\nTrying %s\n' "${disp}" >> "${log}";
  230. if [[ ! -e ${file} ]]; then
  231. echo "File not found: ${file}" >> "${log}";
  232. return 1;
  233. fi;
  234. local perms="$(find ${file} -maxdepth 0 -printf '%m')";
  235. if patch -p0 --dry-run "${file}" "${patch}" >> "${log}" 2>&1; then
  236. einfo " Applying ${disp} ...";
  237. patch -p0 -g0 --no-backup-if-mismatch "${file}" "${patch}" >> "${log}" 2>&1;
  238. ret=$?;
  239. export ELT_APPLIED_PATCHES="${ELT_APPLIED_PATCHES} ${src}";
  240. else
  241. ret=1;
  242. fi;
  243. chmod "${perms}" "${file}";
  244. return "${ret}"
  245. }
  246. ELT_walk_patches ()
  247. {
  248. local patch tmp;
  249. local ret=1;
  250. local file=$1;
  251. local patch_set=$2;
  252. local patch_dir="$(elt_patch_dir)/${patch_set}";
  253. local rem_int_dep=$3;
  254. [[ -z ${patch_set} ]] && return 1;
  255. [[ ! -d ${patch_dir} ]] && return 1;
  256. local sed_args=(-e "s:@GENTOO_LIBDIR@:$(get_libdir):g");
  257. if [[ -n ${rem_int_dep} ]]; then
  258. sed_args+=(-e "s|@REM_INT_DEP@|${rem_int_dep}|g");
  259. fi;
  260. pushd "$(elt_patch_dir)" > /dev/null || die;
  261. for patch in $(find "${patch_set}" -maxdepth 1 -type f | LC_ALL=C sort -r);
  262. do
  263. tmp="${T}/libtool-elt.patch";
  264. sed "${sed_args[@]}" "${patch}" > "${tmp}" || die;
  265. if ELT_try_and_apply_patch "${file}" "${tmp}" "${patch}"; then
  266. ret=0;
  267. break;
  268. fi;
  269. done;
  270. popd > /dev/null;
  271. return ${ret}
  272. }
  273. VER_major ()
  274. {
  275. [[ -z $1 ]] && return 1;
  276. local VER=$@;
  277. echo "${VER%%[^[:digit:]]*}"
  278. }
  279. VER_micro ()
  280. {
  281. [[ -z $1 ]] && return 1;
  282. local VER=$@;
  283. VER=${VER#*.*.};
  284. echo "${VER%%[^[:digit:]]*}"
  285. }
  286. VER_minor ()
  287. {
  288. [[ -z $1 ]] && return 1;
  289. local VER=$@;
  290. VER=${VER#*.};
  291. echo "${VER%%[^[:digit:]]*}"
  292. }
  293. VER_to_int ()
  294. {
  295. [[ -z $1 ]] && return 1;
  296. local VER_MAJOR=$(VER_major "$1");
  297. local VER_MINOR=$(VER_minor "$1");
  298. local VER_MICRO=$(VER_micro "$1");
  299. local VER_int=$(( VER_MAJOR * 65536 + VER_MINOR * 256 + VER_MICRO ));
  300. if [[ ${VER_int} -ge 65536 ]]; then
  301. echo "${VER_int}";
  302. return 0;
  303. fi;
  304. echo 1;
  305. return 1
  306. }
  307. __bashpid ()
  308. {
  309. sh -c 'echo ${PPID}'
  310. }
  311. __eapi6_src_install ()
  312. {
  313. if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then
  314. emake DESTDIR="${D}" install;
  315. fi;
  316. einstalldocs
  317. }
  318. __eapi6_src_prepare ()
  319. {
  320. if [[ $(declare -p PATCHES) == "declare -a"* ]]; then
  321. eapply "${PATCHES[@]}";
  322. else
  323. if [[ -n ${PATCHES} ]]; then
  324. eapply ${PATCHES};
  325. fi;
  326. fi;
  327. eapply_user
  328. }
  329. __start_distcc ()
  330. {
  331. if has distcc $FEATURES && has distcc-pump $FEATURES; then
  332. if [[ -z $INCLUDE_SERVER_PORT ]] || [[ ! -w $INCLUDE_SERVER_PORT ]]; then
  333. eval $(pump --startup | grep -v PATH);
  334. trap "pump --shutdown >/dev/null" EXIT;
  335. fi;
  336. fi
  337. }
  338. _at_uses_autoheader ()
  339. {
  340. _at_uses_pkg A{C,M}_CONFIG_HEADER{S,}
  341. }
  342. _at_uses_automake ()
  343. {
  344. _at_uses_pkg AM_INIT_AUTOMAKE
  345. }
  346. _at_uses_gettext ()
  347. {
  348. _at_uses_pkg AM_GNU_GETTEXT_VERSION
  349. }
  350. _at_uses_glibgettext ()
  351. {
  352. _at_uses_pkg AM_GLIB_GNU_GETTEXT
  353. }
  354. _at_uses_gnomedoc ()
  355. {
  356. _at_uses_pkg GNOME_DOC_INIT
  357. }
  358. _at_uses_gtkdoc ()
  359. {
  360. _at_uses_pkg GTK_DOC_CHECK
  361. }
  362. _at_uses_intltool ()
  363. {
  364. _at_uses_pkg {AC,IT}_PROG_INTLTOOL
  365. }
  366. _at_uses_libtool ()
  367. {
  368. _at_uses_pkg A{C,M}_PROG_LIBTOOL LT_INIT
  369. }
  370. _at_uses_pkg ()
  371. {
  372. if [[ -n $(autotools_check_macro "$@") ]]; then
  373. return 0;
  374. else
  375. local macro args=();
  376. for macro in "$@";
  377. do
  378. args+=(-e "^[[:space:]]*${macro}\>");
  379. done;
  380. egrep -q "${args[@]}" configure.??;
  381. fi
  382. }
  383. _automake_version ()
  384. {
  385. autotools_run_tool --at-output automake --version 2> /dev/null | sed -n -e '1{s:.*(GNU automake) ::p;q}'
  386. }
  387. _autotools_m4dir_include ()
  388. {
  389. local x include_opts flag;
  390. [[ ${WANT_AUTOCONF} == "2.1" ]] && flag="l" || flag="I";
  391. for x in "$@";
  392. do
  393. case ${x} in
  394. -${flag})
  395.  
  396. ;;
  397. *)
  398. [[ ! -d ${x} ]] && ewarn "autotools.eclass: '${x}' does not exist";
  399. include_opts+=" -${flag} ${x}"
  400. ;;
  401. esac;
  402. done;
  403. echo ${include_opts}
  404. }
  405. _elibtoolize ()
  406. {
  407. local LIBTOOLIZE=${LIBTOOLIZE:-$(type -P glibtoolize > /dev/null && echo glibtoolize || echo libtoolize)};
  408. [[ -f GNUmakefile.am || -f Makefile.am ]] && set -- "$@" --automake;
  409. autotools_run_tool ${LIBTOOLIZE} "$@"
  410. }
  411. _epatch_draw_line ()
  412. {
  413. [[ -z $1 ]] && set "$(printf "%65s" '')";
  414. echo "${1//?/=}"
  415. }
  416. _eutils_eprefix_init ()
  417. {
  418. has "${EAPI:-0}" 0 1 2 && : ${ED:=${D}} ${EPREFIX:=} ${EROOT:=${ROOT}}
  419. }
  420. _gcc-install-dir ()
  421. {
  422. echo "$(LC_ALL=C $(tc-getCC) -print-search-dirs 2> /dev/null | awk '$1=="install:" {print $2}')"
  423. }
  424. _gcc-specs-directive_raw ()
  425. {
  426. local cc=$(tc-getCC);
  427. local specfiles=$(LC_ALL=C ${cc} -v 2>&1 | awk '$1=="Reading" {print $NF}');
  428. ${cc} -dumpspecs 2> /dev/null | cat - ${specfiles} | awk -v directive=$1 'BEGIN { pspec=""; spec=""; outside=1 }
  429. $1=="*"directive":" { pspec=spec; spec=""; outside=0; next }
  430. outside || NF==0 || ( substr($1,1,1)=="*" && substr($1,length($1),1)==":" ) { outside=1; next }
  431. spec=="" && substr($0,1,1)=="+" { spec=pspec " " substr($0,2); next }
  432. { spec=spec $0 }
  433. END { print spec }';
  434. return 0
  435. }
  436. _gcc-specs-exists ()
  437. {
  438. [[ -f $(_gcc-install-dir)/$1 ]]
  439. }
  440. _gcc_fullversion ()
  441. {
  442. local ver="$1";
  443. shift;
  444. set -- `$(tc-getCPP "$@") -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__"`;
  445. eval echo "$ver"
  446. }
  447. _iconins ()
  448. {
  449. ( local funcname=$1;
  450. shift;
  451. local size dir;
  452. local context=apps;
  453. local theme=hicolor;
  454. while [[ $# -gt 0 ]]; do
  455. case $1 in
  456. -s | --size)
  457. if [[ ${2%%x*}x${2%%x*} == "$2" ]]; then
  458. size=${2%%x*};
  459. else
  460. size=${2};
  461. fi;
  462. case ${size} in
  463. 16 | 22 | 24 | 32 | 36 | 48 | 64 | 72 | 96 | 128 | 192 | 256 | 512)
  464. size=${size}x${size}
  465. ;;
  466. scalable)
  467.  
  468. ;;
  469. *)
  470. eerror "${size} is an unsupported icon size!";
  471. exit 1
  472. ;;
  473. esac;
  474. shift 2
  475. ;;
  476. -t | --theme)
  477. theme=${2};
  478. shift 2
  479. ;;
  480. -c | --context)
  481. context=${2};
  482. shift 2
  483. ;;
  484. *)
  485. if [[ -z ${size} ]]; then
  486. insinto /usr/share/pixmaps;
  487. else
  488. insinto /usr/share/icons/${theme}/${size}/${context};
  489. fi;
  490. if [[ ${funcname} == doicon ]]; then
  491. if [[ -f $1 ]]; then
  492. doins "${1}";
  493. else
  494. if [[ -d $1 ]]; then
  495. shopt -s nullglob;
  496. doins "${1}"/*.{png,svg};
  497. shopt -u nullglob;
  498. else
  499. eerror "${1} is not a valid file/directory!";
  500. exit 1;
  501. fi;
  502. fi;
  503. else
  504. break;
  505. fi;
  506. shift 1
  507. ;;
  508. esac;
  509. done;
  510. if [[ ${funcname} == newicon ]]; then
  511. newins "$@";
  512. fi ) || die
  513. }
  514. _tc-getPROG ()
  515. {
  516. local tuple=$1;
  517. local v var vars=$2;
  518. local prog=$3;
  519. var=${vars%% *};
  520. for v in ${vars};
  521. do
  522. if [[ -n ${!v} ]]; then
  523. export ${var}="${!v}";
  524. echo "${!v}";
  525. return 0;
  526. fi;
  527. done;
  528. local search=;
  529. [[ -n $4 ]] && search=$(type -p "$4-${prog}");
  530. [[ -z ${search} && -n ${!tuple} ]] && search=$(type -p "${!tuple}-${prog}");
  531. [[ -n ${search} ]] && prog=${search##*/};
  532. export ${var}=${prog};
  533. echo "${!var}"
  534. }
  535. autotools_check_macro ()
  536. {
  537. [[ -f configure.ac || -f configure.in ]] || return 0;
  538. local trace_file=".__autoconf_trace_data";
  539. if [[ ! -e ${trace_file} ]] || [[ ! aclocal.m4 -ot ${trace_file} ]]; then
  540. WANT_AUTOCONF="2.5" autoconf $(autotools_m4dir_include) ${ALL_AUTOTOOLS_MACROS[@]/#/--trace=} > ${trace_file} 2> /dev/null;
  541. fi;
  542. local macro args=();
  543. for macro in "$@";
  544. do
  545. has ${macro} ${ALL_AUTOTOOLS_MACROS[@]} || die "internal error: add ${macro} to ALL_AUTOTOOLS_MACROS";
  546. args+=(-e ":${macro}:");
  547. done;
  548. grep "${args[@]}" ${trace_file}
  549. }
  550. autotools_check_macro_val ()
  551. {
  552. local macro scan_out;
  553. for macro in "$@";
  554. do
  555. autotools_check_macro "${macro}" | gawk -v macro="${macro}" '($0 !~ /^[[:space:]]*(#|dnl)/) {
  556. if (match($0, macro ":(.*)$", res))
  557. print res[1]
  558. }' | uniq;
  559. done;
  560. return 0
  561. }
  562. autotools_env_setup ()
  563. {
  564. if [[ ${WANT_AUTOMAKE} == "latest" ]]; then
  565. local pv;
  566. for pv in ${_LATEST_AUTOMAKE[@]/#*:};
  567. do
  568. ROOT=/ has_version "=sys-devel/automake-${pv}*" && export WANT_AUTOMAKE="${pv}";
  569. done;
  570. [[ ${WANT_AUTOMAKE} == "latest" ]] && die "Cannot find the latest automake! Tried ${_LATEST_AUTOMAKE[*]}";
  571. fi;
  572. [[ ${WANT_AUTOCONF} == "latest" ]] && export WANT_AUTOCONF=2.5
  573. }
  574. autotools_m4dir_include ()
  575. {
  576. _autotools_m4dir_include ${AT_M4DIR}
  577. }
  578. autotools_m4sysdir_include ()
  579. {
  580. _autotools_m4dir_include $(eval echo ${AT_SYS_M4DIR})
  581. }
  582. autotools_run_tool ()
  583. {
  584. local autofail=true m4flags=false missing_ok=false return_output=false;
  585. while [[ -n $1 ]]; do
  586. case $1 in
  587. --at-no-fail)
  588. autofail=false
  589. ;;
  590. --at-m4flags)
  591. m4flags=true
  592. ;;
  593. --at-missing)
  594. missing_ok=true
  595. ;;
  596. --at-output)
  597. return_output=true
  598. ;;
  599. *)
  600. break
  601. ;;
  602. esac;
  603. shift;
  604. done;
  605. if [[ ${EBUILD_PHASE} != "unpack" && ${EBUILD_PHASE} != "prepare" ]]; then
  606. ewarn "QA Warning: running $1 in ${EBUILD_PHASE} phase";
  607. fi;
  608. if ${missing_ok} && ! type -P ${1} > /dev/null; then
  609. einfo "Skipping '$*' due $1 not installed";
  610. return 0;
  611. fi;
  612. autotools_env_setup;
  613. local STDERR_TARGET="${T}/$1.out";
  614. if [[ -e ${STDERR_TARGET} ]]; then
  615. local i=1;
  616. while :; do
  617. STDERR_TARGET="${T}/$1-${i}.out";
  618. [[ -e ${STDERR_TARGET} ]] || break;
  619. : $(( i++ ));
  620. done;
  621. fi;
  622. if ${m4flags}; then
  623. set -- "${1}" $(autotools_m4dir_include) "${@:2}" $(autotools_m4sysdir_include);
  624. fi;
  625. if ${return_output}; then
  626. "$@";
  627. return;
  628. fi;
  629. printf "***** $1 *****\n***** PWD: ${PWD}\n***** $*\n\n" > "${STDERR_TARGET}";
  630. ebegin "Running $@";
  631. "$@" >> "${STDERR_TARGET}" 2>&1;
  632. if ! eend $? && ${autofail}; then
  633. echo;
  634. eerror "Failed Running $1 !";
  635. eerror;
  636. eerror "Include in your bugreport the contents of:";
  637. eerror;
  638. eerror " ${STDERR_TARGET}";
  639. echo;
  640. die "Failed Running $1 !";
  641. fi
  642. }
  643. built_with_use ()
  644. {
  645. _eutils_eprefix_init;
  646. local hidden="no";
  647. if [[ $1 == "--hidden" ]]; then
  648. hidden="yes";
  649. shift;
  650. fi;
  651. local missing_action="die";
  652. if [[ $1 == "--missing" ]]; then
  653. missing_action=$2;
  654. shift;
  655. shift;
  656. case ${missing_action} in
  657. true | false | die)
  658.  
  659. ;;
  660. *)
  661. die "unknown action '${missing_action}'"
  662. ;;
  663. esac;
  664. fi;
  665. local opt=$1;
  666. [[ ${opt:0:1} = "-" ]] && shift || opt="-a";
  667. local PKG=$(best_version $1);
  668. [[ -z ${PKG} ]] && die "Unable to resolve $1 to an installed package";
  669. shift;
  670. local USEFILE=${EROOT}/var/db/pkg/${PKG}/USE;
  671. local IUSEFILE=${EROOT}/var/db/pkg/${PKG}/IUSE;
  672. if [[ ! -e ${USEFILE} ]] || [[ ! -e ${IUSEFILE} && ${hidden} == "no" ]]; then
  673. case ${missing_action} in
  674. true)
  675. return 0
  676. ;;
  677. false)
  678. return 1
  679. ;;
  680. die)
  681. die "Unable to determine what USE flags $PKG was built with"
  682. ;;
  683. esac;
  684. fi;
  685. if [[ ${hidden} == "no" ]]; then
  686. local IUSE_BUILT=($(<"${IUSEFILE}"));
  687. local expand;
  688. for expand in $(echo ${USE_EXPAND} | tr '[:upper:]' '[:lower:]');
  689. do
  690. if [[ $1 == ${expand}_* ]]; then
  691. expand="";
  692. break;
  693. fi;
  694. done;
  695. if [[ -n ${expand} ]]; then
  696. if ! has $1 ${IUSE_BUILT[@]#[-+]}; then
  697. case ${missing_action} in
  698. true)
  699. return 0
  700. ;;
  701. false)
  702. return 1
  703. ;;
  704. die)
  705. die "$PKG does not actually support the $1 USE flag!"
  706. ;;
  707. esac;
  708. fi;
  709. fi;
  710. fi;
  711. local USE_BUILT=$(<${USEFILE});
  712. while [[ $# -gt 0 ]]; do
  713. if [[ ${opt} = "-o" ]]; then
  714. has $1 ${USE_BUILT} && return 0;
  715. else
  716. has $1 ${USE_BUILT} || return 1;
  717. fi;
  718. shift;
  719. done;
  720. [[ ${opt} = "-a" ]]
  721. }
  722. check_license ()
  723. {
  724. die "you no longer need this as portage supports ACCEPT_LICENSE itself"
  725. }
  726. config_rpath_update ()
  727. {
  728. local dst src=$(type -P gettext | sed 's:bin/gettext:share/gettext/config.rpath:');
  729. [[ $# -eq 0 ]] && set -- $(find -name config.rpath);
  730. [[ $# -eq 0 ]] && return 0;
  731. einfo "Updating all config.rpath files";
  732. for dst in "$@";
  733. do
  734. einfo " ${dst}";
  735. cp "${src}" "${dst}" || die;
  736. done
  737. }
  738. darwintoolize ()
  739. {
  740. die "Use elibtoolize"
  741. }
  742. doicon ()
  743. {
  744. _iconins ${FUNCNAME} "$@"
  745. }
  746. domenu ()
  747. {
  748. ( local i j ret=0;
  749. insinto /usr/share/applications;
  750. for i in "$@";
  751. do
  752. if [[ -f ${i} ]]; then
  753. doins "${i}";
  754. ((ret+=$?));
  755. else
  756. if [[ -d ${i} ]]; then
  757. for j in "${i}"/*.desktop;
  758. do
  759. doins "${j}";
  760. ((ret+=$?));
  761. done;
  762. else
  763. ((++ret));
  764. fi;
  765. fi;
  766. done;
  767. exit ${ret} )
  768. }
  769. eaclocal ()
  770. {
  771. [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && autotools_run_tool --at-m4flags aclocal "$@" $(eaclocal_amflags)
  772. }
  773. eaclocal_amflags ()
  774. {
  775. local aclocal_opts amflags_file;
  776. for amflags_file in GNUmakefile.am Makefile.am GNUmakefile.in Makefile.in;
  777. do
  778. [[ -e ${amflags_file} ]] || continue;
  779. autotools_env_setup;
  780. aclocal_opts=$(sed -n "/^ACLOCAL_AMFLAGS[[:space:]]*=/{ # match the first line
  781. s:[^=]*=::p; # then gobble up all escaped lines
  782. : nextline /\\\\$/{ n; p; b nextline; } }" ${amflags_file});
  783. eval aclocal_opts=\""${aclocal_opts}"\";
  784. break;
  785. done;
  786. echo ${aclocal_opts}
  787. }
  788. eautoconf ()
  789. {
  790. if [[ ! -f configure.ac && ! -f configure.in ]]; then
  791. echo;
  792. eerror "No configure.{ac,in} present in '${PWD}'!";
  793. echo;
  794. die "No configure.{ac,in} present!";
  795. fi;
  796. if [[ ${WANT_AUTOCONF} != "2.1" && -e configure.in ]]; then
  797. eqawarn "This package has a configure.in file which has long been deprecated. Please";
  798. eqawarn "update it to use configure.ac instead as newer versions of autotools will die";
  799. eqawarn "when it finds this file. See https://bugs.gentoo.org/426262 for details.";
  800. fi;
  801. autotools_run_tool --at-m4flags autoconf "$@"
  802. }
  803. eautoheader ()
  804. {
  805. _at_uses_autoheader || return 0;
  806. autotools_run_tool --at-no-fail --at-m4flags autoheader "$@"
  807. }
  808. eautomake ()
  809. {
  810. local extra_opts=();
  811. local makefile_name;
  812. for makefile_name in {GNUmakefile,{M,m}akefile}.am "";
  813. do
  814. [[ -f ${makefile_name} ]] && break;
  815. done;
  816. function _automake_version ()
  817. {
  818. autotools_run_tool --at-output automake --version 2> /dev/null | sed -n -e '1{s:.*(GNU automake) ::p;q}'
  819. };
  820. if [[ -z ${makefile_name} ]]; then
  821. _at_uses_automake || return 0;
  822. else
  823. if [[ -z ${FROM_EAUTORECONF} && -f ${makefile_name%.am}.in ]]; then
  824. local used_automake;
  825. local installed_automake;
  826. installed_automake=$(WANT_AUTOMAKE= _automake_version);
  827. used_automake=$(head -n 1 < ${makefile_name%.am}.in | sed -e 's:.*by automake \(.*\) from .*:\1:');
  828. if [[ ${installed_automake} != ${used_automake} ]]; then
  829. ewarn "Automake used for the package (${used_automake}) differs from" "the installed version (${installed_automake}).";
  830. ewarn "Forcing a full rebuild of the autotools to workaround.";
  831. eautoreconf;
  832. return 0;
  833. fi;
  834. fi;
  835. fi;
  836. [[ -f INSTALL && -f AUTHORS && -f ChangeLog && -f NEWS && -f README ]] || extra_opts+=(--foreign);
  837. case $(_automake_version) in
  838. 1.4 | 1.4[.-]*)
  839.  
  840. ;;
  841. *)
  842. extra_opts+=(--force-missing)
  843. ;;
  844. esac;
  845. autotools_run_tool automake --add-missing --copy "${extra_opts[@]}" "$@"
  846. }
  847. eautopoint ()
  848. {
  849. autotools_run_tool autopoint "$@"
  850. }
  851. eautoreconf ()
  852. {
  853. local x g;
  854. if [[ -z ${AT_NO_RECURSIVE} ]]; then
  855. for x in $(autotools_check_macro_val AC_CONFIG_SUBDIRS);
  856. do
  857. if [[ -d ${x} ]]; then
  858. pushd "${x}" > /dev/null;
  859. AT_NOELIBTOOLIZE="yes" eautoreconf || die;
  860. popd > /dev/null;
  861. fi;
  862. done;
  863. fi;
  864. einfo "Running eautoreconf in '${PWD}' ...";
  865. local m4dirs=$(autotools_check_macro_val AC_CONFIG_{AUX,MACRO}_DIR);
  866. [[ -n ${m4dirs} ]] && mkdir -p ${m4dirs};
  867. 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 --install --copy --force");
  868. for ((i = 0; i < ${#tools[@]}; i += 3 ))
  869. do
  870. if _at_uses_${tools[i]}; then
  871. tools[i+1]=true;
  872. ${tools[i+2]};
  873. fi;
  874. done;
  875. local rerun_aclocal=false;
  876. eaclocal;
  877. for ((i = 0; i < ${#tools[@]}; i += 3 ))
  878. do
  879. if ! ${tools[i+1]} && _at_uses_${tools[i]}; then
  880. ${tools[i+2]};
  881. rerun_aclocal=true;
  882. fi;
  883. done;
  884. ${rerun_aclocal} && eaclocal;
  885. if [[ ${WANT_AUTOCONF} = 2.1 ]]; then
  886. eautoconf;
  887. else
  888. eautoconf --force;
  889. fi;
  890. eautoheader;
  891. [[ ${AT_NOEAUTOMAKE} != "yes" ]] && FROM_EAUTORECONF="yes" eautomake ${AM_OPTS};
  892. if [[ ${AT_NOELIBTOOLIZE} != "yes" ]]; then
  893. elibtoolize --force "${PWD}";
  894. fi;
  895. return 0
  896. }
  897. ebeep ()
  898. {
  899. ewarn "QA Notice: ebeep is not defined in EAPI=${EAPI}, please file a bug at http://bugs.gentoo.org"
  900. }
  901. econf_build ()
  902. {
  903. local CBUILD=${CBUILD:-${CHOST}};
  904. tc-env_build econf --build=${CBUILD} --host=${CBUILD} "$@"
  905. }
  906. ecvs_clean ()
  907. {
  908. [[ -z $* ]] && set -- .;
  909. find "$@" -type d -name 'CVS' -prune -print0 | xargs -0 rm -rf;
  910. find "$@" -type f -name '.cvs*' -print0 | xargs -0 rm -rf
  911. }
  912. edos2unix ()
  913. {
  914. [[ $# -eq 0 ]] && return 0;
  915. sed -i 's/\r$//' -- "$@" || die
  916. }
  917. einstalldocs ()
  918. {
  919. debug-print-function ${FUNCNAME} "${@}";
  920. local dodoc_opts=-r;
  921. has ${EAPI} 0 1 2 3 && dodoc_opts=;
  922. if ! declare -p DOCS &>/dev/null; then
  923. local d;
  924. for d in README* ChangeLog AUTHORS NEWS TODO CHANGES THANKS BUGS FAQ CREDITS CHANGELOG;
  925. do
  926. if [[ -s ${d} ]]; then
  927. dodoc "${d}" || die;
  928. fi;
  929. done;
  930. else
  931. if [[ $(declare -p DOCS) == "declare -a"* ]]; then
  932. if [[ -n ${DOCS[@]} ]]; then
  933. dodoc ${dodoc_opts} "${DOCS[@]}" || die;
  934. fi;
  935. else
  936. if [[ -n ${DOCS} ]]; then
  937. dodoc ${dodoc_opts} ${DOCS} || die;
  938. fi;
  939. fi;
  940. fi;
  941. if [[ $(declare -p HTML_DOCS 2>/dev/null) == "declare -a"* ]]; then
  942. if [[ -n ${HTML_DOCS[@]} ]]; then
  943. dohtml -r "${HTML_DOCS[@]}" || die;
  944. fi;
  945. else
  946. if [[ -n ${HTML_DOCS} ]]; then
  947. dohtml -r ${HTML_DOCS} || die;
  948. fi;
  949. fi;
  950. return 0
  951. }
  952. elibtoolize ()
  953. {
  954. local x;
  955. local dirs=();
  956. local do_portage="no";
  957. local do_reversedeps="no";
  958. local do_only_patches="no";
  959. local do_uclibc="yes";
  960. local deptoremove=;
  961. local do_shallow="no";
  962. local force="false";
  963. local elt_patches="install-sh ltmain portage relink max_cmd_len sed test tmp cross as-needed target-nm";
  964. for x in "$@";
  965. do
  966. case ${x} in
  967. --portage)
  968. do_portage="yes"
  969. ;;
  970. --reverse-deps)
  971. do_reversedeps="yes";
  972. elt_patches+=" fix-relink"
  973. ;;
  974. --patch-only)
  975. do_only_patches="yes"
  976. ;;
  977. --remove-internal-dep=*)
  978. deptoremove=${x#--remove-internal-dep=};
  979. [[ -n ${deptoremove} ]] && elt_patches+=" rem-int-dep"
  980. ;;
  981. --shallow)
  982. do_shallow="yes"
  983. ;;
  984. --no-uclibc)
  985. do_uclibc="no"
  986. ;;
  987. --force)
  988. force="true"
  989. ;;
  990. -*)
  991. eerror "Invalid elibtoolize option: ${x}";
  992. die "elibtoolize called with ${x} ??"
  993. ;;
  994. *)
  995. dirs+=("${x}")
  996. ;;
  997. esac;
  998. done;
  999. [[ ${do_uclibc} == "yes" ]] && elt_patches+=" uclibc-conf uclibc-ltconf";
  1000. case ${CHOST} in
  1001. *-aix*)
  1002. elt_patches+=" hardcode aixrtl"
  1003. ;;
  1004. *-darwin*)
  1005. elt_patches+=" darwin-ltconf darwin-ltmain darwin-conf"
  1006. ;;
  1007. *-solaris*)
  1008. elt_patches+=" sol2-conf sol2-ltmain"
  1009. ;;
  1010. *-freebsd*)
  1011. elt_patches+=" fbsd-conf fbsd-ltconf"
  1012. ;;
  1013. *-hpux*)
  1014. elt_patches+=" hpux-conf deplibs hc-flag-ld hardcode hardcode-relink relink-prog no-lc"
  1015. ;;
  1016. *-irix*)
  1017. elt_patches+=" irix-ltmain"
  1018. ;;
  1019. *-mint*)
  1020. elt_patches+=" mint-conf"
  1021. ;;
  1022. esac;
  1023. if $(tc-getLD) --version 2>&1 | grep -qs 'GNU gold'; then
  1024. elt_patches+=" gold-conf";
  1025. fi;
  1026. if [[ ${do_shallow} == "yes" ]]; then
  1027. [[ ${#dirs[@]} -ne 0 ]] && die "Using --shallow with explicit dirs doesn't make sense";
  1028. [[ -f ${S}/ltmain.sh || -f ${S}/configure ]] && dirs+=("${S}");
  1029. else
  1030. [[ ${#dirs[@]} -eq 0 ]] && dirs+=("${S}");
  1031. dirs=($(find "${dirs[@]}" '(' -name ltmain.sh -o -name configure ')' -printf '%h\n' | sort -u));
  1032. fi;
  1033. local d p ret;
  1034. for d in "${dirs[@]}";
  1035. do
  1036. export ELT_APPLIED_PATCHES=;
  1037. if [[ -f ${d}/.elibtoolized ]]; then
  1038. ${force} || continue;
  1039. fi;
  1040. local outfunc="einfo";
  1041. [[ -f ${d}/.elibtoolized ]] && outfunc="ewarn";
  1042. ${outfunc} "Running elibtoolize in: ${d#${WORKDIR}/}/";
  1043. if [[ ${outfunc} == "ewarn" ]]; then
  1044. ewarn " We've already been run in this tree; you should";
  1045. ewarn " avoid this if possible (perhaps by filing a bug)";
  1046. fi;
  1047. [[ -f ${d}/ltmain.sh ]] && for p in ${elt_patches};
  1048. do
  1049. ret=0;
  1050. case ${p} in
  1051. portage)
  1052. if ! grep -qs 'We do not want portage' "${d}/ltmain.sh"; then
  1053. ELT_walk_patches "${d}/ltmain.sh" "${p}";
  1054. ret=$?;
  1055. fi
  1056. ;;
  1057. rem-int-dep)
  1058. ELT_walk_patches "${d}/ltmain.sh" "${p}" "${deptoremove}";
  1059. ret=$?
  1060. ;;
  1061. fix-relink)
  1062. if grep -qs 'inst_prefix_dir' "${d}/ltmain.sh"; then
  1063. ELT_walk_patches "${d}/ltmain.sh" "${p}";
  1064. ret=$?;
  1065. fi
  1066. ;;
  1067. max_cmd_len)
  1068. if grep -qs 'max_cmd_len' "${d}/ltmain.sh"; then
  1069. ELT_walk_patches "${d}/ltmain.sh" "${p}";
  1070. ret=$?;
  1071. fi
  1072. ;;
  1073. as-needed)
  1074. ELT_walk_patches "${d}/ltmain.sh" "${p}";
  1075. ret=$?
  1076. ;;
  1077. uclibc-ltconf)
  1078. if [[ -s ${d}/ltconfig ]]; then
  1079. ELT_walk_patches "${d}/ltconfig" "${p}";
  1080. ret=$?;
  1081. fi
  1082. ;;
  1083. fbsd-ltconf)
  1084. if [[ -s ${d}/ltconfig ]]; then
  1085. ELT_walk_patches "${d}/ltconfig" "${p}";
  1086. ret=$?;
  1087. fi
  1088. ;;
  1089. darwin-ltconf)
  1090. if [[ -s ${d}/ltconfig ]]; then
  1091. ELT_walk_patches "${d}/ltconfig" "${p}";
  1092. ret=$?;
  1093. fi
  1094. ;;
  1095. darwin-ltmain)
  1096. if [[ -e ${d}/ltmain.sh ]] && ! grep -qs 'verstring="-compatibility_version' "${d}/ltmain.sh"; then
  1097. ELT_walk_patches "${d}/ltmain.sh" "${p}";
  1098. ret=$?;
  1099. fi
  1100. ;;
  1101. install-sh)
  1102. ELT_walk_patches "${d}/install-sh" "${p}";
  1103. ret=$?
  1104. ;;
  1105. cross)
  1106. if tc-is-cross-compiler; then
  1107. ELT_walk_patches "${d}/ltmain.sh" "${p}";
  1108. ret=$?;
  1109. fi
  1110. ;;
  1111. *)
  1112. ELT_walk_patches "${d}/ltmain.sh" "${p}";
  1113. ret=$?
  1114. ;;
  1115. esac;
  1116. if [[ ${ret} -ne 0 ]]; then
  1117. case ${p} in
  1118. relink)
  1119. local version=$(ELT_libtool_version "${d}/ltmain.sh");
  1120. if ! grep -qs 'inst_prefix_dir' "${d}/ltmain.sh" && [[ $(VER_to_int "${version}") -ge $(VER_to_int "1.4.0") ]]; then
  1121. ewarn " Could not apply relink.patch!";
  1122. fi
  1123. ;;
  1124. portage)
  1125. if [[ ${do_portage} == "yes" ]]; then
  1126. if ! grep -qs 'We do not want portage' "${d}/ltmain.sh"; then
  1127. echo;
  1128. eerror "Portage patch requested, but failed to apply!";
  1129. eerror "Please file a bug report to add a proper patch.";
  1130. die "Portage patch requested, but failed to apply!";
  1131. fi;
  1132. else
  1133. if grep -qs 'We do not want portage' "${d}/ltmain.sh"; then
  1134. :;
  1135. else
  1136. local version=$(ELT_libtool_version "${d}"/ltmain.sh);
  1137. echo;
  1138. eerror "Portage patch failed to apply (ltmain.sh version ${version})!";
  1139. eerror "Please file a bug report to add a proper patch.";
  1140. die "Portage patch failed to apply!";
  1141. fi;
  1142. ELT_APPLIED_PATCHES="portage";
  1143. fi
  1144. ;;
  1145. darwin-*)
  1146. [[ ${CHOST} == *"-darwin"* ]] && ewarn " Darwin patch set '${p}' failed to apply!"
  1147. ;;
  1148. esac;
  1149. fi;
  1150. done;
  1151. [[ -f ${d}/ltmain.sh ]] && if [[ -z ${ELT_APPLIED_PATCHES} ]]; then
  1152. if [[ ${do_portage} == "no" && ${do_reversedeps} == "no" && ${do_only_patches} == "no" && ${deptoremove} == "" ]]; then
  1153. ewarn "Cannot apply any patches, please file a bug about this";
  1154. die;
  1155. fi;
  1156. fi;
  1157. [[ -f ${d}/configure ]] && for p in ${elt_patches};
  1158. do
  1159. ret=0;
  1160. case ${p} in
  1161. uclibc-conf)
  1162. if grep -qs 'Transform linux' "${d}/configure"; then
  1163. ELT_walk_patches "${d}/configure" "${p}";
  1164. ret=$?;
  1165. fi
  1166. ;;
  1167. fbsd-conf)
  1168. if grep -qs 'version_type=freebsd-' "${d}/configure"; then
  1169. ELT_walk_patches "${d}/configure" "${p}";
  1170. ret=$?;
  1171. fi
  1172. ;;
  1173. darwin-conf)
  1174. if grep -qs '&& echo \.so ||' "${d}/configure"; then
  1175. ELT_walk_patches "${d}/configure" "${p}";
  1176. ret=$?;
  1177. fi
  1178. ;;
  1179. aixrtl | hpux-conf)
  1180. ret=1;
  1181. local subret=0;
  1182. while [[ $subret -eq 0 ]]; do
  1183. subret=1;
  1184. if [[ -e ${d}/configure ]]; then
  1185. ELT_walk_patches "${d}/configure" "${p}";
  1186. subret=$?;
  1187. fi;
  1188. if [[ $subret -eq 0 ]]; then
  1189. ret=0;
  1190. fi;
  1191. done
  1192. ;;
  1193. mint-conf | gold-conf | sol2-conf)
  1194. ELT_walk_patches "${d}/configure" "${p}";
  1195. ret=$?
  1196. ;;
  1197. target-nm)
  1198. ELT_walk_patches "${d}/configure" "${p}";
  1199. ret=$?
  1200. ;;
  1201. *)
  1202.  
  1203. ;;
  1204. esac;
  1205. if [[ ${ret} -ne 0 ]]; then
  1206. case ${p} in
  1207. uclibc-*)
  1208. [[ ${CHOST} == *-uclibc ]] && ewarn " uClibc patch set '${p}' failed to apply!"
  1209. ;;
  1210. fbsd-*)
  1211. if [[ ${CHOST} == *-freebsd* ]]; then
  1212. if [[ -z $(grep 'Handle Gentoo/FreeBSD as it was Linux' "${d}/configure" 2>/dev/null) ]]; then
  1213. eerror " FreeBSD patch set '${p}' failed to apply!";
  1214. die "FreeBSD patch set '${p}' failed to apply!";
  1215. fi;
  1216. fi
  1217. ;;
  1218. darwin-*)
  1219. [[ ${CHOST} == *"-darwin"* ]] && ewarn " Darwin patch set '${p}' failed to apply!"
  1220. ;;
  1221. esac;
  1222. fi;
  1223. done;
  1224. rm -f "${d}/libtool";
  1225. > "${d}/.elibtoolized";
  1226. done
  1227. }
  1228. elt_patch_dir ()
  1229. {
  1230. local d="${ECLASSDIR}/ELT-patches";
  1231. if [[ ! -d ${d} ]]; then
  1232. d="${_LIBTOOL_ECLASSDIR_LOCAL}/ELT-patches";
  1233. fi;
  1234. echo "${d}"
  1235. }
  1236. emktemp ()
  1237. {
  1238. local exe="touch";
  1239. [[ $1 == -d ]] && exe="mkdir" && shift;
  1240. local topdir=$1;
  1241. if [[ -z ${topdir} ]]; then
  1242. [[ -z ${T} ]] && topdir="/tmp" || topdir=${T};
  1243. fi;
  1244. if ! type -P mktemp > /dev/null; then
  1245. local tmp=/;
  1246. while [[ -e ${tmp} ]]; do
  1247. tmp=${topdir}/tmp.${RANDOM}.${RANDOM}.${RANDOM};
  1248. done;
  1249. ${exe} "${tmp}" || ${exe} -p "${tmp}";
  1250. echo "${tmp}";
  1251. else
  1252. if [[ ${exe} == "touch" ]]; then
  1253. TMPDIR="${topdir}" mktemp -t tmp.XXXXXXXXXX;
  1254. else
  1255. TMPDIR="${topdir}" mktemp -dt tmp.XXXXXXXXXX;
  1256. fi;
  1257. fi
  1258. }
  1259. epatch ()
  1260. {
  1261. function _epatch_draw_line ()
  1262. {
  1263. [[ -z $1 ]] && set "$(printf "%65s" '')";
  1264. echo "${1//?/=}"
  1265. };
  1266. unset P4CONFIG P4PORT P4USER;
  1267. local EPATCH_OPTS=(${EPATCH_OPTS[*]});
  1268. while [[ $# -gt 0 ]]; do
  1269. case $1 in
  1270. -*)
  1271. EPATCH_OPTS+=("$1")
  1272. ;;
  1273. *)
  1274. break
  1275. ;;
  1276. esac;
  1277. shift;
  1278. done;
  1279. if [[ $# -gt 1 ]]; then
  1280. local m;
  1281. for m in "$@";
  1282. do
  1283. epatch "${m}";
  1284. done;
  1285. return 0;
  1286. fi;
  1287. local SINGLE_PATCH="no";
  1288. [[ $# -eq 0 ]] && set -- "${EPATCH_SOURCE}";
  1289. if [[ -f $1 ]]; then
  1290. SINGLE_PATCH="yes";
  1291. set -- "$1";
  1292. local EPATCH_SUFFIX=$1;
  1293. else
  1294. if [[ -d $1 ]]; then
  1295. evar_push_set LC_COLLATE C;
  1296. set -- "$1"/*${EPATCH_SUFFIX:+."${EPATCH_SUFFIX}"};
  1297. evar_pop;
  1298. else
  1299. if [[ -f ${EPATCH_SOURCE}/$1 ]]; then
  1300. epatch "${EPATCH_SOURCE}/$1";
  1301. return $?;
  1302. else
  1303. [[ $# -ne 0 ]] && EPATCH_SOURCE=$1;
  1304. echo;
  1305. eerror "Cannot find \$EPATCH_SOURCE! Value for \$EPATCH_SOURCE is:";
  1306. eerror;
  1307. eerror " ${EPATCH_SOURCE}";
  1308. eerror " ( ${EPATCH_SOURCE##*/} )";
  1309. echo;
  1310. die "Cannot find \$EPATCH_SOURCE!";
  1311. fi;
  1312. fi;
  1313. fi;
  1314. EPATCH_OPTS="${EPATCH_COMMON_OPTS} ${EPATCH_OPTS[*]}";
  1315. local PIPE_CMD;
  1316. case ${EPATCH_SUFFIX##*\.} in
  1317. xz)
  1318. PIPE_CMD="xz -dc"
  1319. ;;
  1320. lzma)
  1321. PIPE_CMD="lzma -dc"
  1322. ;;
  1323. bz2)
  1324. PIPE_CMD="bzip2 -dc"
  1325. ;;
  1326. gz | Z | z)
  1327. PIPE_CMD="gzip -dc"
  1328. ;;
  1329. ZIP | zip)
  1330. PIPE_CMD="unzip -p"
  1331. ;;
  1332. *)
  1333.  
  1334. ;;
  1335. esac;
  1336. [[ ${SINGLE_PATCH} == "no" ]] && einfo "${EPATCH_MULTI_MSG}";
  1337. local x;
  1338. for x in "$@";
  1339. do
  1340. [[ ! -f ${x} ]] && continue;
  1341. local patchname=${x##*/};
  1342. local a=${patchname#*_};
  1343. a=${a%%_*};
  1344. if ! [[ ${SINGLE_PATCH} == "yes" || ${EPATCH_FORCE} == "yes" || ${a} == all || ${a} == ${ARCH} ]]; then
  1345. continue;
  1346. fi;
  1347. if [[ -n ${EPATCH_EXCLUDE}${EPATCH_USER_EXCLUDE} ]]; then
  1348. eshopts_push -o noglob;
  1349. local ex;
  1350. for ex in ${EPATCH_EXCLUDE};
  1351. do
  1352. if [[ ${patchname} == ${ex} ]]; then
  1353. einfo " Skipping ${patchname} due to EPATCH_EXCLUDE ...";
  1354. eshopts_pop;
  1355. continue 2;
  1356. fi;
  1357. done;
  1358. for ex in ${EPATCH_USER_EXCLUDE};
  1359. do
  1360. if [[ ${patchname} == ${ex} ]]; then
  1361. einfo " Skipping ${patchname} due to EPATCH_USER_EXCLUDE ...";
  1362. eshopts_pop;
  1363. continue 2;
  1364. fi;
  1365. done;
  1366. eshopts_pop;
  1367. fi;
  1368. if [[ ${SINGLE_PATCH} == "yes" ]]; then
  1369. if [[ -n ${EPATCH_SINGLE_MSG} ]]; then
  1370. einfo "${EPATCH_SINGLE_MSG}";
  1371. else
  1372. einfo "Applying ${patchname} ...";
  1373. fi;
  1374. else
  1375. einfo " ${patchname} ...";
  1376. fi;
  1377. local patch="patch";
  1378. eval $(alias patch 2>/dev/null | sed 's:^alias ::');
  1379. local STDERR_TARGET="${T}/${patchname}.out";
  1380. if [[ -e ${STDERR_TARGET} ]]; then
  1381. STDERR_TARGET="${T}/${patchname}-$$.out";
  1382. fi;
  1383. printf "***** %s *****\nPWD: %s\nPATCH TOOL: %s -> %s\nVERSION INFO:\n%s\n\n" "${patchname}" "${PWD}" "${patch}" "$(type -P "${patch}")" "$(${patch} --version)" > "${STDERR_TARGET}";
  1384. local count=0;
  1385. local PATCH_TARGET;
  1386. if [[ -n ${PIPE_CMD} ]]; then
  1387. PATCH_TARGET="${T}/$$.patch";
  1388. echo "PIPE_COMMAND: ${PIPE_CMD} ${x} > ${PATCH_TARGET}" >> "${STDERR_TARGET}";
  1389. if ! ( ${PIPE_CMD} "${x}" > "${PATCH_TARGET}" ) >> "${STDERR_TARGET}" 2>&1; then
  1390. echo;
  1391. eerror "Could not extract patch!";
  1392. count=5;
  1393. break;
  1394. fi;
  1395. else
  1396. PATCH_TARGET=${x};
  1397. fi;
  1398. local abs_paths=$(egrep -n '^[-+]{3} /' "${PATCH_TARGET}" | awk '$2 != "/dev/null" { print }');
  1399. if [[ -n ${abs_paths} ]]; then
  1400. count=1;
  1401. printf "NOTE: skipping -p0 due to absolute paths in patch:\n%s\n" "${abs_paths}" >> "${STDERR_TARGET}";
  1402. fi;
  1403. local rel_paths=$(egrep -n '^[-+]{3} [^ ]*[.][.]/' "${PATCH_TARGET}");
  1404. if [[ -n ${rel_paths} ]]; then
  1405. echo;
  1406. eerror "Rejected Patch: ${patchname} !";
  1407. eerror " ( ${PATCH_TARGET} )";
  1408. eerror;
  1409. eerror "Your patch uses relative paths '../':";
  1410. eerror "${rel_paths}";
  1411. echo;
  1412. die "you need to fix the relative paths in patch";
  1413. fi;
  1414. local patch_cmd;
  1415. while [[ ${count} -lt 5 ]]; do
  1416. patch_cmd="${patch} -p${count} ${EPATCH_OPTS}";
  1417. ( _epatch_draw_line "***** ${patchname} *****";
  1418. echo;
  1419. echo "PATCH COMMAND: ${patch_cmd} < '${PATCH_TARGET}'";
  1420. echo;
  1421. _epatch_draw_line "***** ${patchname} *****";
  1422. ${patch_cmd} --dry-run -f < "${PATCH_TARGET}" 2>&1;
  1423. ret=$?;
  1424. echo;
  1425. echo "patch program exited with status ${ret}";
  1426. exit ${ret} ) >> "${STDERR_TARGET}";
  1427. if [ $? -eq 0 ]; then
  1428. ( _epatch_draw_line "***** ${patchname} *****";
  1429. echo;
  1430. echo "ACTUALLY APPLYING ${patchname} ...";
  1431. echo;
  1432. _epatch_draw_line "***** ${patchname} *****";
  1433. ${patch_cmd} < "${PATCH_TARGET}" 2>&1;
  1434. ret=$?;
  1435. echo;
  1436. echo "patch program exited with status ${ret}";
  1437. exit ${ret} ) >> "${STDERR_TARGET}";
  1438. if [ $? -ne 0 ]; then
  1439. echo;
  1440. eerror "A dry-run of patch command succeeded, but actually";
  1441. eerror "applying the patch failed!";
  1442. count=5;
  1443. fi;
  1444. break;
  1445. fi;
  1446. : $(( count++ ));
  1447. done;
  1448. if [[ -n ${PIPE_CMD} ]]; then
  1449. rm -f "${PATCH_TARGET}";
  1450. fi;
  1451. if [[ ${count} -ge 5 ]]; then
  1452. echo;
  1453. eerror "Failed Patch: ${patchname} !";
  1454. eerror " ( ${PATCH_TARGET} )";
  1455. eerror;
  1456. eerror "Include in your bugreport the contents of:";
  1457. eerror;
  1458. eerror " ${STDERR_TARGET}";
  1459. echo;
  1460. die "Failed Patch: ${patchname}!";
  1461. fi;
  1462. rm -f "${STDERR_TARGET}";
  1463. cat >> "${T}/epatch.log" <<-EOF
  1464. PATCH: ${x}
  1465. CMD: ${patch_cmd}
  1466. PWD: ${PWD}
  1467.  
  1468. EOF
  1469.  
  1470. eend 0;
  1471. done;
  1472. [[ ${SINGLE_PATCH} == "no" ]] && einfo "Done with patching";
  1473. :
  1474. }
  1475. epatch_user ()
  1476. {
  1477. [[ $# -ne 0 ]] && die "epatch_user takes no options";
  1478. local applied="${T}/epatch_user.log";
  1479. [[ -e ${applied} ]] && return 2;
  1480. local EPATCH_SOURCE check base=${PORTAGE_CONFIGROOT%/}/etc/portage/patches;
  1481. for check in ${CATEGORY}/{${P}-${PR},${P},${PN}}{,:${SLOT}};
  1482. do
  1483. EPATCH_SOURCE=${base}/${CTARGET}/${check};
  1484. [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${base}/${CHOST}/${check};
  1485. [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${base}/${check};
  1486. if [[ -d ${EPATCH_SOURCE} ]]; then
  1487. EPATCH_SOURCE=${EPATCH_SOURCE} EPATCH_SUFFIX="patch" EPATCH_FORCE="yes" EPATCH_MULTI_MSG="Applying user patches from ${EPATCH_SOURCE} ..." epatch;
  1488. echo "${EPATCH_SOURCE}" > "${applied}";
  1489. has epatch_user_death_notice ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS+=" epatch_user_death_notice";
  1490. return 0;
  1491. fi;
  1492. done;
  1493. echo "none" > "${applied}";
  1494. return 1
  1495. }
  1496. epatch_user_death_notice ()
  1497. {
  1498. ewarn "!!! User patches were applied to this build!"
  1499. }
  1500. epause ()
  1501. {
  1502. ewarn "QA Notice: epause is not defined in EAPI=${EAPI}, please file a bug at http://bugs.gentoo.org"
  1503. }
  1504. epunt_cxx ()
  1505. {
  1506. local dir=$1;
  1507. [[ -z ${dir} ]] && dir=${S};
  1508. ebegin "Removing useless C++ checks";
  1509. local f p any_found;
  1510. while IFS= read -r -d '' f; do
  1511. for p in "${PORTDIR}"/eclass/ELT-patches/nocxx/*.patch;
  1512. do
  1513. if patch --no-backup-if-mismatch -p1 "${f}" "${p}" > /dev/null; then
  1514. any_found=1;
  1515. break;
  1516. fi;
  1517. done;
  1518. done < <(find "${dir}" -name configure -print0);
  1519. if [[ -z ${any_found} ]]; then
  1520. eqawarn "epunt_cxx called unnecessarily (no C++ checks to punt).";
  1521. fi;
  1522. eend 0
  1523. }
  1524. eshopts_pop ()
  1525. {
  1526. local s;
  1527. estack_pop eshopts s || die "${FUNCNAME}: unbalanced push";
  1528. if [[ ${s} == "shopt -"* ]]; then
  1529. eval "${s}" || die "${FUNCNAME}: sanity: invalid shopt options: ${s}";
  1530. else
  1531. set +$- || die "${FUNCNAME}: sanity: invalid shell settings: $-";
  1532. set -${s} || die "${FUNCNAME}: sanity: unable to restore saved shell settings: ${s}";
  1533. fi
  1534. }
  1535. eshopts_push ()
  1536. {
  1537. if [[ $1 == -[su] ]]; then
  1538. estack_push eshopts "$(shopt -p)";
  1539. [[ $# -eq 0 ]] && return 0;
  1540. shopt "$@" || die "${FUNCNAME}: bad options to shopt: $*";
  1541. else
  1542. estack_push eshopts $-;
  1543. [[ $# -eq 0 ]] && return 0;
  1544. set "$@" || die "${FUNCNAME}: bad options to set: $*";
  1545. fi
  1546. }
  1547. estack_pop ()
  1548. {
  1549. [[ $# -eq 0 || $# -gt 2 ]] && die "estack_pop: incorrect # of arguments";
  1550. local _estack_name="_ESTACK_$1_";
  1551. shift;
  1552. local _estack_retvar=$1;
  1553. shift;
  1554. eval local _estack_i=\${#${_estack_name}\[@\]};
  1555. [[ $(( --_estack_i )) -eq -1 ]] && return 1;
  1556. if [[ -n ${_estack_retvar} ]]; then
  1557. eval ${_estack_retvar}=\"\${${_estack_name}\[${_estack_i}\]}\";
  1558. fi;
  1559. eval unset ${_estack_name}\[${_estack_i}\]
  1560. }
  1561. estack_push ()
  1562. {
  1563. [[ $# -eq 0 ]] && die "estack_push: incorrect # of arguments";
  1564. local stack_name="_ESTACK_$1_";
  1565. shift;
  1566. eval ${stack_name}+=\( \"\$@\" \)
  1567. }
  1568. esvn_clean ()
  1569. {
  1570. [[ -z $* ]] && set -- .;
  1571. find "$@" -type d -name '.svn' -prune -print0 | xargs -0 rm -rf
  1572. }
  1573. eumask_pop ()
  1574. {
  1575. [[ $# -eq 0 ]] || die "${FUNCNAME}: we take no options";
  1576. local s;
  1577. estack_pop eumask s || die "${FUNCNAME}: unbalanced push";
  1578. umask ${s} || die "${FUNCNAME}: sanity: could not restore umask: ${s}"
  1579. }
  1580. eumask_push ()
  1581. {
  1582. estack_push eumask "$(umask)";
  1583. umask "$@" || die "${FUNCNAME}: bad options to umask: $*"
  1584. }
  1585. evar_pop ()
  1586. {
  1587. local cnt=${1:-bad};
  1588. case $# in
  1589. 0)
  1590. cnt=1
  1591. ;;
  1592. 1)
  1593. isdigit "${cnt}" || die "${FUNCNAME}: first arg must be a number: $*"
  1594. ;;
  1595. *)
  1596. die "${FUNCNAME}: only accepts one arg: $*"
  1597. ;;
  1598. esac;
  1599. local var val;
  1600. while (( cnt-- )); do
  1601. estack_pop evar val || die "${FUNCNAME}: unbalanced push";
  1602. estack_pop evar var || die "${FUNCNAME}: unbalanced push";
  1603. [[ ${val} == "unset_76fc3c462065bb4ca959f939e6793f94" ]] && unset ${var} || printf -v "${var}" '%s' "${val}";
  1604. done
  1605. }
  1606. evar_push ()
  1607. {
  1608. local var val;
  1609. for var in "$@";
  1610. do
  1611. [[ ${!var+set} == "set" ]] && val=${!var} || val="unset_76fc3c462065bb4ca959f939e6793f94";
  1612. estack_push evar "${var}" "${val}";
  1613. done
  1614. }
  1615. evar_push_set ()
  1616. {
  1617. local var=$1;
  1618. evar_push ${var};
  1619. case $# in
  1620. 1)
  1621. unset ${var}
  1622. ;;
  1623. 2)
  1624. printf -v "${var}" '%s' "$2"
  1625. ;;
  1626. *)
  1627. die "${FUNCNAME}: incorrect # of args: $*"
  1628. ;;
  1629. esac
  1630. }
  1631. gcc-fullversion ()
  1632. {
  1633. _gcc_fullversion '$1.$2.$3' "$@"
  1634. }
  1635. gcc-major-version ()
  1636. {
  1637. _gcc_fullversion '$1' "$@"
  1638. }
  1639. gcc-micro-version ()
  1640. {
  1641. _gcc_fullversion '$3' "$@"
  1642. }
  1643. gcc-minor-version ()
  1644. {
  1645. _gcc_fullversion '$2' "$@"
  1646. }
  1647. gcc-specs-directive ()
  1648. {
  1649. local directive subdname subdirective;
  1650. directive="$(_gcc-specs-directive_raw $1)";
  1651. while [[ ${directive} == *%\(*\)* ]]; do
  1652. subdname=${directive/*%\(};
  1653. subdname=${subdname/\)*};
  1654. subdirective="$(_gcc-specs-directive_raw ${subdname})";
  1655. directive="${directive//\%(${subdname})/${subdirective}}";
  1656. done;
  1657. echo "${directive}";
  1658. return 0
  1659. }
  1660. gcc-specs-nostrict ()
  1661. {
  1662. local directive;
  1663. directive=$(gcc-specs-directive cc1);
  1664. [[ "${directive/\{!fstrict-overflow:}" != "${directive}" ]]
  1665. }
  1666. gcc-specs-now ()
  1667. {
  1668. local directive;
  1669. directive=$(gcc-specs-directive link_command);
  1670. [[ "${directive/\{!nonow:}" != "${directive}" ]]
  1671. }
  1672. gcc-specs-pie ()
  1673. {
  1674. local directive;
  1675. directive=$(gcc-specs-directive cc1);
  1676. [[ "${directive/\{!nopie:}" != "${directive}" ]]
  1677. }
  1678. gcc-specs-relro ()
  1679. {
  1680. local directive;
  1681. directive=$(gcc-specs-directive link_command);
  1682. [[ "${directive/\{!norelro:}" != "${directive}" ]]
  1683. }
  1684. gcc-specs-ssp ()
  1685. {
  1686. local directive;
  1687. directive=$(gcc-specs-directive cc1);
  1688. [[ "${directive/\{!fno-stack-protector:}" != "${directive}" ]]
  1689. }
  1690. gcc-specs-ssp-to-all ()
  1691. {
  1692. local directive;
  1693. directive=$(gcc-specs-directive cc1);
  1694. [[ "${directive/\{!fno-stack-protector-all:}" != "${directive}" ]]
  1695. }
  1696. gcc-specs-stack-check ()
  1697. {
  1698. local directive;
  1699. directive=$(gcc-specs-directive cc1);
  1700. [[ "${directive/\{!fno-stack-check:}" != "${directive}" ]]
  1701. }
  1702. gcc-version ()
  1703. {
  1704. _gcc_fullversion '$1.$2' "$@"
  1705. }
  1706. gen_usr_ldscript ()
  1707. {
  1708. local lib libdir=$(get_libdir) output_format="" auto=false suffix=$(get_libname);
  1709. [[ -z ${ED+set} ]] && local ED=${D%/}${EPREFIX}/;
  1710. tc-is-static-only && return;
  1711. case ${CTARGET:-${CHOST}} in
  1712. *-darwin*)
  1713.  
  1714. ;;
  1715. *linux* | *-freebsd* | *-openbsd* | *-netbsd*)
  1716. use prefix && return 0
  1717. ;;
  1718. *)
  1719. return 0
  1720. ;;
  1721. esac;
  1722. dodir /usr/${libdir};
  1723. if [[ $1 == "-a" ]]; then
  1724. auto=true;
  1725. shift;
  1726. dodir /${libdir};
  1727. fi;
  1728. local flags=(${CFLAGS} ${LDFLAGS} -Wl,--verbose);
  1729. if $(tc-getLD) --version | grep -q 'GNU gold'; then
  1730. local d="${T}/bfd-linker";
  1731. mkdir -p "${d}";
  1732. ln -sf $(which ${CHOST}-ld.bfd) "${d}"/ld;
  1733. flags+=(-B"${d}");
  1734. fi;
  1735. output_format=$($(tc-getCC) "${flags[@]}" 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p');
  1736. [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )";
  1737. for lib in "$@";
  1738. do
  1739. local tlib;
  1740. if ${auto}; then
  1741. lib="lib${lib}${suffix}";
  1742. else
  1743. [[ -r ${ED}/${libdir}/${lib} ]] || continue;
  1744. fi;
  1745. case ${CTARGET:-${CHOST}} in
  1746. *-darwin*)
  1747. if ${auto}; then
  1748. tlib=$(scanmacho -qF'%S#F' "${ED}"/usr/${libdir}/${lib});
  1749. else
  1750. tlib=$(scanmacho -qF'%S#F' "${ED}"/${libdir}/${lib});
  1751. fi;
  1752. [[ -z ${tlib} ]] && die "unable to read install_name from ${lib}";
  1753. tlib=${tlib##*/};
  1754. if ${auto}; then
  1755. mv "${ED}"/usr/${libdir}/${lib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die;
  1756. if [[ ${tlib} != ${lib%${suffix}}.*${suffix#.} ]]; then
  1757. mv "${ED}"/usr/${libdir}/${tlib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die;
  1758. fi;
  1759. rm -f "${ED}"/${libdir}/${lib};
  1760. fi;
  1761. if [[ ! -w "${ED}/${libdir}/${tlib}" ]]; then
  1762. chmod u+w "${ED}${libdir}/${tlib}";
  1763. local nowrite=yes;
  1764. fi;
  1765. install_name_tool -id "${EPREFIX}"/${libdir}/${tlib} "${ED}"/${libdir}/${tlib} || die "install_name_tool failed";
  1766. [[ -n ${nowrite} ]] && chmod u-w "${ED}${libdir}/${tlib}";
  1767. pushd "${ED}/usr/${libdir}" > /dev/null;
  1768. ln -snf "../../${libdir}/${tlib}" "${lib}";
  1769. popd > /dev/null
  1770. ;;
  1771. *)
  1772. if ${auto}; then
  1773. tlib=$(scanelf -qF'%S#F' "${ED}"/usr/${libdir}/${lib});
  1774. [[ -z ${tlib} ]] && die "unable to read SONAME from ${lib}";
  1775. mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die;
  1776. if [[ ${tlib} != ${lib}* ]]; then
  1777. mv "${ED}"/usr/${libdir}/${tlib}* "${ED}"/${libdir}/ || die;
  1778. fi;
  1779. rm -f "${ED}"/${libdir}/${lib};
  1780. else
  1781. tlib=${lib};
  1782. fi;
  1783. cat > "${ED}/usr/${libdir}/${lib}" <<-END_LDSCRIPT
  1784. /* GNU ld script
  1785. Since Gentoo has critical dynamic libraries in /lib, and the static versions
  1786. in /usr/lib, we need to have a "fake" dynamic lib in /usr/lib, otherwise we
  1787. run into linking problems. This "fake" dynamic lib is a linker script that
  1788. redirects the linker to the real lib. And yes, this works in the cross-
  1789. compiling scenario as the sysroot-ed linker will prepend the real path.
  1790.  
  1791. See bug http://bugs.gentoo.org/4411 for more info.
  1792. */
  1793. ${output_format}
  1794. GROUP ( ${EPREFIX}/${libdir}/${tlib} )
  1795. END_LDSCRIPT
  1796.  
  1797. ;;
  1798. esac
  1799. fperms a+x "/usr/${libdir}/${lib}" || die "could not change perms on ${lib}";
  1800. done
  1801. }
  1802. get_abi_CFLAGS ()
  1803. {
  1804. get_abi_var CFLAGS "$@"
  1805. }
  1806. get_abi_CHOST ()
  1807. {
  1808. get_abi_var CHOST "$@"
  1809. }
  1810. get_abi_CTARGET ()
  1811. {
  1812. get_abi_var CTARGET "$@"
  1813. }
  1814. get_abi_FAKE_TARGETS ()
  1815. {
  1816. get_abi_var FAKE_TARGETS "$@"
  1817. }
  1818. get_abi_LDFLAGS ()
  1819. {
  1820. get_abi_var LDFLAGS "$@"
  1821. }
  1822. get_abi_LIBDIR ()
  1823. {
  1824. get_abi_var LIBDIR "$@"
  1825. }
  1826. get_abi_var ()
  1827. {
  1828. local flag=$1;
  1829. local abi=${2:-${ABI:-${DEFAULT_ABI:-default}}};
  1830. local var="${flag}_${abi}";
  1831. echo ${!var}
  1832. }
  1833. get_all_abis ()
  1834. {
  1835. local x order="" mvar dvar;
  1836. mvar="MULTILIB_ABIS";
  1837. dvar="DEFAULT_ABI";
  1838. if [[ -n $1 ]]; then
  1839. mvar="$1_${mvar}";
  1840. dvar="$1_${dvar}";
  1841. fi;
  1842. if [[ -z ${!mvar} ]]; then
  1843. echo "default";
  1844. return 0;
  1845. fi;
  1846. for x in ${!mvar};
  1847. do
  1848. if [[ ${x} != ${!dvar} ]]; then
  1849. order="${order:+${order} }${x}";
  1850. fi;
  1851. done;
  1852. order="${order:+${order} }${!dvar}";
  1853. echo ${order};
  1854. return 0
  1855. }
  1856. get_all_libdirs ()
  1857. {
  1858. local libdirs abi;
  1859. for abi in ${MULTILIB_ABIS};
  1860. do
  1861. libdirs+=" $(get_abi_LIBDIR ${abi})";
  1862. done;
  1863. [[ " ${libdirs} " != *" lib "* ]] && libdirs+=" lib";
  1864. echo "${libdirs}"
  1865. }
  1866. get_install_abis ()
  1867. {
  1868. local x order="";
  1869. if [[ -z ${MULTILIB_ABIS} ]]; then
  1870. echo "default";
  1871. return 0;
  1872. fi;
  1873. if [[ ${EMULTILIB_PKG} == "true" ]]; then
  1874. for x in ${MULTILIB_ABIS};
  1875. do
  1876. if [[ ${x} != "${DEFAULT_ABI}" ]]; then
  1877. has ${x} ${ABI_DENY} || order="${order} ${x}";
  1878. fi;
  1879. done;
  1880. has ${DEFAULT_ABI} ${ABI_DENY} || order="${order} ${DEFAULT_ABI}";
  1881. if [[ -n ${ABI_ALLOW} ]]; then
  1882. local ordera="";
  1883. for x in ${order};
  1884. do
  1885. if has ${x} ${ABI_ALLOW}; then
  1886. ordera="${ordera} ${x}";
  1887. fi;
  1888. done;
  1889. order=${ordera};
  1890. fi;
  1891. else
  1892. order=${DEFAULT_ABI};
  1893. fi;
  1894. if [[ -z ${order} ]]; then
  1895. 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.";
  1896. fi;
  1897. echo ${order};
  1898. return 0
  1899. }
  1900. get_libdir ()
  1901. {
  1902. local CONF_LIBDIR;
  1903. if [ -n "${CONF_LIBDIR_OVERRIDE}" ]; then
  1904. echo ${CONF_LIBDIR_OVERRIDE};
  1905. else
  1906. get_abi_LIBDIR;
  1907. fi
  1908. }
  1909. get_libname ()
  1910. {
  1911. local libname;
  1912. local ver=$1;
  1913. case ${CHOST} in
  1914. *-cygwin | mingw* | *-mingw*)
  1915. libname="dll"
  1916. ;;
  1917. *-darwin*)
  1918. libname="dylib"
  1919. ;;
  1920. *-mint*)
  1921. libname="irrelevant"
  1922. ;;
  1923. hppa*-hpux*)
  1924. libname="sl"
  1925. ;;
  1926. *)
  1927. libname="so"
  1928. ;;
  1929. esac;
  1930. if [[ -z $* ]]; then
  1931. echo ".${libname}";
  1932. else
  1933. for ver in "$@";
  1934. do
  1935. case ${CHOST} in
  1936. *-darwin*)
  1937. echo ".${ver}.${libname}"
  1938. ;;
  1939. *-mint*)
  1940. echo ".${libname}"
  1941. ;;
  1942. *)
  1943. echo ".${libname}.${ver}"
  1944. ;;
  1945. esac;
  1946. done;
  1947. fi
  1948. }
  1949. get_modname ()
  1950. {
  1951. local modname;
  1952. local ver=$1;
  1953. case ${CHOST} in
  1954. *-darwin*)
  1955. modname="bundle"
  1956. ;;
  1957. *)
  1958. modname="so"
  1959. ;;
  1960. esac;
  1961. echo ".${modname}"
  1962. }
  1963. has_multilib_profile ()
  1964. {
  1965. [ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ]
  1966. }
  1967. in_iuse ()
  1968. {
  1969. debug-print-function ${FUNCNAME} "${@}";
  1970. [[ ${#} -eq 1 ]] || die "Invalid args to ${FUNCNAME}()";
  1971. local flag=${1};
  1972. local liuse=(${IUSE});
  1973. has "${flag}" "${liuse[@]#[+-]}"
  1974. }
  1975. is_final_abi ()
  1976. {
  1977. has_multilib_profile || return 0;
  1978. set -- $(get_install_abis);
  1979. local LAST_ABI=$#;
  1980. [[ ${!LAST_ABI} == ${ABI} ]]
  1981. }
  1982. isdigit ()
  1983. {
  1984. local d;
  1985. for d in "$@";
  1986. do
  1987. [[ ${d:-bad} == *[!0-9]* ]] && return 1;
  1988. done;
  1989. return 0
  1990. }
  1991. make_desktop_entry ()
  1992. {
  1993. [[ -z $1 ]] && die "make_desktop_entry: You must specify the executable";
  1994. local exec=${1};
  1995. local name=${2:-${PN}};
  1996. local icon=${3:-${PN}};
  1997. local type=${4};
  1998. local fields=${5};
  1999. if [[ -z ${type} ]]; then
  2000. local catmaj=${CATEGORY%%-*};
  2001. local catmin=${CATEGORY##*-};
  2002. case ${catmaj} in
  2003. app)
  2004. case ${catmin} in
  2005. accessibility)
  2006. type="Utility;Accessibility"
  2007. ;;
  2008. admin)
  2009. type=System
  2010. ;;
  2011. antivirus)
  2012. type=System
  2013. ;;
  2014. arch)
  2015. type="Utility;Archiving"
  2016. ;;
  2017. backup)
  2018. type="Utility;Archiving"
  2019. ;;
  2020. cdr)
  2021. type="AudioVideo;DiscBurning"
  2022. ;;
  2023. dicts)
  2024. type="Office;Dictionary"
  2025. ;;
  2026. doc)
  2027. type=Documentation
  2028. ;;
  2029. editors)
  2030. type="Utility;TextEditor"
  2031. ;;
  2032. emacs)
  2033. type="Development;TextEditor"
  2034. ;;
  2035. emulation)
  2036. type="System;Emulator"
  2037. ;;
  2038. laptop)
  2039. type="Settings;HardwareSettings"
  2040. ;;
  2041. office)
  2042. type=Office
  2043. ;;
  2044. pda)
  2045. type="Office;PDA"
  2046. ;;
  2047. vim)
  2048. type="Development;TextEditor"
  2049. ;;
  2050. xemacs)
  2051. type="Development;TextEditor"
  2052. ;;
  2053. esac
  2054. ;;
  2055. dev)
  2056. type="Development"
  2057. ;;
  2058. games)
  2059. case ${catmin} in
  2060. action | fps)
  2061. type=ActionGame
  2062. ;;
  2063. arcade)
  2064. type=ArcadeGame
  2065. ;;
  2066. board)
  2067. type=BoardGame
  2068. ;;
  2069. emulation)
  2070. type=Emulator
  2071. ;;
  2072. kids)
  2073. type=KidsGame
  2074. ;;
  2075. puzzle)
  2076. type=LogicGame
  2077. ;;
  2078. roguelike)
  2079. type=RolePlaying
  2080. ;;
  2081. rpg)
  2082. type=RolePlaying
  2083. ;;
  2084. simulation)
  2085. type=Simulation
  2086. ;;
  2087. sports)
  2088. type=SportsGame
  2089. ;;
  2090. strategy)
  2091. type=StrategyGame
  2092. ;;
  2093. esac;
  2094. type="Game;${type}"
  2095. ;;
  2096. gnome)
  2097. type="Gnome;GTK"
  2098. ;;
  2099. kde)
  2100. type="KDE;Qt"
  2101. ;;
  2102. mail)
  2103. type="Network;Email"
  2104. ;;
  2105. media)
  2106. case ${catmin} in
  2107. gfx)
  2108. type=Graphics
  2109. ;;
  2110. *)
  2111. case ${catmin} in
  2112. radio)
  2113. type=Tuner
  2114. ;;
  2115. sound)
  2116. type=Audio
  2117. ;;
  2118. tv)
  2119. type=TV
  2120. ;;
  2121. video)
  2122. type=Video
  2123. ;;
  2124. esac;
  2125. type="AudioVideo;${type}"
  2126. ;;
  2127. esac
  2128. ;;
  2129. net)
  2130. case ${catmin} in
  2131. dialup)
  2132. type=Dialup
  2133. ;;
  2134. ftp)
  2135. type=FileTransfer
  2136. ;;
  2137. im)
  2138. type=InstantMessaging
  2139. ;;
  2140. irc)
  2141. type=IRCClient
  2142. ;;
  2143. mail)
  2144. type=Email
  2145. ;;
  2146. news)
  2147. type=News
  2148. ;;
  2149. nntp)
  2150. type=News
  2151. ;;
  2152. p2p)
  2153. type=FileTransfer
  2154. ;;
  2155. voip)
  2156. type=Telephony
  2157. ;;
  2158. esac;
  2159. type="Network;${type}"
  2160. ;;
  2161. sci)
  2162. case ${catmin} in
  2163. astro*)
  2164. type=Astronomy
  2165. ;;
  2166. bio*)
  2167. type=Biology
  2168. ;;
  2169. calc*)
  2170. type=Calculator
  2171. ;;
  2172. chem*)
  2173. type=Chemistry
  2174. ;;
  2175. elec*)
  2176. type=Electronics
  2177. ;;
  2178. geo*)
  2179. type=Geology
  2180. ;;
  2181. math*)
  2182. type=Math
  2183. ;;
  2184. physics)
  2185. type=Physics
  2186. ;;
  2187. visual*)
  2188. type=DataVisualization
  2189. ;;
  2190. esac;
  2191. type="Education;Science;${type}"
  2192. ;;
  2193. sys)
  2194. type="System"
  2195. ;;
  2196. www)
  2197. case ${catmin} in
  2198. client)
  2199. type=WebBrowser
  2200. ;;
  2201. esac;
  2202. type="Network;${type}"
  2203. ;;
  2204. *)
  2205. type=
  2206. ;;
  2207. esac;
  2208. fi;
  2209. local slot=${SLOT%/*};
  2210. if [[ ${slot} == "0" ]]; then
  2211. local desktop_name="${PN}";
  2212. else
  2213. local desktop_name="${PN}-${slot}";
  2214. fi;
  2215. local desktop="${T}/$(echo ${exec} | sed 's:[[:space:]/:]:_:g')-${desktop_name}.desktop";
  2216. type=${type%;}${type:+;};
  2217. eshopts_push -s extglob;
  2218. if [[ -n ${icon} && ${icon} != /* ]] && [[ ${icon} == *.xpm || ${icon} == *.png || ${icon} == *.svg ]]; then
  2219. ewarn "As described in the Icon Theme Specification, icon file extensions are not";
  2220. ewarn "allowed in .desktop files if the value is not an absolute path.";
  2221. icon=${icon%.@(xpm|png|svg)};
  2222. fi;
  2223. eshopts_pop;
  2224. cat > "${desktop}" <<-EOF
  2225. [Desktop Entry]
  2226. Name=${name}
  2227. Type=Application
  2228. Comment=${DESCRIPTION}
  2229. Exec=${exec}
  2230. TryExec=${exec%% *}
  2231. Icon=${icon}
  2232. Categories=${type}
  2233. EOF
  2234.  
  2235. if [[ ${fields:-=} != *=* ]]; then
  2236. ewarn "make_desktop_entry: update your 5th arg to read Path=${fields}";
  2237. fields="Path=${fields}";
  2238. fi;
  2239. [[ -n ${fields} ]] && printf '%b\n' "${fields}" >> "${desktop}";
  2240. ( insinto /usr/share/applications;
  2241. doins "${desktop}" ) || die "installing desktop file failed"
  2242. }
  2243. make_session_desktop ()
  2244. {
  2245. [[ -z $1 ]] && eerror "$0: You must specify the title" && return 1;
  2246. [[ -z $2 ]] && eerror "$0: You must specify the command" && return 1;
  2247. local title=$1;
  2248. local command=$2;
  2249. local desktop=${T}/${wm:-${PN}}.desktop;
  2250. shift 2;
  2251. cat > "${desktop}" <<-EOF
  2252. [Desktop Entry]
  2253. Name=${title}
  2254. Comment=This session logs you into ${title}
  2255. Exec=${command} $*
  2256. TryExec=${command}
  2257. Type=XSession
  2258. EOF
  2259.  
  2260. ( insinto /usr/share/xsessions;
  2261. doins "${desktop}" )
  2262. }
  2263. make_wrapper ()
  2264. {
  2265. _eutils_eprefix_init;
  2266. local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5;
  2267. local tmpwrapper=$(emktemp);
  2268. ( echo '#!/bin/sh';
  2269. [[ -n ${chdir} ]] && printf 'cd "%s"\n' "${EPREFIX}${chdir}";
  2270. if [[ -n ${libdir} ]]; then
  2271. local var;
  2272. if [[ ${CHOST} == *-darwin* ]]; then
  2273. var=DYLD_LIBRARY_PATH;
  2274. else
  2275. var=LD_LIBRARY_PATH;
  2276. fi;
  2277. cat <<-EOF
  2278. if [ "\${${var}+set}" = "set" ] ; then
  2279. export ${var}="\${${var}}:${EPREFIX}${libdir}"
  2280. else
  2281. export ${var}="${EPREFIX}${libdir}"
  2282. fi
  2283. EOF
  2284.  
  2285. fi
  2286. printf 'exec %s "$@"\n' "${bin/#\//${EPREFIX}/}" ) > "${tmpwrapper}";
  2287. chmod go+rx "${tmpwrapper}";
  2288. if [[ -n ${path} ]]; then
  2289. ( exeinto "${path}";
  2290. newexe "${tmpwrapper}" "${wrapper}" ) || die;
  2291. else
  2292. newbin "${tmpwrapper}" "${wrapper}" || die;
  2293. fi
  2294. }
  2295. multilib_env ()
  2296. {
  2297. local CTARGET=${1:-${CTARGET}};
  2298. local cpu=${CTARGET%%*-};
  2299. case ${cpu} in
  2300. aarch64*)
  2301. export CFLAGS_arm=${CFLAGS_arm-};
  2302. case ${cpu} in
  2303. aarch64*be)
  2304. export CHOST_arm="armv8b-${CTARGET#*-}"
  2305. ;;
  2306. *)
  2307. export CHOST_arm="armv8l-${CTARGET#*-}"
  2308. ;;
  2309. esac;
  2310. CHOST_arm=${CHOST_arm/%-gnu/-gnueabi};
  2311. export CTARGET_arm=${CHOST_arm};
  2312. export LIBDIR_arm="lib";
  2313. export CFLAGS_arm64=${CFLAGS_arm64-};
  2314. export CHOST_arm64=${CTARGET};
  2315. export CTARGET_arm64=${CHOST_arm64};
  2316. export LIBDIR_arm64="lib64";
  2317. : ${MULTILIB_ABIS=arm64};
  2318. : ${DEFAULT_ABI=arm64}
  2319. ;;
  2320. x86_64*)
  2321. export CFLAGS_x86=${CFLAGS_x86--m32};
  2322. export CHOST_x86=${CTARGET/x86_64/i686};
  2323. CHOST_x86=${CHOST_x86/%-gnux32/-gnu};
  2324. export CTARGET_x86=${CHOST_x86};
  2325. if [[ ${SYMLINK_LIB} == "yes" ]]; then
  2326. export LIBDIR_x86="lib32";
  2327. else
  2328. export LIBDIR_x86="lib";
  2329. fi;
  2330. export CFLAGS_amd64=${CFLAGS_amd64--m64};
  2331. export CHOST_amd64=${CTARGET/%-gnux32/-gnu};
  2332. export CTARGET_amd64=${CHOST_amd64};
  2333. export LIBDIR_amd64="lib64";
  2334. export CFLAGS_x32=${CFLAGS_x32--mx32};
  2335. export CHOST_x32=${CTARGET/%-gnu/-gnux32};
  2336. export CTARGET_x32=${CHOST_x32};
  2337. export LIBDIR_x32="libx32";
  2338. case ${CTARGET} in
  2339. *-gnux32)
  2340. : ${MULTILIB_ABIS=x32 amd64 x86};
  2341. : ${DEFAULT_ABI=x32}
  2342. ;;
  2343. *)
  2344. : ${MULTILIB_ABIS=amd64 x86};
  2345. : ${DEFAULT_ABI=amd64}
  2346. ;;
  2347. esac
  2348. ;;
  2349. mips64*)
  2350. export CFLAGS_o32=${CFLAGS_o32--mabi=32};
  2351. export CHOST_o32=${CTARGET/mips64/mips};
  2352. export CTARGET_o32=${CHOST_o32};
  2353. export LIBDIR_o32="lib";
  2354. export CFLAGS_n32=${CFLAGS_n32--mabi=n32};
  2355. export CHOST_n32=${CTARGET};
  2356. export CTARGET_n32=${CHOST_n32};
  2357. export LIBDIR_n32="lib32";
  2358. export CFLAGS_n64=${CFLAGS_n64--mabi=64};
  2359. export CHOST_n64=${CTARGET};
  2360. export CTARGET_n64=${CHOST_n64};
  2361. export LIBDIR_n64="lib64";
  2362. : ${MULTILIB_ABIS=n64 n32 o32};
  2363. : ${DEFAULT_ABI=n32}
  2364. ;;
  2365. powerpc64*)
  2366. export CFLAGS_ppc=${CFLAGS_ppc--m32};
  2367. export CHOST_ppc=${CTARGET/powerpc64/powerpc};
  2368. export CTARGET_ppc=${CHOST_ppc};
  2369. export LIBDIR_ppc="lib";
  2370. export CFLAGS_ppc64=${CFLAGS_ppc64--m64};
  2371. export CHOST_ppc64=${CTARGET};
  2372. export CTARGET_ppc64=${CHOST_ppc64};
  2373. export LIBDIR_ppc64="lib64";
  2374. : ${MULTILIB_ABIS=ppc64 ppc};
  2375. : ${DEFAULT_ABI=ppc64}
  2376. ;;
  2377. s390x*)
  2378. export CFLAGS_s390=${CFLAGS_s390--m31};
  2379. export CHOST_s390=${CTARGET/s390x/s390};
  2380. export CTARGET_s390=${CHOST_s390};
  2381. export LIBDIR_s390="lib";
  2382. export CFLAGS_s390x=${CFLAGS_s390x--m64};
  2383. export CHOST_s390x=${CTARGET};
  2384. export CTARGET_s390x=${CHOST_s390x};
  2385. export LIBDIR_s390x="lib64";
  2386. : ${MULTILIB_ABIS=s390x s390};
  2387. : ${DEFAULT_ABI=s390x}
  2388. ;;
  2389. sparc64*)
  2390. export CFLAGS_sparc32=${CFLAGS_sparc32--m32};
  2391. export CHOST_sparc32=${CTARGET/sparc64/sparc};
  2392. export CTARGET_sparc32=${CHOST_sparc32};
  2393. export LIBDIR_sparc32="lib";
  2394. export CFLAGS_sparc64=${CFLAGS_sparc64--m64};
  2395. export CHOST_sparc64=${CTARGET};
  2396. export CTARGET_sparc64=${CHOST_sparc64};
  2397. export LIBDIR_sparc64="lib64";
  2398. : ${MULTILIB_ABIS=sparc64 sparc32};
  2399. : ${DEFAULT_ABI=sparc64}
  2400. ;;
  2401. *)
  2402. : ${MULTILIB_ABIS=default};
  2403. : ${DEFAULT_ABI=default}
  2404. ;;
  2405. esac;
  2406. export MULTILIB_ABIS DEFAULT_ABI
  2407. }
  2408. multilib_toolchain_setup ()
  2409. {
  2410. local v vv;
  2411. export ABI=$1;
  2412. if [[ ${_DEFAULT_ABI_SAVED} == "true" ]]; then
  2413. for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH};
  2414. do
  2415. vv="_abi_saved_${v}";
  2416. [[ ${!vv+set} == "set" ]] && export ${v}="${!vv}" || unset ${v};
  2417. unset ${vv};
  2418. done;
  2419. unset _DEFAULT_ABI_SAVED;
  2420. fi;
  2421. if [[ ${ABI} != ${DEFAULT_ABI} ]]; then
  2422. for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH};
  2423. do
  2424. vv="_abi_saved_${v}";
  2425. [[ ${!v+set} == "set" ]] && export ${vv}="${!v}" || unset ${vv};
  2426. done;
  2427. export _DEFAULT_ABI_SAVED="true";
  2428. export CHOST=$(get_abi_CHOST ${DEFAULT_ABI});
  2429. export CC="$(tc-getCC) $(get_abi_CFLAGS)";
  2430. export CXX="$(tc-getCXX) $(get_abi_CFLAGS)";
  2431. export LD="$(tc-getLD) $(get_abi_LDFLAGS)";
  2432. export CHOST=$(get_abi_CHOST $1);
  2433. export CBUILD=$(get_abi_CHOST $1);
  2434. export PKG_CONFIG_LIBDIR=${EPREFIX}/usr/$(get_libdir)/pkgconfig;
  2435. export PKG_CONFIG_PATH=${EPREFIX}/usr/share/pkgconfig;
  2436. fi
  2437. }
  2438. newicon ()
  2439. {
  2440. _iconins ${FUNCNAME} "$@"
  2441. }
  2442. newmenu ()
  2443. {
  2444. ( insinto /usr/share/applications;
  2445. newins "$@" )
  2446. }
  2447. number_abis ()
  2448. {
  2449. set -- `get_install_abis`;
  2450. echo $#
  2451. }
  2452. optfeature ()
  2453. {
  2454. debug-print-function ${FUNCNAME} "$@";
  2455. local i j msg;
  2456. local desc=$1;
  2457. local flag=0;
  2458. shift;
  2459. for i in "$@";
  2460. do
  2461. for j in ${i};
  2462. do
  2463. if has_version "${j}"; then
  2464. flag=1;
  2465. else
  2466. flag=0;
  2467. break;
  2468. fi;
  2469. done;
  2470. if [[ ${flag} -eq 1 ]]; then
  2471. break;
  2472. fi;
  2473. done;
  2474. if [[ ${flag} -eq 0 ]]; then
  2475. for i in "$@";
  2476. do
  2477. msg=" ";
  2478. for j in ${i};
  2479. do
  2480. msg+=" ${j} and";
  2481. done;
  2482. msg="${msg:0: -4} for ${desc}";
  2483. elog "${msg}";
  2484. done;
  2485. fi
  2486. }
  2487. path_exists ()
  2488. {
  2489. local opt=$1;
  2490. [[ ${opt} == -[ao] ]] && shift || opt="-a";
  2491. [[ $# -eq 0 ]] && return 1;
  2492. local p r=0;
  2493. for p in "$@";
  2494. do
  2495. [[ -e ${p} ]];
  2496. : $(( r += $? ));
  2497. done;
  2498. case ${opt} in
  2499. -a)
  2500. return $(( r != 0 ))
  2501. ;;
  2502. -o)
  2503. return $(( r == $# ))
  2504. ;;
  2505. esac
  2506. }
  2507. pkg_nofetch ()
  2508. {
  2509. default
  2510. }
  2511. pkg_postinst ()
  2512. {
  2513. elog "A default setup for ${PN} has been saved as";
  2514. elog "/etc/tvtime/tvtime.xml. You may need to modify it";
  2515. elog "for your needs.";
  2516. elog;
  2517. elog "Detailed information on ${PN} setup can be";
  2518. elog "found at ${HOMEPAGE}help.html";
  2519. echo
  2520. }
  2521. preserve_old_lib ()
  2522. {
  2523. _eutils_eprefix_init;
  2524. if [[ ${EBUILD_PHASE} != "preinst" ]]; then
  2525. eerror "preserve_old_lib() must be called from pkg_preinst() only";
  2526. die "Invalid preserve_old_lib() usage";
  2527. fi;
  2528. [[ -z $1 ]] && die "Usage: preserve_old_lib <library to preserve> [more libraries to preserve]";
  2529. has preserve-libs ${FEATURES} && return 0;
  2530. local lib dir;
  2531. for lib in "$@";
  2532. do
  2533. [[ -e ${EROOT}/${lib} ]] || continue;
  2534. dir=${lib%/*};
  2535. dodir ${dir} || die "dodir ${dir} failed";
  2536. cp "${EROOT}"/${lib} "${ED}"/${lib} || die "cp ${lib} failed";
  2537. touch "${ED}"/${lib};
  2538. done
  2539. }
  2540. preserve_old_lib_notify ()
  2541. {
  2542. if [[ ${EBUILD_PHASE} != "postinst" ]]; then
  2543. eerror "preserve_old_lib_notify() must be called from pkg_postinst() only";
  2544. die "Invalid preserve_old_lib_notify() usage";
  2545. fi;
  2546. has preserve-libs ${FEATURES} && return 0;
  2547. _eutils_eprefix_init;
  2548. local lib notice=0;
  2549. for lib in "$@";
  2550. do
  2551. [[ -e ${EROOT}/${lib} ]] || continue;
  2552. if [[ ${notice} -eq 0 ]]; then
  2553. notice=1;
  2554. ewarn "Old versions of installed libraries were detected on your system.";
  2555. ewarn "In order to avoid breaking packages that depend on these old libs,";
  2556. ewarn "the libraries are not being removed. You need to run revdep-rebuild";
  2557. ewarn "in order to remove these old dependencies. If you do not have this";
  2558. ewarn "helper program, simply emerge the 'gentoolkit' package.";
  2559. ewarn;
  2560. fi;
  2561. ewarn " # revdep-rebuild --library '${lib}' && rm '${lib}'";
  2562. done
  2563. }
  2564. prune_libtool_files ()
  2565. {
  2566. debug-print-function ${FUNCNAME} "$@";
  2567. local removing_all removing_modules opt;
  2568. _eutils_eprefix_init;
  2569. for opt in "$@";
  2570. do
  2571. case "${opt}" in
  2572. --all)
  2573. removing_all=1;
  2574. removing_modules=1
  2575. ;;
  2576. --modules)
  2577. removing_modules=1
  2578. ;;
  2579. *)
  2580. die "Invalid argument to ${FUNCNAME}(): ${opt}"
  2581. ;;
  2582. esac;
  2583. done;
  2584. local f;
  2585. local queue=();
  2586. while IFS= read -r -d '' f; do
  2587. local archivefile=${f/%.la/.a};
  2588. if ! sed -n -e '/^# Generated by .*libtool/q0;4q1' "${f}"; then
  2589. continue;
  2590. fi;
  2591. [[ ${f} != ${archivefile} ]] || die 'regex sanity check failed';
  2592. local reason= pkgconfig_scanned=;
  2593. local snotlink=$(sed -n -e 's:^shouldnotlink=::p' "${f}");
  2594. if [[ ${snotlink} == yes ]]; then
  2595. if [[ -f ${archivefile} ]]; then
  2596. einfo "Removing unnecessary ${archivefile#${D%/}} (static plugin)";
  2597. queue+=("${archivefile}");
  2598. fi;
  2599. if [[ -n ${removing_modules} ]]; then
  2600. reason='module';
  2601. fi;
  2602. else
  2603. if [[ -n ${removing_all} ]]; then
  2604. reason='requested';
  2605. else
  2606. if [[ ! -f ${archivefile} ]]; then
  2607. reason='no static archive';
  2608. else
  2609. if [[ ! -n $(sed -nre "s/^(dependency_libs|inherited_linker_flags)='(.*)'$/\2/p" "${f}") ]]; then
  2610. reason='no libs & flags';
  2611. else
  2612. if [[ ! -n ${pkgconfig_scanned} ]]; then
  2613. local pc_libs=();
  2614. if [[ ! -n ${removing_all} ]]; then
  2615. local pc;
  2616. local tf=${T}/prune-lt-files.pc;
  2617. local pkgconf=$(tc-getPKG_CONFIG);
  2618. while IFS= read -r -d '' pc; do
  2619. local arg libs;
  2620. if ${pkgconf} --exists "${pc}" &>/dev/null; then
  2621. sed -e '/^Requires:/d' "${pc}" > "${tf}";
  2622. libs=$(${pkgconf} --libs "${tf}");
  2623. else
  2624. libs=$(sed -ne 's/^Libs://p' "${pc}");
  2625. fi;
  2626. for arg in ${libs};
  2627. do
  2628. if [[ ${arg} == -l* ]]; then
  2629. if [[ ${arg} == '*$*' ]]; then
  2630. eqawarn "${FUNCNAME}: variable substitution likely failed in ${pc}";
  2631. eqawarn "(arg: ${arg})";
  2632. eqawarn "Most likely, you need to add virtual/pkgconfig to DEPEND.";
  2633. fi;
  2634. pc_libs+=(lib${arg#-l}.la);
  2635. fi;
  2636. done;
  2637. done < <(find "${D}" -type f -name '*.pc' -print0);
  2638. rm -f "${tf}";
  2639. fi;
  2640. pkgconfig_scanned=1;
  2641. fi;
  2642. has "${f##*/}" "${pc_libs[@]}" && reason='covered by .pc';
  2643. fi;
  2644. fi;
  2645. fi;
  2646. fi;
  2647. if [[ -n ${reason} ]]; then
  2648. einfo "Removing unnecessary ${f#${D%/}} (${reason})";
  2649. queue+=("${f}");
  2650. fi;
  2651. done < <(find "${ED}" -xtype f -name '*.la' -print0);
  2652. if [[ -n ${queue[@]} ]]; then
  2653. rm -f "${queue[@]}";
  2654. fi
  2655. }
  2656. src_compile ()
  2657. {
  2658. default
  2659. }
  2660. src_configure ()
  2661. {
  2662. econf $(use_enable nls) $(use_with xinerama) || die "econf failed"
  2663. }
  2664. src_install ()
  2665. {
  2666. make DESTDIR="${D}" install || die "make install failed";
  2667. dohtml docs/html/*;
  2668. dodoc ChangeLog AUTHORS NEWS README
  2669. }
  2670. src_prepare ()
  2671. {
  2672. sed -i -e "s/tvtime.png/tvtime/" docs/net-tvtime.desktop;
  2673. epatch "${FILESDIR}"/${PN}-pic.patch;
  2674. epatch "${FILESDIR}/${PN}-1.0.2-xinerama.patch";
  2675. sed -i "s:^mkinstalldirs = .*:mkinstalldirs = /usr/bin/install -d:" po/Makefile.in.in || die "sed failed";
  2676. AT_M4DIR="m4" eautoreconf
  2677. }
  2678. src_test ()
  2679. {
  2680. default
  2681. }
  2682. src_unpack ()
  2683. {
  2684. default_src_unpack;
  2685. mv tvtime-* ${PF}
  2686. }
  2687. strip-linguas ()
  2688. {
  2689. local ls newls nols;
  2690. if [[ $1 == "-i" ]] || [[ $1 == "-u" ]]; then
  2691. local op=$1;
  2692. shift;
  2693. ls=$(find "$1" -name '*.po' -exec basename {} .po ';');
  2694. shift;
  2695. local d f;
  2696. for d in "$@";
  2697. do
  2698. if [[ ${op} == "-u" ]]; then
  2699. newls=${ls};
  2700. else
  2701. newls="";
  2702. fi;
  2703. for f in $(find "$d" -name '*.po' -exec basename {} .po ';');
  2704. do
  2705. if [[ ${op} == "-i" ]]; then
  2706. has ${f} ${ls} && newls="${newls} ${f}";
  2707. else
  2708. has ${f} ${ls} || newls="${newls} ${f}";
  2709. fi;
  2710. done;
  2711. ls=${newls};
  2712. done;
  2713. else
  2714. ls="$@";
  2715. fi;
  2716. nols="";
  2717. newls="";
  2718. for f in ${LINGUAS};
  2719. do
  2720. if has ${f} ${ls}; then
  2721. newls="${newls} ${f}";
  2722. else
  2723. nols="${nols} ${f}";
  2724. fi;
  2725. done;
  2726. [[ -n ${nols} ]] && einfo "Sorry, but ${PN} does not support the LINGUAS:" ${nols};
  2727. export LINGUAS=${newls:1}
  2728. }
  2729. tc-arch ()
  2730. {
  2731. tc-ninja_magic_to_arch portage "$@"
  2732. }
  2733. tc-arch-kernel ()
  2734. {
  2735. tc-ninja_magic_to_arch kern "$@"
  2736. }
  2737. tc-endian ()
  2738. {
  2739. local host=$1;
  2740. [[ -z ${host} ]] && host=${CTARGET:-${CHOST}};
  2741. host=${host%%-*};
  2742. case ${host} in
  2743. aarch64*be)
  2744. echo big
  2745. ;;
  2746. aarch64)
  2747. echo little
  2748. ;;
  2749. alpha*)
  2750. echo big
  2751. ;;
  2752. arm*b*)
  2753. echo big
  2754. ;;
  2755. arm*)
  2756. echo little
  2757. ;;
  2758. cris*)
  2759. echo little
  2760. ;;
  2761. hppa*)
  2762. echo big
  2763. ;;
  2764. i?86*)
  2765. echo little
  2766. ;;
  2767. ia64*)
  2768. echo little
  2769. ;;
  2770. m68*)
  2771. echo big
  2772. ;;
  2773. mips*l*)
  2774. echo little
  2775. ;;
  2776. mips*)
  2777. echo big
  2778. ;;
  2779. powerpc*le)
  2780. echo little
  2781. ;;
  2782. powerpc*)
  2783. echo big
  2784. ;;
  2785. s390*)
  2786. echo big
  2787. ;;
  2788. sh*b*)
  2789. echo big
  2790. ;;
  2791. sh*)
  2792. echo little
  2793. ;;
  2794. sparc*)
  2795. echo big
  2796. ;;
  2797. x86_64*)
  2798. echo little
  2799. ;;
  2800. *)
  2801. echo wtf
  2802. ;;
  2803. esac
  2804. }
  2805. tc-env_build ()
  2806. {
  2807. tc-export_build_env;
  2808. 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) "$@"
  2809. }
  2810. tc-export ()
  2811. {
  2812. local var;
  2813. for var in "$@";
  2814. do
  2815. [[ $(type -t tc-get${var}) != "function" ]] && die "tc-export: invalid export variable '${var}'";
  2816. eval tc-get${var} > /dev/null;
  2817. done
  2818. }
  2819. tc-export_build_env ()
  2820. {
  2821. tc-export "$@";
  2822. : ${BUILD_CFLAGS:=-O1 -pipe};
  2823. : ${BUILD_CXXFLAGS:=-O1 -pipe};
  2824. : ${BUILD_CPPFLAGS:=};
  2825. : ${BUILD_LDFLAGS:=};
  2826. export BUILD_{C,CXX,CPP,LD}FLAGS;
  2827. local v;
  2828. for v in BUILD_{C,CXX,CPP,LD}FLAGS;
  2829. do
  2830. export ${v#BUILD_}_FOR_BUILD="${!v}";
  2831. done
  2832. }
  2833. tc-getAR ()
  2834. {
  2835. tc-getPROG AR ar "$@"
  2836. }
  2837. tc-getAS ()
  2838. {
  2839. tc-getPROG AS as "$@"
  2840. }
  2841. tc-getBUILD_AR ()
  2842. {
  2843. tc-getBUILD_PROG AR ar "$@"
  2844. }
  2845. tc-getBUILD_AS ()
  2846. {
  2847. tc-getBUILD_PROG AS as "$@"
  2848. }
  2849. tc-getBUILD_CC ()
  2850. {
  2851. tc-getBUILD_PROG CC gcc "$@"
  2852. }
  2853. tc-getBUILD_CPP ()
  2854. {
  2855. tc-getBUILD_PROG CPP cpp "$@"
  2856. }
  2857. tc-getBUILD_CXX ()
  2858. {
  2859. tc-getBUILD_PROG CXX g++ "$@"
  2860. }
  2861. tc-getBUILD_LD ()
  2862. {
  2863. tc-getBUILD_PROG LD ld "$@"
  2864. }
  2865. tc-getBUILD_NM ()
  2866. {
  2867. tc-getBUILD_PROG NM nm "$@"
  2868. }
  2869. tc-getBUILD_OBJCOPY ()
  2870. {
  2871. tc-getBUILD_PROG OBJCOPY objcopy "$@"
  2872. }
  2873. tc-getBUILD_PKG_CONFIG ()
  2874. {
  2875. tc-getBUILD_PROG PKG_CONFIG pkg-config "$@"
  2876. }
  2877. tc-getBUILD_PROG ()
  2878. {
  2879. _tc-getPROG CBUILD "BUILD_$1 $1_FOR_BUILD HOST$1" "${@:2}"
  2880. }
  2881. tc-getBUILD_RANLIB ()
  2882. {
  2883. tc-getBUILD_PROG RANLIB ranlib "$@"
  2884. }
  2885. tc-getBUILD_STRIP ()
  2886. {
  2887. tc-getBUILD_PROG STRIP strip "$@"
  2888. }
  2889. tc-getCC ()
  2890. {
  2891. tc-getPROG CC gcc "$@"
  2892. }
  2893. tc-getCPP ()
  2894. {
  2895. tc-getPROG CPP cpp "$@"
  2896. }
  2897. tc-getCXX ()
  2898. {
  2899. tc-getPROG CXX g++ "$@"
  2900. }
  2901. tc-getDLLWRAP ()
  2902. {
  2903. tc-getPROG DLLWRAP dllwrap "$@"
  2904. }
  2905. tc-getF77 ()
  2906. {
  2907. tc-getPROG F77 gfortran "$@"
  2908. }
  2909. tc-getFC ()
  2910. {
  2911. tc-getPROG FC gfortran "$@"
  2912. }
  2913. tc-getGCJ ()
  2914. {
  2915. tc-getPROG GCJ gcj "$@"
  2916. }
  2917. tc-getLD ()
  2918. {
  2919. tc-getPROG LD ld "$@"
  2920. }
  2921. tc-getNM ()
  2922. {
  2923. tc-getPROG NM nm "$@"
  2924. }
  2925. tc-getOBJCOPY ()
  2926. {
  2927. tc-getPROG OBJCOPY objcopy "$@"
  2928. }
  2929. tc-getOBJDUMP ()
  2930. {
  2931. tc-getPROG OBJDUMP objdump "$@"
  2932. }
  2933. tc-getPKG_CONFIG ()
  2934. {
  2935. tc-getPROG PKG_CONFIG pkg-config "$@"
  2936. }
  2937. tc-getPROG ()
  2938. {
  2939. _tc-getPROG CHOST "$@"
  2940. }
  2941. tc-getRANLIB ()
  2942. {
  2943. tc-getPROG RANLIB ranlib "$@"
  2944. }
  2945. tc-getRC ()
  2946. {
  2947. tc-getPROG RC windres "$@"
  2948. }
  2949. tc-getSTRIP ()
  2950. {
  2951. tc-getPROG STRIP strip "$@"
  2952. }
  2953. tc-has-openmp ()
  2954. {
  2955. local base="${T}/test-tc-openmp";
  2956. cat > "${base}.c" <<-EOF
  2957. #include <omp.h>
  2958. int main() {
  2959. int nthreads, tid, ret = 0;
  2960. #pragma omp parallel private(nthreads, tid)
  2961. {
  2962. tid = omp_get_thread_num();
  2963. nthreads = omp_get_num_threads(); ret += tid + nthreads;
  2964. }
  2965. return ret;
  2966. }
  2967. EOF
  2968.  
  2969. $(tc-getCC "$@") -fopenmp "${base}.c" -o "${base}" &>/dev/null;
  2970. local ret=$?;
  2971. rm -f "${base}"*;
  2972. return ${ret}
  2973. }
  2974. tc-has-tls ()
  2975. {
  2976. local base="${T}/test-tc-tls";
  2977. cat > "${base}.c" <<-EOF
  2978. int foo(int *i) {
  2979. static __thread int j = 0;
  2980. return *i ? j : *i;
  2981. }
  2982. EOF
  2983.  
  2984. local flags;
  2985. case $1 in
  2986. -s)
  2987. flags="-S"
  2988. ;;
  2989. -c)
  2990. flags="-c"
  2991. ;;
  2992. -l)
  2993.  
  2994. ;;
  2995. -*)
  2996. die "Usage: tc-has-tls [-c|-l] [toolchain prefix]"
  2997. ;;
  2998. esac;
  2999. : ${flags:=-fPIC -shared -Wl,-z,defs};
  3000. [[ $1 == -* ]] && shift;
  3001. $(tc-getCC "$@") ${flags} "${base}.c" -o "${base}" &>/dev/null;
  3002. local ret=$?;
  3003. rm -f "${base}"*;
  3004. return ${ret}
  3005. }
  3006. tc-is-cross-compiler ()
  3007. {
  3008. [[ ${CBUILD:-${CHOST}} != ${CHOST} ]]
  3009. }
  3010. tc-is-softfloat ()
  3011. {
  3012. local CTARGET=${CTARGET:-${CHOST}};
  3013. case ${CTARGET} in
  3014. bfin* | h8300*)
  3015. echo "only"
  3016. ;;
  3017. *)
  3018. if [[ ${CTARGET//_/-} == *-softfloat-* ]]; then
  3019. echo "yes";
  3020. else
  3021. if [[ ${CTARGET//_/-} == *-softfp-* ]]; then
  3022. echo "softfp";
  3023. else
  3024. echo "no";
  3025. fi;
  3026. fi
  3027. ;;
  3028. esac
  3029. }
  3030. tc-is-static-only ()
  3031. {
  3032. local host=${CTARGET:-${CHOST}};
  3033. [[ ${host} == *-mint* ]]
  3034. }
  3035. tc-ld-disable-gold ()
  3036. {
  3037. if ! tc-ld-is-gold "$@"; then
  3038. return;
  3039. fi;
  3040. ewarn "Forcing usage of the BFD linker instead of GOLD";
  3041. local bfd_ld="$(tc-getLD "$@").bfd";
  3042. local path_ld=$(which "${bfd_ld}" 2>/dev/null);
  3043. [[ -e ${path_ld} ]] && export LD=${bfd_ld};
  3044. local major=$(gcc-major-version "$@");
  3045. local minor=$(gcc-minor-version "$@");
  3046. if [[ ${major} -lt 4 ]] || [[ ${major} -eq 4 && ${minor} -lt 8 ]]; then
  3047. if [[ -e ${path_ld} ]]; then
  3048. local d="${T}/bfd-linker";
  3049. mkdir -p "${d}";
  3050. ln -sf "${path_ld}" "${d}"/ld;
  3051. export LDFLAGS="${LDFLAGS} -B${d}";
  3052. else
  3053. die "unable to locate a BFD linker to bypass gold";
  3054. fi;
  3055. else
  3056. export LDFLAGS="${LDFLAGS} -fuse-ld=bfd";
  3057. fi
  3058. }
  3059. tc-ld-is-gold ()
  3060. {
  3061. local out;
  3062. out=$($(tc-getLD "$@") --version 2>&1);
  3063. if [[ ${out} == *"GNU gold"* ]]; then
  3064. return 0;
  3065. fi;
  3066. local base="${T}/test-tc-gold";
  3067. cat > "${base}.c" <<-EOF
  3068. int main() { return 0; }
  3069. EOF
  3070.  
  3071. out=$($(tc-getCC "$@") ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -Wl,--version "${base}.c" -o "${base}" 2>&1);
  3072. rm -f "${base}"*;
  3073. if [[ ${out} == *"GNU gold"* ]]; then
  3074. return 0;
  3075. fi;
  3076. return 1
  3077. }
  3078. tc-ninja_magic_to_arch ()
  3079. {
  3080. function ninj ()
  3081. {
  3082. [[ ${type} == "kern" ]] && echo $1 || echo $2
  3083. };
  3084. local type=$1;
  3085. local host=$2;
  3086. [[ -z ${host} ]] && host=${CTARGET:-${CHOST}};
  3087. local KV=${KV:-${KV_FULL}};
  3088. [[ ${type} == "kern" ]] && [[ -z ${KV} ]] && ewarn "QA: Kernel version could not be determined, please inherit kernel-2 or linux-info";
  3089. case ${host} in
  3090. aarch64*)
  3091. echo arm64
  3092. ;;
  3093. alpha*)
  3094. echo alpha
  3095. ;;
  3096. arm*)
  3097. echo arm
  3098. ;;
  3099. avr*)
  3100. ninj avr32 avr
  3101. ;;
  3102. bfin*)
  3103. ninj blackfin bfin
  3104. ;;
  3105. c6x*)
  3106. echo c6x
  3107. ;;
  3108. cris*)
  3109. echo cris
  3110. ;;
  3111. frv*)
  3112. echo frv
  3113. ;;
  3114. hexagon*)
  3115. echo hexagon
  3116. ;;
  3117. hppa*)
  3118. ninj parisc hppa
  3119. ;;
  3120. i?86*)
  3121. if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -lt $(KV_to_int 2.6.24) || ${host} == *freebsd* ]]; then
  3122. echo i386;
  3123. else
  3124. echo x86;
  3125. fi
  3126. ;;
  3127. ia64*)
  3128. echo ia64
  3129. ;;
  3130. m68*)
  3131. echo m68k
  3132. ;;
  3133. metag*)
  3134. echo metag
  3135. ;;
  3136. microblaze*)
  3137. echo microblaze
  3138. ;;
  3139. mips*)
  3140. echo mips
  3141. ;;
  3142. nios2*)
  3143. echo nios2
  3144. ;;
  3145. nios*)
  3146. echo nios
  3147. ;;
  3148. or32*)
  3149. echo openrisc
  3150. ;;
  3151. powerpc*)
  3152. if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -ge $(KV_to_int 2.6.16) ]]; then
  3153. echo powerpc;
  3154. else
  3155. if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -eq $(KV_to_int 2.6.15) ]]; then
  3156. if [[ ${host} == powerpc64* ]] || [[ ${PROFILE_ARCH} == "ppc64" ]]; then
  3157. echo powerpc;
  3158. else
  3159. echo ppc;
  3160. fi;
  3161. else
  3162. if [[ ${host} == powerpc64* ]]; then
  3163. echo ppc64;
  3164. else
  3165. if [[ ${PROFILE_ARCH} == "ppc64" ]]; then
  3166. ninj ppc64 ppc;
  3167. else
  3168. echo ppc;
  3169. fi;
  3170. fi;
  3171. fi;
  3172. fi
  3173. ;;
  3174. riscv*)
  3175. echo riscv
  3176. ;;
  3177. s390*)
  3178. echo s390
  3179. ;;
  3180. score*)
  3181. echo score
  3182. ;;
  3183. sh64*)
  3184. ninj sh64 sh
  3185. ;;
  3186. sh*)
  3187. echo sh
  3188. ;;
  3189. sparc64*)
  3190. ninj sparc64 sparc
  3191. ;;
  3192. sparc*)
  3193. [[ ${PROFILE_ARCH} == "sparc64" ]] && ninj sparc64 sparc || echo sparc
  3194. ;;
  3195. tile*)
  3196. echo tile
  3197. ;;
  3198. vax*)
  3199. echo vax
  3200. ;;
  3201. x86_64*freebsd*)
  3202. echo amd64
  3203. ;;
  3204. x86_64*)
  3205. if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -ge $(KV_to_int 2.6.24) ]]; then
  3206. echo x86;
  3207. else
  3208. ninj x86_64 amd64;
  3209. fi
  3210. ;;
  3211. xtensa*)
  3212. echo xtensa
  3213. ;;
  3214. *)
  3215. echo unknown
  3216. ;;
  3217. esac
  3218. }
  3219. uclibctoolize ()
  3220. {
  3221. die "Use elibtoolize"
  3222. }
  3223. use_if_iuse ()
  3224. {
  3225. in_iuse $1 || return 1;
  3226. use $1
  3227. }
  3228. usex ()
  3229. {
  3230. use "$1" && echo "${2-yes}$4" || echo "${3-no}$5"
  3231. }
  3232. validate_desktop_entries ()
  3233. {
  3234. _eutils_eprefix_init;
  3235. if [[ -x "${EPREFIX}"/usr/bin/desktop-file-validate ]]; then
  3236. einfo "Checking desktop entry validity";
  3237. local directories="";
  3238. for d in /usr/share/applications $@;
  3239. do
  3240. [[ -d ${ED}${d} ]] && directories="${directories} ${ED}${d}";
  3241. done;
  3242. if [[ -n ${directories} ]]; then
  3243. for FILE in $(find ${directories} -name "*\.desktop" -not -path '*.hidden*' | sort -u 2>/dev/null);
  3244. do
  3245. local temp=$(desktop-file-validate ${FILE} | grep -v "warning:" | sed -e "s|error: ||" -e "s|${FILE}:|--|g" );
  3246. [[ -n $temp ]] && elog ${temp/--/${FILE/${ED}/}:};
  3247. done;
  3248. fi;
  3249. echo "";
  3250. else
  3251. einfo "Passing desktop entry validity check. Install dev-util/desktop-file-utils, if you want to help to improve Gentoo.";
  3252. fi
  3253. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement