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