kde-frameworks/kimageformats: x86 stable wrt bug #724346
[gentoo.git] / eclass / mono.eclass
1 # Copyright 1999-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 # @ECLASS: mono.eclass
5 # @MAINTAINER:
6 # dotnet@gentoo.org
7 # @BLURB: common settings and functions for mono and dotnet related packages
8 # @DESCRIPTION:
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
12 # of dotnet packages.
13
14 inherit multilib
15
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}"
19
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)
23 export LC_ALL=C
24
25 # Monodevelop-using applications need this to be set or they will try to create config
26 # files in the user's ~ dir.
27
28 export XDG_CONFIG_HOME="${T}"
29
30 # Fix bug 83020:
31 # "Access Violations Arise When Emerging Mono-Related Packages with MONO_AOT_CACHE"
32
33 unset MONO_AOT_CACHE
34
35 egacinstall() {
36         use !prefix && has "${EAPI:-0}" 0 1 2 && ED="${D}"
37         gacutil -i "${1}" \
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"
42 }
43
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" ]]
48         then
49                 if ! [[ -d "${ED}"/usr/"$(get_libdir)" ]]
50                 then
51                         mkdir "${ED}"/usr/"$(get_libdir)" || die "Couldn't mkdir ${ED}/usr/$(get_libdir)"
52                 fi
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
56                 do
57
58                         if [[ -d "${dir}" && "$(find "${dir}" -name '*.pc')" != "" ]]
59                         then
60                                 pushd "${dir}" &> /dev/null
61                                 sed  -i -r -e 's:/(lib)([^a-zA-Z0-9]|$):/'"$(get_libdir)"'\2:g' \
62                                         *.pc \
63                                         || die "Sedding some sense into pkgconfig files failed."
64                                 popd "${dir}" &> /dev/null
65                         fi
66                 done
67                 if [[ -d "${ED}/usr/bin" ]]
68                 then
69                         for exe in "${ED}/usr/bin"/*
70                         do
71                                 if [[ "$(file "${exe}")" == *"shell script text"* ]]
72                                 then
73                                         sed -r -i -e ":/lib(/|$): s:/lib(/|$):/$(get_libdir)\1:" \
74                                                 "${exe}" || die "Sedding some sense into ${exe} failed"
75                                 fi
76                         done
77                 fi
78
79         fi
80 }