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 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 LDADD = posix/libposix.a
aegisub_SOURCES = about.cpp \ aegisub_SOURCES = about.cpp \
aegisublocale.cpp \ aegisublocale.cpp \

View file

@ -37,6 +37,7 @@
#include <wx/datetime.h> #include <wx/datetime.h>
#include "version.h" #include "version.h"
#ifdef WIN32
// This include is generated by build/make-svn-rev-header.py // This include is generated by build/make-svn-rev-header.py
// That script should be run before every build is initiated // That script should be run before every build is initiated
#include "build/svn-revision.h" #include "build/svn-revision.h"
@ -47,13 +48,22 @@
#include "build/build-credit.h" #include "build/build-credit.h"
#endif #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. // 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 { struct VersionInfoStruct {
// Some raw data // Some raw data
wxChar *VersionNumber; wxChar *VersionNumber;
bool IsDebug; bool IsDebug;
bool IsRelease;
int SvnRev; int SvnRev;
wxChar *BuildTime; wxChar *BuildTime;
wxChar *BuildCredit; wxChar *BuildCredit;
@ -64,6 +74,8 @@ struct VersionInfoStruct {
// Generate the above data // Generate the above data
VersionInfoStruct() { VersionInfoStruct() {
wxString SCMStr, VersionStr;
// Update this whenever a new version is release // Update this whenever a new version is release
VersionNumber = _T("v1.10"); VersionNumber = _T("v1.10");
#ifdef _DEBUG #ifdef _DEBUG
@ -75,21 +87,21 @@ struct VersionInfoStruct {
BuildTime = _T(BUILD_TIMESTAMP); BuildTime = _T(BUILD_TIMESTAMP);
BuildCredit = _T(BUILD_CREDIT); BuildCredit = _T(BUILD_CREDIT);
if (IsDebug && SvnRev > 0) { if (SvnRev > 0)
LongVersionString = wxString::Format(_T("%s PRE-RELEASE (debug, svn %d, %s)"), VersionNumber, SvnRev, BuildCredit); SCMStr = wxString::Format(_T("svn %d"), SvnRev);
ShortVersionString = wxString::Format(_T("%s svn %d debug"), VersionNumber, SvnRev); #ifdef BUILD_DARCS
else
SCMStr = _T("darcs");
#endif
} else if (IsDebug && SvnRev <= 0) { IsRelease = SvnRev < 0;
LongVersionString = wxString::Format(_T("%s beta (debug, %s)"), VersionNumber, BuildCredit); VersionStr = wxString::Format(_T("%s %s"), VersionNumber, IsRelease ? _T(" beta") : _T(" PRE-RELEASE"));
ShortVersionString = wxString::Format(_T("%s beta debug"), VersionNumber);
} else if (SvnRev > 0) { LongVersionString = wxString::Format(_T("%s (%s%s, %s)"), VersionStr.c_str(), IsDebug ? _T("debug, ") : _T(""), SCMStr.c_str(), BuildCredit);
LongVersionString = wxString::Format(_T("%s PRE-RELEASE (svn %d, %s)"), VersionNumber, SvnRev, BuildCredit); ShortVersionString = wxString::Format(_T("%s %s%s"), VersionStr.c_str(), SCMStr.c_str(), IsDebug ? _T(" debug") : _T(""));
ShortVersionString = wxString::Format(_T("%s svn %d PRE-RELEASE"), VersionNumber, SvnRev);
} else { if (IsRelease && !IsDebug)
ShortVersionString = LongVersionString = wxString::Format(_T("%s beta"), VersionNumber); ShortVersionString = LongVersionString = VersionStr;
}
} }
}; };