Red Hat Software PACKAGE Guidelines The following guidelines are to be used when creating Red Hat Software Program Packages (RPPs), and indeed for all aspects of the Red Hat Software Linux distribution. Index 1 - Intro 2 - Makefiles and Configure 3 - FSSTND Compliance 4 - Relocatable vs Absolute Packages 5 - File Ownership and Permissions 6 - Required Control Files 7 - Optional Control Files 8 - Building the Binary and Source Packages 1 - Intro Building packages is pretty easy. To get started, read this document, and look at the rpp and rpp-* man pages. Then install the rpp source package and check out its RPP/* files, Makefile and Makefile.rpp. Then do the same for a GNU type package (like fileutils). You should now have a pretty good understanding of how to build a package. A few notes: Note that binary and source packages are built in the same step. Don't sweat the relocatable/non-relocatable business. If it looks relocatable (for example, it just installs a single binary and man page) it probably is. Do not feel bad if you make a non-relocatable package! Very few packages have after-install install scripts (other than the ones automatically generated by makeRPP), or any of the other scripts. Please try to avoid using the rc-script and profile-script features. So far, no packages use them. 2 - Makefiles and Configure The following variables should be used in the Makefile for building sources: CC = gcc CFLAGS = -O2 LDFLAGS = -s (and possibly -N (for small fast-running utils)) If GNU configure is used, the source package must be properly configured, that is, the Makefile and any other generated files must exist and be configured properly. Also, edit the *.in files or the configure script itself instead of the generated files so that reconfiguring will not mess things up. The Makefile for each source package should contain targets for: all (default) clean install uninstall (this requirement has been relaxed - if yo can do it, great) The install target should completely compile and install the package, including setting proper ownership and permissions, installing all documentation (in /usr/doc etc). Running "make install" should build and install an equivalent of the binary package. Any installed info files should be compressed with gzip. 3 - FSSTND Compliance Our system must comply with the FSSTND document. In particular this means that some packages have a predetermined layout (TeX, for instance). In general this means that /usr must be able to be mounted read-only, perhaps via NFS. Thus, networking utilities essential to mount a remote directory must not reside on /usr, they must be in the / partition. However, the / partition must be as minimal as possible - enough to boot, check and mount all the other filesystems, and enough to do simple sysadmin tasks should something go wrong. /sbin /usr/sbin /usr/local/sbin /bin /usr/bin /usr/local/bin The sbin directories are meant for executables that are normally only run by root. Putting an executable in */sbin will not protect it in any way or make it more secure, it is just a logical grouping. The /usr/local hierarchy will be empty by default. Some programs try to write logs to /usr. These must be modified to use /var. In general, /var is a good place for programs to spool stuff and store things that don't belong elsewhere. The /etc directory should not contain any binaries or executables. Executable files that were once in /etc now belong in /sbin. The /etc directory is reserved for configuration files that need to be local to each machine. Nearly every symbolic link should be relative. That is, they should not point to a path starting with a `/'. I've got the FSSTND 2.0 and it is available on sunsite. 4 - Relocatable vs Absolute Packages A "relocatable" package is a package that can be installed under any filesystem path prefix. For instance a relocatable package could be installed under /usr or /usr/local or whatever. A relocatable package may assume the following directories under the prefix: bin doc etc include info lib man sbin src A relocatable binary package might install binaries in bin and library files in lib. You must be sure your binaries will be able to find the library files or other files, under any prefix the installer chooses. This may require an addition to the boot scripts or the user environment. There are two types of relocatable source pacakges. Relocatable, with compiled binary also relocatable, means the source can be installed under any prefix, and a "make install" will install the binaries under that prefix. To facilitate this, you might want to use an after-install script (see Optional Control Files). The other type, Relocatable, binary not relocatable, means you can install the source under any prefix, but a "make install" will always install under a fixed prefix. This prefix should be indicated in the description. 5 - File Ownerships and Permissions Man pages should be owned by root and be group `man' (gid 15). Everything else, unless there is a good reason for it, should be root.root. This includes the sources. Usually, when you get sources from the net, the owner and groups are something wacky. A "chown -R root.root ." in the source directory should fix things. 6 - Required Control Files Control files used by rpp-build and lim are located in /RPP. Files that must exist are: name - base name of the package version - version size-to-build - size, in bytes, needed to build and install from sources dependencies - packages this package depends on source-locate - relocatability of the source pacakge binary-locate - relocatability of the binary package source-prefix - path prefix to the source binary-prefix - path prefix to the binaries source-list - list of files to put in source package binary-list - list of files to put in binary package source-description - description of the source package binary-description - description of the binary package The name and version files can not have whitespace in the middle of them. That is, the name string and the version string must be single tokens. The dependencies line must not have any whitespace. Each dependency should be separated by a colon ':'. Other than that, the format is currently undefined. The *-locate files contain codes as follows: R Relocatable (binary only) N Not relocatable RBNR Relocatable, but rebuilt binary not relocatable (source only) RBR Relocatable, binary relocatable (source only) The *-prefix files contain the path prefix to be used for files in the *-list files. These files must be non-empty. To use the root directory as the prefix specify "/", other wise use the pathname with no trailing "/". The prefix will also be the path the package is installed under by default. Note that files files in the lists beginning with "/" will not be affected by the prefix. The *-list files contain the list of files to be included in the package. You should include directories your package creates as independent entries. That is, do not include: package/dir/file without including: package/dir unless yo expect package/dir to already exist. A file with a leading "/" is absolute and will not be affected by the prefix. This is not recommended. The *-description files are free form descriptions of the package. Please limit lines to 79 characters. There are limits to the sizes of these files. Check rpp.h for the current limits. As of this writing, they were: #define PH_NAME_MAX 64 #define PH_VERSION_MAX 16 #define PH_PREFIX_MAX 128 #define PH_DEPENDENCIES_MAX 128 #define PH_DESCRIPTION_MAX 2048 7 - Optional Control Files In addition a package may want to make additions to: the "rc" boot scripts the /etc/profile user environment It may also require scripts to be run after installation and/or before and/or after uninstallation. These are the optional files: rc-script (used for binary packages only) profile-script (used for binary packages only) source-before-install source-after-install source-before-uninstall source-after-uninstall binary-before-install binary-after-install binary-before-uninstall binary-after-uninstall These should all be executable scripts. Note: you may wish to include rc-script and profile-script in your source-list file, to be installed when the user does a "make install". (Also: if you do that, don't forget to include the RPP directory!) 8 - Building the Package File The following step should be used when building a package. a. Port the sources Make sure paths conform to FSSTND b. prepare source for relocatability if the package uses a standard GNU configure script "./configure --prefix=/usr" else cp Makefile Makefile.rpp edit Makefile.rpp to use @@@prefix@@@ for prefix fi c. make clean d. make install e. makeRPP f. edit RPP/{binary-list,binary-description, source-description} g. rpp-build h. rpp-install (or lim) the binaries (try /usr/local) make sure they run properly rpp-uninstall i. rpp-install (or lim) the sources (try /usr/local/src) "make -n install" to see that the install goes in the right place "make install" make sure the installed binaries work "make uninstall" "make clean" rpp-uninstall