Difference between revisions of "Unix/Linux Packages"

Line 158: Line 158:
* some cleaning up
* some cleaning up
=== References ===
== See also ==
* [[LinuxUnixLayout]]
== References ==
* http://www.debian.org/doc/manuals/maint-guide/
* http://wiki.ubuntu.com/PackagingGuide/Complete
* http://www.rpm.org/max-rpm/
* http://pmc.ucsc.edu/~dmk/notes/RPMs/Creating_RPMs.html

Revision as of 14:29, 1 May 2008

For building binary installation packages for different Linux distribution you can use the scripts make_debian_package and make_rpm_package. This is a step by step manual on how to create such packages with these scripts. Since the source is the same for all distributions, the resulting packages are not distribution specific. This means you should be able to install e.g. a resulting .deb package on Debian and Ubuntu.


Make sure $ISE_EIFFEL and $ISE_PLATFORM are pointing to the delivery you want to make a package for. The version of EiffelStudio will automatically be detected so your package will be named correctly and also contain all information related to the delivery $ISE_EIFFEL points to.

Regardless which distribution you want to create a package for, you will need a directory called packaging and a script called make_unix_layout from https://svn.origo.ethz.ch/eiffelstudio/trunk/Delivery/scripts/unix/. The packaging directory contains build related files for all distribution. make_unix_layout is used by the packaging scripts to create the final unix layout for EiffelStudio (the way it will be installed later on the end user's system).

In a terminal, type the following commands in the directory you want to create your package(s). In general you do not need root access to build the packages.

export SVNURL=https://svn.origo.ethz.ch/eiffelstudio
svn export $SVNURL/trunk/Delivery/scripts/unix/packaging
svn export $SVNURL/trunk/Delivery/scripts/unix/make_unix_layout


To create a .deb package of EiffelStudio, you will need the make_debian_package script from the repository.

svn co $SVNURL/trunk/Delivery/scripts/unix/make_debian_package

Following debian packages are required:

  • build-essential
  • devscripts
  • debhelper
  • fakeroot
  • lintian (optional)

To install the packages, copy paste following code into a root shell:

apt-get install build-essential devscripts debhelper fakeroot lintian


To create a .rpm package of EiffelStudio, you will need the make_rpm_packge script from the repository.

svn co $SVNURL/trunk/Delivery/scripts/unix/make_rpm_package

Following RPM packages are required:

  • rpm-build

To install the package, copy past following code into a root shell:

yum install rpm-build

Creating the packages

Creating the package itself is fairly simple. Depending on which distribution you want to build a package for, type one of the following commands.

For a debian (.deb) package:


For a RPM package:


If everything works fine, the created packages are located in the current directory.

Additional packages

To reduce the package size for EiffelStudio, both scripts produce a separate architecture independent package containing documentation. This only works if you have a docs directory in your $ISE_EIFFEL delivery. Otherwise it will only create the main package.

Verifying packages (optional)


For Debian packages you have the possibility of verifying your package with a tool called lintian. If you have installed lintian as mentioned in the Prerequisites section for Debian, simply run following command:

lintian *.deb

lintian will print any errors and warnings about the packages.



rpm -qpi *.rpm

to display package information or

rpm -qpl *.rpm

to have a list of the files contained in the packages.

Implementation Details

Both scripts make_debian_package and make_rpm_package do not make use of the build facilities provided by debuild, respectively rpmbuild. This is mainly because the packages are meant to support the installation of EiffelStudio and not provide source packages to actually build EiffelStudio on the different distributions and platforms. This means that both scripts skip the building part and perform the installation themselves by calling make_unix_layout. What remains is generally compressing/archiving the installation files and putting them into a .deb/.rpm file together with some information about the package.

The next sections will explain which files are needed for debuild and rpmbuild to work and what make_debian_package and make_rpm_package need to set up before invoking them.


In the packaging files you have mostly template files for building packages. Some files have a .sh ending and have to be executed so they produce the actual file used by debuild or rpmbuild (e.g. control.sh will produce a file called control). The reason is that most of the settings in these files have to be determined once we now which delivery we are using. This are mostly path names, but can also be names or email addresses or the person creating the package.

  • config.sh contains general attributes the packages should have at the end. They apply to all distributions.
  • description is a longer description of EiffelStudio. This will appear in the package manager if people install or display the new packages.
  • postinstall.sh are preremove.sh are scripts which will be executed when someone installs/removes the packages on their system. The scripts do not contain a #!/bin/sh line, because for RPM spec files only the content of a script is needed.
  • debian/control.sh produces the control file containing information like package name, version number or maintainer. This information is then put into the package by debuild. The control file contains information for the main and the documentation package.
  • debian/changelog.sh produces a changelog file. Since we do not have any distribution specific changes this file only contains a place holder entry.
  • debian/copyright contains copyright information for EiffelStudio
  • debian/compat is only used by debuild
  • debian/rules is a modified makefile which tells debuild what it has to execute in order to build the package. As mentioned earlier, we don't actually build the package, so all build and install related directives have been removed. What is left are a lot of calls to dh_* helper scripts, which perform various tasks. All of the scripts contain a manpage which describes what they actually do.
  • rpm/eiffelstudio.spec.sh and rpm/eiffelstudio-doc.spec.sh create RPM spec files which contain the same information file as the control for Debian packages. Except that when packaging it is easier if there are two separate files for the main and doc package.
  • rpm/RPMS is the directory in which rpmbuild will create the new packages.

Check out the links in the References section for more information of the content of these files.


This list describes briefly what the make_debian_package script does step by step:

  • retrieve EiffelStudio version, checking and setting environment variables
  • calling make_unix_layout to produce a unix layout in packaging/debian/eiffelstudio-X.Y
  • run all *.sh files in the packaging directory
  • if make_unix_layout created a docs directory:
    • move the docs directory into a separate package directory packaging/debian/eiffelstio-X.Y-doc
    • call debuild to create the documentation package (since it is architecture independent, we can simply call debuild with the binary-indep switch, so it only tries to create a -doc package)
    • clean up all documentation related files
  • run debuild with the binary-arch switch to make it create the main package
  • some cleaning up


This list describes briefly what the make_rpm_package script does step by step:

  • retrieve EiffelStudio version, checking and setting environment variables
  • create a user specific RPM macro file ~/.rpmmacro with specific settings needed to create a RPM package for EiffelStudio. This is especially needed to run rpmbuild without root access. Unfortunately I was not able to figure out how to make those settings without creating this file in the $HOME directory. However, if the file already existed, it will be copied to /tmp and moved back after make_rpm_package is done building the packages.
  • calling make_unix_layout to produce a unix layout in packaging/rpm/eiffelstudio
  • run all *.sh files in the packaging directory
  • if make_unix_layout created a docs directory:
    • move the docs directory into a separate package directory packaging/rpm/eiffelstudio-doc
    • call rpmbuild with the eiffelstudio-doc.spec file to create the documentation package
    • clean up all documentation related files
  • call rpmbuild with the eiffelstudio.spec file to create the main package
  • move the created RPM packages to the current directory
  • some cleaning up

See also