Hi All,
I have recently developed a patch that allows the display of the version
info on startup, and in the preferences to hold info about the
repository that the source was built from. I haven't quite finished it
yet but want to get feedback from package developers.
The main idea is that:
./configure --with-buildinfo-repotype=git
would cause the terminal output to display:
Cinelerra 2.1CV GIT::cd8d0e02dd39d612889c8cffe0fd7cc5b95a1418 (C) 2006
Heroine Virtual Ltd.
Compiled on Sat Sep 23 14:09:21 CST 2006
Cinelerra is free software, covered by the GNU General Public License,
....
Whilst
./configure --with-buildinfo-repotype=svn
would cause the terminal output to display:
Cinelerra 2.1CV SVN 896M (C) 2006 Heroine Virtual Ltd.
Compiled on Sat Sep 23 14:43:35 CST 2006
Cinelerra is free software, covered by the GNU General Public License,
...
Using this flag alone, it will only create / update the versioninfo.h
file if it doesn't exist. If you want it to be created on each compile,
then you can pass the flag --with-buildinfo-recompile, which will force
a re-creation of versioninfo.h on each execution of make, (and result in
recompiling main.o and aboutprefs.o and re-linking)
Part of the idea with this patch is that package developers could create
their own versioninfo.h files to specify the distribution, and compile
specific info etc.
Before I commit it, I wouldn't mind getting feedback on the patch..
Index: configure.in
===================================================================
--- configure.in (revision 892)
+++ configure.in (working copy)
@@ -228,6 +228,26 @@
AM_CONDITIONAL(HAVE_FIREWIRE,test "x$enable_firewire" = "xok")
############## END OF FIREWIRE
+############# BUILDINFO display, (for displaying version / date)
+AC_ARG_WITH(buildinfo-repotype,
+ AC_HELP_STRING([--with-buildinfo-repotype], [sets the repository type (git or SVN at the moment) for build info]),
+ [ binfo_repotype=$withval ],
+ [ binfo_repotype="none" ])
+AC_SUBST(buildinfo_repotype)
+
+AM_CONDITIONAL(BUILDINFO_GIT, test "x$binfo_repotype" = "xgit")
+AM_CONDITIONAL(BUILDINFO_SVN, test "x$binfo_repotype" = "xsvn")
+
+AC_ARG_WITH(buildinfo-recompile,
+ AC_HELP_STRING([--with-buildinfo-recompile], [recompile the affected objects every instance of make.]),
+ [ binfo_recompile=$withval ],
+ [ binfo_recompile="no" ])
+AC_SUBST(buildinfo_repotype)
+
+AM_CONDITIONAL(BUILDINFO_RECOMPILE, test "x$binfo_recompile" = "xyes")
+
+############# END BUILDINFO display, (for displaying version / date)
+
############# CSS SUPPORT IN LIBMPEG3
if test "x$enable_css" = "xyes"; then
CSS_CFLAGS="-DHAVE_CSS"
Index: cinelerra/aboutprefs.C
===================================================================
--- cinelerra/aboutprefs.C (revision 892)
+++ cinelerra/aboutprefs.C (working copy)
@@ -5,6 +5,7 @@
#include "quicktime.h"
#include "theme.h"
#include "vframe.h"
+#include "versioninfo.h"
@@ -42,10 +43,9 @@
y += get_text_height(LARGEFONT);
char license2[BCTEXTLEN];
- sprintf(license2, "%s%s%s%s%s",
+ sprintf(license2, "%s%s%s%s",
_("(C) 2006 Heroine Virtual Ltd.\n\n"),
- _("SVN Version: "),
- SVNVERSION,
+ REPOABOUTPREFTXT,
_("\nBuild date: "),
BUILDDATE);
set_font(MEDIUMFONT);
Index: cinelerra/Makefile.am
===================================================================
--- cinelerra/Makefile.am (revision 893)
+++ cinelerra/Makefile.am (working copy)
@@ -1,5 +1,32 @@
BUILDDATE=$(shell date)
+
+if BUILDINFO_RECOMPILE
+main.o: versioninfo
+aboutprefs.o: versioninfo
+
+versioninfo:
+else
+main.o: versioninfo.h
+aboutprefs.o: versioninfo.h
+
+versioninfo.h:
+endif
+ echo '#define BUILDDATE "$(BUILDDATE)"' > versioninfo.h
+
+if BUILDINFO_GIT
+GITVERSION=$(shell if [ -d $(top_srcdir)/.git ]; then cd $(top_srcdir); cg-object-id; else echo "unk"; fi)
+ echo '#define REPOMAINTXT " GIT::$(GITVERSION) (C) 2006 Heroine Virtual Ltd.\nCompiled on $(BUILDDATE)"' >> versioninfo.h
+ echo '#define REPOABOUTPREFTXT "Git SHA-1: $(GITVERSION)"' >> versioninfo.h
+else
+if BUILDINFO_SVN
SVNVERSION=$(shell svnversion $(top_srcdir))
+ echo '#define REPOMAINTXT " SVN $(SVNVERSION) (C) 2006 Heroine Virtual Ltd.\nCompiled on $(BUILDDATE)"' >> versioninfo.h
+ echo '#define REPOABOUTPREFTXT "SVN Version: $(GITVERSION)"' >> versioninfo.h
+else #default
+ echo '#define REPOMAINTXT "(C) 2006 Heroine Virtual Ltd.\nCompiled on $(BUILDDATE)"' >> versioninfo.h
+ echo '#define REPOABOUTPREFTXT ""' >> versioninfo.h
+endif
+endif
SUBDIRS = data
@@ -309,9 +336,7 @@
$(MJPEG_CFLAGS) \
$(OPENEXR_CFLAGS) \
$(LIBDV_CFLAGS) \
- -DPLUGIN_DIR=\"$(plugindir)\" \
- -DSVNVERSION="\"$(SVNVERSION)\"" \
- -DBUILDDATE="\"$(BUILDDATE)\""
+ -DPLUGIN_DIR=\"$(plugindir)\"
AM_LDFLAGS = -export-dynamic
Index: cinelerra/main.C
===================================================================
--- cinelerra/main.C (revision 892)
+++ cinelerra/main.C (working copy)
@@ -14,6 +14,7 @@
#include "pluginserver.h"
#include "preferences.h"
#include "renderfarmclient.h"
+#include "versioninfo.h"
#include <locale.h>
#include <stdlib.h>
@@ -178,9 +179,8 @@
fprintf(stderr,
PROGRAM_NAME " "
CINELERRA_VERSION " "
- BUILDDATE
- " SVN Version " SVNVERSION
- " (C)2006 Heroine Virtual Ltd.\n\n"
+ REPOMAINTXT
+ "\n\n"
PROGRAM_NAME " is free software, covered by the GNU General Public License,\n"
"and you are welcome to change it and/or distribute copies of it under\n"