That's a really good idea. The trouble is that I need to have multiple versions installed (eg. compiled with the various compilers), so I think I still need to manipulate name in some way, so the packages will be named differently. But _prefix should definitely give me more flexibility as to where it's installed.
Lloyd Brown Systems Administrator Fulton Supercomputing Lab Brigham Young University http://marylou.byu.edu On 06/27/2012 11:12 AM, Jeff Squyres wrote: > On Jun 26, 2012, at 2:40 PM, Lloyd Brown wrote: > >> Is there an easy way with the .spec file and the rpmbuild command, for >> me to override the path the OpenMPI RPM installs into, in /opt? >> Basically, I'm already doing something like this: > > I think all you need to do is override the RPM-builtin names, like _prefix > (and possibly some others). For example, I did this in RHEL 6.2: > > rpmbuild --rebuild --define '_prefix /tmp/bogus' \ > /home/jsquyres/RPMS/SRPMS/openmpi-1.6-1.src.rpm > > Which resulted in: > > + ./configure --build=x86_64-unknown-linux-gnu > --host=x86_64-unknown-linux-gnu --target=x86_64-redhat-linux-gnu > --program-prefix= --prefix=/tmp/bogus --exec-prefix=/tmp/bogus > --bindir=/tmp/bogus/bin --sbindir=/tmp/bogus/sbin --sysconfdir=/tmp/bogus/etc > --datadir=/tmp/bogus/share --includedir=/tmp/bogus/include > --libdir=/tmp/bogus/lib64 --libexecdir=/tmp/bogus/libexec > --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man > --infodir=/usr/share/info > > For some reason, this didn't override localstatedir, sharedstatedir, mandir, > and infodir (gotta love RPM! :-) ), so I did: > > rpmbuild --rebuild --define '_prefix /tmp/bogus' --define '_localstatedir > /tmp/bogus/var' --define '_sharedstatedir /tmp/bogus/var/lib' --define > '_mandir /tmp/bogus/share/man' --define '_infodir /tmp/bogus/share/info' > /home/jsquyres/RPMS/SRPMS/openmpi-1.6-1.src.rpm > > When then gave me what I think you want: > > + ./configure --build=x86_64-unknown-linux-gnu > --host=x86_64-unknown-linux-gnu --target=x86_64-redhat-linux-gnu > --program-prefix= --prefix=/tmp/bogus --exec-prefix=/tmp/bogus > --bindir=/tmp/bogus/bin --sbindir=/tmp/bogus/sbin --sysconfdir=/tmp/bogus/etc > --datadir=/tmp/bogus/share --includedir=/tmp/bogus/include > --libdir=/tmp/bogus/lib64 --libexecdir=/tmp/bogus/libexec > --localstatedir=/tmp/bogus/var --sharedstatedir=/tmp/bogus/var/lib > --mandir=/tmp/bogus/share/man --infodir=/tmp/bogus/share/info >