Advertisement
Guest User

Untitled

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