-
Notifications
You must be signed in to change notification settings - Fork 0
/
use_dotnet.htm
169 lines (153 loc) · 7.11 KB
/
use_dotnet.htm
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8" />
<title>USE_DOTNET</title>
</head>
<body><a href="https://github.com/ArsenShnurkov/gentoo-mono-handbook"><img alt="Fork me on GitHub" id="forkme" src="images/forkme.png" align="right" width="100" /></a>
<table><tr><td valign="top">
<h1>USE_DOTNET and USE_MSBUILD</h1>
</td><td valign="top">
<a href="index.htm">Gentoo Mono Handbook</a>
<br />
</td></tr></table>
<h2>USE_DOTNET</h2>
Actually, USE_DOTNET name is confusing.
<br />
The better name should be "THIS_EBUILD_SUPPORT_AND_IS_INSTALLED_FOR_USE_WITH_THE_FOLLOWING_DOTNET_RUNTIMES"
<br />
or "IUSE_DOTNET", to indicate that it should be placed inside ebuild.
<!--
<br />
<br />
The line
<br />
if [[ ${USE_DOTNET} ]]; then REQUIRED_USE="|| (${USE_DOTNET})"; fi;;
<br />
should be something like
<br />
if [[ ${USE_DOTNET} ]]; then REQUIRED_ENV_VAR="|| (${DOTNET})"; fi;;
-->
<br />
<br />
Ebuild can declare which version it understands:
USE_DOTNET="net40 net20"
<br />
<a href="https://github.com/gentoo/dotnet/blob/17bedb24b457189974cfada68814c0313c66e5bd/dev-dotnet/fake/fake-3.23.0.ebuild#L6">https://github.com/gentoo/dotnet/blob/master/dev-dotnet/fake/fake-3.23.0.ebuild#L6</a>
<br />
here are the sample values:
<a href="https://github.com/gentoo/dotnet/blob/master/eclass/dotnet.eclass#L40">https://github.com/gentoo/dotnet/blob/master/eclass/dotnet.eclass#L40</a>
<br />
<br />
USE_DOTNET is concatenated to IUSE variable with "inherit dotnet" line
<br />
that's why it is not necessary to mention net45 in IUSE for the second time.
<br />
<br />
The implementation is here:
<br />
<a href="https://github.com/gentoo/dotnet/blob/7b316f212e670192162257791d231c7a050ed489/eclass/dotnet.eclass#L32-L40">https://github.com/gentoo/dotnet/blob/master/eclass/dotnet.eclass#L28-L36</a>
<br />
<br />
DOTNET_TARGETS variable (specified in /etc/portage/make.conf) just adds a "+" sign before some IUSE-flags.
<h2>DOTNET_TARGETS</h2>
<a href="https://github.com/gentoo/dotnet/blob/master/readme.md">https://github.com/gentoo/dotnet/blob/master/readme.md</a>
<br />
instructs the user to specify necessary platforms in /etc/portage/make.conf
<br />
«add the following USE flags if relevant.
<br />
add DOTNET_TARGETS="net45 net40" to make.conf»
<hr />
<strong><em>The great mystery is why it was not possible to
<br />
just use conventional USE-flags in /etc/portage/make.conf and IUSE in the text of ebuilds.</em></strong>
<h2>USE_EXPAND variables</h2>
Gentoo have a mechanism for creating additional kinds of USE-flags.
<br />
see <a href="https://devmanual.gentoo.org/general-concepts/use-flags/index.html#use_expand-and-arch-use-flags">USE_EXPAND and ARCH USE Flags</a>
<br />
<dl>
<dt>USE_EXPAND</dt>
<dd>Defines a list of variables which are to be treated incrementally and whose contents are to be expanded
into the USE variable as passed to ebuilds.</dd>
<dt>USE_EXPAND_UNPREFIXED</dt>
<dd>Similar to USE_EXPAND, but no prefix is used. If the repository contains any package using an EAPI supporting</dd>
</dl>
«USE_EXPAND values may be forced or masked by using expand_name_value.»
<br />
<a href="https://projects.gentoo.org/pms/7/pms.html">https://projects.gentoo.org/pms/7/pms.html</a>
<br />
<br />
The USE_EXPAND list is set in profiles/base/make.defaults
<br />
(or USE_EXPAND can be modified in /etc/portage/make.conf)
<br />
<br />
«all USE_EXPAND variables are always exported with filtered USE flags inside, even if none of those flags are declared in IUSE.
This is the behavior required for EAPI 5+ by the PMS.»
«why should USE_EXPAND have any effect on a package which doesn't declare the corresponding flags in IUSE?»
<br />
<a href="https://archives.gentoo.org/gentoo-portage-dev/message/1c5724058e4f484f3a76ba787d15cdc3">https://archives.gentoo.org/gentoo-portage-dev/message/1c5724058e4f484f3a76ba787d15cdc3</a>
<br />
<br />
We see that the necessary steps are:
<br />
1) add USE-flags into IUSE (probably in expanded form)
<br />
2) add name of variable into USE_EXPAND
<br />
<br />
USE_EXPAND_VALUES_${v} - the (undocumented) profile variable
<br />
USE_EXPAND_UNPREFIXED (this list must contain at least ARCH)
<br />
<br />
Each variable, mentioned in USE_EXPAND is displayed separately during USE-flags processing.
<br />
(example is needed here)
<!-- this is commented out, because it's not true as of 2020-10-26
<br />
<br />
If the user has DOTNET_TARGETS="net40 net20" in make.conf, for example,
<br />
then USE="dotnet_net40 dotnet_net20" will automatically be set by Portage.
-->
<h2>An idea to convert USE_DOTNET into expand variable</h2>
<strong>Table: Example Variable Settings</strong></p><div class="table-contents"><table class="table" summary="Example Variable Settings" border="1"><colgroup><col class="source" align="left"><col class="destination" align="left"></colgroup><thead><tr><th align="left">Variable</th><th align="left">Value</th></tr></thead><tbody><tr><td align="left">IUSE_IMPLICIT</td><td align="left">prefix selinux</td></tr><tr><td align="left">USE_EXPAND</td><td align="left">ELIBC KERNEL USERLAND</td></tr><tr><td align="left">USE_EXPAND_UNPREFIXED</td><td align="left">ARCH</td></tr><tr><td align="left">USE_EXPAND_IMPLICIT</td><td align="left">ARCH ELIBC KERNEL USERLAND</td></tr><tr><td align="left">USE_EXPAND_VALUES_ARCH</td><td align="left">amd64 ppc ppc64 x86 x86-fbsd x86-solaris</td></tr><tr><td align="left">USE_EXPAND_VALUES_ELIBC</td><td align="left">FreeBSD glibc</td></tr><tr><td align="left">USE_EXPAND_VALUES_KERNEL</td><td align="left">FreeBSD linux SunOS</td></tr><tr><td align="left">USE_EXPAND_VALUES_USERLAND</td><td align="left">BSD GNU</td></tr></tbody></table></div></div>
<br />
<br />
<font style="color:red"><strong><em>USE_DOTNET looks like UNPREFIXED and IMPLICIT</em></strong></font>
<br />
I propose to make it conventional USE-expand variable (or remove at all !!!, because .Net 2.0-3.5 is deprecated and
there is only one slot for .Net 4.x in Gentoo)
<h2>Profile IUSE injection (profile-iuse-inject)</h2>
profile defined IUSE injection, since EAPI-5
<br />
<a href="https://projects.gentoo.org/pms/7/pms.html#x1-56001r4">https://projects.gentoo.org/pms/7/pms.html#x1-56001r4</a>
<h2>USE_MSBUILD</h2>
There are at least 2 build systems - msbuild and xbuild.
<br />
They have their own USE-flags "msbuild" and "xbuild".
<br />
But msbuild have a slotted install, that's why one more variable (USE_MSBUILD) was added and used.
<br />
Some msbuild tasks can be used with each of build systems.
<br />
<br />
<br />
<br />
FRAMEWORK variable is set in pkg_setup, so it should be available in src_prepare
<a href="https://devmanual.gentoo.org/ebuild-writing/functions/">https://devmanual.gentoo.org/ebuild-writing/functions/</a>
this allow to apply patches based on FRAMEWORK variable value
<br />
<br />
DOTNET_TARGETS variable?
<pre>
* ERROR: app-editors/mypad-1.0.3_p201606130::shnurise failed (setup phase):
* USE Flag 'net45' not in IUSE for app-editors/mypad-1.0.3_p201606130
</pre>
MSBUILD: error MSBUILD0004: Too many project files specified
</body>
</html>