Update versioning for AMBuild and git.

Former-commit-id: ea473061ef1f3b52716decfb4dafcfd66167730d
This commit is contained in:
David Anderson 2014-02-08 20:37:33 -08:00
parent a07cf853d7
commit 1f15fdd6cb
50 changed files with 270 additions and 217 deletions

View File

@ -11,9 +11,11 @@ class AMXXConfig(object):
self.metamod_path = None
self.hlsdk_path = None
self.mysql_path = None
self.generated_headers = None
def detectProductVersion(self):
builder.AddConfigureFile('product.version')
builder.AddConfigureFile('.git/HEAD')
# For OS X dylib versioning
import re
@ -200,8 +202,12 @@ class AMXXConfig(object):
cfg.defines += [
'AMX_NOPROPLIST',
'PAWN_CELL_SIZE=32',
'AMBUILD',
]
cfg.includes += [os.path.join(builder.buildPath, 'includes')]
return
#
# Low-level compiler and binary construction.
#
@ -236,7 +242,7 @@ class AMXXConfig(object):
'-current_version', self.productVersion
]
#binary.compiler.linkflags += [self.versionlib]
#binary.compiler.sourcedeps += SM.generated_headers
binary.compiler.sourcedeps += AMXX.generated_headers
return binary
def ModuleBuilder(self, context, compiler, name):
@ -262,7 +268,7 @@ class AMXXConfig(object):
# 'RC_COMPILE',
# ]
# binary.compiler.linkflags += [self.versionlib]
# binary.compiler.sourcedeps += SM.generated_headers
binary.compiler.sourcedeps += AMXX.generated_headers
return binary
#
@ -303,6 +309,11 @@ AMXX.detectHlsdk()
AMXX.detectMysql()
AMXX.configure()
AMXX.generated_headers = builder.RunScript(
'support/Versioning',
{ 'AMXX': AMXX }
)
builder.RunBuildScripts(
[
'amxmodx/AMBuilder',

View File

@ -39,7 +39,7 @@
#include "CFlagManager.h"
#include "nongpl_matches.h"
#include "format.h"
#include "svn_version.h"
#include <amxmodx_version.h>
extern CFlagManager FlagMan;
CVector<CAdminData *> DynamicAdmins;

View File

@ -44,7 +44,7 @@
#define vsnprintf _vsnprintf
#endif
#include "svn_version.h"
#include <amxmodx_version.h>
CLog::CLog()
{

View File

@ -50,7 +50,7 @@
#include "datastructs.h"
#include "CFlagManager.h"
#include "svn_version.h"
#include <amxmodx_version.h>
#include "trie_natives.h"
plugin_info_t Plugin_info =

View File

@ -30,7 +30,7 @@
*/
#include "amxmodx.h"
#include "svn_version.h"
#include <amxmodx_version.h>
void amx_command()
{

View File

@ -1,9 +0,0 @@
#ifndef _INCLUDE_SVN_VERSION_H_
#define _INCLUDE_SVN_VERSION_H_
#define SVN_VERSION_STRING "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$"
#define SVN_VERSION_DWORD $PMAJOR$,$PMINOR$,$PREVISION$,0
#define SVN_VERSION_PRODUCT "$PMAJOR$.$PMINOR$.$PREVISION$"
#define SVN_BUILD_ID SVN_VERSION_STRING " $BUILD_ID$"
#endif //_INCLUDE_SVN_VERSION_H_

View File

@ -69,7 +69,7 @@ int main(int argc, char **argv)
exit(0);
}
pc_printf("Welcome to the AMX Mod X %s Compiler.\n", VERSION_STRING);
pc_printf("Welcome to the AMX Mod X %s Compiler.\n", SVN_VERSION);
pc_printf("Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team\n\n");
if (argc < 2)

View File

@ -1,7 +1,7 @@
#ifndef _AMXXSC_INCLUDE_H
#define _AMXXSC_INCLUDE_H
#define VERSION_STRING "1.8.1-300"
#include <amxmodx_version.h>
#define MAGIC_HEADER2 0x414D5858
#define MAGIC_VERSION 0x0300

View File

@ -3,7 +3,11 @@
#ifndef __MODULECONFIG_H__
#define __MODULECONFIG_H__
#include "svn_version.h"
#if defined AMBUILD
# include <amxmodx_version.h>
#else
# define SVN_VERSION "dev-local"
#endif
// Module info
#define MODULE_NAME "CStrike"

View File

@ -1,9 +0,0 @@
#ifndef _INCLUDE_SVN_VERSION_H_
#define _INCLUDE_SVN_VERSION_H_
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$"
#endif //_INCLUDE_SVN_VERSION_H_

View File

@ -3,7 +3,11 @@
#ifndef __MODULECONFIG_H__
#define __MODULECONFIG_H__
#include "svn_version.h"
#if defined AMBUILD
# include <amxmodx_version.h>
#else
# define SVN_VERSION "dev-local"
#endif
// Module info
#define MODULE_NAME "CSX"

View File

@ -1,9 +0,0 @@
#ifndef _INCLUDE_SVN_VERSION_H_
#define _INCLUDE_SVN_VERSION_H_
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$"
#endif //_INCLUDE_SVN_VERSION_H_

View File

@ -3,7 +3,11 @@
#ifndef __MODULECONFIG_H__
#define __MODULECONFIG_H__
#include "svn_version.h"
#if defined AMBUILD
# include <amxmodx_version.h>
#else
# define SVN_VERSION "dev-local"
#endif
// Module info
#define MODULE_NAME "DoD Fun"

View File

@ -1,9 +0,0 @@
#ifndef _INCLUDE_SVN_VERSION_H_
#define _INCLUDE_SVN_VERSION_H_
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$"
#endif //_INCLUDE_SVN_VERSION_H_

View File

@ -3,7 +3,11 @@
#ifndef __MODULECONFIG_H__
#define __MODULECONFIG_H__
#include "svn_version.h"
#if defined AMBUILD
# include <amxmodx_version.h>
#else
# define SVN_VERSION "dev-local"
#endif
// Module info
#define MODULE_NAME "DoDX"

View File

@ -1,9 +0,0 @@
#ifndef _INCLUDE_SVN_VERSION_H_
#define _INCLUDE_SVN_VERSION_H_
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$"
#endif //_INCLUDE_SVN_VERSION_H_

View File

@ -3,7 +3,11 @@
#ifndef __MODULECONFIG_H__
#define __MODULECONFIG_H__
#include "svn_version.h"
#if defined AMBUILD
# include <amxmodx_version.h>
#else
# define SVN_VERSION "dev-local"
#endif
// Module info
#define MODULE_NAME "Engine"

View File

@ -1,9 +0,0 @@
#ifndef _INCLUDE_SVN_VERSION_H_
#define _INCLUDE_SVN_VERSION_H_
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$"
#endif //_INCLUDE_SVN_VERSION_H_

View File

@ -3,7 +3,11 @@
#ifndef __MODULECONFIG_H__
#define __MODULECONFIG_H__
#include "svn_version.h"
#if defined AMBUILD
# include <amxmodx_version.h>
#else
# define SVN_VERSION "dev-local"
#endif
// Module info
#define MODULE_NAME "FakeMeta"

View File

@ -1,9 +0,0 @@
#ifndef _INCLUDE_SVN_VERSION_H_
#define _INCLUDE_SVN_VERSION_H_
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$"
#endif //_INCLUDE_SVN_VERSION_H_

View File

@ -3,7 +3,11 @@
#ifndef __MODULECONFIG_H__
#define __MODULECONFIG_H__
#include "svn_version.h"
#if defined AMBUILD
# include <amxmodx_version.h>
#else
# define SVN_VERSION "dev-local"
#endif
// Module info
#define MODULE_NAME "Fun"

View File

@ -1,9 +0,0 @@
#ifndef _INCLUDE_SVN_VERSION_H_
#define _INCLUDE_SVN_VERSION_H_
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$"
#endif //_INCLUDE_SVN_VERSION_H_

View File

@ -3,7 +3,11 @@
#ifndef __MODULECONFIG_H__
#define __MODULECONFIG_H__
#include "svn_version.h"
#if defined AMBUILD
# include <amxmodx_version.h>
#else
# define SVN_VERSION "dev-local"
#endif
// Module info
#define MODULE_NAME "GeoIP"

View File

@ -1,9 +0,0 @@
#ifndef _INCLUDE_SVN_VERSION_H_
#define _INCLUDE_SVN_VERSION_H_
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$"
#endif //_INCLUDE_SVN_VERSION_H_

View File

@ -3,7 +3,11 @@
#ifndef __MODULECONFIG_H__
#define __MODULECONFIG_H__
#include "../svn_version.h"
#if defined AMBUILD
# include <amxmodx_version.h>
#else
# define SVN_VERSION "dev-local"
#endif
// Module info
#define MODULE_NAME "Ham Sandwich"

View File

@ -1,9 +0,0 @@
#ifndef _INCLUDE_SVN_VERSION_H_
#define _INCLUDE_SVN_VERSION_H_
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$"
#endif //_INCLUDE_SVN_VERSION_H_

View File

@ -3,7 +3,11 @@
#ifndef __MODULECONFIG_H__
#define __MODULECONFIG_H__
#include "svn_version.h"
#if defined AMBUILD
# include <amxmodx_version.h>
#else
# define SVN_VERSION "dev-local"
#endif
/** Module info
* -The logtag is the tag that the module's log messages will be

View File

@ -1,9 +0,0 @@
#ifndef _INCLUDE_SVN_VERSION_H_
#define _INCLUDE_SVN_VERSION_H_
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$"
#endif //_INCLUDE_SVN_VERSION_H_

View File

@ -3,7 +3,11 @@
#ifndef __MODULECONFIG_H__
#define __MODULECONFIG_H__
#include "../svn_version.h"
#if defined AMBUILD
# include <amxmodx_version.h>
#else
# define SVN_VERSION "dev-local"
#endif
// Module info
#define MODULE_NAME "NS"

View File

@ -1,9 +0,0 @@
#ifndef _INCLUDE_SVN_VERSION_H_
#define _INCLUDE_SVN_VERSION_H_
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$"
#endif //_INCLUDE_SVN_VERSION_H_

View File

@ -3,7 +3,11 @@
#ifndef __MODULECONFIG_H__
#define __MODULECONFIG_H__
#include "svn_version.h"
#if defined AMBUILD
# include <amxmodx_version.h>
#else
# define SVN_VERSION "dev-local"
#endif
// Module info
#define MODULE_NAME "nVault"

View File

@ -1,9 +0,0 @@
#ifndef _INCLUDE_SVN_VERSION_H_
#define _INCLUDE_SVN_VERSION_H_
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$"
#endif //_INCLUDE_SVN_VERSION_H_

View File

@ -3,7 +3,11 @@
#ifndef __MODULECONFIG_H__
#define __MODULECONFIG_H__
#include "svn_version.h"
#if defined AMBUILD
# include <amxmodx_version.h>
#else
# define SVN_VERSION "dev-local"
#endif
// Module info
#define MODULE_NAME "RegEx"

View File

@ -1,9 +0,0 @@
#ifndef _INCLUDE_SVN_VERSION_H_
#define _INCLUDE_SVN_VERSION_H_
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$"
#endif //_INCLUDE_SVN_VERSION_H_

View File

@ -3,7 +3,11 @@
#ifndef __MODULECONFIG_H__
#define __MODULECONFIG_H__
#include "svn_version.h"
#if defined AMBUILD
# include <amxmodx_version.h>
#else
# define SVN_VERSION "dev-local"
#endif
// Module info
#define MODULE_NAME "Sockets"

View File

@ -1,9 +0,0 @@
#ifndef _INCLUDE_SVN_VERSION_H_
#define _INCLUDE_SVN_VERSION_H_
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$"
#endif //_INCLUDE_SVN_VERSION_H_

View File

@ -3,7 +3,11 @@
#ifndef __MODULECONFIG_H__
#define __MODULECONFIG_H__
#include "svn_version.h"
#if defined AMBUILD
# include <amxmodx_version.h>
#else
# define SVN_VERSION "dev-local"
#endif
// Module info
#define MODULE_NAME "SQLite"

View File

@ -1,9 +0,0 @@
#ifndef _INCLUDE_SVN_VERSION_H_
#define _INCLUDE_SVN_VERSION_H_
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$"
#endif //_INCLUDE_SVN_VERSION_H_

View File

@ -3,7 +3,11 @@
#ifndef __MODULECONFIG_H__
#define __MODULECONFIG_H__
#include "svn_version.h"
#if defined AMBUILD
# include <amxmodx_version.h>
#else
# define SVN_VERSION "dev-local"
#endif
// Module info
#define MODULE_NAME "TfcX"

View File

@ -1,9 +0,0 @@
#ifndef _INCLUDE_SVN_VERSION_H_
#define _INCLUDE_SVN_VERSION_H_
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$"
#endif //_INCLUDE_SVN_VERSION_H_

View File

@ -3,7 +3,11 @@
#ifndef __MODULECONFIG_H__
#define __MODULECONFIG_H__
#include "svn_version.h"
#if defined AMBUILD
# include <amxmodx_version.h>
#else
# define SVN_VERSION "dev-local"
#endif
// Module info
#define MODULE_NAME "TSFun Wrapper"

View File

@ -1,9 +0,0 @@
#ifndef _INCLUDE_SVN_VERSION_H_
#define _INCLUDE_SVN_VERSION_H_
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$"
#endif //_INCLUDE_SVN_VERSION_H_

View File

@ -3,7 +3,11 @@
#ifndef __MODULECONFIG_H__
#define __MODULECONFIG_H__
#include "svn_version.h"
#if defined AMBUILD
# include <amxmodx_version.h>
#else
# define SVN_VERSION "dev-local"
#endif
// Module info
#define MODULE_NAME "TSX"

View File

@ -1,9 +0,0 @@
#ifndef _INCLUDE_SVN_VERSION_H_
#define _INCLUDE_SVN_VERSION_H_
/** This file is auto-generated by build scripts. Do not edit it unless you know what you're doing. */
/** Do not commit the generated .h file, as it will only mess up SVN revision numbers. */
#define SVN_VERSION "$PMAJOR$.$PMINOR$.$PREVISION$$BUILD_STRING$"
#endif //_INCLUDE_SVN_VERSION_H_

View File

@ -89,7 +89,8 @@ def build_plugin(script_path, amxx_file, extra_argv = []):
inputs = inputs,
argv = argv,
outputs = outputs,
dep_type = 'msvc'
dep_type = 'msvc',
weak_inputs = AMXX.generated_headers
)
AMXX.plugins[amxx_file] = amx_entry

View File

@ -11,6 +11,9 @@
#endif
#define _svnversion_included
#define AMXX_VERSION 1.82
#define AMXX_VERSION_NUM 182
stock const AMXX_VERSION_STR[] = "1.8.2";
#tryinclude <amxmodx_version>
#if !defined _amxmodx_version_included
#define AMXX_VERSION 1.83
#define AMXX_VERSION_NUM 183
stock const AMXX_VERSION_STR[] = "1.8.3-dev";
#endif

View File

@ -1,16 +0,0 @@
/* AMX Mod X constants
*
* by the AMX Mod X Development Team
* originally developed by OLO
*
* This file is provided as is (no warranties).
*/
#if defined _svnversion_included
#endinput
#endif
#define _svnversion_included
#define AMXX_VERSION $PMAJOR$.$PMINOR$$PREVISION$
#define AMXX_VERSION_NUM $PMAJOR$$PMINOR$$PREVISION$
stock const AMXX_VERSION_STR[] = "$PMAJOR$.$PMINOR$.$PREVISION$";

View File

@ -117,6 +117,12 @@ for amxx_file in AMXX.plugins:
)
builder.AddCopy(source_file, folder_map[package + '/addons/amxmodx/scripting'])
# Copy the generated version .inc.
for generated_header in AMXX.generated_headers:
if 'inc' in generated_header.path:
builder.AddCopy(generated_header, folder_map['base/addons/amxmodx/scripting/include'])
break
# Copy configuration files for each mod.
configs = [
'amxx.cfg',

41
support/Versioning Normal file
View File

@ -0,0 +1,41 @@
# vim: set ts=8 sts=2 sw=2 tw=99 et ft=python:
import os, sys
builder.SetBuildFolder('/')
includes = builder.AddFolder('includes')
argv = [
sys.executable,
os.path.join(builder.sourcePath, 'support', 'generate_headers.py'),
os.path.join(builder.sourcePath),
os.path.join(builder.buildPath, 'includes'),
]
outputs = [
os.path.join(builder.buildFolder, 'includes', 'amxmodx_version.h'),
os.path.join(builder.buildFolder, 'includes', 'amxmodx_version.inc'),
]
with open(os.path.join(builder.sourcePath, '.git', 'HEAD')) as fp:
git_state = fp.read().strip().split(':')[1].strip()
git_head_path = os.path.join(builder.sourcePath, '.git', git_state)
if not os.path.exists(git_head_path):
git_head_path = os.path.join(builder.sourcePath, '.git', 'HEAD')
sources = [
os.path.join(builder.sourcePath, 'product.version'),
# This is a hack, but we need some way to only run this script when HG changes.
git_head_path,
# The script source is a dependency, of course...
argv[1]
]
cmd_node, output_nodes = builder.AddCommand(
inputs = sources,
argv = argv,
outputs = outputs
)
rvalue = output_nodes

106
support/generate_headers.py Normal file
View File

@ -0,0 +1,106 @@
# vim: set ts=8 sts=2 sw=2 tw=99 et:
import re
import os, sys
import subprocess
argv = sys.argv[1:]
if len(argv) < 2:
sys.stderr.write('Usage: generate_headers.py <source_path> <output_folder>\n')
sys.exit(1)
SourceFolder = os.path.abspath(os.path.normpath(argv[0]))
OutputFolder = os.path.normpath(argv[1])
class FolderChanger:
def __init__(self, folder):
self.old = os.getcwd()
self.new = folder
def __enter__(self):
if self.new:
os.chdir(self.new)
def __exit__(self, type, value, traceback):
os.chdir(self.old)
def run_and_return(argv):
# Python 2.6 doesn't have check_output.
if hasattr(subprocess, 'check_output'):
text = subprocess.check_output(argv)
if str != bytes:
text = str(text, 'utf-8')
else:
p = subprocess.Popen(argv, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, ignored = p.communicate()
rval = p.poll()
if rval:
raise subprocess.CalledProcessError(rval, argv)
text = output.decode('utf8')
return text.strip()
def get_git_version():
revision_count = run_and_return(['git', 'rev-list', '--count', 'HEAD'])
revision_hash = run_and_return(['git', 'log', '--pretty=format:%h:%H', '-n', '1'])
shorthash, longhash = revision_hash.split(':')
return revision_count, shorthash, longhash
def output_version_headers():
with FolderChanger(SourceFolder):
count, shorthash, longhash = get_git_version()
with open(os.path.join(SourceFolder, 'product.version')) as fp:
contents = fp.read()
m = re.match('(\d+)\.(\d+)\.(\d+)-?(.*)', contents)
if m == None:
raise Exception('Could not detremine product version')
major, minor, release, tag = m.groups()
product = "{0}.{1}.{2}".format(major, minor, release)
fullstring = product
if tag != "":
fullstring += "-{0}".format(tag)
if tag == "dev":
fullstring += "+{0}".format(shorthash)
with open(os.path.join(OutputFolder, 'amxmodx_version.h'), 'w') as fp:
fp.write("""
#ifndef _AMXMODX_AUTO_VERSION_INFORMATION_H_
#define _AMXMODX_AUTO_VERSION_INFORMATION_H_
#define SVN_VERSION_STRING "{fullstring}"
#define SVN_VERSION_DWORD {major}, {minor}, {release}, 0
#define SVN_VERSION_PRODUCT "{product}"
#define SVN_VERSION SVN_VERSION_STRING
#define SVN_BUILD_ID "{count}:{longhash}"
#endif // _AMXMODX_AUTO_VERSION_INFORMATION_H_
""".format(
fullstring = fullstring,
major = major,
minor = minor,
release = release,
product = product,
count = count,
longhash = longhash
))
version_num = int(major) * 100 + int(minor) * 10 + int(release)
with open(os.path.join(OutputFolder, 'amxmodx_version.inc'), 'w') as fp:
fp.write("""
#if defined _amxmodx_version_included
#endinput
#endif
#define _amxmodx_version_included
#define AMXX_VERSION {major}.{minor}{release}
#define AMXX_VERSION_NUM {version_num}
stock const AMXX_VERSION_STR[] = "{fullstring}";
""".format(
major = major,
minor = minor,
release = release,
version_num = version_num,
fullstring = fullstring
))
output_version_headers()