mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-23 19:31:44 +00:00
build system: include git commit number since last release in version for dev builds
This commit is contained in:
parent
4569b4fdb7
commit
6a8246e7eb
1
.gitignore
vendored
1
.gitignore
vendored
@ -64,6 +64,7 @@
|
||||
/src/common/common_pch.h.[gp]ch
|
||||
/src/common/common_pch.h.pch-????????
|
||||
/src/common/libmtxcommon.dll
|
||||
/src/common/mkvtoolnix_version.h
|
||||
/src/info/forms/*.h
|
||||
/src/info/static_plugins.cpp
|
||||
/src/mkvextract
|
||||
|
4
Rakefile
4
Rakefile
@ -100,6 +100,8 @@ def setup_globals
|
||||
$dependency_dir = "#{$source_dir}/rake.d/dependency.d"
|
||||
$dependency_tmp_dir = "#{$dependency_dir}/tmp"
|
||||
|
||||
$version_header_name = "#{$build_dir}/src/common/mkvtoolnix_version.h"
|
||||
|
||||
$languages = {
|
||||
:programs => c(:TRANSLATIONS).split(/\s+/),
|
||||
:manpages => c(:MANPAGES_TRANSLATIONS).split(/\s+/),
|
||||
@ -279,6 +281,7 @@ setup_globals
|
||||
setup_overrides
|
||||
import_dependencies
|
||||
generate_helper_files
|
||||
update_version_number_include
|
||||
|
||||
# Default task
|
||||
define_default_task
|
||||
@ -977,6 +980,7 @@ task :clean do
|
||||
}
|
||||
patterns += $applications + $tools.collect { |name| "src/tools/#{name}" }
|
||||
patterns += PCH.clean_patterns
|
||||
patterns << $version_header_name
|
||||
|
||||
remove_files_by_patterns patterns
|
||||
|
||||
|
@ -1,4 +1,7 @@
|
||||
# coding: utf-8
|
||||
|
||||
require "shellwords"
|
||||
|
||||
$use_tempfile_for_run = defined?(RUBY_PLATFORM) && /mingw/i.match(RUBY_PLATFORM)
|
||||
|
||||
$git_mutex = Mutex.new
|
||||
@ -252,6 +255,38 @@ def ensure_file file_name, content = ""
|
||||
File.open(file_name, 'w') { |file| file.write(content) }
|
||||
end
|
||||
|
||||
def update_version_number_include
|
||||
git_dir = $source_dir + '/.git'
|
||||
current_version = nil
|
||||
wanted_version = c(:PACKAGE_VERSION)
|
||||
|
||||
if FileTest.exists?($version_header_name)
|
||||
lines = IO.readlines($version_header_name)
|
||||
|
||||
if !lines.empty? && %r{#define.*?"([0-9.]+)"}.match(lines[0])
|
||||
current_version = $1
|
||||
end
|
||||
end
|
||||
|
||||
if FileTest.directory?(git_dir)
|
||||
command = ["git", "--git-dir=#{$source_dir}/.git", "describe", "HEAD"].
|
||||
map { |e| Shellwords.escape(e) }.
|
||||
join(' ')
|
||||
|
||||
description = `#{command} 2> /dev/null`.chomp
|
||||
|
||||
if %r{^release-#{Regexp.escape(c(:PACKAGE_VERSION))}-(\d+)}.match(description) && ($1.to_i != 0)
|
||||
wanted_version += ".#{$1}"
|
||||
end
|
||||
end
|
||||
|
||||
return if current_version == wanted_version
|
||||
|
||||
File.open($version_header_name, "w") do |file|
|
||||
file.puts("#define MKVTOOLNIX_VERSION \"#{wanted_version}\"")
|
||||
end
|
||||
end
|
||||
|
||||
class Rake::Task
|
||||
def mo_all_prerequisites
|
||||
todo = [name]
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "common/debugging.h"
|
||||
#include "common/hacks.h"
|
||||
#include "common/mkvtoolnix_version.h"
|
||||
#include "common/strings/formatting.h"
|
||||
#include "common/strings/parsing.h"
|
||||
#include "common/version.h"
|
||||
@ -135,7 +136,7 @@ get_version_info(const std::string &program,
|
||||
|
||||
if (!program.empty())
|
||||
info.push_back(program);
|
||||
info.push_back(fmt::format("v{0} ('{1}')", PACKAGE_VERSION, VERSIONNAME));
|
||||
info.push_back(fmt::format("v{0} ('{1}')", MKVTOOLNIX_VERSION, VERSIONNAME));
|
||||
|
||||
if (flags & vif_architecture)
|
||||
info.push_back(fmt::format("{0}-bit", __SIZEOF_POINTER__ * 8));
|
||||
@ -145,12 +146,12 @@ get_version_info(const std::string &program,
|
||||
|
||||
int
|
||||
compare_current_version_to(const std::string &other_version_str) {
|
||||
return version_number_t(PACKAGE_VERSION).compare(version_number_t(other_version_str));
|
||||
return version_number_t(MKVTOOLNIX_VERSION).compare(version_number_t(other_version_str));
|
||||
}
|
||||
|
||||
version_number_t
|
||||
get_current_version() {
|
||||
return version_number_t(PACKAGE_VERSION);
|
||||
return version_number_t(MKVTOOLNIX_VERSION);
|
||||
}
|
||||
|
||||
mtx_release_version_t
|
||||
|
Loading…
Reference in New Issue
Block a user