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...

1) Get existing source rpm (SRPM) and install it with rpm -i

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

3) As root, cd to the SPECS directory and verify that there is a 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>

5) Some times it works and builds a binary RPM in /usr/src/redhat/RPMS/arm/...

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

1) Unpack the sources and apply existing patches: go to the SPECS directory and do a rpm -bp <spec-file-name>

2) Go to SOURCES 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 the SOURCES directory and generate a patch:

      diff -uNr package-original-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