RE: prefix for rpmbuild?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On behalf Of dblank@xxxxxxxxxxxx
>
> I'm attempting to build some packages, but I would like the initial
build
> made with the rpmbuild command to go to, say, /usr/local, and then
have
> the "rpm -i" command put it where ever it defaults.

If you are trying to make the temporary install under /usr/local/somedir
you should set your buildroot to /usr/local/somedir in the spec file.
It is best to have it under a temporary directory that can be deleted or
investigated between builds.  /var/tmp/${packagename}-root is a common
place for this. 

> The problem is, there seems to be only one default. For example, if I
do
> this in the SPEC file:
>
> Prefix: /usr/local
> %install
> %makeinstall
>
> Then the files will go into /usr because that is the default:
>
> % rpm --eval %{_prefix}
> /usr
>
> Of course, that builds fine, and I could then:
>
> rpm -i --prefix=/usr/local package.rpm
>
> Now, I can force it to go to /usr/local in the build by doing this:
>
> %define _prefix /usr/local
> Prefix: /usr
> %install
> %makeinstall
>
> But, then it isn't relocatable (well, it thinks it is, but --prefix
has no
> effect).

Prefix is used to build (somewhat) relocatable packages.  %_prefix
defines where most things are installed relative to the root and
%(buildroot) directories.

There are 2 areas you touch during the rpm build, these are the %_topdir
and the %(buildroot).  %_topdir/BUILD is where the software is
extracted, patched, and built.  %(buildroot) is the location used as the
base directory of %makeinstall as well as the base of the cpio of %files
that make up the rpm archive.  

 
> So, is there a way to get it to build in /usr/local but then default
> correctly when installing? Or I am I just trying to do something that
I
> shouldn't be doing?
>
> Thanks for any hints (hope that this is clear),

Cheers,
Rik



[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux