[llvm-commits] [LLVMdev] How to identify LLVM version? [updated patch]
İsmail Dönmez
ismail at namtrac.org
Fri Jul 1 05:53:31 PDT 2011
Hi;
On Fri, Jul 1, 2011 at 2:44 PM, Duncan Sands <baldrick at free.fr> wrote:
> Hi Yuri,
>
> > +/*===-- Version
> -----------------------------------------------------------===*/
> > +
> > +typedef enum {
> > + /* Terminator Instructions */
>
> ^ Strange comment
>
> > + LLVMVersionNumber = 1,
> > + LLVMVersionRepository = 2
> > +} LLVMVersion;
> > +
> > +const char* LLVMGetVersion(LLVMVersion VN);
>
> I think it would be better to get rid of the enum and have two functions.
>
> > +SVNVERSION := $(shell cd $(PROJ_SRC_ROOT)&& (LC_ALL=C svnversion -cn
> . 2>/dev/null | sed -e "s/.*://" -e "s/\([0-9]*\).*/\1/" | grep "[0-9]" ||
> LC_ALL=C svn info . 2>/dev/null | awk '/^Revision:/ {print $$2 }' | grep
> "[0-9]" || LC_ALL=C git svn info . 2>/dev/null | awk '/^Revision:/ {print
> $$2 }' | grep "[0-9]" || echo unknown))
> > +CPPFLAGS += -DREPOSITORY_REVISION="\"$(SVNVERSION)\""
>
> I don't much like this. Probably there should be some helper for
> determining
> the revision. And does everyone have sed and awk? And what about when
> building
> a release so there is no repository, no svn or git?
>
Here is the version.sh script from mplayer;
# releases extract the version number from the VERSION file
version=$(cat VERSION 2> /dev/null)
if test -z $version ; then
# Extract revision number from file used by daily tarball snapshots
# or from the places different Subversion versions have it.
svn_revision=$(cat snapshot_version 2> /dev/null)
test $svn_revision || svn_revision=$(LC_ALL=C svn info 2> /dev/null | grep
Revision | cut -d' ' -f2)
test $svn_revision || svn_revision=$(grep revision .svn/entries 2>/dev/null
| cut -d '"' -f2)
test $svn_revision || svn_revision=$(sed -n -e '/^dir$/{n;p;q;}'
.svn/entries 2>/dev/null)
test $svn_revision && svn_revision=SVN-r$svn_revision
test $svn_revision || svn_revision=UNKNOWN
version=$svn_revision
fi
Regards,
ismail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110701/f131b614/attachment.html>
More information about the llvm-commits
mailing list