summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBerke Viktor <berkeviktor@aol.com>2011-08-11 08:11:10 +0200
committerBerke Viktor <berkeviktor@aol.com>2011-08-11 08:11:10 +0200
commit13288a8251629dee0a3ff11a958f4c4f29afcef0 (patch)
treee9832233db4ccb9a941c12e43f9d6b1fedd6a207
parent9a4907e28a1e446e9dff89c6612f18e32f20b3fb (diff)
automatically propagate version bump from config.h
-rw-r--r--build/build-small.bat13
-rw-r--r--build/build-x86.bat17
-rw-r--r--build/version.c135
-rw-r--r--build/xchat-wdk.skel.iss4
4 files changed, 155 insertions, 14 deletions
diff --git a/build/build-small.bat b/build/build-small.bat
index 65df12fa..ca9f74af 100644
--- a/build/build-small.bat
+++ b/build/build-small.bat
@@ -1,14 +1,17 @@
 @echo off
 set WDK_ROOT=c:\WinDDK\7600.16385.1
-cd ..
-set DEV_32=%cd%\dep-x86
-cd src
-echo DEV = %DEV_32% > makeinc.mak
-type makeinc.skel.mak >> makeinc.mak
 set INCLUDE=%WDK_ROOT%\inc\api;%WDK_ROOT%\inc\crt;%WDK_ROOT%\inc\api\crt\stl70
 set LIB=%WDK_ROOT%\lib\wxp\i386;%WDK_ROOT%\lib\Crt\i386
 set OPATH=%PATH%
+set DEV_32=%cd%\..\dep-x86
 set PATH=%PROGRAMFILES(X86)%\Microsoft Visual Studio 10.0\VC\bin;%PROGRAMFILES(X86)%\Microsoft Visual Studio 10.0\Common7\IDE;%PROGRAMFILES(X86)%\Microsoft SDKs\Windows\v7.0A\Bin;%DEV_32%\bin
+del version.exe
+cl /nologo version.c
+cd ..
+build\version -r > resource.h
+cd src
+echo DEV = %DEV_32% > makeinc.mak
+type makeinc.skel.mak >> makeinc.mak
 nmake /nologo /f makefile.mak clean
 cd pixmaps
 nmake /nologo /f makefile.mak
diff --git a/build/build-x86.bat b/build/build-x86.bat
index c2df1c25..4e7d0ef0 100644
--- a/build/build-x86.bat
+++ b/build/build-x86.bat
@@ -1,20 +1,27 @@
 @echo off
+set INCLUDE=%WDK_ROOT%\inc\api;%WDK_ROOT%\inc\crt;%WDK_ROOT%\inc\api\crt\stl70
+set LIB=%WDK_ROOT%\lib\wxp\i386;%WDK_ROOT%\lib\Crt\i386
+set OPATH=%PATH%
+set DEV_32=%cd%\..\dep-x86
+set PATH=%PROGRAMFILES(X86)%\Microsoft Visual Studio 10.0\VC\bin;%PROGRAMFILES(X86)%\Microsoft Visual Studio 10.0\Common7\IDE;%PROGRAMFILES(X86)%\Microsoft SDKs\Windows\v7.0A\Bin;%DEV_32%\bin
 set PERL_512=c:\mozilla-build\perl-5.12-x86\perl
 set PERL_514=c:\mozilla-build\perl-5.14-x86
 echo [Setup] > xchat-wdk.iss
 echo WizardImageFile=%cd%\bitmaps\wizardimage.bmp >> xchat-wdk.iss
 echo WizardSmallImageFile=%cd%\bitmaps\wizardsmallimage.bmp >> xchat-wdk.iss
+del version.exe
+cl /nologo version.c
+version -a >> xchat-wdk.iss
+version -v >> xchat-wdk.iss
+version -i >> xchat-wdk.iss
+version -o >> xchat-wdk.iss
 cd ..
+build\version -r > resource.h
 echo SetupIconFile=%cd%\xchat.ico >> build\xchat-wdk.iss
 type build\xchat-wdk.skel.iss >> build\xchat-wdk.iss
-set DEV_32=%cd%\dep-x86
 cd src
 echo DEV = %DEV_32% > makeinc.mak
 type makeinc.skel.mak >> makeinc.mak
-set INCLUDE=%WDK_ROOT%\inc\api;%WDK_ROOT%\inc\crt;%WDK_ROOT%\inc\api\crt\stl70
-set LIB=%WDK_ROOT%\lib\wxp\i386;%WDK_ROOT%\lib\Crt\i386
-set OPATH=%PATH%
-set PATH=%PROGRAMFILES(X86)%\Microsoft Visual Studio 10.0\VC\bin;%PROGRAMFILES(X86)%\Microsoft Visual Studio 10.0\Common7\IDE;%PROGRAMFILES(X86)%\Microsoft SDKs\Windows\v7.0A\Bin;%DEV_32%\bin
 nmake /nologo /f makefile.mak clean
 cd pixmaps
 nmake /nologo /f makefile.mak
diff --git a/build/version.c b/build/version.c
new file mode 100644
index 00000000..baa5cb46
--- /dev/null
+++ b/build/version.c
@@ -0,0 +1,135 @@
+/* XChat-WDK
+ * Copyright (c) 2011 Berke Viktor.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <malloc.h>
+#include "../config.h"
+
+char *
+comma ()
+{
+	int major, minor;
+	char *version_string; /* nnnn,n,n,n format */
+
+	version_string = (char*) malloc (11);
+
+	if (sscanf (PACKAGE_VERSION, "%d-%d", &major, &minor) > 1)
+	{
+		sprintf (version_string, "%d,%d,0,0", major, minor);
+	} else
+	{
+		sprintf (version_string, "%d,0,0,0", major);
+	}
+
+	return version_string;
+}
+
+char *
+point ()
+{
+	int major1, major2, major3, major4, minor;
+	char *version_string; /* nn.nn.nn.nn format */
+
+	version_string = (char*) malloc (12);
+
+	if (sscanf (PACKAGE_VERSION, "%c%c%c%c-%d", &major1, &major2, &major3, &major4, &minor) > 4)
+	{
+		sprintf (version_string, "%c%c.%c%c.%d.0", major1, major2, major3, major4, minor);
+	} else
+	{
+		sprintf (version_string, "%c%c.%c%c.0.0", major1, major2, major3, major4);
+	}
+
+	return version_string;
+}
+
+int
+main (int argc, char *argv[])
+{
+	if (argc > 1)
+	{
+		if (!strcmp (argv[1], "-r"))			/* xchat.rc/FILEVERSION, PRODUCTVERSION */
+		{
+			printf ("#define COMMA_VERSION %s\n", comma ());
+		}
+		else if (!strcmp (argv[1], "-a"))	/* xchat-wdk.iss/AppVerName */
+		{
+			printf ("AppVerName=XChat-WDK %s\n", PACKAGE_VERSION);
+		}
+		else if (!strcmp (argv[1], "-v"))	/* xchat-wdk.iss/AppVersion */
+		{
+			printf ("AppVersion=%s\n", point ());
+		}
+		else if (!strcmp (argv[1], "-i"))	/* xchat-wdk.iss/VersionInfoVersion */
+		{
+			printf ("VersionInfoVersion=%s\n", point ());
+		}
+		else if (!strcmp (argv[1], "-o"))	/* xchat-wdk.iss/OutputBaseFilename */
+		{
+			printf ("OutputBaseFilename=XChat-WDK %s\n", PACKAGE_VERSION);
+		}
+		else if (!strcmp (argv[1], "-v"))	/* version.txt */
+		{
+			printf ("%s", PACKAGE_VERSION);
+		} else
+		{
+			printf ("usage:\n\t-a\txchat-wdk.iss/AppVerName\n\t-i\txchat-wdk.iss/VersionInfoVersion\n\t-o\txchat-wdk.iss/OutputBaseFilename\n\t-r\txchat.rc/FILEVERSION, PRODUCTVERSION\n\t-v\txchat-wdk.iss/AppVersion\n");
+		}
+	} else
+	{
+		printf ("usage:\n\t-a\txchat-wdk.iss/AppVerName\n\t-i\txchat-wdk.iss/VersionInfoVersion\n\t-o\txchat-wdk.iss/OutputBaseFilename\n\t-r\txchat.rc/FILEVERSION, PRODUCTVERSION\n\t-v\txchat-wdk.iss/AppVersion\n");
+	}
+
+#if 0 /* ugly hack */
+	switch ((int) argv[1][0])
+	{
+		case 'r':	/* xchat.rc/FILEVERSION, PRODUCTVERSION*/
+			printf ("#define COMMA_VERSION \"%s\"\n", comma ());
+			break;
+		case 'a':	/* xchat-wdk.iss/AppVerName */
+			printf ("AppVerName=XChat-WDK %s\n", PACKAGE_VERSION);
+			break;
+		case 'v':	/* xchat-wdk.iss/AppVersion */
+			printf ("AppVersion=%s\n", point ());
+			break;
+		case 'i':	/* xchat-wdk.iss/VersionInfoVersion */
+			printf ("VersionInfoVersion=%s\n", point ());
+			break;
+		case 'o':	/* xchat-wdk.iss/OutputBaseFilename */
+			printf ("OutputBaseFilename=XChat-WDK %s\n", PACKAGE_VERSION);
+			break;
+		case 'u':	/* version.txt */
+			printf ("%s", PACKAGE_VERSION);
+			break;
+		default:
+			printf ("use a, i, o, r or v.\n");
+			break;
+	}
+#endif
+
+	return 0;
+}
diff --git a/build/xchat-wdk.skel.iss b/build/xchat-wdk.skel.iss
index 0b68def1..3fc93f13 100644
--- a/build/xchat-wdk.skel.iss
+++ b/build/xchat-wdk.skel.iss
@@ -1,8 +1,4 @@
 AppName=XChat-WDK

-AppVerName=XChat-WDK 1496-6

-AppVersion=14.96.6

-VersionInfoVersion=14.96.6

-OutputBaseFilename=XChat-WDK 1496-6

 AppPublisher=XChat-WDK

 AppPublisherURL=http://code.google.com/p/xchat-wdk/

 AppCopyright=Copyright (C) 1998-2010 Peter Zelezny