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 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945
|
<!doctype debiandoc public "-//DebianDoc//DTD DebianDoc//EN"> <book>
<title>
Debian CLI Policy (DRAFT)
</title>
<author>
<name>Mirco Bauer</name>
<email>meebey@meebey.net</email>
</author>
<author>
<name>Brandon Hale</name>
<email>brandon@smarterits.com</email>
</author>
<author>
<name>Sebastian Dröge</name>
<email>slomo@ubuntu.com</email>
</author>
<author>
<name>Dylan R. E. Moonfire</name>
<email>debian@mfgames.com</email>
</author>
<version>
Version 0.4.2
</version>
<abstract>
This document lays out basic policies regarding packaging Mono, other
<qref id="CLR">CLRs</qref> and <qref id="CLI">CLI</qref> based applications/libraries on Debian GNU/Linux.
</abstract>
<copyright>
<copyrightsummary>
Copyright © 2005-2006 Mirco Bauer, Brandon Hale, Sebastian
Dröge and Dylan R. E. Moonfire.
</copyrightsummary>
<p>This manual is free software; you may redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.</p>
<p>This is distributed in the hope that it will be useful, but without
any warranty; without even the implied warranty of merchantability or
fitness for a particular purpose. See the GNU General Public License
for more details.</p>
<p>A copy of the GNU General Public License is available as
/usr/share/common-licenses/GPL in the Debian GNU/Linux distribution or
on the World Wide Web at the GNU General Public Licence. You can also
obtain it by writing to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA.</p>
</copyright>
<toc sect1>
<chapt id="history">
<heading>Policy History</heading>
<p>Here are the changes to the Debian CLI Policy document.</p>
<p>
Changes from 0.4.1 to 0.4.2:
<list>
<item><ref id="gac-policy-file-example">: Fixed naming of the policy
files</item>
</list>
</p>
<p>
Changes from 0.4.0 to 0.4.1:
<list>
<item><ref id="debhelper-example">: Fixed typo.</item>
</list>
</p>
<p>
Changes from 0.3.0 to 0.4.0:
<list>
<item><ref id="build-deps">: Added nemerle to the compilers.</item>
<item><ref id="packaging">: Added a packaging chapter that includes some of the old chapter and some new.</item>
<item><ref id="gac-library-packaging">: Added informations about signing and policy files.</item>
<item><ref id="dh_installcligac">: Added and consolidated the
information on <file>dh_installcligac</file>.</item>
<item><ref id="file-locations">: Require that files are installed into <file>/usr/lib/package</file> or <file>/usr/lib/cli/package-X.Y</file> now.</item>
</list>
</p>
<p>
Changes from 0.2.1 to 0.3.0:
<list>
<item><ref id=".NET">: Added URL for the ".NET" term.</item>
<item><ref id="GAC">: Added explanation of GAC.</item>
<item><ref id="gac-library-packaging">: Added section for naming of GAC packages.</item>
</list>
</p>
<p>
Changes from 0.2.0 to 0.2.1:
<list>
<item><ref id="cli-common-dev">: Added examples for debhelper and CDBS.</item>
</list>
</p>
<p>
Changes from 0.1.1 to 0.2.0:
<list>
<item><ref id="history">: Added chapter "Policy History"</item>
<item><ref id="build-deps">: Compiler dependency is no longer strict on
mono-mcs</item>
<item><ref id="cli-common-dev">: Note that dh_makeclilibs must be called before
dh_clideps</item>
<item><ref id="build-deps">: Moved dh_clideps and dh_makeclilibs into
their own subsections</item>
<item><ref id="file-perms">: Added chapter "File Permissions"</item>
<item><ref id="migrating">: cli-wrapper is now deprecated</item>
<item><ref id="dll-maps-intro">: Added an external link for
DllNotFoundException</item>
</list>
</p>
</chapt>
<chapt id="terms">
<heading>Used Terms</heading>
<p>
The ".NET" area uses its own set of abbreviations, which can
look confusing to other people.
This chapter lists some of the terms along with their explanations:
</p>
<sect id="CLI">
<heading>CLI - Common Language Infrastructure</heading>
<p>
This is what most people mean when they say ".NET".
The CLI defines mainly the virtual machine, the bytecode and how everything
works together. It is both an
<url id="http://www.iso.org/iso/en/CatalogueDetailPage.CatalogueDetail?CSNUMBER=36769" name="ISO">
and <url id="http://www.ecma-international.org/publications/standards/Ecma-335.htm" name="ECMA">
standard.
</p>
</sect>
<sect id="CLR">
<heading>CLR - Common Language Runtime</heading>
<p>
The CLR is an implementation of the <qref id="CLI">CLI</qref> (often with a lot of add-ons or tools
for developers). Mono and Microsoft .NET Framework are CLRs.
</p>
</sect>
<sect id="CIL">
<heading>CIL - Common Intermediate Language</heading>
<p>
The CIL is the format of the bytecode for binaries and libraries
used by the <qref id="CLI">CLI</qref>.
</p>
</sect>
<sect id=".NET">
<heading>".NET" or long "Microsoft .NET Framework"</heading>
<p>
The ".NET" word is a Microsoft marketing phrase and mostly is a
CLR with added Microsoft technologies like: ASP.NET, VB.NET,
System.Windows.Forms, Passport plus a lot of other things.
<p>
<p>
<strong>We highly discourage from using any form of the word ".NET", it is
burdened by copyright and marketing.</strong> We advice to use the correct
term instead, which is usually <qref id="CLI">CLI</qref>.
</p>
<p>
If you really want to use the ".NET" term in a correct form please refer to the
<url id="http://www.microsoft.com/about/legal/intellectualproperty/trademarks/usage/net.mspx" name="Microsoft .NET Guidelines">.
</p>
</sect>
<sect id="GAC">
<heading>GAC - Global Assembly Cache</heading>
<p>
The GAC contains and manages the libraries for the <qref id="CLR">CLR</qref>.
It allows users to install multiple versions of the same library and enables loading of
the right version when an application is executed.
</p>
<p>
Mono stores the GAC at <file>/usr/lib/mono/gac</file>
</p>
<p>
Portable.NET stores the GAC at <file>/usr/lib/cscc/lib</file>
</p>
</sect>
</chapt>
<chapt id="packaging">
<heading>Packaging Policy</heading>
<p>
This section describes the additions to the
<url id="http://www.debian.org/doc/debian-policy/" name="Debian Policy">
that are required for <qref id="CLI">CLI</qref> packages.
</p>
<sect id="general-packaging">
<heading>General Packaging</heading>
<sect1 id="architecture">
<heading>Architecture</heading>
<p>
For packages that consist of 100% managed code, "Architecture: all" <em>must</em> be chosen in debian/control.
</p>
<p>
Packages containing a mix of managed and native code <em>must</em> be "Architecure: any" or
depending on the specific package a more restricted set of architectures is valid.
</p>
</sect1>
<sect1 id="file-locations">
<heading>File Locations</heading>
<p>
The package's applications, libraries and meta-data <em>must</em> be installed into
<file>/usr/lib/packagename</file>.
<p>
<p>
Libraries that will be installed into the GAC <em>should</em> be installed into <file>/usr/lib/cli/packagename-X.Y</file>
(for more details about the X.Y version see <qref id="gac-naming-versioning">GAC versioning</qref>).
The commonly seen <file>/usr/lib/mono/packagename</file> path should <em>only</em> be used for Mono project packages.
</p>
<p>
Never install native "glue" libraries into <file>/usr/lib</file>, instead install them at
<file>/usr/lib/cli/packagename-X.Y</file>. When moving libraries
update the references to the new location using a DLL Map. See the
<qref id="dll-maps-intro">Mono DLL maps</qref> secion for an example.
</p>
<p>
The only exception here is for native libraries that are of wider use;
can be used other packages. Native libraries should be packaged according to the
<url id="http://www.netfort.gr.jp/~dancer/column/libpkg-guide/libpkg-guide.html"
name="Library Packaging Guide"> in a Debain Policy conformant way.
</p>
<p>
Never ever install application files (<file>.exe</file>) directly into <file>/usr/bin</file>.
Instead create a <qref id="wrapper-script-example">wrapper script</qref>
into <file>/usr/bin</file> to allow them to be run without the <file>.exe</file> suffix.
</p>
</sect1>
<sect1 id="file-perms">
<heading>File Permissions</heading>
<p>
Source code files (<file>*.cs</file>, <file>*.vb</file>, <file>*.boo</file>, etc.) should be non-executable.
</p>
<p>
Library files (<file>*.dll</file>) should be non-executable.
</p>
<p>
Debug symbol files (<file>*.mdb</file>) should be non-executable.
</p>
<p>
Assembly config files (<file>*.config</file>) should be non-executable.
</p>
<p>
Application files (<file>*.exe</file>) <em>must</em> have the executable flag (+x) set to enable
compatiblity with direct invokation as <file>./foo.exe</file> using Linux binfmt.
</p>
<p>
To ensure that the file permissions are correct, use the
following at the end of the install target in <file>debian/rules</file>:
<example>
find debian/ -type f -name "*.dll" -or -name "*.mdb" -or -name "*.cs" -or -name "*.config" | xargs chmod -x
find debian/ -type f -name "*.exe" | xargs chmod +x
</example>
</p>
</sect1>
<sect1 id="build-deps">
<heading>Build Dependencies</heading>
<p>
At a minimum, CLI packages <em>must</em> Build-Depends on
<package>cli-common-dev</package> (>= 0.4.0) and the
appropriate CLI compiler(s).
</p>
<p>
Current CLI compilers in Debian:
<list>
<item>
C#: <package>mono-mcs</package> (>= 1.0) | c-sharp-compiler
</item>
<item>
C# 2.0: <package>mono-gmcs</package> (>= 1.1.8) | c-sharp-2.0-compiler
</item>
<item>
Nemerle: <package>nemerle</package> (>= 0.9)
</item>
<item>
Boo: <package>boo</package> (>= 0.5.6)
</item>
</list>
</p>
<p>
Software that uses Mono via the C interface library
(<file>libmono.so</file>) or requires the
<file>/usr/lib/pkgconfig/mono.pc</file> file <em>must</em>
Build-Depends on libmono-dev (>= 1.0)
</p>
<p>
Note that there are architectures for which no <qref id="CLR">CLR</qref> is
available and thus you may have to restrict the Build-Depends for your
package to the architectures available.
</p>
<p>
If your package is <file>Architecture: all</file>, you should specify this as Build-Depends-Indep.
Never put <package>debhelper</package>, <package>cdbs</package> or <package>dpatch</package>
into Build-Depends-Indep. See the <url
id="http://www.debian.org/doc/debian-policy/ch-relationships.html#s-sourcebinarydeps"
name="Debian Policy Manual"> for more information on this.
</p>
</sect1>
</sect>
<sect id="gac-library-packaging">
<heading>GAC Library Packaging</heading>
<p>
Libraries that are installed into the <qref id="GAC">GAC</qref>
should provide decent ABI stability and be useful for other
packages. Otherwise, they should remain private to the package.
</p>
<sect1 id="gac-naming-versioning">
<heading>Naming & Versioning</heading>
<p>
Libraries that are installed into the <qref id="GAC">GAC</qref> <em>must</em> be
strong-named, i.e. <qref id="signing">signed</qref>.
</p>
<p>
Each of the libraries in the <qref id="GAC">GAC</qref> has
an assembly version number that consists of 4 parts (major, minor, build
and revision number). When loading libraries from the
<qref id="GAC">GAC</qref> all 4 parts and the public
signing key fingerprint must match.
</p>
<p>
It is general practice and <url
id="http://msdn.microsoft.com/netframework/programming/deployment/default.aspx?pull=/library/en-us/dndotnet/html/dplywithnet.asp#dplywithnet_version"
name="recommended by Microsoft">
that a library is ABI compatible when only the build and
revision number change and the major and minor number stay
the same.
</p>
<p>
To reflect the ABI stability and prevent breakages when a
ABI-incompatible version is released, a similar solution for
<url id="http://www.netfort.gr.jp/~dancer/column/libpkg-guide/libpkg-guide.html#naminglibpkg"
name="native library packages">
is used. The major and minor number <em>must</em> mirror
the SONAME version and the resulting package name should be
<package>libfooX.Y-cil</package>, where X is the major and
Y the minor number.
</p>
<p>
One notable exception for this naming are assemblies that
end on a number (Mono.C5 for example). In this case the
package should be named <package>libfoo123-X.Y-cil</package>
(i.e. <package>libmono-c5-0.5-cil</package>) to improve the
readability.
</p>
<p>
The <file>-cil</file> suffix is chosen to prevent confusion
with native library package names. Never use "sharp" in the package
name as it does not represent the language, and a <qref id="CLI">CLI</qref>
library can be used with all <qref id="CLI">CLI</qref> implemented / enabled
languages such as C#, Boo, Nemerle, J#, ASP.NET, VB.NET
(<url id="http://www.mono-project.com/Languages" name="full list">).
</p>
<p>
Unnecessary package renames should be avoided. Existing
package names that do not follow this policy should not be
renamed until the next incompatible ABI change when the new
naming scheme should be used.
</p>
<p>
If the upstream software does not use major and minor
number to reflect ABI stability or breaks ABI with a change
in build or revision, the package <em>must</em> be renamed to either
<package>libfooA.B.C-cil</package> or
<package>libfooA.B.C.D-cil</package>
(where A, B, C, D are the complete assembly version numbers),
depending at which point (major or minor) where the breakage occurred.
All <qref id="gac-policy-files">Policy Files </qref>
<em>must</em> be dropped at this stage until a new major or minor
version is released.
</p>
<p>
The upstream software may use wildcards in the assembly versions (1.2.* for example) which
are filled by the compiler with a random value. You <em>must</em> replace these wildcards
with 0 (1.2.0.0 in the example) to make it possible to use
<qref id="gac-policy-files">Policy Files</qref> and make predictable version numbers.
</p>
<p>
More than one library can be installed in one package but
it is required that they <em>must</em> all have the same
version and belong together.
</p>
</sect1>
<sect1 id="gac-policy-files">
<heading>Policy Files</heading>
<p>
As explained above a exact match of the version number is required
to load a library from the <qref id="GAC">GAC</qref>. To override this behaviour
and make different versions of ABI-compatible library packages really
ABI-compatible you have to use <url
id="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcreatingpublisherpolicyfile.asp"
name="Policy Files">. These files have to be named <file>policy.X.Y.foo.dll</file> (where X and Y
are the major and minor number of the assembly it should be compatible with),
it <em>must</em> be signed with the same signing key as the original assembly and it must be installed
into the <qref id="GAC">GAC</qref>. For information on how to create policy files
look at the previous Policy Files link or at the <qref id="gac-policy-file-example">example</qref>
below.
</p>
<p>
Overriding the <qref id="GAC">GAC</qref> policy should only
be done when the different library versions are really
ABI-compatible. You should also raise the version
in the <qref id="clilibs-control-file">clilibs control file</qref>
to the minimum version when new interfaces/classes/methods were added.
</p>
</sect1>
<sect1 id="clilibs-control-file">
<heading>clilibs Control File</heading>
<p>
The <file>clilibs</file> control file <em>MUST</em> be present in all <qref id="GAC">GAC</qref> library
packages. It can be created with the <qref id="dh_makeclilibs">dh_makeclilibs</qref>
helper script and has a format similar to the <file>shlibs</file> file created by <manref name="dh_makeshlibs" section="1">
and also has a similar use: it is used by
<qref id="dh_clideps">dh_clideps</qref>
helper script to find the correct dependencies.
</p>
<p>
You should always set the minimum required version of the library in the <file>clilibs</file> file.
</p>
</sect1>
<sect1 id="pkg-config-file">
<heading>pkg-config File</heading>
<p>
Many libraries deliver a <file>.pc</file> file for use by
the <file>pkg-config</file> helper utility, which aids
other libraries and applications to link against libraries.
</p>
<p>
All GAC library packages should have a pkg-config <file>.pc</file> file located in <file>/usr/lib/pkgconfig</file>.
The filename <em>must</em> be named: <file>package-X.Y.pc</file> including the versioning.
The version <em>must</em> reflect the same X.Y version as the package name.
There <em>should</em> also be a symlink without the version to the latest version, as follows:
from <file>package.pc</file> to <file>package-X.Y.pc</file>
</p>
</sect1>
<sect1 id="signing">
<heading>Signing</heading>
<p>
When installing libraries into the <qref id="GAC">GAC</qref> signing
is required. The signing key can either be supplied by upstream or you
have to create your own one using the <file>sn</file> utility. This
<em>must</em> be put into your source package and used for all following versions of the library.
</p>
</sect1>
</sect>
<sect id="non-gac-library-packaging">
<heading>non-GAC Library Packaging</heading>
<p>
This includes libraries that are not ABI-stable, may be not
strong-named and are usually in an early stage of
development. They <em>must</em> not include a clilibs control file.
</p>
<sect1 id="non-gac-naming">
<heading>Naming</heading>
<p>
The package should be named <file>libfoo-cil</file> (without a version in the package name)
and libraries should not be installed into the <qref id="GAC">GAC</qref> but only
into <file>/usr/lib/packagename</file>.
</p>
<p>
Applications using non-GAC libraries <em>must</em> copy the libraries they need into their own
application directory. You can compare this with static linking of native libraries.
</p>
</sect1>
</sect>
</chapt>
<chapt id="mono">
<heading>Mono Specific Packaging help</heading>
<p>
This section offers help with common problems encountered when
packaging Mono-specific applications for Debian.
</p>
<sect>
<heading>Naming</heading>
<p>
The official name of the Mono Project is: Mono, mono:: or mono.
To keep this consistent for users, it should
<em>always</em> be called "Mono" (not MONO, mono, mono:: or mixed
with the .NET name). The explanation of what Mono is, should be in
the package <em>long</em> description.
</p>
</sect>
<sect>
<heading>DLL Maps</heading>
<p>
Often times, upstream software developers are not
packagers, and vice versa. Developers do not necessarily test their
software with packaging issues in mind. The most common problem we
see from this are missing DLL exceptions.
</p>
<sect1 id="dll-maps-intro">
<heading>Introduction</heading>
<p>
When Mono code invokes an external library, it usually calls
something like [DllImport("foo")] which expands "foo" to
a shared library name such as "libfoo.so" which is then
searched for in the library search path.
</p>
<p>
In Debian and some other binary Linux distributions,
packages are split into runtime and developer (-dev)
packages. Since the versioned library libfoo.so.X is
usually used at runtime, and libfoo.so is a symlink only
used when building against the library, the libfoo.so
symlink is in the libfoo-dev package.
</p>
<p>
When packaging an application which uses libfoo.so normal
users should not need the -dev packages installed just to
run the application. However, Mono defaults to looking for
the unversioned libfoo.so, which is unavailable in the
runtime package.
</p>
<p>
When the DLL map is missing or upstream forgets to install
the DLL map, it will result in a
<url id="http://www.mono-project.com/DllNotFoundException" name="DllNotFoundException">
which will stop the execution of the program.
</p>
</sect1>
<sect1>
<heading>Solution: DLL map config file</heading>
<p>
This can be fixed by creating a DLL map for the application exe or
for the library DLL that is trying to invoke libfoo.so.
If libfoo.so is invoked by the DLL bar.dll, create an xml file,
bar.dll.config to tell Mono which .so should be loaded at runtime.
bar.dll.config should be installed to the same directory as bar.dll.
</p>
<p>
<example>
<configuration>
<dllmap dll="foo" target="libfoo.so.0"/>
</configuration>
</example>
</p>
<p>
A config file can contain as many dllmap directives as are needed.
If the upstream developer already ships a config file, but it is
incomplete, you should create a patch against it in your package.
</p>
<p>
Most Mono software developers are very helpful people, and will
readily accept patches to solve this type of bug if you bring it to
their attention. Please be sure to inform them of all these changes.
</p>
</sect1>
</sect>
<sect>
<heading>MONO_SHARED_DIR</heading>
<p>
The Mono runtime uses a shared directory, by default
<file>~/.wapi</file>. This directory will be created/used when any CLI
application is executed (like the C# compiler mcs).
</p>
<p>
There are 2 problems with this:
<list>
<item>In an autobuilder environment often the running user has no home directory.</item>
<item>Mono uses the wrong home directory when running within fakeroot
(it tries <file>/root/.wapi</file> instead of <file>$HOME/.wapi
</file>).</item>
</list>
</p>
<p>
In these cases, the package building will fail, applications
will hang, die with strange Mono runtime errors or segfault.
This includes dh_clideps or dh_makeclideps, since they run
monodis.
</p>
<p>
The solution is to set the MONO_SHARED_DIR environment variable
to a custom directory in the debian/rules file:
<example>
export MONO_SHARED_DIR=$(CURDIR)
</example>
</p>
<p>
The clean target should later remove the $(MONO_SHARED_DIR)/.wapi
directory.
For more information on what this .wapi directory is used for, please
see <manref name="mono" section="1">.
</p>
</sect>
</chapt>
<chapt id="pnet">
<heading>DotGNU Portable.NET Packaging help</heading>
<p>
This section offers help to common problems encountered when
packaging DotGNU Portable.NET-specific applications for Debian.
</p>
<sect>
<heading>Naming</heading>
<p>
The official name of the DotGNU Portable.NET project is exactly that.
To keep this consistent for users, it should be <em>always
</em> called "DotGNU Portable.NET" (not pnet or Portable.NET).
The explanation of what DotGNU Portable.NET is, should be in
the package <em>long</em> description.
</p>
</sect>
</chapt>
<chapt id="appendix">
<heading>Appendix</heading>
<sect id="cli-common-dev">
<heading>Helper Scripts: cli-common-dev</heading>
<p>
When using cli-common-dev and the included dh_* scripts packages <em>must</em>
Build-Depends on <package>cli-common-dev</package> (>= 0.4.0)
(this version may change later, when cli-common-dev has changes which
are required to be used by all CLI packages, the CLI Policy version will
represent such changes).
</p>
<sect1 id="dh_makeclilibs">
<heading>dh_makeclilibs</heading>
<p>
dh_makeclilibs is used to create the <qref id="clilibs-control-file">clilibs
control files</qref> which are used later by <file>dh_clideps</file> for this or other
packages. It <em>must</em> only be used when your package contains libraries
that other packages may link against.
</p>
<p>
It has the same use (and very similar parameters) to
<file>dh_makeshlibs</file>. You should always use the
most minimal version necessary.
</p>
<p>
<em>This program <em>must</em> be called before <file>dh_clideps</file>.</em>
</p>
<p>
See <manref name="dh_makeclilibs" section="1"> for details.
</p>
</sect1>
<sect1 id="dh_clideps">
<heading>dh_clideps</heading>
<p>
<file>dh_clideps</file> is used to discover the native and managed dependencies
of the packages. It uses the <qref id="clilibs-control-file">clilibs
control files</qref>, the <file>.config</file> of assemblies and the <file>shlibs</file>
files created by <file>dh_makeshlibs</file>. The discovered dependencies are written into the ${cli:Depends} variable.
</p>
<p>
<em><file>dh_shlibdeps</file> must be run before
<file>dh_clideps</file>. <file>dh_makeshlibs</file> and
<file>dh_makeclilibs</file> must be run before
<file>dh_clideps</file></em>. If not, when two binary
packages from the same source package depend on one
another, <file>dh_clideps</file> will not be able to
determine the dependencies.
</p>
<p>
<file>dh_clideps</file> can remove duplicate dependencies
created by running <file>dh_clideps</file> and
<file>dh_shlibsdeps</file> when run given the -d parameter.
</p>
<p>
See <manref name="dh_clideps" section="1"> for details.
</p>
</sect1>
<sect1 id="dh_installcligac">
<heading>dh_installcligac</heading>
<p><file>dh_installcligac</file> is used to facilitate the
installation of strong-named assemblies into the various
caches installed on the user's machine. Its primary purpose is
to install the assemblies at the point of installation instead
of pre-packing them inside the Debian package; this is also
known as late-GAC install.</p>
<p>To identify which assemblies need to be installed into the
GAC, <file>dh_installcligac</file> uses the
<file>debian/installcligac</file> or the
<file>debian/packagename.installcligac</file> to list the
assemblies to install or uninstall at installation or removal
respectivly.</p>
<p>The file format of the <file>installcligac</file> is
simple: the full installed path of every assembly to install
into the <qref id="GAC">GAC</qref>. For example, the
liblog4net1.2-cil package would have this in the
<file>debian/installcligac</file> file:
<example>/usr/lib/cli/log4net-1.2/log4net.dll</example>
</p>
<p>As a note, the use of <file>dh_installcligac</file> is not
required by the current policy, but may become so in later
versions. It is primarily intended to make it easier to
install assemblies and to allow more than one CLR co-exist at
the same time.</p>
<p><file>dh_installcligac</file> needs to be called after
<file>dh_install</file> and before <file>dh_makeclilibs</file>
and <file>dh_clideps</file>. See <manref
name="dh_installcligac" section="1"> for details.</p>
</sect1>
</sect>
<sect id="examples">
<heading>Examples</heading>
<sect1 id="debhelper-example">
<heading>debhelper Example</heading>
<p>
For binary-arch packages:
<example>
binary-arch: build install
...
dh_shlibdeps -a
dh_makeclilibs -a -V
dh_clideps -a -d
dh_installcligac -a
...
</example>
For binary-indep packages:
<example>
binary-indep: build install
...
dh_makeclilibs -i -V
dh_clideps -i
dh_installcligac -i
...
</example>
</p>
</sect1>
<sect1 id="cdbs-example">
<heading>cdbs Example</heading>
<p>
<example>
common-binary-predeb-arch common-binary-predeb-indep::
dh_shlibdeps
dh_makeclilibs -V
dh_clideps -d
dh_installcligac
</example>
</p>
</sect1>
<sect1 id="wrapper-script-example">
<heading>Executable Wrapper Script Example</heading>
<p>
<example>
#!/bin/sh
exec /usr/bin/cli /usr/lib/package/package.exe "$@"
</example>
</p>
</sect1>
<sect1 id="api-compat-example">
<heading>API Compatibility Check Example</heading>
<p>
You need to install following packages for this example: mono-mcs libmono-sharpzip0.6-cil libmono-sharpzip0.84-cil
<example>
mono-api-check /usr/lib/mono/gac/ICSharpCode.SharpZipLib/0.6.0.0__1b03e6acf1164f73/ICSharpCode.SharpZipLib.dll \
/usr/lib/mono/gac/ICSharpCode.SharpZipLib/0.84.0.0__1b03e6acf1164f73/ICSharpCode.SharpZipLib.dll
CLI API Check
Assembly Name: ICSharpCode.SharpZipLib
Missing Interfaces: 44
Additional Interfaces: 79
The two assemblies you compared are not API compatible!
You must use a new package name!
The new assembly has additional interfaces. You must raise
the minimal version in clilibs!
</example>
The mono-api-check wrapper script checks whether there are new public/protected interfaces (where interface
in this context means namespace, class, method, interface, delegate, etc) or any missing ones. When an interface
is changed it will show up as missing and additional. You should follow the instructions, in this case you must
create a new versioned package for the library and raise the minimal version number for the
<qref id="dh_makeclilibs">dh_makeclilibs</qref> call.
</p>
</sect1>
<sect1 id="gac-policy-file-example">
<heading>GAC Policy File Example</heading>
<p>
<example>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="foo" publicKeyToken="35e10195dab3c99f" />
<bindingRedirect oldVersion="1.2.0.0-1.2.10.0" newVersion="1.3.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
</example>
The above example would be used for a policy file for the "foo" assembly and would tell
the <qref id="GAC">GAC</qref> that version 1.3.0.0 is compatible with versions 1.2.0.0 to 1.2.10.0.
You have to compile and install it with
<example>
al -link:policy.1.2.foo.config -out:policy.1.2.foo.dll -keyfile:path/to/keyfile
gacutil /i policy.1.2.foo.dll
</example>
</p>
<p>
Keep in mind that the filenames <em>must</em> be
policy.X.Y.foo.config and policy.X.Y.foo.dll where
foo is the assembly name and X.Y is the major and minor version
number you want to be compatible with.
</p>
</sect1>
</sect>
<sect id="migrating">
<heading>Migrating Existing Packages</heading>
<p>
Many CLI packages already exist in Debian, or are in ITP, and conform to
the deprecated <url id="http://wiki.debian.net/?MonoConventions"
name="Mono Conventions">.
</p>
<p>
Any <file>debian/rules</file> hacks or patches that exist to redirect
files to <file>/usr/share/dotnet</file> should be removed, and adjusted
according to upstream file locations (<file>/usr/lib</file>). See
<url id="http://wiki.debian.net/?MonoDebianPlan" name="Mono Debian Plan">
for the rationale behind this change.
</p>
<p>
Also, be sure to replace references to dh_netdepends, dh_makenetlibs, and
${net:Depends} with the newer names described in the policy above.
</p>
<p>
Please remove any build-deps on <package>mono-jit</package>,
<package>mono-mint</package>, <package>mono-utils</package> (this one had
the dh_* helper scripts which are now in <package>cli-common</package>)
and <package>libmono-dev</package> (use this one only if the package
really links against <package>mono</package> or requires the mono.pc
file).
</p>
<p>
Do not use cli-wrapper (<file>/usr/bin/cli-wrapper</file>).
It is deprecated and will be removed soon!
Either use the upstream shell
script to invoke the application or write one, which calls
<file>/usr/bin/cli</file>
</p>
</sect>
</chapt>
</book>
|