-
Notifications
You must be signed in to change notification settings - Fork 0
/
pc-files.htm
142 lines (134 loc) · 5.53 KB
/
pc-files.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8" />
<title>.pc-files</title>
</head>
<body><a href="https://github.com/ArsenShnurkov/gentoo-mono-handbook"><img alt="Fork me on GitHub" id="forkme" src="images/forkme.png" align="right" width="100" /></a>
<table><tr><td style="vertical-align:top;">
<h1>.pc-files</h1>
</td><td style="vertical-align:top;">
<a href="index.htm">Gentoo Mono Handbook</a>
<br />
<a href="pinvoke.htm">PInvoke</a>
<br />
<a href="pkg-config/index.htm">pkg-config</a>
<br />
<a href="https://en.wikipedia.org/wiki/Pkg-config">https://en.wikipedia.org/wiki/Pkg-config</a>
</td></tr></table>
pkg-config files (*.pc) which are installed
<br />
allows the MonoDevelop IDE to find the bindings.
<br />
MonoDevelop does not look for assemblies in the GAC.
<br />
<a href="http://www.monodevelop.com/help/faq/">http://www.monodevelop.com/help/faq/</a>
<br />
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.
<br />
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.
<br />
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.
<br />
<br />
Guide to pkg-config, Dan Nicholson, 2010
<br />
<a href="https://people.freedesktop.org/~dbn/pkg-config-guide.html">https://people.freedesktop.org/~dbn/pkg-config-guide.html</a>
<br />
<br />
Checklist for writing pkg-config files, Philip Withnall, 2014-12-09
<br />
<a href="https://tecnocode.co.uk/2014/12/09/a-checklist-for-writing-pkg-config-files/">https://tecnocode.co.uk/2014/12/09/a-checklist-for-writing-pkg-config-files/</a>
<br />
<br />
Debian policy for .pc files:
<br />
<a href="http://pkg-mono.alioth.debian.org/cli-policy/ch-packaging.html#s-pkg-config-file">http://pkg-mono.alioth.debian.org/cli-policy/ch-packaging.html#s-pkg-config-file</a>
<br />
<br />
Example of .pc file for some .dll:
<pre>
# 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
</pre>
Example of .ebuild piece ("<<-" operator of bash is used, see <a href="https://www.gnu.org/software/bash/manual/bash.html">§3.6.6 Here Documents</a>)
<br />
note, how $ sign is escaped inside of .pc-file content (it's highlighted with red color)
<br />
<h2>gac.eclass</h2>
gac.eclass contains <a href="https://github.com/gentoo/dotnet/blob/91dd57dca99c01b951b87d22e23e13e32a5f084f/eclass/gac.eclass#L63-L93">einstall_pc_file</a> bash function:
<br />
<pre>
# @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</pre>
example of usage:
<br />
<a href="https://github.com/gentoo/dotnet/blob/a0ce339bbffbff02f393d80c6bd58746c012f2c7/dev-dotnet/conemu-control-winforms/conemu-control-winforms-1.0.0_p2016051802-r1.ebuild#L49">dev-dotnet/conemu-control-winforms/conemu-control-winforms-1.0.0_p2016051802-r1.ebuild#L49</a>
<br />
<pre>
src_install()
{
einstall_pc_file "${PN}" "${NAME}.dll"
}
</pre>
<h2>Independent creation of .pc file</h2>
<pre>
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"'*' \
<font style="color:red"><<-</font>EOF >"${D}/usr/$(get_libdir)/pkgconfig/$1.pc" || die
prefix=<font style="color:red">\$</font>{pcfiledir}/../..
exec_prefix=<font style="color:red">\$</font>{prefix}
libdir=<font style="color:red">\$</font>{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
}
</pre>
</body>
</html>