aboutsummaryrefslogtreecommitdiff
blob: b0a09364d61f13508c430c0a1ddfc333231d03e6 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=6
KEYWORDS="~amd64"
RESTRICT+=" mirror"

SLOT="0"

USE_DOTNET="net45 net35"
IUSE="+${USE_DOTNET} +gac +nupkg +pkg-config +debug +developer"

inherit xbuild gac mono-pkg-config nupkg

HOMEPAGE="https://cecil.pe/"
DESCRIPTION="System.Reflection alternative to generate and inspect .NET executables/libraries"
# https://github.com/jbevain/cecil/wiki/License
# https://github.com/jbevain/cecil/blob/master/LICENSE.txt
LICENSE="MIT"

COMMON_DEPEND=">=dev-lang/mono-4.0.2.5
"

DEPEND="${COMMON_DEPEND}
	virtual/pkgconfig
"

RDEPEND="${COMMON_DEPEND}
"

NAME="cecil"
REPO_OWNER="jbevain"
REPOSITORY="https://github.com/${REPO_OWNER}/${NAME}"
LICENSE_URL="${REPOSITORY}/blob/master/LICENSE"
ICONMETA="https://www.iconeasy.com/icon/ico/Movie%20%26%20TV/Looney%20Tunes/Cecil%20Turtle%20no%20shell.ico"
ICON_URL="file://${FILESDIR}/cecil_turtle_no_shell.png"

EGIT_BRANCH="master"
EGIT_COMMIT="045b0f9729905dd456d46e33436a2dadc9e2a52d"
EGIT_SHORT_COMMIT=${EGIT_COMMIT:0:7}
SRC_URI="https://api.github.com/repos/${REPO_OWNER}/${NAME}/tarball/${EGIT_COMMIT} -> ${PF}.tar.gz"
RESTRICT+=" test"
# jbevain-cecil-045b0f9
S="${WORKDIR}/${REPO_OWNER}-${NAME}-${EGIT_SHORT_COMMIT}"

METAFILETOBUILD="./Mono.Cecil.sln"

GAC_DLL_NAMES="Mono.Cecil Mono.Cecil.Mdb Mono.Cecil.Pdb Mono.Cecil.Rocks"

NUSPEC_ID="Mono.Cecil"
NUSPEC_FILE="${S}/Mono.Cecil.nuspec"
NUSPEC_VERSION="0.10.0.2016111002"

src_prepare() {
	enuget_restore "${METAFILETOBUILD}"

	eapply "${FILESDIR}/nuspec-${PV}.patch"
	eapply "${FILESDIR}/sln-${PV}.patch"
	#eapply "${FILESDIR}/csproj-${PV}.patch"

	eapply_user
}

src_configure() {
	:;
}

src_compile() {
	if [[ -z ${TOOLS_VERSION} ]]; then
		TOOLS_VERSION=4.0
	fi
	PARAMETERS=" /tv:${TOOLS_VERSION}"
	if use developer; then
		SARGS=/p:DebugSymbols=True
	else
		SARGS=/p:DebugSymbols=False
	fi
	PARAMETERS+=" ${SARGS}"
	PARAMETERS+=" /p:SignAssembly=true"
	PARAMETERS+=" /p:AssemblyOriginatorKeyFile=${S}/mono.snk"
	PARAMETERS+=" /v:detailed"

	for x in ${USE_DOTNET} ; do
		FW_UPPER=${x:3:1}
		FW_LOWER=${x:4:1}
		P_FW_VERSION="/p:TargetFrameworkVersion=v${FW_UPPER}.${FW_LOWER}"
		local CONFIGURATION=""
		if use debug; then
			CONFIGURATION=net_${FW_UPPER}_${FW_LOWER}_Debug
		else
			CONFIGURATION=net_${FW_UPPER}_${FW_LOWER}_Debug
		fi
		einfo "Building configuration '${CONFIGURATION}'"
		P_CONFIGURATION="/p:Configuration=${CONFIGURATION}"
		exbuild_raw ${PARAMETERS} ${P_FW_VERSION} ${P_CONFIGURATION} "${METAFILETOBUILD}"

		# https://github.com/gentoo/dotnet/issues/305
		sn -R ${S}/bin/${CONFIGURATION}/Mono.Cecil.dll mono.snk
		sn -R ${S}/bin/${CONFIGURATION}/Mono.Cecil.Mdb.dll mono.snk
		sn -R ${S}/bin/${CONFIGURATION}/Mono.Cecil.Pdb.dll mono.snk

		sn -R ${S}/bin/${CONFIGURATION}/Mono.Cecil.Rocks.dll mono.snk
		sn -R ${S}/bin/${CONFIGURATION}/Mono.Cecil.Rocks.Mdb.dll mono.snk
		sn -R ${S}/bin/${CONFIGURATION}/Mono.Cecil.Rocks.Pdb.dll mono.snk
	done

	# run nuget_pack
	enuspec -Prop "id=${NUSPEC_ID};version=${NUSPEC_VERSION}" ${NUSPEC_FILE}
}

src_install() {
	if use debug; then
		DIR=Debug
	else
		DIR=Release
	fi

	for dll_name in ${GAC_DLL_NAMES} ; do
		for x in ${USE_DOTNET} ; do
			FW_UPPER=${x:3:1}
			FW_LOWER=${x:4:1}
			egacinstall "bin/net_${FW_UPPER}_${FW_LOWER}_${DIR}/${dll_name}.dll"
		done
	done
	einstall_pc_file "${PN}" "0.10" ${GAC_DLL_NAMES}

	enupkg "${WORKDIR}/${NUSPEC_ID}.${NUSPEC_VERSION}.nupkg"
}