fix posix build & modify version string

Originally committed to SVN as r378.
This commit is contained in:
David Lamparter 2006-05-07 14:29:45 +00:00
parent 9950531430
commit 815225667a
2 changed files with 31 additions and 14 deletions

View File

@ -5,7 +5,12 @@ SUBDIRS = bitmaps posix
bin_PROGRAMS = aegisub
AM_CPPFLAGS = -Iposix -include posix/defines.h
SVNREV := $(strip $(shell grep revision= .svn/entries 2>/dev/null | cut -d \" -f 2))
DARCSREV := $(strip $(shell head -n 1 ../_darcs/inventory 2>/dev/null))
REVISION := $(if $(SVNREV),-DBUILD_SVN_REVISION=$(SVNREV)) $(if $(DARCSREV),-DBUILD_DARCS)
BUILDINFO := -DBUILD_CREDIT="\"$(shell whoami)\"" $(REVISION)
AM_CPPFLAGS = -Iposix -include posix/defines.h $(BUILDINFO)
LDADD = posix/libposix.a
aegisub_SOURCES = about.cpp \
aegisublocale.cpp \

View File

@ -37,6 +37,7 @@
#include <wx/datetime.h>
#include "version.h"
#ifdef WIN32
// This include is generated by build/make-svn-rev-header.py
// That script should be run before every build is initiated
#include "build/svn-revision.h"
@ -47,13 +48,22 @@
#include "build/build-credit.h"
#endif
// If the BUILD_SVN_REVISION happens to be zero or less, the build is assumed to be a public-release build (ie. not prerel)
#else
#define BUILD_TIMESTAMP __DATE__ " " __TIME__
#ifndef BUILD_SVN_REVISION
#define BUILD_SVN_REVISION 0
#endif
#endif
// If the BUILD_SVN_REVISION happens to be negative, the build is assumed to be a public-release build (ie. not prerel)
// So manually edit build/svn-revision.h to match that, when doing such a build, or add some other magic to do that.
struct VersionInfoStruct {
// Some raw data
wxChar *VersionNumber;
bool IsDebug;
bool IsRelease;
int SvnRev;
wxChar *BuildTime;
wxChar *BuildCredit;
@ -64,6 +74,8 @@ struct VersionInfoStruct {
// Generate the above data
VersionInfoStruct() {
wxString SCMStr, VersionStr;
// Update this whenever a new version is release
VersionNumber = _T("v1.10");
#ifdef _DEBUG
@ -75,21 +87,21 @@ struct VersionInfoStruct {
BuildTime = _T(BUILD_TIMESTAMP);
BuildCredit = _T(BUILD_CREDIT);
if (IsDebug && SvnRev > 0) {
LongVersionString = wxString::Format(_T("%s PRE-RELEASE (debug, svn %d, %s)"), VersionNumber, SvnRev, BuildCredit);
ShortVersionString = wxString::Format(_T("%s svn %d debug"), VersionNumber, SvnRev);
if (SvnRev > 0)
SCMStr = wxString::Format(_T("svn %d"), SvnRev);
#ifdef BUILD_DARCS
else
SCMStr = _T("darcs");
#endif
} else if (IsDebug && SvnRev <= 0) {
LongVersionString = wxString::Format(_T("%s beta (debug, %s)"), VersionNumber, BuildCredit);
ShortVersionString = wxString::Format(_T("%s beta debug"), VersionNumber);
IsRelease = SvnRev < 0;
VersionStr = wxString::Format(_T("%s %s"), VersionNumber, IsRelease ? _T(" beta") : _T(" PRE-RELEASE"));
} else if (SvnRev > 0) {
LongVersionString = wxString::Format(_T("%s PRE-RELEASE (svn %d, %s)"), VersionNumber, SvnRev, BuildCredit);
ShortVersionString = wxString::Format(_T("%s svn %d PRE-RELEASE"), VersionNumber, SvnRev);
LongVersionString = wxString::Format(_T("%s (%s%s, %s)"), VersionStr.c_str(), IsDebug ? _T("debug, ") : _T(""), SCMStr.c_str(), BuildCredit);
ShortVersionString = wxString::Format(_T("%s %s%s"), VersionStr.c_str(), SCMStr.c_str(), IsDebug ? _T(" debug") : _T(""));
} else {
ShortVersionString = LongVersionString = wxString::Format(_T("%s beta"), VersionNumber);
}
if (IsRelease && !IsDebug)
ShortVersionString = LongVersionString = VersionStr;
}
};