aboutsummaryrefslogtreecommitdiff
blob: 5a29b73e1102a531df94a325b80fa5307fdeecd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

# @ECLASS: gac.eclass
# @MAINTAINER: cynede@gentoo.org
# @BLURB: functions for registring in gac
# @DESCRIPTION:
# binary packages should be able to be registred in gac too

case ${EAPI:-0} in
	0|1|2|3|4|5) die "this eclass doesn't support EAPI ${EAPI:-0}" ;;
	6) ;;
esac

IUSE+=" +gac pkg-config"

DEPEND+=" dev-lang/mono"
RDEPEND+=" dev-lang/mono"

# SRC_URI+=" https://github.com/mono/mono/raw/main/mcs/class/mono.snk"
# I was unable to setup it this ^^ way

# @FUNCTION: egacinstall
# @DESCRIPTION:  install package to GAC
egacinstall() {
	use !prefix && has "${EAPI:-0}" 0 1 2 && ED="${D}"
	if use gac; then
		if use pkg-config; then
			gacutil -i "${1}" \
				-root "${ED}"/usr/lib \
				-package ${2:-${GACPN:-${PN}}} \
				|| die "installing ${1} into the Global Assembly Cache failed"
		else
			gacutil -i "${1}" \
				-root "${ED}"/usr/lib \
				|| die "installing ${1} into the Global Assembly Cache failed"
		fi
	fi
}

# @FUNCTION: egacadd
# @DESCRIPTION:  install package to GAC
egacadd() {
	if use gac; then
		GACROOT="${PREFIX}/usr/lib"
		GACDIR="/usr/$(get_libdir)/mono/gac"
		einfo gacutil -i "${PREFIX}/${1}" -root "${GACROOT}"
		gacutil -i "${PREFIX}/${1}" \
			-root ${GACROOT} \
			|| die "installing ${1} into the Global Assembly Cache failed"
	fi
}

# @FUNCTION: egacdel
# @DESCRIPTION:  remove package from GAC
egacdel() {
	if use gac; then
		GACROOT="${PREFIX}/usr/lib"
		GACDIR="/usr/$(get_libdir)/mono/gac"
		einfo gacutil -u "${1}" -root "${GACROOT}"
		gacutil -u "${1}" \
			-root ${GACROOT} \
		# don't die
	fi
}