mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-01-27 14:03:36 +03:00
build: Read version number from VERSION file
This commit is contained in:
parent
c3731347c4
commit
e2a49afe3e
@ -1,14 +1,12 @@
|
||||
cmake_minimum_required(VERSION 3.18)
|
||||
|
||||
file(STRINGS "configure.ac" CONFIGURE_AC_LINES)
|
||||
foreach(line ${CONFIGURE_AC_LINES})
|
||||
if(line MATCHES [[^m4_define\(\[(MAJOR_VERSION|MINOR_VERSION|MICRO_VERSION)\],[ \t]*([0-9]+)\)$]])
|
||||
set(LIBXML_${CMAKE_MATCH_1} ${CMAKE_MATCH_2})
|
||||
elseif(line MATCHES "^(LIBXML_MAJOR_VERSION|LIBXML_MINOR_VERSION|LIBXML_MICRO_VERSION)=([0-9]+)$")
|
||||
set(${CMAKE_MATCH_1} ${CMAKE_MATCH_2})
|
||||
endif()
|
||||
endforeach()
|
||||
set(VERSION "${LIBXML_MAJOR_VERSION}.${LIBXML_MINOR_VERSION}.${LIBXML_MICRO_VERSION}")
|
||||
file(READ "VERSION" VERSION)
|
||||
string(STRIP ${VERSION} VERSION)
|
||||
if(${VERSION} MATCHES [[([0-9]+)\.([0-9]+)\.([0-9]+)]])
|
||||
set(LIBXML_MAJOR_VERSION ${CMAKE_MATCH_1})
|
||||
set(LIBXML_MINOR_VERSION ${CMAKE_MATCH_2})
|
||||
set(LIBXML_MICRO_VERSION ${CMAKE_MATCH_3})
|
||||
endif()
|
||||
|
||||
project(libxml2 VERSION ${VERSION} LANGUAGES C)
|
||||
|
||||
|
@ -50,8 +50,7 @@ You can get started by running
|
||||
|
||||
### Bump the version number
|
||||
|
||||
Edit the version numbers in `configure.ac` and `meson.build` if you
|
||||
haven't done so already.
|
||||
Update the version number in `VERSION` if you haven't done so already.
|
||||
|
||||
### Build the tarball
|
||||
|
||||
|
14
configure.ac
14
configure.ac
@ -1,21 +1,19 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ([2.63])
|
||||
|
||||
m4_define([MAJOR_VERSION], 2)
|
||||
m4_define([MINOR_VERSION], 14)
|
||||
m4_define([MICRO_VERSION], 0)
|
||||
m4_define([version_macro], m4_normalize(m4_include([VERSION])))
|
||||
|
||||
AC_INIT([libxml2],[MAJOR_VERSION.MINOR_VERSION.MICRO_VERSION])
|
||||
AC_INIT([libxml2],[version_macro])
|
||||
AC_CONFIG_SRCDIR([entities.c])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
LIBXML_MAJOR_VERSION=MAJOR_VERSION
|
||||
LIBXML_MINOR_VERSION=MINOR_VERSION
|
||||
LIBXML_MICRO_VERSION=MICRO_VERSION
|
||||
LIBXML_VERSION=version_macro
|
||||
LIBXML_MAJOR_VERSION=`echo $LIBXML_VERSION | cut -d . -f 1`
|
||||
LIBXML_MINOR_VERSION=`echo $LIBXML_VERSION | cut -d . -f 2`
|
||||
LIBXML_MICRO_VERSION=`echo $LIBXML_VERSION | cut -d . -f 3`
|
||||
LIBXML_MICRO_VERSION_SUFFIX=
|
||||
LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
|
||||
|
||||
# The oldest minor version we are compatible with.
|
||||
LIBXML_MINOR_COMPAT=0
|
||||
|
@ -1,7 +1,7 @@
|
||||
project(
|
||||
'libxml2',
|
||||
'c',
|
||||
version: '2.13.0',
|
||||
version: files('VERSION'),
|
||||
license: 'MIT',
|
||||
default_options: ['buildtype=debug', 'warning_level=3'],
|
||||
meson_version: '>= 0.61',
|
||||
|
Loading…
x
Reference in New Issue
Block a user