Add set-ver script

This commit is contained in:
project-repo 2023-04-13 22:22:18 +02:00
commit 47e9f28019
3 changed files with 36 additions and 0 deletions

View file

@ -361,6 +361,19 @@ Withou meson use:
./scripts/create-signatures GPGID
```
##### Set Version Number
Once the version number is set within meson.build, you can use
```
meson compile set-ver -C build
```
to set the version number in the man pages and README repology minversion.
Use of the script without meson is discouraged because meson.build is
not touched by the script.
### GCC and -fanalyzer
Cagebreak should compile with any reasonably new gcc or clang. Consider

View file

@ -362,6 +362,9 @@ run_target('output-hashes',
run_target('create-sigs',
command : ['scripts/create-signatures', get_option('gpg_id')])
run_target('set-ver',
command : ['scripts/set-version', meson.project_version()])
# Test Suite
test('Build without warnings', find_program('test/build-w-o-warnings'), env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'devel')

20
scripts/set-version Executable file
View file

@ -0,0 +1,20 @@
#!/bin/bash
# Copyright 2023, project-repo and the cagebreak contributors
# SPDX-License-Identifier: MIT
# TODO man pages
if [[ -n ${MESON_SOURCE_ROOT} ]]
then
# shellcheck disable=2164
cd "${MESON_SOURCE_ROOT}"
fi
# shellcheck disable=2034
version="${1}"
sed -i -e "s/minversion\=[0-9]*\.[0-9]*.[0-9]*/minversion=$version/" README.md
sed -i -e "s/Version [0-9]*\.[0-9]*.[0-9]*/VERSION $version/" man/cagebreak.1.md
sed -i -e "s/Version [0-9]*\.[0-9]*.[0-9]*/VERSION $version/" man/cagebreak-config.5.md
sed -i -e "s/Version [0-9]*\.[0-9]*.[0-9]*/VERSION $version/" man/cagebreak-socket.7.md