提交 743cca1c authored 作者: Michael Jerris's avatar Michael Jerris

make windows build update version info out of configure.in settings like the autotools build.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5612 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 bbf691e6
...@@ -199,6 +199,30 @@ Function Showpath(folderspec) ...@@ -199,6 +199,30 @@ Function Showpath(folderspec)
showpath = f.path & "\" showpath = f.path & "\"
End Function End Function
Function FindVersionStringInConfigure(strConfigFile, strVersionString)
Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Pattern = "[^#]AC_SUBST\(" & strVersionString & ".*\[([^\[]*)\]"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strConfigFile, 1)
strSearchString = objFile.ReadAll
objFile.Close
Set colMatches = objRegEx.Execute(strSearchString)
strResult = ""
If colMatches.Count > 0 Then
For Each strMatch in colMatches
strResult = objRegEx.Replace(strMatch.Value, "$1")
Next
End If
FindVersionStringInConfigure = strResult
End Function
Sub FindReplaceInFile(FileName, sFind, sReplace) Sub FindReplaceInFile(FileName, sFind, sReplace)
Const OpenAsASCII = 0 ' Opens the file as ASCII (TristateFalse) Const OpenAsASCII = 0 ' Opens the file as ASCII (TristateFalse)
Const OpenAsUnicode = -1 ' Opens the file as Unicode (TristateTrue) Const OpenAsUnicode = -1 ' Opens the file as Unicode (TristateTrue)
...@@ -219,6 +243,12 @@ End Sub ...@@ -219,6 +243,12 @@ End Sub
Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest) Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest)
Dim oExec Dim oExec
strVerMajor = FindVersionStringInConfigure(VersionDir & "configure.in", "SWITCH_VERSION_MAJOR")
strVerMinor = FindVersionStringInConfigure(VersionDir & "configure.in", "SWITCH_VERSION_MINOR")
strVerMicro = FindVersionStringInConfigure(VersionDir & "configure.in", "SWITCH_VERSION_MICRO")
strVerRev = FindVersionStringInConfigure(VersionDir & "configure.in", "SWITCH_VERSION_REVISION")
If Right(tmpFolder, 1) <> "\" Then tmpFolder = tmpFolder & "\" End If If Right(tmpFolder, 1) <> "\" Then tmpFolder = tmpFolder & "\" End If
If Not FSO.FileExists(tmpFolder & "svnversion.exe") Then If Not FSO.FileExists(tmpFolder & "svnversion.exe") Then
Wget ToolsBase & "svnversion.exe", tmpFolder Wget ToolsBase & "svnversion.exe", tmpFolder
...@@ -226,6 +256,8 @@ Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest) ...@@ -226,6 +256,8 @@ Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest)
Dim sLastFile Dim sLastFile
Const OverwriteIfExist = -1 Const OverwriteIfExist = -1
Const ForReading = 1 Const ForReading = 1
if strVerRev = "" Then
VersionCmd="svnversion " & quote & VersionDir & "." & quote & " -n" VersionCmd="svnversion " & quote & VersionDir & "." & quote & " -n"
Set MyFile = fso.CreateTextFile(tmpFolder & "tmpVersion.Bat", True) Set MyFile = fso.CreateTextFile(tmpFolder & "tmpVersion.Bat", True)
MyFile.WriteLine("@" & "cd " & quote & tmpFolder & quote ) MyFile.WriteLine("@" & "cd " & quote & tmpFolder & quote )
...@@ -242,6 +274,11 @@ Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest) ...@@ -242,6 +274,11 @@ Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest)
sLastVersion = sLastFile.ReadLine() sLastVersion = sLastFile.ReadLine()
End If End If
sLastFile.Close sLastFile.Close
End If
if strVerRev <> "" Then
VERSION = strVerRev
End If
If VERSION = "" Then If VERSION = "" Then
VERSION = "UNKNOWN" VERSION = "UNKNOWN"
...@@ -253,7 +290,11 @@ Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest) ...@@ -253,7 +290,11 @@ Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest)
MyFile.Close MyFile.Close
FSO.CopyFile includebase, includedest, true FSO.CopyFile includebase, includedest, true
FindReplaceInFile includedest, "@SVN_VERSION@", VERSION FindReplaceInFile includedest, "@SWITCH_VERSION_REVISION@", VERSION
FindReplaceInFile includedest, "@SWITCH_VERSION_MAJOR@", strVerMajor
FindReplaceInFile includedest, "@SWITCH_VERSION_MINOR@", strVerMinor
FindReplaceInFile includedest, "@SWITCH_VERSION_MICRO@", strVerMicro
End If End If
End Sub End Sub
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论