Update CMake and autoconf scripts to consistently update LibTIFF version defines and references in various files when version definition in configure.ac has been changed.

- Move in tiffvers.h from .\libtiff source directory to .\libtiff  build directory.
- Remove unused version information from tif_config.h
- With every CMake build the version defines (e.g. 4.5.1) within tiffvers.h are consistently updated from configure.ac. The version release-date is taken from file RELEASE-DATE.
- The files VERSION and RELEASE-DATE are only updated with a special CMake target build: cmake --build . --target tiff_release.

- For autotools, version information is updated from configure.ac with ./autogen.sh. LIBTIFF_RELEASE_DATE is taken form file RELEASE-DATE.
- ./configure generates tiffvers.h with the cached version information and LIBTIFF_RELEASE_DATE.
- "make release" updates tiffvers.h and VERSION file with cached version info and RELEASE-DATE file and tiffves.h with the current date.
This commit is contained in:
Su Laus
2023-09-03 18:11:13 +00:00
committed by Even Rouault
parent 07f922106b
commit 432a3b64ad
16 changed files with 101 additions and 57 deletions

View File

@@ -35,9 +35,6 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
# Read version information from configure.ac.
include(AutotoolsVersion)
message(STATUS "Building tiff version ${LIBTIFF_VERSION_FULL}")
message(STATUS "libtiff library version ${SO_VERSION}")
string(TIMESTAMP BUILD_DATE "%Y%m%d")
message(STATUS "libtiff build date: ${BUILD_DATE}")
# Project definition
set(CMAKE_C_STANDARD 99)
@@ -167,6 +164,13 @@ include(PkgConfig)
message(STATUS "")
message(STATUS "Libtiff is now configured for ${CMAKE_SYSTEM}")
message(STATUS "")
if (NOT LIBTIFF_RELEASE_VERSION STREQUAL LIBTIFF_VERSION_FULL)
message(STATUS " Libtiff release version ${LIBTIFF_RELEASE_VERSION} is not equal to build version!")
endif()
message(STATUS " Libtiff build version: ${LIBTIFF_VERSION_FULL}")
message(STATUS " Libtiff library version: ${SO_VERSION}")
message(STATUS " Libtiff release date: ${LIBTIFF_RELEASE_DATE}")
message(STATUS "")
message(STATUS " Installation directory: ${prefix}")
message(STATUS " Documentation directory: ${LIBTIFF_DOCDIR}")
message(STATUS " C compiler: ${CMAKE_C_COMPILER}")

View File

@@ -100,11 +100,13 @@ Notes on releasing.
make release
This will update "RELEASE-DATE", "VERSION", and libtiff/tiffvers.h
in the source tree.
This will update "RELEASE-DATE", "VERSION" in the source tree,
and libtiff/tiffvers.h in the build tree.
12. In the source tree, verify that the version info in RELEASE-DATE,
VERSION and libtiff/tiffvers.h is right.
VERSION is right.
In the build tree, verify that the version info in
libtiff/tiffvers.h is right.
13. In the build tree do

View File

@@ -62,10 +62,14 @@ distcheck-hook:
SUBDIRS = port libtiff tools build contrib test doc tools/unsupported
NEW_LIBTIFF_RELEASE_DATE=$(shell date +"%Y%m%d")
release:
(rm -f $(top_srcdir)/RELEASE-DATE && echo $(LIBTIFF_RELEASE_DATE) > $(top_srcdir)/RELEASE-DATE)
@(echo --- Setting release date to $(NEW_LIBTIFF_RELEASE_DATE) and release version to $(LIBTIFF_VERSION) ---)
(rm -f $(top_srcdir)/RELEASE-DATE && echo $(NEW_LIBTIFF_RELEASE_DATE) > $(top_srcdir)/RELEASE-DATE)
(rm -f $(top_srcdir)/VERSION && echo $(LIBTIFF_VERSION) > $(top_srcdir)/VERSION)
(rm -f $(top_srcdir)/libtiff/tiffvers.h && sed 's,LIBTIFF_VERSION,$(LIBTIFF_VERSION),;s,LIBTIFF_RELEASE_DATE,$(LIBTIFF_RELEASE_DATE),;s,LIBTIFF_MAJOR_VERSION,$(LIBTIFF_MAJOR_VERSION),;s,LIBTIFF_MINOR_VERSION,$(LIBTIFF_MINOR_VERSION),;s,LIBTIFF_MICRO_VERSION,$(LIBTIFF_MICRO_VERSION),' $(top_srcdir)/libtiff/tiffvers.h.in > $(top_srcdir)/libtiff/tiffvers.h)
(rm -f $(top_builddir)/libtiff/tiffvers.h && sed 's,LIBTIFF_VERSION,$(LIBTIFF_VERSION),;s,LIBTIFF_RELEASE_DATE,$(NEW_LIBTIFF_RELEASE_DATE),;s,LIBTIFF_MAJOR_VERSION,$(LIBTIFF_MAJOR_VERSION),;s,LIBTIFF_MINOR_VERSION,$(LIBTIFF_MINOR_VERSION),;s,LIBTIFF_MICRO_VERSION,$(LIBTIFF_MICRO_VERSION),' $(top_srcdir)/libtiff/tiffvers.h.in > $(top_builddir)/libtiff/tiffvers.h && sed -i 's,@,,g' $(top_builddir)/libtiff/tiffvers.h)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libtiff-4.pc

View File

@@ -40,6 +40,12 @@ endforeach()
set(LIBTIFF_VERSION "${LIBTIFF_MAJOR_VERSION}.${LIBTIFF_MINOR_VERSION}.${LIBTIFF_MICRO_VERSION}")
set(LIBTIFF_VERSION_FULL "${LIBTIFF_VERSION}${LIBTIFF_ALPHA_VERSION}")
# Get release version from file VERSION
FILE(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" LIBTIFF_RELEASE_VERSION)
# Package date - get it from file RELEASE-DATE
FILE(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/RELEASE-DATE" LIBTIFF_RELEASE_DATE)
# Convert the libtool version variables to proper major and minor versions
math(EXPR SO_MAJOR "${LIBTIFF_CURRENT} - ${LIBTIFF_AGE}")
set(SO_MINOR "${LIBTIFF_AGE}")

View File

@@ -22,10 +22,26 @@
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Add target tiff_release to update the version information in the root files
# VERSION and RELEASE-DATE.
add_custom_target(tiff_release
COMMAND ${CMAKE_COMMAND}
"-DSOURCE_DIR:PATH=${PROJECT_SOURCE_DIR}"
"-DLIBTIFF_VERSION=${PROJECT_VERSION}"
-P "${CMAKE_CURRENT_LIST_DIR}/ReleaseScript.cmake"
COMMENT "Releasing ${PROJECT_NAME} ${PROJECT_VERSION}")
COMMAND ${CMAKE_COMMAND}
"-DSOURCE_DIR:PATH=${PROJECT_SOURCE_DIR}"
"-DLIBTIFF_VERSION=${PROJECT_VERSION}"
"-DLIBTIFF_BASIC_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}"
"-DLIBTIFF_BASIC_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}"
-P "${CMAKE_CURRENT_LIST_DIR}/ReleaseScript.cmake"
COMMENT "Releasing ${PROJECT_NAME} ${PROJECT_VERSION} ...")
# Version information is taken from configure.ac
# Note: Single command "cmake --build . --target tiff_release"
# does not work correctly, because version information is taken from CMakeCache.txt,
# which is not updated by cmake --build.
# Therefore, force CMake re-configure if configure.ac has changed.
# By the way, release-date and VERSION will not change but only when --targt tiff_release is called.
set_property(
DIRECTORY
APPEND
PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/configure.ac
)

View File

@@ -22,11 +22,21 @@
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
# Update release date to current date
string(TIMESTAMP LIBTIFF_RELEASE_DATE "%Y%m%d")
# Update version information in all relevant files
message(STATUS "Setting release version to ${LIBTIFF_VERSION}")
message(STATUS "Setting release date to ${LIBTIFF_RELEASE_DATE}")
configure_file("${SOURCE_DIR}/libtiff/tiffvers.h.cmake.in"
"${SOURCE_DIR}/libtiff/tiffvers.h"
@ONLY)
# Only needed here, for manual build of target tiff_release
# because otherwise tiffvers.h is generated when building all targets.
configure_file(${LIBTIFF_BASIC_SOURCE_DIR}/libtiff/tiffvers.h.cmake.in
${LIBTIFF_BASIC_BINARY_DIR}/libtiff/tiffvers.h
@ONLY)
# Write version information and release date to root files.
FILE(WRITE ${LIBTIFF_BASIC_SOURCE_DIR}/VERSION "${LIBTIFF_VERSION}" \n)
FILE(WRITE ${LIBTIFF_BASIC_SOURCE_DIR}/RELEASE-DATE "${LIBTIFF_RELEASE_DATE}" \n)
message(STATUS "Files tiffvers.h, VERSION and RELEASE-DATE updated.")

View File

@@ -44,8 +44,9 @@ LIBTIFF_MINOR_VERSION=5
LIBTIFF_MICRO_VERSION=1
LIBTIFF_ALPHA_VERSION=
LIBTIFF_VERSION=$LIBTIFF_MAJOR_VERSION.$LIBTIFF_MINOR_VERSION.$LIBTIFF_MICRO_VERSION$LIBTIFF_ALPHA_VERSION
dnl This will be used with the 'make release' target
LIBTIFF_RELEASE_DATE=`date +"%Y%m%d"`
dnl This (LIBTIFF_RELEASE_DATE) is used to set the #define TIFFLIB_VERSION in tiffvers.h.
LIBTIFF_RELEASE_DATE=$(cat ${srcdir}/RELEASE-DATE)
dnl Libtool library revision control info
dnl See the libtool documentation under the heading "Libtool's versioning
@@ -1183,6 +1184,7 @@ AC_CONFIG_FILES([Makefile \
doc/Makefile \
libtiff-4.pc \
libtiff/Makefile \
libtiff/tiffvers.h \
port/Makefile \
test/Makefile \
tools/Makefile \
@@ -1196,6 +1198,10 @@ dnl ---------------------------------------------------------------------------
LOC_MSG()
LOC_MSG([Libtiff is now configured for ${host}])
LOC_MSG()
LOC_MSG([ Libtiff build version: ${LIBTIFF_VERSION}])
LOC_MSG([ Libtiff library version: ${LIBTIFF_VERSION_INFO}])
LOC_MSG([ Libtiff release date: ${LIBTIFF_RELEASE_DATE}])
LOC_MSG()
LOC_MSG([ Installation directory: ${prefix}])
LOC_MSG([ Documentation directory: ${LIBTIFF_DOCDIR}])
LOC_MSG([ C compiler: ${CC} ${CFLAGS}])

View File

@@ -23,17 +23,21 @@
# OF THIS SOFTWARE.
# Generate headers
# and update configuration settings and package / version information.
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tif_config.h.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/tif_config.h
@ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tiffconf.h.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/tiffconf.h
@ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tiffvers.h.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/tiffvers.h
@ONLY)
set(tiff_public_HEADERS
tiff.h
tiffio.h
tiffvers.h
${CMAKE_CURRENT_BINARY_DIR}/tiffvers.h
${CMAKE_CURRENT_BINARY_DIR}/tiffconf.h)
set(tiff_private_HEADERS

View File

@@ -32,6 +32,7 @@ EXTRA_DIST = \
libtiff.def \
libtiff.map \
libtiffxx.map \
tiffvers.h.cmake.in \
tif_config.h.cmake.in \
tiffconf.h.cmake.in \
tif_win32_versioninfo.rc

View File

@@ -82,18 +82,12 @@
/* Define to the full name of this package. */
#define PACKAGE_NAME "@PACKAGE_NAME@"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "@PACKAGE_STRING@"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "@PACKAGE_TARNAME@"
/* Define to the home page for this package. */
#define PACKAGE_URL "@PACKAGE_URL@"
/* Define to the version of this package. */
#define PACKAGE_VERSION "@PACKAGE_VERSION@"
/* Size of size_t */
#define SIZEOF_SIZE_T @SIZEOF_SIZE_T@
@@ -106,9 +100,6 @@
/* define to use win32 IO system */
#cmakedefine USE_WIN32_FILEIO 1
/* Version number of package */
#define VERSION "@PACKAGE_VERSION@"
/* Support WEBP compression */
#cmakedefine WEBP_SUPPORT 1

View File

@@ -85,18 +85,12 @@
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* The size of `size_t', as computed by sizeof. */
#undef SIZEOF_SIZE_T
@@ -109,9 +103,6 @@
/* define to use win32 IO system */
#undef USE_WIN32_FILEIO
/* Version number of package */
#undef VERSION
/* Support webp compression */
#undef WEBP_SUPPORT

View File

@@ -7,7 +7,6 @@
#include <winver.h>
#include "tiffvers.h"
#include "tif_config.h"
#ifdef _WIN32
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
@@ -33,12 +32,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "libtiff project"
VALUE "FileDescription", "TIFF Library"
VALUE "FileVersion", PACKAGE_VERSION
VALUE "FileVersion", TIFFLIB_VERSION_STR_MAJ_MIN_MIC
VALUE "InternalName", "tiff.dll"
VALUE "LegalCopyright", "See LICENCE.md"
VALUE "OriginalFilename", "tiff.dll"
VALUE "ProductName", "LibTIFF"
VALUE "ProductVersion", PACKAGE_VERSION
VALUE "ProductVersion", TIFFLIB_VERSION_STR_MAJ_MIN_MIC
VALUE "WebPage", "https://libtiff.gitlab.io/libtiff/\0"
END
END

View File

@@ -1,9 +1,14 @@
/* tiffvers.h version information is updated according to version information
* in configure.ac */
/* clang-format off */
/* clang-format disabled because FindTIFF.cmake is very sensitive to the
* formatting of below line being a single line.
* Furthermore, configure_file variables of type "@VAR@" are
* modified by clang-format and won't be substituted by CMake.
*/
#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.5.1\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
#define TIFFLIB_VERSION_STR "LIBTIFF, Version @LIBTIFF_VERSION@\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
/*
* This define can be used in code that requires
* compilation-related definitions specific to a
@@ -11,12 +16,13 @@
* version checking should be done based on the
* string returned by TIFFGetVersion.
*/
#define TIFFLIB_VERSION 20230609
#define TIFFLIB_VERSION @LIBTIFF_RELEASE_DATE@
/* The following defines have been added in 4.5.0 */
#define TIFFLIB_MAJOR_VERSION 4
#define TIFFLIB_MINOR_VERSION 5
#define TIFFLIB_MICRO_VERSION 1
#define TIFFLIB_MAJOR_VERSION @LIBTIFF_MAJOR_VERSION@
#define TIFFLIB_MINOR_VERSION @LIBTIFF_MINOR_VERSION@
#define TIFFLIB_MICRO_VERSION @LIBTIFF_MICRO_VERSION@
#define TIFFLIB_VERSION_STR_MAJ_MIN_MIC "@LIBTIFF_VERSION@"
/* Macro added in 4.5.0. Returns TRUE if the current libtiff version is
* greater or equal to major.minor.micro

View File

@@ -1,9 +1,14 @@
/* tiffvers.h version information is updated according to version information
* in configure.ac */
/* clang-format off */
/* clang-format disabled because FindTIFF.cmake is very sensitive to the
* formatting of below line being a single line.
* Furthermore, configure_file variables of type "@VAR@" are
* modified by clang-format and won't be substituted by CMake.
*/
#define TIFFLIB_VERSION_STR "LIBTIFF, Version LIBTIFF_VERSION\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
#define TIFFLIB_VERSION_STR "LIBTIFF, Version @LIBTIFF_VERSION@\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
/*
* This define can be used in code that requires
* compilation-related definitions specific to a
@@ -11,12 +16,13 @@
* version checking should be done based on the
* string returned by TIFFGetVersion.
*/
#define TIFFLIB_VERSION LIBTIFF_RELEASE_DATE
#define TIFFLIB_VERSION @LIBTIFF_RELEASE_DATE@
/* The following defines have been added in 4.5.0 */
#define TIFFLIB_MAJOR_VERSION LIBTIFF_MAJOR_VERSION
#define TIFFLIB_MINOR_VERSION LIBTIFF_MINOR_VERSION
#define TIFFLIB_MICRO_VERSION LIBTIFF_MICRO_VERSION
#define TIFFLIB_MAJOR_VERSION @LIBTIFF_MAJOR_VERSION@
#define TIFFLIB_MINOR_VERSION @LIBTIFF_MINOR_VERSION@
#define TIFFLIB_MICRO_VERSION @LIBTIFF_MICRO_VERSION@
#define TIFFLIB_VERSION_STR_MAJ_MIN_MIC "@LIBTIFF_VERSION@"
/* Macro added in 4.5.0. Returns TRUE if the current libtiff version is
* greater or equal to major.minor.micro

View File

@@ -7,7 +7,6 @@
#include <winver.h>
#include "tiffvers.h"
#include "tif_config.h"
#ifdef _WIN32
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
@@ -33,12 +32,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "libtiff project"
VALUE "FileDescription", "TIFF Tools"
VALUE "FileVersion", PACKAGE_VERSION
VALUE "FileVersion", TIFFLIB_VERSION_STR_MAJ_MIN_MIC
VALUE "InternalName", ""
VALUE "LegalCopyright", "See LICENCE.md"
VALUE "OriginalFilename", ""
VALUE "ProductName", "LibTIFF"
VALUE "ProductVersion", PACKAGE_VERSION
VALUE "ProductVersion", TIFFLIB_VERSION_STR_MAJ_MIN_MIC
VALUE "WebPage", "https://libtiff.gitlab.io/libtiff/\0"
END
END

View File

@@ -7,7 +7,6 @@
#include <winver.h>
#include "tiffvers.h"
#include "tif_config.h"
#ifdef _WIN32
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
@@ -33,12 +32,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "libtiff project"
VALUE "FileDescription", "Unsupported TIFF Tools"
VALUE "FileVersion", PACKAGE_VERSION
VALUE "FileVersion", TIFFLIB_VERSION_STR_MAJ_MIN_MIC
VALUE "InternalName", ""
VALUE "LegalCopyright", "See LICENCE.md"
VALUE "OriginalFilename", ""
VALUE "ProductName", "LibTIFF"
VALUE "ProductVersion", PACKAGE_VERSION
VALUE "ProductVersion", TIFFLIB_VERSION_STR_MAJ_MIN_MIC
VALUE "WebPage", "https://libtiff.gitlab.io/libtiff/\0"
END
END