Advertisement
tihnessa

/var/tmp/portage/net-misc/curl-7.21.7-r2/temp/environment

Sep 11th, 2011
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 109.59 KB | None | 0 0
  1. declare -x ALSA_CARDS=""
  2. declare -x ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol"
  3. declare -x APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias"
  4. declare -x APACHE2_MPMS="prefork"
  5. declare -x ARCH="x86"
  6. declare -- AT_M4DIR=""
  7. declare -- AUTOTOOLS_AUTO_DEPEND="yes"
  8. declare -- AUTOTOOLS_DEPEND="|| ( =sys-devel/automake-1.11* ) >=sys-devel/autoconf-2.61 sys-devel/libtool"
  9. declare -x CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump"
  10. declare -x CAMERAS="agfa_cl20 casio_qv dimagev dimera3500 kodak_dc120 kodak_dc210 kodak_dc240 kodak_dc3200 kodak_ez200 konica_qm150 panasonic_coolshot panasonic_dc1000 panasonic_dc1580 panasonic_l859 polaroid_pdc320 polaroid_pdc640 polaroid_pdc700 ricoh_g3 sipix_blink sipix_blink2 sipix_web2 sony_dscf1 sony_dscf55 toshiba_pdrm11 adc65 aox barbie canon clicksmart310 digigr8 digita directory enigma13 fuji gsmart300 hp215 iclick jamcam jd11 konica largan lg_gsm mars mustek pccam300 pccam600 ptp2 ricoh samsung sierra smal sonix soundvision spca50x sq905 stv0674 stv0680 sx330z template"
  11. declare -x CBUILD="i686-pc-linux-gnu"
  12. declare -x CFLAGS="-O2 -march=i686 -pipe"
  13. declare -x CFLAGS_default
  14. declare -x CHOST="i686-pc-linux-gnu"
  15. declare -x CHOST_default="i686-pc-linux-gnu"
  16. declare -x CMDLINE="BOOT_IMAGE=/boot/kernel-genkernel-x86-2.6.39-sabayon ro init=/linuxrc splash=silent,theme:sabayon radeon.modeset=1 vga=791 console=tty1 quiet dokeymap keymap=uk domdadm resume=swap:UUID=e00cdc43-bc76-4d6b-a2c9-430d41122e4c real_resume=UUID=e00cdc43-bc76-4d6b-a2c9-430d41122e4c root=UUID=0fc02d71-3b6f-4bd4-987a-328d1d95191a docrypt"
  17. declare -x COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog"
  18. declare -x CONSOLE="/dev/console"
  19. declare -x CROSSCOMPILE_OPTS=""
  20. declare -x CTARGET_default="i686-pc-linux-gnu"
  21. declare -x CXXFLAGS="-O2 -march=i686 -pipe"
  22. declare -x DBUS_SESSION_BUS_ADDRESS="unix:abstract=/tmp/dbus-e8mUyQMPBL,guid=90313fd20612f93f4ea1617700000029"
  23. declare -x DEFAULT_ABI="default"
  24. declare -x DEFINED_PHASES=" compile configure install prepare"
  25. declare DEPEND="ldap? ( net-nds/openldap )
  26. ssl? (
  27. gnutls? ( net-libs/gnutls dev-libs/libgcrypt app-misc/ca-certificates )
  28. nss? ( !gnutls? ( dev-libs/nss app-misc/ca-certificates ) )
  29. !gnutls? ( !nss? ( dev-libs/openssl ) )
  30. )
  31. idn? ( net-dns/libidn )
  32. ares? ( >=net-dns/c-ares-1.6 )
  33. kerberos? ( virtual/krb5 )
  34. libssh2? ( >=net-libs/libssh2-0.16 )
  35. sys-apps/ed
  36. test? (
  37. sys-apps/diffutils
  38. dev-lang/perl
  39. ) || ( =sys-devel/automake-1.11* ) >=sys-devel/autoconf-2.61 sys-devel/libtool"
  40. declare DESCRIPTION="A Client that groks URLs"
  41. declare -x DESKTOP_SESSION="LXDE"
  42. declare -x DESTTREE="/usr"
  43. declare -x DIROPTIONS="-m0755"
  44. declare -x EAPI="4"
  45. declare -x EINFO_LOG="/etc/init.d/xdm"
  46. declare -x ELIBC="glibc"
  47. declare -x ELT_APPLIED_PATCHES=" 1.2.0 1.5.6 2.2.6"
  48. declare -- ELT_PATCH_DIR="/usr/portage/eclass/ELT-patches"
  49. declare -- EPATCH_EXCLUDE=""
  50. declare -- EPATCH_FORCE="no"
  51. declare -- EPATCH_MULTI_MSG="Applying various patches (bugfixes/updates) ..."
  52. declare -- EPATCH_OPTS="-g0 -E --no-backup-if-mismatch"
  53. declare -- EPATCH_SINGLE_MSG=""
  54. declare -- EPATCH_SOURCE="/var/tmp/portage/net-misc/curl-7.21.7-r2/work/patch"
  55. declare -- EPATCH_SUFFIX="patch.bz2"
  56. declare -x EXEOPTIONS="-m0755"
  57. declare -x FCFLAGS=""
  58. 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}\\\" -avP \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" rsync \"\${DISTDIR}/\${FILE}\" \"\${URI}\""
  59. declare -x FFLAGS=""
  60. declare -x GCC_SPECS=""
  61. declare -x GDK_USE_XFT="1"
  62. declare -x GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx"
  63. declare -x GRUB_PLATFORMS=""
  64. declare -x GSETTINGS_BACKEND="gconf"
  65. declare HOMEPAGE="http://curl.haxx.se/"
  66. declare -x INHERITED=" toolchain-funcs multilib portability eutils libtool autotools prefix"
  67. declare -x INPUT_DEVICES="evdev void"
  68. declare -x INSDESTTREE=""
  69. declare -x INSOPTIONS="-m0644"
  70. declare IUSE="ares gnutls idn ipv6 kerberos ldap libssh2 nss ssl static-libs test threads "
  71. declare -x KERNEL="linux"
  72. declare -x KERNEL_ABI="default"
  73. declare -x KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
  74. declare -x LANG="en_US.UTF-8"
  75. declare -x LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text"
  76. declare -x LDFLAGS="-Wl,-O1,--as-needed"
  77. declare -x LDFLAGS_default
  78. declare -x LIBDIR_default="lib"
  79. declare -x LIBOPTIONS="-m0644"
  80. declare -x LICENSE="MIT"
  81. declare -x LINGUAS="en en_US af ar az bg bn br bs ca cs cy da de el en_GB eo es et eu fa fi fr fy ga gl he hi hr hu is it ja kk km ko lt lv mk mn ms nb nds nl nn pa pl pt pt_BR ro ru rw se sk sl sr sr@Latn ss sv ta tg tr uk uz vi zh_CN zh_TW es_AR es_ES fy_NL ga_IE gu gu_IN nb_NO nn_NO pt_PT sv_SE zh"
  82. declare -x LIRC_DEVICES="audio audio_alsa serial pctv"
  83. declare -x LIVECD_CONSOLE="tty1"
  84. declare -x LIVECD_CONSOLE_BAUD="38400"
  85. declare -x MAKEOPTS="-j16 -s"
  86. declare -x MULTILIB_ABIS="default"
  87. declare -x NETBEANS="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml"
  88. declare -x OPENGL_PROFILE="xorg-x11"
  89. declare -x PATH="/usr/lib/portage/bin/ebuild-helpers/4:/usr/lib/portage/bin/ebuild-helpers:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/4.5.2"
  90. declare PDEPEND=" "
  91. declare -x PHP_TARGETS=""
  92. declare -x PORTAGE_COMPRESS_EXCLUDE_SUFFIXES="css gif htm[l]? jp[e]?g js pdf png"
  93. declare -a PORTAGE_DOCOMPRESS='([0]="/usr/share/doc" [1]="/usr/share/info" [2]="/usr/share/man")'
  94. declare -a PORTAGE_DOCOMPRESS_SKIP='([0]="/usr/share/doc/curl-7.21.7-r2/html")'
  95. declare -x PRELINK_PATH_MASK="/usr/lib/libfreebl3.so:/usr/lib/libnssdbm3.so:/usr/lib/libsoftokn3.so"
  96. declare -x PROFILE_ONLY_VARIABLES="ARCH ELIBC KERNEL USERLAND"
  97. declare -x PROPERTIES=""
  98. declare -x PROVIDE=""
  99. declare -x PYTHONDONTWRITEBYTECODE="1"
  100. declare -x PYTHONPATH="/usr/lib/entropy/libraries"
  101. declare -x RC_SERVICE="/etc/init.d/xdm"
  102. declare -x RC_SVCNAME="xdm"
  103. declare RDEPEND="ldap? ( net-nds/openldap )
  104. ssl? (
  105. gnutls? ( net-libs/gnutls dev-libs/libgcrypt app-misc/ca-certificates )
  106. nss? ( !gnutls? ( dev-libs/nss app-misc/ca-certificates ) )
  107. !gnutls? ( !nss? ( dev-libs/openssl ) )
  108. )
  109. idn? ( net-dns/libidn )
  110. ares? ( >=net-dns/c-ares-1.6 )
  111. kerberos? ( virtual/krb5 )
  112. libssh2? ( >=net-libs/libssh2-0.16 ) "
  113. declare REQUIRED_USE="threads? ( !ares )
  114. gnutls? ( ssl )
  115. nss? ( ssl )
  116. nss? ( !gnutls ) "
  117. declare -x RESTRICT=""
  118. 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}\\\" -avP \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" rsync \"\${DISTDIR}/\${FILE}\" \"\${URI}\""
  119. declare -x RUBY_TARGETS=""
  120. declare -x S="/var/tmp/portage/net-misc/curl-7.21.7-r2/work/curl-7.21.7"
  121. declare -x SAB_BAD="-kdeprefix -arts -qt3 -beagle -gnome -evo -mono -eds -apm -oss -branding -esd"
  122. declare -x SAB_BROWSER="nsplugin firefox mozdevelop xulrunner"
  123. declare -x SAB_CODECS="x264 gsm lame dv mp3 stream live openal theora ogg a52 win32codecs matroska xvid flac ffmpeg aac speex real dts musepack"
  124. declare -x SAB_COMMS="jabber msn yahoo icq irc aim rss slp mail imap"
  125. declare -x SAB_DESKTOP="kdehiddenvisibility gmp libnotify rdesktop pda zeroconf kdeenablefinal visualization avahi startup-notification accessibility"
  126. declare -x SAB_FILESYS="fat hfs jfs xfs ntfs reiserfs sysfs inotify"
  127. declare -x SAB_MEDIA="musicbrainz sdl pulseaudio wmf fame cdr mp3rtp xine cddb alsa dvb dvd network dvdread ipod audiofile artswrappersuid dvdr jack dri cdda mjpeg mmx joystick xvmc cpudetection v4l v4l2"
  128. declare -x SAB_PRINT="cups ppds foomatic-db gimpprint freetype xprint scanner"
  129. declare -x SAB_SYSTEM="cjk unicode gnutls nptl gcj udev kerberos acl dbus bash-completion lzo rar policykit xcb bzip2 bidi wifi lm_sensors acpi usb pcmcia bluetooth irda ieee1394"
  130. declare -x SAB_XSYS="cairo X opengl gif gtk qt4 qt3support xpm tiff xinerama aiglx svg gphoto2 dga lcd openexr"
  131. declare -x SAL_USE_VCLPLUGIN="gtk"
  132. declare -x SANDBOX_DEBUG="0"
  133. declare -x SANDBOX_DENY=""
  134. declare -x SANDBOX_PID="8208"
  135. declare -x SANDBOX_PREDICT="/var/tmp/portage/net-misc/curl-7.21.7-r2/homedir:/dev/crypto:/var/cache/fontconfig"
  136. declare -x SANDBOX_READ="/:/var/tmp"
  137. declare -x SANDBOX_VERBOSE="1"
  138. 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/net-misc/curl-7.21.7-r2/homedir/.bash_history"
  139. declare -x SLOT="0"
  140. declare SRC_URI="http://curl.haxx.se/download/curl-7.21.7.tar.bz2"
  141. declare -x SVCNAME="xdm"
  142. declare -x SYSFONT="latarcyrheb-sun16"
  143. declare -x USE="elibc_glibc ipv6 kerberos kernel_linux ldap nss ssl userland_GNU x86"
  144. declare -x USERLAND="GNU"
  145. declare -x VIDEO_CARDS=""
  146. declare -x WANT_AUTOCONF="2.5"
  147. declare -x WANT_AUTOMAKE="1.11"
  148. declare -x WANT_LIBTOOL="latest"
  149. declare -x XCURSORS_THEME="Blue"
  150. declare -x XDG_CONFIG_DIRS="/etc/xdg"
  151. declare -x XDG_CONFIG_HOME="/root/.config"
  152. declare -x XDG_CURRENT_DESKTOP="LXDE"
  153. declare -x XDG_DATA_DIRS="/usr/local/share:/usr/share"
  154. declare -x XDG_MENU_PREFIX="lxde-"
  155. declare -x XDG_SESSION_COOKIE="1c465219a117be05ee0cb1a60000001c-1315749829.660492-140851605"
  156. 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"
  157. declare -- _="PKG_INSTALL_MASK"
  158. declare -x _E_DOCDESTTREE_=""
  159. declare -x _E_EXEDESTTREE_=""
  160. declare -- _LATEST_AUTOMAKE="1.11"
  161. declare -x _LXSESSION_PID="7944"
  162. declare -- ___ECLASS_RECUR_MULTILIB="yes"
  163. declare -- ___ECLASS_RECUR_TOOLCHAIN_FUNCS="yes"
  164. declare -- _libtool_atom="sys-devel/libtool"
  165. ELT_libtool_version ()
  166. {
  167. ( unset VERSION;
  168. eval $(grep -e '^[[:space:]]*VERSION=' "$1");
  169. echo "${VERSION:-0}" )
  170. }
  171. ELT_try_and_apply_patch ()
  172. {
  173. local ret=0;
  174. local file=$1;
  175. local patch=$2;
  176. echo -e "\nTrying $(basename "$(dirname "${patch}")")-${patch##*/}.patch on ${file}" >> "${T}/elibtool.log" 2>&1;
  177. if patch -p0 --dry-run "${file}" "${patch}" >> "${T}/elibtool.log" 2>&1; then
  178. einfo " Applying $(basename "$(dirname "${patch}")")-${patch##*/}.patch ...";
  179. patch -p0 -g0 --no-backup-if-mismatch "${file}" "${patch}" >> "${T}/elibtool.log" 2>&1;
  180. ret=$?;
  181. export ELT_APPLIED_PATCHES="${ELT_APPLIED_PATCHES} ${patch##*/}";
  182. else
  183. ret=1;
  184. fi;
  185. return "${ret}"
  186. }
  187. ELT_walk_patches ()
  188. {
  189. local patch;
  190. local ret=1;
  191. local file=$1;
  192. local patch_set=$2;
  193. local patch_dir="${ELT_PATCH_DIR}/${patch_set}";
  194. local rem_int_dep=$3;
  195. [[ -z ${patch_set} ]] && return 1;
  196. [[ ! -d ${patch_dir} ]] && return 1;
  197. pushd "${ELT_PATCH_DIR}" > /dev/null;
  198. for patch in $(find "${patch_set}" -maxdepth 1 -type f | LC_ALL=C sort -r);
  199. do
  200. if [[ -n ${rem_int_dep} ]]; then
  201. local tmp="${T}/$$.rem_int_deps.patch";
  202. sed -e "s|@REM_INT_DEP@|${rem_int_dep}|g" "${patch}" > "${tmp}";
  203. patch=${tmp};
  204. fi;
  205. if ELT_try_and_apply_patch "${file}" "${patch}"; then
  206. ret=0;
  207. break;
  208. fi;
  209. done;
  210. popd > /dev/null;
  211. return ${ret}
  212. }
  213. VER_major ()
  214. {
  215. [[ -z $1 ]] && return 1;
  216. local VER=$@;
  217. echo "${VER%%[^[:digit:]]*}"
  218. }
  219. VER_micro ()
  220. {
  221. [[ -z $1 ]] && return 1;
  222. local VER=$@;
  223. VER=${VER#*.*.};
  224. echo "${VER%%[^[:digit:]]*}"
  225. }
  226. VER_minor ()
  227. {
  228. [[ -z $1 ]] && return 1;
  229. local VER=$@;
  230. VER=${VER#*.};
  231. echo "${VER%%[^[:digit:]]*}"
  232. }
  233. VER_to_int ()
  234. {
  235. [[ -z $1 ]] && return 1;
  236. local VER_MAJOR=$(VER_major "$1");
  237. local VER_MINOR=$(VER_minor "$1");
  238. local VER_MICRO=$(VER_micro "$1");
  239. local VER_int=$(( VER_MAJOR * 65536 + VER_MINOR * 256 + VER_MICRO ));
  240. if [[ ${VER_int} -ge 65536 ]]; then
  241. echo "${VER_int}";
  242. return 0;
  243. fi;
  244. echo 1;
  245. return 1
  246. }
  247. _cdrom_locate_file_on_cd ()
  248. {
  249. local mline="";
  250. local showedmsg=0 showjolietmsg=0;
  251. while [[ -z ${CDROM_ROOT} ]]; do
  252. local i=0;
  253. local -a cdset=(${*//:/ });
  254. if [[ -n ${CDROM_SET} ]]; then
  255. cdset=(${cdset[${CDROM_SET}]});
  256. fi;
  257. while [[ -n ${cdset[${i}]} ]]; do
  258. local dir=$(dirname ${cdset[${i}]});
  259. local file=$(basename ${cdset[${i}]});
  260. local point= node= fs= foo=;
  261. while read point node fs foo; do
  262. [[ " cd9660 iso9660 udf " != *" ${fs} "* ]] && ! [[ ${fs} == "subfs" && ",${opts}," == *",fs=cdfss,"* ]] && continue;
  263. point=${point//\040/ };
  264. [[ ! -d ${point}/${dir} ]] && continue;
  265. [[ -z $(find "${point}/${dir}" -maxdepth 1 -iname "${file}") ]] && continue;
  266. export CDROM_ROOT=${point};
  267. export CDROM_SET=${i};
  268. export CDROM_MATCH=${cdset[${i}]};
  269. return;
  270. done <<< "$(get_mounts)";
  271. ((++i));
  272. done;
  273. echo;
  274. if [[ ${showedmsg} -eq 0 ]]; then
  275. if [[ ${CDROM_TOTAL_CDS} -eq 1 ]]; then
  276. if [[ -z ${CDROM_NAME} ]]; then
  277. einfo "Please insert+mount the cdrom for ${PN} now !";
  278. else
  279. einfo "Please insert+mount the ${CDROM_NAME} cdrom now !";
  280. fi;
  281. else
  282. if [[ -z ${CDROM_NAME_1} ]]; then
  283. einfo "Please insert+mount cd #${CDROM_CURRENT_CD} for ${PN} now !";
  284. else
  285. local var="CDROM_NAME_${CDROM_CURRENT_CD}";
  286. einfo "Please insert+mount the ${!var} cdrom now !";
  287. fi;
  288. fi;
  289. showedmsg=1;
  290. fi;
  291. einfo "Press return to scan for the cd again";
  292. einfo "or hit CTRL+C to abort the emerge.";
  293. echo;
  294. if [[ ${showjolietmsg} -eq 0 ]]; then
  295. showjolietmsg=1;
  296. else
  297. ewarn "If you are having trouble with the detection";
  298. ewarn "of your CD, it is possible that you do not have";
  299. ewarn "Joliet support enabled in your kernel. Please";
  300. ewarn "check that CONFIG_JOLIET is enabled in your kernel.";
  301. ebeep 5;
  302. fi;
  303. read || die "something is screwed with your system";
  304. done
  305. }
  306. _elibtoolize ()
  307. {
  308. local opts g=;
  309. [[ -n $(autotools_check_macro AC_PROG_LIBTOOL AM_PROG_LIBTOOL LT_INIT) ]] || return 0;
  310. [[ -f GNUmakefile.am || -f Makefile.am ]] && opts="--automake";
  311. [[ ${CHOST} == *-darwin* ]] && g=g;
  312. autotools_run_tool ${LIBTOOLIZE:-${g}libtoolize} "$@" ${opts};
  313. eaclocal
  314. }
  315. _epatch_draw_line ()
  316. {
  317. [[ -z $1 ]] && set "$(printf "%65s" '')";
  318. echo "${1//?/=}"
  319. }
  320. _gcc-install-dir ()
  321. {
  322. echo "$(LC_ALL=C $(tc-getCC) -print-search-dirs 2> /dev/null | awk '$1=="install:" {print $2}')"
  323. }
  324. _gcc-specs-directive_raw ()
  325. {
  326. local cc=$(tc-getCC);
  327. local specfiles=$(LC_ALL=C ${cc} -v 2>&1 | awk '$1=="Reading" {print $NF}');
  328. ${cc} -dumpspecs 2> /dev/null | cat - ${specfiles} | awk -v directive=$1 'BEGIN { pspec=""; spec=""; outside=1 }
  329. $1=="*"directive":" { pspec=spec; spec=""; outside=0; next }
  330. outside || NF==0 || ( substr($1,1,1)=="*" && substr($1,length($1),1)==":" ) { outside=1; next }
  331. spec=="" && substr($0,1,1)=="+" { spec=pspec " " substr($0,2); next }
  332. { spec=spec $0 }
  333. END { print spec }';
  334. return 0
  335. }
  336. _gcc-specs-exists ()
  337. {
  338. [[ -f $(_gcc-install-dir)/$1 ]]
  339. }
  340. _gcc_fullversion ()
  341. {
  342. local ver="$1";
  343. shift;
  344. set -- `$(tc-getCPP "$@") -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__"`;
  345. eval echo "$ver"
  346. }
  347. _unpack_tar ()
  348. {
  349. if [ "${y}" == "tar" ]; then
  350. $1 -c -- "$srcdir$x" | tar xof -;
  351. assert_sigpipe_ok "$myfail";
  352. else
  353. $1 -c -- "${srcdir}${x}" > ${x%.*} || die "$myfail";
  354. fi
  355. }
  356. autotools_check_macro ()
  357. {
  358. [[ -f configure.ac || -f configure.in ]] || return 0;
  359. local macro;
  360. for macro in "$@";
  361. do
  362. WANT_AUTOCONF="2.5" autoconf $(autotools_m4dir_include) --trace="${macro}" 2> /dev/null;
  363. done;
  364. return 0
  365. }
  366. autotools_env_setup ()
  367. {
  368. if [[ ${WANT_AUTOMAKE} == "latest" ]]; then
  369. local pv;
  370. for pv in ${_LATEST_AUTOMAKE};
  371. do
  372. ROOT=/ has_version "=sys-devel/automake-${pv}*" && export WANT_AUTOMAKE="$pv";
  373. done;
  374. [[ ${WANT_AUTOMAKE} == "latest" ]] && die "Cannot find the latest automake! Tried ${_LATEST_AUTOMAKE}";
  375. fi;
  376. [[ ${WANT_AUTOCONF} == "latest" ]] && export WANT_AUTOCONF=2.5
  377. }
  378. autotools_get_auxdir ()
  379. {
  380. local auxdir_scan_out;
  381. auxdir_scan_out=$(autotools_check_macro "AC_CONFIG_AUX_DIR");
  382. [[ -n ${auxdir_scan_out} ]] || return 0;
  383. echo ${auxdir_scan_out} | gawk '($0 !~ /^[[:space:]]*(#|dnl)/) {
  384. if (match($0, /AC_CONFIG_AUX_DIR:(.*)$/, res))
  385. print res[1]
  386. }' | uniq;
  387. return 0
  388. }
  389. autotools_get_subdirs ()
  390. {
  391. local subdirs_scan_out;
  392. subdirs_scan_out=$(autotools_check_macro "AC_CONFIG_SUBDIRS");
  393. [[ -n ${subdirs_scan_out} ]] || return 0;
  394. echo "${subdirs_scan_out}" | gawk '($0 !~ /^[[:space:]]*(#|dnl)/) {
  395. if (match($0, /AC_CONFIG_SUBDIRS:(.*)$/, res))
  396. print res[1]
  397. }' | uniq;
  398. return 0
  399. }
  400. autotools_m4dir_include ()
  401. {
  402. [[ -n ${AT_M4DIR} ]] || return;
  403. local include_opts=;
  404. for x in ${AT_M4DIR};
  405. do
  406. case "${x}" in
  407. "-I")
  408.  
  409. ;;
  410. *)
  411. [[ ! -d ${x} ]] && ewarn "autotools.eclass: '${x}' does not exist";
  412. include_opts="${include_opts} -I ${x}"
  413. ;;
  414. esac;
  415. done;
  416. echo $include_opts
  417. }
  418. autotools_run_tool ()
  419. {
  420. if [[ ${EBUILD_PHASE} != "unpack" && ${EBUILD_PHASE} != "prepare" ]]; then
  421. ewarn "QA Warning: running $1 in ${EBUILD_PHASE} phase";
  422. fi;
  423. autotools_env_setup;
  424. local STDERR_TARGET="${T}/$1.out";
  425. if [[ -e ${STDERR_TARGET} ]]; then
  426. local i=1;
  427. while :; do
  428. STDERR_TARGET="${T}/$1-${i}.out";
  429. [[ -e ${STDERR_TARGET} ]] || break;
  430. : $(( i++ ));
  431. done;
  432. fi;
  433. printf "***** $1 *****\n***** PWD: ${PWD}\n***** $*\n\n" > "${STDERR_TARGET}";
  434. ebegin "Running $@";
  435. "$@" >> "${STDERR_TARGET}" 2>&1;
  436. eend $?;
  437. if [[ $? != 0 && ${NO_FAIL} != 1 ]]; then
  438. echo;
  439. eerror "Failed Running $1 !";
  440. eerror;
  441. eerror "Include in your bugreport the contents of:";
  442. eerror;
  443. eerror " ${STDERR_TARGET}";
  444. echo;
  445. die "Failed Running $1 !";
  446. fi
  447. }
  448. built_with_use ()
  449. {
  450. local hidden="no";
  451. if [[ $1 == "--hidden" ]]; then
  452. hidden="yes";
  453. shift;
  454. fi;
  455. local missing_action="die";
  456. if [[ $1 == "--missing" ]]; then
  457. missing_action=$2;
  458. shift;
  459. shift;
  460. case ${missing_action} in
  461. true | false | die)
  462.  
  463. ;;
  464. *)
  465. die "unknown action '${missing_action}'"
  466. ;;
  467. esac;
  468. fi;
  469. local opt=$1;
  470. [[ ${opt:0:1} = "-" ]] && shift || opt="-a";
  471. local PKG=$(best_version $1);
  472. [[ -z ${PKG} ]] && die "Unable to resolve $1 to an installed package";
  473. shift;
  474. local USEFILE=${ROOT}/var/db/pkg/${PKG}/USE;
  475. local IUSEFILE=${ROOT}/var/db/pkg/${PKG}/IUSE;
  476. if [[ ! -e ${USEFILE} ]] || [[ ! -e ${IUSEFILE} && ${hidden} == "no" ]]; then
  477. case ${missing_action} in
  478. true)
  479. return 0
  480. ;;
  481. false)
  482. return 1
  483. ;;
  484. die)
  485. die "Unable to determine what USE flags $PKG was built with"
  486. ;;
  487. esac;
  488. fi;
  489. if [[ ${hidden} == "no" ]]; then
  490. local IUSE_BUILT=($(<"${IUSEFILE}"));
  491. local expand;
  492. for expand in $(echo ${USE_EXPAND} | tr '[:upper:]' '[:lower:]');
  493. do
  494. if [[ $1 == ${expand}_* ]]; then
  495. expand="";
  496. break;
  497. fi;
  498. done;
  499. if [[ -n ${expand} ]]; then
  500. if ! has $1 ${IUSE_BUILT[@]#[-+]}; then
  501. case ${missing_action} in
  502. true)
  503. return 0
  504. ;;
  505. false)
  506. return 1
  507. ;;
  508. die)
  509. die "$PKG does not actually support the $1 USE flag!"
  510. ;;
  511. esac;
  512. fi;
  513. fi;
  514. fi;
  515. local USE_BUILT=$(<${USEFILE});
  516. while [[ $# -gt 0 ]]; do
  517. if [[ ${opt} = "-o" ]]; then
  518. has $1 ${USE_BUILT} && return 0;
  519. else
  520. has $1 ${USE_BUILT} || return 1;
  521. fi;
  522. shift;
  523. done;
  524. [[ ${opt} = "-a" ]]
  525. }
  526. cdrom_get_cds ()
  527. {
  528. local cdcnt=0;
  529. local f=;
  530. for f in "$@";
  531. do
  532. ((++cdcnt));
  533. export CDROM_CHECK_${cdcnt}="$f";
  534. done;
  535. export CDROM_TOTAL_CDS=${cdcnt};
  536. export CDROM_CURRENT_CD=1;
  537. if [[ -n ${CD_ROOT}${CD_ROOT_1} ]]; then
  538. local var=;
  539. cdcnt=0;
  540. while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]]; do
  541. ((++cdcnt));
  542. var="CD_ROOT_${cdcnt}";
  543. [[ -z ${!var} ]] && var="CD_ROOT";
  544. if [[ -z ${!var} ]]; then
  545. eerror "You must either use just the CD_ROOT";
  546. eerror "or specify ALL the CD_ROOT_X variables.";
  547. eerror "In this case, you will need ${CDROM_TOTAL_CDS} CD_ROOT_X variables.";
  548. die "could not locate CD_ROOT_${cdcnt}";
  549. fi;
  550. done;
  551. export CDROM_ROOT=${CD_ROOT_1:-${CD_ROOT}};
  552. einfo "Found CD #${CDROM_CURRENT_CD} root at ${CDROM_ROOT}";
  553. export CDROM_SET=-1;
  554. for f in ${CDROM_CHECK_1//:/ };
  555. do
  556. ((++CDROM_SET));
  557. [[ -e ${CDROM_ROOT}/${f} ]] && break;
  558. done;
  559. export CDROM_MATCH=${f};
  560. return;
  561. fi;
  562. if [[ ${CDROM_TOTAL_CDS} -eq 1 ]]; then
  563. einfo "This ebuild will need the ${CDROM_NAME:-cdrom for ${PN}}";
  564. echo;
  565. einfo "If you do not have the CD, but have the data files";
  566. einfo "mounted somewhere on your filesystem, just export";
  567. einfo "the variable CD_ROOT so that it points to the";
  568. einfo "directory containing the files.";
  569. echo;
  570. einfo "For example:";
  571. einfo "export CD_ROOT=/mnt/cdrom";
  572. echo;
  573. else
  574. if [[ -n ${CDROM_NAME_SET} ]]; then
  575. cdcnt=0;
  576. while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]]; do
  577. ((++cdcnt));
  578. export CDROM_NAME_${cdcnt}="${CDROM_NAME_SET[$((${cdcnt}-1))]}";
  579. done;
  580. fi;
  581. einfo "This package will need access to ${CDROM_TOTAL_CDS} cds.";
  582. cdcnt=0;
  583. while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]]; do
  584. ((++cdcnt));
  585. var="CDROM_NAME_${cdcnt}";
  586. [[ ! -z ${!var} ]] && einfo " CD ${cdcnt}: ${!var}";
  587. done;
  588. echo;
  589. einfo "If you do not have the CDs, but have the data files";
  590. einfo "mounted somewhere on your filesystem, just export";
  591. einfo "the following variables so they point to the right place:";
  592. einfon "";
  593. cdcnt=0;
  594. while [[ ${cdcnt} -lt ${CDROM_TOTAL_CDS} ]]; do
  595. ((++cdcnt));
  596. echo -n " CD_ROOT_${cdcnt}";
  597. done;
  598. echo;
  599. einfo "Or, if you have all the files in the same place, or";
  600. einfo "you only have one cdrom, you can export CD_ROOT";
  601. einfo "and that place will be used as the same data source";
  602. einfo "for all the CDs.";
  603. echo;
  604. einfo "For example:";
  605. einfo "export CD_ROOT_1=/mnt/cdrom";
  606. echo;
  607. fi;
  608. export CDROM_SET="";
  609. export CDROM_CURRENT_CD=0;
  610. cdrom_load_next_cd
  611. }
  612. cdrom_load_next_cd ()
  613. {
  614. local var;
  615. ((++CDROM_CURRENT_CD));
  616. unset CDROM_ROOT;
  617. var=CD_ROOT_${CDROM_CURRENT_CD};
  618. [[ -z ${!var} ]] && var="CD_ROOT";
  619. if [[ -z ${!var} ]]; then
  620. var="CDROM_CHECK_${CDROM_CURRENT_CD}";
  621. _cdrom_locate_file_on_cd ${!var};
  622. else
  623. export CDROM_ROOT=${!var};
  624. fi;
  625. einfo "Found CD #${CDROM_CURRENT_CD} root at ${CDROM_ROOT}"
  626. }
  627. check_license ()
  628. {
  629. local lic=$1;
  630. if [ -z "${lic}" ]; then
  631. lic="${PORTDIR}/licenses/${LICENSE}";
  632. else
  633. if [ -e "${PORTDIR}/licenses/${lic}" ]; then
  634. lic="${PORTDIR}/licenses/${lic}";
  635. else
  636. if [ -e "${PWD}/${lic}" ]; then
  637. lic="${PWD}/${lic}";
  638. else
  639. if [ -e "${lic}" ]; then
  640. lic="${lic}";
  641. fi;
  642. fi;
  643. fi;
  644. fi;
  645. local l="`basename ${lic}`";
  646. local alic;
  647. eshopts_push -o noglob;
  648. for alic in ${ACCEPT_LICENSE};
  649. do
  650. if [[ ${alic} == ${l} ]]; then
  651. eshopts_pop;
  652. return 0;
  653. fi;
  654. done;
  655. eshopts_pop;
  656. [ ! -f "${lic}" ] && die "Could not find requested license ${lic}";
  657. local licmsg=$(emktemp);
  658. cat > ${licmsg} <<-EOF
  659. **********************************************************
  660. The following license outlines the terms of use of this
  661. package. You MUST accept this license for installation to
  662. continue. When you are done viewing, hit 'q'. If you
  663. CTRL+C out of this, the install will not run!
  664. **********************************************************
  665.  
  666. EOF
  667.  
  668. cat ${lic} >> ${licmsg};
  669. ${PAGER:-less} ${licmsg} || die "Could not execute pager (${PAGER}) to accept ${lic}";
  670. einfon "Do you accept the terms of this license (${l})? [yes/no] ";
  671. read alic;
  672. case ${alic} in
  673. yes | Yes | y | Y)
  674. return 0
  675. ;;
  676. *)
  677. echo;
  678. echo;
  679. echo;
  680. eerror "You MUST accept the license to continue! Exiting!";
  681. die "Failed to accept license"
  682. ;;
  683. esac
  684. }
  685. darwintoolize ()
  686. {
  687. die "Use elibtoolize"
  688. }
  689. dlopen_lib ()
  690. {
  691. case "${CHOST}" in
  692. *-linux-gnu* | *-linux-uclibc | *-interix*)
  693. echo "-ldl"
  694. ;;
  695. esac
  696. }
  697. doicon ()
  698. {
  699. ( local i j ret;
  700. insinto /usr/share/pixmaps;
  701. for i in "$@";
  702. do
  703. if [[ -f ${i} ]]; then
  704. doins "${i}";
  705. ((ret+=$?));
  706. else
  707. if [[ -d ${i} ]]; then
  708. for j in "${i}"/*.png;
  709. do
  710. doins "${j}";
  711. ((ret+=$?));
  712. done;
  713. else
  714. ((++ret));
  715. fi;
  716. fi;
  717. done;
  718. exit ${ret} )
  719. }
  720. domenu ()
  721. {
  722. ( local i j ret=0;
  723. insinto /usr/share/applications;
  724. for i in "$@";
  725. do
  726. if [[ -f ${i} ]]; then
  727. doins "${i}";
  728. ((ret+=$?));
  729. else
  730. if [[ -d ${i} ]]; then
  731. for j in "${i}"/*.desktop;
  732. do
  733. doins "${j}";
  734. ((ret+=$?));
  735. done;
  736. else
  737. ((++ret));
  738. fi;
  739. fi;
  740. done;
  741. exit ${ret} )
  742. }
  743. dyn_pretend ()
  744. {
  745. if [[ -e $PORTAGE_BUILDDIR/.pretended ]]; then
  746. vecho ">>> It appears that '$PF' is already pretended; skipping.";
  747. vecho ">>> Remove '$PORTAGE_BUILDDIR/.pretended' to force pretend.";
  748. return 0;
  749. fi;
  750. ebuild_phase pre_pkg_pretend;
  751. ebuild_phase pkg_pretend;
  752. >> "$PORTAGE_BUILDDIR/.pretended" || die "Failed to create $PORTAGE_BUILDDIR/.pretended";
  753. ebuild_phase post_pkg_pretend
  754. }
  755. eaclocal ()
  756. {
  757. local aclocal_opts;
  758. local amflags_file;
  759. for amflags_file in GNUmakefile.am Makefile.am GNUmakefile.in Makefile.in;
  760. do
  761. [[ -e ${amflags_file} ]] || continue;
  762. autotools_env_setup;
  763. aclocal_opts=$(sed -n '/^ACLOCAL_AMFLAGS[[:space:]]*=/s:[^=]*=::p' ${amflags_file});
  764. eval aclocal_opts=\"${aclocal_opts}\";
  765. break;
  766. done;
  767. [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && autotools_run_tool aclocal $(autotools_m4dir_include) "$@" ${aclocal_opts}
  768. }
  769. eautoconf ()
  770. {
  771. if [[ ! -f configure.ac && ! -f configure.in ]]; then
  772. echo;
  773. eerror "No configure.{ac,in} present in '${PWD}'!";
  774. echo;
  775. die "No configure.{ac,in} present!";
  776. fi;
  777. autotools_run_tool autoconf $(autotools_m4dir_include) "$@"
  778. }
  779. eautoheader ()
  780. {
  781. [[ -n $(autotools_check_macro "AC_CONFIG_HEADERS") ]] || return 0;
  782. NO_FAIL=1 autotools_run_tool autoheader $(autotools_m4dir_include) "$@"
  783. }
  784. eautomake ()
  785. {
  786. local extra_opts;
  787. local makefile_name;
  788. for makefile_name in {GNUmakefile,{M,m}akefile}.{am,in} "";
  789. do
  790. [[ -f ${makefile_name} ]] && break;
  791. done;
  792. [[ -z ${makefile_name} ]] && return 0;
  793. if [[ ${makefile_name} == *.in ]]; then
  794. if ! grep -qs AM_INIT_AUTOMAKE configure.??; then
  795. return 0;
  796. fi;
  797. else
  798. if [[ -z ${FROM_EAUTORECONF} && -f ${makefile_name%.am}.in ]]; then
  799. local used_automake;
  800. local installed_automake;
  801. installed_automake=$(WANT_AUTOMAKE= automake --version | head -n 1 | sed -e 's:.*(GNU automake) ::');
  802. used_automake=$(head -n 1 < ${makefile_name%.am}.in | sed -e 's:.*by automake \(.*\) from .*:\1:');
  803. if [[ ${installed_automake} != ${used_automake} ]]; then
  804. einfo "Automake used for the package (${used_automake}) differs from";
  805. einfo "the installed version (${installed_automake}).";
  806. eautoreconf;
  807. return 0;
  808. fi;
  809. fi;
  810. fi;
  811. [[ -f INSTALL && -f AUTHORS && -f ChangeLog && -f NEWS ]] || extra_opts="${extra_opts} --foreign";
  812. autotools_run_tool automake --add-missing --copy ${extra_opts} "$@"
  813. }
  814. eautopoint ()
  815. {
  816. autotools_run_tool autopoint "$@"
  817. }
  818. eautoreconf ()
  819. {
  820. local x auxdir g;
  821. if [[ -z ${AT_NO_RECURSIVE} ]]; then
  822. for x in $(autotools_get_subdirs);
  823. do
  824. if [[ -d ${x} ]]; then
  825. pushd "${x}" > /dev/null;
  826. AT_NOELIBTOOLIZE="yes" eautoreconf;
  827. popd > /dev/null;
  828. fi;
  829. done;
  830. fi;
  831. auxdir=$(autotools_get_auxdir);
  832. einfo "Running eautoreconf in '${PWD}' ...";
  833. [[ -n ${auxdir} ]] && mkdir -p ${auxdir};
  834. eaclocal;
  835. [[ ${CHOST} == *-darwin* ]] && g=g;
  836. if ${LIBTOOLIZE:-${g}libtoolize} -n --install &>/dev/null; then
  837. _elibtoolize --copy --force --install;
  838. else
  839. _elibtoolize --copy --force;
  840. fi;
  841. eautoconf;
  842. eautoheader;
  843. FROM_EAUTORECONF="yes" eautomake ${AM_OPTS};
  844. [[ ${AT_NOELIBTOOLIZE} == "yes" ]] && return 0;
  845. S=${PWD} elibtoolize;
  846. return 0
  847. }
  848. ebeep ()
  849. {
  850. ewarn "QA Notice: ebeep is not defined in EAPI=${EAPI}, please file a bug at http://bugs.gentoo.org"
  851. }
  852. ecvs_clean ()
  853. {
  854. [[ -z $* ]] && set -- .;
  855. find "$@" -type d -name 'CVS' -prune -print0 | xargs -0 rm -rf;
  856. find "$@" -type f -name '.cvs*' -print0 | xargs -0 rm -rf
  857. }
  858. edos2unix ()
  859. {
  860. echo "$@" | xargs sed -i 's/\r$//'
  861. }
  862. egetent ()
  863. {
  864. case ${CHOST} in
  865. *-darwin[678])
  866. case "$2" in
  867. *[!0-9]*)
  868. nidump $1 . | awk -F":" "{ if (\$1 ~ /^$2\$/) {print \$0;exit;} }"
  869. ;;
  870. *)
  871. nidump $1 . | awk -F":" "{ if (\$3 == $2) {print \$0;exit;} }"
  872. ;;
  873. esac
  874. ;;
  875. *-darwin*)
  876. local mytype=$1;
  877. [[ "passwd" == $mytype ]] && mytype="Users";
  878. [[ "group" == $mytype ]] && mytype="Groups";
  879. case "$2" in
  880. *[!0-9]*)
  881. dscl . -read /$mytype/$2 2> /dev/null | grep RecordName
  882. ;;
  883. *)
  884. local mykey="UniqueID";
  885. [[ $mytype == "Groups" ]] && mykey="PrimaryGroupID";
  886. dscl . -search /$mytype $mykey $2 2> /dev/null
  887. ;;
  888. esac
  889. ;;
  890. *-freebsd* | *-dragonfly*)
  891. local opts action="user";
  892. [[ $1 == "passwd" ]] || action="group";
  893. if [[ $2 == [[:digit:]]* ]]; then
  894. [[ ${action} == "user" ]] && opts="-u" || opts="-g";
  895. fi;
  896. pw show ${action} ${opts} "$2" -q
  897. ;;
  898. *-netbsd* | *-openbsd*)
  899. grep "$2:\*:" /etc/$1
  900. ;;
  901. *)
  902. type -p nscd &>/dev/null && nscd -i "$1";
  903. getent "$1" "$2"
  904. ;;
  905. esac
  906. }
  907. egethome ()
  908. {
  909. ent=$(egetent passwd $1);
  910. case ${CHOST} in
  911. *-darwin* | *-freebsd* | *-dragonfly*)
  912. echo ${ent} | cut -d: -f9
  913. ;;
  914. *)
  915. echo ${ent} | cut -d: -f6
  916. ;;
  917. esac
  918. }
  919. egetshell ()
  920. {
  921. ent=$(egetent passwd "$1");
  922. case ${CHOST} in
  923. *-darwin* | *-freebsd* | *-dragonfly*)
  924. echo ${ent} | cut -d: -f10
  925. ;;
  926. *)
  927. echo ${ent} cut -d: -f7
  928. ;;
  929. esac
  930. }
  931. elibtoolize ()
  932. {
  933. local x;
  934. local do_portage="no";
  935. local do_reversedeps="no";
  936. local do_only_patches="no";
  937. local do_uclibc="yes";
  938. local deptoremove=;
  939. local do_shallow="no";
  940. local elt_patches="install-sh ltmain portage relink max_cmd_len sed test tmp cross as-needed";
  941. for x in "$@";
  942. do
  943. case ${x} in
  944. --portage)
  945. do_portage="yes"
  946. ;;
  947. --reverse-deps)
  948. do_reversedeps="yes";
  949. elt_patches+=" fix-relink"
  950. ;;
  951. --patch-only)
  952. do_only_patches="yes"
  953. ;;
  954. --remove-internal-dep=*)
  955. deptoremove=${x#--remove-internal-dep=};
  956. [[ -n ${deptoremove} ]] && elt_patches+=" rem-int-dep"
  957. ;;
  958. --shallow)
  959. do_shallow="yes"
  960. ;;
  961. --no-uclibc)
  962. do_uclibc="no"
  963. ;;
  964. *)
  965. eerror "Invalid elibtoolize option: ${x}";
  966. die "elibtoolize called with ${x} ??"
  967. ;;
  968. esac;
  969. done;
  970. [[ ${do_uclibc} == "yes" ]] && elt_patches+=" uclibc-conf uclibc-ltconf";
  971. case ${CHOST} in
  972. *-aix*)
  973. elt_patches+=" hardcode aixrtl aix-noundef"
  974. ;;
  975. *-darwin*)
  976. elt_patches+=" darwin-ltconf darwin-ltmain darwin-conf"
  977. ;;
  978. *-freebsd*)
  979. elt_patches+=" fbsd-conf fbsd-ltconf"
  980. ;;
  981. *-hpux*)
  982. elt_patches+=" hpux-conf deplibs hc-flag-ld hardcode hardcode-relink relink-prog no-lc"
  983. ;;
  984. *-irix*)
  985. elt_patches+=" irix-ltmain"
  986. ;;
  987. *-mint*)
  988. elt_patches+=" mint-conf"
  989. ;;
  990. esac;
  991. if $(tc-getLD) --version 2>&1 | grep -qs 'GNU gold'; then
  992. elt_patches+=" gold-conf";
  993. fi;
  994. set --;
  995. if [[ ${do_shallow} == "yes" ]]; then
  996. [[ -f ${S}/ltmain.sh ]] && set -- "${S}";
  997. else
  998. set -- $(find "${S}" -name ltmain.sh -printf '%h ');
  999. fi;
  1000. local d p;
  1001. for d in "$@";
  1002. do
  1003. export ELT_APPLIED_PATCHES=;
  1004. [[ -f ${d}/.elibtoolized ]] && continue;
  1005. einfo "Running elibtoolize in: ${d#${WORKDIR}/}/";
  1006. for p in ${elt_patches};
  1007. do
  1008. local ret=0;
  1009. case ${p} in
  1010. portage)
  1011. if ! grep -qs 'We do not want portage' "${d}/ltmain.sh"; then
  1012. ELT_walk_patches "${d}/ltmain.sh" "${p}";
  1013. ret=$?;
  1014. fi
  1015. ;;
  1016. rem-int-dep)
  1017. ELT_walk_patches "${d}/ltmain.sh" "${p}" "${deptoremove}";
  1018. ret=$?
  1019. ;;
  1020. fix-relink)
  1021. if grep -qs 'inst_prefix_dir' "${d}/ltmain.sh"; then
  1022. ELT_walk_patches "${d}/ltmain.sh" "${p}";
  1023. ret=$?;
  1024. fi
  1025. ;;
  1026. max_cmd_len)
  1027. if grep -qs 'max_cmd_len' "${d}/ltmain.sh"; then
  1028. ELT_walk_patches "${d}/ltmain.sh" "${p}";
  1029. ret=$?;
  1030. fi
  1031. ;;
  1032. as-needed)
  1033. ELT_walk_patches "${d}/ltmain.sh" "${p}";
  1034. ret=$?
  1035. ;;
  1036. uclibc-conf)
  1037. if grep -qs 'Transform linux' "${d}/configure"; then
  1038. ELT_walk_patches "${d}/configure" "${p}";
  1039. ret=$?;
  1040. else
  1041. if [[ ! -e ${d}/configure ]] && grep -qs 'Transform linux' "${d}/../configure"; then
  1042. ELT_walk_patches "${d}/../configure" "${p}";
  1043. ret=$?;
  1044. fi;
  1045. fi
  1046. ;;
  1047. uclibc-ltconf)
  1048. if [[ -s ${d}/ltconfig ]]; then
  1049. ELT_walk_patches "${d}/ltconfig" "${p}";
  1050. ret=$?;
  1051. fi
  1052. ;;
  1053. fbsd-conf)
  1054. if grep -qs 'version_type=freebsd-' "${d}/configure"; then
  1055. ELT_walk_patches "${d}/configure" "${p}";
  1056. ret=$?;
  1057. else
  1058. if [[ ! -e ${d}/configure ]] && grep -qs 'version_type=freebsd-' "${d}/../configure"; then
  1059. ELT_walk_patches "${d}/../configure" "${p}";
  1060. ret=$?;
  1061. fi;
  1062. fi
  1063. ;;
  1064. fbsd-ltconf)
  1065. if [[ -s ${d}/ltconfig ]]; then
  1066. ELT_walk_patches "${d}/ltconfig" "${p}";
  1067. ret=$?;
  1068. fi
  1069. ;;
  1070. darwin-conf)
  1071. if grep -qs '&& echo \.so ||' "${d}/configure"; then
  1072. ELT_walk_patches "${d}/configure" "${p}";
  1073. ret=$?;
  1074. else
  1075. if [[ ! -e ${d}/configure ]] && grep -qs '&& echo \.so ||' "${d}/../configure"; then
  1076. ELT_walk_patches "${d}/../configure" "${p}";
  1077. ret=$?;
  1078. fi;
  1079. fi
  1080. ;;
  1081. darwin-ltconf)
  1082. if [[ -s ${d}/ltconfig ]]; then
  1083. ELT_walk_patches "${d}/ltconfig" "${p}";
  1084. ret=$?;
  1085. fi
  1086. ;;
  1087. darwin-ltmain)
  1088. if [[ -e ${d}/ltmain.sh ]] && ! grep -qs 'verstring="-compatibility_version' "${d}/ltmain.sh"; then
  1089. ELT_walk_patches "${d}/ltmain.sh" "${p}";
  1090. ret=$?;
  1091. fi
  1092. ;;
  1093. aixrtl | hpux-conf)
  1094. ret=1;
  1095. local subret=0;
  1096. while [[ $subret -eq 0 ]]; do
  1097. subret=1;
  1098. if [[ -e ${d}/configure ]]; then
  1099. ELT_walk_patches "${d}/configure" "${p}";
  1100. subret=$?;
  1101. else
  1102. if [[ ! -e ${d}/configure && -e ${d}/../configure ]]; then
  1103. ELT_walk_patches "${d}/../configure" "${p}";
  1104. subret=$?;
  1105. fi;
  1106. fi;
  1107. if [[ $subret -eq 0 ]]; then
  1108. ret=0;
  1109. fi;
  1110. done
  1111. ;;
  1112. mint-conf | gold-conf)
  1113. ret=1;
  1114. local subret=1;
  1115. if [[ -e ${d}/configure ]]; then
  1116. ELT_walk_patches "${d}/configure" "${p}";
  1117. subret=$?;
  1118. else
  1119. if [[ -e ${d}/../configure ]]; then
  1120. ELT_walk_patches "${d}/../configure" "${p}";
  1121. subret=$?;
  1122. else
  1123. if [[ -e ${d}/../../configure ]]; then
  1124. ELT_walk_patches "${d}/../../configure" "${p}";
  1125. subret=$?;
  1126. fi;
  1127. fi;
  1128. fi;
  1129. if [[ $subret -eq 0 ]]; then
  1130. ret=0;
  1131. fi
  1132. ;;
  1133. install-sh)
  1134. ELT_walk_patches "${d}/install-sh" "${p}";
  1135. ret=$?
  1136. ;;
  1137. cross)
  1138. if tc-is-cross-compiler; then
  1139. ELT_walk_patches "${d}/ltmain.sh" "${p}";
  1140. ret=$?;
  1141. fi
  1142. ;;
  1143. *)
  1144. ELT_walk_patches "${d}/ltmain.sh" "${p}";
  1145. ret=$?
  1146. ;;
  1147. esac;
  1148. if [[ ${ret} -ne 0 ]]; then
  1149. case ${p} in
  1150. relink)
  1151. local version=$(ELT_libtool_version "${d}/ltmain.sh");
  1152. if ! grep -qs 'inst_prefix_dir' "${d}/ltmain.sh" && [[ $(VER_to_int "${version}") -ge $(VER_to_int "1.4.0") ]]; then
  1153. ewarn " Could not apply relink.patch!";
  1154. fi
  1155. ;;
  1156. portage)
  1157. if [[ ${do_portage} == "yes" ]]; then
  1158. if ! grep -qs 'We do not want portage' "${d}/ltmain.sh"; then
  1159. echo;
  1160. eerror "Portage patch requested, but failed to apply!";
  1161. eerror "Please file a bug report to add a proper patch.";
  1162. die "Portage patch requested, but failed to apply!";
  1163. fi;
  1164. else
  1165. if grep -qs 'We do not want portage' "${d}/ltmain.sh"; then
  1166. :;
  1167. else
  1168. local version=$(ELT_libtool_version "${d}"/ltmain.sh);
  1169. echo;
  1170. eerror "Portage patch failed to apply (ltmain.sh version ${version})!";
  1171. eerror "Please file a bug report to add a proper patch.";
  1172. die "Portage patch failed to apply!";
  1173. fi;
  1174. ELT_APPLIED_PATCHES="portage";
  1175. fi
  1176. ;;
  1177. uclibc-*)
  1178. [[ ${CHOST} == *-uclibc ]] && ewarn " uClibc patch set '${p}' failed to apply!"
  1179. ;;
  1180. fbsd-*)
  1181. if [[ ${CHOST} == *-freebsd* ]]; then
  1182. if [[ -z $(grep 'Handle Gentoo/FreeBSD as it was Linux' "${d}/configure" "${d}/../configure" 2>/dev/null) ]]; then
  1183. eerror " FreeBSD patch set '${p}' failed to apply!";
  1184. die "FreeBSD patch set '${p}' failed to apply!";
  1185. fi;
  1186. fi
  1187. ;;
  1188. darwin-*)
  1189. [[ ${CHOST} == *"-darwin"* ]] && ewarn " Darwin patch set '${p}' failed to apply!"
  1190. ;;
  1191. esac;
  1192. fi;
  1193. done;
  1194. if [[ -z ${ELT_APPLIED_PATCHES} ]]; then
  1195. if [[ ${do_portage} == "no" && ${do_reversedeps} == "no" && ${do_only_patches} == "no" && ${deptoremove} == "" ]]; then
  1196. ewarn "Cannot apply any patches, please file a bug about this";
  1197. die;
  1198. fi;
  1199. fi;
  1200. rm -f "${d}/libtool";
  1201. > "${d}/.elibtoolized";
  1202. done
  1203. }
  1204. emktemp ()
  1205. {
  1206. local exe="touch";
  1207. [[ $1 == -d ]] && exe="mkdir" && shift;
  1208. local topdir=$1;
  1209. if [[ -z ${topdir} ]]; then
  1210. [[ -z ${T} ]] && topdir="/tmp" || topdir=${T};
  1211. fi;
  1212. if ! type -P mktemp > /dev/null; then
  1213. local tmp=/;
  1214. while [[ -e ${tmp} ]]; do
  1215. tmp=${topdir}/tmp.${RANDOM}.${RANDOM}.${RANDOM};
  1216. done;
  1217. ${exe} "${tmp}" || ${exe} -p "${tmp}";
  1218. echo "${tmp}";
  1219. else
  1220. if [[ ${exe} == "touch" ]]; then
  1221. TMPDIR="${topdir}" mktemp -t tmp.XXXXXXXXXX;
  1222. else
  1223. TMPDIR="${topdir}" mktemp -dt tmp.XXXXXXXXXX;
  1224. fi;
  1225. fi
  1226. }
  1227. enewgroup ()
  1228. {
  1229. case ${EBUILD_PHASE} in
  1230. unpack | compile | test | install)
  1231. eerror "'enewgroup()' called from '${EBUILD_PHASE}()' which is not a pkg_* function.";
  1232. eerror "Package fails at QA and at life. Please file a bug.";
  1233. die "Bad package! enewgroup is only for use in pkg_* functions!"
  1234. ;;
  1235. esac;
  1236. local egroup="$1";
  1237. shift;
  1238. if [ -z "${egroup}" ]; then
  1239. eerror "No group specified !";
  1240. die "Cannot call enewgroup without a group";
  1241. fi;
  1242. if [[ -n $(egetent group "${egroup}") ]]; then
  1243. return 0;
  1244. fi;
  1245. einfo "Adding group '${egroup}' to your system ...";
  1246. local opts=;
  1247. local egid="$1";
  1248. shift;
  1249. if [ ! -z "${egid}" ]; then
  1250. if [ "${egid}" -gt 0 ]; then
  1251. if [ -z "`egetent group ${egid}`" ]; then
  1252. if [[ "${CHOST}" == *-darwin* ]]; then
  1253. opts="${opts} ${egid}";
  1254. else
  1255. opts="${opts} -g ${egid}";
  1256. fi;
  1257. else
  1258. egid="next available; requested gid taken";
  1259. fi;
  1260. else
  1261. eerror "Groupid given but is not greater than 0 !";
  1262. die "${egid} is not a valid GID";
  1263. fi;
  1264. else
  1265. egid="next available";
  1266. fi;
  1267. einfo " - Groupid: ${egid}";
  1268. local eextra="$@";
  1269. opts="${opts} ${eextra}";
  1270. local oldsandbox="${SANDBOX_ON}";
  1271. export SANDBOX_ON="0";
  1272. case ${CHOST} in
  1273. *-darwin*)
  1274. if [ ! -z "${eextra}" ]; then
  1275. einfo "Extra options are not supported on Darwin/OS X yet";
  1276. einfo "Please report the ebuild along with the info below";
  1277. einfo "eextra: ${eextra}";
  1278. die "Required function missing";
  1279. fi;
  1280. case ${egid} in
  1281. *[!0-9]*)
  1282. for ((egid = 101; egid <= 999; egid++))
  1283. do
  1284. [[ -z $(egetent group ${egid}) ]] && break;
  1285. done
  1286. ;;
  1287. esac;
  1288. dscl . create /groups/${egroup} gid ${egid};
  1289. dscl . create /groups/${egroup} passwd '*'
  1290. ;;
  1291. *-freebsd* | *-dragonfly*)
  1292. case ${egid} in
  1293. *[!0-9]*)
  1294. for ((egid = 101; egid <= 999; egid++))
  1295. do
  1296. [[ -z $(egetent group ${egid}) ]] && break;
  1297. done
  1298. ;;
  1299. esac;
  1300. pw groupadd ${egroup} -g ${egid} || die "enewgroup failed"
  1301. ;;
  1302. *-netbsd*)
  1303. case ${egid} in
  1304. *[!0-9]*)
  1305. for ((egid = 101; egid <= 999; egid++))
  1306. do
  1307. [[ -z $(egetent group ${egid}) ]] && break;
  1308. done
  1309. ;;
  1310. esac;
  1311. groupadd -g ${egid} ${egroup} || die "enewgroup failed"
  1312. ;;
  1313. *)
  1314. groupadd -r ${opts} ${egroup} || die "enewgroup failed"
  1315. ;;
  1316. esac;
  1317. export SANDBOX_ON="${oldsandbox}"
  1318. }
  1319. enewuser ()
  1320. {
  1321. case ${EBUILD_PHASE} in
  1322. unpack | compile | test | install)
  1323. eerror "'enewuser()' called from '${EBUILD_PHASE}()' which is not a pkg_* function.";
  1324. eerror "Package fails at QA and at life. Please file a bug.";
  1325. die "Bad package! enewuser is only for use in pkg_* functions!"
  1326. ;;
  1327. esac;
  1328. local euser=$1;
  1329. shift;
  1330. if [[ -z ${euser} ]]; then
  1331. eerror "No username specified !";
  1332. die "Cannot call enewuser without a username";
  1333. fi;
  1334. if [[ -n $(egetent passwd "${euser}") ]]; then
  1335. return 0;
  1336. fi;
  1337. einfo "Adding user '${euser}' to your system ...";
  1338. local opts=;
  1339. local euid=$1;
  1340. shift;
  1341. if [[ -n ${euid} && ${euid} != -1 ]]; then
  1342. if [[ ${euid} -gt 0 ]]; then
  1343. if [[ -n $(egetent passwd ${euid}) ]]; then
  1344. euid="next";
  1345. fi;
  1346. else
  1347. eerror "Userid given but is not greater than 0 !";
  1348. die "${euid} is not a valid UID";
  1349. fi;
  1350. else
  1351. euid="next";
  1352. fi;
  1353. if [[ ${euid} == "next" ]]; then
  1354. for ((euid = 101; euid <= 999; euid++))
  1355. do
  1356. [[ -z $(egetent passwd ${euid}) ]] && break;
  1357. done;
  1358. fi;
  1359. opts="${opts} -u ${euid}";
  1360. einfo " - Userid: ${euid}";
  1361. local eshell=$1;
  1362. shift;
  1363. if [[ ! -z ${eshell} ]] && [[ ${eshell} != "-1" ]]; then
  1364. if [[ ! -e ${ROOT}${eshell} ]]; then
  1365. eerror "A shell was specified but it does not exist !";
  1366. die "${eshell} does not exist in ${ROOT}";
  1367. fi;
  1368. if [[ ${eshell} == */false || ${eshell} == */nologin ]]; then
  1369. eerror "Do not specify ${eshell} yourself, use -1";
  1370. die "Pass '-1' as the shell parameter";
  1371. fi;
  1372. else
  1373. for shell in /sbin/nologin /usr/sbin/nologin /bin/false /usr/bin/false /dev/null;
  1374. do
  1375. [[ -x ${ROOT}${shell} ]] && break;
  1376. done;
  1377. if [[ ${shell} == "/dev/null" ]]; then
  1378. eerror "Unable to identify the shell to use, proceeding with userland default.";
  1379. case ${USERLAND} in
  1380. GNU)
  1381. shell="/bin/false"
  1382. ;;
  1383. BSD)
  1384. shell="/sbin/nologin"
  1385. ;;
  1386. Darwin)
  1387. shell="/usr/sbin/nologin"
  1388. ;;
  1389. *)
  1390. die "Unable to identify the default shell for userland ${USERLAND}"
  1391. ;;
  1392. esac;
  1393. fi;
  1394. eshell=${shell};
  1395. fi;
  1396. einfo " - Shell: ${eshell}";
  1397. opts="${opts} -s ${eshell}";
  1398. local ehome=$1;
  1399. shift;
  1400. if [[ -z ${ehome} ]] || [[ ${ehome} == "-1" ]]; then
  1401. ehome="/dev/null";
  1402. fi;
  1403. einfo " - Home: ${ehome}";
  1404. opts="${opts} -d ${ehome}";
  1405. local egroups=$1;
  1406. shift;
  1407. if [[ ! -z ${egroups} ]]; then
  1408. local oldifs=${IFS};
  1409. local defgroup="" exgroups="";
  1410. export IFS=",";
  1411. for g in ${egroups};
  1412. do
  1413. export IFS=${oldifs};
  1414. if [[ -z $(egetent group "${g}") ]]; then
  1415. eerror "You must add group ${g} to the system first";
  1416. die "${g} is not a valid GID";
  1417. fi;
  1418. if [[ -z ${defgroup} ]]; then
  1419. defgroup=${g};
  1420. else
  1421. exgroups="${exgroups},${g}";
  1422. fi;
  1423. export IFS=",";
  1424. done;
  1425. export IFS=${oldifs};
  1426. opts="${opts} -g ${defgroup}";
  1427. if [[ ! -z ${exgroups} ]]; then
  1428. opts="${opts} -G ${exgroups:1}";
  1429. fi;
  1430. else
  1431. egroups="(none)";
  1432. fi;
  1433. einfo " - Groups: ${egroups}";
  1434. local oldsandbox=${SANDBOX_ON};
  1435. export SANDBOX_ON="0";
  1436. case ${CHOST} in
  1437. *-darwin*)
  1438. if [[ -z $@ ]]; then
  1439. dscl . create /users/${euser} uid ${euid};
  1440. dscl . create /users/${euser} shell ${eshell};
  1441. dscl . create /users/${euser} home ${ehome};
  1442. dscl . create /users/${euser} realname "added by portage for ${PN}";
  1443. local oldifs=${IFS};
  1444. export IFS=",";
  1445. for g in ${egroups};
  1446. do
  1447. dscl . merge /groups/${g} users ${euser};
  1448. done;
  1449. export IFS=${oldifs};
  1450. else
  1451. einfo "Extra options are not supported on Darwin yet";
  1452. einfo "Please report the ebuild along with the info below";
  1453. einfo "eextra: $@";
  1454. die "Required function missing";
  1455. fi
  1456. ;;
  1457. *-freebsd* | *-dragonfly*)
  1458. if [[ -z $@ ]]; then
  1459. pw useradd ${euser} ${opts} -c "added by portage for ${PN}" die "enewuser failed";
  1460. else
  1461. einfo " - Extra: $@";
  1462. pw useradd ${euser} ${opts} "$@" || die "enewuser failed";
  1463. fi
  1464. ;;
  1465. *-netbsd*)
  1466. if [[ -z $@ ]]; then
  1467. useradd ${opts} ${euser} || die "enewuser failed";
  1468. else
  1469. einfo " - Extra: $@";
  1470. useradd ${opts} ${euser} "$@" || die "enewuser failed";
  1471. fi
  1472. ;;
  1473. *-openbsd*)
  1474. if [[ -z $@ ]]; then
  1475. useradd -u ${euid} -s ${eshell} -d ${ehome} -c "Added by portage for ${PN}" -g ${egroups} ${euser} || die "enewuser failed";
  1476. else
  1477. einfo " - Extra: $@";
  1478. useradd -u ${euid} -s ${eshell} -d ${ehome} -c "Added by portage for ${PN}" -g ${egroups} ${euser} "$@" || die "enewuser failed";
  1479. fi
  1480. ;;
  1481. *)
  1482. if [[ -z $@ ]]; then
  1483. useradd -r ${opts} -c "added by portage for ${PN}" ${euser} || die "enewuser failed";
  1484. else
  1485. einfo " - Extra: $@";
  1486. useradd -r ${opts} "$@" ${euser} || die "enewuser failed";
  1487. fi
  1488. ;;
  1489. esac;
  1490. if [[ ! -e ${ROOT}/${ehome} ]]; then
  1491. einfo " - Creating ${ehome} in ${ROOT}";
  1492. mkdir -p "${ROOT}/${ehome}";
  1493. chown ${euser} "${ROOT}/${ehome}";
  1494. chmod 755 "${ROOT}/${ehome}";
  1495. fi;
  1496. export SANDBOX_ON=${oldsandbox}
  1497. }
  1498. epatch ()
  1499. {
  1500. function _epatch_draw_line ()
  1501. {
  1502. [[ -z $1 ]] && set "$(printf "%65s" '')";
  1503. echo "${1//?/=}"
  1504. };
  1505. unset P4CONFIG P4PORT P4USER;
  1506. if [[ $# -gt 1 ]]; then
  1507. local m;
  1508. for m in "$@";
  1509. do
  1510. epatch "${m}";
  1511. done;
  1512. return 0;
  1513. fi;
  1514. local SINGLE_PATCH="no";
  1515. [[ $# -eq 0 ]] && set -- "${EPATCH_SOURCE}";
  1516. if [[ -f $1 ]]; then
  1517. SINGLE_PATCH="yes";
  1518. set -- "$1";
  1519. local EPATCH_SUFFIX=$1;
  1520. else
  1521. if [[ -d $1 ]]; then
  1522. set -- "$1"/*${EPATCH_SUFFIX:+."${EPATCH_SUFFIX}"};
  1523. else
  1524. if [[ -f ${EPATCH_SOURCE}/$1 ]]; then
  1525. epatch "${EPATCH_SOURCE}/$1";
  1526. return $?;
  1527. else
  1528. [[ $# -ne 0 ]] && EPATCH_SOURCE=$1;
  1529. echo;
  1530. eerror "Cannot find \$EPATCH_SOURCE! Value for \$EPATCH_SOURCE is:";
  1531. eerror;
  1532. eerror " ${EPATCH_SOURCE}";
  1533. eerror " ( ${EPATCH_SOURCE##*/} )";
  1534. echo;
  1535. die "Cannot find \$EPATCH_SOURCE!";
  1536. fi;
  1537. fi;
  1538. fi;
  1539. local PIPE_CMD;
  1540. case ${EPATCH_SUFFIX##*\.} in
  1541. xz)
  1542. PIPE_CMD="xz -dc"
  1543. ;;
  1544. lzma)
  1545. PIPE_CMD="lzma -dc"
  1546. ;;
  1547. bz2)
  1548. PIPE_CMD="bzip2 -dc"
  1549. ;;
  1550. gz | Z | z)
  1551. PIPE_CMD="gzip -dc"
  1552. ;;
  1553. ZIP | zip)
  1554. PIPE_CMD="unzip -p"
  1555. ;;
  1556. *)
  1557.  
  1558. ;;
  1559. esac;
  1560. [[ ${SINGLE_PATCH} == "no" ]] && einfo "${EPATCH_MULTI_MSG}";
  1561. local x;
  1562. for x in "$@";
  1563. do
  1564. [[ ! -f ${x} ]] && continue;
  1565. local patchname=${x##*/};
  1566. local a=${patchname#*_};
  1567. a=${a%%_*};
  1568. if ! [[ ${SINGLE_PATCH} == "yes" || ${EPATCH_FORCE} == "yes" || ${a} == all || ${a} == ${ARCH} ]]; then
  1569. continue;
  1570. fi;
  1571. if [[ -n ${EPATCH_EXCLUDE} ]]; then
  1572. eshopts_push -o noglob;
  1573. local ex;
  1574. for ex in ${EPATCH_EXCLUDE};
  1575. do
  1576. if [[ ${patchname} == ${ex} ]]; then
  1577. eshopts_pop;
  1578. continue 2;
  1579. fi;
  1580. done;
  1581. eshopts_pop;
  1582. fi;
  1583. if [[ ${SINGLE_PATCH} == "yes" ]]; then
  1584. if [[ -n ${EPATCH_SINGLE_MSG} ]]; then
  1585. einfo "${EPATCH_SINGLE_MSG}";
  1586. else
  1587. einfo "Applying ${patchname} ...";
  1588. fi;
  1589. else
  1590. einfo " ${patchname} ...";
  1591. fi;
  1592. local STDERR_TARGET="${T}/${patchname}.out";
  1593. if [[ -e ${STDERR_TARGET} ]]; then
  1594. STDERR_TARGET="${T}/${patchname}-$$.out";
  1595. fi;
  1596. printf "***** %s *****\n\n" "${patchname}" > "${STDERR_TARGET}";
  1597. local count=0;
  1598. local PATCH_TARGET;
  1599. if [[ -n ${PIPE_CMD} ]]; then
  1600. PATCH_TARGET="${T}/$$.patch";
  1601. echo "PIPE_COMMAND: ${PIPE_CMD} ${x} > ${PATCH_TARGET}" >> "${STDERR_TARGET}";
  1602. if ! ( ${PIPE_CMD} "${x}" > "${PATCH_TARGET}" ) >> "${STDERR_TARGET}" 2>&1; then
  1603. echo;
  1604. eerror "Could not extract patch!";
  1605. count=5;
  1606. break;
  1607. fi;
  1608. else
  1609. PATCH_TARGET=${x};
  1610. fi;
  1611. local abs_paths=$(egrep -n '^[-+]{3} /' "${PATCH_TARGET}" | awk '$2 != "/dev/null" { print }');
  1612. if [[ -n ${abs_paths} ]]; then
  1613. count=1;
  1614. printf "NOTE: skipping -p0 due to absolute paths in patch:\n%s\n" "${abs_paths}" >> "${STDERR_TARGET}";
  1615. fi;
  1616. local rel_paths=$(egrep -n '^[-+]{3} [^ ]*[.][.]/' "${PATCH_TARGET}");
  1617. if [[ -n ${rel_paths} ]]; then
  1618. eqawarn "QA Notice: Your patch uses relative paths '../'.";
  1619. eqawarn " In the future this will cause a failure.";
  1620. eqawarn "${rel_paths}";
  1621. fi;
  1622. while [[ ${count} -lt 5 ]]; do
  1623. ( _epatch_draw_line "***** ${patchname} *****";
  1624. echo;
  1625. echo "PATCH COMMAND: patch -p${count} ${EPATCH_OPTS} < '${PATCH_TARGET}'";
  1626. echo;
  1627. _epatch_draw_line "***** ${patchname} *****";
  1628. patch -p${count} ${EPATCH_OPTS} --dry-run -f < "${PATCH_TARGET}" 2>&1;
  1629. ret=$?;
  1630. echo;
  1631. echo "patch program exited with status ${ret}";
  1632. exit ${ret} ) >> "${STDERR_TARGET}";
  1633. if [ $? -eq 0 ]; then
  1634. ( _epatch_draw_line "***** ${patchname} *****";
  1635. echo;
  1636. echo "ACTUALLY APPLYING ${patchname} ...";
  1637. echo;
  1638. _epatch_draw_line "***** ${patchname} *****";
  1639. patch -p${count} ${EPATCH_OPTS} < "${PATCH_TARGET}" 2>&1;
  1640. ret=$?;
  1641. echo;
  1642. echo "patch program exited with status ${ret}";
  1643. exit ${ret} ) >> "${STDERR_TARGET}";
  1644. if [ $? -ne 0 ]; then
  1645. echo;
  1646. eerror "A dry-run of patch command succeeded, but actually";
  1647. eerror "applying the patch failed!";
  1648. count=5;
  1649. fi;
  1650. break;
  1651. fi;
  1652. : $(( count++ ));
  1653. done;
  1654. if [[ -n ${PIPE_CMD} ]]; then
  1655. rm -f "${PATCH_TARGET}";
  1656. fi;
  1657. if [[ ${count} -ge 5 ]]; then
  1658. echo;
  1659. eerror "Failed Patch: ${patchname} !";
  1660. eerror " ( ${PATCH_TARGET} )";
  1661. eerror;
  1662. eerror "Include in your bugreport the contents of:";
  1663. eerror;
  1664. eerror " ${STDERR_TARGET}";
  1665. echo;
  1666. die "Failed Patch: ${patchname}!";
  1667. fi;
  1668. rm -f "${STDERR_TARGET}";
  1669. eend 0;
  1670. done;
  1671. [[ ${SINGLE_PATCH} == "no" ]] && einfo "Done with patching";
  1672. :
  1673. }
  1674. epatch_user ()
  1675. {
  1676. [[ $# -ne 0 ]] && die "epatch_user takes no options";
  1677. local applied="${T}/epatch_user.applied";
  1678. [[ -e ${applied} ]] && return 2;
  1679. local EPATCH_SOURCE check base=${PORTAGE_CONFIGROOT%/}/etc/portage/patches;
  1680. for check in {${CATEGORY}/${PF},${CATEGORY}/${P},${CATEGORY}/${PN}};
  1681. do
  1682. EPATCH_SOURCE=${base}/${CTARGET}/${check};
  1683. [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${base}/${CHOST}/${check};
  1684. [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${base}/${check};
  1685. if [[ -d ${EPATCH_SOURCE} ]]; then
  1686. EPATCH_SOURCE=${EPATCH_SOURCE} EPATCH_SUFFIX="patch" EPATCH_FORCE="yes" EPATCH_MULTI_MSG="Applying user patches from ${EPATCH_SOURCE} ..." epatch;
  1687. echo "${EPATCH_SOURCE}" > "${applied}";
  1688. return 0;
  1689. fi;
  1690. done;
  1691. echo "none" > "${applied}";
  1692. return 1
  1693. }
  1694. epause ()
  1695. {
  1696. ewarn "QA Notice: epause is not defined in EAPI=${EAPI}, please file a bug at http://bugs.gentoo.org"
  1697. }
  1698. eprefixify ()
  1699. {
  1700. [[ $# -lt 1 ]] && die "at least one argument required";
  1701. einfo "Adjusting to prefix ${EPREFIX:-/}";
  1702. local x;
  1703. for x in "$@";
  1704. do
  1705. if [[ -e ${x} ]]; then
  1706. ebegin " ${x##*/}";
  1707. sed -i -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}|g" "${x}";
  1708. eend $? || die "failed to eprefixify ${x}";
  1709. else
  1710. die "${x} does not exist";
  1711. fi;
  1712. done;
  1713. return 0
  1714. }
  1715. epunt_cxx ()
  1716. {
  1717. local dir=$1;
  1718. [[ -z ${dir} ]] && dir=${S};
  1719. ebegin "Removing useless C++ checks";
  1720. local f;
  1721. find "${dir}" -name configure | while read f; do
  1722. patch --no-backup-if-mismatch -p0 "${f}" "${PORTDIR}/eclass/ELT-patches/nocxx/nocxx.patch" > /dev/null;
  1723. done;
  1724. eend 0
  1725. }
  1726. eshopts_pop ()
  1727. {
  1728. [[ $# -ne 0 ]] && die "eshopts_pop takes no arguments";
  1729. local i=$(( ${#__ESHOPTS_SAVE__[@]} - 1 ));
  1730. [[ ${i} -eq -1 ]] && die "eshopts_{push,pop}: unbalanced pair";
  1731. local s=${__ESHOPTS_SAVE__[$i]};
  1732. unset __ESHOPTS_SAVE__[$i];
  1733. if [[ ${s} == "shopt -"* ]]; then
  1734. eval "${s}" || die "eshopts_pop: sanity: invalid shopt options: ${s}";
  1735. else
  1736. set +$- || die "eshopts_pop: sanity: invalid shell settings: $-";
  1737. set -${s} || die "eshopts_pop: sanity: unable to restore saved shell settings: ${s}";
  1738. fi
  1739. }
  1740. eshopts_push ()
  1741. {
  1742. local i=${#__ESHOPTS_SAVE__[@]};
  1743. if [[ $1 == -[su] ]]; then
  1744. __ESHOPTS_SAVE__[$i]=$(shopt -p);
  1745. [[ $# -eq 0 ]] && return 0;
  1746. shopt "$@" || die "eshopts_push: bad options to shopt: $*";
  1747. else
  1748. __ESHOPTS_SAVE__[$i]=$-;
  1749. [[ $# -eq 0 ]] && return 0;
  1750. set "$@" || die "eshopts_push: bad options to set: $*";
  1751. fi
  1752. }
  1753. esvn_clean ()
  1754. {
  1755. [[ -z $* ]] && set -- .;
  1756. find "$@" -type d -name '.svn' -prune -print0 | xargs -0 rm -rf
  1757. }
  1758. find_unpackable_file ()
  1759. {
  1760. local src=$1;
  1761. if [[ -z ${src} ]]; then
  1762. src=${DISTDIR}/${A};
  1763. else
  1764. if [[ -e ${DISTDIR}/${src} ]]; then
  1765. src=${DISTDIR}/${src};
  1766. else
  1767. if [[ -e ${PWD}/${src} ]]; then
  1768. src=${PWD}/${src};
  1769. else
  1770. if [[ -e ${src} ]]; then
  1771. src=${src};
  1772. fi;
  1773. fi;
  1774. fi;
  1775. fi;
  1776. [[ ! -e ${src} ]] && return 1;
  1777. echo "${src}"
  1778. }
  1779. gcc-fullversion ()
  1780. {
  1781. _gcc_fullversion '$1.$2.$3' "$@"
  1782. }
  1783. gcc-major-version ()
  1784. {
  1785. _gcc_fullversion '$1' "$@"
  1786. }
  1787. gcc-micro-version ()
  1788. {
  1789. _gcc_fullversion '$3' "$@"
  1790. }
  1791. gcc-minor-version ()
  1792. {
  1793. _gcc_fullversion '$2' "$@"
  1794. }
  1795. gcc-specs-directive ()
  1796. {
  1797. local directive subdname subdirective;
  1798. directive="$(_gcc-specs-directive_raw $1)";
  1799. while [[ ${directive} == *%\(*\)* ]]; do
  1800. subdname=${directive/*%\(};
  1801. subdname=${subdname/\)*};
  1802. subdirective="$(_gcc-specs-directive_raw ${subdname})";
  1803. directive="${directive//\%(${subdname})/${subdirective}}";
  1804. done;
  1805. echo "${directive}";
  1806. return 0
  1807. }
  1808. gcc-specs-nostrict ()
  1809. {
  1810. local directive;
  1811. directive=$(gcc-specs-directive cc1);
  1812. return $([[ "${directive/\{!fstrict-overflow:}" != "${directive}" ]])
  1813. }
  1814. gcc-specs-now ()
  1815. {
  1816. local directive;
  1817. directive=$(gcc-specs-directive link_command);
  1818. return $([[ "${directive/\{!nonow:}" != "${directive}" ]])
  1819. }
  1820. gcc-specs-pie ()
  1821. {
  1822. local directive;
  1823. directive=$(gcc-specs-directive cc1);
  1824. return $([[ "${directive/\{!nopie:}" != "${directive}" ]])
  1825. }
  1826. gcc-specs-relro ()
  1827. {
  1828. local directive;
  1829. directive=$(gcc-specs-directive link_command);
  1830. return $([[ "${directive/\{!norelro:}" != "${directive}" ]])
  1831. }
  1832. gcc-specs-ssp ()
  1833. {
  1834. local directive;
  1835. directive=$(gcc-specs-directive cc1);
  1836. return $([[ "${directive/\{!fno-stack-protector:}" != "${directive}" ]])
  1837. }
  1838. gcc-specs-ssp-to-all ()
  1839. {
  1840. local directive;
  1841. directive=$(gcc-specs-directive cc1);
  1842. return $([[ "${directive/\{!fno-stack-protector-all:}" != "${directive}" ]])
  1843. }
  1844. gcc-version ()
  1845. {
  1846. _gcc_fullversion '$1.$2' "$@"
  1847. }
  1848. gen_usr_ldscript ()
  1849. {
  1850. local lib libdir=$(get_libdir) output_format="" auto=false suffix=$(get_libname);
  1851. [[ -z ${ED+set} ]] && local ED=${D%/}${EPREFIX}/;
  1852. tc-is-static-only && return;
  1853. dodir /usr/${libdir};
  1854. if [[ $1 == "-a" ]]; then
  1855. auto=true;
  1856. shift;
  1857. dodir /${libdir};
  1858. fi;
  1859. output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p');
  1860. [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )";
  1861. for lib in "$@";
  1862. do
  1863. local tlib;
  1864. if ${auto}; then
  1865. lib="lib${lib}${suffix}";
  1866. else
  1867. [[ -r ${ED}/${libdir}/${lib} ]] || continue;
  1868. fi;
  1869. case ${CTARGET:-${CHOST}} in
  1870. *-darwin*)
  1871. if ${auto}; then
  1872. tlib=$(scanmacho -qF'%S#F' "${ED}"/usr/${libdir}/${lib});
  1873. else
  1874. tlib=$(scanmacho -qF'%S#F' "${ED}"/${libdir}/${lib});
  1875. fi;
  1876. [[ -z ${tlib} ]] && die "unable to read install_name from ${lib}";
  1877. tlib=${tlib##*/};
  1878. if ${auto}; then
  1879. mv "${ED}"/usr/${libdir}/${lib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die;
  1880. if [[ ${tlib} != ${lib%${suffix}}.*${suffix#.} ]]; then
  1881. mv "${ED}"/usr/${libdir}/${tlib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die;
  1882. fi;
  1883. rm -f "${ED}"/${libdir}/${lib};
  1884. fi;
  1885. if [[ ! -w "${ED}/${libdir}/${tlib}" ]]; then
  1886. chmod u+w "${ED}${libdir}/${tlib}";
  1887. local nowrite=yes;
  1888. fi;
  1889. install_name_tool -id "${EPREFIX}"/${libdir}/${tlib} "${ED}"/${libdir}/${tlib} || die "install_name_tool failed";
  1890. [[ -n ${nowrite} ]] && chmod u-w "${ED}${libdir}/${tlib}";
  1891. pushd "${ED}/usr/${libdir}" > /dev/null;
  1892. ln -snf "../../${libdir}/${tlib}" "${lib}";
  1893. popd > /dev/null
  1894. ;;
  1895. *-aix* | *-irix* | *64*-hpux* | *-interix* | *-winnt*)
  1896. if ${auto}; then
  1897. mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die;
  1898. tlib=$(readlink "${ED}"/${libdir}/${lib});
  1899. tlib=${tlib##*/};
  1900. if [[ -z ${tlib} ]]; then
  1901. tlib=${lib};
  1902. else
  1903. rm -f "${ED}"/${libdir}/${lib};
  1904. fi;
  1905. else
  1906. tlib=${lib};
  1907. fi;
  1908. pushd "${ED}/usr/${libdir}" > /dev/null;
  1909. ln -snf "../../${libdir}/${tlib}" "${lib}";
  1910. popd > /dev/null
  1911. ;;
  1912. hppa*-hpux*)
  1913. if ${auto}; then
  1914. tlib=$(chatr "${ED}"/usr/${libdir}/${lib} | sed -n '/internal name:/{n;s/^ *//;p;q}');
  1915. [[ -z ${tlib} ]] && tlib=${lib};
  1916. tlib=${tlib##*/};
  1917. mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die;
  1918. if [[ ${tlib} != ${lib}* ]]; then
  1919. mv "${ED}"/usr/${libdir}/${tlib}* "${ED}"/${libdir}/ || die;
  1920. fi;
  1921. [[ ${tlib} != ${lib} ]] && rm -f "${ED}"/${libdir}/${lib};
  1922. else
  1923. tlib=$(chatr "${ED}"/${libdir}/${lib} | sed -n '/internal name:/{n;s/^ *//;p;q}');
  1924. [[ -z ${tlib} ]] && tlib=${lib};
  1925. tlib=${tlib##*/};
  1926. fi;
  1927. pushd "${ED}"/usr/${libdir} > /dev/null;
  1928. ln -snf "../../${libdir}/${tlib}" "${lib}";
  1929. [[ ${tlib} != ${lib} ]] && ln -snf "../../${libdir}/${tlib}" "${tlib}";
  1930. popd > /dev/null
  1931. ;;
  1932. *)
  1933. if ${auto}; then
  1934. tlib=$(scanelf -qF'%S#F' "${ED}"/usr/${libdir}/${lib});
  1935. [[ -z ${tlib} ]] && die "unable to read SONAME from ${lib}";
  1936. mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die;
  1937. if [[ ${tlib} != ${lib}* ]]; then
  1938. mv "${ED}"/usr/${libdir}/${tlib}* "${ED}"/${libdir}/ || die;
  1939. fi;
  1940. rm -f "${ED}"/${libdir}/${lib};
  1941. else
  1942. tlib=${lib};
  1943. fi;
  1944. cat > "${ED}/usr/${libdir}/${lib}" <<-END_LDSCRIPT
  1945. /* GNU ld script
  1946. Since Gentoo has critical dynamic libraries in /lib, and the static versions
  1947. in /usr/lib, we need to have a "fake" dynamic lib in /usr/lib, otherwise we
  1948. run into linking problems. This "fake" dynamic lib is a linker script that
  1949. redirects the linker to the real lib. And yes, this works in the cross-
  1950. compiling scenario as the sysroot-ed linker will prepend the real path.
  1951.  
  1952. See bug http://bugs.gentoo.org/4411 for more info.
  1953. */
  1954. ${output_format}
  1955. GROUP ( ${EPREFIX}/${libdir}/${tlib} )
  1956. END_LDSCRIPT
  1957.  
  1958. ;;
  1959. esac
  1960. fperms a+x "/usr/${libdir}/${lib}" || die "could not change perms on ${lib}";
  1961. done
  1962. }
  1963. get_abi_ASFLAGS ()
  1964. {
  1965. get_abi_var ASFLAGS "$@"
  1966. }
  1967. get_abi_CFLAGS ()
  1968. {
  1969. get_abi_var CFLAGS "$@"
  1970. }
  1971. get_abi_CHOST ()
  1972. {
  1973. get_abi_var CHOST "$@"
  1974. }
  1975. get_abi_CTARGET ()
  1976. {
  1977. get_abi_var CTARGET "$@"
  1978. }
  1979. get_abi_FAKE_TARGETS ()
  1980. {
  1981. get_abi_var FAKE_TARGETS "$@"
  1982. }
  1983. get_abi_LDFLAGS ()
  1984. {
  1985. get_abi_var LDFLAGS "$@"
  1986. }
  1987. get_abi_LIBDIR ()
  1988. {
  1989. get_abi_var LIBDIR "$@"
  1990. }
  1991. get_abi_var ()
  1992. {
  1993. local flag=$1;
  1994. local abi;
  1995. if [ $# -gt 1 ]; then
  1996. abi=${2};
  1997. else
  1998. if [ -n "${ABI}" ]; then
  1999. abi=${ABI};
  2000. else
  2001. if [ -n "${DEFAULT_ABI}" ]; then
  2002. abi=${DEFAULT_ABI};
  2003. else
  2004. abi="default";
  2005. fi;
  2006. fi;
  2007. fi;
  2008. local var="${flag}_${abi}";
  2009. echo ${!var}
  2010. }
  2011. get_all_abis ()
  2012. {
  2013. local order="";
  2014. if [[ -z ${MULTILIB_ABIS} ]]; then
  2015. echo "default";
  2016. return 0;
  2017. fi;
  2018. for x in ${MULTILIB_ABIS};
  2019. do
  2020. if [[ ${x} != ${DEFAULT_ABI} ]]; then
  2021. order="${order:+${order} }${x}";
  2022. fi;
  2023. done;
  2024. order="${order:+${order} }${DEFAULT_ABI}";
  2025. echo ${order};
  2026. return 0
  2027. }
  2028. get_all_libdirs ()
  2029. {
  2030. local libdirs;
  2031. local abi;
  2032. local dir;
  2033. for abi in ${MULTILIB_ABIS};
  2034. do
  2035. libdirs+=" $(get_abi_LIBDIR ${abi})";
  2036. done;
  2037. [[ " ${libdirs} " != *" lib "* ]] && libdirs+=" lib";
  2038. echo "${libdirs}"
  2039. }
  2040. get_bmake ()
  2041. {
  2042. if [[ ${USERLAND} == *BSD ]]; then
  2043. echo make;
  2044. else
  2045. if [[ ${USERLAND} == "Darwin" ]]; then
  2046. echo bsdmake;
  2047. else
  2048. echo pmake;
  2049. fi;
  2050. fi
  2051. }
  2052. get_install_abis ()
  2053. {
  2054. local order="";
  2055. if [[ -z ${MULTILIB_ABIS} ]]; then
  2056. echo "default";
  2057. return 0;
  2058. fi;
  2059. if [[ ${EMULTILIB_PKG} == "true" ]]; then
  2060. for x in ${MULTILIB_ABIS};
  2061. do
  2062. if [[ ${x} != "${DEFAULT_ABI}" ]]; then
  2063. has ${x} ${ABI_DENY} || order="${order} ${x}";
  2064. fi;
  2065. done;
  2066. has ${DEFAULT_ABI} ${ABI_DENY} || order="${order} ${DEFAULT_ABI}";
  2067. if [[ -n ${ABI_ALLOW} ]]; then
  2068. local ordera="";
  2069. for x in ${order};
  2070. do
  2071. if has ${x} ${ABI_ALLOW}; then
  2072. ordera="${ordera} ${x}";
  2073. fi;
  2074. done;
  2075. order=${ordera};
  2076. fi;
  2077. else
  2078. order=${DEFAULT_ABI};
  2079. fi;
  2080. if [[ -z ${order} ]]; then
  2081. 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.";
  2082. fi;
  2083. echo ${order};
  2084. return 0
  2085. }
  2086. get_libdir ()
  2087. {
  2088. local CONF_LIBDIR;
  2089. if [ -n "${CONF_LIBDIR_OVERRIDE}" ]; then
  2090. echo ${CONF_LIBDIR_OVERRIDE};
  2091. else
  2092. get_abi_LIBDIR;
  2093. fi
  2094. }
  2095. get_libdir_override ()
  2096. {
  2097. if has_multilib_profile; then
  2098. eerror "get_libdir_override called, but it shouldn't be needed with the new multilib approach. Please file a bug at http://bugs.gentoo.org and assign it to eradicator@gentoo.org";
  2099. exit 1;
  2100. fi;
  2101. CONF_LIBDIR="$1";
  2102. CONF_LIBDIR_OVERRIDE="$1";
  2103. LIBDIR_default="$1"
  2104. }
  2105. get_libname ()
  2106. {
  2107. local libname;
  2108. local ver=$1;
  2109. case ${CHOST} in
  2110. *-cygwin | mingw* | *-mingw*)
  2111. libname="dll"
  2112. ;;
  2113. *-darwin*)
  2114. libname="dylib"
  2115. ;;
  2116. *-mint*)
  2117. libname="irrelevant"
  2118. ;;
  2119. hppa*-hpux*)
  2120. libname="sl"
  2121. ;;
  2122. *)
  2123. libname="so"
  2124. ;;
  2125. esac;
  2126. if [[ -z $* ]]; then
  2127. echo ".${libname}";
  2128. else
  2129. for ver in "$@";
  2130. do
  2131. case ${CHOST} in
  2132. *-darwin*)
  2133. echo ".${ver}.${libname}"
  2134. ;;
  2135. *-mint*)
  2136. echo ".${libname}"
  2137. ;;
  2138. *)
  2139. echo ".${libname}.${ver}"
  2140. ;;
  2141. esac;
  2142. done;
  2143. fi
  2144. }
  2145. get_modname ()
  2146. {
  2147. local modname;
  2148. local ver=$1;
  2149. case ${CHOST} in
  2150. *-darwin*)
  2151. modname="bundle"
  2152. ;;
  2153. *)
  2154. modname="so"
  2155. ;;
  2156. esac;
  2157. echo ".${modname}"
  2158. }
  2159. get_mounts ()
  2160. {
  2161. local point= node= fs= opts= foo=;
  2162. if [[ $(uname -s) == "Linux" ]]; then
  2163. while read node point fs opts foo; do
  2164. echo "${point} ${node} ${fs} ${opts}";
  2165. done < /proc/mounts;
  2166. return;
  2167. fi;
  2168. local IFS=' ';
  2169. LC_ALL=C mount -p | while read node point fs foo; do
  2170. opts=${fs#* };
  2171. fs=${fs%% *};
  2172. echo "${point// /\040} ${node// /\040} ${fs%% *} ${opts// /\040}";
  2173. done
  2174. }
  2175. get_multilibdir ()
  2176. {
  2177. if has_multilib_profile; then
  2178. eerror "get_multilibdir called, but it shouldn't be needed with the new multilib approach. Please file a bug at http://bugs.gentoo.org and assign it to eradicator@gentoo.org";
  2179. exit 1;
  2180. fi;
  2181. echo ${CONF_MULTILIBDIR:=lib32}
  2182. }
  2183. has_multilib_profile ()
  2184. {
  2185. [ -n "${MULTILIB_ABIS}" -a "${MULTILIB_ABIS}" != "${MULTILIB_ABIS/ /}" ]
  2186. }
  2187. helpers_die ()
  2188. {
  2189. case "${EAPI:-0}" in
  2190. 0 | 1 | 2 | 3)
  2191. echo -e "$@" 1>&2
  2192. ;;
  2193. *)
  2194. die "$@"
  2195. ;;
  2196. esac
  2197. }
  2198. is-login-disabled ()
  2199. {
  2200. shell=$(egetshell "$1");
  2201. case ${shell} in
  2202. /bin/false | /usr/bin/false | /sbin/nologin | /usr/sbin/nologin)
  2203. return 0
  2204. ;;
  2205. *)
  2206. return 1
  2207. ;;
  2208. esac
  2209. }
  2210. is_final_abi ()
  2211. {
  2212. has_multilib_profile || return 0;
  2213. set -- $(get_install_abis);
  2214. local LAST_ABI=$#;
  2215. [[ ${!LAST_ABI} == ${ABI} ]]
  2216. }
  2217. make_desktop_entry ()
  2218. {
  2219. [[ -z $1 ]] && die "make_desktop_entry: You must specify the executable";
  2220. local exec=${1};
  2221. local name=${2:-${PN}};
  2222. local icon=${3:-${PN}};
  2223. local type=${4};
  2224. local fields=${5};
  2225. if [[ -z ${type} ]]; then
  2226. local catmaj=${CATEGORY%%-*};
  2227. local catmin=${CATEGORY##*-};
  2228. case ${catmaj} in
  2229. app)
  2230. case ${catmin} in
  2231. accessibility)
  2232. type=Accessibility
  2233. ;;
  2234. admin)
  2235. type=System
  2236. ;;
  2237. antivirus)
  2238. type=System
  2239. ;;
  2240. arch)
  2241. type=Archiving
  2242. ;;
  2243. backup)
  2244. type=Archiving
  2245. ;;
  2246. cdr)
  2247. type=DiscBurning
  2248. ;;
  2249. dicts)
  2250. type=Dictionary
  2251. ;;
  2252. doc)
  2253. type=Documentation
  2254. ;;
  2255. editors)
  2256. type=TextEditor
  2257. ;;
  2258. emacs)
  2259. type=TextEditor
  2260. ;;
  2261. emulation)
  2262. type=Emulator
  2263. ;;
  2264. laptop)
  2265. type=HardwareSettings
  2266. ;;
  2267. office)
  2268. type=Office
  2269. ;;
  2270. pda)
  2271. type=PDA
  2272. ;;
  2273. vim)
  2274. type=TextEditor
  2275. ;;
  2276. xemacs)
  2277. type=TextEditor
  2278. ;;
  2279. esac
  2280. ;;
  2281. dev)
  2282. type="Development"
  2283. ;;
  2284. games)
  2285. case ${catmin} in
  2286. action | fps)
  2287. type=ActionGame
  2288. ;;
  2289. arcade)
  2290. type=ArcadeGame
  2291. ;;
  2292. board)
  2293. type=BoardGame
  2294. ;;
  2295. emulation)
  2296. type=Emulator
  2297. ;;
  2298. kids)
  2299. type=KidsGame
  2300. ;;
  2301. puzzle)
  2302. type=LogicGame
  2303. ;;
  2304. roguelike)
  2305. type=RolePlaying
  2306. ;;
  2307. rpg)
  2308. type=RolePlaying
  2309. ;;
  2310. simulation)
  2311. type=Simulation
  2312. ;;
  2313. sports)
  2314. type=SportsGame
  2315. ;;
  2316. strategy)
  2317. type=StrategyGame
  2318. ;;
  2319. esac;
  2320. type="Game;${type}"
  2321. ;;
  2322. gnome)
  2323. type="Gnome;GTK"
  2324. ;;
  2325. kde)
  2326. type="KDE;Qt"
  2327. ;;
  2328. mail)
  2329. type="Network;Email"
  2330. ;;
  2331. media)
  2332. case ${catmin} in
  2333. gfx)
  2334. type=Graphics
  2335. ;;
  2336. *)
  2337. case ${catmin} in
  2338. radio)
  2339. type=Tuner
  2340. ;;
  2341. sound)
  2342. type=Audio
  2343. ;;
  2344. tv)
  2345. type=TV
  2346. ;;
  2347. video)
  2348. type=Video
  2349. ;;
  2350. esac;
  2351. type="AudioVideo;${type}"
  2352. ;;
  2353. esac
  2354. ;;
  2355. net)
  2356. case ${catmin} in
  2357. dialup)
  2358. type=Dialup
  2359. ;;
  2360. ftp)
  2361. type=FileTransfer
  2362. ;;
  2363. im)
  2364. type=InstantMessaging
  2365. ;;
  2366. irc)
  2367. type=IRCClient
  2368. ;;
  2369. mail)
  2370. type=Email
  2371. ;;
  2372. news)
  2373. type=News
  2374. ;;
  2375. nntp)
  2376. type=News
  2377. ;;
  2378. p2p)
  2379. type=FileTransfer
  2380. ;;
  2381. voip)
  2382. type=Telephony
  2383. ;;
  2384. esac;
  2385. type="Network;${type}"
  2386. ;;
  2387. sci)
  2388. case ${catmin} in
  2389. astro*)
  2390. type=Astronomy
  2391. ;;
  2392. bio*)
  2393. type=Biology
  2394. ;;
  2395. calc*)
  2396. type=Calculator
  2397. ;;
  2398. chem*)
  2399. type=Chemistry
  2400. ;;
  2401. elec*)
  2402. type=Electronics
  2403. ;;
  2404. geo*)
  2405. type=Geology
  2406. ;;
  2407. math*)
  2408. type=Math
  2409. ;;
  2410. physics)
  2411. type=Physics
  2412. ;;
  2413. visual*)
  2414. type=DataVisualization
  2415. ;;
  2416. esac;
  2417. type="Education;Science;${type}"
  2418. ;;
  2419. sys)
  2420. type="System"
  2421. ;;
  2422. www)
  2423. case ${catmin} in
  2424. client)
  2425. type=WebBrowser
  2426. ;;
  2427. esac;
  2428. type="Network;${type}"
  2429. ;;
  2430. *)
  2431. type=
  2432. ;;
  2433. esac;
  2434. fi;
  2435. if [ "${SLOT}" == "0" ]; then
  2436. local desktop_name="${PN}";
  2437. else
  2438. local desktop_name="${PN}-${SLOT}";
  2439. fi;
  2440. local desktop="${T}/$(echo ${exec} | sed 's:[[:space:]/:]:_:g')-${desktop_name}.desktop";
  2441. type=${type%;}${type:+;};
  2442. eshopts_push -s extglob;
  2443. if [[ -n ${icon} && ${icon} != /* ]] && [[ ${icon} == *.xpm || ${icon} == *.png || ${icon} == *.svg ]]; then
  2444. ewarn "As described in the Icon Theme Specification, icon file extensions are not";
  2445. ewarn "allowed in .desktop files if the value is not an absolute path.";
  2446. icon=${icon%.@(xpm|png|svg)};
  2447. fi;
  2448. eshopts_pop;
  2449. cat > "${desktop}" <<-EOF
  2450. [Desktop Entry]
  2451. Name=${name}
  2452. Type=Application
  2453. Comment=${DESCRIPTION}
  2454. Exec=${exec}
  2455. TryExec=${exec%% *}
  2456. Icon=${icon}
  2457. Categories=${type}
  2458. EOF
  2459.  
  2460. if [[ ${fields:-=} != *=* ]]; then
  2461. ewarn "make_desktop_entry: update your 5th arg to read Path=${fields}";
  2462. fields="Path=${fields}";
  2463. fi;
  2464. [[ -n ${fields} ]] && printf '%b\n' "${fields}" >> "${desktop}";
  2465. ( insinto /usr/share/applications;
  2466. doins "${desktop}" ) || die "installing desktop file failed"
  2467. }
  2468. make_session_desktop ()
  2469. {
  2470. [[ -z $1 ]] && eerror "$0: You must specify the title" && return 1;
  2471. [[ -z $2 ]] && eerror "$0: You must specify the command" && return 1;
  2472. local title=$1;
  2473. local command=$2;
  2474. local desktop=${T}/${wm:-${PN}}.desktop;
  2475. shift 2;
  2476. cat > "${desktop}" <<-EOF
  2477. [Desktop Entry]
  2478. Name=${title}
  2479. Comment=This session logs you into ${title}
  2480. Exec=${command} $*
  2481. TryExec=${command}
  2482. Type=XSession
  2483. EOF
  2484.  
  2485. ( insinto /usr/share/xsessions;
  2486. doins "${desktop}" )
  2487. }
  2488. make_wrapper ()
  2489. {
  2490. local wrapper=$1 bin=$2 chdir=$3 libdir=$4 path=$5;
  2491. local tmpwrapper=$(emktemp);
  2492. cat > "${tmpwrapper}" <<EOF
  2493. #!/bin/sh
  2494. cd "${chdir:-.}"
  2495. if [ -n "${libdir}" ] ; then
  2496. if [ "\${LD_LIBRARY_PATH+set}" = "set" ] ; then
  2497. export LD_LIBRARY_PATH="\${LD_LIBRARY_PATH}:${libdir}"
  2498. else
  2499. export LD_LIBRARY_PATH="${libdir}"
  2500. fi
  2501. fi
  2502. exec ${bin} "\$@"
  2503. EOF
  2504.  
  2505. chmod go+rx "${tmpwrapper}";
  2506. if [[ -n ${path} ]]; then
  2507. ( exeinto "${path}";
  2508. newexe "${tmpwrapper}" "${wrapper}" ) || die;
  2509. else
  2510. newbin "${tmpwrapper}" "${wrapper}" || die;
  2511. fi
  2512. }
  2513. multilib_env ()
  2514. {
  2515. local CTARGET=${1:-${CTARGET}};
  2516. case ${CTARGET} in
  2517. x86_64*)
  2518. export CFLAGS_x86=${CFLAGS_x86--m32};
  2519. export CHOST_x86=${CTARGET/x86_64/i686};
  2520. export CTARGET_x86=${CHOST_x86};
  2521. if [[ ${SYMLINK_LIB} == "yes" ]]; then
  2522. export LIBDIR_x86="lib32";
  2523. else
  2524. export LIBDIR_x86="lib";
  2525. fi;
  2526. export CFLAGS_amd64=${CFLAGS_amd64--m64};
  2527. export CHOST_amd64=${CTARGET};
  2528. export CTARGET_amd64=${CHOST_amd64};
  2529. export LIBDIR_amd64="lib64";
  2530. export CFLAGS_x32=${CFLAGS_x32--mx32};
  2531. export CHOST_x32=${CTARGET};
  2532. export CTARGET_x32=${CHOST_x32};
  2533. export LIBDIR_x32="libx32";
  2534. : ${MULTILIB_ABIS=amd64 x86};
  2535. : ${DEFAULT_ABI=amd64}
  2536. ;;
  2537. mips64*)
  2538. export CFLAGS_o32=${CFLAGS_o32--mabi=32};
  2539. export CHOST_o32=${CTARGET/mips64/mips};
  2540. export CTARGET_o32=${CHOST_o32};
  2541. export LIBDIR_o32="lib";
  2542. export CFLAGS_n32=${CFLAGS_n32--mabi=n32};
  2543. export CHOST_n32=${CTARGET};
  2544. export CTARGET_n32=${CHOST_n32};
  2545. export LIBDIR_n32="lib32";
  2546. export CFLAGS_n64=${CFLAGS_n64--mabi=64};
  2547. export CHOST_n64=${CTARGET};
  2548. export CTARGET_n64=${CHOST_n64};
  2549. export LIBDIR_n64="lib64";
  2550. : ${MULTILIB_ABIS=n64 n32 o32};
  2551. : ${DEFAULT_ABI=n32}
  2552. ;;
  2553. powerpc64*)
  2554. export CFLAGS_ppc=${CFLAGS_ppc--m32};
  2555. export CHOST_ppc=${CTARGET/powerpc64/powerpc};
  2556. export CTARGET_ppc=${CHOST_ppc};
  2557. export LIBDIR_ppc="lib";
  2558. export CFLAGS_ppc64=${CFLAGS_ppc64--m64};
  2559. export CHOST_ppc64=${CTARGET};
  2560. export CTARGET_ppc64=${CHOST_ppc64};
  2561. export LIBDIR_ppc64="lib64";
  2562. : ${MULTILIB_ABIS=ppc64 ppc};
  2563. : ${DEFAULT_ABI=ppc64}
  2564. ;;
  2565. s390x*)
  2566. export CFLAGS_s390=${CFLAGS_s390--m31};
  2567. export CHOST_s390=${CTARGET/s390x/s390};
  2568. export CTARGET_s390=${CHOST_s390};
  2569. export LIBDIR_s390="lib";
  2570. export CFLAGS_s390x=${CFLAGS_s390x--m64};
  2571. export CHOST_s390x=${CTARGET};
  2572. export CTARGET_s390x=${CHOST_s390x};
  2573. export LIBDIR_s390x="lib64";
  2574. : ${MULTILIB_ABIS=s390x s390};
  2575. : ${DEFAULT_ABI=s390x}
  2576. ;;
  2577. sparc*)
  2578. export CFLAGS_sparc32=${CFLAGS_sparc32};
  2579. export CHOST_sparc32=${CTARGET/sparc64/sparc};
  2580. export CTARGET_sparc32=${CHOST_sparc32};
  2581. export LIBDIR_sparc32="lib";
  2582. export CFLAGS_sparc64=${CFLAGS_sparc64--m64};
  2583. export CHOST_sparc64=${CTARGET};
  2584. export CTARGET_sparc64=${CHOST_sparc64};
  2585. export LIBDIR_sparc64="lib64";
  2586. : ${MULTILIB_ABIS=sparc64 sparc32};
  2587. : ${DEFAULT_ABI=sparc64}
  2588. ;;
  2589. *)
  2590. : ${MULTILIB_ABIS=default};
  2591. : ${DEFAULT_ABI=default}
  2592. ;;
  2593. esac;
  2594. export MULTILIB_ABIS DEFAULT_ABI
  2595. }
  2596. multilib_toolchain_setup ()
  2597. {
  2598. local v vv;
  2599. export ABI=$1;
  2600. if [[ ${__DEFAULT_ABI_SAVED} == "true" ]]; then
  2601. for v in CHOST CBUILD AS CC CXX LD;
  2602. do
  2603. vv="__abi_saved_${v}";
  2604. export ${v}="${!vv}";
  2605. unset ${vv};
  2606. done;
  2607. unset __DEFAULT_ABI_SAVED;
  2608. fi;
  2609. if [[ ${ABI} != ${DEFAULT_ABI} ]]; then
  2610. for v in CHOST CBUILD AS CC CXX LD;
  2611. do
  2612. export __abi_saved_${v}="${!v}";
  2613. done;
  2614. export __DEFAULT_ABI_SAVED="true";
  2615. export CHOST=$(get_abi_CHOST ${DEFAULT_ABI});
  2616. export AS="$(tc-getAS) $(get_abi_ASFLAGS)";
  2617. export CC="$(tc-getCC) $(get_abi_CFLAGS)";
  2618. export CXX="$(tc-getCXX) $(get_abi_CFLAGS)";
  2619. export LD="$(tc-getLD) $(get_abi_LDFLAGS)";
  2620. export CHOST=$(get_abi_CHOST $1);
  2621. export CBUILD=$(get_abi_CHOST $1);
  2622. fi
  2623. }
  2624. newicon ()
  2625. {
  2626. ( insinto /usr/share/pixmaps;
  2627. newins "$@" )
  2628. }
  2629. newmenu ()
  2630. {
  2631. ( insinto /usr/share/applications;
  2632. newins "$@" )
  2633. }
  2634. nonfatal ()
  2635. {
  2636. if has "${EAPI:-0}" 0 1 2 3 3_pre2; then
  2637. die "$FUNCNAME() not supported in this EAPI";
  2638. fi;
  2639. if [[ $# -lt 1 ]]; then
  2640. die "$FUNCNAME(): Missing argument";
  2641. fi;
  2642. PORTAGE_NONFATAL=1 "$@"
  2643. }
  2644. number_abis ()
  2645. {
  2646. set -- `get_install_abis`;
  2647. echo $#
  2648. }
  2649. path_exists ()
  2650. {
  2651. local opt=$1;
  2652. [[ ${opt} == -[ao] ]] && shift || opt="-a";
  2653. [[ $# -eq 0 ]] && return 1;
  2654. local p r=0;
  2655. for p in "$@";
  2656. do
  2657. [[ -e ${p} ]];
  2658. : $(( r += $? ));
  2659. done;
  2660. case ${opt} in
  2661. -a)
  2662. return $(( r != 0 ))
  2663. ;;
  2664. -o)
  2665. return $(( r == $# ))
  2666. ;;
  2667. esac
  2668. }
  2669. pkg_nofetch ()
  2670. {
  2671. _eapi0_pkg_nofetch "$@"
  2672. }
  2673. preserve_old_lib ()
  2674. {
  2675. if [[ ${EBUILD_PHASE} != "preinst" ]]; then
  2676. eerror "preserve_old_lib() must be called from pkg_preinst() only";
  2677. die "Invalid preserve_old_lib() usage";
  2678. fi;
  2679. [[ -z $1 ]] && die "Usage: preserve_old_lib <library to preserve> [more libraries to preserve]";
  2680. has preserve-libs ${FEATURES} && return 0;
  2681. local lib dir;
  2682. for lib in "$@";
  2683. do
  2684. [[ -e ${ROOT}/${lib} ]] || continue;
  2685. dir=${lib%/*};
  2686. dodir ${dir} || die "dodir ${dir} failed";
  2687. cp "${ROOT}"/${lib} "${D}"/${lib} || die "cp ${lib} failed";
  2688. touch "${D}"/${lib};
  2689. done
  2690. }
  2691. preserve_old_lib_notify ()
  2692. {
  2693. if [[ ${EBUILD_PHASE} != "postinst" ]]; then
  2694. eerror "preserve_old_lib_notify() must be called from pkg_postinst() only";
  2695. die "Invalid preserve_old_lib_notify() usage";
  2696. fi;
  2697. has preserve-libs ${FEATURES} && return 0;
  2698. local lib notice=0;
  2699. for lib in "$@";
  2700. do
  2701. [[ -e ${ROOT}/${lib} ]] || continue;
  2702. if [[ ${notice} -eq 0 ]]; then
  2703. notice=1;
  2704. ewarn "Old versions of installed libraries were detected on your system.";
  2705. ewarn "In order to avoid breaking packages that depend on these old libs,";
  2706. ewarn "the libraries are not being removed. You need to run revdep-rebuild";
  2707. ewarn "in order to remove these old dependencies. If you do not have this";
  2708. ewarn "helper program, simply emerge the 'gentoolkit' package.";
  2709. ewarn;
  2710. fi;
  2711. [[ ${PN} == "mpfr" ]] && lib=${lib##*/};
  2712. ewarn " # revdep-rebuild --library '${lib}'";
  2713. done;
  2714. if [[ ${notice} -eq 1 ]]; then
  2715. ewarn;
  2716. ewarn "Once you've finished running revdep-rebuild, it should be safe to";
  2717. ewarn "delete the old libraries. Here is a copy & paste for the lazy:";
  2718. for lib in "$@";
  2719. do
  2720. ewarn " # rm '${lib}'";
  2721. done;
  2722. fi
  2723. }
  2724. register_success_hook ()
  2725. {
  2726. local x;
  2727. for x in $*;
  2728. do
  2729. hasq $x $EBUILD_SUCCESS_HOOKS || export EBUILD_SUCCESS_HOOKS="$EBUILD_SUCCESS_HOOKS $x";
  2730. done
  2731. }
  2732. seq ()
  2733. {
  2734. local p=$(type -P seq);
  2735. if [[ -n ${p} ]]; then
  2736. "${p}" "$@";
  2737. return $?;
  2738. fi;
  2739. case $# in
  2740. 1)
  2741. min=1 max=$1 step=1
  2742. ;;
  2743. 2)
  2744. min=$1 max=$2 step=1
  2745. ;;
  2746. 3)
  2747. min=$1 max=$3 step=$2
  2748. ;;
  2749. *)
  2750. die "seq called with wrong number of arguments"
  2751. ;;
  2752. esac;
  2753. p=$(type -P jot);
  2754. if [[ -n ${p} ]]; then
  2755. local reps;
  2756. if [[ ${step} != 0 ]]; then
  2757. reps=$(( (max - min) / step + 1 ));
  2758. else
  2759. reps=0;
  2760. fi;
  2761. jot $reps $min $max $step;
  2762. return $?;
  2763. fi;
  2764. while :; do
  2765. [[ $max < $min && $step > 0 ]] && break;
  2766. [[ $min < $max && $step < 0 ]] && break;
  2767. echo $min;
  2768. : $(( min += step ));
  2769. done;
  2770. return 0
  2771. }
  2772. src_compile ()
  2773. {
  2774. default;
  2775. ed - lib/curl_config.h < "${FILESDIR}"/config.h.ed || die;
  2776. ed - src/curl_config.h < "${FILESDIR}"/config.h.ed || die;
  2777. ed - include/curl/curlbuild.h < "${FILESDIR}"/curlbuild.h.ed || die
  2778. }
  2779. src_configure ()
  2780. {
  2781. local myconf;
  2782. myconf="$(use_enable ldap)
  2783. $(use_enable ldap ldaps)
  2784. $(use_with idn libidn)
  2785. $(use_with kerberos gssapi "${EPREFIX}"/usr)
  2786. $(use_with libssh2)
  2787. $(use_enable static-libs static)
  2788. $(use_enable ipv6)
  2789. $(use_enable threads threaded-resolver)
  2790. $(use_enable ares)
  2791. --enable-http
  2792. --enable-ftp
  2793. --enable-gopher
  2794. --enable-file
  2795. --enable-dict
  2796. --enable-manual
  2797. --enable-telnet
  2798. --enable-smtp
  2799. --enable-pop3
  2800. --enable-imap
  2801. --enable-rtsp
  2802. --enable-nonblocking
  2803. --enable-largefile
  2804. --enable-maintainer-mode
  2805. --disable-sspi
  2806. --without-krb4
  2807. --without-librtmp
  2808. --without-spnego";
  2809. if use ssl; then
  2810. if use gnutls; then
  2811. myconf+=" --without-ssl --with-gnutls --without-nss";
  2812. myconf+=" --with-ca-bundle=${EPREFIX}/etc/ssl/certs/ca-certificates.crt";
  2813. else
  2814. if use nss; then
  2815. myconf+=" --without-ssl --without-gnutls --with-nss";
  2816. myconf+=" --with-ca-bundle=${EPREFIX}/etc/ssl/certs/ca-certificates.crt";
  2817. else
  2818. myconf+=" --without-gnutls --without-nss --with-ssl";
  2819. myconf+=" --without-ca-bundle --with-ca-path=${EPREFIX}/etc/ssl/certs";
  2820. fi;
  2821. fi;
  2822. else
  2823. myconf+=" --without-gnutls --without-nss --without-ssl";
  2824. fi;
  2825. econf ${myconf}
  2826. }
  2827. src_install ()
  2828. {
  2829. default;
  2830. find "${ED}" -name '*.la' -exec rm -f {} +;
  2831. rm -rf "${ED}"/etc/;
  2832. insinto /usr/share/aclocal;
  2833. doins docs/libcurl/libcurl.m4;
  2834. dodoc CHANGES README;
  2835. dodoc docs/FEATURES docs/INTERNALS;
  2836. dodoc docs/MANUAL docs/FAQ docs/BUGS docs/CONTRIBUTE
  2837. }
  2838. src_prepare ()
  2839. {
  2840. epatch "${FILESDIR}"/${PN}-7.20.0-strip-ldflags.patch "${FILESDIR}"/${PN}-7.19.7-test241.patch "${FILESDIR}"/${PN}-7.18.2-prefix.patch "${FILESDIR}"/${PN}-respect-cflags-3.patch "${FILESDIR}"/${P}-examples-fix-headers.patch;
  2841. eprefixify curl-config.in;
  2842. eautoreconf
  2843. }
  2844. src_test ()
  2845. {
  2846. _eapi0_src_test "$@"
  2847. }
  2848. src_unpack ()
  2849. {
  2850. _eapi0_src_unpack "$@"
  2851. }
  2852. strip-linguas ()
  2853. {
  2854. local ls newls nols;
  2855. if [[ $1 == "-i" ]] || [[ $1 == "-u" ]]; then
  2856. local op=$1;
  2857. shift;
  2858. ls=$(find "$1" -name '*.po' -exec basename {} .po ';');
  2859. shift;
  2860. local d f;
  2861. for d in "$@";
  2862. do
  2863. if [[ ${op} == "-u" ]]; then
  2864. newls=${ls};
  2865. else
  2866. newls="";
  2867. fi;
  2868. for f in $(find "$d" -name '*.po' -exec basename {} .po ';');
  2869. do
  2870. if [[ ${op} == "-i" ]]; then
  2871. has ${f} ${ls} && newls="${newls} ${f}";
  2872. else
  2873. has ${f} ${ls} || newls="${newls} ${f}";
  2874. fi;
  2875. done;
  2876. ls=${newls};
  2877. done;
  2878. else
  2879. ls="$@";
  2880. fi;
  2881. nols="";
  2882. newls="";
  2883. for f in ${LINGUAS};
  2884. do
  2885. if has ${f} ${ls}; then
  2886. newls="${newls} ${f}";
  2887. else
  2888. nols="${nols} ${f}";
  2889. fi;
  2890. done;
  2891. [[ -n ${nols} ]] && ewarn "Sorry, but ${PN} does not support the LINGUAS:" ${nols};
  2892. export LINGUAS=${newls:1}
  2893. }
  2894. tc-arch ()
  2895. {
  2896. tc-ninja_magic_to_arch portage "$@"
  2897. }
  2898. tc-arch-kernel ()
  2899. {
  2900. tc-ninja_magic_to_arch kern "$@"
  2901. }
  2902. tc-endian ()
  2903. {
  2904. local host=$1;
  2905. [[ -z ${host} ]] && host=${CTARGET:-${CHOST}};
  2906. host=${host%%-*};
  2907. case ${host} in
  2908. alpha*)
  2909. echo big
  2910. ;;
  2911. arm*b*)
  2912. echo big
  2913. ;;
  2914. arm*)
  2915. echo little
  2916. ;;
  2917. cris*)
  2918. echo little
  2919. ;;
  2920. hppa*)
  2921. echo big
  2922. ;;
  2923. i?86*)
  2924. echo little
  2925. ;;
  2926. ia64*)
  2927. echo little
  2928. ;;
  2929. m68*)
  2930. echo big
  2931. ;;
  2932. mips*l*)
  2933. echo little
  2934. ;;
  2935. mips*)
  2936. echo big
  2937. ;;
  2938. powerpc*)
  2939. echo big
  2940. ;;
  2941. s390*)
  2942. echo big
  2943. ;;
  2944. sh*b*)
  2945. echo big
  2946. ;;
  2947. sh*)
  2948. echo little
  2949. ;;
  2950. sparc*)
  2951. echo big
  2952. ;;
  2953. x86_64*)
  2954. echo little
  2955. ;;
  2956. *)
  2957. echo wtf
  2958. ;;
  2959. esac
  2960. }
  2961. tc-export ()
  2962. {
  2963. local var;
  2964. for var in "$@";
  2965. do
  2966. [[ $(type -t tc-get${var}) != "function" ]] && die "tc-export: invalid export variable '${var}'";
  2967. eval tc-get${var} > /dev/null;
  2968. done
  2969. }
  2970. tc-getAR ()
  2971. {
  2972. tc-getPROG AR ar "$@"
  2973. }
  2974. tc-getAS ()
  2975. {
  2976. tc-getPROG AS as "$@"
  2977. }
  2978. tc-getBUILD_CC ()
  2979. {
  2980. local v;
  2981. for v in CC_FOR_BUILD BUILD_CC HOSTCC;
  2982. do
  2983. if [[ -n ${!v} ]]; then
  2984. export BUILD_CC=${!v};
  2985. echo "${!v}";
  2986. return 0;
  2987. fi;
  2988. done;
  2989. local search=;
  2990. if [[ -n ${CBUILD} ]]; then
  2991. search=$(type -p ${CBUILD}-gcc);
  2992. search=${search##*/};
  2993. fi;
  2994. search=${search:-gcc};
  2995. export BUILD_CC=${search};
  2996. echo "${search}"
  2997. }
  2998. tc-getCC ()
  2999. {
  3000. tc-getPROG CC gcc "$@"
  3001. }
  3002. tc-getCPP ()
  3003. {
  3004. tc-getPROG CPP cpp "$@"
  3005. }
  3006. tc-getCXX ()
  3007. {
  3008. tc-getPROG CXX g++ "$@"
  3009. }
  3010. tc-getDLLWRAP ()
  3011. {
  3012. tc-getPROG DLLWRAP dllwrap "$@"
  3013. }
  3014. tc-getF77 ()
  3015. {
  3016. tc-getPROG F77 gfortran "$@"
  3017. }
  3018. tc-getFC ()
  3019. {
  3020. tc-getPROG FC gfortran "$@"
  3021. }
  3022. tc-getGCJ ()
  3023. {
  3024. tc-getPROG GCJ gcj "$@"
  3025. }
  3026. tc-getLD ()
  3027. {
  3028. tc-getPROG LD ld "$@"
  3029. }
  3030. tc-getNM ()
  3031. {
  3032. tc-getPROG NM nm "$@"
  3033. }
  3034. tc-getOBJCOPY ()
  3035. {
  3036. tc-getPROG OBJCOPY objcopy "$@"
  3037. }
  3038. tc-getPKG_CONFIG ()
  3039. {
  3040. tc-getPROG PKG_CONFIG pkg-config "$@"
  3041. }
  3042. tc-getPROG ()
  3043. {
  3044. local var=$1;
  3045. local prog=$2;
  3046. if [[ -n ${!var} ]]; then
  3047. echo "${!var}";
  3048. return 0;
  3049. fi;
  3050. local search=;
  3051. [[ -n $3 ]] && search=$(type -p "$3-${prog}");
  3052. [[ -z ${search} && -n ${CHOST} ]] && search=$(type -p "${CHOST}-${prog}");
  3053. [[ -n ${search} ]] && prog=${search##*/};
  3054. export ${var}=${prog};
  3055. echo "${!var}"
  3056. }
  3057. tc-getRANLIB ()
  3058. {
  3059. tc-getPROG RANLIB ranlib "$@"
  3060. }
  3061. tc-getRC ()
  3062. {
  3063. tc-getPROG RC windres "$@"
  3064. }
  3065. tc-getSTRIP ()
  3066. {
  3067. tc-getPROG STRIP strip "$@"
  3068. }
  3069. tc-has-openmp ()
  3070. {
  3071. local base="${T}/test-tc-openmp";
  3072. cat > "${base}.c" <<-EOF
  3073. #include <omp.h>
  3074. int main() {
  3075. int nthreads, tid, ret = 0;
  3076. #pragma omp parallel private(nthreads, tid)
  3077. {
  3078. tid = omp_get_thread_num();
  3079. nthreads = omp_get_num_threads(); ret += tid + nthreads;
  3080. }
  3081. return ret;
  3082. }
  3083. EOF
  3084.  
  3085. $(tc-getCC "$@") -fopenmp "${base}.c" -o "${base}" &>/dev/null;
  3086. local ret=$?;
  3087. rm -f "${base}"*;
  3088. return ${ret}
  3089. }
  3090. tc-has-tls ()
  3091. {
  3092. local base="${T}/test-tc-tls";
  3093. cat > "${base}.c" <<-EOF
  3094. int foo(int *i) {
  3095. static __thread int j = 0;
  3096. return *i ? j : *i;
  3097. }
  3098. EOF
  3099.  
  3100. local flags;
  3101. case $1 in
  3102. -s)
  3103. flags="-S"
  3104. ;;
  3105. -c)
  3106. flags="-c"
  3107. ;;
  3108. -l)
  3109.  
  3110. ;;
  3111. -*)
  3112. die "Usage: tc-has-tls [-c|-l] [toolchain prefix]"
  3113. ;;
  3114. esac;
  3115. : ${flags:=-fPIC -shared -Wl,-z,defs};
  3116. [[ $1 == -* ]] && shift;
  3117. $(tc-getCC "$@") ${flags} "${base}.c" -o "${base}" &>/dev/null;
  3118. local ret=$?;
  3119. rm -f "${base}"*;
  3120. return ${ret}
  3121. }
  3122. tc-is-cross-compiler ()
  3123. {
  3124. return $([[ ${CBUILD:-${CHOST}} != ${CHOST} ]])
  3125. }
  3126. tc-is-hardfloat ()
  3127. {
  3128. [[ ${CTARGET//_/-} == *-hardfloat-* ]] && echo "yes" || echo "no"
  3129. }
  3130. tc-is-softfloat ()
  3131. {
  3132. case ${CTARGET} in
  3133. bfin* | h8300*)
  3134. echo "only"
  3135. ;;
  3136. *)
  3137. [[ ${CTARGET//_/-} == *-softfloat-* ]] && echo "yes" || echo "no"
  3138. ;;
  3139. esac
  3140. }
  3141. tc-is-static-only ()
  3142. {
  3143. local host=${CTARGET:-${CHOST}};
  3144. return $([[ ${host} == *-mint* ]])
  3145. }
  3146. tc-ninja_magic_to_arch ()
  3147. {
  3148. function ninj ()
  3149. {
  3150. [[ ${type} == "kern" ]] && echo $1 || echo $2
  3151. };
  3152. local type=$1;
  3153. local host=$2;
  3154. [[ -z ${host} ]] && host=${CTARGET:-${CHOST}};
  3155. case ${host} in
  3156. alpha*)
  3157. echo alpha
  3158. ;;
  3159. arm*)
  3160. echo arm
  3161. ;;
  3162. avr*)
  3163. ninj avr32 avr
  3164. ;;
  3165. bfin*)
  3166. ninj blackfin bfin
  3167. ;;
  3168. cris*)
  3169. echo cris
  3170. ;;
  3171. hppa*)
  3172. ninj parisc hppa
  3173. ;;
  3174. i?86*)
  3175. if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -lt $(KV_to_int 2.6.24) || ${host} == *freebsd* ]]; then
  3176. echo i386;
  3177. else
  3178. echo x86;
  3179. fi
  3180. ;;
  3181. ia64*)
  3182. echo ia64
  3183. ;;
  3184. m68*)
  3185. echo m68k
  3186. ;;
  3187. mips*)
  3188. echo mips
  3189. ;;
  3190. nios2*)
  3191. echo nios2
  3192. ;;
  3193. nios*)
  3194. echo nios
  3195. ;;
  3196. powerpc*)
  3197. if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -ge $(KV_to_int 2.6.16) ]]; then
  3198. echo powerpc;
  3199. else
  3200. if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -eq $(KV_to_int 2.6.15) ]]; then
  3201. if [[ ${host} == powerpc64* ]] || [[ ${PROFILE_ARCH} == "ppc64" ]]; then
  3202. echo powerpc;
  3203. else
  3204. echo ppc;
  3205. fi;
  3206. else
  3207. if [[ ${host} == powerpc64* ]]; then
  3208. echo ppc64;
  3209. else
  3210. if [[ ${PROFILE_ARCH} == "ppc64" ]]; then
  3211. ninj ppc64 ppc;
  3212. else
  3213. echo ppc;
  3214. fi;
  3215. fi;
  3216. fi;
  3217. fi
  3218. ;;
  3219. s390*)
  3220. echo s390
  3221. ;;
  3222. sh64*)
  3223. ninj sh64 sh
  3224. ;;
  3225. sh*)
  3226. echo sh
  3227. ;;
  3228. sparc64*)
  3229. ninj sparc64 sparc
  3230. ;;
  3231. sparc*)
  3232. [[ ${PROFILE_ARCH} == "sparc64" ]] && ninj sparc64 sparc || echo sparc
  3233. ;;
  3234. vax*)
  3235. echo vax
  3236. ;;
  3237. x86_64*freebsd*)
  3238. echo amd64
  3239. ;;
  3240. x86_64*)
  3241. if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -ge $(KV_to_int 2.6.24) ]]; then
  3242. echo x86;
  3243. else
  3244. ninj x86_64 amd64;
  3245. fi
  3246. ;;
  3247. *)
  3248. echo unknown
  3249. ;;
  3250. esac
  3251. }
  3252. treecopy ()
  3253. {
  3254. dest=${!#};
  3255. files_count=$#;
  3256. while (( $# > 1 )); do
  3257. dirstruct=$(dirname "$1");
  3258. mkdir -p "${dest}/${dirstruct}";
  3259. cp -pPR "$1" "${dest}/${dirstruct}";
  3260. shift;
  3261. done
  3262. }
  3263. uclibctoolize ()
  3264. {
  3265. die "Use elibtoolize"
  3266. }
  3267. unpack_makeself ()
  3268. {
  3269. local src_input=${1:-${A}};
  3270. local src=$(find_unpackable_file "${src_input}");
  3271. local skip=$2;
  3272. local exe=$3;
  3273. [[ -z ${src} ]] && die "Could not locate source for '${src_input}'";
  3274. local shrtsrc=$(basename "${src}");
  3275. echo ">>> Unpacking ${shrtsrc} to ${PWD}";
  3276. if [[ -z ${skip} ]]; then
  3277. local ver=$(grep -m1 -a '#.*Makeself' "${src}" | awk '{print $NF}');
  3278. local skip=0;
  3279. exe=tail;
  3280. case ${ver} in
  3281. 1.5.* | 1.6.0-nv)
  3282. skip=$(grep -a ^skip= "${src}" | cut -d= -f2)
  3283. ;;
  3284. 2.0 | 2.0.1)
  3285. skip=$(grep -a ^' 'tail "${src}" | awk '{print $2}' | cut -b2-)
  3286. ;;
  3287. 2.1.1)
  3288. skip=$(grep -a ^offset= "${src}" | awk '{print $2}' | cut -b2-);
  3289. (( skip++ ))
  3290. ;;
  3291. 2.1.2)
  3292. skip=$(grep -a ^offset= "${src}" | awk '{print $3}' | head -n 1);
  3293. (( skip++ ))
  3294. ;;
  3295. 2.1.3)
  3296. skip=`grep -a ^offset= "${src}" | awk '{print $3}'`;
  3297. (( skip++ ))
  3298. ;;
  3299. 2.1.4 | 2.1.5)
  3300. skip=$(grep -a offset=.*head.*wc "${src}" | awk '{print $3}' | head -n 1);
  3301. skip=$(head -n ${skip} "${src}" | wc -c);
  3302. exe="dd"
  3303. ;;
  3304. *)
  3305. eerror "I'm sorry, but I was unable to support the Makeself file.";
  3306. eerror "The version I detected was '${ver}'.";
  3307. eerror "Please file a bug about the file ${shrtsrc} at";
  3308. eerror "http://bugs.gentoo.org/ so that support can be added.";
  3309. die "makeself version '${ver}' not supported"
  3310. ;;
  3311. esac;
  3312. debug-print "Detected Makeself version ${ver} ... using ${skip} as offset";
  3313. fi;
  3314. case ${exe} in
  3315. tail)
  3316. exe="tail -n +${skip} '${src}'"
  3317. ;;
  3318. dd)
  3319. exe="dd ibs=${skip} skip=1 if='${src}'"
  3320. ;;
  3321. *)
  3322. die "makeself cant handle exe '${exe}'"
  3323. ;;
  3324. esac;
  3325. local filetype tmpfile=$(emktemp);
  3326. eval ${exe} 2> /dev/null | head -c 512 > "${tmpfile}";
  3327. filetype=$(file -b "${tmpfile}") || die;
  3328. case ${filetype} in
  3329. *tar\ archive*)
  3330. eval ${exe} | tar --no-same-owner -xf -
  3331. ;;
  3332. bzip2*)
  3333. eval ${exe} | bzip2 -dc | tar --no-same-owner -xf -
  3334. ;;
  3335. gzip*)
  3336. eval ${exe} | tar --no-same-owner -xzf -
  3337. ;;
  3338. compress*)
  3339. eval ${exe} | gunzip | tar --no-same-owner -xf -
  3340. ;;
  3341. *)
  3342. eerror "Unknown filetype \"${filetype}\" ?";
  3343. false
  3344. ;;
  3345. esac;
  3346. assert "failure unpacking (${filetype}) makeself ${shrtsrc} ('${ver}' +${skip})"
  3347. }
  3348. unpack_pdv ()
  3349. {
  3350. local src=$(find_unpackable_file "$1");
  3351. local sizeoff_t=$2;
  3352. [[ -z ${src} ]] && die "Could not locate source for '$1'";
  3353. [[ -z ${sizeoff_t} ]] && die "No idea what off_t size was used for this pdv :(";
  3354. local shrtsrc=$(basename "${src}");
  3355. echo ">>> Unpacking ${shrtsrc} to ${PWD}";
  3356. local metaskip=$(tail -c ${sizeoff_t} "${src}" | hexdump -e \"%i\");
  3357. local tailskip=$(tail -c $((${sizeoff_t}*2)) "${src}" | head -c ${sizeoff_t} | hexdump -e \"%i\");
  3358. local metafile=$(emktemp);
  3359. tail -c +$((${metaskip}+1)) "${src}" > "${metafile}";
  3360. local datafile=$(tail -c +$((${metaskip}+1)) "${src}" | strings | head -n 1);
  3361. datafile=$(basename "${datafile}");
  3362. local tmpfile=$(emktemp);
  3363. tail -c +$((${tailskip}+1)) ${src} 2> /dev/null | head -c 512 > ${tmpfile};
  3364. local iscompressed=$(file -b "${tmpfile}");
  3365. if [[ ${iscompressed:0:8} == "compress" ]]; then
  3366. iscompressed=1;
  3367. mv ${tmpfile}{,.Z};
  3368. gunzip ${tmpfile};
  3369. else
  3370. iscompressed=0;
  3371. fi;
  3372. local istar=$(file -b "${tmpfile}");
  3373. if [[ ${istar:0:9} == "POSIX tar" ]]; then
  3374. istar=1;
  3375. else
  3376. istar=0;
  3377. fi;
  3378. if [ ${iscompressed} -eq 1 ]; then
  3379. if [ ${istar} -eq 1 ]; then
  3380. tail -c +$((${tailskip}+1)) ${src} 2> /dev/null | head -c $((${metaskip}-${tailskip})) | tar -xzf -;
  3381. else
  3382. tail -c +$((${tailskip}+1)) ${src} 2> /dev/null | head -c $((${metaskip}-${tailskip})) | gzip -dc > ${datafile};
  3383. fi;
  3384. else
  3385. if [ ${istar} -eq 1 ]; then
  3386. tail -c +$((${tailskip}+1)) ${src} 2> /dev/null | head -c $((${metaskip}-${tailskip})) | tar --no-same-owner -xf -;
  3387. else
  3388. tail -c +$((${tailskip}+1)) ${src} 2> /dev/null | head -c $((${metaskip}-${tailskip})) > ${datafile};
  3389. fi;
  3390. fi;
  3391. true
  3392. }
  3393. validate_desktop_entries ()
  3394. {
  3395. if [[ -x /usr/bin/desktop-file-validate ]]; then
  3396. einfo "Checking desktop entry validity";
  3397. local directories="";
  3398. for d in /usr/share/applications $@;
  3399. do
  3400. [[ -d ${D}${d} ]] && directories="${directories} ${D}${d}";
  3401. done;
  3402. if [[ -n ${directories} ]]; then
  3403. for FILE in $(find ${directories} -name "*\.desktop" -not -path '*.hidden*' | sort -u 2>/dev/null);
  3404. do
  3405. local temp=$(desktop-file-validate ${FILE} | grep -v "warning:" | sed -e "s|error: ||" -e "s|${FILE}:|--|g" );
  3406. [[ -n $temp ]] && elog ${temp/--/${FILE/${D}/}:};
  3407. done;
  3408. fi;
  3409. echo "";
  3410. else
  3411. einfo "Passing desktop entry validity check. Install dev-util/desktop-file-utils, if you want to help to improve Gentoo.";
  3412. fi
  3413. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement