mirror of
https://github.com/OpenVPN/openvpn.git
synced 2025-05-09 13:41:06 +08:00
msvc: add branch name and commit hash to version output
Add a simple python script which generates header with branch name and commit hash #defines. While on it, fix filename in msvc-generate.vcxproj and add proper copyright header to Makefile.mak. Signed-off-by: Lev Stipakov <lev@openvpn.net> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20220926070843.717-1-lstipakov@gmail.com> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25314.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
parent
997df07a98
commit
8cbfd57e4a
@ -1,4 +1,27 @@
|
|||||||
# Copyright (C) 2008-2012 Alon Bar-Lev <alon.barlev@gmail.com>
|
#
|
||||||
|
# OpenVPN -- An application to securely tunnel IP networks
|
||||||
|
# over a single UDP port, with support for SSL/TLS-based
|
||||||
|
# session authentication and key exchange,
|
||||||
|
# packet encryption, packet authentication, and
|
||||||
|
# packet compression.
|
||||||
|
#
|
||||||
|
# Copyright (C) 2002-2022 OpenVPN Inc <sales@openvpn.net>
|
||||||
|
# Copyright (C) 2008-2012 Alon Bar-Lev <alon.barlev@gmail.com>
|
||||||
|
# Copyright (C) 2022-2022 Lev Stipakov <lev@lestisoftware.fi>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License version 2
|
||||||
|
# as published by the Free Software Foundation.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License along
|
||||||
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
#
|
||||||
|
|
||||||
CONFIG=$(SOLUTIONDIR)/version.m4
|
CONFIG=$(SOLUTIONDIR)/version.m4
|
||||||
|
|
||||||
@ -14,7 +37,9 @@ OUTPUT_PLUGIN_CONFIG=version.m4
|
|||||||
INPUT_MAN=$(SOLUTIONDIR)/doc/openvpn.8.rst
|
INPUT_MAN=$(SOLUTIONDIR)/doc/openvpn.8.rst
|
||||||
OUTPUT_MAN=$(SOLUTIONDIR)/doc/openvpn.8.html
|
OUTPUT_MAN=$(SOLUTIONDIR)/doc/openvpn.8.html
|
||||||
|
|
||||||
all: $(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN) $(OUTPUT_MAN)
|
OUTPUT_MSVC_GIT_CONFIG=$(SOLUTIONDIR)/config-version.h
|
||||||
|
|
||||||
|
all: $(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN) $(OUTPUT_MAN) $(OUTPUT_MSVC_GIT_CONFIG)
|
||||||
|
|
||||||
$(OUTPUT_MSVC_VER): $(INPUT_MSVC_VER) $(CONFIG)
|
$(OUTPUT_MSVC_VER): $(INPUT_MSVC_VER) $(CONFIG)
|
||||||
cscript //nologo msvc-generate.js --config="$(CONFIG)" --input="$(INPUT_MSVC_VER)" --output="$(OUTPUT_MSVC_VER)"
|
cscript //nologo msvc-generate.js --config="$(CONFIG)" --input="$(INPUT_MSVC_VER)" --output="$(OUTPUT_MSVC_VER)"
|
||||||
@ -28,8 +53,12 @@ $(OUTPUT_PLUGIN): $(INPUT_PLUGIN) $(OUTPUT_PLUGIN_CONFIG)
|
|||||||
$(OUTPUT_MAN): $(INPUT_MAN)
|
$(OUTPUT_MAN): $(INPUT_MAN)
|
||||||
-FOR /F %i IN ('where rst2html.py') DO python %i "$(INPUT_MAN)" "$(OUTPUT_MAN)"
|
-FOR /F %i IN ('where rst2html.py') DO python %i "$(INPUT_MAN)" "$(OUTPUT_MAN)"
|
||||||
|
|
||||||
|
$(OUTPUT_MSVC_GIT_CONFIG):
|
||||||
|
python git-version.py $(SOLUTIONDIR)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-del "$(OUTPUT_MSVC_VER)"
|
-del "$(OUTPUT_MSVC_VER)"
|
||||||
-del "$(OUTPUT_PLUGIN)"
|
-del "$(OUTPUT_PLUGIN)"
|
||||||
-del "$(OUTPUT_PLUGIN_CONFIG)"
|
-del "$(OUTPUT_PLUGIN_CONFIG)"
|
||||||
-del "$(OUTPUT_MAN)"
|
-del "$(OUTPUT_MAN)"
|
||||||
|
-del "$(OUTPUT_MSVC_GIT_CONFIG)"
|
||||||
|
50
build/msvc/msvc-generate/git-version.py
Normal file
50
build/msvc/msvc-generate/git-version.py
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#
|
||||||
|
# OpenVPN -- An application to securely tunnel IP networks
|
||||||
|
# over a single UDP port, with support for SSL/TLS-based
|
||||||
|
# session authentication and key exchange,
|
||||||
|
# packet encryption, packet authentication, and
|
||||||
|
# packet compression.
|
||||||
|
#
|
||||||
|
# Copyright (C) 2022-2022 OpenVPN Inc <sales@openvpn.net>
|
||||||
|
# Copyright (C) 2022-2022 Lev Stipakov <lev@lestisoftware.fi>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License version 2
|
||||||
|
# as published by the Free Software Foundation.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License along
|
||||||
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
#
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
def get_branch_commit_id():
|
||||||
|
commit_id = os.popen("git rev-parse --short=16 HEAD").read()[:-1]
|
||||||
|
if not commit_id:
|
||||||
|
raise
|
||||||
|
l = os.popen("git rev-parse --symbolic-full-name HEAD").read().split("/")[2:]
|
||||||
|
if not l:
|
||||||
|
l = ["none\n"]
|
||||||
|
branch = "/" .join(l)[:-1]
|
||||||
|
return branch, commit_id
|
||||||
|
|
||||||
|
def main():
|
||||||
|
try:
|
||||||
|
branch, commit_id = get_branch_commit_id()
|
||||||
|
except:
|
||||||
|
branch, commit_id = "unknown", "unknown"
|
||||||
|
|
||||||
|
name = os.path.join("%s" % (sys.argv[1] if len(sys.argv) > 1 else "."), "config-version.h")
|
||||||
|
with open(name, "w") as f:
|
||||||
|
f.write("#define CONFIGURE_GIT_REVISION \"%s/%s\"\n" % (branch, commit_id))
|
||||||
|
f.write("#define CONFIGURE_GIT_FLAGS \"\"\n")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
@ -150,7 +150,7 @@
|
|||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Makefile.mak" />
|
<None Include="Makefile.mak" />
|
||||||
<None Include="msc-generate.js" />
|
<None Include="msvc-generate.js" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
@ -177,3 +177,5 @@ typedef uint16_t in_port_t;
|
|||||||
#define HAVE_INET_NTOP
|
#define HAVE_INET_NTOP
|
||||||
#define HAVE_INET_PTON
|
#define HAVE_INET_PTON
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define HAVE_CONFIG_VERSION_H 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user