Apocrypha

netcoredbg-3.1.3.1062gentoo

# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

MY_PV="$(ver_cut 1-3)-$(ver_cut 4)"
DOTNET_RUNTIME_V="8.0.20"

CMAKE_IN_SOURCE_BUILD="ON"
CMAKE_MAKEFILE_GENERATOR="emake"

DOTNET_PKG_COMPAT="10.0"
NUGETS="
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl@4.3.0
runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl@4.3.0
runtime.fedora.24-x64.runtime.native.system.security.cryptography.openssl@4.3.0
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl@4.3.0
runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl@4.3.0
runtime.osx.10.10-x64.runtime.native.system.security.cryptography.apple@4.3.0
runtime.osx.10.10-x64.runtime.native.system.security.cryptography.openssl@4.3.0
runtime.rhel.7-x64.runtime.native.system.security.cryptography.openssl@4.3.0
runtime.ubuntu.14.04-x64.runtime.native.system.security.cryptography.openssl@4.3.0
runtime.ubuntu.16.04-x64.runtime.native.system.security.cryptography.openssl@4.3.0
runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl@4.3.0
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
"

inherit check-reqs dotnet-pkg flag-o-matic cmake

DESCRIPTION="NetCoreDbg is a managed code debugger with MI interface for CoreCLR"
HOMEPAGE="https://github.com/Samsung/netcoredbg/"

if [[ "${PV}" == *9999* ]] ; then
	inherit git-r3

	EGIT_REPO_URI="https://github.com/Samsung/${PN}"
else
	SRC_URI="https://github.com/Samsung/${PN}/archive/refs/tags/${MY_PV}.tar.gz
		-> ${P}.gh.tar.gz"
	S="${WORKDIR}/${PN}-${MY_PV}"

	KEYWORDS="amd64"
fi

# .NET runtime that would have otherwise be downloaded via git.
SRC_URI+="
	https://github.com/dotnet/runtime/archive/refs/tags/v${DOTNET_RUNTIME_V}.tar.gz
		-> dotnet-runtime-${DOTNET_RUNTIME_V}.gh.tar.gz
"
CORECLR_S="${WORKDIR}/runtime-${DOTNET_RUNTIME_V}/src/coreclr"

SRC_URI+="
	${NUGET_URIS}
"

LICENSE="MIT"
SLOT="0/${MY_PV}"

CHECKREQS_DISK_BUILD="1400M"
DOTNET_PKG_PROJECTS=(
	src/managed/ManagedPart.csproj   # Restore but do not build those projects.
)
PATCHES=( "${FILESDIR}/netcoredbg-3.0.0.1012-compileoptions.patch" )
QA_FLAGS_IGNORED=".*/libdbgshim.so"

DOCS=( README.md docs/{interop,stepping}.md )

pkg_setup() {
	check-reqs_pkg_setup
	dotnet-pkg_pkg_setup
}

src_unpack() {
	dotnet-pkg_src_unpack

	if [[ -n "${EGIT_REPO_URI}" ]] ; then
		git-r3_src_unpack
	fi
}

src_prepare() {
	# Bump "cmake_minimum_required" to >=3.20.
	sed -i CMakeLists.txt \
		third_party/libelfin/CMakeLists.txt \
		third_party/libelfin/dwarf/CMakeLists.txt \
		third_party/libelfin/elf/CMakeLists.txt \
		third_party/linenoise-ng/CMakeLists.txt \
		-e "/^cmake_minimum_required/s|3.5|3.25|g" \
		|| die

	cmake_src_prepare

	nuget_writeconfig "$(pwd)/"
	cp NuGet.config tools/generrmsg/nuget.xml || die
}

src_configure() {
	INSTALL_PREFIX="/usr/$(get_libdir)/${PN}"
	append-cxxflags -fpermissive
	dotnet-pkg_src_configure

	local -a mycmakeargs=(
		-DBUILD_MANAGED="1"
		-DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}"
		-DCORECLR_DIR="${CORECLR_S}"
		-DDOTNET_DIR="${DOTNET_ROOT}"
	)
	cmake_src_configure
}

src_install() {
	cmake_src_install

	dosym -r "${INSTALL_PREFIX}/${PN}" "/usr/bin/${PN}"
	einstalldocs
}