From: Henri M. <hen...@gm...> - 2020-07-01 00:18:29
|
On 30/06/20, 16:19, Ethan Merritt wrote: > On Tuesday, 30 June 2020 16:03:22 PDT Henri Menke wrote: > > Currently building the development version requires git to be installed > > to fetch the `last modified' date from the commit information. This is > > okay when building from a git clone, but fails when downloading a > > snapshot that does not contain the .git directory. > > Yeah, that has been a problem. > Thanks for looking at this. > > > To this end, I implemented a fallback which just uses the current date > > if git is not available. > > If you are building from a snapshot, the correct date should be the > date of the snapshot. I don't know how to do that. Do you? If I go to the SourceForge project page [1] and just hit the `Download Snapshot' button in the upper right corner, I get a zip file with all the source but no .git folder and also no timestamp.h. I suspect there is no or at least no easy way to make SourceForge preprocess the source when generating a snapshot. Within the Makefile determining the latest change would be tricky. The only way I can think of right now would be to run stat on all the files in the source tree and pick the newest one, but that is slow and ugly. Maybe instead of using the current date if git is unavailable just do echo '0000-00-00'. It should be pretty obvious that this is not the true `Last modified' then. Kind regards, Henri > > Ethan > > > The old version had the advantage that > > `timestamp.h' would only be rebuilt when changing the git branch. If > > git is not available, this logic fails of course. Instead I made > > `timestamp.h' a phony target, i.e. it will be rebuilt unconditionally > > every time. The disadvantage here is that this will also trigger a > > rebuild of every file that depends on `timestamp.h' but as far as I can > > see this is only `version.c'. > > --- > > src/Makefile.am | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/src/Makefile.am b/src/Makefile.am > > index 1b0d8136e..7eca23cfa 100644 > > --- a/src/Makefile.am > > +++ b/src/Makefile.am > > @@ -107,12 +107,12 @@ endif > > > > DISTCLEANFILES = timestamp.h > > BUILT_SOURCES = timestamp.h > > -git_current := $(shell cut -c6- $(top_srcdir)/.git/HEAD) > > -timestamp.h: $(top_srcdir)/.git/${git_current} Makefile > > +.PHONY: timestamp.h > > +timestamp.h: Makefile > > @echo Making $@ > > @echo "#ifndef GNUPLOT_TIMEBASE_H_INCLUDED" >$@t > > @echo "#define GNUPLOT_TIMEBASE_H_INCLUDED" >>$@t > > - @echo "const char gnuplot_date[] = \"`git --git-dir '$(top_srcdir)/.git' log -1 --format=%ci | cut -b-11`\";" >>$@t > > + @echo "const char gnuplot_date[] = \"`git --git-dir '$(top_srcdir)/.git' log -1 --format=%cs || date +'%Y-%m-%d'`\";" >>$@t > > @echo "#endif /* GNUPLOT_TIMEBASE_H_INCLUDED */" >> $@t > > @if cmp -s $@ $@t; then rm -f $@t; else mv $@t $@; fi > > > > > > > > |