660-version-stamp.patch 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. From 85599643e2fbf70f7f0bd58831993132ef335705 Mon Sep 17 00:00:00 2001
  2. From: Bruno Haible <[email protected]>
  3. Date: Wed, 22 Jan 2025 21:25:27 +0100
  4. Subject: New module 'version-stamp'.
  5. * m4/version-stamp.m4: New file.
  6. * modules/version-stamp: New file.
  7. ---
  8. ChangeLog | 6 ++++++
  9. m4/version-stamp.m4 | 35 +++++++++++++++++++++++++++++++++++
  10. modules/version-stamp | 19 +++++++++++++++++++
  11. 3 files changed, 60 insertions(+)
  12. create mode 100644 m4/version-stamp.m4
  13. create mode 100644 modules/version-stamp
  14. --- /dev/null
  15. +++ b/m4/version-stamp.m4
  16. @@ -0,0 +1,35 @@
  17. +# version-stamp.m4
  18. +# serial 1
  19. +dnl Copyright (C) 2025 Free Software Foundation, Inc.
  20. +dnl This file is free software, distributed under the terms of the GNU
  21. +dnl General Public License. As a special exception to the GNU General
  22. +dnl Public License, this file may be distributed as part of a program
  23. +dnl that contains a configuration script generated by Autoconf, under
  24. +dnl the same distribution terms as the rest of that program.
  25. +
  26. +# Manages a stamp file, that keeps track when $(VERSION) was last changed.
  27. +#
  28. +# gl_CONFIG_VERSION_STAMP
  29. +# needs to be invoked near the end of the package's top-level configure.ac,
  30. +# before AC_OUTPUT.
  31. +# It makes sure that during the build,
  32. +# - $(top_srcdir)/.version exists, and
  33. +# - when $(VERSION) is changed, $(top_srcdir)/.version gets modified.
  34. +#
  35. +# $(top_srcdir)/.version is a stamp file. Its contents wouldn't matter,
  36. +# except that for detecting the change, we store the value of $(VERSION)
  37. +# in it (but we could just as well store it in a different file).
  38. +AC_DEFUN([gl_CONFIG_VERSION_STAMP],
  39. +[
  40. + AC_CONFIG_COMMANDS([version-timestamp],
  41. + [if test -f "$ac_top_srcdir/.version" \
  42. + && test `cat "$ac_top_srcdir/.version"` = "$gl_version"; then
  43. + # The value of $(VERSION) is the same as last time.
  44. + :
  45. + else
  46. + # The value of $(VERSION) has changed. Update the stamp.
  47. + echo "$gl_version" > "$ac_top_srcdir/.version"
  48. + fi
  49. + ],
  50. + [gl_version="$VERSION"])
  51. +])
  52. --- /dev/null
  53. +++ b/modules/version-stamp
  54. @@ -0,0 +1,19 @@
  55. +Description:
  56. +Optimized rebuilding of artifacts that depend on $(VERSION).
  57. +
  58. +Files:
  59. +m4/version-stamp.m4
  60. +
  61. +Depends-on:
  62. +
  63. +configure.ac:
  64. +
  65. +Makefile.am:
  66. +
  67. +Include:
  68. +
  69. +License:
  70. +GPLed build tool
  71. +
  72. +Maintainer:
  73. +Bruno Haible