summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorArnavion <arnavion@gmail.com>2013-10-12 18:41:27 -0700
committerArnavion <arnavion@gmail.com>2013-10-12 18:41:27 -0700
commite2edbfe47d89059f2020baccd76ad4715ef87871 (patch)
treef1948820b339f513f036e62f04ebcd0ed9803085
parent0061cd38d07396cfa42deaaa199c334b40f3d0d3 (diff)
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.
-rw-r--r--.gitignore3
-rw-r--r--config-win32.h.tt (renamed from config-win32.h)6
-rw-r--r--src/common/common.vcxproj16
-rw-r--r--src/fe-gtk/fe-gtk.vcxproj11
-rw-r--r--src/fe-gtk/hexchat.rc.tt (renamed from src/fe-gtk/hexchat.rc)5
-rw-r--r--version.include.tt12
-rw-r--r--win32/installer/hexchat.iss.tt (renamed from win32/installer/hexchat.iss)4
-rw-r--r--win32/installer/installer.vcxproj9
-rw-r--r--win32/version.txt.tt1
9 files changed, 55 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index 696b3cae..1528c6e5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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
diff --git a/config-win32.h b/config-win32.h.tt
index 9c7a1a1d..8f21d0b1 100644
--- a/config-win32.h
+++ b/config-win32.h.tt
@@ -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
diff --git a/src/common/common.vcxproj b/src/common/common.vcxproj
index bc2605dd..13610cee 100644
--- a/src/common/common.vcxproj
+++ b/src/common/common.vcxproj
@@ -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>
\ No newline at end of file
diff --git a/src/fe-gtk/fe-gtk.vcxproj b/src/fe-gtk/fe-gtk.vcxproj
index 73526766..7cc40da8 100644
--- a/src/fe-gtk/fe-gtk.vcxproj
+++ b/src/fe-gtk/fe-gtk.vcxproj
@@ -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>

diff --git a/src/fe-gtk/hexchat.rc b/src/fe-gtk/hexchat.rc.tt
index 789aa26e..87507340 100644
--- a/src/fe-gtk/hexchat.rc
+++ b/src/fe-gtk/hexchat.rc.tt
@@ -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"

 

diff --git a/version.include.tt b/version.include.tt
new file mode 100644
index 00000000..ab77a6d9
--- /dev/null
+++ b/version.include.tt
@@ -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('.');
+#>
\ No newline at end of file
diff --git a/win32/installer/hexchat.iss b/win32/installer/hexchat.iss.tt
index 68d0bedb..486e2f8d 100644
--- a/win32/installer/hexchat.iss
+++ b/win32/installer/hexchat.iss.tt
@@ -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\"
diff --git a/win32/installer/installer.vcxproj b/win32/installer/installer.vcxproj
index 88de2c35..453e87bd 100644
--- a/win32/installer/installer.vcxproj
+++ b/win32/installer/installer.vcxproj
@@ -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>

diff --git a/win32/version.txt.tt b/win32/version.txt.tt
new file mode 100644
index 00000000..64e50010
--- /dev/null
+++ b/win32/version.txt.tt
@@ -0,0 +1 @@
+<#@ include file="..\version.include.tt" #><#= string.Join(".", versionParts) #>
\ No newline at end of file