So, I am somewhat puzzled by the rpmbuild process. I'm now maintaining a slew of scripts previously created and while most work, there are enough differences between them that finding a consistent approach is just not happening.
Some individually copy files (very tedious) to a temp location prior to packaging.
Some use the original author's spec file, we're just modifying configs or code.
Some are home-rolled, but were apparently created with the same level of understanding as I!
Specifically, I would love to just have the make; make install
approach, but, while make
builds the software just fine, make install
actually installs it on my system.
What I would like to do, is use make install, but have it placed in a working directory for the purpose of the packager. I want the software to install on the target machine in /usr/bin
etc, but when I run make install, I want it to go to /tempDir/usr/bin
-- make sense? Basically, I just want to avoid polluting my system with software I'm packaging; it doesn't seem right that it all gets plugged in. Must be something misconfigured or is this normal?
Exerpts from the spec file I'm working with. Copying source file to /usr/src/redhat/SOURCES
and building with rpmbuild -bb <specfilename>
.
BuildRoot: /var/tmp/%{name}-%{version}-root
Source0: %{name}-%{version}.tar.gz
%prep
%setup -q
%build
./configure <config opts>
make
%install
rm -rf $RPM_BUILD_ROOT
make install
./configure --prefix=%{buildroot}
or pass a variable tomake
so that it puts it in the temp directory instead of your actual root filesystem? If not wouldn't this call for patching the makefile so that you can change the path it installs into?BuildRoot
yourself. See fedoraproject.org/wiki/Packaging:RPMMacros. And in the compile step, what you typically want is to install to%{buildroot}
by passingDESTDIR=%{buildroot}
tomake
.make
and not to./configure
?--prefix
determines the final installation directory,DESTDIR
determines a staging directory for the installation and not the final installation directory.