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