--- a/include/generate.py
+++ b/include/generate.py
@@ -33,6 +33,7 @@
 
 import subprocess
 import os
+import re
 import sys
 
 srcroot = "../.."
@@ -62,6 +63,21 @@ v = subprocess.check_output([
     (os.path.join(srcroot, ".git"))
     ], shell=True, universal_newlines=True).strip()
 
+# override VCS_Version with the content of debian/vcs_version, if it exists
+try:
+    v = open(os.path.join(srcroot, "debian", "vcs_version")).readline().strip()
+except IOError as e:
+    if e.errno != errno.ENOENT:
+        raise
+
+# add a symbol with the Debian version number
+dch = open(os.path.join(srcroot, "debian", "changelog")).readline().strip()
+match = re.search(r'^\S+\s+\(([^)]+)\)', dch)
+if not match:
+    print("Could not find the Debian version number!", file=sys.stderr)
+    exit(1)
+debversion = match.group(1)
+
 vcsfn = os.path.join(srcroot, "include", "vcs_version.h")
 
 try:
@@ -86,4 +102,5 @@ if i != ident:
     fo = open(os.path.join(srcroot, "include", "vmod_abi.h"), "w")
     file_header(fo)
     fo.write('#define VMOD_ABI_Version "%s %s"\n' % (i, v))
+    fo.write('#define VMOD_Debian_Version "%s"\n' % debversion)
     fo.close()
