Update the revision checks to work with a pure-git repo
This commit is contained in:
parent
fd6652b345
commit
42a016a83b
9 changed files with 99 additions and 79 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -64,3 +64,4 @@ configure
|
|||
svn-revision.h
|
||||
svn_revision
|
||||
svnmove.txt
|
||||
git_version.h
|
||||
|
|
|
@ -43,7 +43,7 @@ AEGISUB_VERSION_DATA = @AEGISUB_VERSION_DATA@
|
|||
BUILD_DATE = @BUILD_DATE@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_DEBUG = @PACKAGE_DEBUG@
|
||||
SVN_REVISION = @SVN_REVISION@
|
||||
BUILD_VERSION_STRING = @BUILD_GIT_VERSION_STRING@
|
||||
# OS X
|
||||
BUNDLE_STRING = @BUNDLE_STRING@
|
||||
DARWIN_ARCH = @DARWIN_ARCH@
|
||||
|
|
9
aegisub/build/version.bat
Normal file
9
aegisub/build/version.bat
Normal file
|
@ -0,0 +1,9 @@
|
|||
cd %~dp0..
|
||||
sh build/version.sh .
|
||||
if %ERRORLEVEL% NEQ 0 goto :fail
|
||||
goto :eof
|
||||
|
||||
:fail
|
||||
ECHO Aegisub requires that sh and git be on the windows command line path for version checking.
|
||||
> build\git_version.h echo #define BUILD_GIT_VERSION_NUMBER 0
|
||||
>> build\git_version.h echo #define BUILD_GIT_VERSION_STR "unknown"
|
52
aegisub/build/version.sh
Executable file
52
aegisub/build/version.sh
Executable file
|
@ -0,0 +1,52 @@
|
|||
srcdir="$1"
|
||||
|
||||
# If no git repo try to read from the existing git_version.h, for building from tarballs
|
||||
if ! test -d "${srcdir}/.git"; then
|
||||
version_h_path="${srcdir}/aegisub/build/git_version.h"
|
||||
if test -f "${version_h_path}"; then
|
||||
while read line; do
|
||||
set -- $line
|
||||
export $2=$(echo $3 | sed 's/"//g')
|
||||
done < "${version_h_path}"
|
||||
if test x$BUILD_GIT_VERSION_NUMBER != x -a x$BUILD_GIT_VERSION_STRING != x; then
|
||||
export VERSION_SOURCE="from cached git_version.h"
|
||||
return 0
|
||||
else
|
||||
echo "invalid git_version.h"
|
||||
exit 2
|
||||
fi
|
||||
else
|
||||
echo "git repo not found and no cached git_version.h"
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
|
||||
last_svn_revision=6962
|
||||
last_svn_hash="2289c084f28d9923989e1b58b81332347130ea78"
|
||||
|
||||
git_branch="$(git symbolic-ref HEAD 2> /dev/null)" || git_branch="(unnamed branch)"
|
||||
git_branch="${git_branch##refs/heads/}"
|
||||
git_revision=$(expr $last_svn_revision + $(git log --pretty=oneline $last_svn_hash..HEAD 2>/dev/null | wc -l))
|
||||
git_hash=$(git rev-parse --short HEAD)
|
||||
|
||||
git_version_str="${git_revision}-${git_branch}-${git_hash}"
|
||||
|
||||
new_version_h="\
|
||||
#define BUILD_GIT_VERSION_NUMBER ${git_revision}
|
||||
#define BUILD_GIT_VERSION_STRING \"${git_version_str}\""
|
||||
|
||||
# may not exist yet for out of tree builds
|
||||
mkdir -p build
|
||||
version_h_path="build/git_version.h"
|
||||
|
||||
# Write it only if it's changed to avoid spurious rebuilds
|
||||
# This bizzare comparison method is due to that newlines in shell variables are very exciting
|
||||
case "$(cat ${version_h_path} 2> /dev/null)"
|
||||
in
|
||||
"${new_version_h}");;
|
||||
*) echo "${new_version_h}" > "${version_h_path}"
|
||||
esac
|
||||
|
||||
export BUILD_GIT_VERSION_NUMBER="${git_revision}"
|
||||
export BUILD_GIT_VERSION_STRING="${git_version_str}"
|
||||
export VERSION_SOURCE="from git"
|
|
@ -40,7 +40,6 @@ AC_CONFIG_HEADER([acconf.h])
|
|||
AC_GNU_SOURCE
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
|
||||
###########################
|
||||
# Check host architecture
|
||||
###########################
|
||||
|
@ -151,29 +150,9 @@ PKG_PROG_PKG_CONFIG([pkgconfig_required_version])
|
|||
#################
|
||||
# Developers only
|
||||
#################
|
||||
# XXX: This needs to be fixed to handle mixed revisions properly
|
||||
# There is probably a better way to handle it as well...
|
||||
AC_MSG_CHECKING([for svn version])
|
||||
# Try to get revision from working copy and check if it makes sense
|
||||
SVN_REVISION=`svnversion $srcdir | sed "s/\(^@<:@0-9@:>@*\).*/\1/"` 2> /dev/null
|
||||
AS_IF([test -n "$SVN_REVISION" -a -z "`echo $SVN_REVISION | tr -d '0-9'`"], [
|
||||
`echo $SVN_REVISION > $srcdir/svn_revision`
|
||||
AC_MSG_RESULT([$SVN_REVISION from "svnversion $srcdir"])
|
||||
], [test -f "$srcdir/svn_revision"], [
|
||||
SVN_REVISION=`cat $srcdir/svn_revision`
|
||||
AC_MSG_RESULT([$SVN_REVISION from "$srcdir/svn_revision"])
|
||||
], [test -d "$srcdir/../.git"], [
|
||||
SVN_REVISION=[`git log --format=%b | grep git-svn-id -m 1 | sed -E 's/.*@([0-9]+) .*/\1/'`]
|
||||
`echo $SVN_REVISION > $srcdir/svn_revision`
|
||||
AC_MSG_RESULT([$SVN_REVISION from git])
|
||||
], [
|
||||
AC_MSG_RESULT([not found])
|
||||
AC_MSG_FAILURE([unable to get SVN Revision from $srcdir/svn_revision or 'svnversion $srcdir'])
|
||||
])
|
||||
|
||||
# This is required in order for the config file to work correctly.
|
||||
AC_DEFINE_UNQUOTED([BUILD_SVN_REVISION], [$SVN_REVISION], [SVN Revision number, used for config.dat and version.cpp])
|
||||
|
||||
AC_MSG_CHECKING([for version])
|
||||
. $srcdir/build/version.sh "$srcdir/.."
|
||||
AC_MSG_RESULT([$BUILD_GIT_VERSION_STRING $VERSION_SOURCE])
|
||||
|
||||
# Release information.
|
||||
AS_IF([test "aegisub_FINAL_RELEASE" = "1"], [
|
||||
|
@ -181,24 +160,23 @@ AS_IF([test "aegisub_FINAL_RELEASE" = "1"], [
|
|||
BUNDLE_STRING="${PACKAGE_NAME}"
|
||||
DMG_STRING="${PACKAGE_NAME}-${PACKAGE_VERSION}-${arch_bundle}"
|
||||
], [
|
||||
PACKAGE_STRING="${PACKAGE_STRING}-dev-r${SVN_REVISION}"
|
||||
PACKAGE_VERSION="${PACKAGE_VERSION}-dev-r${SVN_REVISION}"
|
||||
VERSION="${VERSION}-dev-r${SVN_REVISION}"
|
||||
PACKAGE_STRING="${PACKAGE_STRING}-dev-r${BUILD_GIT_VERSION_NUMBER}"
|
||||
PACKAGE_VERSION="${PACKAGE_VERSION}-dev-r${BUILD_GIT_VERSION_NUMBER}"
|
||||
VERSION="${VERSION}-dev-r${BUILD_GIT_VERSION_NUMBER}"
|
||||
|
||||
BUNDLE_STRING="${PACKAGE_NAME}-${PACKAGE_VERSION}"
|
||||
DMG_STRING="${PACKAGE_NAME}-${PACKAGE_VERSION}-${arch_bundle}"
|
||||
])
|
||||
PACKAGE_TARNAME="${PACKAGE_TARNAME}-${PACKAGE_VERSION}"
|
||||
|
||||
# Used in version.cpp
|
||||
AC_MSG_CHECKING([for build date])
|
||||
BUILD_DATE=`date "+%Y-%m-%d %H:%M %Z"`
|
||||
AC_MSG_RESULT($BUILD_DATE)
|
||||
|
||||
AC_SUBST(SVN_REVISION)
|
||||
AC_SUBST(BUILD_DATE)
|
||||
AC_SUBST(BUNDLE_STRING)
|
||||
AC_SUBST(DMG_STRING)
|
||||
AC_SUBST([BUILD_GIT_VERSION_STRING])
|
||||
AC_SUBST([BUILD_DATE])
|
||||
|
||||
###################################################
|
||||
# Check for pthreads and setup variables / compiler
|
||||
|
@ -731,7 +709,7 @@ AS_IF([test x$with_ffms2 != xyes], [AC_MSG_NOTICE([
|
|||
AC_MSG_RESULT([
|
||||
Configure settings
|
||||
Install prefix: $prefix
|
||||
SVN Revision: $SVN_REVISION
|
||||
Revision: $BUILD_GIT_VERSION_STRING
|
||||
Debug $enable_debug
|
||||
CFLAGS $CFLAGS
|
||||
CXXFLAGS $CXXFLAGS
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<string>@PLIST_VERSION@</string>
|
||||
|
||||
<key>CFBundleLongVersionString</key>
|
||||
<string>@PLIST_VERSION@ (@PLIST_SVN_REVISION@), Copyright 2005-2012, aegisub http://www.aegisub.org/</string>
|
||||
<string>@PLIST_VERSION@, Copyright 2005-2012, aegisub http://www.aegisub.org/</string>
|
||||
|
||||
<!-- Values: i386, ppc, x86_65, ppc64 -->
|
||||
<key>LSArchitecturePriority</key>
|
||||
|
@ -39,7 +39,7 @@
|
|||
|
||||
<!-- Displayed in the 'Get Info' context menu dialogue -->
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>aegisub version @PLIST_VERSION@ (@PLIST_SVN_REVISION@) built on @PLIST_BUILD_DATE@ http://www.aegisub.org/</string>
|
||||
<string>aegisub version @PLIST_VERSION@ built on @PLIST_BUILD_DATE@ http://www.aegisub.org/</string>
|
||||
|
||||
<!-- Whether to allow multiple instances across user logins -->
|
||||
<key>LSMultipleInstancesProhibited</key>
|
||||
|
|
|
@ -5,7 +5,7 @@ PROGRAM_INSTALL = yes
|
|||
|
||||
PRECOMPILED_HEADER_NAME=agi_pre.h
|
||||
|
||||
AEGISUB_CFLAGS = -I. -I.. -Iinclude -I../libaegisub/include -DAEGISUB $(CFLAGS_PTHREAD) $(CFLAGS_FFTW3) $(CFLAGS_PROFILE)
|
||||
AEGISUB_CFLAGS = -I. -I.. -Iinclude -I../libaegisub/include -I../build -DAEGISUB $(CFLAGS_PTHREAD) $(CFLAGS_FFTW3) $(CFLAGS_PROFILE)
|
||||
|
||||
CFLAGS += $(AEGISUB_CFLAGS)
|
||||
CXXFLAGS += $(AEGISUB_CFLAGS) -D__STDC_FORMAT_MACROS $(CXXFLAGS_WX)
|
||||
|
|
|
@ -37,60 +37,40 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "version.h"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#include "../build/svn-revision.h"
|
||||
#endif
|
||||
|
||||
#define STR_INT2(x) #x
|
||||
#define STR_INT(x) STR_INT2(x)
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define DEBUG_SUFFIX " [DEBUG VERSION]"
|
||||
#else
|
||||
#define DEBUG_SUFFIX ""
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_CREDIT
|
||||
#define BUILD_CREDIT_SUFFIX ", " BUILD_CREDIT
|
||||
#else
|
||||
#define BUILD_CREDIT_SUFFIX ""
|
||||
#endif
|
||||
|
||||
#ifndef BUILD_SVN_DATE
|
||||
#define BUILD_SVN_DATE __DATE__ " " __TIME__
|
||||
#endif
|
||||
|
||||
#ifndef BUILD_SVN_LOCALMODS
|
||||
#define BUILD_SVN_LOCALMODS ""
|
||||
#endif
|
||||
#include "git_version.h"
|
||||
|
||||
// Define FINAL_RELEASE to mark a build as a "final" version, ie. not pre-release version
|
||||
// In that case it won't include the SVN revision information
|
||||
#ifdef FINAL_RELEASE
|
||||
#define VERSION_NUMBER "3.0.0"
|
||||
#define VERSION_NUMBER "3.0.0"
|
||||
#define BUILD_CREDIT_SUFFIX ""
|
||||
#define DEBUG_SUFFIX ""
|
||||
#else
|
||||
#define VERSION_NUMBER "r" STR_INT(BUILD_SVN_REVISION) BUILD_SVN_LOCALMODS
|
||||
#define VERSION_NUMBER BUILD_GIT_VERSION_STRING
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define DEBUG_SUFFIX " [DEBUG VERSION]"
|
||||
#else
|
||||
#define DEBUG_SUFFIX ""
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_CREDIT
|
||||
#define BUILD_CREDIT_SUFFIX ", " BUILD_CREDIT
|
||||
#else
|
||||
#define BUILD_CREDIT_SUFFIX ""
|
||||
#endif
|
||||
#endif
|
||||
|
||||
const char *GetAegisubLongVersionString() {
|
||||
#ifdef FINAL_RELEASE
|
||||
return VERSION_NUMBER DEBUG_SUFFIX;
|
||||
#else
|
||||
return VERSION_NUMBER " (development version" BUILD_CREDIT_SUFFIX ")" DEBUG_SUFFIX;
|
||||
#endif
|
||||
return VERSION_NUMBER BUILD_CREDIT_SUFFIX DEBUG_SUFFIX;
|
||||
}
|
||||
|
||||
const char *GetAegisubShortVersionString() {
|
||||
#ifdef FINAL_RELEASE
|
||||
return VERSION_NUMBER " (built from SVN revision r" #BUILD_SVN_REVISION BUILD_SVN_LOCALMODS ")" DEBUG_SUFFIX;
|
||||
#else
|
||||
return VERSION_NUMBER " (development version" BUILD_CREDIT_SUFFIX ")" DEBUG_SUFFIX;
|
||||
#endif
|
||||
return VERSION_NUMBER DEBUG_SUFFIX;
|
||||
}
|
||||
|
||||
const char *GetAegisubBuildTime() {
|
||||
return BUILD_SVN_DATE;
|
||||
return __DATE__ " " __TIME__;
|
||||
}
|
||||
|
||||
const char *GetAegisubBuildCredit() {
|
||||
|
@ -114,9 +94,10 @@ const char *GetVersionNumber() {
|
|||
}
|
||||
|
||||
int GetSVNRevision() {
|
||||
#ifdef BUILD_SVN_REVISION
|
||||
return BUILD_SVN_REVISION;
|
||||
#ifdef BUILD_GIT_VERSION_NUMBER
|
||||
return BUILD_GIT_VERSION_NUMBER;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
s/@PLIST_VERSION@/@VERSION@/g
|
||||
s/@PLIST_SVN_REVISION@/@SVN_REVISION@/g
|
||||
s/@PLIST_VERSION@/@BUILD_VERSION_STRING@/g
|
||||
s/@PLIST_BUILD_DATE@/@BUILD_DATE@/g
|
||||
s/@PKG_DMG_STRING@/@DMG_STRING@/
|
||||
s/@PKG_BUNDLE_STRING@/@BUNDLE_STRING@/
|
||||
|
|
Loading…
Reference in a new issue