summaryrefslogtreecommitdiff
path: root/app-shells/pwsh/pwsh-7.4.0.ebuild
blob: ff259b5a16d21132294ec56dc1cf450dde92556d (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
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# NOTICE: Before packaging we have to run "ResGen" and "GetDependencies".
# See: https://git.alpinelinux.org/aports/tree/community/powershell/APKBUILD
# The repackaged tarball contains the C# code generated by that subproject.

EAPI=8

DOTNET_PKG_COMPAT=8.0
NUGET_APIS=(
	"https://api.nuget.org/v3-flatcontainer"
	"https://www.powershellgallery.com/api/v2"
)
NUGETS="
dotnetanalyzers.documentationanalyzers.unstable@1.0.0.59
dotnetanalyzers.documentationanalyzers@1.0.0-beta.59
jetbrains.annotations@2021.2.0
json.more.net@1.9.0
jsonpointer.net@3.0.3
jsonschema.net@5.2.6
markdig.signed@0.33.0
microsoft.applicationinsights@2.21.0
microsoft.bcl.asyncinterfaces@5.0.0
microsoft.codeanalysis.analyzers@3.3.4
microsoft.codeanalysis.common@4.8.0-2.final
microsoft.codeanalysis.csharp@4.8.0-2.final
microsoft.codecoverage@17.7.2
microsoft.extensions.objectpool@5.0.10
microsoft.management.infrastructure.runtime.unix@3.0.0
microsoft.management.infrastructure.runtime.win@3.0.0
microsoft.management.infrastructure@3.0.0
microsoft.net.test.sdk@17.7.2
microsoft.netcore.platforms@1.1.0
microsoft.netcore.platforms@3.1.0
microsoft.netcore.targets@1.1.0
microsoft.powershell.markdownrender@7.2.1
microsoft.powershell.native@7.4.0
microsoft.security.extensions@1.2.0
microsoft.testplatform.objectmodel@17.7.2
microsoft.testplatform.testhost@17.7.2
microsoft.win32.primitives@4.3.0
microsoft.win32.registry.accesscontrol@8.0.0
microsoft.win32.registry@4.7.0
microsoft.win32.systemevents@8.0.0
microsoft.windows.compatibility@8.0.0
netstandard.library@1.6.1
netstandard.library@2.0.3
newtonsoft.json@13.0.1
newtonsoft.json@13.0.3
nuget.frameworks@6.5.0
runtime.any.system.collections@4.3.0
runtime.any.system.diagnostics.tools@4.3.0
runtime.any.system.diagnostics.tracing@4.3.0
runtime.any.system.globalization.calendars@4.3.0
runtime.any.system.globalization@4.3.0
runtime.any.system.io@4.3.0
runtime.any.system.reflection.extensions@4.3.0
runtime.any.system.reflection.primitives@4.3.0
runtime.any.system.reflection@4.3.0
runtime.any.system.resources.resourcemanager@4.3.0
runtime.any.system.runtime.handles@4.3.0
runtime.any.system.runtime.interopservices@4.3.0
runtime.any.system.runtime@4.3.0
runtime.any.system.text.encoding.extensions@4.3.0
runtime.any.system.text.encoding@4.3.0
runtime.any.system.threading.tasks@4.3.0
runtime.any.system.threading.timer@4.3.0
runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl@4.3.0
runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl@4.3.0
runtime.fedora.24-x64.runtime.native.system.security.cryptography.openssl@4.3.0
runtime.linux-arm.runtime.native.system.io.ports@8.0.0
runtime.linux-arm64.runtime.native.system.io.ports@8.0.0
runtime.linux-x64.runtime.native.system.io.ports@8.0.0
runtime.native.system.data.sqlclient.sni@4.7.0
runtime.native.system.io.compression@4.3.0
runtime.native.system.io.ports@8.0.0
runtime.native.system.net.http@4.3.0
runtime.native.system.security.cryptography.apple@4.3.0
runtime.native.system.security.cryptography.openssl@4.3.0
runtime.native.system@4.3.0
runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl@4.3.0
runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl@4.3.0
runtime.osx-arm64.runtime.native.system.io.ports@8.0.0
runtime.osx-x64.runtime.native.system.io.ports@8.0.0
runtime.osx.10.10-x64.runtime.native.system.security.cryptography.apple@4.3.0
runtime.osx.10.10-x64.runtime.native.system.security.cryptography.openssl@4.3.0
runtime.rhel.7-x64.runtime.native.system.security.cryptography.openssl@4.3.0
runtime.ubuntu.14.04-x64.runtime.native.system.security.cryptography.openssl@4.3.0
runtime.ubuntu.16.04-x64.runtime.native.system.security.cryptography.openssl@4.3.0
runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl@4.3.0
runtime.unix.microsoft.win32.primitives@4.3.0
runtime.unix.system.console@4.3.0
runtime.unix.system.diagnostics.debug@4.3.0
runtime.unix.system.io.filesystem@4.3.0
runtime.unix.system.net.primitives@4.3.0
runtime.unix.system.net.sockets@4.3.0
runtime.unix.system.private.uri@4.3.0
runtime.unix.system.runtime.extensions@4.3.0
runtime.win-arm64.runtime.native.system.data.sqlclient.sni@4.4.0
runtime.win-x64.runtime.native.system.data.sqlclient.sni@4.4.0
runtime.win-x86.runtime.native.system.data.sqlclient.sni@4.4.0
stylecop.analyzers.unstable@1.2.0.507
stylecop.analyzers@1.2.0-beta.507
system.appcontext@4.3.0
system.buffers@4.3.0
system.buffers@4.5.1
system.codedom@8.0.0
system.collections.concurrent@4.3.0
system.collections.immutable@7.0.0
system.collections@4.3.0
system.componentmodel.composition.registration@8.0.0
system.componentmodel.composition@8.0.0
system.configuration.configurationmanager@8.0.0
system.console@4.3.0
system.data.odbc@8.0.0
system.data.oledb@8.0.0
system.data.sqlclient@4.8.5
system.diagnostics.debug@4.3.0
system.diagnostics.diagnosticsource@4.3.0
system.diagnostics.diagnosticsource@8.0.0
system.diagnostics.eventlog@8.0.0
system.diagnostics.performancecounter@8.0.0
system.diagnostics.tools@4.3.0
system.diagnostics.tracing@4.3.0
system.directoryservices.accountmanagement@8.0.0
system.directoryservices.protocols@8.0.0
system.directoryservices@8.0.0
system.drawing.common@8.0.0
system.formats.asn1@6.0.0
system.formats.asn1@8.0.0
system.globalization.calendars@4.3.0
system.globalization.extensions@4.3.0
system.globalization@4.3.0
system.io.compression.zipfile@4.3.0
system.io.compression@4.3.0
system.io.filesystem.primitives@4.3.0
system.io.filesystem@4.3.0
system.io.packaging@8.0.0
system.io.ports@8.0.0
system.io@4.3.0
system.linq.expressions@4.3.0
system.linq@4.3.0
system.management@8.0.0
system.memory@4.5.5
system.net.http.winhttphandler@8.0.0
system.net.http@4.3.0
system.net.nameresolution@4.3.0
system.net.primitives@4.3.0
system.net.sockets@4.3.0
system.numerics.vectors@4.4.0
system.numerics.vectors@4.5.0
system.objectmodel@4.3.0
system.private.servicemodel@4.10.3
system.private.uri@4.3.0
system.reflection.context@8.0.0
system.reflection.dispatchproxy@4.7.1
system.reflection.emit.ilgeneration@4.3.0
system.reflection.emit.lightweight@4.3.0
system.reflection.emit@4.3.0
system.reflection.extensions@4.3.0
system.reflection.metadata@1.6.0
system.reflection.metadata@7.0.0
system.reflection.primitives@4.3.0
system.reflection.typeextensions@4.3.0
system.reflection@4.3.0
system.resources.resourcemanager@4.3.0
system.runtime.caching@8.0.0
system.runtime.compilerservices.unsafe@6.0.0
system.runtime.extensions@4.3.0
system.runtime.handles@4.3.0
system.runtime.interopservices.runtimeinformation@4.3.0
system.runtime.interopservices@4.3.0
system.runtime.numerics@4.3.0
system.runtime@4.3.0
system.security.accesscontrol@4.7.0
system.security.accesscontrol@6.0.0
system.security.accesscontrol@6.0.2-mauipre.1.22102.15
system.security.claims@4.3.0
system.security.cryptography.algorithms@4.3.0
system.security.cryptography.cng@4.3.0
system.security.cryptography.csp@4.3.0
system.security.cryptography.encoding@4.3.0
system.security.cryptography.openssl@4.3.0
system.security.cryptography.pkcs@6.0.1
system.security.cryptography.pkcs@8.0.0
system.security.cryptography.primitives@4.3.0
system.security.cryptography.protecteddata@8.0.0
system.security.cryptography.x509certificates@4.3.0
system.security.cryptography.xml@6.0.1
system.security.cryptography.xml@8.0.0
system.security.permissions@8.0.0
system.security.principal.windows@4.3.0
system.security.principal.windows@4.7.0
system.security.principal.windows@5.0.0
system.security.principal@4.3.0
system.servicemodel.duplex@4.10.3
system.servicemodel.http@4.10.3
system.servicemodel.nettcp@4.10.3
system.servicemodel.primitives@4.10.3
system.servicemodel.security@4.10.3
system.servicemodel.syndication@8.0.0
system.serviceprocess.servicecontroller@8.0.0
system.speech@8.0.0
system.text.encoding.codepages@7.0.0
system.text.encoding.codepages@8.0.0
system.text.encoding.extensions@4.3.0
system.text.encoding@4.3.0
system.text.encodings.web@6.0.0
system.text.encodings.web@8.0.0
system.text.json@6.0.2
system.text.regularexpressions@4.3.0
system.threading.accesscontrol@8.0.0
system.threading.tasks.extensions@4.3.0
system.threading.tasks.extensions@4.5.4
system.threading.tasks@4.3.0
system.threading.threadpool@4.3.0
system.threading.timer@4.3.0
system.threading@4.3.0
system.web.services.description@4.10.0
system.windows.extensions@8.0.0
system.xml.readerwriter@4.3.0
system.xml.xdocument@4.3.0
validation@2.4.18
xunit.abstractions@2.0.2
xunit.abstractions@2.0.3
xunit.analyzers@1.2.0
xunit.assert@2.5.0
xunit.core@2.5.0
xunit.extensibility.core@2.4.0
xunit.extensibility.core@2.5.0
xunit.extensibility.execution@2.4.0
xunit.extensibility.execution@2.5.0
xunit.runner.visualstudio@2.5.3
xunit.skippablefact@1.4.13
xunit@2.5.0
xunitxml.testlogger@3.1.17
"

# Additional PowerShell Gallery modules.
NUGETS+="
microsoft.powershell.archive@1.2.5
microsoft.powershell.psresourceget@1.0.1
packagemanagement@1.4.8.1
powershellget@2.2.5
psreadline@2.3.4
threadjob@2.0.3
"

inherit check-reqs desktop dotnet-pkg xdg

DESCRIPTION="Cross-platform automation and configuration tool"
HOMEPAGE="https://microsoft.com/powershell/
	https://github.com/PowerShell/PowerShell/"
SRC_URI="
	https://dev.gentoo.org/~xgqt/distfiles/repackaged/${P}.tar.xz
	${NUGET_URIS}
"

LICENSE="MIT"
SLOT="$(ver_cut 1-2)"
KEYWORDS="~amd64 ~arm ~arm64"
RESTRICT="test"                        # TODO: "LibraryImports.g.cs" not found.

RDEPEND="
	>=dev-libs/libpsl-native-7.4.0:=
	sys-libs/pam:0/0
	|| (
		dev-libs/openssl-compat:1.0.0
		=dev-libs/openssl-1.0*:0/0
	)
"
DEPEND="
	${RDEPEND}
"
IDEPEND="
	app-eselect/eselect-pwsh
"

CHECKREQS_DISK_BUILD="2G"
DOTNET_PKG_PROJECTS=(
	src/powershell-unix/powershell-unix.csproj
	src/Modules/PSGalleryModules.csproj
)
PATCHES=(
	"${FILESDIR}/pwsh-7.3.3-disable-update-check.patch"
	"${FILESDIR}/pwsh-7.4.0-disable-telemetry.patch"
)

DOCS=( CHANGELOG CHANGELOG.md CODE_OF_CONDUCT.md README.md docs )

pkg_setup() {
	check-reqs_pkg_setup
	dotnet-pkg_pkg_setup

	if [[ "${MERGE_TYPE}" != binary ]] ; then
		if use elibc_glibc ; then
			local locales="$(locale -a)"

			if has en_US.utf8 ${locales} ; then
				LC_ALL=en_US.utf8
			elif has en_US.UTF-8 ${locales} ; then
				LC_ALL=en_US.UTF-8
			else
				eerror "The locale en_US.utf8 or en_US.UTF-8 is not available."
				eerror "Please generate en_US.UTF-8 before building ${CATEGORY}/${P}."

				die "Could not switch to the en_US.UTF-8 locale."
			fi
		else
			LC_ALL=en_US.UTF-8
		fi

		export LC_ALL
		einfo "Successfully switched to the ${LC_ALL} locale."
	fi
}

src_prepare() {
	dotnet-pkg_src_prepare

	# This is guarded by "RegexGitVersion" in "PowerShell.Common.props".
	local fake_describe="v${PV}-0-g0"
	sed -i "s|git describe --abbrev=60 --long|echo ${fake_describe}|" \
		PowerShell.Common.props || die

	echo "v${PV}" > powershell.version || die
}

src_compile() {
	einfo 'Copying DLL files for the missing "ref" directory'
	edotnet fsi "${FILESDIR}/pwsh-7.3.3-copy-ref.fsx" "${WORKDIR}/${P}_ref"

	dotnet-pkg_src_compile
}

src_install() {
	local dest_root="/usr/share/${PN}-${SLOT}"

	# Install additional PowerShell Gallery modules.
	local -a psg_modules=(
		Microsoft.PowerShell.Archive
		Microsoft.PowerShell.PSResourceGet
		PSReadLine
		PackageManagement
		PowerShellGet
		ThreadJob
	)
	local psg_module
	for psg_module in "${psg_modules[@]}" ; do
		insinto "${dest_root}/Modules/${psg_module}"
		doins -r "${NUGET_PACKAGES}/${psg_module,,}"/*
	done

	dotnet-pkg-base_append_launchervar \
		'PSModulePath="${PSModulePath}:${EPREFIX}/usr/share/GentooPowerShell/Modules:"'
	dotnet-pkg-base_install "${dest_root}"
	dotnet-pkg-base_dolauncher "${dest_root}/pwsh" "pwsh-${SLOT}"

	insinto "${dest_root}/ref"
	doins "${WORKDIR}/${P}_ref"/*

	# Remove "libpsl-native.so" provided by "microsoft.powershell.native".
	rm "${ED}/${dest_root}/libpsl-native.so" || die
	dosym -r "/usr/$(get_libdir)/libpsl-native.so" "${dest_root}/libpsl-native.so"

	newicon assets/ps_black_128.svg "powershell-${SLOT}.svg"
	make_desktop_entry "pwsh-${SLOT} -l" "PowerShell ${SLOT}" \
		"powershell-${SLOT}" "ConsoleOnly;System;" "Terminal=true"

	einstalldocs
}

pkg_postinst() {
	xdg_pkg_postinst

	eselect pwsh update ifunset
}

pkg_postrm() {
	xdg_pkg_postrm

	eselect pwsh update ifunset
}