Hi,

On Tue, Apr 19, 2005 at 12:35:00AM +0200, Alexandre Duret-Lutz wrote:
> If a file is distributed, it should not be rebuild by configure.
> If a file is build by configure, there is no point in distributing it.

generally, yes.  But the rpm *.spec file might be an exception.

rpm contains an option (rpmbuild -t*) which says: find a spec file in
the tarball and use it to build the package.  If a maintainer decides
to support this (weird) option, then the spec file has to be distributed.

The spec file contains a version number.  Thus it's safer to generate it
from a template.

> In your case I suggest you build mypackage.spec from a custom
> rule in Makefile.am.  See how Automake builds its copy if
> m4/amversion.m4 for instance.

I think you are right that a simple sed command might be better then
config.status here.  But it might be difficult to get all dependencies
right.  I think something like this is needed:

EXTRA_DIST += mypackage.spec mypackage.spec.in

$(top_srcdir)/mypackage.spec: $(top_srcdir)/mypackage.spec.in 
$(top_srcdir)/configure.ac
        $(MAKE) $(AM_MAKEFLAGS) Makefile
        $(MAKE) $(AM_MAKEFLAGS) update-spec

.PHONY: update-spec
update-spec:
        sed -e 's,[EMAIL PROTECTED]@],$(VERSION),g' 
$(top_srcdir)/mypackage.spec.in \
                >$(top_srcdir)/mypackage.spec

Am I missing something?
Is there a simpler way to make sure that the version number in the spec file
will be always up to date, yet the file won't be regenerated in every build?

No wonder people do it the simple way: add the spec file to AC_OUTPUT.
(Fortunately, distcheck doesn't complain.)

Have a nice day,
        Stepan Kasal


Reply via email to