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

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

USE_DOTNET="net45"
IUSE="net45 +gac +nupkg +pkg-config debug developer"

inherit versionator gac nupkg

HOMEPAGE="https://github.com/kpi-ua/X.PagedList/"
DESCRIPTION="Nugget for easily paging through any IEnumerable/IQueryable in Asp.Net MVC"
LICENSE="MIT"
SLOT="0"

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

DEPEND="${COMMON_DEPEND}
	virtual/pkgconfig
	>=dev-util/mono-packaging-tools-1.4.2.2
"

RDEPEND="${COMMON_DEPEND}
"

NAME="X.PagedList"
REPOSITORY="https://github.com/ArsenShnurkov/${NAME}"
EGIT_BRANCH="master"
LICENSE_URL="${REPOSITORY}/blob/${EGIT_BRANCH}/LICENSE"
ICONMETA="https://uxrepo.com/static/icon-sets/iconic/svg/list.svg"
ICON_URL="https://github.com/ArsenShnurkov/X.PagedList/blob/switching-from-pcl/misc/list.svg"

EGIT_COMMIT="c0521a4099c65efd3e964ea57129d5a61261f784"
SRC_URI="${REPOSITORY}/archive/${EGIT_BRANCH}/${EGIT_COMMIT}.tar.gz -> ${PF}.tar.gz"
#S="${WORKDIR}/${NAME}-${EGIT_COMMIT}"
S="${WORKDIR}/${NAME}-${EGIT_BRANCH}"

METAFILETOBUILD=./X.PagedList.sln
#OUTPUT_DIR=

# there is an original file exists: ./src/X.PagedList.Mvc/PagedList.Mvc.nuspec
NUSPEC_FILE_NAME=X.PagedList.nuspec
NUSPEC_VERSION="${PV}"

# rm -rf /var/tmp/portage/dev-dotnet/X-PagedList-*
# emerge =X-PagedList-5.3.0.8
# leafpad /var/tmp/portage/dev-dotnet/X-PagedList-5.3.0.8/temp/build.log &

src_prepare() {
	einfo "patching project files"

	find "${S}" -iname "AssemblyInfo.cs" -exec sed -i '/Assembly.*Version/d' {} \; || die
	mpt-csproj --inject-import='$(MSBuildToolsPath)\MSBuild.Community.Tasks.Targets' "${S}" || die
	mpt-csproj --inject-versioning=BuildVersion "${S}" || die

	einfo "preparing nuspec"
	cp "${FILESDIR}/${NUSPEC_FILE_NAME}" "${S}/${NUSPEC_FILE_NAME}" || die
	patch_nuspec_file "${S}/${NUSPEC_FILE_NAME}"

	eapply_user
}

src_configure() {
	:;
}

SNK_FILENAME="${S}/X.PagedList/PublicPrivateKeyFile.snk"

src_compile() {
	exbuild_strong /p:BuildVersion=${PV} "./X.PagedList/X.PagedList.csproj"
	exbuild_strong /p:BuildVersion=${PV} "./X.PagedList.Mvc/X.PagedList.Mvc.csproj"

	# run nuget_pack
	einfo "setting .nupkg version to ${NUSPEC_VERSION}"
	enuspec -Prop "version=${NUSPEC_VERSION}" "${S}/${NUSPEC_FILE_NAME}"
}

src_install() {
	enupkg "${WORKDIR}/${NAME}.${NUSPEC_VERSION}.nupkg"

	egacinstall "X.PagedList/bin/${DIR}/X.PagedList.dll"
	egacinstall "X.PagedList.Mvc/bin/${DIR}/X.PagedList.Mvc.dll"

	einstall_pc_file "${PN}" "${PV}" "X.PagedList.Mvc"
}

patch_nuspec_file()
{
	if use nupkg; then
		if use debug; then
			DIR="Debug"
			FILES_STRING=`sed 's/[\/&]/\\\\&/g' <<-EOF || die "escaping replacement string characters"
			  <files> <!-- https://docs.nuget.org/create/nuspec-reference -->
			    <file src="X.PagedList/bin/${DIR}/X.PagedList.dll" target="lib/net45" />
			    <file src="X.PagedList.Mvc/bin/${DIR}/X.PagedList.Mvc.dll" target="lib/net45" />
			    <file src="X.PagedList/bin/${DIR}/X.PagedList.dll.mdb" target="lib/net45" />
			    <file src="X.PagedList.Mvc/bin/${DIR}/X.PagedList.Mvc.dll.mdb" target="lib/net45" />
			  </files>
			EOF
			`
		else
			DIR="Release"
			FILES_STRING=`sed 's/[\/&]/\\\\&/g' <<-EOF || die "escaping replacement string characters"
			  <files> <!-- https://docs.nuget.org/create/nuspec-reference -->
			    <file src="X.PagedList/bin/${DIR}/X.PagedList.dll" target="lib\net45" />
			    <file src="X.PagedList.Mvc/bin/${DIR}/X.PagedList.Mvc.dll" target="lib\net45" />
			  </files>
			EOF
			`
		fi

		sed -i 's/<\/package>/'"${FILES_STRING//$'\n'/\\$'\n'}"'\n&/g' $1 || die "escaping line endings"
	fi
}