注射水银修改集版本信息在C可执行程序 [英] Injecting mercurial changeset as version information in a C executable

查看:137
本文介绍了注射水银修改集版本信息在C可执行程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对于一个项目,我的工作有最新的善变变更记录,这样当用户抱怨的错误行为,我可以跟踪他们正在使用哪个版本的可执行文件。我的一些可执行文件是Python和其他被编译C.有没有办法自动执行此,或者你可以点我表现出解决方案的项目,我可以看看?

I would like the executables for a project I am working on to have the latest mercurial changeset recorded so that when a user complains about buggy behavior, I can track which version they are using. Some of my executables are Python and others are compiled C. Is there a way to automate this, or can you point me to projects that exhibit solutions that I can look at?

我使用的autoconf在我的项目......万一,使解决方案更加容易。

I am using autoconf in my project... in case that makes the solution easier.

谢谢!

的setjmp

推荐答案

此加入 configure.ac

AM_CONDITIONAL([IS_HG_REPO], [test -d "$srcdir/.hg"])

以下行添加到 Makefile.am

if IS_HG_REPO
AM_CPPFLAGS = -DHGVERSION="\"$(PACKAGE) `hg parents --template 'hgid: {node|short}'`\""
else
AM_CPPFLAGS = -DHGVERSION=PACKAGE_STRING
endif

这将定义 HGVERSION 作为格式的字符串 APPNAME hgid:24d0921ee4bd APPNAME版本,如果从发行tar包建。

This will define HGVERSION as a string of the form APPNAME hgid: 24d0921ee4bd or APPNAME VERSION, if building from a release tarball.

这篇关于注射水银修改集版本信息在C可执行程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆