Creating a binary-only rpm

This is a hands-on tutorial explaining how to create a RPM in Mandriva using the RPMPM (RPM-Package Manager).

Requirements

We need the following things (and their dependencies) installed on order to create a package as described:

  • RPMPM
  • RPM
  • RPMLINT
  • RPMBUILD

Preparing steps

  • Create a macro file for rpm that holds environment variables.
    • In the home folder we create the file “.rpmmacros” with the command:
      “vim ~/.rpmmacros”
    • And add lines similar to those to it:

  • Create the folder structure described above
  • Create a makefile that will “install” your project to a specific location
    • Your makefile should look like this:
    • Make sure that after the makefile is run all files needed are in the right place and have the proper permissions set
    • In this example the makefile is in my working directory which a folder called “WMS-1.0”. In this folder there is a folder called wms into which all my project files are copied to.

Creating the RPM

  • Open a console in the directory with the makefile and run:
    “rpmpm”
  • Choose the folder containing the file structure you would like to build a package of:

In this example it is WMS-1.0. If the directory name is not in the right format you will be asked to change it accordingly.

  • Click onto: New Spec File
  • Select: Template (default.spec) and click ok
  • Fill out the form and click: Save
  • Double click onto the created spec file to open it up in an editor:

  • Edit the spec file. If you provide any libraries you might want to run ldconfig post installing.

Note that the spec file is like a script file and can be handled as such. Also keep in mind that the structure you provided earlier will be installed to root and that scripts always will have root as working directory.

  • Save and Close the file
  • Click the Start button and wait for the process to come to an end. You will be told where the created rpm is located.
  • Open a terminal and run rpmlint with the created rpm as parameter to check for errors and warnings and adjust your settings and spec file accordingly.

Navigation