* [PATCH] build: extract library versions from notmuch.h
@ 2015-08-09 18:56 David Bremner
2015-08-09 22:11 ` Tomi Ollila
0 siblings, 1 reply; 3+ messages in thread
From: David Bremner @ 2015-08-09 18:56 UTC (permalink / raw)
To: notmuch
- Make lib/notmuch.h the canonical location for the library versioning
information.
- Since the release-check should never fail now, remove it to reduce
complexity.
- Make the version numbers in notmuch.h consistent with the (now
deleted) ones in lib/Makefile.local
---
Not counting turning 20 lines of lib/Makefile.local into a template in
configure, the main change here is replacing a test in
release-checks.sh with another piece of code in configure. This isn't
obviously a good idea, since everyone has to run configure and few run
release-checks. Personally, I think the test in config is a bit
cleaner, but the main point is that it is much nicer to have the
version information only in one place.
configure | 51 +++++++++++++++++++++++++++++++++++++++++++++++++
devel/release-checks.sh | 32 -------------------------------
lib/Makefile.local | 21 --------------------
lib/notmuch.h | 2 +-
4 files changed, 52 insertions(+), 54 deletions(-)
diff --git a/configure b/configure
index 20fbed6..17eb243 100755
--- a/configure
+++ b/configure
@@ -324,6 +324,35 @@ EOF
exit 1
fi
+printf "Reading libnotmuch version from source..."
+cat > _libversion.c <<EOF
+#include <stdio.h>
+#include "lib/notmuch.h"
+int main(void) {
+ printf("libnotmuch_version_major=%d\n",
+ LIBNOTMUCH_MAJOR_VERSION);
+ printf("libnotmuch_version_minor=%d\n",
+ LIBNOTMUCH_MINOR_VERSION);
+ printf("libnotmuch_version_release=%d\n",
+ LIBNOTMUCH_MICRO_VERSION);
+ return 0;
+}
+EOF
+if ${CC} ${CFLAGS} _libversion.c -o _libversion > /dev/null 2>&1 && \
+ ./_libversion > libversion.sh && . ./libversion.sh
+then
+ printf "OK"
+else
+ cat <<EOF
+
+*** Error: Reading lib/notmuch.h failed.
+Please try running configure again in a clean environment, and if the
+problem persists, report a bug.
+EOF
+ rm -f _libversion _libversion.c_libversion.sh
+ exit 1
+fi
+
if pkg-config --version > /dev/null 2>&1; then
have_pkg_config=1
else
@@ -847,6 +876,28 @@ vpath Makefile.% \$(srcdir)
vpath %.py \$(srcdir)
vpath %.rst \$(srcdir)
+# Library versions (used to make SONAME)
+# The major version of the library interface. This will control the soname.
+# As such, this number must be incremented for any incompatible change to
+# the library interface, (such as the deletion of an API or a major
+# semantic change that breaks formerly functioning code).
+#
+LIBNOTMUCH_VERSION_MAJOR = ${libnotmuch_version_major}
+
+# The minor version of the library interface. This should be incremented at
+# the time of release for any additions to the library interface,
+# (and when it is incremented, the release version of the library should
+# be reset to 0).
+LIBNOTMUCH_VERSION_MINOR = ${libnotmuch_version_minor}
+
+# The release version the library interface. This should be incremented at
+# the time of release if there have been no changes to the interface, (but
+# simply compatible changes to the implementation).
+LIBNOTMUCH_VERSION_RELEASE = ${libnotmuch_version_release}
+
+# These are derived from the VERSION macros in lib/notmuch.h so
+# if you have to change them, something is wrong.
+
# The C compiler to use
CC = ${CC}
diff --git a/devel/release-checks.sh b/devel/release-checks.sh
index bf0d68a..8604a9f 100755
--- a/devel/release-checks.sh
+++ b/devel/release-checks.sh
@@ -88,38 +88,6 @@ case $VERSION in
*) verfail "'$VERSION' is a single number" ;;
esac
-echo -n "Checking that LIBNOTMUCH version macros & variables match ... "
-# lib/notmuch.h
-LIBNOTMUCH_MAJOR_VERSION=broken
-LIBNOTMUCH_MINOR_VERSION=broken
-LIBNOTMUCH_MICRO_VERSION=broken
-# lib/Makefile.local
-LIBNOTMUCH_VERSION_MAJOR=borken
-LIBNOTMUCH_VERSION_MINOR=borken
-LIBNOTMUCH_VERSION_RELEASE=borken
-
-eval `awk 'NF == 3 && $1 == "#define" && $2 ~ /^LIBNOTMUCH_[A-Z]+_VERSION$/ \
- && $3 ~ /^[0-9]+$/ { print $2 "=" $3 }' lib/notmuch.h`
-
-eval `awk 'NF == 3 && $1 ~ /^LIBNOTMUCH_VERSION_[A-Z]+$/ && $2 == "=" \
- && $3 ~ /^[0-9]+$/ { print $1 "=" $3 }' lib/Makefile.local`
-
-
-check_version_component ()
-{
- eval local v1=\$LIBNOTMUCH_$1_VERSION
- eval local v2=\$LIBNOTMUCH_VERSION_$2
- if [ $v1 != $v2 ]
- then append_emsg "LIBNOTMUCH_$1_VERSION ($v1) does not equal LIBNOTMUCH_VERSION_$2 ($v2)"
- fi
-}
-
-old_emsg_count=$emsg_count
-check_version_component MAJOR MAJOR
-check_version_component MINOR MINOR
-check_version_component MICRO RELEASE
-[ $old_emsg_count = $emsg_count ] && echo Yes. || echo No.
-
echo -n "Checking that this is Debian package for notmuch... "
read deb_notmuch deb_version rest < debian/changelog
if [ "$deb_notmuch" = 'notmuch' ]
diff --git a/lib/Makefile.local b/lib/Makefile.local
index 412d865..3a07090 100644
--- a/lib/Makefile.local
+++ b/lib/Makefile.local
@@ -1,26 +1,5 @@
# -*- makefile -*-
-# The major version of the library interface. This will control the soname.
-# As such, this number must be incremented for any incompatible change to
-# the library interface, (such as the deletion of an API or a major
-# semantic change that breaks formerly functioning code).
-#
-LIBNOTMUCH_VERSION_MAJOR = 4
-
-# The minor version of the library interface. This should be incremented at
-# the time of release for any additions to the library interface,
-# (and when it is incremented, the release version of the library should
-# be reset to 0).
-LIBNOTMUCH_VERSION_MINOR = 3
-
-# The release version the library interface. This should be incremented at
-# the time of release if there have been no changes to the interface, (but
-# simply compatible changes to the implementation).
-LIBNOTMUCH_VERSION_RELEASE = 0
-
-# Note: Don't forget to change the VERSION macros in notmuch.h when
-# any of the above change.
-
ifeq ($(PLATFORM),MACOSX)
LIBRARY_SUFFIX = dylib
# On OS X, library version numbers go before suffix.
diff --git a/lib/notmuch.h b/lib/notmuch.h
index 421c19d..b1f5bfa 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -56,7 +56,7 @@ NOTMUCH_BEGIN_DECLS
* version in Makefile.local.
*/
#define LIBNOTMUCH_MAJOR_VERSION 4
-#define LIBNOTMUCH_MINOR_VERSION 2
+#define LIBNOTMUCH_MINOR_VERSION 3
#define LIBNOTMUCH_MICRO_VERSION 0
#define NOTMUCH_DEPRECATED(major,minor) \
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] build: extract library versions from notmuch.h
2015-08-09 18:56 [PATCH] build: extract library versions from notmuch.h David Bremner
@ 2015-08-09 22:11 ` Tomi Ollila
2015-08-10 12:00 ` David Bremner
0 siblings, 1 reply; 3+ messages in thread
From: Tomi Ollila @ 2015-08-09 22:11 UTC (permalink / raw)
To: David Bremner, notmuch
On Sun, Aug 09 2015, David Bremner <david@tethera.net> wrote:
> - Make lib/notmuch.h the canonical location for the library versioning
> information.
>
> - Since the release-check should never fail now, remove it to reduce
> complexity.
>
> - Make the version numbers in notmuch.h consistent with the (now
> deleted) ones in lib/Makefile.local
> ---
>
> Not counting turning 20 lines of lib/Makefile.local into a template in
> configure, the main change here is replacing a test in
> release-checks.sh with another piece of code in configure. This isn't
> obviously a good idea, since everyone has to run configure and few run
> release-checks. Personally, I think the test in config is a bit
> cleaner, but the main point is that it is much nicer to have the
> version information only in one place.
Good idea. see below for 2 things.
>
> configure | 51 +++++++++++++++++++++++++++++++++++++++++++++++++
> devel/release-checks.sh | 32 -------------------------------
> lib/Makefile.local | 21 --------------------
> lib/notmuch.h | 2 +-
> 4 files changed, 52 insertions(+), 54 deletions(-)
>
> diff --git a/configure b/configure
> index 20fbed6..17eb243 100755
> --- a/configure
> +++ b/configure
> @@ -324,6 +324,35 @@ EOF
> exit 1
> fi
>
> +printf "Reading libnotmuch version from source..."
Just one ^ space
> +cat > _libversion.c <<EOF
> +#include <stdio.h>
> +#include "lib/notmuch.h"
> +int main(void) {
> + printf("libnotmuch_version_major=%d\n",
> + LIBNOTMUCH_MAJOR_VERSION);
> + printf("libnotmuch_version_minor=%d\n",
> + LIBNOTMUCH_MINOR_VERSION);
> + printf("libnotmuch_version_release=%d\n",
> + LIBNOTMUCH_MICRO_VERSION);
> + return 0;
> +}
> +EOF
> +if ${CC} ${CFLAGS} _libversion.c -o _libversion > /dev/null 2>&1 && \
> + ./_libversion > libversion.sh && . ./libversion.sh
> +then
> + printf "OK"
> +else
> + cat <<EOF
> +
> +*** Error: Reading lib/notmuch.h failed.
> +Please try running configure again in a clean environment, and if the
> +problem persists, report a bug.
> +EOF
> + rm -f _libversion _libversion.c_libversion.sh
Above should be _libversion.c libversion.sh
> + exit 1
> +fi
> +
> if pkg-config --version > /dev/null 2>&1; then
> have_pkg_config=1
> else
> @@ -847,6 +876,28 @@ vpath Makefile.% \$(srcdir)
> vpath %.py \$(srcdir)
> vpath %.rst \$(srcdir)
>
> +# Library versions (used to make SONAME)
> +# The major version of the library interface. This will control the soname.
> +# As such, this number must be incremented for any incompatible change to
> +# the library interface, (such as the deletion of an API or a major
> +# semantic change that breaks formerly functioning code).
> +#
> +LIBNOTMUCH_VERSION_MAJOR = ${libnotmuch_version_major}
> +
> +# The minor version of the library interface. This should be incremented at
> +# the time of release for any additions to the library interface,
> +# (and when it is incremented, the release version of the library should
> +# be reset to 0).
> +LIBNOTMUCH_VERSION_MINOR = ${libnotmuch_version_minor}
> +
> +# The release version the library interface. This should be incremented at
> +# the time of release if there have been no changes to the interface, (but
> +# simply compatible changes to the implementation).
> +LIBNOTMUCH_VERSION_RELEASE = ${libnotmuch_version_release}
> +
> +# These are derived from the VERSION macros in lib/notmuch.h so
> +# if you have to change them, something is wrong.
> +
> # The C compiler to use
> CC = ${CC}
>
> diff --git a/devel/release-checks.sh b/devel/release-checks.sh
> index bf0d68a..8604a9f 100755
> --- a/devel/release-checks.sh
> +++ b/devel/release-checks.sh
> @@ -88,38 +88,6 @@ case $VERSION in
> *) verfail "'$VERSION' is a single number" ;;
> esac
>
> -echo -n "Checking that LIBNOTMUCH version macros & variables match ... "
> -# lib/notmuch.h
> -LIBNOTMUCH_MAJOR_VERSION=broken
> -LIBNOTMUCH_MINOR_VERSION=broken
> -LIBNOTMUCH_MICRO_VERSION=broken
> -# lib/Makefile.local
> -LIBNOTMUCH_VERSION_MAJOR=borken
> -LIBNOTMUCH_VERSION_MINOR=borken
> -LIBNOTMUCH_VERSION_RELEASE=borken
> -
> -eval `awk 'NF == 3 && $1 == "#define" && $2 ~ /^LIBNOTMUCH_[A-Z]+_VERSION$/ \
> - && $3 ~ /^[0-9]+$/ { print $2 "=" $3 }' lib/notmuch.h`
> -
> -eval `awk 'NF == 3 && $1 ~ /^LIBNOTMUCH_VERSION_[A-Z]+$/ && $2 == "=" \
> - && $3 ~ /^[0-9]+$/ { print $1 "=" $3 }' lib/Makefile.local`
> -
> -
> -check_version_component ()
> -{
> - eval local v1=\$LIBNOTMUCH_$1_VERSION
> - eval local v2=\$LIBNOTMUCH_VERSION_$2
> - if [ $v1 != $v2 ]
> - then append_emsg "LIBNOTMUCH_$1_VERSION ($v1) does not equal LIBNOTMUCH_VERSION_$2 ($v2)"
> - fi
> -}
> -
> -old_emsg_count=$emsg_count
> -check_version_component MAJOR MAJOR
> -check_version_component MINOR MINOR
> -check_version_component MICRO RELEASE
> -[ $old_emsg_count = $emsg_count ] && echo Yes. || echo No.
> -
> echo -n "Checking that this is Debian package for notmuch... "
> read deb_notmuch deb_version rest < debian/changelog
> if [ "$deb_notmuch" = 'notmuch' ]
> diff --git a/lib/Makefile.local b/lib/Makefile.local
> index 412d865..3a07090 100644
> --- a/lib/Makefile.local
> +++ b/lib/Makefile.local
> @@ -1,26 +1,5 @@
> # -*- makefile -*-
>
> -# The major version of the library interface. This will control the soname.
> -# As such, this number must be incremented for any incompatible change to
> -# the library interface, (such as the deletion of an API or a major
> -# semantic change that breaks formerly functioning code).
> -#
> -LIBNOTMUCH_VERSION_MAJOR = 4
> -
> -# The minor version of the library interface. This should be incremented at
> -# the time of release for any additions to the library interface,
> -# (and when it is incremented, the release version of the library should
> -# be reset to 0).
> -LIBNOTMUCH_VERSION_MINOR = 3
> -
> -# The release version the library interface. This should be incremented at
> -# the time of release if there have been no changes to the interface, (but
> -# simply compatible changes to the implementation).
> -LIBNOTMUCH_VERSION_RELEASE = 0
> -
> -# Note: Don't forget to change the VERSION macros in notmuch.h when
> -# any of the above change.
> -
> ifeq ($(PLATFORM),MACOSX)
> LIBRARY_SUFFIX = dylib
> # On OS X, library version numbers go before suffix.
> diff --git a/lib/notmuch.h b/lib/notmuch.h
> index 421c19d..b1f5bfa 100644
> --- a/lib/notmuch.h
> +++ b/lib/notmuch.h
> @@ -56,7 +56,7 @@ NOTMUCH_BEGIN_DECLS
> * version in Makefile.local.
> */
> #define LIBNOTMUCH_MAJOR_VERSION 4
> -#define LIBNOTMUCH_MINOR_VERSION 2
> +#define LIBNOTMUCH_MINOR_VERSION 3
> #define LIBNOTMUCH_MICRO_VERSION 0
>
> #define NOTMUCH_DEPRECATED(major,minor) \
> --
> 2.1.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] build: extract library versions from notmuch.h
2015-08-09 22:11 ` Tomi Ollila
@ 2015-08-10 12:00 ` David Bremner
0 siblings, 0 replies; 3+ messages in thread
From: David Bremner @ 2015-08-10 12:00 UTC (permalink / raw)
To: Tomi Ollila, notmuch
Tomi Ollila <tomi.ollila@iki.fi> writes:
>
> Good idea. see below for 2 things.
Thanks for the review. I pushed with your changes, plus deleting created
files on the non-error path.
d
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-08-10 12:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-09 18:56 [PATCH] build: extract library versions from notmuch.h David Bremner
2015-08-09 22:11 ` Tomi Ollila
2015-08-10 12:00 ` David Bremner
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).