diff options
author | ArsenShnurkov <ArsenShnurkov@users.noreply.github.com> | 2017-09-29 15:10:40 +0300 |
---|---|---|
committer | ArsenShnurkov <ArsenShnurkov@users.noreply.github.com> | 2017-09-29 15:10:40 +0300 |
commit | d0bb7453402d879047ab75cc80b9836d53c8eb1c (patch) | |
tree | 80ed897822fb1f7039c5935308b5c6a51b974a6b /eclass | |
parent | bump mono (diff) | |
download | dotnet-d0bb7453402d879047ab75cc80b9836d53c8eb1c.tar.gz dotnet-d0bb7453402d879047ab75cc80b9836d53c8eb1c.tar.bz2 dotnet-d0bb7453402d879047ab75cc80b9836d53c8eb1c.zip |
dev-dotnet/msbuild, fix 310
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/gac.eclass | 126 | ||||
-rw-r--r-- | eclass/mono-pkg-config.eclass | 98 | ||||
-rw-r--r-- | eclass/msbuild.eclass | 58 |
3 files changed, 181 insertions, 101 deletions
diff --git a/eclass/gac.eclass b/eclass/gac.eclass index 1afae97..d972e05 100644 --- a/eclass/gac.eclass +++ b/eclass/gac.eclass @@ -13,7 +13,7 @@ case ${EAPI:-0} in 6) ;; esac -IUSE+=" +gac +pkg-config +symlink" +IUSE+=" +gac pkg-config" DEPEND+=" dev-lang/mono" RDEPEND+=" dev-lang/mono" @@ -24,121 +24,45 @@ RDEPEND+=" dev-lang/mono" # @FUNCTION: egacinstall # @DESCRIPTION: install package to GAC egacinstall() { + use !prefix && has "${EAPI:-0}" 0 1 2 && ED="${D}" if use gac; then - use !prefix && has "${EAPI:-0}" 0 1 2 && ED="${D}" - gacutil -i "${1}" \ - -root "${ED}"/usr/$(get_libdir) \ - -gacdir /usr/$(get_libdir) \ - -package ${2:-${GACPN:-${PN}}} \ - || die "installing ${1} into the Global Assembly Cache failed" + if use pkg-config; then + gacutil -i "${1}" \ + -root "${ED}"/usr/$(get_libdir) \ + -gacdir /usr/$(get_libdir) \ + -package ${2:-${GACPN:-${PN}}} \ + || die "installing ${1} into the Global Assembly Cache failed" + else + gacutil -i "${1}" \ + -root "${ED}"/usr/$(get_libdir) \ + -gacdir /usr/$(get_libdir) \ + || die "installing ${1} into the Global Assembly Cache failed" + fi fi } # @FUNCTION: egacadd -# @DESCRIPTION: install package to GAC in pkg_postinst phase -# the idea is to allow registration in GAC for binary packages for different PREFIX-es -# see http://arsenshnurkov.github.io/gentoo-mono-handbook/gac.htm +# @DESCRIPTION: install package to GAC egacadd() { if use gac; then - GACROOT="${PREFIX}/usr/$(get_libdir)" - GACDIR="/usr/$(get_libdir)/mono/gac" - einfo gacutil -i "${PREFIX}/${1}" -root "${GACROOT}" -gacdir "${GACDIR}" - gacutil -i "${PREFIX}/${1}" \ - -root ${GACROOT} \ - -gacdir "${GACDIR}" \ + use !prefix && has "${EAPI:-0}" 0 1 2 && ED="${D}" + gacutil -i "${1}" \ + -root "${ED}"/usr/$(get_libdir) \ + -gacdir /usr/$(get_libdir) \ -package ${2:-${GACPN:-${PN}}} \ || die "installing ${1} into the Global Assembly Cache failed" fi } # @FUNCTION: egacdel -# @DESCRIPTION: remove package from GAC in pkg_prerm phase -# see notes for egacadd() +# @DESCRIPTION: remove package from GAC egacdel() { if use gac; then - GACROOT="${PREFIX}/usr/$(get_libdir)" - GACDIR="/usr/$(get_libdir)/mono/gac" - einfo gacutil -u "${1}" -root "${GACROOT}" -gacdir "${GACDIR}" - gacutil -u "${1}" -root "${GACROOT}" -gacdir "${GACDIR}" + use !prefix && has "${EAPI:-0}" 0 1 2 && ED="${D}" + gacutil -u "${1}" \ + -root "${ED}"/usr/$(get_libdir) \ + -gacdir /usr/$(get_libdir) \ + -package ${2:-${GACPN:-${PN}}} # don't die fi } - -# http://www.gossamer-threads.com/lists/gentoo/dev/263462 -# pkg config files should always come from upstream -# but what if they are not? -# you can fork, or you can use a configuration system that upstream actually supports. -# both are more difficult than creating .pc in ebuilds. Forks requires maintenance, and -# second one requires rewriting the IDE (disrespecting the decision of IDE's authors who decide to use .pc-files) -# So, "keep fighting the good fight, don't stop believing, and let the haters hate" (q) desultory from #gentoo-dev-help @ freenode - -# @FUNCTION: einstall_pc_file -# @DESCRIPTION: installs .pc file -# The file format contains predefined metadata keywords and freeform variables (like ${prefix} and ${exec_prefix}) -# $1 = ${PN} -# $2 = ${PV} -# $3 = myassembly1 # should not contain path, shouldn't contain .dll extension -# $4 = myassembly2 -# $N = myassemblyN-2 # see DLL_REFERENCES -einstall_pc_file() -{ - if use pkg-config; then - local PC_NAME="$1" - local PC_VERSION="$2" - - shift 2 - if [ "$#" == "0" ]; then - die "no assembly names given" - fi - local DLL_REFERENCES="" - while (( "$#" )); do - DLL_REFERENCES+=" -r:\${libdir}/mono/${PC_NAME}/${1}.dll" - shift - done - -# local PC_FILENAME="${PC_NAME}-${PC_VERSION}" - local PC_FILENAME="${PN}-${PV}" - local PC_DIRECTORY="/usr/$(get_libdir)/pkgconfig" - #local PC_DIRECTORY_DELTA="${CATEGORY}/${PN}" - local PC_DIRECTORY_VER="${PC_DIRECTORY}/${PC_DIRECTORY_DELTA}" - - dodir "${PC_DIRECTORY}" - dodir "${PC_DIRECTORY_VER}" - - ebegin "Installing ${PC_DIRECTORY_VER}/${PC_FILENAME}.pc file" - - # @Name@: A human-readable name for the library or package. This does not affect usage of the pkg-config tool, - # which uses the name of the .pc file. - # see https://people.freedesktop.org/~dbn/pkg-config-guide.html - - # \${name} variables going directly into .pc file after unescaping $ sign - # - # other variables are not substituted to sed input directly - # to protect them from processing by bash - # (they only requires sed escaping for replacement path) - sed \ - -e "s:@PC_VERSION@:${PC_VERSION}:" \ - -e "s:@Name@:${CATEGORY}/${PN}:" \ - -e "s:@DESCRIPTION@:${DESCRIPTION}:" \ - -e "s:@LIBDIR@:$(get_libdir):" \ - -e "s*@LIBS@*${DLL_REFERENCES}*" \ - <<-EOF >"${D}/${PC_DIRECTORY_VER}/${PC_FILENAME}.pc" || die - prefix=\${pcfiledir}/../.. - exec_prefix=\${prefix} - libdir=\${exec_prefix}/@LIBDIR@ - Version: @PC_VERSION@ - Name: @Name@ - Description: @DESCRIPTION@ - Libs: @LIBS@ - EOF - - einfo PKG_CONFIG_PATH="${D}/${PC_DIRECTORY_VER}" pkg-config --exists "${PC_FILENAME}" - PKG_CONFIG_PATH="${D}/${PC_DIRECTORY_VER}" pkg-config --exists "${PC_FILENAME}" || die ".pc file failed to validate." - eend $? - - if use symlink; then - einfo "SymLinking ${PC_DIRECTORY_VER}/${PC_FILENAME}.pc file as ${PC_DIRECTORY}/${PC_NAME}.pc" - dosym "./${PC_DIRECTORY_DELTA}/${PC_FILENAME}.pc" "${PC_DIRECTORY}/${PC_NAME}.pc" - fi - fi -} diff --git a/eclass/mono-pkg-config.eclass b/eclass/mono-pkg-config.eclass new file mode 100644 index 0000000..41d892e --- /dev/null +++ b/eclass/mono-pkg-config.eclass @@ -0,0 +1,98 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# @ECLASS: mono-pkg-config.eclass +# @MAINTAINER: cynede@gentoo.org +# @BLURB: functions for registring in gac +# @DESCRIPTION: +# interacts with pkg-config tools + +case ${EAPI:-0} in + 0|1|2|3|4|5) die "this eclass doesn't support EAPI ${EAPI:-0}" ;; + 6) ;; +esac + +IUSE+=" pkg-config symlink" + +DEPEND+=" dev-lang/mono" +RDEPEND+=" dev-lang/mono" + +# http://www.gossamer-threads.com/lists/gentoo/dev/263462 +# pkg config files should always come from upstream +# but what if they are not? +# you can fork, or you can use a configuration system that upstream actually supports. +# both are more difficult than creating .pc in ebuilds. Forks requires maintenance, and +# second one requires rewriting the IDE (disrespecting the decision of IDE's authors who decide to use .pc-files) +# So, "keep fighting the good fight, don't stop believing, and let the haters hate" (q) desultory from #gentoo-dev-help @ freenode + +# @FUNCTION: einstall_pc_file +# @DESCRIPTION: installs .pc file +# The file format contains predefined metadata keywords and freeform variables (like ${prefix} and ${exec_prefix}) +# $1 = ${PN} +# $2 = ${PV} +# $3 = myassembly1 # should not contain path, shouldn't contain .dll extension +# $4 = myassembly2 +# $N = myassemblyN-2 # see DLL_REFERENCES +einstall_pc_file() +{ + if use pkg-config; then + local PC_NAME="$1" + local PC_VERSION="$2" + + shift 2 + if [ "$#" == "0" ]; then + die "no assembly names given" + fi + local DLL_REFERENCES="" + while (( "$#" )); do + DLL_REFERENCES+=" -r:\${libdir}/mono/${PC_NAME}/${1}.dll" + shift + done + +# local PC_FILENAME="${PC_NAME}-${PC_VERSION}" + local PC_FILENAME="${PN}-${PV}" + local PC_DIRECTORY="/usr/$(get_libdir)/pkgconfig" + #local PC_DIRECTORY_DELTA="${CATEGORY}/${PN}" + local PC_DIRECTORY_VER="${PC_DIRECTORY}/${PC_DIRECTORY_DELTA}" + + dodir "${PC_DIRECTORY}" + dodir "${PC_DIRECTORY_VER}" + + ebegin "Installing ${PC_DIRECTORY_VER}/${PC_FILENAME}.pc file" + + # @Name@: A human-readable name for the library or package. This does not affect usage of the pkg-config tool, + # which uses the name of the .pc file. + # see https://people.freedesktop.org/~dbn/pkg-config-guide.html + + # \${name} variables going directly into .pc file after unescaping $ sign + # + # other variables are not substituted to sed input directly + # to protect them from processing by bash + # (they only requires sed escaping for replacement path) + sed \ + -e "s:@PC_VERSION@:${PC_VERSION}:" \ + -e "s:@Name@:${CATEGORY}/${PN}:" \ + -e "s:@DESCRIPTION@:${DESCRIPTION}:" \ + -e "s:@LIBDIR@:$(get_libdir):" \ + -e "s*@LIBS@*${DLL_REFERENCES}*" \ + <<-EOF >"${D}/${PC_DIRECTORY_VER}/${PC_FILENAME}.pc" || die + prefix=\${pcfiledir}/../.. + exec_prefix=\${prefix} + libdir=\${exec_prefix}/@LIBDIR@ + Version: @PC_VERSION@ + Name: @Name@ + Description: @DESCRIPTION@ + Libs: @LIBS@ + EOF + + einfo PKG_CONFIG_PATH="${D}/${PC_DIRECTORY_VER}" pkg-config --exists "${PC_FILENAME}" + PKG_CONFIG_PATH="${D}/${PC_DIRECTORY_VER}" pkg-config --exists "${PC_FILENAME}" || die ".pc file failed to validate." + eend $? + + if use symlink; then + einfo "SymLinking ${PC_DIRECTORY_VER}/${PC_FILENAME}.pc file as ${PC_DIRECTORY}/${PC_NAME}.pc" + dosym "./${PC_DIRECTORY_DELTA}/${PC_FILENAME}.pc" "${PC_DIRECTORY}/${PC_NAME}.pc" + fi + fi +} diff --git a/eclass/msbuild.eclass b/eclass/msbuild.eclass new file mode 100644 index 0000000..fae886f --- /dev/null +++ b/eclass/msbuild.eclass @@ -0,0 +1,58 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# @ECLASS: msbuild.eclass +# @MAINTAINER: cynede@gentoo.org +# @BLURB: functions for working with msbuild command line utility +# @DESCRIPTION: +# This is the new replacement for dotnet eclass + +case ${EAPI:-0} in + 0) die "this eclass doesn't support EAPI 0" ;; + 1|2|3) ;; + *) ;; #if [[ ${USE_DOTNET} ]]; then REQUIRED_USE="|| (${USE_DOTNET})"; fi;; +esac + +# Use flags added to IUSE + +IUSE+=" debug developer" +DEPEND+=" dev-util/msbuild" + +# >=mono-0.92 versions using mcs -pkg:foo-sharp require shared memory, so we set the +# shared dir to ${T} so that ${T}/.wapi can be used during the install process. +export MONO_SHARED_DIR="${T}" + +# Monodevelop-using applications need this to be set or they will try to create config +# files in the user's ~ dir. +export XDG_CONFIG_HOME="${T}" + +# Building mono, nant and many other dotnet packages is known to fail if LC_ALL +# variable is not set to C. To prevent this all mono related packages will be +# build with LC_ALL=C (see bugs #146424, #149817) +export LC_ALL=C + +# @FUNCTION: emsbuild_raw +# @DESCRIPTION: run msbuild with given parameters +emsbuild_raw() { + elog """$@""" + msbuild /p:MSBuildToolsPath=/usr/lib/mono/xbuild "$@" || die +} + +# @FUNCTION: emsbuild +# @DESCRIPTION: run msbuild with Release of Debug configuration depending on USE="debug" +emsbuild() { + if use debug; then + CARGS=/p:Configuration=Debug + else + CARGS=/p:Configuration=Release + fi + + if use developer; then + SARGS=/p:DebugSymbols=True + else + SARGS=/p:DebugSymbols=False + fi + + emsbuild_raw "${CARGS}" "${SARGS}" "$@" +} |