Building NetWinder RPMs mini-HOWTO

From an email message by Ralph Siemsen <ralphs@corelcomputer.com> to oclug@netwinder.org.

The preferred thing to do would be to upload a binary and a source RPM. The SRPM would include your patches.

Here is the basic recipe, hopefully understandable to all (it's a question that has come up a fair bit lately). You can also find this written in more detail in the RPM book ("Maximum RPM") in chapter 20. Also see http://www.rpm.org for on-line reading...

Basic builds (no patches)

1) Get existing source rpm (SRPM) and install it
    rpm -i <source-rpm-name>

2) That places source code into a subdirectory in  /usr/src/redhat/SOURCES and a so-called spec file /usr/src/redhat/SPECS.

3) As root, cd to the SPECS directory and locate the spec file for the package you installed. It basically contains the steps needed to build / install the package.

4) Cross your fingers and type
    rpm -bb <spec.file.name>     (-bb means 'build binary')

5) If all goes well, this will unpack the sources, apply any patches, do a 'configure', then 'make', and finally it will collect all the binaries into a binary RPM and place the result in /usr/src/redhat/RPMS/arm/.

Builds with patches

IF the above doesn't work, then you need to do the following:

1) Go to the SPECS directory as before and type:
    rpm -bp <spec-file-name>         (-bp means 'build prep')
This will unpack the sources and apply any patches.
Everything is located in a subdirectory of /usr/src/redhat/BUILD

2) Go to the BUILD directory and do a recursive copy of the source directory for your package. You are making a copy so that you can later generate diffs.

3) Now go into the source directory and build manually as you would normally (ie. configure, make, make install, etc.)

4) Once you have it working to your satisfaction, do a make clean. You should also remove any other files (config.h, etc) that might have been built. The real test is to do a recursive ls in the original and working source directorys- the filename should all match up.

5) Go to back to the /usr/src/redhat/BUILD directory and generate a patch:
     diff -uNr original-package-dir/ working-package-dir/  > netwinder.patch

6) Take a look at the patch file netwinder.patch ;)

7) Move the patch file into /usr/src/redhat/SOURCES

8) Go to the SPECS file and in the %prep section, add a the line

       %patch <filename>
after any other patches

9) Cross your fingers and do a rpm -bb <spec-file-name> (or use -ba to get a source RPM as well, including your changes).

10) The results show up in /usr/src/redhat/RPMS/arm.

Good luck! Ralph Siemsen