mono.eclass 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # Copyright 1999-2011 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # @ECLASS: mono.eclass
  4. # @MAINTAINER:
  5. # dotnet@gentoo.org
  6. # @BLURB: common settings and functions for mono and dotnet related packages
  7. # @DESCRIPTION:
  8. # The mono eclass contains common environment settings that are useful for
  9. # dotnet packages. Currently, it provides no functions, just exports
  10. # MONO_SHARED_DIR and sets LC_ALL in order to prevent errors during compilation
  11. # of dotnet packages.
  12. inherit multilib
  13. # >=mono-0.92 versions using mcs -pkg:foo-sharp require shared memory, so we set the
  14. # shared dir to ${T} so that ${T}/.wapi can be used during the install process.
  15. export MONO_SHARED_DIR="${T}"
  16. # Building mono, nant and many other dotnet packages is known to fail if LC_ALL
  17. # variable is not set to C. To prevent this all mono related packages will be
  18. # build with LC_ALL=C (see bugs #146424, #149817)
  19. export LC_ALL=C
  20. # Monodevelop-using applications need this to be set or they will try to create config
  21. # files in the user's ~ dir.
  22. export XDG_CONFIG_HOME="${T}"
  23. # Fix bug 83020:
  24. # "Access Violations Arise When Emerging Mono-Related Packages with MONO_AOT_CACHE"
  25. unset MONO_AOT_CACHE
  26. egacinstall() {
  27. use !prefix && has "${EAPI:-0}" 0 1 2 && ED="${D}"
  28. gacutil -i "${1}" \
  29. -root "${ED}"/usr/$(get_libdir) \
  30. -gacdir /usr/$(get_libdir) \
  31. -package ${2:-${GACPN:-${PN}}} \
  32. || die "installing ${1} into the Global Assembly Cache failed"
  33. }
  34. mono_multilib_comply() {
  35. use !prefix && has "${EAPI:-0}" 0 1 2 && ED="${D}"
  36. local dir finddirs=() mv_command=${mv_command:-mv}
  37. if [[ -d "${ED}/usr/lib" && "$(get_libdir)" != "lib" ]]
  38. then
  39. if ! [[ -d "${ED}"/usr/"$(get_libdir)" ]]
  40. then
  41. mkdir "${ED}"/usr/"$(get_libdir)" || die "Couldn't mkdir ${ED}/usr/$(get_libdir)"
  42. fi
  43. ${mv_command} "${ED}"/usr/lib/* "${ED}"/usr/"$(get_libdir)"/ || die "Moving files into correct libdir failed"
  44. rm -rf "${ED}"/usr/lib
  45. for dir in "${ED}"/usr/"$(get_libdir)"/pkgconfig "${ED}"/usr/share/pkgconfig
  46. do
  47. if [[ -d "${dir}" && "$(find "${dir}" -name '*.pc')" != "" ]]
  48. then
  49. pushd "${dir}" &> /dev/null
  50. sed -i -r -e 's:/(lib)([^a-zA-Z0-9]|$):/'"$(get_libdir)"'\2:g' \
  51. *.pc \
  52. || die "Sedding some sense into pkgconfig files failed."
  53. popd "${dir}" &> /dev/null
  54. fi
  55. done
  56. if [[ -d "${ED}/usr/bin" ]]
  57. then
  58. for exe in "${ED}/usr/bin"/*
  59. do
  60. if [[ "$(file "${exe}")" == *"shell script text"* ]]
  61. then
  62. sed -r -i -e ":/lib(/|$): s:/lib(/|$):/$(get_libdir)\1:" \
  63. "${exe}" || die "Sedding some sense into ${exe} failed"
  64. fi
  65. done
  66. fi
  67. fi
  68. }