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

EAPI=6

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"
KEYWORDS="~amd64 ~x86"
IUSE="net45 +gac +nupkg +pkg-config debug developer"
USE_DOTNET="net45"

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

RDEPEND="${COMMON_DEPEND}
"

DEPEND="${COMMON_DEPEND}
	virtual/pkgconfig
"

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="48bc7da1bc3b6b294c69796bd9573e670edd3c64"
SRC_URI="${REPOSITORY}/archive/${EGIT_BRANCH}/${EGIT_COMMIT}.zip -> ${PF}.zip
	mirror://gentoo/mono.snk.bz2"
#S="${WORKDIR}/${NAME}-${EGIT_COMMIT}"
S="${WORKDIR}/${NAME}-${EGIT_BRANCH}"

METAFILETOBUILD=./src/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="${PVR//-r/.}"
NUSPEC_VERSION=$(get_version_component_range 1-3)"${PR//r/.}"

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

src_unpack()
{
	default
	enuget_download_rogue_binary "Microsoft.Web.Infrastructure" "1.0.0.0"
	enuget_download_rogue_binary "Microsoft.AspNet.WebPages" "3.2.3"
	enuget_download_rogue_binary "Microsoft.AspNet.Razor" "3.2.3"
	enuget_download_rogue_binary "Microsoft.AspNet.Mvc" "5.2.3"
}

src_prepare() {
	einfo "patching project files"
	epatch "${FILESDIR}/X.PagedList.csproj.patch"
	epatch "${FILESDIR}/X.PagedList.Mvc.csproj.patch"

	# no restoring for this particular project for now, see src_unpack() above instead
	# einfo "restoring packages"
	# enuget_restore -Verbosity detailed -SolutionDirectory "${S}" "./src/X.PagedList/packages.config"
	# enuget_restore "./src/X.PagedList.Mvc/X.PagedList.Mvc.csproj"
	# enuget_restore -Verbosity detailed -SolutionDirectory "${S}" "./src/X.PagedList.Mvc/packages.config"

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

	eapply_user
}

src_configure() {
	:;
}

src_compile() {
	exbuild /p:SignAssembly=true "/p:AssemblyOriginatorKeyFile=${WORKDIR}/mono.snk" "./src/X.PagedList/X.PagedList.csproj"
	exbuild /p:SignAssembly=true "/p:AssemblyOriginatorKeyFile=${WORKDIR}/mono.snk" "./src/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 "src/X.PagedList/bin/${DIR}/X.PagedList.dll"
	egacinstall "src/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="src/X.PagedList/bin/${DIR}/X.PagedList.dll" target="lib\net45\" />
			    <file src="src/X.PagedList.Mvc/bin/${DIR}/X.PagedList.Mvc.dll" target="lib\net45\" />
			    <file src="src/X.PagedList/bin/${DIR}/X.PagedList.dll.mdb" target="lib\net45\" />
			    <file src="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="src/X.PagedList/bin/${DIR}/X.PagedList.dll" target="lib\net45\" />
			    <file src="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
}