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

View File

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

View File

@ -14,7 +14,6 @@
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\config-win32.h" />
<ClInclude Include="cfgfiles.h" /> <ClInclude Include="cfgfiles.h" />
<ClInclude Include="chanopt.h" /> <ClInclude Include="chanopt.h" />
<ClInclude Include="ctcp.h" /> <ClInclude Include="ctcp.h" />
@ -75,6 +74,10 @@
<ClCompile Include="util.c" /> <ClCompile Include="util.c" />
<ClCompile Include="hexchat.c" /> <ClCompile Include="hexchat.c" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="..\..\config-win32.h.tt" />
<ClInclude Include="..\..\config-win32.h" />
</ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{87554B59-006C-4D94-9714-897B27067BA3}</ProjectGuid> <ProjectGuid>{87554B59-006C-4D94-9714-897B27067BA3}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
@ -151,4 +154,15 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </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> </Project>

View File

@ -97,8 +97,14 @@
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup> <ItemDefinitionGroup>
<PreBuildEvent> <PreBuildEvent>
<Command>$(DepsRoot)\bin\glib-compile-resources.exe --generate-source --sourcedir $(DataDir) --target "$(ProjectDir)resources.c" "$(DataDir)hexchat.gresource.xml"</Command> <Command>
<Message>Build gresource file</Message> <![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> </PreBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
@ -166,6 +172,7 @@
<Manifest Include="hexchat.exe.manifest" /> <Manifest Include="hexchat.exe.manifest" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="hexchat.rc.tt" />
<ResourceCompile Include="hexchat.rc" /> <ResourceCompile Include="hexchat.rc" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,6 +1,7 @@
#include <winver.h> <#@ include file="..\..\version.include.tt" #>#include <winver.h>
#include "../../config-win32.h" #include "../../config-win32.h"
#include "../../resource.h"
#define COMMA_VERSION <#= string.Join(",", versionParts) #>,0
XC_ICON ICON "../../data/icons/hexchat.ico" 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" <#@ include file="..\..\version.include.tt" #>#define APPNAM "HexChat"
#define APPVER "2.9.6" #define APPVER "<#= string.Join(".", versionParts) #>"
; These are defined by our installer project at build time ; These are defined by our installer project at build time
;#define APPARCH "x64" ;#define APPARCH "x64"
;#define PROJECTDIR "C:\...\hexchat\win32\installer\" ;#define PROJECTDIR "C:\...\hexchat\win32\installer\"

View File

@ -62,9 +62,14 @@
</Link> </Link>
<PreBuildEvent> <PreBuildEvent>
<Command> <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" del "$(OutDir)hexchat.iss"
type hexchat.iss &gt;&gt; "$(OutDir)hexchat.iss" type hexchat.iss >> "$(OutDir)hexchat.iss"
"$(ProgramFiles)\Inno Setup 5\iscc.exe" /dPROJECTDIR="$(ProjectDir)" /dAPPARCH="$(Platform)" "$(OutDir)hexchat.iss"</Command> "$(ProgramFiles)\Inno Setup 5\iscc.exe" /dPROJECTDIR="$(ProjectDir)" /dAPPARCH="$(Platform)" "$(OutDir)hexchat.iss"
]]>
</Command>
</PreBuildEvent> </PreBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>

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

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