aboutsummaryrefslogtreecommitdiff
blob: 41efd1f8a89787d545141f2114e173883c6689e9 (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
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI="6"
KEYWORDS="~amd64 ~ppc ~x86"
RESTRICT="mirror"
SLOT="0"

USE_DOTNET="net45"
IUSE="+${USE_DOTNET}"

inherit dotnet msbuild eutils

DESCRIPTION="An Open Source reimplementation of Windows PowerShell"

LICENSE="BSD || ( GPL-2+ )"   # LICENSE syntax is defined in https://wiki.gentoo.org/wiki/GLEP:23

PROJECTNAME="Pash"
HOMEPAGE="https://github.com/Pash-Project/${PROJECTNAME}"
EGIT_COMMIT="8d6a48f5ed70d64f9b49e6849b3ee35b887dc254"
SRC_URI="${HOMEPAGE}/archive/${EGIT_COMMIT}.tar.gz -> ${P}-${PR}.tar.gz"
S="${WORKDIR}/${PROJECTNAME}-${EGIT_COMMIT}"

CDEPEND="|| ( >=dev-lang/mono-5.4.0.167 <dev-lang/mono-9999 )
	dev-dotnet/irony-daxnet
	"

RDEPEND="${CDEPEND}
	"
DEPEND="${CDEPEND}
	"

PROJECT1_PATH=Source/System.Management
PROJECT1_NAME=System.Management
PROJECT1_OUT=System.Management.Automation

PROJECT2_PATH=Source/Microsoft.PowerShell.Security
PROJECT2_NAME=Microsoft.PowerShell.Security
PROJECT2_OUT=Microsoft.PowerShell.Security

PROJECT3_PATH=Source/Microsoft.PowerShell.Commands.Utility
PROJECT3_NAME=Microsoft.PowerShell.Commands.Utility
PROJECT3_OUT=Microsoft.PowerShell.Commands.Utility

PROJECT4_PATH=Source/Microsoft.PowerShell.Commands.Management
PROJECT4_NAME=Microsoft.Commands.Management
PROJECT4_OUT=Microsoft.PowerShell.Commands.Management

PROJECT5_PATH=Source/PashConsole
PROJECT5_NAME=PashConsole
PROJECT5_OUT=Pash

src_prepare() {
	sed -i "s/new Version(1, 0, 0, 0)/System.Reflection.Assembly.GetExecutingAssembly().GetName().Version/" Source/System.Management/Pash/Implementation/LocalHost.cs || die
	sed -i "/Version/d" "${S}/${PROJECT1_PATH}/Properties/AssemblyInfo.cs" || die
	sed -i "/Version/d" "${S}/${PROJECT2_PATH}/Properties/AssemblyInfo.cs" || die
	sed -i "/Version/d" "${S}/${PROJECT3_PATH}/Properties/AssemblyInfo.cs" || die
	sed -i "/Version/d" "${S}/${PROJECT4_PATH}/Properties/AssemblyInfo.cs" || die
	sed -i "/Version/d" "${S}/${PROJECT5_PATH}/Properties/AssemblyInfo.cs" || die
	sed "s/\$(OutputType)/Library/; s/\$(AssemblyName)/${PROJECT1_OUT}/" "${FILESDIR}/template.csproj" > "${S}/${PROJECT1_PATH}/${PROJECT1_NAME}.csproj" || die
	sed -i 's#^.*-- Reference --.*$#&\n<Reference Include="Irony" />#' "${S}/${PROJECT1_PATH}/${PROJECT1_NAME}.csproj" || die
	sed -i 's#^.*-- Reference --.*$#&\n<Reference Include="Microsoft.CSharp" />#' "${S}/${PROJECT1_PATH}/${PROJECT1_NAME}.csproj" || die
	sed -i 's#^.*-- Reference --.*$#&\n<Reference Include="System.Data" />#' "${S}/${PROJECT1_PATH}/${PROJECT1_NAME}.csproj" || die
	sed -i 's#^.*-- Reference --.*$#&\n<Reference Include="System.Xml" />#' "${S}/${PROJECT1_PATH}/${PROJECT1_NAME}.csproj" || die
	sed -i 's#^.*-- Reference --.*$#&\n<Reference Include="System.Configuration" />#' "${S}/${PROJECT1_PATH}/${PROJECT1_NAME}.csproj" || die
	sed "s/\$(OutputType)/Library/; s/\$(AssemblyName)/${PROJECT2_OUT}/" "${FILESDIR}/template.csproj" > "${S}/${PROJECT2_PATH}/${PROJECT2_NAME}.csproj" || die
	sed -i "s#^.*-- ProjectReference --.*\$#&\\n<ProjectReference Include=\"../../${PROJECT1_PATH}/${PROJECT1_NAME}.csproj\" />#" "${S}/${PROJECT2_PATH}/${PROJECT2_NAME}.csproj" || die
	sed "s/\$(OutputType)/Library/; s/\$(AssemblyName)/${PROJECT3_OUT}/" "${FILESDIR}/template.csproj" > "${S}/${PROJECT3_PATH}/${PROJECT3_NAME}.csproj" || die
	sed -i 's#^.*-- Reference --.*$#&\n<Reference Include="System.Data" />#' "${S}/${PROJECT3_PATH}/${PROJECT3_NAME}.csproj" || die
	sed -i 's#^.*-- Reference --.*$#&\n<Reference Include="System.Xml" />#' "${S}/${PROJECT3_PATH}/${PROJECT3_NAME}.csproj" || die
	sed -i 's#^.*-- Reference --.*$#&\n<Reference Include="System.Net" />#' "${S}/${PROJECT3_PATH}/${PROJECT3_NAME}.csproj" || die
	sed -i "s#^.*-- ProjectReference --.*\$#&\\n<ProjectReference Include=\"../../${PROJECT1_PATH}/${PROJECT1_NAME}.csproj\" />#" "${S}/${PROJECT3_PATH}/${PROJECT3_NAME}.csproj" || die
	sed "s/\$(OutputType)/Library/; s/\$(AssemblyName)/${PROJECT4_OUT}/" "${FILESDIR}/template.csproj" > "${S}/${PROJECT4_PATH}/${PROJECT4_NAME}.csproj" || die
	sed -i 's#^.*-- Reference --.*$#&\n<Reference Include="System.Data" />#' "${S}/${PROJECT4_PATH}/${PROJECT4_NAME}.csproj" || die
	sed -i 's#^.*-- Reference --.*$#&\n<Reference Include="System.Xml" />#' "${S}/${PROJECT4_PATH}/${PROJECT4_NAME}.csproj" || die
	sed -i 's#^.*-- Reference --.*$#&\n<Reference Include="System.ServiceProcess" />#' "${S}/${PROJECT4_PATH}/${PROJECT4_NAME}.csproj" || die
	sed -i "s#^.*-- ProjectReference --.*\$#&\\n<ProjectReference Include=\"../../${PROJECT1_PATH}/${PROJECT1_NAME}.csproj\" />#" "${S}/${PROJECT4_PATH}/${PROJECT4_NAME}.csproj" || die
	sed "s/\$(OutputType)/Exe/; s/\$(AssemblyName)/${PROJECT5_OUT}/" "${FILESDIR}/template.csproj" > "${S}/${PROJECT5_PATH}/${PROJECT5_NAME}.csproj" || die
	sed -i "s#^.*-- ProjectReference --.*\$#&\\n<ProjectReference Include=\"../../${PROJECT1_PATH}/${PROJECT1_NAME}.csproj\" />#" "${S}/${PROJECT5_PATH}/${PROJECT5_NAME}.csproj" || die
	sed -i "s#^.*-- ProjectReference --.*\$#&\\n<ProjectReference Include=\"../../${PROJECT2_PATH}/${PROJECT2_NAME}.csproj\" />#" "${S}/${PROJECT5_PATH}/${PROJECT5_NAME}.csproj" || die
	sed -i "s#^.*-- ProjectReference --.*\$#&\\n<ProjectReference Include=\"../../${PROJECT3_PATH}/${PROJECT3_NAME}.csproj\" />#" "${S}/${PROJECT5_PATH}/${PROJECT5_NAME}.csproj" || die
	sed -i "s#^.*-- ProjectReference --.*\$#&\\n<ProjectReference Include=\"../../${PROJECT4_PATH}/${PROJECT4_NAME}.csproj\" />#" "${S}/${PROJECT5_PATH}/${PROJECT5_NAME}.csproj" || die
	eapply_user
}

src_compile() {
	emsbuild "/p:VersionNumber=1.0.2016.606" "${S}/${PROJECT5_PATH}/${PROJECT5_NAME}.csproj"
}

src_install() {
	if [ "${SLOT}"="0" ] ;
	then
		SLOTTEDDIR="/usr/share/${PN}"
	else
		SLOTTEDDIR="/usr/share/${PN}-${SLOT}"
	fi
	insinto "${SLOTTEDDIR}"

	if use debug; then
		DIR="Debug"
	else
		DIR="Release"
	fi
	doins Source/PashConsole/bin/${DIR}/Pash.exe
	doins Source/PashConsole/bin/${DIR}/*.dll
	if use developer; then
		doins Source/PashConsole/bin/${DIR}/*.pdb
	fi
	if use debug; then
		make_wrapper --debug pash "mono ${SLOTTEDDIR}/Pash.exe"
	else
		make_wrapper pash "mono ${SLOTTEDDIR}/Pash.exe"
	fi
}