win32: Use version information from configure.ac to populate the Windows-specific files that need it - config-win32.h, version.txt, hexchat.rc, hexchat.iss

This is done via T4 templates. The original files are now generated at build-time and so have been added to .gitignore and removed from the repository, with the exception of version.txt which must be hosted on GitHub for the updater plugin.
This commit is contained in:
Arnavion 2013-10-12 18:41:27 -07:00
parent 0061cd38d0
commit e2edbfe47d
9 changed files with 55 additions and 12 deletions

3
.gitignore vendored
View File

@ -18,6 +18,7 @@ config.h
config.log
config.status
config.sub
config-win32.h
configure
configure.tmp
depcomp
@ -45,6 +46,7 @@ src/common/make-te
src/common/textenums.h
src/common/textevents.h
src/fe-gtk/hexchat
src/fe-gtk/hexchat.rc
src/fe-text/hexchat-text
src/htm/Main.resources
src/htm/thememan.exe
@ -70,6 +72,7 @@ win32/ext/perl/perl-x86-cache
win32/ext/perl/perl-x86-SetupFiles
win32/ext/perl/perl-x64-cache
win32/ext/perl/perl-x64-SetupFiles
win32/installer/hexchat.iss
resource.h
*.opensdf
*.sdf

View File

@ -1,4 +1,4 @@
#define LOCALEDIR ".\\share\\locale"
<#@ include file="version.include.tt" #>#define LOCALEDIR ".\\share\\locale"
#define ENABLE_NLS
#define USE_GMODULE
#define USE_PLUGIN
@ -8,12 +8,12 @@
#define ISO_CODES_PREFIX ".\\"
#define ISO_CODES_LOCALEDIR LOCALEDIR
#define PACKAGE_NAME "hexchat"
#define PACKAGE_VERSION "2.9.6"
#define PACKAGE_VERSION "<#= string.Join(".", versionParts) #>"
#define HEXCHATLIBDIR ".\\plugins"
#define HEXCHATSHAREDIR "."
#define OLD_PERL
#define GETTEXT_PACKAGE "hexchat"
#define PACKAGE_TARNAME "hexchat-2.9.6"
#define PACKAGE_TARNAME "hexchat-<#= string.Join(".", versionParts) #>"
#ifndef USE_IPV6
#define socklen_t int
#endif

View File

@ -14,7 +14,6 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\config-win32.h" />
<ClInclude Include="cfgfiles.h" />
<ClInclude Include="chanopt.h" />
<ClInclude Include="ctcp.h" />
@ -75,6 +74,10 @@
<ClCompile Include="util.c" />
<ClCompile Include="hexchat.c" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\config-win32.h.tt" />
<ClInclude Include="..\..\config-win32.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{87554B59-006C-4D94-9714-897B27067BA3}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
@ -151,4 +154,15 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<ItemDefinitionGroup>
<PreBuildEvent>
<Command>
<![CDATA[
SET SOLUTIONDIR=$(SolutionDir)..\
"%PROGRAMFILES%\Common Files\microsoft shared\TextTemplating\12.0\TextTransform.exe" -out "%SOLUTIONDIR%config-win32.h" "%SOLUTIONDIR%config-win32.h.tt"
"%PROGRAMFILES%\Common Files\microsoft shared\TextTemplating\12.0\TextTransform.exe" -out "%SOLUTIONDIR%win32\version.txt" "%SOLUTIONDIR%win32\version.txt.tt"
]]>
</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
</Project>

View File

@ -97,8 +97,14 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup>
<PreBuildEvent>
<Command>$(DepsRoot)\bin\glib-compile-resources.exe --generate-source --sourcedir $(DataDir) --target "$(ProjectDir)resources.c" "$(DataDir)hexchat.gresource.xml"</Command>
<Message>Build gresource file</Message>
<Command>
<![CDATA[
SET SOLUTIONDIR=$(SolutionDir)..\
"%PROGRAMFILES%\Common Files\microsoft shared\TextTemplating\12.0\TextTransform.exe" -out hexchat.rc hexchat.rc.tt
$(DepsRoot)\bin\glib-compile-resources.exe --generate-source --sourcedir $(DataDir) --target "$(ProjectDir)resources.c" "$(DataDir)hexchat.gresource.xml"
]]>
</Command>
<Message>Build hexchat.rc and gresource file</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
@ -166,6 +172,7 @@
<Manifest Include="hexchat.exe.manifest" />
</ItemGroup>
<ItemGroup>
<None Include="hexchat.rc.tt" />
<ResourceCompile Include="hexchat.rc" />
</ItemGroup>
<ItemGroup>

View File

@ -1,6 +1,7 @@
#include <winver.h>
<#@ include file="..\..\version.include.tt" #>#include <winver.h>
#include "../../config-win32.h"
#include "../../resource.h"
#define COMMA_VERSION <#= string.Join(",", versionParts) #>,0
XC_ICON ICON "../../data/icons/hexchat.ico"

12
version.include.tt Normal file
View File

@ -0,0 +1,12 @@
<#@
template debug="false" hostspecific="false" language="C#" #><#@
assembly name="System.Core" #><#@
import namespace="System.IO" #><#@
import namespace="System.Linq" #><#@
import namespace="System.Text.RegularExpressions" #><#
var versionParts = File.ReadLines(Path.Combine(System.Environment.GetEnvironmentVariable("SOLUTIONDIR"), "configure.ac"))
.Select(line => Regex.Match(line, @"^AC_INIT\(\[HexChat\],\[([^]]+)\]\)$"))
.First(match => match.Success)
.Groups[1].Value
.Split('.');
#>

View File

@ -1,5 +1,5 @@
#define APPNAM "HexChat"
#define APPVER "2.9.6"
<#@ include file="..\..\version.include.tt" #>#define APPNAM "HexChat"
#define APPVER "<#= string.Join(".", versionParts) #>"
; These are defined by our installer project at build time
;#define APPARCH "x64"
;#define PROJECTDIR "C:\...\hexchat\win32\installer\"

View File

@ -62,9 +62,14 @@
</Link>
<PreBuildEvent>
<Command>
<![CDATA[
SET SOLUTIONDIR=$(SolutionDir)..\
"%PROGRAMFILES%\Common Files\microsoft shared\TextTemplating\12.0\TextTransform.exe" -out "%SOLUTIONDIR%win32\installer\hexchat.iss" "%SOLUTIONDIR%win32\installer\hexchat.iss.tt"
del "$(OutDir)hexchat.iss"
type hexchat.iss &gt;&gt; "$(OutDir)hexchat.iss"
"$(ProgramFiles)\Inno Setup 5\iscc.exe" /dPROJECTDIR="$(ProjectDir)" /dAPPARCH="$(Platform)" "$(OutDir)hexchat.iss"</Command>
type hexchat.iss >> "$(OutDir)hexchat.iss"
"$(ProgramFiles)\Inno Setup 5\iscc.exe" /dPROJECTDIR="$(ProjectDir)" /dAPPARCH="$(Platform)" "$(OutDir)hexchat.iss"
]]>
</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>

1
win32/version.txt.tt Normal file
View File

@ -0,0 +1 @@
<#@ include file="..\version.include.tt" #><#= string.Join(".", versionParts) #>