Cygwin Home
Red Hat Cygwin Product
Mailing Lists
Documentation
  • FAQ (Frequently Asked Questions)
  • User's Guide
  • API Reference
  • Contributing
  • Snapshots
  • Source in CVS
  • Bug Reporting
  • Cygwin DLL To-Do List
  • Cygwin Packages
  • Software
  • setup.exe Package Listing
  • XFree86
  • Related Sites
  • General Info
  • Who are we?
  • Mirror Sites
  • Licensing Terms
  • News
    sources.redhat.com

    Cygwin Package Contributors Guide

    This document is intended for people who post packages to sources.redhat.com, and thus need to make them available through the standard Cygwin setup program. This documents the syntax of the setup.ini file, the program that automatically generates it on a regular basis, the layout required for packages, and the related policies to ensure good behaviour from the setup.exe program.

    Setup depends on certain conventions being followed. If they are not followed, bad things may happen to the users of setup.exe. Where a convention can be ignored, should circumstances warrent, this document will specify that.

    The mailing list cygwin-apps@cygwin.com is the correct place to discuss any package creation or maintenance issues. It is not a place for end user bug reports - direct those to cygwin at cygwin dot com instead.

    Contents

    Package file naming

    Package naming scheme: use the vendor's version plus a release suffix for ports of existing packages (i.e. bash 2.04 becomes 2.04-1, 2.04-2, etc, until bash 2.05 is ported, which would be 2.05-1, etc). Some packages also use a YYMMDD format for their versions, e.g. binutils-20010901-1.tar.bz2. The first release of a package should have a -1 release suffix.

    A complete package currently consists of three files:

    • a binary tar file
    • a source tar file
    • a setup.hint file

    Binary tar files are named "package-version-release.tar.bz2". They generally contain the executable files that will be installed on a user's system plus any auxilliary files needed by the package. See the making packages section below for more details on how to generate a binary tar file.

    Source tar files are named "package-version-release-src.tar.bz2". Source tar files should contain the source files needed to rebuild the package. While installing these files is optional under setup.exe, the inclusion of a source tar file is part of the totality that makes up a cygwin package and so, these files are not optional. See the making packages section below for more details on the contents of a -src tar file..

    The setup.hint file is discussed below.

    Automatic setup.ini generation on sources.redhat.com

    A script runs on sources.redhat.com which collects information from (currently) the release directory in the ftp download area. Information from subdirectories of these directories is parsed to automatically generate the default setup.ini file which is used by the cygwin setup.exe program for installation control. If you are responsible for maintaining a cygwin package, it is important that you understand how this process works.

    Packages are grouped by directory under release. The directory name is the same as the package name. For example, the boffo package will live in the boffo subdirectory. Exceptions to this rule are historical. All new packages will follow the rule of package name == directory name. However, for closely related groups of packages, it is acceptable to use a heirarchical tree under release/:

    
      release/
      release/boffo/
      release/boffo/<boffo files>
      release/boffo/boffo-devel/
      release/boffo/boffo-devel/<boffo-devel file>
    

    Each directory contains source and binary tar files which have been been compressed using bzip2. The required format of these filenames is: package-version-release[-src].tar.bz2 . The contents of these files is discussed below.

    The "package" part of the filename is the name mentioned above.

    The version number must start with a digit and must adhere to the rules in package file naming above. Higher version (and release) numbers are used for the current version of a package; the previous stable version (if any) is used for the previous version (however see setup.hint for exceptions to this rule). Lexically, when two packages have identical vendor version numbers, the one with the higher release number is considered newer. Also, given two packages, the one with the higher vendor version number is always considered newer, regardless of the release number.

    The -src component of the filename is added to files which contain source code.

    A complete "package" is made up of three files: the "binary" package tar file, the "source" tar file, and the "setup.hint" file, e.g.:

    bash$ ls release/boffo
    boffo-1.0-1.tar.bz2  boffo-1.0-1-src.tar.bz2  setup.hint
    

    Setup is currently unable to list more than three versions of each package. Therefore you should not keep more than three versions of each package around: The current version, the previous stable version, and, optionally, one test version. By keeping a previous stable version around, you isolate yourself (somewhat) from problems with partial mirrors. When you add a new "current" version, you can either keep the old "previous" version, or make the old current version the new previous version, depending on how stable they each were.

    Test versions are specified via the setup.hint file as described below. It is not required that your package have a test version. Use of a test version of a package is at the discretion of the package maintainer.

    Note that currently some files in the distribution are gzipped. Use of gzip for file compression is deprecated, however. New package submissions must be bzip2'ed.

    setup.hint

    Each package must be submitted with a file called setup.hint. This file is used for information that cannot be inferred just from the context of the file name or package name. Lines in setup.hint will consist of one of the following:

    # comment
    @ package
    sdesc: "some text"
    ldesc: "some text"
    skip:
    curr: version
    prev: version
    test: version
    category: name1[ name2...]
    requires: package[ package...]
    

    (You may see some older setup.hint files which lack the colons after the introducing field. This usage is allowed but deprecated. Please use colons in your setup.hint for everything but '#' and "@'.)

    Lines that begin with '#' are considered to be comments and are ignored by the setup.ini generator.

    A line that begins with a "@" behaves similarly to the setup.ini field (see below). It overrides the package name for the enclosing directory. This is an optional entry. It is intended only for historical packages where the package name is different from the name of the directory in which the package resides. This should not be necessary for "modern" setup.hint files.

    The curr, prev, and test lines indicate which versions should be used for which sections of that package. Use these settings only if you need to circumvent the normal intuitive version numbering scheme.

    Use of curr and prev is usually not required since the setup.ini generator does a good job of figuring out version number ordering. So, e.g., if you had previously released boffo-0.9-1 and now have a new boffo-1.0-1, the version numbering is obvious and there is no need to use curr or prev. It is obvious that boffo-1.0-1 is newer than boffo-0.9-1 and the setup.ini generator will do the right thing in this case.

    However, if you had discovered a serious error in the boffo-1.0 release, and then decided that you want to drop back to boffo-0.9-1, you could include entries like this:

    prev: 1.0-1
    curr: 0.9-1
    
    This usage should be rare, however.

    In general, you should trust the automatic setup.ini generator to "do the right thing" -- with one exception. If you decide that you need to release a test version of your package, there is no way for the setup.ini generator to know that.

    So, you will have to put something like "test: 1.9-1" in your setup.hint file. This will cause setup.exe to characterize the 1.9-1 version as a "test" package. With the current setup.exe implementation, it will also mean that it will be overlooked by most people during installation. So, unless you have made arrangements to advertise your test release, this option should be used sparingly.

    Note that if any of the curr, prev, or test options are used, they will short circuit all of the automatic version detection used for generating setup.ini. So, if you include a test option, and you have valid current and/or previous tar files, you must specify curr and/or prev. Otherwise, the only version that setup.exe will display will be the test version.

    For example, if your setup.hint looks like this:

    test: 1.9-1
    
    then setup.ini will not contain the 0.9-1 or 1.0-1 versions.

    If you want all of the versions included, you must do this:

    prev: 0.9-1
    curr: 1.0-1
    test: 1.9-1
    

    The skip line indicates that that package should not appear in setup.ini. It is intended for directories that exist in the hierarchy that should not be considered for inclusion in setup.ini.

    sdesc and ldesc are both mandatory fields for setup.hint. Your package must contain these fields. In particular, the sdesc field is required for correct operation of setup.exe.

    sdesc is a one line description of the package. This is the information that will be displayed when installing packages via setup.exe.

    ldesc is a more descriptive, multi-line description of the package, intended for future use in setup.exe.

    Please note that the package name should not be part of the description, e.g., this is incorrect:
    sdesc:	"boffo: A whackamole simulation in ASCII art"
    
    This is correct:
    sdesc:	"A whackamole simulation in ASCII art"
    

    Quote text that takes up several lines e.g.:

    ldesc: "A whackamole simulation in ASCII art.
    Intended for use on VT100 terminals at BAUD rates 1200 and
    above.	Uses arrow keys for positioning over moles.  Space
    bar whacks the mole.
    
    No actual moles will be harmed during execution of this game."
    

    The category line indicates the categories that this package belongs to. One package can belong to multiple categories. Multiple categories are separated by spaces.

    Do no enclose multiple category names within quotation marks.

    Please do not invent a new category without checking with the cygwin-apps mailing list first. As of this writing, the current categories are:

    Admin Archive Base Database Devel
    Doc Editors Games Graphics Interpreters
    Libs Mail Math Net Shells
    System Text Utils Web

    As you can see, currently, all categories consist of only a single word. We don't anticipate that this will change anytime soon. However, with the use of quotes, setup.exe will understand category names which contain spaces, for example:

    category: "ASCII Games"

    The above would place a package in a single category called "ASCII Games" rather than two categories "ASCII" and "Games".

    The requires line indicates the packages that this package relies on. If your package is dependent on a file provided by another package that other package should be included here. The requires field may be missing or empty if your package truly does not require any other package.

    A package will probably require the cygwin package if it contain any DLLs or executable files since the cygwin package contains cygwin1.dll, which is required for most programs. However, the cygwin package would not be a required dependency for a package which contained only text files, as is the case with, for example, packages that consist entirely of man pages.

    A package can rely on multiple other packages. Hierarchical dependencies should work correctly, however, it is best to always include specific dependencies, i.e., don't drop 'bar' from your dependency list if your package requires it, even if you are including 'foo' which relies on 'bar'.

    Conversely, do not include package dependencies of dependent packages in your dependency list. If you think that another package has an incorrect dependency list, send email to cygwin-apps noting that fact.

    Multiple packages are separated by spaces. Do not enclose multiple package names within quotation marks.

    Here's an example of a complete release/boffo/setup.hint:

    
        category: Games Text
        requires: libncurses6 cygwin
        sdesc:    "A whackamole simulation in ASCII art"
        ldesc:    "A whackamole simulation in ASCII art.
        Intended for use on VT100 terminals at BAUD rates 1200 and
        above.  Uses arrow keys for positioning over moles.  Space
        bar whacks the mole.
    
        No actual moles will be harmed during execution of this game."
    
    

    Notice that we didn't use the prev, curr, test, or @ options. Instead, we relied on the automatic setup.ini generator to do as much as possible for us.

    setup.ini

    Note that setup.ini is automatically generated. This section is for completeness, not instruction.

    Setup reads a file called setup.ini that resides on all cygwin FTP mirrors. There are a two global parameters in this file, followed by a list of packages. Any line beginning with # is ignored by setup and can be used to add commentary to the file at any point.

    setup-timestamp: number

    This line is at the beginning of all setup.ini files. It indicates the time that the setup.ini file was created. Its only purpose is to warn the user when the timestamp is less than the last setup.ini used; i.e. it prevents accidental regression. Use "perl -e 'print time'" to get a timestamp.

    setup-version: number

    This line follows the setup-timestamp in all setupl.ini files. It indicates the version number of the setup.exe for which this setup.ini was generated.

    @ package

    Lines beginning with the "at" symbol indicate the start of a package section. Each package consists of a name, one or more descriptive texts, package categories, package requirements, and up to three version definitions.

    sdesc: "some text"

    This is the "short description" of the package. This text, if available, accompanies the package name in package listings.

    ldesc: "some text"

    This is the "long description" of the package. This text, if available, is used as a supplimental description of the package.

    category: name1[ name2...]

    The category line indicates the categories that this package belongs to. One package can belong to multiple categories. Multiple categories are separated by spaces. See the description of categories in setup.hint above for more information on categories.

    requires: package[ package...]

    The requires line indicates the packages that this package belongs to. A package can rely on multiple packages. Multiple packages are separated by spaces.

    [curr]
    [prev]
    [test]

    These indicate the start of a version description within a package. Note that [curr] is the default and may be omitted if that version happens to be specified before the others. "Curr" indicates the current stable (preferred) version, "prev" is the previous stable version, and "test" indicates a test or experimental version.

    version: version

    Indicates the version of the package. This is currently derived from the name of the package.

    install: filename size-in-bytes

    Indicates the file to install for that version, and its size in bytes. The file name must include the full path (relative to setup.ini's directory), and the file size must match the actual file size (setup uses this to verify it got the whole file).

    source: filename size-in-bytes

    Like the file to install, this is the corresponding sources.

    Example

    setup-timestamp: 967844652
    
    @ cygwin
    sdesc: Cygwin Runtime
    ldesc: A Posix runtime emulator for Windows platforms
    version: 1.1.4
    install: release/cygwin/cygwin-1.1.4.tar.bz2 1234567
    source: release/cygwin/cygwin-1.1.4.tar.bz2 1341245
    [prev]
    version: 1.1.3
    install: release/cygwin/cygwin-1.1.3.tar.bz2 1234580
    source: release/cygwin/cygwin-1.1.3.tar.bz2 1341123
    
    @ bash
    [test]
    version: 20000901
    install: release/bash/bash-20000901.tar.bz2 276403
    source:  release/bash/bash-20000901-src.tar.bz2 1892899
    [curr]
    version: 2.04
    install: release/bash/bash-2.04.tar.bz2 277375
    source:  release/bash/bash-2.04-src.tar.bz2 1815177
    
    

    Making Packages

    The files paths within both the -src and the binary package files are quite important. Since setup.exe extracts into a predetermined directory, you must structure your package contents accordingly.

    The following requirements avoid problems that have occured in the past with packages. Thus only skip them if you *know* your package will not recreate that prior problem.

    • Binary packages are extracted in /, include all file paths from the root in your archive, e.g.:
        usr/bin/boffo.exe
        usr/share/boffo/boffo.dat
        etc...
    • The package is configured using (at a minimum) the following paths:
        --prefix=/usr
        --sysconfdir=/etc
        --libexecdir='$(sbindir)'
        --localstatedir=/var
        --datadir='$(prefix)/share'
    • All executables in your binary package are stripped (run 'strip' on them). Some makefiles have a install-strip command you can use to do this automatically when you setup your 'installed' tree.

    • Source packages are extracted in /usr/src. See the Package Source section for more information.

    • In your binary package, include a file /usr/doc/Cygwin/foo-vendor-suffix.README containing (at a minimum) the information needed for an end user to recreate the package. This includes CFLAGS settings, configure parameters, etc.

    • In your binary package include a directory /usr/doc/foo-vendor/ that includes any binary-relevant vendor documentation, such as ChangeLog's, copyright licence's, README's etc.

    • If you are not creating your package from an installed virtual root, be sure to check that the file permissions are appropriate.

    • If you have any 'info' documention in your package, run install-info as part of your post-install script

    • If the package has any global settings (ie in files in /etc) that are not overrideable on a per user basis (sshd, as a daemon, is an example of this) do not include the relevant config files in your package. Instead include in your post-install script to install the settings files. Be sure that if you would overwrite an already present file that the user is offered the choice of keeping their own or overwriting with your defaults.

    • Ensure that your package handles binary only systems, textmode only systems, and hybrid systems correctly.

    Package Source

    There are two accepted ways to package the source code for cygwin packages.

    Method One

    • Source packages are extracted underneath /usr/src (so your -src tarball should not include /usr/src). On extraction, the tar file should put the sources in a directory with the same name as the package tar ball minus the -src.tar.bz2 part:

        boffo-1.0-1/Makefile.in
        boffo-1.0-1/README
        boffo-1.0-1/configure
        boffo-1.0-1/configure.in
        etc...
      
    • In your source package include the same foo-vendor-suffix.README as used in the binary package.

    • Your source package already be patched with any necessary cygwin specific changes. The user should be able to just ./configure; make; and go.

    • Include a single file foo-vendor-release.patch in your source package, that when applied (in reverse: 'patch -R') will remove all the patches you've applied to the package, leaving it as the vendor distributes it. This file should extract as : /usr/src/foo-vendor-release.patch (that is, since setup.exe extracts everything into /usr/src, the patch should be a "top level" member of the -src tarball.)

      Optionally, this patch could also unpack inside the source tree:

        boffo-1.0-1/README
        boffo-1.0-1/configure
        boffo-1.0-1/CYGWIN-PATCHES/boffo-1.0-1.patch
        etc...
      
      However, that tends to complicate actually creating the patch itself. Unless one enjoys recursion, one must move the .patch file OUT of the source tree, regenerate the patch to incorporate any new changes, and then copy the new patch back into .../CYGWIN-PATCHES/. This option is documented because some existing packages do it this way, but it is not recommended for new packages. Make boffo-1.0-1.patch a top-level member of the -src tarball instead:
        boffo-1.0-1.patch
        boffo-1.0-1/README
        boffo-1.0-1/configure
        etc...
      
      To create the patch file described above, you might run
        diff -Nrup vendor-src-dir patched-src-dir > foo-vendor-release.patch
      To apply the generated patch (in reverse; that is, to remove the cygwin specific changes from the unpacked -src tarball) the user would run (from within the source tree)
        patch -R -p1 < ../foo-vendor-release.patch

    • In general, any cygwin-specific "packaging" files -- such as cygwin-specific READMEs, a copy of the setup.hint file for your package, etc. -- should unpack within a /CYGWIN-PATCHES/ subdirectory in your sources. Naturally, applying the patch (in reverse, as described above) would remove these files from the source tree.

    • So, returning to the boffo example, boffo-1.0-1-src.tar.bz2 would contain:

        boffo-1.0-1.patch
        boffo-1.0-1/README
        boffo-1.0-1/configure
        boffo-1.0-1/configure.in
        boffo-1.0-1/Makefile.am
        boffo-1.0-1/Makefile.in
        boffo-1.0-1/boffo.c
        ...
        boffo-1.0-1/CYGWIN-PATCHES/boffo.README (cygwin-specific)
        boffo-1.0-1/CYGWIN-PATCHES/setup.hint
        ...
      

    Method Two

    • In a packaging technique inspired by rpms and debs, you may create a -src tarball which simply contains:

      1. foo-vendor.tar.[gz|bz2]: The original source tarball, exactly as downloaded from the original vendor.

      2. foo-vendor-release.patch: the patch file as described in Method One, above.

      3. foo-vendor-release.sh: A build script that drives the entire unpacking, configuration, build, and packaging (binary and -src) process.

    • You can adapt this generic readme file for script-driven -src packages.

    • Here is an example build script which can be adapted for your package. By carefully modifying the details of this script, it can create the binary and -src packages for you, once you've finished porting your package. How? See the Initial packaging procedure below. But first, a few facts:

      • The buildscript will autodetect the package name, vendor version, and release number from its own filename.

      • When the buildscript is used to compile the package, all building occurs within a hidden subdirectory inside the source tree: boffo-1.0/.build/

      • To create the binary package, the script redirects 'make install' into a hidden subdirectory boffo-1.0/.inst/, creating a faux tree boffo-1.0/.inst/usr/bin, etc. This faux tree is tar'ed up into the new binary package.

      • To create the -src package, the script generates a patch file, and copies the original tarball, the patch, and the script into yet another hidden subdirectory boffo-1.0/.sinst/. The contents of this subdirectory are tar'ed up into the new -src package.

      • Sometimes, you will find that a package cannot build outside of its source directory. In this case, the script must recreate the source tree within the .build subdirectory. The jbigkit -src package uses GNU shtool's mkshadow to do this.

      • generic-build-script is not a one-size-fits-all solution. It must be customized for your package.

    • Initial packaging procedure, script-based

      • Suppose you've got your boffo package ported to cygwin. It took some work, but it now builds and runs. Further, suppose that the boffo-1.0.tar.bz2 file that you downloaded from the boffo homepage unpacks into boffo-1.0/, so you've been doing all of your work in ~/sources/boffo-1.0/. That's good.

      • Place a copy of boffo-1.0.tar.bz2 in ~/sources

      • copy generic-build-script into ~/sources/ and rename it boffo-1.0-1.sh. Carefully adapt this script for your purposes. However, it should auto detect most of what it needs to know: the package name, vendor version, release number, etc.

      • Clean up inside your ~/sources/boffo-1.0/ directory -- make sure that no files which are generated during the build process are lying around. Usually, a 'make distclean' will do the trick, but not always.

      • Ensure that you've put any cygwin-specific readme files, setup.hint files, etc, into ~/sources/boffo-1.0/CYGWIN-PATCHES/. You can adapt this generic readme file for this purpose. The build script expects that the cygwin-specific README file will be named .../CYGWIN-PATCHES/<package>.README. In this example, it would be stored as ~/sources/boffo-1.0/CYGWIN-PATCHES/boffo.README. The build script will ensure that it gets installed as /usr/doc/Cygwin/boffo-1.0.README

      • Prepare the staging location for the -src package (yes, do the -src package first): From the directory above your boffo-1.0 tree (e.g. ~/sources/ in our example) execute './boffo-1.0-1.sh mkdirs'

      • Create the -src package: './boffo-1.0-1.sh spkg'

      • Now, let's go somewhere else and unpack this new -src package:

          cd /tmp
          tar xvjf ~/sources/boffo-1.0-1-src.tar.bz2

      • Finally, rebuild the whole thing (you're still in /tmp):

          ./boffo-1.0-1.sh all
        (Or, you may want to do each step in 'all' manually: prep, conf, build, (check), install, strip, pkg, spkg, finish.

    Creating a package postinstall script

    If your package requires certain commands to be executed after the files in the package are installed, include them in a file in the package called /etc/postinstall/package.sh or /etc/postinstall/package.bat.

    If the file's name ends in ".sh", it is executed with the Cygwin shell; if it ends in ".bat", it is executed with the DOS command interpreter. If it doesn't end with either of these suffixes, it is ignored.

    After the script has been run it is renamed by appending the suffix ".done" to its previous name, to prevent it from being run again the next time the user runs the setup program.

    Note that the setup program runs all the postinstall scripts after all desired packages have been installed, that is, it does not run each package's postinstall script immediately after installing that package. Note, furthermore, that the order in which the scripts are run is not guaranteed. Therefore, if your package depends on others which have their own postinstall scripts, you cannot assume in your script that the other packages' scripts have already been run.

    Submitting a package

    So you've got a package you want to submit. Follow the following checklist before emailing cygwin-apps@cygwin.com and you'll almost certainly save time.

    1. Propose on cygwin-apps@cygwin.com that you are interested in becoming a package maintainer for package foo. Some packages cannot be distributed via cygwin's setup due to vendor licence limitations. Other packages may not be appropriate for cygwin. This step will save time if, for some reason we cannot accept the package.

    2. If this is a new package, post a complete setup.hint file as part of your proposal. Include this file in the text of your message so that it can be commented on. Do not submit it as an attachment.
    3. Do you have the time to maintain the package? Packages without active maintainers are pulled from the distribution. Generally speaking the time commitment is relatively low, simply subscribe to cygwin at cygwin dot com (digest mode is fine) and when a bug is reported in your package, address the bug (if it's a cygwin-only bug) or pass back to the vendor. When a solution exists, create an updated package with the fix in it, and upload that. Note that you are not expected to be a helpdesk for the package - the users are pointed back at the vendors lists, once you've determined that the bug is not a cygwin-related bug.

    4. Look in the debian package list and identify the section that your package is present in there - if it's available via debian. If it's not, have a look and take a sensible guess.

    5. Create setup.hint file following the documentation on this web page. Opinion on whether to mark your initial version as a Test version is currently mixed. If you have doubts about the stability of your initial offering you may decide to mark it as Test. Then, once the package has no major bug reports from users, a current package may be introduced. Otherwise, it is perfectly acceptable to forgo the Test designation in your first release.

    6. If possible, place the package files in a web accessible http/ftp site somewhere.

    7. Announce on cygwin-apps@cygwin.com that you have the package ready for uploading, and Robert Collins will contact you to get access to the package files, which he'll then upload to sources.redhat.com for you.

    8. Delete your temporary copy once they have been uploaded to sources.redhat.com.

    9. Announce via cygwin-announce@cygwin.com that the new package, is available for experimentation. Use a recent cygwin-announce message from one of the core maintainers as a template for your announcement.

      Once sent, your message will be reviewed by one of the cygwin-announce moderators and, once approved, will be automatically forwarded to the cygwin mailing list with an [ANNOUNCEMENT] prepended to the subject.

    NOTE: On any major version upgrade, you may want to mark the release as Test.