refine meson git version

This commit is contained in:
Sukchan Lee 2020-07-13 01:07:27 -04:00
parent 4dd113ac7b
commit 347e0d7b2f
5 changed files with 15 additions and 54 deletions

View File

@ -108,18 +108,6 @@ add_project_arguments(
cc.get_supported_arguments(possible_cc_flags),
language : 'c')
vcs_tagger = [meson.source_root() + '/misc/meson-vcs-tag.sh',
meson.source_root(),
get_option('version-tag'),
meson.project_version()]
version_h = vcs_tag(
input : 'src/version.h.in',
output : 'version.h',
command: vcs_tagger)
versiondep = declare_dependency(sources: version_h)
subdir('configs')
subdir('lib')
subdir('src')

View File

@ -1,19 +0,0 @@
# Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
# This file is part of Open5GS.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
option('version-tag', type : 'string',
description : 'override the git version string')

View File

@ -1,22 +0,0 @@
#!/bin/bash
set -eu
set -o pipefail
dir="$1"
tag="$2"
fallback="$3"
if [ -n "$tag" ]; then
echo "$tag"
exit 0
fi
# Apparently git describe has a bug where it always considers the work-tree
# dirty when invoked with --git-dir (even though 'git status' is happy). Work
# around this issue by cd-ing to the source directory.
cd "$dir"
# Check that we have either .git/ (a normal clone) or a .git file (a work-tree)
# and that we don't get confused if a tarball is extracted in a higher-level
# git repository.
[ -e .git ] && git describe --abbrev=7 --dirty=+ 2>/dev/null | sed 's/^v//' || echo "$fallback"

View File

@ -17,6 +17,21 @@
srcinc = include_directories('.')
#version_conf = configuration_data()
#version_conf.set_quoted('OPEN5GS_VERSION', meson.project_version())
#configure_file(output : 'version.h', configuration : version_conf)
version_data = configuration_data()
version_data.set_quoted('OPEN5GS_VERSION', '@VCS_TAG@')
version_h = vcs_tag(
input : configure_file(
output : 'version.h.in',
configuration : version_data),
output : 'version.h')
versiondep = declare_dependency(sources: version_h)
subdir('mme')
subdir('hss')
subdir('sgw')

View File

@ -1 +0,0 @@
#define OPEN5GS_VERSION "@VCS_TAG@"