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