Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dosbox-staging/dosbox-staging.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatryk Obara <dreamer.tan@gmail.com>2021-02-13 22:27:48 +0300
committerPatryk Obara <patryk.obara@gmail.com>2021-02-15 04:03:58 +0300
commit7cd6b2e9949665d28082c5ab251d0d93b2692c11 (patch)
treec261900dbae1a12d350062dee29de226ddc282f6
parent16faf3451387808b0a049585cdc8d8166c38c262 (diff)
Use Git tag description for emulator versionpo/older-opengl-1
This change BREAKS Autoconf-based buildsystem. Only Meson and Visual Studio buildsystems are operational from this point forward. Thanks to this change, it will be easier for developers and testers to communicate/detect the exact version of emulator. Builds created from tarball releases OR builds from Git repo checked out to point to an annotated tag will behave this way: $ dosbox --version dosbox (dosbox-staging), version 0.77.0 ... Development builds from Git repo will behave this way: $ dosbox --version dosbox (dosbox-staging), version 0.77.0-alpha-457-g6d8d10a9 ... Meson handles this "automagically", correctly for us via vcs_tag function. We use it to generate version.cpp file - this way new commits in repo will rebuild only a single file and trigger linker, but will never result in full rebuild. When Meson cannot obtain info version from Git, it automatically falls back to version specified in our project function on top of meson.build file. Leave VERSION macro in place (it originated from Autoconf) in several places - it's being extensively used when communicating e.g. "emulated modem firmware version" and other fake-hardware identification. Any builds created with Visual Studio (Release and Debug builds) will use hardcoded version string for VERSION macro and hardcoded version string DOSBOX_DETAILED_VERSION for all the places where we want more info. This macro defaults to string "git" and is being overriden with output of "git describe" on CI. Also, adjust --version copyright message for readability and to better fit into 80 colums. Fixes: #543
-rw-r--r--.github/workflows/windows.yml2
-rw-r--r--include/dosbox.h2
-rw-r--r--meson.build3
-rw-r--r--src/gui/gui_msgs.h12
-rw-r--r--src/gui/sdlmain.cpp4
-rw-r--r--src/misc/programs.cpp8
-rw-r--r--src/platform/visualc/config.h5
-rw-r--r--src/platform/visualc/version.cpp31
-rw-r--r--src/shell/shell.cpp9
-rw-r--r--src/shell/shell_cmds.cpp5
-rw-r--r--src/version.cpp.in31
-rw-r--r--vs/dosbox.vcxproj1
12 files changed, 93 insertions, 20 deletions
diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml
index e49997013..f55aefe8e 100644
--- a/.github/workflows/windows.yml
+++ b/.github/workflows/windows.yml
@@ -114,7 +114,7 @@ jobs:
set -x
git fetch --prune --unshallow
export VERSION=$(git describe --abbrev=4)
- sed -i "s|VERSION \"git\"|VERSION \"$VERSION\"|" src/platform/visualc/config.h
+ sed -i "s|DOSBOX_DETAILED_VERSION \"git\"|DOSBOX_DETAILED_VERSION \"$VERSION\"|" src/platform/visualc/config.h
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Build
diff --git a/include/dosbox.h b/include/dosbox.h
index 479d73381..2956b28bb 100644
--- a/include/dosbox.h
+++ b/include/dosbox.h
@@ -41,6 +41,8 @@ class Section;
typedef Bitu (LoopHandler)(void);
+const char *DOSBOX_GetDetailedVersion() noexcept;
+
void DOSBOX_RunMachine();
void DOSBOX_SetLoop(LoopHandler * handler);
void DOSBOX_SetNormalLoop();
diff --git a/meson.build b/meson.build
index 13cf5bf1e..faaee588e 100644
--- a/meson.build
+++ b/meson.build
@@ -290,7 +290,8 @@ subdir('tests')
# dosbox executable
#
-executable('dosbox', ['src/main.cpp', 'src/dosbox.cpp'],
+version_file = vcs_tag(input : 'src/version.cpp.in', output : 'version.cpp')
+executable('dosbox', ['src/main.cpp', 'src/dosbox.cpp', version_file],
dependencies : [threads_dep, sdl2_dep] + internal_deps,
include_directories : incdir,
install : true)
diff --git a/src/gui/gui_msgs.h b/src/gui/gui_msgs.h
index e6c6345af..2bb27981a 100644
--- a/src/gui/gui_msgs.h
+++ b/src/gui/gui_msgs.h
@@ -23,13 +23,13 @@
constexpr char version_msg[] =
R"(dosbox (dosbox-staging), version %s
-Copyright (C) 2020-2021 The DOSBox Staging Team.
-License GPLv2+: GNU GPL version 2 or later
-<https://www.gnu.org/licenses/gpl-2.0.html>
-This is free software, and you are welcome to change and redistribute it
-under certain conditions; please read the COPYING file thoroughly before
-doing so. There is NO WARRANTY, to the extent permitted by law.
+Copyright (C) 2020-2021 The DOSBox Staging Team
+License: GNU GPL-2.0-or-later <https://www.gnu.org/licenses/gpl-2.0.html>
+
+This is free software, and you are welcome to change and redistribute it under
+certain conditions; please read the COPYING file thoroughly before doing so.
+There is NO WARRANTY, to the extent permitted by law.
)";
constexpr char help_msg[] =
diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp
index 105b652c2..b074cc8b5 100644
--- a/src/gui/sdlmain.cpp
+++ b/src/gui/sdlmain.cpp
@@ -3278,7 +3278,7 @@ int sdl_main(int argc, char *argv[])
if (control->cmdline->FindExist("--version") ||
control->cmdline->FindExist("-version") ||
control->cmdline->FindExist("-v")) {
- printf(version_msg, VERSION);
+ printf(version_msg, DOSBOX_GetDetailedVersion());
return 0;
}
@@ -3303,7 +3303,7 @@ int sdl_main(int argc, char *argv[])
SetConsoleCtrlHandler((PHANDLER_ROUTINE) ConsoleEventHandler,TRUE);
#endif
- LOG_MSG("dosbox-staging version %s", VERSION);
+ LOG_MSG("dosbox-staging version %s", DOSBOX_GetDetailedVersion());
LOG_MSG("---");
if (SDL_Init(SDL_INIT_AUDIO | SDL_INIT_VIDEO) < 0)
diff --git a/src/misc/programs.cpp b/src/misc/programs.cpp
index 2406726c3..81c5528c2 100644
--- a/src/misc/programs.cpp
+++ b/src/misc/programs.cpp
@@ -391,7 +391,8 @@ void CONFIG::Run(void) {
Bitu size = control->configfiles.size();
std::string config_path;
Cross::GetPlatformConfigDir(config_path);
- WriteOut(MSG_Get("PROGRAM_CONFIG_CONFDIR"), VERSION,config_path.c_str());
+ WriteOut(MSG_Get("PROGRAM_CONFIG_CONFDIR"), VERSION,
+ config_path.c_str());
if (size==0) WriteOut(MSG_Get("PROGRAM_CONFIG_NOCONFIGFILE"));
else {
WriteOut(MSG_Get("PROGRAM_CONFIG_PRIMARY_CONF"),control->configfiles.front().c_str());
@@ -861,8 +862,9 @@ void PROGRAMS_Init(Section* /*sec*/) {
MSG_Add("PROGRAM_CONFIG_NOCONFIGFILE","No config file loaded!\n");
MSG_Add("PROGRAM_CONFIG_PRIMARY_CONF","Primary config file: \n%s\n");
MSG_Add("PROGRAM_CONFIG_ADDITIONAL_CONF","Additional config files:\n");
- MSG_Add("PROGRAM_CONFIG_CONFDIR","DOSBox %s configuration directory: \n%s\n\n");
-
+ MSG_Add("PROGRAM_CONFIG_CONFDIR",
+ "DOSBox Staging %s configuration directory: \n%s\n\n");
+
// writeconf
MSG_Add("PROGRAM_CONFIG_FILE_ERROR","\nCan't open file %s\n");
MSG_Add("PROGRAM_CONFIG_FILE_WHICH", "Writing config file %s\n");
diff --git a/src/platform/visualc/config.h b/src/platform/visualc/config.h
index ad19daefd..2af214875 100644
--- a/src/platform/visualc/config.h
+++ b/src/platform/visualc/config.h
@@ -2,7 +2,10 @@
#define CONF_BRAND "staging-git"
/* Version number of package */
-#define VERSION "git"
+#define VERSION "0.77.0"
+
+/* This macro is going to be overriden via CI */
+#define DOSBOX_DETAILED_VERSION "git"
/* Define to 1 to enable internal debugger, requires libcurses */
#define C_DEBUG 0
diff --git a/src/platform/visualc/version.cpp b/src/platform/visualc/version.cpp
new file mode 100644
index 000000000..ace6172e3
--- /dev/null
+++ b/src/platform/visualc/version.cpp
@@ -0,0 +1,31 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ * Copyright (C) 2021-2021 The DOSBox Staging Team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 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, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "dosbox.h"
+
+const char *DOSBOX_GetDetailedVersion() noexcept
+{
+ static const char version[] = DOSBOX_DETAILED_VERSION;
+ // Git tag names start with a letter v (by convention).
+ if (version[0] == 'v')
+ return version + 1;
+ else
+ return version;
+}
diff --git a/src/shell/shell.cpp b/src/shell/shell.cpp
index 0cc105fd8..42b59167b 100644
--- a/src/shell/shell.cpp
+++ b/src/shell/shell.cpp
@@ -341,7 +341,8 @@ void DOS_Shell::Run()
const bool wants_welcome_banner = control->GetStartupVerbosity() >=
Verbosity::Medium;
if (wants_welcome_banner) {
- WriteOut(MSG_Get("SHELL_STARTUP_BEGIN"), VERSION);
+ WriteOut(MSG_Get("SHELL_STARTUP_BEGIN"),
+ DOSBOX_GetDetailedVersion());
#if C_DEBUG
WriteOut(MSG_Get("SHELL_STARTUP_DEBUG"));
#endif
@@ -359,7 +360,7 @@ void DOS_Shell::Run()
line.erase();
ParseLine(input_line);
} else {
- WriteOut(MSG_Get("SHELL_STARTUP_SUB"),VERSION);
+ WriteOut(MSG_Get("SHELL_STARTUP_SUB"), DOSBOX_GetDetailedVersion());
}
do {
if (bf){
@@ -746,8 +747,8 @@ void SHELL_Init() {
"Examples:\n"
" \033[32;1mver\033[0m \033[37;1mset\033[0m \033[36;1m6.22\033[0m\n"
" \033[32;1mver\033[0m \033[37;1mset\033[0m \033[36;1m7 10\033[0m\n");
- MSG_Add("SHELL_CMD_VER_VER",
- "DOSBox Staging version %s. Reported DOS version %d.%02d.\n");
+ MSG_Add("SHELL_CMD_VER_VER", "DOSBox Staging version %s\n"
+ "DOS version %d.%02d\n");
MSG_Add("SHELL_CMD_VER_INVALID", "The specified DOS version is not correct.\n");
/* Regular startup */
diff --git a/src/shell/shell_cmds.cpp b/src/shell/shell_cmds.cpp
index 8e7b086aa..c5b917076 100644
--- a/src/shell/shell_cmds.cpp
+++ b/src/shell/shell_cmds.cpp
@@ -1608,7 +1608,8 @@ void DOS_Shell::CMD_VER(char *args)
dos.version.minor = new_version.minor;
} else
WriteOut(MSG_Get("SHELL_CMD_VER_INVALID"));
- } else
- WriteOut(MSG_Get("SHELL_CMD_VER_VER"), VERSION,
+ } else {
+ WriteOut(MSG_Get("SHELL_CMD_VER_VER"), DOSBOX_GetDetailedVersion(),
dos.version.major, dos.version.minor);
+ }
}
diff --git a/src/version.cpp.in b/src/version.cpp.in
new file mode 100644
index 000000000..6128fa2ed
--- /dev/null
+++ b/src/version.cpp.in
@@ -0,0 +1,31 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ * Copyright (C) 2021-2021 The DOSBox Staging Team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 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, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "dosbox.h"
+
+const char *DOSBOX_GetDetailedVersion() noexcept
+{
+ static const char version[] = "@VCS_TAG@";
+ // Git tag names start with a letter v (by convention).
+ if (version[0] == 'v')
+ return version + 1;
+ else
+ return version;
+}
diff --git a/vs/dosbox.vcxproj b/vs/dosbox.vcxproj
index be4ffd67c..6ff2a1e2a 100644
--- a/vs/dosbox.vcxproj
+++ b/vs/dosbox.vcxproj
@@ -371,6 +371,7 @@
<ClCompile Include="..\src\shell\shell_batch.cpp" />
<ClCompile Include="..\src\shell\shell_cmds.cpp" />
<ClCompile Include="..\src\shell\shell_misc.cpp" />
+ <ClCompile Include="..\src\platform\visualc\version.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\src\winres.rc" />