Fork me on GitHub

.pc-files

Gentoo Mono Handbook
PInvoke
pkg-config
https://en.wikipedia.org/wiki/Pkg-config
pkg-config files (*.pc) which are installed
allows the MonoDevelop IDE to find the bindings.
MonoDevelop does not look for assemblies in the GAC.
    http://www.monodevelop.com/help/faq/
On Mac and Linux, MonoDevelop uses pkg-config to locate installed packages and get the list of assemblies that each package provides. A package specifies this list of assemblies in a .pc file which has to be installed in the standard pkg-config directory.
The GAC is an assembly registry meant to be used at run-time, not at development time. If your application depends on another assembly, that assembly either has to be provided by a package (and advertised through a .pc file) or has to be bundled together with your application.
Assemblies you see when you choose Project + Add Reference is not created from the GAC. You should keep a copy of the assemblies stored in any location other than the GAC. Microsoft stores them in c:\windows\microsoft.net and c:\program files\reference assemblies. Using either the Project or the Browse tab is the most common way to add the reference or hack the registry.

Guide to pkg-config, Dan Nicholson, 2010
    https://people.freedesktop.org/~dbn/pkg-config-guide.html

Checklist for writing pkg-config files, Philip Withnall, 2014-12-09
    https://tecnocode.co.uk/2014/12/09/a-checklist-for-writing-pkg-config-files/

Debian policy for .pc files:
http://pkg-mono.alioth.debian.org/cli-policy/ch-packaging.html#s-pkg-config-file

Example of .pc file for some .dll:
# cat /usr/lib/pkgconfig/system-web.pc 
prefix=${pcfiledir}/../..
exec_prefix=${prefix}
libdir=${exec_prefix}/lib64
Name: system-web
Description: Framework for developing web-applications
Version: 4.6.0.150
Libs: -r:${libdir}/mono/system-web/System.Web.dll
Example of .ebuild piece ("<<-" operator of bash is used, see §3.6.6 Here Documents)
note, how $ sign is escaped inside of .pc-file content (it's highlighted with red color)

gac.eclass

gac.eclass contains einstall_pc_file bash function:
# @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 = myassembly.dll
example of usage:
dev-dotnet/conemu-control-winforms/conemu-control-winforms-1.0.0_p2016051802-r1.ebuild#L49
src_install()
{
	einstall_pc_file "${PN}" "${NAME}.dll"
}

Independent creation of .pc file

src_install()
{
	if use debug; then
		DIR="Debug"
	else
		DIR="Release"
	fi
	egacinstall "${S}/mcs/class/${NAME}/obj/${DIR}/${NAME}.dll"
	egacinstall "${S}/policy.4.0.System.Web.dll"
	install_pc_file "${PN}" "${NAME}.dll"
}

# The file format contains predefined metadata keywords and freeform variables (like ${prefix} and ${exec_prefix})
# $1 = ${PN}
# $2 = myassembly.dll
install_pc_file()
{
	if use pkg-config; then
		dodir /usr/$(get_libdir)/pkgconfig
		ebegin "Installing ${PC_FILE_NAME}.pc file"
		sed \
			-e "s:@LIBDIR@:$(get_libdir):" \
			-e "s:@PACKAGENAME@:$1:" \
			-e "s:@DESCRIPTION@:${DESCRIPTION}:" \
			-e "s:@VERSION@:${PV}:" \
			-e 's*@LIBS@*-r:${libdir}'"/mono/$1/$2"'*' \
			<<-EOF >"${D}/usr/$(get_libdir)/pkgconfig/$1.pc" || die
				prefix=\${pcfiledir}/../..
				exec_prefix=\${prefix}
				libdir=\${exec_prefix}/@LIBDIR@
				Name: @PACKAGENAME@
				Description: @DESCRIPTION@
				Version: @VERSION@
				Libs: @LIBS@
			EOF

		einfo PKG_CONFIG_PATH="${D}/usr/$(get_libdir)/pkgconfig/" pkg-config --exists "$1"
		PKG_CONFIG_PATH="${D}/usr/$(get_libdir)/pkgconfig/" pkg-config --exists "$1" || die ".pc file failed to validate."
		eend $?
	fi
}