Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ elseif(PROVIDED_VERSION_INFO)
message(STATUS "Variable-provided version info: BRANCH=${GIT_BRANCH}")
else()
execute_process(
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/scripts/query_version_info.py" "--mode=cmake_version_info_tbht"
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/scripts/query_version_info.py" "--mode=cmake_version_info_tbht" "--toplevel=${CMAKE_SOURCE_DIR}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE VERSION_DEFINITIONS
)
Expand All @@ -39,6 +39,9 @@ set(CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/cmake")
set(KUMIR2_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
find_package(Kumir2 REQUIRED)

if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
include_directories("/usr/include/c++/v1")
endif ()
include_directories("${CMAKE_SOURCE_DIR}/include")
include_directories("${CMAKE_SOURCE_DIR}/src")

Expand Down
2 changes: 1 addition & 1 deletion cmake/kumir2/kumir2_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ else()
# The script exists only if build from main sources tree, but not using SDK
if(EXISTS "${CMAKE_SOURCE_DIR}/scripts/query_version_info.py")
execute_process(
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/scripts/query_version_info.py" "--mode=cmake_disabled_modules"
COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/scripts/query_version_info.py" "--mode=cmake_disabled_modules" "--toplevel=${CMAKE_SOURCE_DIR}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE DISABLED_SUBDIRS
)
Expand Down
10 changes: 5 additions & 5 deletions cmake/kumir2/kumir2_linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ endif()

# CLang-specific compatibility options
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
list(APPEND KUMIR2_CXXFLAGS "-stdlib=libstdc++")
list(APPEND KUMIR2_LIBRARY_LINKER_FLAGS "-lstdc++ -lm")
list(APPEND KUMIR2_PLUGIN_LINKER_FLAGS "-lstdc++ -lm")
list(APPEND KUMIR2_LANUCHER_LINKER_FLAGS "-lstdc++ -lm")
list(APPEND KUMIR2_TOOL_LINKER_FLAGS "-lstdc++ -lm")
set(KUMIR2_CXXFLAGS "${KUMIR2_CXXFLAGS} -stdlib=libstdc++")
set(KUMIR2_LIBRARY_LINKER_FLAGS "${KUMIR2_LIBRARY_LINKER_FLAGS} -lstdc++ -lm")
set(KUMIR2_PLUGIN_LINKER_FLAGS "${KUMIR2_PLUGIN_LINKER_FLAGS}-lstdc++ -lm")
set(KUMIR2_LANUCHER_LINKER_FLAGS "${KUMIR2_LANUCHER_LINKER_FLAGS} -lstdc++ -lm")
set(KUMIR2_TOOL_LINKER_FLAGS "${KUMIR2_TOOL_LINKER_FLAGS} -lstdc++ -lm")
endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
45 changes: 27 additions & 18 deletions scripts/query_version_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,34 @@ def _add_path_env(value):
os.environ['PATH'] = new_path


GIT_FOUND = False

for path_variant in GIT_PATH_SEARCH:
candidate = path_variant + os.path.sep + "git"
if "nt" == os.name:
candidate += ".exe"
if os.path.exists(candidate):
_add_path_env(path_variant)
GIT_FOUND = True
break

if not GIT_FOUND:
sys.stderr.write("Git executable not found!\n")
sys.exit(1)

TOP_LEVEL_DIR = os.getcwd()

def get_version_information(top_level_dir):
assert isinstance(top_level_dir, str)
def get_version_information():
assert isinstance(TOP_LEVEL_DIR, str)
result = {
"taggedRelease": False,
"version": None,
"hash": None,
"branch": None,
"date": get_date(top_level_dir)
"date": get_date()
}

if os.path.exists(top_level_dir + os.path.sep + ".git"):
if os.path.exists(TOP_LEVEL_DIR + os.path.sep + ".git"):
try:
version_info = subprocess.check_output(
"git describe --abbrev=0 --tags --exact-match",
Expand Down Expand Up @@ -111,7 +117,7 @@ def get_version_information(top_level_dir):
result["hash"] = hash_tag

else:
dir_name = os.path.basename(top_level_dir)
dir_name = os.path.basename(TOP_LEVEL_DIR)
match = re.match(r"kumir2-(.+)", dir_name)
version_info = match.group(1)
if version_info.startswith("2"):
Expand All @@ -121,16 +127,16 @@ def get_version_information(top_level_dir):
return result


def get_date(top_level_dir):
timestamp = int(get_timestamp(top_level_dir))
def get_date():
timestamp = int(get_timestamp())
localtime = time.localtime(timestamp)
assert isinstance(localtime, time.struct_time)
return "{:04}{:02}{:02}".format(localtime.tm_year, localtime.tm_mon, localtime.tm_mday)


def get_timestamp(top_level_dir):
assert isinstance(top_level_dir, str)
if os.path.exists(top_level_dir + os.path.sep + ".git"):
def get_timestamp():
assert isinstance(TOP_LEVEL_DIR, str)
if os.path.exists(TOP_LEVEL_DIR + os.path.sep + ".git"):
return to_str(subprocess.check_output(
"git --no-pager log -1 --pretty=format:%ct",
shell=True,
Expand All @@ -145,7 +151,7 @@ def is_tag(version):


def find_suitable_list_file_name(version_info):
base = os.getcwd() + os.path.sep + "subdirs-disabled-{}.txt"
base = TOP_LEVEL_DIR + os.path.sep + "subdirs-disabled-{}.txt"
if version_info["taggedRelease"]:
name = base.format(version_info["version"])
else:
Expand All @@ -164,7 +170,7 @@ def find_suitable_list_file_name(version_info):


def disabled_modules():
version_info = get_version_information(os.getcwd())
version_info = get_version_information()
disabled_list_file_name = find_suitable_list_file_name(version_info)
disabled_list = []
if disabled_list_file_name:
Expand All @@ -186,9 +192,9 @@ def cmake_disabled_modules():


def cmake_version_info():
version_name = get_version_information(os.getcwd())
version_name = get_version_information()
assert isinstance(version_name, dict)
timestamp = get_timestamp(os.getcwd())
timestamp = get_timestamp()
output = ""
if version_name["taggedRelease"]:
output += "-DGIT_TAG=\"{}\";".format(version_name["version"])
Expand All @@ -203,9 +209,9 @@ def cmake_version_info():


def cmake_version_info_tbht():
version_name = get_version_information(os.getcwd())
version_name = get_version_information()
assert isinstance(version_name, dict)
timestamp = get_timestamp(os.getcwd())
timestamp = get_timestamp()
output_values = []
if version_name["taggedRelease"]:
output_values += to_str(version_name["version"])
Expand All @@ -219,7 +225,7 @@ def cmake_version_info_tbht():


def source_file_name(prefix: str, suffix: str):
version_info = get_version_information(os.getcwd())
version_info = get_version_information()
if version_info["taggedRelease"]:
version_name = version_info["version"]
else:
Expand Down Expand Up @@ -248,7 +254,7 @@ def package_bundle_name():


def nsis_include_file():
version_info = get_version_information(os.getcwd())
version_info = get_version_information()
data = ""
if version_info["taggedRelease"]:
data += "OutFile \"kumir2-" + version_info["version"] + "-install.exe\"\r\n"
Expand Down Expand Up @@ -290,13 +296,16 @@ def get_changelog(max_count=1000, after=(2015, 5, 1)):

def main():
global OUT_FILE
global TOP_LEVEL_DIR
mode = "package_bundle_name"
out_file_name = None
for arg in sys.argv:
if arg.startswith("--mode="):
mode = arg[7:]
elif arg.startswith("--out="):
out_file_name = arg[6:]
elif arg.startswith("--toplevel="):
TOP_LEVEL_DIR = arg[11:]
custom_encoding = False
if out_file_name:
if mode.startswith("nsis"):
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/coregui/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
#endif
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
#include <signal.h>
#if defined(__FreeBSD__)
typedef union sigval sigval_t;
#endif /* __FreeBSD__ */
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdlib.h>
Expand Down
3 changes: 3 additions & 0 deletions src/tools/open/messager_unix.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#include "messager_unix.h"

#include <signal.h>
#if defined(__FreeBSD__)
typedef union sigval sigval_t;
#endif /* __FreeBSD__ */
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
Expand Down