The standard way to do an rpmbuild on fedora/redhat is to use the %configure macro in the %prep section of the spec file and the %makeinstall macro in the %install section. These set all of the bindir, libdir, datadir, sysconfdir, etc. paths used by the application. %configure sets them to their "real" runtime locations e.g. /usr/lib, and %makeinstall sets them to their paths used for rpm packaging e.g. /var/tmp/fedora-ds-foo-bar-baz/usr/lib. There were a few places in our autotools files where we were running afoul of this. Another thing is that configure defines bindir etc. as literally '${exec_prefix}/bin' so that the real value doesn't get expanded until make or make install time. This means that we cannot create scripts from templates in configure, we have to do that in make. So this adds a sed command to Makefile.am in order to do all of the script and config file path replacement at make time. Since we do the subst this way, whatever $prefix is set during make will be incorporated into the value of $bindir etc. so we can omit directly referencing @prefix@ in the template files.
Created attachment 139919 [details] diffs
Created attachment 139920 [details] list of files affected list of files
Your changes look good. One question... Could you tell me why the backslash is needed before the second @? It's in Makefile.am. +fixupcmd = sed \ + -e 's,@bindir\@,$(bindir),g' \ ^ + -e 's,@libdir\@,$(libdir),g' \ ^ + [...]
Aside from Noriko's question in comment#3, the changes look fine. You may be able to use things such as $pkglibdir in places where you want to package name (fedora-ds in this case) appended to one of the standard paths such as $libdir. Automake supports this for all of the normal path macros like bindir, libdir, sysconfdir, etc.
> Your changes look good. One question... Could you tell me why the backslash is > needed before the second @? It's in Makefile.am. > +fixupcmd = sed \ > + -e 's,@bindir\@,$(bindir),g' \ > ^ >+ -e 's,@libdir\@,$(libdir),g' \ > ^ >+ [...] Good question. It's because configure runs the same substitution on Makefile.in to create Makefile. We have to escape one of the @ so that configure won't replace e.g. @bindir@ with /usr/bin (or ${exec_prefix}/bin). I suppose I could have used another delimiter character, but we're already using @var@ in our templates and scripts. > You may be able to use things such as $pkglibdir in places where you want > to package name (fedora-ds in this case) appended to one of the standard > paths such as $libdir. > Automake supports this for all of the normal path macros like bindir, libdir, > sysconfdir, etc. I'm not sure what you mean. How would I use this?
Ah, I see! The var format is shared, of course. Thanks for explaining it for me!
Created attachment 140071 [details] cvs commit log Reviewed by: nhosoi (Thanks!) Files: see diff Branch: HEAD Platforms tested: RHEL4 Flag Day: no Doc impact: no
An additional change is needed to allow us to build from outside of the ldapserver directory. Here's the change: Index: Makefile.am =================================================================== RCS file: /cvs/dirsec/ldapserver/Makefile.am,v retrieving revision 1.9 diff -u -5 -t -r1.9 Makefile.am --- Makefile.am 2 Nov 2006 03:11:39 -0000 1.9 +++ Makefile.am 3 Nov 2006 21:27:05 -0000 @@ -905,7 +905,8 @@ -e 's,@serverdir\@,$(serverdir),g' \ -e 's,@serverplugindir\@,$(serverplugindir),g' \ -e 's,@taskdir\@,$(taskdir),g' \ -e 's,@configdir\@,$(configdir),g' -% : %.in +%: %.in + mkdir -p $(dir $@) $(fixupcmd) $^ > $@
Checked in the changes from comment#8 (along with the generated build files). Checking in Makefile.am; /cvs/dirsec/ldapserver/Makefile.am,v <-- Makefile.am new revision: 1.10; previous revision: 1.9 done Checking in Makefile.in; /cvs/dirsec/ldapserver/Makefile.in,v <-- Makefile.in new revision: 1.11; previous revision: 1.10 done Checking in aclocal.m4; /cvs/dirsec/ldapserver/aclocal.m4,v <-- aclocal.m4 new revision: 1.4; previous revision: 1.3 done Checking in compile; /cvs/dirsec/ldapserver/compile,v <-- compile new revision: 1.3; previous revision: 1.2 done Checking in config.guess; /cvs/dirsec/ldapserver/config.guess,v <-- config.guess new revision: 1.3; previous revision: 1.2 done Checking in config.sub; /cvs/dirsec/ldapserver/config.sub,v <-- config.sub new revision: 1.3; previous revision: 1.2 done Checking in configure; /cvs/dirsec/ldapserver/configure,v <-- configure new revision: 1.8; previous revision: 1.7 done Checking in depcomp; /cvs/dirsec/ldapserver/depcomp,v <-- depcomp new revision: 1.3; previous revision: 1.2 done Checking in install-sh; /cvs/dirsec/ldapserver/install-sh,v <-- install-sh new revision: 1.3; previous revision: 1.2 done Checking in missing; /cvs/dirsec/ldapserver/missing,v <-- missing new revision: 1.3; previous revision: 1.2 done
pushed to be verified bu build person
We have been using these changes to sucessfully build our RPM for quite some time now. Marking as VERIFIED.