TinyURL widget - shorten your URL's for free!

Enter a long URL to make tiny:

Thursday, November 19, 2015

Autoversion under Autoheader / Autoconf / Automake under git repositories


 https://www.gnu.org/graphics/heckert_gnu.small.png

There is a way to make the library update it's version number automagically is to use the

git describe --tags

function to get the current library version, the GPG signage, and store that value in a temporary file that you shouldn't track inside the repository.


In configure.ac:

AC_INIT([library], m4_esyscmd([build-aux/git-version-gen.sh .version]), [email@shaw.ca])
 Add this line to update the library version from a shell script. There is an unquoted version of m4_esyscmd_s that strips newlines but I found storing straight to file did not add any.

I got this from libqb's git repository but I modified their file to include git describe --tags rather than the original version.


Inside Makefile.am I added .phony targets unlike how libqb did with this:

.version:
    git describe --tags > build-aux/.version
dist-hook:
    git describe --tags  > $(distdir)/.tarball-version

.PHONY:  .version

commit:
    DATE='date'
    git commit -m  " $DATE "
    git push
    
.PHONY: commit

to make a version that then gets read by the autoheader when it sets up configure.

I added an auto commit as well but I may not use that. 

I added another shellscript to the top folder for priming the pump and inserting the first version number into the .version file.

#!/bin/sh
# uprev.sh - shell script to update the latest library tags.

git describe --tags > build-aux/.version

No comments:

Post a Comment