📄 package.sgml
字号:
C or C++ source file that can be compiled with the package's set ofcompiler flags and linked like any application program. Each test caseshould use the testing API defined by the infrastructure. Amagically-named calculated configuration option of the form<varname>CYGPKG_<PACKAGE-NAME>_TESTS</varname> lists the testcases.</para></sect2><!-- }}} --><!-- {{{ Host tools --><sect2 id="package.host"><title>Host-side Support</title><para>On occasion it would be useful for an &eCos; package to be shippedwith host-side support. This could take the form of an additional toolneeded to build that package. It could be an application intended tocommunicate with the target-side package code and display monitoringinformation. It could be a utility needed for running the package testcases, especially in the case of device drivers. The componentframework does not yet provide any such support for host-sidesoftware, and there are obvious issues related to portability to thedifferent machines that can be used for hosts. This issue may getaddressed in some future release. In some cases custom build steps canbe subverted to do things on the host side rather than the targetside, but this is not recommended.</para></sect2><!-- }}} --></sect1><!-- }}} --><!-- {{{ Package Distributions --><sect1 id="package.distrib"><title>Making a Package Distribution</title><para>Developers of new &eCos; packages are advised to distribute theirpackages in the form of &eCos; package distribution files. Packagesdistributed in this format may be added to existing &eCos; componentrepositories in a robust manner using the Package Administration Tool.This chapter describes the format of package distribution files anddetails how to prepare an eCos package for distribution in this format.</para><sect2 id="package.distrib.format"><title>The &eCos; package distribution file format</title><para>eCos package distribution files are gzipped GNU tar archives whichcontain both the source code for one or more &eCos; packages and adata file containing package information to be added to the componentrepository database. The distribution files are subject to thefollowing rules:</para><orderedlist numeration="Loweralpha"><listitem><para>The data file must be named <filename>pkgadd.db</filename> and must belocated in the root of the tar archive. It must contain data in aformat suitable for appending to the eCos repository database(<database>ecos.db</database>). <xref linkend="language.database">describes this data format. Note that a database consistency check isperformed by the &eCos; Administration Tool when<filename>pkgadd.db</filename> has been appended to the database. Anynew target entries which refer to unknown packages will be removed atthis stage.</para></listitem><listitem><para>The package source code must be placed in one or more <filenameclass="directory"><package-path>/<version></filename>directories in the tar archive, where each <package-path>directory path is specified as the directory attribute of one of thepackages entries in <filename>pkgadd.db</filename>.</para></listitem><listitem><para>An optional license agreement file named<filename>pkgadd.txt</filename> may be placed in the root of the tararchive. It should contain text with a maximum line length of 79characters. If this file exists, the contents will be presented to theuser during installation of the package. The &eCos; PackageAdministration Tool will then prompt the user with the question<prompt>"Do you accept all the terms of the preceding licenseagreement?"</prompt>. The user must respond<userinput>"yes"</userinput> to this prompt in order to proceed withthe installation.</para></listitem><listitem><para>Optional template files may be placed in one or more <filenameclass="directory">templates/<template_name></filename>directories in the tar archive. Note that such template files would beappropriate only where the packages to be distributed have a complexdependency relationship with other packages. Typically, a third partypackage can be simply added to an eCos configuration based on anexisting core template and the provision of new templates would not beappropriate. <xref linkend="advanced.templates"> contains moreinformation on templates.</para></listitem><listitem><para>The distribution file must be given a <filename>.epk</filename> (not<filename>.tar.gz</filename>) file extension. The<filename>.epk</filename> file extension serves to distinguish &eCos;package distributions files from generic gzipped GNU tar archives. Italso discourages users from attempting to extract the package from thearchive manually. The file browsing dialog of the &eCos; PackageAdministration Tool lists only those files which have a<filename>.epk</filename> extension.</para></listitem><listitem><para>No other files should be present in the archive.</para></listitem><listitem><para>Files in the tar archive may use <literal>LF</literal> or<literal>CRLF</literal> line endings interchangably. The &eCos;Administration Tool ensures that the installed files are given theappropriate host-specific line endings.</para></listitem><listitem><para>Binary files may be placed in the archive, but the distribution ofobject code is not recommended. All binary files must be given a<literal>.bin</literal> suffix in addition to any file extension theymay already have. For example, the GIF image file<filename>myfile.gif</filename> must be named<filename>myfile.gif.bin</filename> in the archive. The<filename>.bin</filename> suffix is removed during file extraction andis used to inhibit the manipulation of line endings by the &eCos;Administration Tool.</para></listitem></orderedlist></sect2><sect2 id="package.distrib.prepare"><title>Preparing eCos packages for distribution</title><para>Development of new &eCos; packages or new versions of existing &eCos;packages will take place in the context of an existing &eCos;component repository. This section details the steps involved inextracting new packages from a repository and generating acorresponding &eCos; package distribution file for distribution of thepackages to other &eCos; users. The steps required are as follows:</para><orderedlist numeration="Loweralpha"><listitem><para>Create a temporary directory <filenameclass="directory">$PKGTMP</filename> for manipulation of the packagedistribution file contents and copy the source files of the newpackages into this directory, preserving the relative path to thepackage. In the case of a new package at <filenameclass="directory">mypkg/current</filename> in the repository:</para><screen width=72> $ mkdir -p $PKGTMP/mypkg $ cp -p -R $ECOS_REPOSITORY/mypkg/current $PKGTMP/mypkg</screen><para>Where more than one package is to be distributed in a single packagedistribution file, copy each package in the above manner. Note thatmultiple packages distributed in a single package distribution filecannot be installed separately. Where such flexibility is required,distribution of each new package in separate package distribution filesis recommended.</para></listitem><listitem><para>Copy any template files associated with the distributed packages intothe temporary directory, preserving the relative path to the template.For example:</para><screen width=72> $ mkdir -p $PKGTMP/templates $ cp -p -R $ECOS_REPOSITORY/templates/mytemplate $PKGTMP/templates</screen></listitem><listitem><para>Remove any files from the temporary directory hierarchy which you donot want to distribute with the packages (eg object files, <filenameclass="directory">CVS</filename> directories).</para></listitem><listitem><para>Add a <filename>.bin</filename> suffix to the name of any binaryfiles. For example, if the packages contains GIF image files (*.gif)for documentation purposes, such files must be renamed to *.gif.bin asfollows:</para><screen width=72> $ find $PKGTMP -type f -name '*.gif' -exec mv {} {}.bin ';'</screen><para>The <filename>.bin</filename> suffix is removed during file extractionand is used to inhibit the manipulation of line endings by the eCosPackage Administration Tool.</para></listitem><listitem><para>Extract the package records for the new packages from the packagedatabase file at <database>$ECOS_REPOSITORY/ecos.db</database> andcreate a new file containing these records at<filename>$PKGTMP/pkgadd.db</filename> (in the root of the temporarydirectory hierarchy). Any target records which reference thedistributed packages must also be provided in pkgadd.db.</para></listitem><listitem><para>Rename the version directories under <filenameclass="directory">$PKGTMP</filename> (typically <filenameclass="directory">current</filename> during development) to reflectthe versions of the packages you are distributing. For example,version 1.0 of a package may use the version directory name <filenameclass="directory">v1_0</filename>:</para><screen width=72> $ cd $PKGTMP/mypkg $ mv current v1_0</screen><para><xref linkend="package.versions"> describes the version namingconventions.</para></listitem><listitem><para>Rename any template files under <filenameclass="directory">$PKGTMP</filename> (typically<filename>current.ect</filename> during development) to reflect theversion of the template you are distributing. For example, version 1.0of a template may use the filename <filename>v1_0.ect</filename>:</para><screen width=72> $ cd $PKGTMP/templates/mytemplate $ mv current.ect v1_0.ect</screen><para>It is also important to edit the contents of the template file, changingthe version of each referenced package to match that of the packages youare distributing. This step will eliminate version warnings during thesubsequent loading of the template.</para></listitem><listitem><para>Optionally create a licence agreement file at<filename>$PKGTMP/pkgadd.txt</filename> containing the licensing termsunder which you are distributing the new packages. Limit each line inthis file to a maximum of 79 characters.</para></listitem><listitem><para>Create a GNU tar archive of the temporary directory hierarchy. Byconvention, this archive would have a name of the form<filename><package_name>-<version></filename>:</para><screen width=72> $ cd $PKGTMP $ tar cf mypkg-1.0.tar *</screen><para>Note that non-GNU version of tar may create archive files which exhibitsubtle incompatibilities with GNU tar. For this reason, always use GNUtar to create the archive file.</para></listitem><listitem><para>Compress the archive using gzip and give the resulting file a<filename>.epk</filename> file extension:</para><screen width=72> $ gzip mypkg-1.0.tar $ mv mypkg-1.0.tar.gz mypkg-1.0.epk</screen><para>The resulting eCos package distribution file (*.epk) is in a compressedformat and may be distributed without further compression.</para></listitem></orderedlist></sect2></sect1><!-- }}} --></chapter>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -