================================================ Packaging in Windows the Debian way (under MSYS) ================================================ :Author: Jiri Barton :Date: 2005-01-13 mingw-package is a build system for the MSYS/MinGW environment (in Windows). It is based on and very similar to the Debian packaging system. mingw-package uses the subdirectory mingw in the package source root to store all the files relevant to building, instaling, and packaging a source. Those files resemble their counterparts in the debian directory for the Debian packaging system. Following lists those files and comments them accordingly. Where in doubt, use the Debian documentation to find out what the meaning is. INSTALATION =========== 1. Requirements --------------- * MSYS * Python 2. File locations ----------------- * mingw-* files should go to /usr/bin * all the other files should go to /usr/share/mingw-package CONTROL FILES ============= 1. changelog ------------ This file is used for versioning. The file is divided into sections, separated by an empty line. The format of a section is:: PACKAGE_NAME (VERSION-PACKAGING) * COMMENT1 * COMMENT2 ... -- MAINTAINER'S NAME DATE-TIME For example:: cppunit (1.10.2-1) * Initial release. -- Jiri Barton 2005-01-12 As you can see, it does not contain all the entries that you find in debian/changelog. However, it does not contain extra entries. This is true with other control files (i.e. mingw/\*) too. 2. control ---------- This file tells the packaging system what installers it should create. There can be several installers for each source. The file is also divided into sections. They are separated by an empty line. The first section is special:: Source: PACKAGE_NAME Maintainer: MAINTAINER'S NAME All the other sections define installers to be created. :: Package: INSTALLER_NAME Description: SHORT_DESCRIPTION LONG_DESCRIPTION_PARAGRAPH1 . LONG_DESCRIPTION_PARAGRAPH2 . LONG_DESCRIPTION_PARAGRAPH3 ... So, each such section lists a different INSTALLER_NAME. This name is then used elsewhere to parametrize the packaging process. This is the control file for CPPUNIT:: Source: cppunit Maintainer: Jiri Barton Package: cppunit-dev Description: Unit Testing Library for C++ CppUnit is a simple Framework for incorporating test cases in your C++ code. It is similar to, and inspired by, xUnit and JUnit. . For more information on CppUnit visit the project homepage http://cppunit.sourceforge.net/ . 3. rules -------- This file customizes the the configure, build, and packaging processes. It is a makefile. Each goal of the makefile is used in a different phase of the packaging process: * configure * build * clean * install * package The goal *package* is not present in the Debian packaging system. It resembles the goal binary or binary-common. This goal should create the binary installers when the package is installed into DESTDIR. You will very likely call mingw-package helper there, *mingw-installers*. 4. INSTALLER_NAME.iss.in ------------------------ These files are the installer scripts for INSTALLER_NAME. For every installer, this script is used or a stock script is used (/usr/share/SETUPTEMPLATE .iss.in, /usr/share/setup.iss.in). See the documentation to mingw-installers for more. 5. copyright ------------ Each package should be accompanied with copyright. UTILITIES ========= 1. mingw-buildpackage --------------------- This utility will patch, build, and create an executable installer using the information in the mingw subdirectory of the current path. It is very similar to Debian's dpkg-buildpackage. It uses mingw/rules to do its job. Usage: mingw-buildpackage 2. mingw-installers ------------------- (this utility requires Python) This helper file is usually called from within mingw/rules. It goes through mingw/control and creates installer for each installer section that it finds there. For each installer, mingw-installers uses the custom script INSTALLER_NAME.iss.in if it finds one in the mingw directory, or it uses one of the stock scripts - ``/usr/share/*.iss``. If ming-installers is passed the second argument, its name is used for the name of the stock script, otherwise ``setup`` is used. mingw-installers use the Inno Setup Install System (ISS) to generate installer executables. Inno Setup must be installed for it to function. You can find it at http://www.jrsoftware.org/isinfo.php. mingw-installers try to find the Inno Setup compiler by various means; if it fails to find it, you should set the environment variable INNOSETUPDIR to point to the directory where ``iscc.exe`` can be found. In fact, this variable takes precedence over other search methods and is used when set. You can use the following variables inside your ISS scripts. Those will be replaced with the content by mingw-installers when the installer is generated: +-------------------------+--------------------------------------------------------+ | %(msysdir)s | location of your MSYS root. Usually C:\MSYS\1.0 | +-------------------------+--------------------------------------------------------+ | %(mingwdir)s | location of your MinGW root. Usually C:\MinGW | +-------------------------+--------------------------------------------------------+ | %(package_version)s | package version + packaging. E.g. 1.10.2-1 | +-------------------------+--------------------------------------------------------+ | %(package_baseversion)s | package version. E.g. 1.10.2 | +-------------------------+--------------------------------------------------------+ | %(package_name)s | package name. E.g. cppunit | +-------------------------+--------------------------------------------------------+ | %(destdir)s | target of the installation. Passed to mingw-installers | +-------------------------+--------------------------------------------------------+ | %(templatesdir)s | location of the global templates E.g. for the #include | +-------------------------+--------------------------------------------------------+ | %% | % | +-------------------------+--------------------------------------------------------+ Because every such script is formatted by the Python string expansion, all other occurences of the percent character has to be double, as in:: {%%TMP|C:\Temp} Usage: mingw-buildpackage DESTDIR [SETUPTEMPLATE] 3. mingw-source --------------- This utility operates in two modes. One, it creates .dsc, .diff.gz, and .orig.tar.gz by comparing the source modified ready for mingw-buildpackage to the original upstream source. Usage: mingw-source -b MODIFIED-SOURCE UPSTREAM-TARBALL (.tar.gz or .tar.bz2 are accepted tarball formats) Two, it extracts the upstream source and adds the mingw specific packaging commands to it. It uses .dsc, .diff.gz, and .orig.tar.gz (created by with ming-source -b, for example). Usage: mingw-source -x DSC-FILE The DSC files should contain the following entries (or more):: Source: PACKAGE_NAME Maintainer: MAINTAINER'S NAME Files: MD5SUM SIZE PACKAGE_NAME.orig.tar.gz MD5SUM SIZE PACKAGE_NAME.diff.gz For example:: Source: cppunit Maintainer: Jiri Barton Files: 7191918798fb08b2710406c39ffeb3cd 514757 cppunit_1.10.2.orig.tar.bz2 7191918798fb08b2710406c39ffeb3cd 2275 cppunit_1.10.2-1.diff.gz