Red-Hat-Packagemanager
Intended audience: distribution maintainers.
The following pages describe how to create RPM packages of GNAT.
Why RPM?
RPM packages have the distinct advantage of being installable and de-installable. This is quite interesting for maintainers and users alike: Every make install might leave you with no working compiler. And without a compiler you can't compile a new one. Catch 22.
I noticed that very painfully when upgrading to SuSE 10.0 – the GCC 4.0.2 of SuSE 10.0 can't compile GNAT/GPL so one needs a working GNAT/GPL to create a new one.
Quick guide
For those who don't like to read much and want to get right to it.
- Download and Install the RPM-Spec-Files
- Copy and amend the .rpmmacros file.
- Download and Install the GNAT-Configuration-Files
- Download and install the source-rpm-Files
- Run rpmbuild -ba gnat-gpl-2005.spec and rpmbuild -ba gnat-gcc-4.0.2.spec, and install the resulting packages.
- Run Package_Step_2.bash and install the resulting packages.
- Run Package_Step_3.bash and install the resulting packages.
- Run Upload_R2.bash to upload the files to SourceForge.
- Add or edit the appropiate Packages and Releases
Detailed guide
For those who don't like to figure everything out by themselves.
1. Download and Install the RPM-Spec-Files
You have two options open:
- You can download them from the download server and then install them with rpm --install. This installs into /work/rpm. You can also use rpm --install --prefix=Directory to install then at any location you like.
- You can check them out from the Subversion Archive. The module you need is trunk/rpm. In Subversion you can also find the configuration for older compiler releases.
The documentation is based on the assumption that you use /work/rpm as the build directory.
2. Copy and amend the .rpmmacros file.
You will find a file called /work/rpm/SPECS/.rpmmacros after the download/install. Copy that file to your home directory. Then open it with your favorite editor - there are only 3 lines - change them to reflect your system:
%_topdir /work/rpm %System_Id SuSE_10_0 %System_Name SuSE 10.0
Important: System_Id must be one word - no space, not dot, no dash, no fancy anything!
Once you changed %_topdir all installations of source-rpm will go there.
3. Download and Install the GNAT-Configuration-Files
The configuration files install into /opt/gnat but you can change that with rpm --install --prefix=Directory.
These files are used to switch from one GNAT to another.
4. Download the source-rpm-Files
You need to download the RPM-source-file of the system you want to compile – or of a system similar to the one you use. Again you have two options open:
- You can download them from the download server and then install them with rpm --install. This installs them into /work/rpm/SOURCES.
- You get them from somewhere else and copy them into /work/rpm/SOURCES.
5. Run make gpl and make gcc, and install the resulting packages.
You should know that this step will take several hours – even on modern systems. For the first run you want to start in the morning and from time to time have a look at how things are going.
When finished you will have 2 compiler systems ready – one from the GNAT/GPL sources and one from GNAT/GCC 4.1.1 (at time of writing). You need to install them to continue.
If you have both of these packages installed and want to rebuild them, you can run Package_Step_1.bash instead of the rpmbuild commands. Each compiler will then compile itself. The Package* scripts will only work if the gnat-gcc and gnat-gpl packages are allready installed.
Currently (Sep.2006) there is one extra hurdle: The GNAT/GPL can only be compiled using another (older) GNAT/GPL. This can be solved by
- Temporarly installing GNAT from Libre.
- Installing a GNAT/GPL from a similar System.
6. Run Package_Step_2.bash and install the resulting packages.
This will compile the libraries and tools which we currently distribute.
7. Run Package_Step_3.bash and install the resulting packages.
Some of the libraries and tools will only compile if others are already installed, so to run step 3 you will need to install the packages from step 2.
8. Run Upload_R2.bash to upload the files to SourceForge.
You will need NcFTP to run this script. You can use any other FTP client you like but then you have to write your own script.
As always you should have a look into the script before executing it.
9. Add or edit the appropiate Packages and Releases
What about Package_Step_0.bash?
Step 0 creates the RPM packages with the rpm-spec-files and the GNAT configuration files. Since this should be independent of the (POSIX) OS used you should have no need to create them.
It did not work
If you read this you are a programmer and therefore should be able to fix it. Here are some hints:
- Make a copy of the spec file in question. That way we can add the spec to Subversion repository.
- The file you have to look at – apart from the spec – is gnat-common.bash. There you find all common settings for all packages. Since you are planning a special spec file you might want to do away with the gnat-common.bash and expand the functions into your spec file.
- try rpmbuild -bp (prepare only) and rpmbuild -bc (prepare and compile).
- Remove the calls to
Do_Clean– then rpmbuild will keep the temporary files and leave you with more to debug with. The spec files have been designed to be restartable in most cases. Beware: restart won't work on fatal errors in the prepare phase - then you need to clean it all up yourself.
BASH scripts
The package creation with RPM relyies on the use of the bash shell. Here a few hints.
if
The if is probably the most difficult to unterstand bash command. if executed the command between if and ; then and converts the return value to Boolean (in Ada : retval /= 0). There are 4 common commands which to be used between if and ; then:
| Command | Description |
|---|---|
| test ... | Perfomes various tests. Since help test gives a very helpfull introduction I consider test "prefered" to the other commands. |
[[ ... ]] | Works allmost test. help [[ will tell you only about the differences to test. |
| let "..." | Performes and arithmetic evaluation on the expression and returnes the result. c§help let§§ will tell you about the operations possible. |
| (( ... )) | Same as let but looks nicer. However you need the very un-intuitive help \(\( to get the online help which in turn only tells that the command is equevalent to let. For a team effort I suggest to use let. |
M4
We use a set of Prototype RPM specs which we pass thrue the M4 macro preprocessor to create the real RPM specs.
As we are Ada programmers the priority is placed on easy reading over easy writing. We therefore use only a very small subset of the m4 features. Also we use the "m4_" prefix feature so all m4 commands are prefixed the - well - "m4_"
Vim / Exim
Sometimes sources must be patched. We usualy do this with litte exim scripts (the script language from the vim editor). Again priority is placed on easy reading over easy writing. All exim commands are written in there full form and prefixed with ":".
Also exim often is easier to read and understand then diff patch files. For details of Exim see Learning the vi editor/Vim - Ex/Exim Script language.
Packages
The following packages should be installed on your computer:
| Command | Description |
|---|---|
| atk | An Accessibility ToolKit |
| autoconf | |
| aclocal | |
| automake | A Program for Automatically Generating GNU-Style Makefile.in files |
| bash | The GNU Bourne-Again Shell |
| bison | The GNU Parser Generator |
| bonobo | CORBA Interfaces for Reusable Components |
| cairo | Vector graphics library with cross-device output support |
| coreutils | GNU Core Utilities |
| cups-libs | libraries for CUPS |
| db | Berkeley DB Database Library |
| expat | XML Parser Toolkit |
| flex | Fast Lexical Analyser Generator |
| fontconfig | Library for Font Configuration |
| freetype | TrueType Font Engine |
| freetype2 | A TrueType font library |
| gawk | GNU awk |
| gconf2 | The GNOME 2.x Desktop Configuration Database System |
| gdbm | GNU database routines |
| glib2 | A Library with Convenient Functions Written in C |
| glibc | Standard Shared Libraries (from the GNU C Library) |
| glitz | Glitz--OpenGL Image Compositing Library |
| gmp | The GNU MP Library |
| gnome-vfs2 | The GNOME 2.x Desktop Virtual File-System Libraries |
| gpm | Console Mouse Support |
| gtk2 | Library for Creation of Graphical User Interfaces |
| libacl | A dynamic library for accessing POSIX Access Control Lists |
| libapr0 | Apache Portable Runtime (APR) Library |
| libart_lgpl | Libart components licensed under the LGPL |
| libbonobo | The Bonobo Component System for the GNOME 2.x Desktop Platform |
| libbonoboui | The Bonobo Part of the GNOME User Interface Libraries |
| libgcc | C compiler runtime library |
| libgnome | The GNOME 2.x Desktop Base Libraries |
| libgnomecanvas | An Add-On for the GNOME User Interface Libraries |
| libgnomeui | The GNOME User Interface Library |
| libpng | Library for the Portable Network Graphics Format |
| libxml2 | A library to manipulate XML files |
| iconv | |
| ncurses | New curses libraries |
| openssl | Secure Sockets and Transport Layer Security |
| orbit2 | High-Performance CORBA Object Request Broker |
| pango | System for Layout and Rendering of Internationalised Text |
| perl | The Perl interpreter |
| popt | A C library for parsing command line parameters |
| python | Python Interpreter |
| rpm | The RPM Package Manager |
| ruby | An Interpreted Object-Oriented Scripting Language |
| tcl | The Tcl scripting language |
| tcsh | The C SHell |
| texinfo | Tools Needed to Create Documentation from Texinfo Sources |
| xorg-x11-libs | X Window System shared libraries |
| xorg-x11-Mesa | Mesa Libraries |
| zlib | Data Compression Library |
| tetex | The Base System of teTeX |
Hint: you can get the package summaries with:
rpm --query --queryformat='||%{name} ||%{summary} ||\n' ruby
Ada programming, © 2005,2006 the Authors, Content is available under GNU Free Documentation License.
