Difference between revisions of "Unix/Linux Packages"
(→Debian) |
(Replaced origo.ethz.ch by eiffel.com in SVN URL) |
||
(35 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[[Category:Build Scripts]] | [[Category:Build Scripts]] | ||
+ | |||
+ | {{Note|This pages describes how to build binary packages of EiffelStudio for different Unix/Linux distributions. If you are looking for already built packages see [[Unix/Linux Repositories]].}} | ||
+ | |||
+ | |||
+ | == Introduction == | ||
+ | |||
+ | This is a step by step manual on how to create binary EiffelStudio packages with '''make_debian_package''', '''make_rpm_package''' and '''make_svr_package'''. 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 any Debian and Ubuntu distribution. | ||
+ | In general the scripts take an existing EiffelStudio delivery, copy all files to a temporary Unix root directory and call the packaging tools for the specific distribution. | ||
+ | |||
+ | Note that you should only create packages from deliveries built for your specific architecture. This is because the packaging tools automatically determine your architecture and store that information in the resulting package. So lets say you have an amd64 machine, only try to create packages for linux-x86-64 deliveries. The package will then be tagged for x86_64 architectures. Because the packaging tools automatically detect dynamic library dependencies, unfortunately it is not possible to create packages for other architectures, even if you use an already compiled delivery. | ||
+ | |||
+ | Also if the Delivery includes a '''docs/''' directory, the packaging scripts will automatically create an architecture independent package only containing the documentary for EiffelStudio. This is to keep the size for the main package as little as possible. | ||
+ | |||
== Prerequisites == | == Prerequisites == | ||
Line 5: | Line 18: | ||
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. | 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. | + | 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.eiffel.com/eiffelstudio/trunk/Src/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. | 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. | ||
<pre> | <pre> | ||
− | export SVNURL=https://svn. | + | export SVNURL=https://svn.eiffel.com/eiffelstudio/trunk/Src |
− | svn export $SVNURL | + | svn export $SVNURL/Delivery/scripts/unix/packaging |
− | svn export $SVNURL | + | svn export $SVNURL/Delivery/scripts/unix/make_unix_layout |
</pre> | </pre> | ||
Line 20: | Line 33: | ||
<pre> | <pre> | ||
− | svn | + | svn export $SVNURL/Delivery/scripts/unix/make_debian_package |
</pre> | </pre> | ||
Line 41: | Line 54: | ||
<pre> | <pre> | ||
− | svn | + | svn export $SVNURL/Delivery/scripts/unix/make_rpm_package |
</pre> | </pre> | ||
− | + | Sometimes, RPM does not have <code>rpmbuild</code> installed. Usually you can install it be typing this into a root shell: | |
− | + | ||
− | + | <pre>yum install rpm-build</pre> | |
+ | |||
+ | On a debian system: | ||
+ | |||
+ | <pre>sudo apt-get install rpm</pre> | ||
+ | |||
+ | === UNIX === | ||
+ | |||
+ | To create a .svr package of EiffelStudio, you will need the '''make_svr_packge''' script from the repository. | ||
<pre> | <pre> | ||
− | + | svn export $SVNURL/Delivery/scripts/unix/make_svr_package | |
</pre> | </pre> | ||
+ | |||
+ | The packaging tools '''pkgmk''' and '''pkgtrans''' which are used by the scripts should be installed already. | ||
== Creating the packages == | == 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. | + | Creating the package itself is fairly simple. Depending on which distribution you want to build a package for, type one of the following commands where '''ISE_PLATFORM''', '''ISE_EIFFEL''' and '''architecture''' have to be replaced by the corresponding value corresponding to your platform and architecture. |
For a debian (.deb) package: | For a debian (.deb) package: | ||
<pre> | <pre> | ||
− | ./make_debian_package | + | ./make_debian_package $ISE_PLATFORM $ISE_EIFFEL [arch] |
</pre> | </pre> | ||
− | For a RPM package: | + | For a RPM (.rpm) package: |
<pre> | <pre> | ||
− | ./make_rpm_package | + | ./make_rpm_package $ISE_PLATFORM $ISE_EIFFEL |
+ | </pre> | ||
+ | |||
+ | For a UNIX (.svr) package | ||
+ | |||
+ | <pre> | ||
+ | ./make_svr_package $ISE_PLATFORM $ISE_EIFFEL | ||
</pre> | </pre> | ||
If everything works fine, the created packages are located in the current directory. | If everything works fine, the created packages are located in the current directory. | ||
+ | |||
+ | === Additional packages === | ||
+ | |||
+ | To reduce the package size for EiffelStudio, all 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. | ||
+ | |||
+ | == Signing packages == | ||
+ | |||
+ | So far signing is only supported for RPM packages. '''make_rpm_package''' will automatically try to sign the package if '''gpg''' is available on your system. Also you will need to set '''$KEY''' and '''$PASS_PHRASE''' in '''packaging/config.sh''' with the identifier/pass phrase of your private key. | ||
+ | |||
+ | Do not forget to import your private key by using: | ||
+ | <pre>gpg --import my_private_key.gpg</pre> | ||
== Verifying packages (optional) == | == Verifying packages (optional) == | ||
Line 91: | Line 130: | ||
</pre> | </pre> | ||
− | to display package information. | + | to display package information or |
+ | |||
+ | <pre> | ||
+ | rpm -qpl *.rpm | ||
+ | </pre> | ||
+ | |||
+ | to have a list of the files contained in the packages. | ||
== Implementation Details == | == 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. | ||
+ | |||
+ | === Files in packaging/ === | ||
+ | |||
+ | In the '''packaging''' directory 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. | ||
+ | * '''desktop''' contains menu information for desktop environments like Gnome or KDE (this file gets added by '''make_unix_layout''') | ||
+ | * '''license''' contains copyright information for EiffelStudio | ||
+ | * '''logo.png''' icon for menu entry (gets added by '''make_unix_layout''') | ||
+ | * '''make_install.sh''' this script is added to a unix layout also by '''make_unix_layout''' (/usr/share). It is used to build the precompile libraries by calling the wizard or if there is no GUI directly through command line. | ||
+ | * '''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/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. | ||
+ | * '''debian/postinst.sh''' creates a Debian package script similar to '''make_install.sh''', except that it is called by the packaging manager directly when installing the package (or reconfiguring it e.g. through dpkg-reconfigure). | ||
+ | * '''debian/prerm.sh''' created a Debian package script which simply removes the EIFGENs directory for precompiles. | ||
+ | * '''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. As a difference to Debian packages, the .spec files for RPM already include the install/remove scripts (Although simplified because user input through the console is not allowed with RPM during installation). | ||
+ | * '''rpm/RPMS''' is the directory in which '''rpmbuild''' will create the new packages. | ||
+ | * '''svr/pkginfo.sh''' and '''svr/pkginfo-doc.sh''' creates a pkginfo file containing general information for each package. | ||
+ | * '''svr/preremove.sh''' creates a the preremove scripts which gets called when uninstalling EiffelStudio (similar to Debian's '''prerm.sh''') | ||
+ | * '''svr/reqeust.sh''' creates a script which is called before installing the resulting package. The scripts simply prints some information on how to generate the precompile libraries after the installation. The reason why we (currently) can not do this as convenient as for Debian/RPM is that the package manager for .svr packages clears all environment variables when calling these scripts. | ||
+ | |||
+ | Check out the links in the [[#References|References]] section for more information of the content of these files. | ||
+ | |||
=== make_debian_package === | === make_debian_package === | ||
+ | |||
+ | This list describes briefly what the '''make_debian_package''' script does step by step: | ||
+ | |||
+ | * 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 | ||
+ | |||
=== make_rpm_package === | === make_rpm_package === | ||
+ | |||
+ | This list describes briefly what the '''make_rpm_package''' script does step by step: | ||
+ | |||
+ | * 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 == | ||
+ | |||
+ | * [[Unix/Linux Repositories]] | ||
+ | * [[LinuxUnixLayout]] | ||
+ | |||
+ | == References == | ||
+ | |||
+ | Debian: | ||
+ | |||
+ | * http://www.debian.org/doc/manuals/maint-guide/ | ||
+ | * https://wiki.ubuntu.com/PackagingGuide/Complete | ||
+ | |||
+ | RPM: | ||
+ | |||
+ | * http://www.rpm.org/max-rpm/ | ||
+ | * http://pmc.ucsc.edu/~dmk/notes/RPMs/Creating_RPMs.html | ||
+ | |||
+ | UNIX: | ||
+ | |||
+ | * http://docsrv.sco.com/SDK_tools/CTOC-PackagSWApps.html | ||
+ | * http://www.cymru.com/Documents/UNIX/package.txt | ||
+ | * http://dlc.sun.com/osol/docs/content/IPS/ggcph.html (Opensolaris) |
Latest revision as of 12:08, 4 June 2012
Note: This pages describes how to build binary packages of EiffelStudio for different Unix/Linux distributions. If you are looking for already built packages see Unix/Linux Repositories.
Contents
Introduction
This is a step by step manual on how to create binary EiffelStudio packages with make_debian_package, make_rpm_package and make_svr_package. 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 any Debian and Ubuntu distribution. In general the scripts take an existing EiffelStudio delivery, copy all files to a temporary Unix root directory and call the packaging tools for the specific distribution.
Note that you should only create packages from deliveries built for your specific architecture. This is because the packaging tools automatically determine your architecture and store that information in the resulting package. So lets say you have an amd64 machine, only try to create packages for linux-x86-64 deliveries. The package will then be tagged for x86_64 architectures. Because the packaging tools automatically detect dynamic library dependencies, unfortunately it is not possible to create packages for other architectures, even if you use an already compiled delivery.
Also if the Delivery includes a docs/ directory, the packaging scripts will automatically create an architecture independent package only containing the documentary for EiffelStudio. This is to keep the size for the main package as little as possible.
Prerequisites
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.eiffel.com/eiffelstudio/trunk/Src/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.eiffel.com/eiffelstudio/trunk/Src svn export $SVNURL/Delivery/scripts/unix/packaging svn export $SVNURL/Delivery/scripts/unix/make_unix_layout
Debian
To create a .deb package of EiffelStudio, you will need the make_debian_package script from the repository.
svn export $SVNURL/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
RPM
To create a .rpm package of EiffelStudio, you will need the make_rpm_packge script from the repository.
svn export $SVNURL/Delivery/scripts/unix/make_rpm_package
Sometimes, RPM does not have rpmbuild
installed. Usually you can install it be typing this into a root shell:
yum install rpm-build
On a debian system:
sudo apt-get install rpm
UNIX
To create a .svr package of EiffelStudio, you will need the make_svr_packge script from the repository.
svn export $SVNURL/Delivery/scripts/unix/make_svr_package
The packaging tools pkgmk and pkgtrans which are used by the scripts should be installed already.
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 where ISE_PLATFORM, ISE_EIFFEL and architecture have to be replaced by the corresponding value corresponding to your platform and architecture.
For a debian (.deb) package:
./make_debian_package $ISE_PLATFORM $ISE_EIFFEL [arch]
For a RPM (.rpm) package:
./make_rpm_package $ISE_PLATFORM $ISE_EIFFEL
For a UNIX (.svr) package
./make_svr_package $ISE_PLATFORM $ISE_EIFFEL
If everything works fine, the created packages are located in the current directory.
Additional packages
To reduce the package size for EiffelStudio, all 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.
Signing packages
So far signing is only supported for RPM packages. make_rpm_package will automatically try to sign the package if gpg is available on your system. Also you will need to set $KEY and $PASS_PHRASE in packaging/config.sh with the identifier/pass phrase of your private key.
Do not forget to import your private key by using:
gpg --import my_private_key.gpg
Verifying packages (optional)
Debian
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
Use
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.
Files in packaging/
In the packaging directory 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.
- desktop contains menu information for desktop environments like Gnome or KDE (this file gets added by make_unix_layout)
- license contains copyright information for EiffelStudio
- logo.png icon for menu entry (gets added by make_unix_layout)
- make_install.sh this script is added to a unix layout also by make_unix_layout (/usr/share). It is used to build the precompile libraries by calling the wizard or if there is no GUI directly through command line.
- 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/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.
- debian/postinst.sh creates a Debian package script similar to make_install.sh, except that it is called by the packaging manager directly when installing the package (or reconfiguring it e.g. through dpkg-reconfigure).
- debian/prerm.sh created a Debian package script which simply removes the EIFGENs directory for precompiles.
- 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. As a difference to Debian packages, the .spec files for RPM already include the install/remove scripts (Although simplified because user input through the console is not allowed with RPM during installation).
- rpm/RPMS is the directory in which rpmbuild will create the new packages.
- svr/pkginfo.sh and svr/pkginfo-doc.sh creates a pkginfo file containing general information for each package.
- svr/preremove.sh creates a the preremove scripts which gets called when uninstalling EiffelStudio (similar to Debian's prerm.sh)
- svr/reqeust.sh creates a script which is called before installing the resulting package. The scripts simply prints some information on how to generate the precompile libraries after the installation. The reason why we (currently) can not do this as convenient as for Debian/RPM is that the package manager for .svr packages clears all environment variables when calling these scripts.
Check out the links in the References section for more information of the content of these files.
make_debian_package
This list describes briefly what the make_debian_package script does step by step:
- 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
make_rpm_package
This list describes briefly what the make_rpm_package script does step by step:
- 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
References
Debian:
RPM:
UNIX: