mirror of
https://github.com/avrdudes/avrdude.git
synced 2026-09-23 09:36:24 +03:00
Use cmake libavrdude SOVERSION/VERSION for autotools
This transfers the information from the CMakeLists.txt libavrdude VERSION and SOVERSION into the autotools configure script and (partly) uses the information to build the libavrdude.la libtool library. At this time, VERSION must always be SOVERSION.0.0 for this to work (and that is checked).
This commit is contained in:
@@ -220,7 +220,7 @@ libavrdude_la_SOURCES = \
|
||||
wiring.c \
|
||||
xbee.h \
|
||||
xbee.c
|
||||
libavrdude_la_LDFLAGS = -version-info 2:0
|
||||
libavrdude_la_LDFLAGS = -version-info @LIBAVRDUDE_VERSION_INFO@
|
||||
|
||||
include_HEADERS = libavrdude.h
|
||||
include_HEADERS += libavrdude-avrintel.h
|
||||
|
||||
@@ -9,6 +9,8 @@ dnl This must be the same sequence as the versioninfo script writes.
|
||||
m4_pattern_forbid([versioninfo_items])
|
||||
m4_define([versioninfo_items], [
|
||||
[CMAKE_PROJECT_VERSION],
|
||||
[CMAKE_LIBAVRDUDE_VERSION],
|
||||
[CMAKE_LIBAVRDUDE_SOVERSION],
|
||||
[GIT_COMMIT_DATE],
|
||||
[GIT_COMMIT_HASH],
|
||||
[GIT_TAG_HASH]
|
||||
|
||||
@@ -89,6 +89,36 @@ test -n "$PROJECT_VERSION" || \
|
||||
ret_error "Cannot find project(...) in top-level avrdude 'CMakeLists.txt'"
|
||||
|
||||
|
||||
# Parse libavrdude library version from CMakeLists.txt
|
||||
tmp="$(${AWK-awk} '
|
||||
BEGIN { v=0; }
|
||||
($1 == "set_target_properties(libavrdude") { v=1; }
|
||||
(v == 1) && /^[[:space:]]+\)/ { v=0; }
|
||||
(v == 1) && /^[[:space:]]+VERSION[[:space:]]+/ { version=$2; }
|
||||
(v == 1) && /^[[:space:]]+SOVERSION[[:space:]]+/ { soversion=$2; }
|
||||
END { print version;
|
||||
print soversion; }
|
||||
' < "$top_srcdir/CMakeLists.txt")"
|
||||
|
||||
|
||||
# Extract the libavrdude VERSION
|
||||
CMAKE_LIBAVRDUDE_VERSION="$(printf "%s\n" "$tmp" | { \
|
||||
read LIB_VERSION; read LIB_SOVERSION; \
|
||||
printf "%s\n" "$LIB_VERSION"; })"
|
||||
|
||||
test -n "$CMAKE_LIBAVRDUDE_VERSION" || \
|
||||
ret_error "Cannot find library VERSION in library 'CMakeLists.txt'"
|
||||
|
||||
|
||||
# Extract the libavrdude SOVERSION
|
||||
CMAKE_LIBAVRDUDE_SOVERSION="$(printf "%s\n" "$tmp" | { \
|
||||
read LIB_VERSION; read LIB_SOVERSION; \
|
||||
printf "%s\n" "$LIB_SOVERSION"; })"
|
||||
|
||||
test -n "$CMAKE_LIBAVRDUDE_SOVERSION" || \
|
||||
ret_error "Cannot find library SOVERSION in library 'CMakeLists.txt'"
|
||||
|
||||
|
||||
# If GIT_DIR is set, use it. If not, try "$top_srcdir/../.git".
|
||||
test -n "$GIT_DIR" || { \
|
||||
GIT_DIR="$top_srcdir/../.git"; \
|
||||
@@ -106,11 +136,13 @@ if test -d "$GIT_DIR" && ${GIT-git} --version > /dev/null 2>&1; then
|
||||
ret_error "$prog: Cannot run 'git log' for tag hash"
|
||||
# This must be the same sequence as versioninfo_items in configure.ac
|
||||
ret_ok "${PROJECT_VERSION}" \
|
||||
"${CMAKE_LIBAVRDUDE_VERSION}" "${CMAKE_LIBAVRDUDE_SOVERSION}" \
|
||||
"${GIT_COMMIT_DATE}" "${GIT_COMMIT_HASH}" "${GIT_TAG_HASH}"
|
||||
else # This is a github release tarball or github snapshot tarball
|
||||
# Presume this is a release version, because who would build a
|
||||
# non-release version from a snapshot tarball?
|
||||
ret_ok "${PROJECT_VERSION}"
|
||||
ret_ok "${PROJECT_VERSION}" \
|
||||
"${CMAKE_LIBAVRDUDE_VERSION}" "${CMAKE_LIBAVRDUDE_SOVERSION}"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -92,6 +92,33 @@ AC_DEFINE_UNQUOTED([AVRDUDE_FULL_VERSION], ["$AVRDUDE_FULL_VERSION"],
|
||||
AC_SUBST([AVRDUDE_FULL_VERSION])
|
||||
|
||||
|
||||
# Define libavrdude libtool version from cmake libavrdude information
|
||||
dnl
|
||||
dnl This is a very simple consistency check. If this check ever fails,
|
||||
dnl the library versioning policy and its technical implementation
|
||||
dnl must be adapted.
|
||||
m4_case(m4_defn([versioninfo_CMAKE_LIBAVRDUDE_SOVERSION])[.0.0],
|
||||
m4_defn([versioninfo_CMAKE_LIBAVRDUDE_VERSION]),
|
||||
[],
|
||||
[m4_fatal([
|
||||
The cmake libavrdude VERSION should be SOVERSION.0.0 ("]m4_defn([versioninfo_CMAKE_LIBAVRDUDE_SOVERSION])[.0.0"),
|
||||
but it is actually "]m4_defn([versioninfo_CMAKE_LIBAVRDUDE_VERSION])[".
|
||||
|
||||
This is an internal error in the logic which transfers library version
|
||||
information from the cmake buildsystem to the automake buildsystem.
|
||||
|
||||
Please file a GitHub issue for avrdude and mention @ndim.
|
||||
])])dnl
|
||||
dnl
|
||||
AC_MSG_CHECKING([versioninfo derived libtool -version-info for libavrdude])
|
||||
libavrdude_lt_cur=$CMAKE_LIBAVRDUDE_SOVERSION
|
||||
libavrdude_lt_rev=0
|
||||
libavrdude_lt_age=0
|
||||
AC_SUBST([LIBAVRDUDE_VERSION_INFO],
|
||||
[${libavrdude_lt_cur}:${libavrdude_lt_rev}:${libavrdude_lt_age}])
|
||||
AC_MSG_RESULT([$LIBAVRDUDE_VERSION_INFO])
|
||||
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
|
||||
Reference in New Issue
Block a user