RPM build root location different from intended install location

Asked by Jordan Rhody on 2007-05-25

I am creating an upstart RPM package for Fedora. I am using this line for configuring for use to package in RPM:

./configure --prefix=$RPM_BUILD_ROOT/opt/upstart --sysconfdir=/etc/ --enable-compat=sysv --enable-shared=no --enable-static=no

rpmbuild successfully builds the binary rpm package. Also, the rpm package successfully installs in /opt/upstart/sbin (following the Fedora install instructions for the 'secure way'). However, this is where the problem starts.

Whenever I try to do an /opt/upstart/sbin/reboot, I get an error:

'reboot: Unable to execute shutdown: No such file or directory'

On further investigation, this error is valid. The reason this error is in compat/sysv/reboot.c on line 222. 'SHUTDOWN' is a pre-defined string in Makefile, Makefile.am, and Makefile.in. It refers back to the full install path set in .configure.

Since RPM uses build-root to actually compile sources, and package up binaries, the path used for setting the install path should be different than when referencing installed binaries.

My assumption is all binaries are going to be installed together in one directory, such as '/sbin/' or '/opt/upstart/sbin', etc. If so, can't one binary just call the other from the same directory, rather than providing the full path?

If not, is there another suggestion for resolving this issue? Another idea is to take out SHUTDOWN from Makefile and redefine SHUTDOWN on line 74 in reboot.c to the intended full path for shutdown binary.


Jordan Rhody

Question information

English Edit question
upstart Edit question
No assignee Edit question
Last query:
Last reply:

You should not use RPM_BUILD_ROOT in this manner.

Do not pass it when configuring or making upstart, instead set the DESTDIR variable to that value when doing "make install", e.g.:

$ ./configure --prefix=/opt/upstart --sysconfdir=/etc/ --enable-compat=sysv --enable-shared=no --enable-static=no
$ make
$ make DESTDIR=$RPM_BUILD_ROOT install

All of the files will be installed under $RPM_BUILD_ROOT in a directory tree suitable for packaging, but will have all been compiled with the intended destination paths.

Appears Solved