commit: 7bfef3a293d7247c82e672c71caeb14f41dd1d3a Author: ArsenShnurkov <Arsen.Shnurkov <AT> gmail <DOT> com> AuthorDate: Tue Sep 1 16:14:38 2015 +0000 Commit: Heather Cynede <cynede <AT> gentoo <DOT> org> CommitDate: Tue Sep 1 16:14:38 2015 +0000 URL: https://gitweb.gentoo.org/proj/dotnet.git/commit/?id=7bfef3a2
Newtonsoft.Json - one of mono's dependencies .../newtonsoftjson/files/Newtonsoft.Json.nuspec | 45 ++++++++++ .../newtonsoftjson/files/removing-tests.patch | 33 ++++++++ .../newtonsoftjson-7.0.1-r20150831.ebuild | 92 +++++++++++++++++++++ eclass/dotnet.eclass | 25 ++++-- eclass/mono.snk | Bin 0 -> 596 bytes 5 files changed, 190 insertions(+), 5 deletions(-) diff --git a/dev-dotnet/newtonsoftjson/files/Newtonsoft.Json.nuspec b/dev-dotnet/newtonsoftjson/files/Newtonsoft.Json.nuspec new file mode 100644 index 0000000..a557d6b --- /dev/null +++ b/dev-dotnet/newtonsoftjson/files/Newtonsoft.Json.nuspec @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> + <metadata> + <id>Newtonsoft.Json</id> + <version>@Version@</version> + <title>Json.NET</title> + <description>Json.NET is a popular high-performance JSON framework for .NET</description> + <authors>James Newton-King</authors> + <language>en-US</language> + <projectUrl>http://www.newtonsoft.com/json</projectUrl> + <iconUrl>http://www.newtonsoft.com/content/images/nugeticon.png</iconUrl> + <licenseUrl>https://raw.github.com/JamesNK/Newtonsoft.Json/master/LICENSE.md</licenseUrl> + <tags>json</tags> + <dependencies> + <group targetFramework="net45" /> + <group targetFramework=".NETPlatform5.0"> + <dependency id="Microsoft.CSharp" version="4.0.0" /> + <dependency id="System.Collections" version="4.0.10" /> + <dependency id="System.Collections.Concurrent" version="4.0.10" /> + <dependency id="System.ComponentModel.TypeConverter" version="4.0.0" /> + <dependency id="System.Diagnostics.Debug" version="4.0.10" /> + <dependency id="System.Diagnostics.Tools" version="4.0.0" /> + <dependency id="System.Dynamic.Runtime" version="4.0.10" /> + <dependency id="System.Globalization" version="4.0.10" /> + <dependency id="System.IO" version="4.0.10" /> + <dependency id="System.Linq" version="4.0.0" /> + <dependency id="System.Linq.Expressions" version="4.0.10" /> + <dependency id="System.ObjectModel" version="4.0.10" /> + <dependency id="System.Reflection" version="4.0.10" /> + <dependency id="System.Reflection.Extensions" version="4.0.0" /> + <dependency id="System.Runtime" version="4.0.20" /> + <dependency id="System.Runtime.Extensions" version="4.0.10" /> + <dependency id="System.Runtime.Numerics" version="4.0.0" /> + <dependency id="System.Runtime.Serialization.Primitives" version="4.0.10" /> + <dependency id="System.Text.Encoding" version="4.0.10" /> + <dependency id="System.Text.Encoding.Extensions" version="4.0.10" /> + <dependency id="System.Text.RegularExpressions" version="4.0.10" /> + <dependency id="System.Threading" version="4.0.10" /> + <dependency id="System.Threading.Tasks" version="4.0.10" /> + <dependency id="System.Xml.ReaderWriter" version="4.0.10" /> + <dependency id="System.Xml.XDocument" version="4.0.10" /> + </group> + </dependencies> + </metadata> +</package> diff --git a/dev-dotnet/newtonsoftjson/files/removing-tests.patch b/dev-dotnet/newtonsoftjson/files/removing-tests.patch new file mode 100644 index 0000000..50d3562 --- /dev/null +++ b/dev-dotnet/newtonsoftjson/files/removing-tests.patch @@ -0,0 +1,33 @@ +--- a/Src/Newtonsoft.Json.sln 2015-08-31 08:43:56.000000000 +0300 ++++ b/Src/Newtonsoft.Json.sln 2015-09-01 18:48:51.000000000 +0300 +@@ -1,14 +1,10 @@ + + Microsoft Visual Studio Solution File, Format Version 12.00 +-# Visual Studio 14 ++# Visual Studio 2012 + VisualStudioVersion = 14.0.23107.0 + MinimumVisualStudioVersion = 10.0.40219.1 + Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Newtonsoft.Json", "Newtonsoft.Json\Newtonsoft.Json.csproj", "{EEEA67F9-9089-481D-A4DC-0966DEC9FD7D}" + EndProject +-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Newtonsoft.Json.Tests", "Newtonsoft.Json.Tests\Newtonsoft.Json.Tests.csproj", "{CCD1B8C4-7349-409C-A090-A9B9A1ABD981}" +-EndProject +-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Newtonsoft.Json.TestConsole", "Newtonsoft.Json.TestConsole\Newtonsoft.Json.TestConsole.csproj", "{3CC9C2DF-CD0A-4096-BF46-B4AFDF0147D2}" +-EndProject + Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU +@@ -19,14 +15,6 @@ + {EEEA67F9-9089-481D-A4DC-0966DEC9FD7D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EEEA67F9-9089-481D-A4DC-0966DEC9FD7D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EEEA67F9-9089-481D-A4DC-0966DEC9FD7D}.Release|Any CPU.Build.0 = Release|Any CPU +- {CCD1B8C4-7349-409C-A090-A9B9A1ABD981}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +- {CCD1B8C4-7349-409C-A090-A9B9A1ABD981}.Debug|Any CPU.Build.0 = Debug|Any CPU +- {CCD1B8C4-7349-409C-A090-A9B9A1ABD981}.Release|Any CPU.ActiveCfg = Release|Any CPU +- {CCD1B8C4-7349-409C-A090-A9B9A1ABD981}.Release|Any CPU.Build.0 = Release|Any CPU +- {3CC9C2DF-CD0A-4096-BF46-B4AFDF0147D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +- {3CC9C2DF-CD0A-4096-BF46-B4AFDF0147D2}.Debug|Any CPU.Build.0 = Debug|Any CPU +- {3CC9C2DF-CD0A-4096-BF46-B4AFDF0147D2}.Release|Any CPU.ActiveCfg = Release|Any CPU +- {3CC9C2DF-CD0A-4096-BF46-B4AFDF0147D2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE diff --git a/dev-dotnet/newtonsoftjson/newtonsoftjson-7.0.1-r20150831.ebuild b/dev-dotnet/newtonsoftjson/newtonsoftjson-7.0.1-r20150831.ebuild new file mode 100644 index 0000000..53eda5e --- /dev/null +++ b/dev-dotnet/newtonsoftjson/newtonsoftjson-7.0.1-r20150831.ebuild @@ -0,0 +1,92 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 +inherit mono-env nuget dotnet + +NAME="Newtonsoft.Json" +HOMEPAGE="https://github.com/JamesNK/${NAME}" + +EGIT_COMMIT="05710874cd61adabfb635085b1b45cf31882df3d" +SRC_URI="${HOMEPAGE}/archive/${EGIT_COMMIT}.zip -> ${PF}.zip" +S="${WORKDIR}/${NAME}-${EGIT_COMMIT}" + +SLOT="0" + +DESCRIPTION="NewtonSoft.JSon library" +LICENSE="MIT" + +KEYWORDS="~amd64 ~ppc ~x86" +COMMON_DEPENDENCIES="|| ( >=dev-lang/mono-4.2 <dev-lang/mono-9999 )" +RDEPEND="${COMMON_DEPENDENCIES} +" +DEPEND="${COMMON_DEPENDENCIES} + >=dev-dotnet/nunit-2.6.4-r201501110:2[nupkg] +" + +USE_DOTNET="net45" +IUSE="${USE_DOTNET} gac nupkg" +# if you remove these flags where will be the error: +# USE Flag 'gac' not in IUSE for dev-dotnet/newtonsoftjson-0.0.0-r20150831 + +METAFILETOBUILD=Src/Newtonsoft.Json.sln + +# https://devmanual.gentoo.org/ebuild-writing/variables/ +# +# PN = Package name, for example vim. +# P = Package name and version (excluding revision, if any), for example vim-6.3. +# FILESDIR = Path to the ebuild's files/ directory, commonly used for small patches and files. Value: "${PORTDIR}/${CATEGORY}/${PN}/files" +# WORKDIR = Path to the ebuild's root build directory. Value: "${PORTAGE_BUILDDIR}/work" +# S = Path to the temporary build directory, used by src_compile and src_install. Default: "${WORKDIR}/${P}". + +NUSPEC_FILENAME="Newtonsoft.Json.nuspec" + +# ${SNK_FILENAME} is used inside exbuild() to sign assemblies +#SNK_FILENAME="${S}/Src/Newtonsoft.Json/Dynamic.snk" + +src_prepare() { + elog "${S}/Build/${NUSPEC_FILENAME}" + sed "s/@Version@/${PV}/g" "${FILESDIR}/${NUSPEC_FILENAME}" >"${S}/Build/${NUSPEC_FILENAME}" || die + + egrep -lRZ '2\.6\.2' "${S}" | xargs -0 sed -i 's/2\.6\.2/2\.6\.4/g' || die + + enuget_restore "${METAFILETOBUILD}" + # Installing 'Autofac 3.5.0'. + # Installing 'NUnit 2.6.2'. + # Installing 'System.Collections.Immutable 1.1.36'. + # Installing 'FSharp.Core 4.0.0'. + epatch "${FILESDIR}/removing-tests.patch" + + if use gac; then + find . -iname "*.csproj" -print0 | xargs -0 \ + sed -i 's/<DefineConstants>/<DefineConstants>SIGNED;/g' || die + #PUBLIC_KEY=`sn -q -p ${SNK_FILENAME} /dev/stdout | hexdump -e '"%02x"'` + #find . -iname "AssemblyInfo.cs" -print0 | xargs -0 sed -i "s/PublicKey=[0-9a-fA-F]*/PublicKey=${PUBLIC_KEY}/g" || die + find . -iname "AssemblyInfo.cs" -print0 | xargs -0 sed -i "/InternalsVisibleTo/d" || die + fi +} + +src_compile() { + exbuild "${METAFILETOBUILD}" + enuspec "Build/${NUSPEC_FILENAME}" +} + + +src_install() { + DIR="" + if use debug; then + DIR="Debug" + else + DIR="Release" + fi + + FINAL_DLL=Src/Newtonsoft.Json/bin/${DIR}/Net45/Newtonsoft.Json.dll + + if use gac; then + estrongname "${FINAL_DLL}" + egacinstall "${FINAL_DLL}" + fi + + enupkg "${WORKDIR}/Newtonsoft.Json.${PV}.nupkg" +} diff --git a/eclass/dotnet.eclass b/eclass/dotnet.eclass index 0b94b64..c6d7af4 100644 --- a/eclass/dotnet.eclass +++ b/eclass/dotnet.eclass @@ -26,6 +26,9 @@ inherit eutils versionator mono-env DEPEND+=" dev-lang/mono" IUSE+=" debug developer" +# SRC_URI+=" https://github.com/mono/mono/raw/master/mcs/class/mono.snk" +# I was unable to setup it this ^^ way + # SET default use flags according on DOTNET_TARGETS for x in ${USE_DOTNET}; do case ${x} in @@ -41,14 +44,12 @@ done dotnet_pkg_setup() { EBUILD_FRAMEWORK="" for x in ${USE_DOTNET} ; do -# elog "Cycle, start, x=""${x}""" case ${x} in net45) EBF="4.5"; if use net45; then F="${EBF}";fi;; net40) EBF="4.0"; if use net40; then F="${EBF}";fi;; net35) EBF="3.5"; if use net35; then F="${EBF}";fi;; net20) EBF="2.0"; if use net20; then F="${EBF}";fi;; esac -# elog "Cycle, after switch, F=""${F}"", EBF=""${EBF}""" if [[ -z ${FRAMEWORK} ]]; then if [[ ${F} ]]; then FRAMEWORK="${F}"; @@ -63,7 +64,6 @@ dotnet_pkg_setup() { else version_is_at_least "${EBF}" "${EBUILD_FRAMEWORK}" || EBUILD_FRAMEWORK="${EBF}" fi -# elog "Cycle, the end, FRAMEWORK=""${FRAMEWORK}"", EBUILD_FRAMEWORK=""${EBUILD_FRAMEWORK}"" " done if [[ -z ${FRAMEWORK} ]]; then if [[ -z ${EBUILD_FRAMEWORK} ]]; then @@ -111,8 +111,23 @@ exbuild() { SARGS=/p:DebugSymbols=False fi - elog "xbuild /tv:4.0 ""/p:TargetFrameworkVersion=v${FRAMEWORK}"" ""${CARGS}"" ""${SARGS}"" ""$@""" || die - xbuild /tv:4.0 "/p:TargetFrameworkVersion=v${FRAMEWORK}" "${CARGS}" "${SARGS}" "$@" || die + # http://stackoverflow.com/questions/7903321/only-sign-assemblies-with-strong-name-during-release-build + if use gac; then + if [[ -z ${SNK_FILENAME} ]]; then + # elog ${BASH_SOURCE} + SNK_FILENAME=/var/lib/layman/dotnet/eclass/mono.snk + # sn - Digitally sign/verify/compare strongnames on CLR assemblies. + # man sn = http://linux.die.net/man/1/sn + fi + KARGS1=/p:SignAssembly=true + KARGS2=/p:AssemblyOriginatorKeyFile=${SNK_FILENAME} + else + KARGS1= + KARGS2= + fi + + elog "xbuild /tv:4.0 ""/p:TargetFrameworkVersion=v${FRAMEWORK}"" ""${CARGS}"" ""${SARGS}"" ""${KARGS1}"" ""${KARGS2}"" ""$@""" || die + xbuild /tv:4.0 "/p:TargetFrameworkVersion=v${FRAMEWORK}" "${CARGS}" "${SARGS}" "${KARGS1}" "${KARGS2}" "$@" || die } # @FUNCTION: egacinstall diff --git a/eclass/mono.snk b/eclass/mono.snk new file mode 100644 index 0000000..380116c Binary files /dev/null and b/eclass/mono.snk differ