diff --git a/build-relocatable-install.py b/build-relocatable-install.py
index 04070ab9ba0458482e57dca490e344ef02fd557d..ecf9cfb98c750559594e60f1037e5136b6086b0e 100755
--- a/build-relocatable-install.py
+++ b/build-relocatable-install.py
@@ -373,6 +373,12 @@ def main():
             )
             source_to_download.add(source)
 
+    with open(
+        os.path.join(destdir_prefix, 'metadata', 'VERSION.txt'),
+        'w',
+    ) as writer:
+        writer.write('{}\n'.format(args.version))
+
     shutil.copytree(
         os.path.join(destdir_prefix, 'metadata'),
         os.path.join(destdir_prefix, 'sources'),
@@ -472,6 +478,17 @@ def main():
                     cmd=git_archive.args,
                 )
 
+    with open(
+        os.path.join(
+            destdir_prefix,
+            'sources',
+            'pressure-vessel',
+            '.tarball-version',
+        ),
+        'w',
+    ) as writer:
+        writer.write('{}\n'.format(args.version))
+
     bin_tar = 'pressure-vessel-{}-bin.tar.gz'.format(args.version)
     src_tar = 'pressure-vessel-{}-bin+src.tar.gz'.format(args.version)
 
diff --git a/src/wrap.c b/src/wrap.c
index 080dc2bc511c9f7e5551df72919192982f57abec..3d3d2f38178283190e73cac9bf823374c35864e0 100644
--- a/src/wrap.c
+++ b/src/wrap.c
@@ -1447,6 +1447,7 @@ static GPtrArray *opt_ld_preload = NULL;
 static char *opt_runtime = NULL;
 static gboolean opt_share_home = TRUE;
 static gboolean opt_verbose = FALSE;
+static gboolean opt_version = FALSE;
 static gboolean opt_xterm = FALSE;
 
 static gboolean
@@ -1503,6 +1504,8 @@ static GOptionEntry options[] =
     "must be installed in the RUNTIME, if used.", NULL },
   { "verbose", 0, 0, G_OPTION_ARG_NONE, &opt_verbose,
     "Be more verbose.", NULL },
+  { "version", 0, 0, G_OPTION_ARG_NONE, &opt_version,
+    "Print version number and exit.", NULL },
   { NULL }
 };
 
@@ -1576,6 +1579,13 @@ main (int argc,
   if (!g_option_context_parse (context, &argc, &argv, error))
     goto out;
 
+  if (opt_version)
+    {
+      g_print ("pressure-vessel version %s\n", VERSION);
+      ret = 0;
+      goto out;
+    }
+
   if (argc < 2)
     {
       g_printerr ("%s: An executable to run is required\n",