commit:     d87c297e46e25d032b4fed630429d28f663f0028
Author:     Ben Sagal <bsagal <AT> gmail <DOT> com>
AuthorDate: Wed Jul 13 08:00:07 2016 +0000
Commit:     Heather Cynede <cynede <AT> gentoo <DOT> org>
CommitDate: Wed Jul 13 08:06:43 2016 +0000
URL:        https://gitweb.gentoo.org/proj/dotnet.git/commit/?id=d87c297e

Add dev-dotnet/dotnet-cli (bug #148)

 .../dotnet-cli-1.0.0_pre2_p003121.ebuild           | 125 +++++++++++++++++++++
 .../coreclr-1.0.0-gcc6-github-pull-5304.patch      |  28 +++++
 .../files/coreclr-1.0.0-icu57-commit-352df35.patch |  42 +++++++
 .../coreclr-1.0.0-segv-github-pull-6027.patch      |  59 ++++++++++
 dev-dotnet/dotnet-cli/metadata.xml                 |   8 ++
 5 files changed, 262 insertions(+)

diff --git a/dev-dotnet/dotnet-cli/dotnet-cli-1.0.0_pre2_p003121.ebuild 
b/dev-dotnet/dotnet-cli/dotnet-cli-1.0.0_pre2_p003121.ebuild
new file mode 100644
index 0000000..0211db9
--- /dev/null
+++ b/dev-dotnet/dotnet-cli/dotnet-cli-1.0.0_pre2_p003121.ebuild
@@ -0,0 +1,125 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+#BASED ON https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=dotnet-cli
+
+EAPI="6"
+
+BASE_PV=${PV%_p*}
+P_BUILD=${PV##*_p}
+DIST='debian-x64'
+
+MY_BASE_PV=${BASE_PV/_pre/-preview}
+
+MY_PV=${MY_BASE_PV}-${P_BUILD}
+MY_P=${PN}-${MY_PV}
+
+CORE_V=${PV%%_*}
+
+CORECLR_N=coreclr-${CORE_V}
+COREFX_N=corefx-${CORE_V}
+
+DESCRIPTION="A command line utility for building, testing, packaging and 
running .NET Core applications and libraries"
+HOMEPAGE="https://www.microsoft.com/net/core";
+LICENSE="MIT"
+
+IUSE=""
+SRC_URI="https://github.com/dotnet/coreclr/archive/v${CORE_V}.tar.gz -> 
${CORECLR_N}.tar.gz
+    https://github.com/dotnet/corefx/archive/v${CORE_V}.tar.gz -> 
${COREFX_N}.tar.gz
+    
https://download.microsoft.com/download/1/5/2/1523EBE1-3764-4328-8961-D1BD8ECA9295/dotnet-dev-${DIST}.${MY_PV}.tar.gz";
+
+SLOT="0"
+KEYWORDS="~amd64"
+
+RDEPEND="
+    >=sys-devel/llvm-3.7.1-r3[lldb]
+    >=sys-libs/libunwind-1.1-r1
+    >=dev-libs/icu-57.1
+    >=dev-util/lttng-ust-2.8.1
+    >=dev-libs/openssl-1.0.2h-r2
+    >=net-misc/curl-7.49.0"
+DEPEND="${RDEPEND}
+    >=dev-util/cmake-3.3.1-r1
+    >=sys-devel/make-4.1-r1
+    >=sys-devel/clang-3.7.1-r100
+    >=sys-devel/gettext-0.19.7"
+
+PATCHES=(
+       "${FILESDIR}/${CORECLR_N}-icu57-commit-352df35.patch"
+       "${FILESDIR}/${CORECLR_N}-gcc6-github-pull-5304.patch"
+       "${FILESDIR}/${CORECLR_N}-segv-github-pull-6027.patch"
+)
+
+S=${WORKDIR}
+CLI_S="${S}/dotnet_cli"
+CORECLR_S="${S}/${CORECLR_N}"
+COREFX_S="${S}/${COREFX_N}"
+
+CORECLR_FILES=(
+    'libclrjit.so'
+    'libcoreclr.so'
+    'libcoreclrtraceptprovider.so'
+    'libdbgshim.so'
+    'libmscordaccore.so'
+    'libmscordbi.so'
+    'libsos.so'
+    'libsosplugin.so'
+    'System.Globalization.Native.so'
+)
+
+COREFX_FILES=(
+    'System.IO.Compression.Native.so'
+    'System.Native.a'
+    'System.Native.so'
+    'System.Net.Http.Native.so'
+    'System.Net.Security.Native.so'
+    'System.Security.Cryptography.Native.so'
+)
+
+src_unpack() {
+    unpack "${CORECLR_N}.tar.gz" "${COREFX_N}.tar.gz"
+    mkdir "${CLI_S}" || die
+    cd "${CLI_S}" || die
+    unpack "dotnet-dev-${DIST}.${MY_PV}.tar.gz"
+}
+
+src_prepare() {
+    for file in "${CORECLR_FILES[@]}"; do
+        rm "${CLI_S}/shared/Microsoft.NETCore.App/${CORE_V}/${file}"
+    done
+    for file in "${COREFX_FILES[@]}"; do
+        rm "${CLI_S}/shared/Microsoft.NETCore.App/${CORE_V}/${file}"
+    done
+    default_src_prepare
+}
+
+src_compile() {
+    cd "${S}/${CORECLR_N}" || die
+    ./build.sh x64 release || die
+
+    cd "${S}/${COREFX_N}" || die
+    ./build.sh native x64 release || die
+}
+
+
+src_install() {
+    
+    local dest="/opt/dotnet_cli"
+    local ddest="${D}/${dest}"
+    local ddest_core="${ddest}/shared/Microsoft.NETCore.App/${CORE_V}/"
+    
+    dodir "${dest}"
+    cp -pPR "${CLI_S}"/* "${ddest}" || die
+
+    for file in "${CORECLR_FILES[@]}"; do
+        cp -pP "${CORECLR_S}/bin/Product/Linux.x64.Release/${file}" 
"${ddest_core}" || die
+    done
+    
+    for file in "${COREFX_FILES[@]}"; do
+        cp -pP "${COREFX_N}/bin/Linux.x64.Release/Native/${file}" 
"${ddest_core}" || die
+    done
+    
+    dosym "../../opt/dotnet_cli/dotnet" "/usr/bin/dotnet"
+    
+}

diff --git 
a/dev-dotnet/dotnet-cli/files/coreclr-1.0.0-gcc6-github-pull-5304.patch 
b/dev-dotnet/dotnet-cli/files/coreclr-1.0.0-gcc6-github-pull-5304.patch
new file mode 100644
index 0000000..872c539
--- /dev/null
+++ b/dev-dotnet/dotnet-cli/files/coreclr-1.0.0-gcc6-github-pull-5304.patch
@@ -0,0 +1,28 @@
+From 41912e3adb789b62f4cb46acffe915b6f1ab0e1e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=BCrgen=20H=C3=B6tzel?= <[email protected]>
+Date: Mon, 30 May 2016 11:45:49 +0200
+Subject: [PATCH] Don't use libstdc++ wrappers for stdlib.h (#5304)
+
+This prevents #undef of min/max macros. Refs #5006.
+---
+ src/pal/src/include/pal/palinternal.h | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/pal/src/include/pal/palinternal.h 
b/src/pal/src/include/pal/palinternal.h
+index 4c01be8..fdebc8d 100644
+--- a/coreclr-1.0.0/src/pal/src/include/pal/palinternal.h
++++ b/coreclr-1.0.0/src/pal/src/include/pal/palinternal.h
+@@ -567,6 +567,10 @@ function_name() to call the system's implementation
+ #endif
+ #include <ctype.h>
+ 
++// Don't use C++ wrappers for stdlib.h
++// https://gcc.gnu.org/ml/libstdc++/2016-01/msg00025.html 
++#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS 1
++
+ #define _WITH_GETLINE
+ #include <stdio.h>
+ #include <stdlib.h>
+-- 
+2.9.0
+

diff --git 
a/dev-dotnet/dotnet-cli/files/coreclr-1.0.0-icu57-commit-352df35.patch 
b/dev-dotnet/dotnet-cli/files/coreclr-1.0.0-icu57-commit-352df35.patch
new file mode 100644
index 0000000..d16369c
--- /dev/null
+++ b/dev-dotnet/dotnet-cli/files/coreclr-1.0.0-icu57-commit-352df35.patch
@@ -0,0 +1,42 @@
+From 352df35c124104586ee4c977556cb50ce720af62 Mon Sep 17 00:00:00 2001
+From: Peter Jas <[email protected]>
+Date: Mon, 30 May 2016 12:54:02 +0300
+Subject: [PATCH] Fix ucol_setMaxVariable detection for Gentoo Linux (#5309)
+
+The issue was the symbol is exported by the ICU lib. Including headers
+was not enough. The linker requires the libraries to succeed.
+
+With this fix, CoreCLR successfully builds on Gentoo Linux 100%.
+Tested with LXC gentoo container on Ubuntu machine.
+
+Steps to configure and build:
+https://gist.github.com/jasonwilliams200OK/1a2e2c0e904ffa95faf6333fcd88d9b8
+
+Fix #5160
+---
+ src/corefx/System.Globalization.Native/configure.cmake | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/src/corefx/System.Globalization.Native/configure.cmake 
b/src/corefx/System.Globalization.Native/configure.cmake
+index 4250c7c..138127e 100644
+--- a/coreclr-1.0.0/src/corefx/System.Globalization.Native/configure.cmake
++++ b/coreclr-1.0.0/src/corefx/System.Globalization.Native/configure.cmake
+@@ -8,11 +8,18 @@ CHECK_CXX_SOURCE_COMPILES("
+     int main() { UDateFormatSymbolType e = UDAT_STANDALONE_SHORTER_WEEKDAYS; }
+ " HAVE_UDAT_STANDALONE_SHORTER_WEEKDAYS)
+ 
++if(NOT CLR_CMAKE_PLATFORM_DARWIN)
++    set(CMAKE_REQUIRED_LIBRARIES ${ICUUC} ${ICUI18N})
++else()
++    set(CMAKE_REQUIRED_LIBRARIES ${ICUCORE})
++endif()
++
+ check_symbol_exists(
+     ucol_setMaxVariable
+     "unicode/ucol.h"
+     HAVE_SET_MAX_VARIABLE)
+ 
++unset(CMAKE_REQUIRED_LIBRARIES)
+ unset(CMAKE_REQUIRED_INCLUDES)
+ 
+ configure_file(

diff --git 
a/dev-dotnet/dotnet-cli/files/coreclr-1.0.0-segv-github-pull-6027.patch 
b/dev-dotnet/dotnet-cli/files/coreclr-1.0.0-segv-github-pull-6027.patch
new file mode 100644
index 0000000..5d07157
--- /dev/null
+++ b/dev-dotnet/dotnet-cli/files/coreclr-1.0.0-segv-github-pull-6027.patch
@@ -0,0 +1,59 @@
+From 56ab756b0e9afef24cf9151a4a43f23e8d78de29 Mon Sep 17 00:00:00 2001
+From: Jan Vorlicek <[email protected]>
+Date: Tue, 28 Jun 2016 21:34:04 +0200
+Subject: [PATCH] Fix Windows context to Unix context translation on AMD64
+ (#6027)
+
+There was a bug in the context translation between the Windows context
+and Unix context on AMD64 caused by the fact that the Unix context
+gregs array contains CS, GS and FS in a single field (REG_CSGSFS) and
+the MCREG_SegCs accessor macro was incorrectly written to use the
+whole field as CS. So writing the CS into the Unix context also
+cleared the GS, FS and the topmost 16 bits described as padding.
+This issue was exposed on the Linux kernel >= 4.6.0 where the padding
+for some reason was not zero, probably used by the kernel for some
+internal purposes.
+I have fixed it by changing the accessor to modify only the 16 bits
+corresponding to the CS.
+I have also changed the code in the inject_activation_handler to
+save cycles and not to copy the Windows context back to the Unix one
+in case the activation function was not called and so the context
+was not possibly changed.
+---
+ src/pal/src/exception/signal.cpp  | 5 ++---
+ src/pal/src/include/pal/context.h | 2 +-
+ 2 files changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/src/pal/src/exception/signal.cpp 
b/src/pal/src/exception/signal.cpp
+index dc26ee4..adeada1 100644
+--- a/coreclr-1.0.0/src/pal/src/exception/signal.cpp
++++ b/coreclr-1.0.0/src/pal/src/exception/signal.cpp
+@@ -464,10 +464,9 @@ static void inject_activation_handler(int code, siginfo_t 
*siginfo, void *contex
+         if (g_safeActivationCheckFunction(CONTEXTGetPC(&winContext), /* 
checkingCurrentThread */ TRUE))
+         {
+             g_activationFunction(&winContext);
++            // Activation function may have modified the context, so update 
it.
++            CONTEXTToNativeContext(&winContext, ucontext);
+         }
+-
+-        // Activation function may have modified the context, so update it.
+-        CONTEXTToNativeContext(&winContext, ucontext);
+     }
+     else if (g_previous_activation.sa_sigaction != NULL)
+     {
+diff --git a/src/pal/src/include/pal/context.h 
b/src/pal/src/include/pal/context.h
+index 7591703..6f1b3fe 100644
+--- a/coreclr-1.0.0/src/pal/src/include/pal/context.h
++++ b/coreclr-1.0.0/src/pal/src/include/pal/context.h
+@@ -111,7 +111,7 @@ typedef ucontext_t native_context_t;
+ #define MCREG_Rax(mc)       ((mc).gregs[REG_RAX])
+ #define MCREG_Rip(mc)       ((mc).gregs[REG_RIP])
+ #define MCREG_Rsp(mc)       ((mc).gregs[REG_RSP])
+-#define MCREG_SegCs(mc)     ((mc).gregs[REG_CSGSFS])
++#define MCREG_SegCs(mc)     (*(WORD*)&((mc).gregs[REG_CSGSFS]))
+ #define MCREG_R8(mc)        ((mc).gregs[REG_R8])
+ #define MCREG_R9(mc)        ((mc).gregs[REG_R9])
+ #define MCREG_R10(mc)       ((mc).gregs[REG_R10])
+-- 
+2.9.0
+

diff --git a/dev-dotnet/dotnet-cli/metadata.xml 
b/dev-dotnet/dotnet-cli/metadata.xml
new file mode 100644
index 0000000..b1262f1
--- /dev/null
+++ b/dev-dotnet/dotnet-cli/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="project">
+               <email>[email protected]</email>
+               <description>Gentoo Dotnet Project</description>
+       </maintainer>
+</pkgmetadata>

Reply via email to