Cleanup versioning strategy relanding (#989) (#997)

* Cleanup versioning strategy

Currently, versioning is a mess. CMake and Meson have seperate build
version number storage locations, with no way of knowing you need to
have both. Plus, due to recent revisions the amalgamate script is broken
unless you build first, and may still be broken afterwards.

This PR fixes some issues with versioning, and adds comments clarifying
what has to be done when doing a release.

* Run clang format

* Update SOVERSION....
diff --git a/amalgamate.py b/amalgamate.py
old mode 100644
new mode 100755
index c12215a..7b41e2e
--- a/amalgamate.py
+++ b/amalgamate.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
 """Amalgamate json-cpp library sources into a single source and header file.
 
 Works with python2.6+ and python3.4+.
@@ -9,6 +11,9 @@
 import os.path
 import sys
 
+INCLUDE_PATH = "include/json"
+SRC_PATH = "src/lib_json"
+
 class AmalgamationFile:
     def __init__(self, top_dir):
         self.top_dir = top_dir
@@ -66,15 +71,15 @@
     header.add_text("/// If defined, indicates that the source file is amalgamated")
     header.add_text("/// to prevent private header inclusion.")
     header.add_text("#define JSON_IS_AMALGAMATION")
-    header.add_file("include/json/version.h")
-    header.add_file("include/json/allocator.h")
-    header.add_file("include/json/config.h")
-    header.add_file("include/json/forwards.h")
-    header.add_file("include/json/features.h")
-    header.add_file("include/json/value.h")
-    header.add_file("include/json/reader.h")
-    header.add_file("include/json/writer.h")
-    header.add_file("include/json/assertions.h")
+    header.add_file(os.path.join(INCLUDE_PATH, "version.h"))
+    header.add_file(os.path.join(INCLUDE_PATH, "allocator.h"))
+    header.add_file(os.path.join(INCLUDE_PATH, "config.h"))
+    header.add_file(os.path.join(INCLUDE_PATH, "forwards.h"))
+    header.add_file(os.path.join(INCLUDE_PATH, "features.h"))
+    header.add_file(os.path.join(INCLUDE_PATH, "value.h"))
+    header.add_file(os.path.join(INCLUDE_PATH, "reader.h"))
+    header.add_file(os.path.join(INCLUDE_PATH, "writer.h"))
+    header.add_file(os.path.join(INCLUDE_PATH, "assertions.h"))
     header.add_text("#endif //ifndef JSON_AMALGAMATED_H_INCLUDED")
 
     target_header_path = os.path.join(os.path.dirname(target_source_path), header_include_path)
@@ -94,8 +99,8 @@
     header.add_text("/// If defined, indicates that the source file is amalgamated")
     header.add_text("/// to prevent private header inclusion.")
     header.add_text("#define JSON_IS_AMALGAMATION")
-    header.add_file("include/json/config.h")
-    header.add_file("include/json/forwards.h")
+    header.add_file(os.path.join(INCLUDE_PATH, "config.h"))
+    header.add_file(os.path.join(INCLUDE_PATH, "forwards.h"))
     header.add_text("#endif //ifndef JSON_FORWARD_AMALGAMATED_H_INCLUDED")
 
     target_forward_header_path = os.path.join(os.path.dirname(target_source_path),
@@ -116,12 +121,11 @@
 #endif
 """)
     source.add_text("")
-    lib_json = "src/lib_json"
-    source.add_file(os.path.join(lib_json, "json_tool.h"))
-    source.add_file(os.path.join(lib_json, "json_reader.cpp"))
-    source.add_file(os.path.join(lib_json, "json_valueiterator.inl"))
-    source.add_file(os.path.join(lib_json, "json_value.cpp"))
-    source.add_file(os.path.join(lib_json, "json_writer.cpp"))
+    source.add_file(os.path.join(SRC_PATH, "json_tool.h"))
+    source.add_file(os.path.join(SRC_PATH, "json_reader.cpp"))
+    source.add_file(os.path.join(SRC_PATH, "json_valueiterator.inl"))
+    source.add_file(os.path.join(SRC_PATH, "json_value.cpp"))
+    source.add_file(os.path.join(SRC_PATH, "json_writer.cpp"))
 
     print("Writing amalgamated source to %r" % target_source_path)
     source.write_to(target_source_path)