src/CMakeFiles/*
src/Makefile
src/cmake_config.h
+src/cmake_config_githash.h
src/cmake_install.cmake
src/script/CMakeFiles/*
src/script/common/CMakeFiles/*
set(VERSION_PATCH 7)
if(VERSION_EXTRA)
set(VERSION_PATCH ${VERSION_PATCH}-${VERSION_EXTRA})
+else()
+ # Comment the following line during release
+ set(VERSION_PATCH ${VERSION_PATCH}-dev)
endif()
set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
--- /dev/null
+# Always run during 'make'
+
+if(VERSION_EXTRA)
+ set(VERSION_GITHASH "${VERSION_STRING}")
+else(VERSION_EXTRA)
+ execute_process(COMMAND git describe --always --tag --dirty
+ WORKING_DIRECTORY "${GENERATE_VERSION_SOURCE_DIR}"
+ OUTPUT_VARIABLE VERSION_GITHASH OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_QUIET)
+
+ if(VERSION_GITHASH)
+ message(STATUS "*** Detected git version ${VERSION_GITHASH} ***")
+ else()
+ set(VERSION_GITHASH "${VERSION_STRING}")
+ endif()
+endif()
+
+configure_file(
+ ${GENERATE_VERSION_SOURCE_DIR}/cmake_config_githash.h.in
+ ${GENERATE_VERSION_BINARY_DIR}/cmake_config_githash.h)
"${PROJECT_BINARY_DIR}/cmake_config.h"
)
+# Add a target that always rebuilds cmake_config_githash.h
+add_custom_target(GenerateVersion
+ COMMAND ${CMAKE_COMMAND}
+ -D "GENERATE_VERSION_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}"
+ -D "GENERATE_VERSION_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}"
+ -D "VERSION_STRING=${VERSION_STRING}"
+ -P "${CMAKE_SOURCE_DIR}/cmake/Modules/GenerateVersion.cmake"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
+
add_subdirectory(jthread)
add_subdirectory(script)
add_subdirectory(util)
set(common_SRCS
+ version.cpp
rollback_interface.cpp
rollback.cpp
genericobject.cpp
if(BUILD_CLIENT)
add_executable(${PROJECT_NAME} ${minetest_SRCS})
+ add_dependencies(${PROJECT_NAME} GenerateVersion)
target_link_libraries(
${PROJECT_NAME}
${ZLIB_LIBRARIES}
if(BUILD_SERVER)
add_executable(${PROJECT_NAME}server ${minetestserver_SRCS})
+ add_dependencies(${PROJECT_NAME}server GenerateVersion)
target_link_libraries(
${PROJECT_NAME}server
${ZLIB_LIBRARIES}
#else
#define CMAKE_BUILD_TYPE "Debug"
#endif
-#define CMAKE_BUILD_INFO "VER=@VERSION_STRING@ BUILD_TYPE="CMAKE_BUILD_TYPE" RUN_IN_PLACE=@RUN_IN_PLACE@ USE_GETTEXT=@USE_GETTEXT@ USE_SOUND=@USE_SOUND@ USE_CURL=@USE_CURL@ USE_FREETYPE=@USE_FREETYPE@ USE_LUAJIT=@USE_LUAJIT@ STATIC_SHAREDIR=@SHAREDIR@"
+#define CMAKE_BUILD_INFO "BUILD_TYPE="CMAKE_BUILD_TYPE" RUN_IN_PLACE=@RUN_IN_PLACE@ USE_GETTEXT=@USE_GETTEXT@ USE_SOUND=@USE_SOUND@ USE_CURL=@USE_CURL@ USE_FREETYPE=@USE_FREETYPE@ USE_LUAJIT=@USE_LUAJIT@ STATIC_SHAREDIR=@SHAREDIR@"
#endif
--- /dev/null
+// Filled in by the build system
+// Separated from cmake_config.h to avoid excessive rebuilds on every commit
+
+#ifndef CMAKE_CONFIG_GITHASH_H
+#define CMAKE_CONFIG_GITHASH_H
+
+#define CMAKE_VERSION_GITHASH "@VERSION_GITHASH@"
+
+#endif
+
#define CONFIG_H
#define PROJECT_NAME "Minetest"
-#define VERSION_STRING "unknown"
#define RUN_IN_PLACE 0
#define USE_GETTEXT 0
#define USE_SOUND 0
#define USE_CURL 0
#define USE_FREETYPE 0
#define STATIC_SHAREDIR ""
-#define BUILD_INFO "non-cmake"
#define USE_LEVELDB 0
#ifdef USE_CMAKE_CONFIG_H
#include "cmake_config.h"
#undef PROJECT_NAME
#define PROJECT_NAME CMAKE_PROJECT_NAME
- #undef VERSION_STRING
- #define VERSION_STRING CMAKE_VERSION_STRING
#undef RUN_IN_PLACE
#define RUN_IN_PLACE CMAKE_RUN_IN_PLACE
#undef USE_GETTEXT
#define USE_FREETYPE CMAKE_USE_FREETYPE
#undef STATIC_SHAREDIR
#define STATIC_SHAREDIR CMAKE_STATIC_SHAREDIR
- #undef BUILD_INFO
- #define BUILD_INFO CMAKE_BUILD_INFO
#undef USE_LEVELDB
#define USE_LEVELDB CMAKE_USE_LEVELDB
#endif
#include "tool.h"
#include "guiChatConsole.h"
#include "config.h"
+#include "version.h"
#include "clouds.h"
#include "particles.h"
#include "camera.h"
//TimeTaker guiupdatetimer("Gui updating");
- const char program_name_and_version[] =
- "Minetest " VERSION_STRING;
-
if(show_debug)
{
static float drawtime_avg = 0;
std::ostringstream os(std::ios_base::binary);
os<<std::fixed
- <<program_name_and_version
+ <<"Minetest "<<minetest_version_hash
<<" (R: range_all="<<draw_control.range_all<<")"
<<std::setprecision(0)
<<" drawtime = "<<drawtime_avg
}
else if(show_hud || show_chat)
{
- guitext->setText(narrow_to_wide(program_name_and_version).c_str());
+ std::ostringstream os(std::ios_base::binary);
+ os<<"Minetest "<<minetest_version_hash;
+ guitext->setText(narrow_to_wide(os.str()).c_str());
guitext->setVisible(true);
}
else
#include "scripting_mainmenu.h"
#include "config.h"
+#include "version.h"
#include "porting.h"
#include "filesys.h"
#include "main.h"
//create topleft header
core::rect<s32> rect(0, 0, 500, 40);
rect += v2s32(4, 0);
- std::string t = "Minetest " VERSION_STRING;
+ std::string t = std::string("Minetest ") + minetest_version_hash;
m_irr_toplefttext =
m_device->getGUIEnvironment()->addStaticText(narrow_to_wide(t).c_str(),
/******************************************************************************/
void GUIEngine::setTopleftText(std::string append) {
- std::string toset = "Minetest " VERSION_STRING;
+ std::string toset = std::string("Minetest ") + minetest_version_hash;
if (append != "") {
toset += " / ";
#include "serialization.h"
#include "porting.h"
#include "config.h"
+#include "version.h"
#include "main.h"
#include <IGUICheckBox.h>
#include <IGUIEditBox.h>
std::ostringstream os;
os<<"Minetest\n";
- os<<BUILD_INFO<<"\n";
+ os<<minetest_build_info<<"\n";
os<<"path_user = "<<wrap_rows(porting::path_user, 20)<<"\n";
Environment->addStaticText(narrow_to_wide(os.str()).c_str(), rect, false, true, this, 259);
#include "guiMessageMenu.h"
#include "filesys.h"
#include "config.h"
+#include "version.h"
#include "guiMainMenu.h"
#include "game.h"
#include "keycode.h"
// Print startup message
infostream<<PROJECT_NAME<<
" "<<_("with")<<" SER_FMT_VER_HIGHEST_READ="<<(int)SER_FMT_VER_HIGHEST_READ
- <<", "<<BUILD_INFO
+ <<", "<<minetest_build_info
<<std::endl;
/*
#include "guiKeyChangeMenu.h"
#include "guiFileSelectMenu.h"
#include "subgame.h"
+#include "version.h"
#include "porting.h"
#include "filesys.h"
#include "convert_json.h"
/******************************************************************************/
int ModApiMainMenu::l_get_version(lua_State *L)
{
- lua_pushstring(L,VERSION_STRING);
+ lua_pushstring(L, minetest_version_simple);
return 1;
}
#include "constants.h"
#include "voxel.h"
#include "config.h"
+#include "version.h"
#include "filesys.h"
#include "mapblock.h"
#include "serverobject.h"
DenyAccess(peer_id, std::wstring(
L"Your client's version is not supported.\n"
L"Server version is ")
- + narrow_to_wide(VERSION_STRING) + L"."
+ + narrow_to_wide(minetest_version_simple) + L"."
);
return;
}
DenyAccess(peer_id, std::wstring(
L"Your client's version is not supported.\n"
L"Server version is ")
- + narrow_to_wide(VERSION_STRING) + L",\n"
+ + narrow_to_wide(minetest_version_simple) + L",\n"
+ L"server's PROTOCOL_VERSION is "
+ narrow_to_wide(itos(SERVER_PROTOCOL_VERSION_MIN))
+ L"..."
DenyAccess(peer_id, std::wstring(
L"Your client's version is not supported.\n"
L"Server version is ")
- + narrow_to_wide(VERSION_STRING) + L",\n"
+ + narrow_to_wide(minetest_version_simple) + L",\n"
+ L"server's PROTOCOL_VERSION (strict) is "
+ narrow_to_wide(itos(LATEST_PROTOCOL_VERSION))
+ L", client's PROTOCOL_VERSION is "
std::wostringstream os(std::ios_base::binary);
os<<L"# Server: ";
// Version
- os<<L"version="<<narrow_to_wide(VERSION_STRING);
+ os<<L"version="<<narrow_to_wide(minetest_version_simple);
// Uptime
os<<L", uptime="<<m_uptime.get();
// Max lag estimate
#include <sstream>
#include <algorithm>
+#include "version.h"
#include "main.h" // for g_settings
#include "settings.h"
#include "serverlist.h"
if (action != "delete") {
server["name"] = g_settings->get("server_name");
server["description"] = g_settings->get("server_description");
- server["version"] = VERSION_STRING;
+ server["version"] = minetest_version_simple;
server["url"] = g_settings->get("server_url");
server["creative"] = g_settings->get("creative_mode");
server["damage"] = g_settings->get("enable_damage");
--- /dev/null
+/*
+Minetest
+Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser 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 "version.h"
+#include "config.h"
+
+#ifdef USE_CMAKE_CONFIG_H
+
+#include "cmake_config_githash.h"
+
+const char *minetest_version_simple = CMAKE_VERSION_STRING;
+const char *minetest_version_hash = CMAKE_VERSION_GITHASH;
+const char *minetest_build_info =
+ "VER=" CMAKE_VERSION_GITHASH " " CMAKE_BUILD_INFO;
+
+#else
+
+const char *minetest_version_simple = "unknown";
+const char *minetest_version_hash = "unknown";
+const char *minetest_build_info = "non-cmake";
+
+#endif
+
--- /dev/null
+/*
+Minetest
+Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser 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.
+*/
+
+#ifndef VERSION_HEADER
+#define VERSION_HEADER
+
+#include "config.h"
+
+extern const char *minetest_version_simple;
+extern const char *minetest_version_hash;
+extern const char *minetest_build_info;
+
+#endif
+