Skip to content

Commit 033718c

Browse files
committed
[syntacore] change version specification mechanism
Change-Id: I53e7f1455f21bc9d807876bc44a035d1d0b45b72 Signed-off-by: Evgeniy Naydanov <[email protected]>
1 parent 7135fb9 commit 033718c

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

configure.ac

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,6 @@ AS_IF([test -x "$srcdir/guess-rev.sh"], [
110110
])
111111
AC_MSG_RESULT([$build_release])
112112

113-
# Syntacore has it's own rules for release processing
114-
AC_MSG_CHECKING([whether to build a release for Syntacore])
115-
AS_IF([test -r "$srcdir/__sc_version.txt"], [
116-
build_syntacore_release=yes
117-
], [
118-
build_syntacore_release=no
119-
])
120-
AC_MSG_RESULT([$build_syntacore_release])
121-
122113
# Adapter drivers
123114
# 1st column -- Basename for the configure option generated with AC_ARG_ENABLE.
124115
# For example, "buspirate" generates options "--enable-buspirate[=yes/no]"

src/Makefile.am

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,22 @@ endif
2222

2323
%C%_libopenocd_la_CPPFLAGS =
2424

25-
# this is Syntacore-specific code
26-
if SYNTACORE_RELEASE
27-
%C%_libopenocd_la_CPPFLAGS += -DRELSTR=\"-`head -1 $(top_srcdir)/__sc_version.txt`\"
28-
%C%_libopenocd_la_CPPFLAGS += -DGITVERSION=\"`tail -1 $(top_srcdir)/__sc_version.txt`\"
29-
%C%_libopenocd_la_CPPFLAGS += -DPKGBLDDATE=\"`date +%F-%R`\"
30-
else
3125
# banner output includes RELSTR appended to $VERSION from the configure script
3226
# guess-rev.sh returns either a repository version ID or "-snapshot"
3327
if RELEASE
3428
%C%_libopenocd_la_CPPFLAGS += -DRELSTR=\"\"
3529
%C%_libopenocd_la_CPPFLAGS += -DGITVERSION=\"\"
3630
else
37-
%C%_libopenocd_la_CPPFLAGS += -DRELSTR=\"`$(top_srcdir)/guess-rev.sh $(top_srcdir)`\"
38-
%C%_libopenocd_la_CPPFLAGS += -DGITVERSION=\"`cd $(top_srcdir) && git describe`\"
31+
mpy_hints_path = $(top_builddir)/makepy_hints.json
32+
get_version = "import json; print(json.load(open('$(mpy_hints_path)'))['version'])"
33+
branch = $$(python -c $(get_version) | cut -d'+' -f2- | tr -c '[:alnum:]\n' _)
34+
revision = $$(git -C $(top_srcdir) rev-parse HEAD | head -c 8)
35+
maybe_dirty = $$([ -z "$$(git status --untracked-files=no --porcelain)" ] || echo -dirty)
36+
%C%_libopenocd_la_CPPFLAGS += -DRELSTR=\"-$(branch)-g$(revision)$(maybe_dirty)\"
37+
riscv_base = $$(git -C $(top_srcdir) merge-base origin/riscv HEAD | head -c 8)
38+
%C%_libopenocd_la_CPPFLAGS += -DGITVERSION=\"riscv-upstream-$(riscv_base)-cs-$(revision)$(maybe_dirty)\"
3939
%C%_libopenocd_la_CPPFLAGS += -DPKGBLDDATE=\"`date +%F-%R`\"
4040
endif
41-
endif
4241

4342
# add default CPPFLAGS
4443
%C%_libopenocd_la_CPPFLAGS += $(AM_CPPFLAGS) $(CPPFLAGS)

0 commit comments

Comments
 (0)