net-wireless/hostapd: use #!/sbin/openrc-run instead of #!/sbin/runscript
[gentoo.git] / eclass / go-mono.eclass
1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 # @ECLASS: go-mono.eclass
6 # @MAINTAINER:
7 # dotnet@gentoo.org
8 # @BLURB: Common functionality for go-mono.org apps
9 # @DESCRIPTION:
10 # Common functionality needed by all go-mono.org apps.
11
12 inherit base versionator mono
13
14 PRE_URI="http://mono.ximian.com/monobuild/preview/sources"
15
16 GIT_PN="${PN/mono-debugger/debugger}"
17
18 ESVN_STORE_DIR="${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}/svn-src/mono"
19
20 GO_MONO_SUB_BRANCH=${GO_MONO_SUB_BRANCH}
21
22 if [[ "${PV%_rc*}" != "${PV}" ]]
23 then
24         GO_MONO_P="${P%_rc*}"
25         SRC_URI="${PRE_URI}/${PN}/${GO_MONO_P}.tar.bz2 -> ${P}.tar.bz2"
26         S="${WORKDIR}/${GO_MONO_P}"
27 elif [[ "${PV%_pre*}" != "${PV}" ]]
28 then
29         GO_MONO_P="${P%_pre*}"
30         SRC_URI="${PRE_URI}/${PN}/${GO_MONO_P}.tar.bz2 -> ${P}.tar.bz2"
31         S="${WORKDIR}/${GO_MONO_P}"
32 elif [[ "${PV}" == "9999" ]]
33 then
34         GO_MONO_P=${P}
35         EGIT_REPO_URI="http://github.com/mono/${GIT_PN}.git"
36         SRC_URI=""
37         inherit autotools git
38 elif [[ "${PV%.9999}" != "${PV}" ]]
39 then
40         GO_MONO_P=${P}
41         EGIT_REPO_URI="http://github.com/mono/${GIT_PN}.git"
42         EGIT_BRANCH="mono-$(get_version_component_range 1)-$(get_version_component_range 2)${GO_MONO_SUB_BRANCH}"
43         SRC_URI=""
44         inherit autotools git
45 else
46         GO_MONO_P=${P}
47         SRC_URI="http://download.mono-project.com/sources/${PN}/${P}.tar.bz2"
48 fi
49
50
51 NO_MONO_DEPEND=( "dev-lang/mono" "dev-dotnet/libgdiplus" "dev-dotnet/gluezilla" )
52
53 if [[ "$(get_version_component_range 3)" != "9999" ]]
54 then
55         GO_MONO_REL_PV="$(get_version_component_range 1-2)"
56
57 else
58         GO_MONO_REL_PV="${PV}"
59 fi
60
61 if ! has "${CATEGORY}/${PN}" "${NO_MONO_DEPEND[@]}"
62 then
63         RDEPEND=">=dev-lang/mono-${GO_MONO_REL_PV}"
64         DEPEND="${RDEPEND}"
65 fi
66
67 DEPEND="${DEPEND}
68         virtual/pkgconfig"
69
70 # @FUNCTION: go-mono_src_unpack
71 # @DESCRIPTION:
72 # Runs default()
73 go-mono_src_unpack() {
74         if [[ "${PV%.9999}" != "${PV}" ||  "${PV}" == "9999" ]]
75         then
76                 default
77                 git_src_unpack
78         else
79                 default
80         fi
81 }
82
83 # @FUNCTION: go-mono_src_prepare
84 # @DESCRIPTION:
85 # Runs autopatch from base.eclass, if PATCHES is set.
86 go-mono_src_prepare() {
87         if [[ "${PV%.9999}" != "${PV}" ||  "${PV}" == "9999" ]]
88         then
89                 base_src_prepare
90                 [[ "$EAUTOBOOTSTRAP" != "no" ]] && eautoreconf
91         else
92                 base_src_prepare
93         fi
94 }
95
96 # @FUNCTION: go-mono_src_configure
97 # @DESCRIPTION:
98 # Runs econf, disabling static libraries and dependency-tracking.
99 go-mono_src_configure() {
100         econf   --disable-dependency-tracking           \
101                 --disable-static                        \
102                 "$@"
103 }
104
105 # @FUNCTION: go-mono_src_compile
106 # @DESCRIPTION:
107 # Runs emake.
108 go-mono_src_compile() {
109         emake "$@" || die "emake failed"
110 }
111
112 # @ECLASS-VARIABLE: DOCS
113 # @DESCRIPTION:
114 # Insert path of docs you want installed. If more than one,
115 # consider using an array.
116
117 # @FUNCTION: go-mono_src_install
118 # @DESCRIPTION:
119 # Rune emake, installs common doc files, if DOCS is
120 # set, installs those. Gets rid of .la files.
121 go-mono_src_install () {
122         emake -j1 DESTDIR="${D}" "$@" install || die "install failed"
123         mono_multilib_comply
124         local   commondoc=( AUTHORS ChangeLog README TODO )
125         for docfile in "${commondoc[@]}"
126         do
127                 [[ -e "${docfile}" ]] && dodoc "${docfile}"
128         done
129         if [[ "${DOCS[@]}" ]]
130         then
131                 dodoc "${DOCS[@]}" || die "dodoc DOCS failed"
132         fi
133         find "${D}" -name '*.la' -exec rm -rf '{}' '+' || die "la removal failed"
134 }
135
136 EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install