== Setting up to build RPMs There's three ways to build RPMs: the silly way, the easy way, and the better way. The silly way starts with _[[/bin/su ../sysadmin/ASysadminTwitch]] root_, which should be enough of a warning sign. You really don't want to be building and installing packages as root unless you don't have a choice, and you do. The easy way is: > _$ cat >$HOME/.rpmmacros \\ > ((%_topdir)) /some/where \\ > ^D \\ > $ cd /some/where \\ > $ mkdir BUILD RPMS SOURCES SPECS_ Then you can build as a normal user out of your _/some/where_ hierarchy. I tend to use something like _/u/cks/sys/RPM_, but where you put it is up to you. (I always use absolute paths and I suspect that RPM requires them, so you can't use _$HOME_ or _~/.._ or the like.) The problem with the easy way is that you wind up with an awful jumble in the _SOURCES_ and _SPECS_ subdirectories, because all of your sources and patches wind up in _SOURCES_, and all of your RPM spec files wind up in _SPECS_. This also makes it all but impossible to work with two versions of an RPM at the same time, since their specfiles usually stage a duel to the death. The better way isn't original to me; I got it from Red Hat's Mike A. Harris. Put the following in your $HOME/.rpmmacros instead of the easy version: > _((%_topdir)) /some/where \\ > ((%_sourcedir)) ((%{_topdir}/SOURCES/%{name}-%{version})) \\ > \\ > ((%_specdir)) ((%{_sourcedir}))_ This puts all of the bits of a given version of an RPM, say _liferea-1.0.7_, in _SOURCES/liferea-1.0.7_, instead of spread out across two flat directories. Which is *much* easy to work with and keep track of. (Trust me; I did it the 'easy' way for a while until I got totally fed up and found Mike Harris's version.) (Ob-attr-darnit: [[here http://www.rpm.org/hintskinks/buildtree/]] on [[rpm.org http://www.rpm.org/]]. Note that some of the information linked there is a bit out of date; for example, you no longer need a _.rpmrc_ to have your _.rpmmacros_ acted on.)