From 53051b7cace8db3ec948349e0538e393e4af6860 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Tue, 4 Jun 2024 14:15:47 +0000 Subject: Very basic python3 support Extremely minimal, not touching any __future__ imports or such. For serious use, see specing's WIP PR at: https://git.themanaworld.org/legacy/tmwa/-/merge_requests/256 --- .gitmodules | 2 +- configure | 2 +- deps/attoconf | 2 +- tools/bs-align | 2 +- tools/colorize | 2 +- tools/config.py | 2 +- tools/debug-debug-scripts | 8 +++++++- tools/indenter | 2 +- tools/pp-indent | 2 +- tools/protocol.py | 2 +- 10 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.gitmodules b/.gitmodules index 8197e60..48c5d1f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "deps/attoconf"] path = deps/attoconf - url = https://github.com/o11c/attoconf.git + url = https://github.com/Freeyorp/attoconf [submodule "deps/googletest"] path = deps/googletest url = https://github.com/google/googletest.git diff --git a/configure b/configure index aa1d0fd..275a9c4 100755 --- a/configure +++ b/configure @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2013 Ben Longbons # diff --git a/deps/attoconf b/deps/attoconf index 7b939e7..f8844ed 160000 --- a/deps/attoconf +++ b/deps/attoconf @@ -1 +1 @@ -Subproject commit 7b939e7e4ce36e8b62b10025e567f871731cbf4d +Subproject commit f8844ed8f37189396a3c6589909a33673ce6bc78 diff --git a/tools/bs-align b/tools/bs-align index 6582298..0caf649 100755 --- a/tools/bs-align +++ b/tools/bs-align @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- encoding: utf-8 ## bs-align.py - Filter to align trailing line continuations ## diff --git a/tools/colorize b/tools/colorize index ce6f410..849fb61 100755 --- a/tools/colorize +++ b/tools/colorize @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function diff --git a/tools/config.py b/tools/config.py index f87fe77..a2645d8 100755 --- a/tools/config.py +++ b/tools/config.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # coding: utf-8 # config.py - generator for config file parsers diff --git a/tools/debug-debug-scripts b/tools/debug-debug-scripts index 2112a6e..cfdc31f 100755 --- a/tools/debug-debug-scripts +++ b/tools/debug-debug-scripts @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # encoding: utf-8 from __future__ import print_function @@ -35,6 +35,12 @@ error = False def eprint(s): print('Error:', s, file=sys.stderr) +# Implement an equivalent to Python 2's execfile for Python 3 +def execfile(filename, globals=None, locals=None): + with open(filename, 'r') as f: + code = compile(f.read(), filename, 'exec') + exec(code, globals, locals) + def get_classes_from_file(a): global error d = {} diff --git a/tools/indenter b/tools/indenter index 0d93543..f7c1657 100755 --- a/tools/indenter +++ b/tools/indenter @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- encoding: utf-8 ## indenter.py - Top-level indenter for all files ## diff --git a/tools/pp-indent b/tools/pp-indent index 9be9a03..622614a 100755 --- a/tools/pp-indent +++ b/tools/pp-indent @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- encoding: utf-8 ## pp-indent - Filter to apply indentation to preprocessor statements ## diff --git a/tools/protocol.py b/tools/protocol.py index cf89a16..d63c22d 100755 --- a/tools/protocol.py +++ b/tools/protocol.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # coding: utf-8 # protocol.py - generator for entire TMWA network protocol -- cgit v1.2.3-70-g09d2 From 779beae0c495dc095808ea4015c5bfda6633e4f1 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Tue, 4 Jun 2024 14:16:16 +0000 Subject: real.make: Use C++11 C++0x was released as C++11 nearly a decade and a half ago. My version of cmake doesn't recognize it in CMAKE_CXX_STANDARD, which makes before/after comparison difficult. --- Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index 10f909c..6fe2de6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -283,9 +283,9 @@ endif # This needs to edit CXX instead of CXXFLAGS in order to make # the %.ii rule work. ifeq (${ENABLE_CYGWIN_HACKS},yes) -override CXX += -std=gnu++0x +override CXX += -std=gnu++11 else -override CXX += -std=c++0x +override CXX += -std=c++11 endif CXXFLAGS += -fstack-protector -- cgit v1.2.3-70-g09d2 From 7c80d10503545cc870c084def44c0ea4a95fd290 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Tue, 4 Jun 2024 14:16:59 +0000 Subject: Rename .make to .mk .mk is more widely understood than .make, for IDE usage. --- COPYING | 2 +- Makefile.in | 14 +++++++------- README.md | 2 +- generate.make | 42 ---------------------------------------- generate.mk | 42 ++++++++++++++++++++++++++++++++++++++++ tools/protocol.py | 2 +- version.make | 58 ------------------------------------------------------- version.mk | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 110 insertions(+), 110 deletions(-) delete mode 100644 generate.make create mode 100644 generate.mk delete mode 100644 version.make create mode 100644 version.mk diff --git a/COPYING b/COPYING index edf98ab..c1c13ff 100644 --- a/COPYING +++ b/COPYING @@ -5,7 +5,7 @@ This combination is explicitly allowed by section 13 of the licenses. See gpl-3.0.txt or agpl-3.0.txt for specific terms. In order to make life easy for users who run this software publicly, -please set VENDOR_SOURCE in version.make if you make any modifications. +please set VENDOR_SOURCE in version.mk if you make any modifications. History: diff --git a/Makefile.in b/Makefile.in index 6fe2de6..75f91f7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -152,7 +152,7 @@ $(info The Road goes ever on and on ...) endif endif -include ${SRC_DIR}/version.make +include ${SRC_DIR}/version.mk ifeq (${ENABLE_SHARED},yes) LIB_SUFFIX_FAKE := so @@ -184,7 +184,7 @@ export PATH:=$(realpath ${SRC_DIR}/tools):${PATH} SHELL=bash # need to generate source files before path lists -$(shell make -f ${SRC_DIR}/generate.make >&2) +$(shell make -f ${SRC_DIR}/generate.mk >&2) stamp/generated.stamp: # if you get here, the shell above failed false @@ -688,15 +688,15 @@ override CPPFLAGS += -I . -I ${SRC_DIR}/include # distribution tarballs # this only works from within a git checkout -dist/%/version.make: +dist/%/version.mk: $(MKDIR_FIRST) - git --git-dir=${SRC_DIR}/.git show HEAD:version.make > $@ + git --git-dir=${SRC_DIR}/.git show HEAD:version.mk > $@ sed 's/^VERSION_FULL := .*/#&\nVERSION_FULL := ${VERSION_FULL}/' -i $@ sed 's/^VERSION_HASH := .*/#&\nVERSION_HASH := ${VERSION_HASH}/' -i $@ -dist/%-src.tar: dist/%/version.make +dist/%-src.tar: dist/%/version.mk git --git-dir=${SRC_DIR}/.git archive --prefix=$*/ -o $@ HEAD - ( mtime="$$(git --git-dir=${SRC_DIR}/.git log -n1 --pretty=%ci)" && cd dist && tar uf $*-src.tar --mtime="$${mtime}" --mode=664 --owner=root --group=root $*/version.make ) - rm dist/$*/version.make + ( mtime="$$(git --git-dir=${SRC_DIR}/.git log -n1 --pretty=%ci)" && cd dist && tar uf $*-src.tar --mtime="$${mtime}" --mode=664 --owner=root --group=root $*/version.mk ) + rm dist/$*/version.mk rmdir dist/$*/ dist/%-attoconf-only.tar: $(MKDIR_FIRST) diff --git a/README.md b/README.md index b2309f5..6de796f 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ attoconf), but for any discussions related to TMW development. ## 1. Distributors. ### Important notes: -- Go read [version.make](version.make) +- Go read [version.mk](version.mk) - TMWA requires git to build by default, use 'make dist' to get a tarball. ### Platform dependencies: diff --git a/generate.make b/generate.make deleted file mode 100644 index c32ca8d..0000000 --- a/generate.make +++ /dev/null @@ -1,42 +0,0 @@ -SHELL=bash - -MKDIR_FIRST = @mkdir -p ${@D} -SRC_DIR := $(patsubst %/,%,$(dir ${MAKEFILE_LIST})) -PIES := $(shell cd ${SRC_DIR}; find src/ -name '*.py') -PIES := $(filter-out src/main-gdb-%.py,${PIES}) - -export PATH:=$(realpath ${SRC_DIR}/tools):${PATH} - -vpath %.cpp ${SRC_DIR} -vpath %.hpp ${SRC_DIR} -vpath %.tcc ${SRC_DIR} -vpath tools/% ${SRC_DIR} -vpath %.py ${SRC_DIR} - -stamp/generated.stamp: - $(MKDIR_FIRST) - touch $@ - -stamp/generated.stamp: stamp/generate-proto2.stamp -stamp/generate-proto2.stamp: tools/protocol.py - $(MKDIR_FIRST) - rm -f stamp/generated.stamp - mkdir -p ${SRC_DIR}/src/proto2 - cd ${SRC_DIR} && protocol.py - touch $@ - -stamp/generated.stamp: stamp/generate-debug-debug.stamp -stamp/generate-debug-debug.stamp: tools/debug-debug-scripts ${PIES} - $(MKDIR_FIRST) - rm -f stamp/generated.stamp - mkdir -p ${SRC_DIR}/src/debug-debug - rm -f ${SRC_DIR}/src/debug-debug/test.cpp - debug-debug-scripts ${SRC_DIR}/src/debug-debug/ $(wordlist 2,$(words $^),$^) - touch $@ - -stamp/generated.stamp: stamp/generate-config.stamp -stamp/generate-config.stamp: tools/config.py - $(MKDIR_FIRST) - rm -f stamp/generated.stamp - cd ${SRC_DIR} && config.py - touch $@ diff --git a/generate.mk b/generate.mk new file mode 100644 index 0000000..c32ca8d --- /dev/null +++ b/generate.mk @@ -0,0 +1,42 @@ +SHELL=bash + +MKDIR_FIRST = @mkdir -p ${@D} +SRC_DIR := $(patsubst %/,%,$(dir ${MAKEFILE_LIST})) +PIES := $(shell cd ${SRC_DIR}; find src/ -name '*.py') +PIES := $(filter-out src/main-gdb-%.py,${PIES}) + +export PATH:=$(realpath ${SRC_DIR}/tools):${PATH} + +vpath %.cpp ${SRC_DIR} +vpath %.hpp ${SRC_DIR} +vpath %.tcc ${SRC_DIR} +vpath tools/% ${SRC_DIR} +vpath %.py ${SRC_DIR} + +stamp/generated.stamp: + $(MKDIR_FIRST) + touch $@ + +stamp/generated.stamp: stamp/generate-proto2.stamp +stamp/generate-proto2.stamp: tools/protocol.py + $(MKDIR_FIRST) + rm -f stamp/generated.stamp + mkdir -p ${SRC_DIR}/src/proto2 + cd ${SRC_DIR} && protocol.py + touch $@ + +stamp/generated.stamp: stamp/generate-debug-debug.stamp +stamp/generate-debug-debug.stamp: tools/debug-debug-scripts ${PIES} + $(MKDIR_FIRST) + rm -f stamp/generated.stamp + mkdir -p ${SRC_DIR}/src/debug-debug + rm -f ${SRC_DIR}/src/debug-debug/test.cpp + debug-debug-scripts ${SRC_DIR}/src/debug-debug/ $(wordlist 2,$(words $^),$^) + touch $@ + +stamp/generated.stamp: stamp/generate-config.stamp +stamp/generate-config.stamp: tools/config.py + $(MKDIR_FIRST) + rm -f stamp/generated.stamp + cd ${SRC_DIR} && config.py + touch $@ diff --git a/tools/protocol.py b/tools/protocol.py index d63c22d..08c82b2 100755 --- a/tools/protocol.py +++ b/tools/protocol.py @@ -7124,7 +7124,7 @@ def make_dots(ctx): #p = partition({k: ids_only(v.post) for (k, v) in d.items()}) if not os.path.exists('doc-gen'): - # generate.make will succeed if missing the wiki repo + # generate.mk will succeed if missing the wiki repo # but 'make doc' will fail return for g in glob.glob('doc-gen/*.gv'): diff --git a/version.make b/version.make deleted file mode 100644 index 73ecc83..0000000 --- a/version.make +++ /dev/null @@ -1,58 +0,0 @@ -ABI_VERSION := 0 - -# These lines are automatically replaced in tarballs generated by 'make dist' -# Note so you stop forgetting: export-subst attribute can't do tag-relative -VERSION_FULL := $(shell git --git-dir=${SRC_DIR}/.git describe --tags HEAD) -VERSION_HASH := $(shell git --git-dir=${SRC_DIR}/.git rev-parse HEAD) - -version_bits := $(subst v, ,$(subst -, ,$(subst ., ,${VERSION_FULL}))) -# Note: these four numbers are limited to 255. -# Currently, my tags are yy.mm.dd instead of semantic versioning. -# The dev number is how many commits since the last tag. -VERSION_MAJOR := $(word 1,${version_bits}) -VERSION_MINOR := $(word 2,${version_bits}) -VERSION_PATCH := $(word 3,${version_bits}) -VERSION_DEVEL := $(word 4,${version_bits}) -ifeq "${VERSION_DEVEL}" "" - VERSION_DEVEL := 0 -endif - - - -# Settings for those distributing modified versions. -# -# It is strongly recommended that all distributors set these, -# but the only *requirement* is that modified versions that are run -# (semi)publicly give VENDOR_SOURCE to satisfy section 13 of the AGPLv3. - -# TODO should these be passed to configure instead? - -# Vendor Name: String (no newlines, no parentheses) -# This is usually one word, and does not (usually) change over time. -# (Examples: Gentoo, Debian, Fedora, Ubuntu) -VENDOR_NAME := Vanilla -# Vendor Point: Integer (max value 65535) -# This is intended to be the "packaging revision number", assuming that's -# an integer. At a minimum, please try to make it nonzero if you have -# any non-upstream patches (unconditionally nonzero is also okay). -# (If your revision 0 package has patches ... please be nicer to upstream) -VENDOR_POINT := 0 -# URL where the source may be found (after searching for version number). -# See AGPLv3 section 13 -VENDOR_SOURCE := https://github.com/themanaworld/tmwa - -# Convenience -VERSION_STRING := TMWA ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH} dev${VERSION_DEVEL} +${VENDOR_POINT} (${VENDOR_NAME}) -VERSION_DOTS := ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_DEVEL}.${VENDOR_POINT} - -# Shared libraries -SO_SHORT := so.${ABI_VERSION} -SO_LONG := ${SO_SHORT}.${VERSION_DOTS} -# and thanks for all the fish - -version: - @echo version '${VERSION_STRING}' - @echo based on commit ${VERSION_FULL} aka ${VERSION_HASH} - @echo source ${VENDOR_SOURCE} - @echo abi version ${ABI_VERSION} - @echo 'lib so -> ${SO_SHORT} -> ${SO_LONG}' diff --git a/version.mk b/version.mk new file mode 100644 index 0000000..73ecc83 --- /dev/null +++ b/version.mk @@ -0,0 +1,58 @@ +ABI_VERSION := 0 + +# These lines are automatically replaced in tarballs generated by 'make dist' +# Note so you stop forgetting: export-subst attribute can't do tag-relative +VERSION_FULL := $(shell git --git-dir=${SRC_DIR}/.git describe --tags HEAD) +VERSION_HASH := $(shell git --git-dir=${SRC_DIR}/.git rev-parse HEAD) + +version_bits := $(subst v, ,$(subst -, ,$(subst ., ,${VERSION_FULL}))) +# Note: these four numbers are limited to 255. +# Currently, my tags are yy.mm.dd instead of semantic versioning. +# The dev number is how many commits since the last tag. +VERSION_MAJOR := $(word 1,${version_bits}) +VERSION_MINOR := $(word 2,${version_bits}) +VERSION_PATCH := $(word 3,${version_bits}) +VERSION_DEVEL := $(word 4,${version_bits}) +ifeq "${VERSION_DEVEL}" "" + VERSION_DEVEL := 0 +endif + + + +# Settings for those distributing modified versions. +# +# It is strongly recommended that all distributors set these, +# but the only *requirement* is that modified versions that are run +# (semi)publicly give VENDOR_SOURCE to satisfy section 13 of the AGPLv3. + +# TODO should these be passed to configure instead? + +# Vendor Name: String (no newlines, no parentheses) +# This is usually one word, and does not (usually) change over time. +# (Examples: Gentoo, Debian, Fedora, Ubuntu) +VENDOR_NAME := Vanilla +# Vendor Point: Integer (max value 65535) +# This is intended to be the "packaging revision number", assuming that's +# an integer. At a minimum, please try to make it nonzero if you have +# any non-upstream patches (unconditionally nonzero is also okay). +# (If your revision 0 package has patches ... please be nicer to upstream) +VENDOR_POINT := 0 +# URL where the source may be found (after searching for version number). +# See AGPLv3 section 13 +VENDOR_SOURCE := https://github.com/themanaworld/tmwa + +# Convenience +VERSION_STRING := TMWA ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH} dev${VERSION_DEVEL} +${VENDOR_POINT} (${VENDOR_NAME}) +VERSION_DOTS := ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_DEVEL}.${VENDOR_POINT} + +# Shared libraries +SO_SHORT := so.${ABI_VERSION} +SO_LONG := ${SO_SHORT}.${VERSION_DOTS} +# and thanks for all the fish + +version: + @echo version '${VERSION_STRING}' + @echo based on commit ${VERSION_FULL} aka ${VERSION_HASH} + @echo source ${VENDOR_SOURCE} + @echo abi version ${ABI_VERSION} + @echo 'lib so -> ${SO_SHORT} -> ${SO_LONG}' -- cgit v1.2.3-70-g09d2 From aa40b22314507a2526e7bf2823d4d4f6b5d51c72 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Tue, 4 Jun 2024 14:23:22 +0000 Subject: WIP: Add CMake based toolchain attoconf is a bespoke build system that has seen little maintenance, and the overwhelming majority of build logic happens inside real.mk, here Makefile.in. While attoconf and real.mk provide a lot of very nice functionality, it doesn't integrate so well with IDEs, and is very intimidating for prospective developers. Providing a full cmake based approach solves both of these problems, and there isn't anything so complicated in tmwa that it needs its own build system. WIP: This represents a messy dump of CMakeLists.txt in the last state I left it. It has been shared to make collaboration easier, but should by no means be considered anything more than exploratory at this point. --- CMakeLists.txt | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..d32a9f8 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,102 @@ +cmake_minimum_required(VERSION 3.10) + +project(tmwAthena) + +# Prefer to use G++ as the compiler +set(CMAKE_CXX_COMPILER g++) +# Set C++ standard to C++11 +# Note we want -std=c++11, not -std=gnu++11, as we want to avoid GNU extensions +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# Search through the tree for sources +# For each subfolder in src, add all .cpp files to a subfolder's SOURCES +# variable. +set(ALL_SOURCES "") +foreach(dir admin ast char compat conf generic high ints io login map mmo net proto-base range sexpr shared strings tests wire strtest) + file(GLOB_RECURSE ${dir}_SOURCES CONFIGURE_DEPENDS src/${dir}/*.cpp) + # Exclude any _test.cpp files from the build + set(ALL_SOURCES ${ALL_SOURCES} ${${dir}_SOURCES}) + list(FILTER ${dir}_SOURCES EXCLUDE REGEX ".*_test.cpp") + message("Adding sources in ${dir}: ${${dir}_SOURCES}") +endforeach() + +# All targets include the include/ directory +include_directories(include) + +# We want -fvisibility=hidden for regular objects, but not shared libraries. +# CMake provides a helpful preset for this. +# FIXME this is currently broken +#set(CMAKE_CXX_VISIBILITY_PRESET hidden) +# General purpose build flags. +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -fstack-protector -fno-strict-aliasing -flto") +# Enable link time optimization, and track function and data sections. We let +# the linker remove unused code. +#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto -ffunction-sections -fdata-sections -Wl,--gc-sections") +# Next, add warnings +#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") +# Add debug information +#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb") + +set_source_files_properties($(ALL_SOURCES) PROPERTIES IMPLICIT_DEPENDS CXX) + + +# Add a shared library: libtmwa-shared.so.0 +# When we add_executable later, we need to link against this library. +add_library(tmwa-shared SHARED ${shared_SOURCES} + src/io/dir.cpp + src/io/fd.cpp + src/io/read.cpp + src/io/write.cpp + ${strings_SOURCES} +) +# SO versioning +set_target_properties(tmwa-shared PROPERTIES VERSION 23.10.22.24.0 SOVERSION 0) + +# We have four binaries we want to build: tmwa-{login,char,map,admin} +#add_executable(tmwa-login src/login/main.cpp) +#target_link_libraries(tmwa-login tmwa-shared) +#add_executable(tmwa-char src/char/main.cpp) +#target_link_libraries(tmwa-char tmwa-shared) +add_executable(tmwa-map ${map_SOURCES} + ${generic_SOURCES} + ${high_SOURCES} + ${io_SOURCES} + ${mmo_SOURCES} + ${net_SOURCES} + ${wire_SOURCES} + ) +target_link_libraries(tmwa-map tmwa-shared) +add_executable(tmwa-admin ${admin_SOURCES} + ${generic_SOURCES} + ${high_SOURCES} + ${io_SOURCES} + ${mmo_SOURCES} + ${net_SOURCES} + ${wire_SOURCES} +) +target_link_libraries(tmwa-admin tmwa-shared) + +add_executable(tmwa-test ${strtest_SOURCES}) +target_link_libraries(tmwa-test tmwa-shared) + +# Some sources and includes are generated, such as the protocol headers. +# We defer to generate.make for these rules. +# Note that these are raw Makefile rules, not CMake rules, so a simple +# add_custom_command() won't work. +add_custom_target(generate + COMMAND make -f ${CMAKE_SOURCE_DIR}/generate.mk + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMENT "Generating sources and includes" +) + +# Call make -f ${CMAKE_SOURCE_DIR}/generate.mk clean to clean up the generated +# files. We want this to be run every time we call make clean. + + +# The generate target must be run before building the binaries +#add_dependencies(tmwa-login generate) +#add_dependencies(tmwa-char generate) +add_dependencies(tmwa-map generate) +add_dependencies(tmwa-admin generate) -- cgit v1.2.3-70-g09d2 From 89a0a0ee96932a4949c756d50a149a1daa55e2da Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Wed, 5 Jun 2024 09:31:19 +0200 Subject: Fixed tmwa-map linker errors and made tmwa-login and tmwa-char compile --- CMakeLists.txt | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d32a9f8..41c77bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,11 +55,29 @@ add_library(tmwa-shared SHARED ${shared_SOURCES} set_target_properties(tmwa-shared PROPERTIES VERSION 23.10.22.24.0 SOVERSION 0) # We have four binaries we want to build: tmwa-{login,char,map,admin} -#add_executable(tmwa-login src/login/main.cpp) -#target_link_libraries(tmwa-login tmwa-shared) -#add_executable(tmwa-char src/char/main.cpp) -#target_link_libraries(tmwa-char tmwa-shared) +add_executable(tmwa-login ${login_SOURCES} + ${generic_SOURCES} + ${high_SOURCES} + ${io_SOURCES} + ${mmo_SOURCES} + ${net_SOURCES} + ${wire_SOURCES} +) +target_link_libraries(tmwa-login tmwa-shared) + +add_executable(tmwa-char ${char_SOURCES} + ${generic_SOURCES} + ${high_SOURCES} + ${io_SOURCES} + ${mmo_SOURCES} + ${net_SOURCES} + ${wire_SOURCES} +) +target_link_libraries(tmwa-char tmwa-shared) + add_executable(tmwa-map ${map_SOURCES} + ${ast_SOURCES} + ${compat_SOURCES} ${generic_SOURCES} ${high_SOURCES} ${io_SOURCES} @@ -68,6 +86,7 @@ add_executable(tmwa-map ${map_SOURCES} ${wire_SOURCES} ) target_link_libraries(tmwa-map tmwa-shared) + add_executable(tmwa-admin ${admin_SOURCES} ${generic_SOURCES} ${high_SOURCES} @@ -78,8 +97,8 @@ add_executable(tmwa-admin ${admin_SOURCES} ) target_link_libraries(tmwa-admin tmwa-shared) -add_executable(tmwa-test ${strtest_SOURCES}) -target_link_libraries(tmwa-test tmwa-shared) +#add_executable(tmwa-test ${strtest_SOURCES}) +#target_link_libraries(tmwa-test tmwa-shared) # Some sources and includes are generated, such as the protocol headers. # We defer to generate.make for these rules. -- cgit v1.2.3-70-g09d2 From 0f838aa20384425198b832df3317667201808765 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Wed, 5 Jun 2024 09:38:14 +0200 Subject: Forgot to add 'generate' as dependency to login/char binary now --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 41c77bd..564fffe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,7 +115,7 @@ add_custom_target(generate # The generate target must be run before building the binaries -#add_dependencies(tmwa-login generate) -#add_dependencies(tmwa-char generate) +add_dependencies(tmwa-login generate) +add_dependencies(tmwa-char generate) add_dependencies(tmwa-map generate) add_dependencies(tmwa-admin generate) -- cgit v1.2.3-70-g09d2 From 3169331e84d4cc13192403a7f218899b5e98cfba Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Wed, 5 Jun 2024 10:54:31 +0200 Subject: CMake: Generate the install.hpp and version.hpp files The values of defines in these files should be the same as those set from version.mk / Makefile.in. --- CMakeLists.txt | 57 +++++++++++++++++++++++++++++++++++++++++++++---- src/conf/install.hpp.in | 29 +++++++++++++++++++++++++ src/conf/version.hpp.in | 39 +++++++++++++++++++++++++++++++++ 3 files changed, 121 insertions(+), 4 deletions(-) create mode 100644 src/conf/install.hpp.in create mode 100644 src/conf/version.hpp.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 564fffe..9f4effc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,31 @@ cmake_minimum_required(VERSION 3.10) -project(tmwAthena) +# Function for conveniently capturing git output, used to set version related variables +find_package(Git REQUIRED) +function(git_capture_output var) + execute_process(COMMAND ${GIT_EXECUTABLE} ${ARGN} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE ${var} + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET) + message(STATUS "${var} = ${${var}}") + set(${var} ${${var}} PARENT_SCOPE) +endfunction() + +git_capture_output(VERSION_FULL describe --tags) +git_capture_output(VERSION_HASH rev-parse HEAD) + +# Capture the major.minor.patch part of the version based on the last tag +string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION ${VERSION_FULL}) + +# Capture the tweak part of the version +if(${VERSION_FULL} MATCHES "^v[0-9]+\\.[0-9]+\\.[0-9]+-([0-9]+)-g[0-9a-f]+$") + set(VERSION "${VERSION}.${CMAKE_MATCH_1}") +else() + set(VERSION "${VERSION}.0") +endif() + +project(tmwAthena VERSION ${VERSION} LANGUAGES CXX) # Prefer to use G++ as the compiler set(CMAKE_CXX_COMPILER g++) @@ -39,8 +64,32 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -fstack-protector -fno-strict-aliasi # Add debug information #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb") -set_source_files_properties($(ALL_SOURCES) PROPERTIES IMPLICIT_DEPENDS CXX) - +# Vendor Name: String (no newlines, no parentheses) +# This is usually one word, and does not (usually) change over time. +# (Examples: Gentoo, Debian, Fedora, Ubuntu) +set(VENDOR_NAME Vanilla) +# Vendor Point: Integer (max value 65535) +# This is intended to be the "packaging revision number", assuming that's +# an integer. At a minimum, please try to make it nonzero if you have +# any non-upstream patches (unconditionally nonzero is also okay). +# (If your revision 0 package has patches ... please be nicer to upstream) +set(VENDOR_POINT 0) +# URL where the source may be found (after searching for version number). +# See AGPLv3 section 13 +set(VENDOR_SOURCE https://github.com/themanaworld/tmwa) + +# Convenience +set(VERSION_STRING "TMWA ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} dev${PROJECT_VERSION_TWEAK} +${VENDOR_POINT} (${VENDOR_NAME})") +set(VERSION_DOTS "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.${PROJECT_VERSION_TWEAK}.${VENDOR_POINT}") + +include(GNUInstallDirs) +set(PACKAGEDATADIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/tmwa") +set(PACKAGELOCALSTATEDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/tmwa") +set(PACKAGESYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}/tmwa") + +configure_file(src/conf/install.hpp.in src/conf/install.hpp @ONLY) +configure_file(src/conf/version.hpp.in src/conf/version.hpp @ONLY) +set(conf_SOURCES ${conf_SOURCES} src/conf/install.hpp src/conf/version.hpp) # Add a shared library: libtmwa-shared.so.0 # When we add_executable later, we need to link against this library. @@ -52,7 +101,7 @@ add_library(tmwa-shared SHARED ${shared_SOURCES} ${strings_SOURCES} ) # SO versioning -set_target_properties(tmwa-shared PROPERTIES VERSION 23.10.22.24.0 SOVERSION 0) +set_target_properties(tmwa-shared PROPERTIES VERSION ${PROJECT_VERSION}.0 SOVERSION 0) # We have four binaries we want to build: tmwa-{login,char,map,admin} add_executable(tmwa-login ${login_SOURCES} diff --git a/src/conf/install.hpp.in b/src/conf/install.hpp.in new file mode 100644 index 0000000..c44f026 --- /dev/null +++ b/src/conf/install.hpp.in @@ -0,0 +1,29 @@ +#pragma once +// conf/install.hpp - Import configuration variables related to install. +// +// Copyright © 2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 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 . + +// just mention "fwd.hpp" to make formatter happy + +#define PACKAGESYSCONFDIR "@PACKAGESYSCONFDIR@"_s +#define PACKAGELOCALSTATEDIR "@PACKAGELOCALSTATEDIR@"_s +#define PACKAGEDATADIR "@PACKAGEDATADIR@"_s + +namespace tmwa +{ +} // namespace tmwa diff --git a/src/conf/version.hpp.in b/src/conf/version.hpp.in new file mode 100644 index 0000000..126fae2 --- /dev/null +++ b/src/conf/version.hpp.in @@ -0,0 +1,39 @@ +#pragma once +// conf/version.hpp - Import configuration variables related to version. +// +// Copyright © 2013-2014 Ben Longbons +// +// This file is part of The Mana World (Athena server) +// +// 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 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 . + +// just mention "fwd.hpp" to make formatter happy + +#define VERSION_FULL "@VERSION_FULL@"_s +#define VERSION_HASH "@VERSION_HASH@"_s + +#define VERSION_MAJOR @PROJECT_VERSION_MAJOR@ +#define VERSION_MINOR @PROJECT_VERSION_MINOR@ +#define VERSION_PATCH @PROJECT_VERSION_PATCH@ +#define VERSION_DEVEL @PROJECT_VERSION_TWEAK@ + +#define VENDOR_NAME "@VENDOR_NAME@"_s +#define VENDOR_POINT @VENDOR_POINT@ +#define VENDOR_SOURCE "@VENDOR_SOURCE@"_s + +#define VERSION_STRING "@VERSION_STRING@"_s + +namespace tmwa +{ +} // namespace tmwa -- cgit v1.2.3-70-g09d2 From 92c41206656d37e8686e30524c3cd376a7e1a216 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Wed, 5 Jun 2024 11:09:03 +0200 Subject: CMake: Simplified VERSION_DOTS and match version.mk SO version --- CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f4effc..51e3b6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,7 +80,7 @@ set(VENDOR_SOURCE https://github.com/themanaworld/tmwa) # Convenience set(VERSION_STRING "TMWA ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} dev${PROJECT_VERSION_TWEAK} +${VENDOR_POINT} (${VENDOR_NAME})") -set(VERSION_DOTS "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.${PROJECT_VERSION_TWEAK}.${VENDOR_POINT}") +set(VERSION_DOTS "${PROJECT_VERSION}.${VENDOR_POINT}") include(GNUInstallDirs) set(PACKAGEDATADIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/tmwa") @@ -101,7 +101,10 @@ add_library(tmwa-shared SHARED ${shared_SOURCES} ${strings_SOURCES} ) # SO versioning -set_target_properties(tmwa-shared PROPERTIES VERSION ${PROJECT_VERSION}.0 SOVERSION 0) +set(ABI_VERSION 0) +set_target_properties(tmwa-shared PROPERTIES + VERSION ${ABI_VERSION}.${VERSION_DOTS} + SOVERSION ${ABI_VERSION}) # We have four binaries we want to build: tmwa-{login,char,map,admin} add_executable(tmwa-login ${login_SOURCES} -- cgit v1.2.3-70-g09d2 From a5547c7d62a41b784d88e5eabe9355921384b03a Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Wed, 5 Jun 2024 11:46:54 +0200 Subject: CMake: Make the build work the first time Use execute_process instead of add_custom_target to make sure the generated files are found on the first configure run. Set CMAKE_CONFIGURE_DEPENDS so that touching the script generating files will automatically trigger a re-configre, which will re-run the make process. --- CMakeLists.txt | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 51e3b6e..11c58d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,20 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD_REQUIRED ON) +# Some sources and includes are generated, such as the protocol headers. +# We defer to generate.make for these rules. +# Note that these are raw Makefile rules, not CMake rules, so a simple +# add_custom_command() won't work. +execute_process(COMMAND make -f ${CMAKE_SOURCE_DIR}/generate.mk + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + +# The generate target must be re-run when the scripts change +set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS + "${PROJECT_SOURCE_DIR}/generate.mk" + "${PROJECT_SOURCE_DIR}/tools/config.py" + "${PROJECT_SOURCE_DIR}/tools/protocol.py" +) + # Search through the tree for sources # For each subfolder in src, add all .cpp files to a subfolder's SOURCES # variable. @@ -152,22 +166,5 @@ target_link_libraries(tmwa-admin tmwa-shared) #add_executable(tmwa-test ${strtest_SOURCES}) #target_link_libraries(tmwa-test tmwa-shared) -# Some sources and includes are generated, such as the protocol headers. -# We defer to generate.make for these rules. -# Note that these are raw Makefile rules, not CMake rules, so a simple -# add_custom_command() won't work. -add_custom_target(generate - COMMAND make -f ${CMAKE_SOURCE_DIR}/generate.mk - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMENT "Generating sources and includes" -) - # Call make -f ${CMAKE_SOURCE_DIR}/generate.mk clean to clean up the generated # files. We want this to be run every time we call make clean. - - -# The generate target must be run before building the binaries -add_dependencies(tmwa-login generate) -add_dependencies(tmwa-char generate) -add_dependencies(tmwa-map generate) -add_dependencies(tmwa-admin generate) -- cgit v1.2.3-70-g09d2 From 69a603e87496dcc05cf93d1359686c23a0c43e28 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 10:59:41 +0000 Subject: cmake: Fix out of tree build Also remove {install,version}.hpp from source control, so they're actually generated. There may be a better way to handle this, but I'll just leave a note as a TODO for now. --- CMakeLists.txt | 8 ++++++-- src/conf/install.hpp | 30 ------------------------------ src/conf/version.hpp | 40 ---------------------------------------- 3 files changed, 6 insertions(+), 72 deletions(-) delete mode 100644 src/conf/install.hpp delete mode 100644 src/conf/version.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 11c58d0..a0587b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,8 +101,12 @@ set(PACKAGEDATADIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/tmwa") set(PACKAGELOCALSTATEDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/tmwa") set(PACKAGESYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}/tmwa") -configure_file(src/conf/install.hpp.in src/conf/install.hpp @ONLY) -configure_file(src/conf/version.hpp.in src/conf/version.hpp @ONLY) +# Generate the install.hpp and version.hpp files in the source directory. +# TODO: Is there a nicer way to handle this so we're still able to make fully +# out-of-tree builds, generating the files in the build directory, but still +# having them found by includes? +configure_file(src/conf/install.hpp.in ${CMAKE_SOURCE_DIR}/src/conf/install.hpp @ONLY) +configure_file(src/conf/version.hpp.in ${CMAKE_SOURCE_DIR}/src/conf/version.hpp @ONLY) set(conf_SOURCES ${conf_SOURCES} src/conf/install.hpp src/conf/version.hpp) # Add a shared library: libtmwa-shared.so.0 diff --git a/src/conf/install.hpp b/src/conf/install.hpp deleted file mode 100644 index 42fd125..0000000 --- a/src/conf/install.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once -// conf/install.hpp - Import configuration variables related to install. -// -// Copyright © 2014 Ben Longbons -// -// This file is part of The Mana World (Athena server) -// -// 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 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 . - -// just mention "fwd.hpp" to make formatter happy - -#include "conf-raw/str-PACKAGESYSCONFDIR.h" -#include "conf-raw/str-PACKAGELOCALSTATEDIR.h" -#include "conf-raw/str-PACKAGEDATADIR.h" - - -namespace tmwa -{ -} // namespace tmwa diff --git a/src/conf/version.hpp b/src/conf/version.hpp deleted file mode 100644 index df8a8b6..0000000 --- a/src/conf/version.hpp +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once -// conf/version.hpp - Import configuration variables related to version. -// -// Copyright © 2013-2014 Ben Longbons -// -// This file is part of The Mana World (Athena server) -// -// 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 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 . - -// just mention "fwd.hpp" to make formatter happy - -#include "conf-raw/str-VERSION_FULL.h" -#include "conf-raw/str-VERSION_HASH.h" - -#include "conf-raw/int-VERSION_MAJOR.h" -#include "conf-raw/int-VERSION_MINOR.h" -#include "conf-raw/int-VERSION_PATCH.h" -#include "conf-raw/int-VERSION_DEVEL.h" - -#include "conf-raw/str-VENDOR_NAME.h" -#include "conf-raw/int-VENDOR_POINT.h" -#include "conf-raw/str-VENDOR_SOURCE.h" - -#include "conf-raw/str-VERSION_STRING.h" - - -namespace tmwa -{ -} // namespace tmwa -- cgit v1.2.3-70-g09d2 From 0bba87a4851ac1e0aae059802bf6d739f8123bd9 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 13:18:42 +0000 Subject: VENDOR_SOURCE: github.com -> git.themanaworld.org --- CMakeLists.txt | 2 +- version.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a0587b3..dd99bf2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,7 +90,7 @@ set(VENDOR_NAME Vanilla) set(VENDOR_POINT 0) # URL where the source may be found (after searching for version number). # See AGPLv3 section 13 -set(VENDOR_SOURCE https://github.com/themanaworld/tmwa) +set(VENDOR_SOURCE https://git.themanaworld.org/legacy/tmwa) # Convenience set(VERSION_STRING "TMWA ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} dev${PROJECT_VERSION_TWEAK} +${VENDOR_POINT} (${VENDOR_NAME})") diff --git a/version.mk b/version.mk index 73ecc83..a5137ad 100644 --- a/version.mk +++ b/version.mk @@ -39,7 +39,7 @@ VENDOR_NAME := Vanilla VENDOR_POINT := 0 # URL where the source may be found (after searching for version number). # See AGPLv3 section 13 -VENDOR_SOURCE := https://github.com/themanaworld/tmwa +VENDOR_SOURCE := https://git.themanaworld.org/legacy/tmwa # Convenience VERSION_STRING := TMWA ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH} dev${VERSION_DEVEL} +${VENDOR_POINT} (${VENDOR_NAME}) -- cgit v1.2.3-70-g09d2 From 2ff7077ab900cca73e6dc3a256a67caff5d447f8 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 13:27:51 +0000 Subject: Generate {install,version}.hpp through attoconf Or more specifically, in the attoconf buildchain. attoconf itself directly generates src/conf/install.hpp alongside Makefile, but version inforation is only available later. To generate version.hpp, I extended version.mk slightly to provide the recipe. It's not anywhere near as generic as real.make tends to be, but with any luck we'll soon be doing all builds through cmake going forward. The template for install.hpp has been changed to use variables actually provided by attoconf. PACKAGE{SYSCONF,LOCALSTATE}DIR are actually only defined in real.make, and then only in terms of SYSCONFDIR and LOCALSTATEDIR, adding `/tmwa`. It's simpler to just use the attoconf variable and adjust the template, which conveniently also simplifies the construction in CMakeLists.txt, too. --- CMakeLists.txt | 4 ++-- Makefile.in | 1 + configure | 4 +++- src/conf/install.hpp.in | 4 ++-- version.mk | 23 +++++++++++++++++++++++ 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd99bf2..5981636 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,8 +98,8 @@ set(VERSION_DOTS "${PROJECT_VERSION}.${VENDOR_POINT}") include(GNUInstallDirs) set(PACKAGEDATADIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/tmwa") -set(PACKAGELOCALSTATEDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/tmwa") -set(PACKAGESYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}/tmwa") +set(LOCALSTATEDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}") +set(SYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}") # Generate the install.hpp and version.hpp files in the source directory. # TODO: Is there a nicer way to handle this so we're still able to make fully diff --git a/Makefile.in b/Makefile.in index 75f91f7..df8a2df 100644 --- a/Makefile.in +++ b/Makefile.in @@ -386,6 +386,7 @@ vpath include/%.hpp ${SRC_DIR} vpath src/%.tcc ${SRC_DIR} vpath tools/% ${SRC_DIR} vpath src/%.py ${SRC_DIR} +vpath src/%.in ${SRC_DIR} .DELETE_ON_ERROR: .DEFAULT_GOAL := all diff --git a/configure b/configure index 275a9c4..7a7a9ef 100755 --- a/configure +++ b/configure @@ -112,7 +112,9 @@ def main(): srcdir = os.path.dirname(sys.argv[0]) proj = Configuration( srcdir=srcdir, - template_files=['Makefile'], + # Note that src/conf/version.hpp is made later, by Makefile. + # See version.mk (included by Makefile). + template_files=['Makefile', 'src/conf/install.hpp'], ) proj.set_package('tmwa', 'The Mana World (Athena server)'); proj.jiggle() diff --git a/src/conf/install.hpp.in b/src/conf/install.hpp.in index c44f026..e63164a 100644 --- a/src/conf/install.hpp.in +++ b/src/conf/install.hpp.in @@ -20,8 +20,8 @@ // just mention "fwd.hpp" to make formatter happy -#define PACKAGESYSCONFDIR "@PACKAGESYSCONFDIR@"_s -#define PACKAGELOCALSTATEDIR "@PACKAGELOCALSTATEDIR@"_s +#define PACKAGESYSCONFDIR "@SYSCONFDIR@/tmwa"_s +#define PACKAGELOCALSTATEDIR "@LOCALSTATEDIR@/tmwa"_s #define PACKAGEDATADIR "@PACKAGEDATADIR@"_s namespace tmwa diff --git a/version.mk b/version.mk index a5137ad..39cf181 100644 --- a/version.mk +++ b/version.mk @@ -50,6 +50,29 @@ SO_SHORT := so.${ABI_VERSION} SO_LONG := ${SO_SHORT}.${VERSION_DOTS} # and thanks for all the fish +# Fully generate version.hpp here, where we have all the relevant information. +# version.mk is included by the top level Makefile, so simply explaning how to +# make it here will let it be built later, when needed. +# Note that some variable substitutions are slightly different here to use the +# name used by standard CMake macros, such as PROJECT_VERSION_TWEAK instead of +# VERSION_DEVEL. +src/conf/version.hpp: src/conf/version.hpp.in + sed -e 's/@VERSION_FULL@/${VERSION_FULL}/g' \ + -e 's/@VERSION_HASH@/${VERSION_HASH}/g' \ + -e 's/@VERSION_STRING@/${VERSION_STRING}/g' \ + -e 's/@PROJECT_VERSION_MAJOR@/${VERSION_MAJOR}/g' \ + -e 's/@PROJECT_VERSION_MINOR@/${VERSION_MINOR}/g' \ + -e 's/@PROJECT_VERSION_PATCH@/${VERSION_PATCH}/g' \ + -e 's/@PROJECT_VERSION_TWEAK@/${VERSION_DEVEL}/g' \ + -e 's/@VENDOR_NAME@/${VENDOR_NAME}/g' \ + -e 's/@VENDOR_POINT@/${VENDOR_POINT}/g' \ + -e 's|@VENDOR_SOURCE@|${VENDOR_SOURCE}|g' \ + -e 's/@ABI_VERSION@/${ABI_VERSION}/g' \ + -e 's/@SO_SHORT@/${SO_SHORT}/g' \ + -e 's/@SO_LONG@/${SO_LONG}/g' \ + $< > $@ + + version: @echo version '${VERSION_STRING}' @echo based on commit ${VERSION_FULL} aka ${VERSION_HASH} -- cgit v1.2.3-70-g09d2 From 08d98f6cb2255db6c92f184ecb6efcca079f706a Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 13:30:57 +0000 Subject: version.mk: make version target PHONY --- version.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/version.mk b/version.mk index 39cf181..6d9a7ca 100644 --- a/version.mk +++ b/version.mk @@ -79,3 +79,4 @@ version: @echo source ${VENDOR_SOURCE} @echo abi version ${ABI_VERSION} @echo 'lib so -> ${SO_SHORT} -> ${SO_LONG}' +.PHONY: version -- cgit v1.2.3-70-g09d2 From 9c829dd8290bdf97c55487a8869018b4c7103849 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 13:31:09 +0000 Subject: version.mk: Always generate version.hpp --- Makefile.in | 3 ++- version.mk | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index df8a2df..587382e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -683,7 +683,8 @@ conf-raw/bool-%.h: FORCE conf-raw/str-%.h: FORCE $(MKDIR_FIRST) @echo '#define $* "$(value $*)"_s' | maybe-replace $@ -FORCE: ; + +FORCE:: ; .PHONY: FORCE override CPPFLAGS += -I . -I ${SRC_DIR}/include diff --git a/version.mk b/version.mk index 6d9a7ca..23bd071 100644 --- a/version.mk +++ b/version.mk @@ -50,13 +50,18 @@ SO_SHORT := so.${ABI_VERSION} SO_LONG := ${SO_SHORT}.${VERSION_DOTS} # and thanks for all the fish +# This is a phony target, so that it always runs. +# Targets which depend on this will always have their recipes run. +FORCE:: ; +.PHONY: FORCE + # Fully generate version.hpp here, where we have all the relevant information. # version.mk is included by the top level Makefile, so simply explaning how to # make it here will let it be built later, when needed. # Note that some variable substitutions are slightly different here to use the # name used by standard CMake macros, such as PROJECT_VERSION_TWEAK instead of # VERSION_DEVEL. -src/conf/version.hpp: src/conf/version.hpp.in +src/conf/version.hpp: src/conf/version.hpp.in FORCE sed -e 's/@VERSION_FULL@/${VERSION_FULL}/g' \ -e 's/@VERSION_HASH@/${VERSION_HASH}/g' \ -e 's/@VERSION_STRING@/${VERSION_STRING}/g' \ -- cgit v1.2.3-70-g09d2 From 1c8a041d5c337306373453b4b2b8a0c3e9e30b46 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 13:47:14 +0000 Subject: .gitignore: Add newly generated files --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index d28b05e..fdc00ac 100644 --- a/.gitignore +++ b/.gitignore @@ -9,10 +9,12 @@ /src/proto2/ /src/debug-debug/ /src/*/*_conf.[ch]pp +/src/conf/version.hpp # tags file /tags # generated by configure /Makefile +/src/conf/install.hpp /config.status /lib # generated by python -- cgit v1.2.3-70-g09d2 From 00ffb562340f3f8f75efa48a138f2f1c8cf49202 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 15:50:36 +0000 Subject: Fix up .d generation for generated files --- Makefile.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Makefile.in b/Makefile.in index 587382e..e548065 100644 --- a/Makefile.in +++ b/Makefile.in @@ -438,6 +438,14 @@ obj/%.d: src/%.cpp | stamp/generated.stamp ${CXX} ${CPPFLAGS} -DGENERATING_DEPENDENCIES ${CXXFLAGS} -MG -MM \ -MT '$(patsubst obj/%.d,%,$@) := ' \ -MF $@ $< +# -MG takes the include parameter as-is without prepending the path whenever +# it's not found, and presumed to be a not-yet generated file. +# This is troublesome, since real.make tends not to be in the same directory. +# We work around this by checking to see if a file doesn't exist, and if it +# doesn't, we prepend the path. + for f in $$(sed -e '1s@$(patsubst obj/%.d,%,$@) := \(.*\)@\1@' $@ | tr ' ' \\n | grep -vFx -e : -e \\); do \ + test -f "$${f}" || sed -i "s|\($${f}\)|src/$(dir $*)\1|" $@; \ + done endif # the above SRC_DIR replacement is not really safe, but it works okayish. obj/%.ii: src/%.cpp -- cgit v1.2.3-70-g09d2 From b46a317de18e0b3f2cc7f7e5669fe4273dbe6571 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 15:51:56 +0000 Subject: real.make: Document dependency sanitization step A little indentation and formatting, and quite a lot of commenting, goes a long way. This doesn't change any code, it only reformats it. --- Makefile.in | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index e548065..a63a589 100644 --- a/Makefile.in +++ b/Makefile.in @@ -333,9 +333,40 @@ include ${DEPENDS} endif thisdir := $(abspath .) + #$(foreach root,${PATTERN_ROOTS},$(info pre-root: ${root} := $(value ${root}))$(info )) # can't do $(filter %.hpp yet) -$(foreach root,${PATTERN_ROOTS},$(eval ${root} := $(sort $(patsubst ${thisdir}/%,%,$(abspath $(patsubst ${SRC_DIR}/%,%,$(wildcard $(value ${root})) $(filter conf-raw/%.h,$(value ${root})))))))) + +# Sanitize the dependencies. +# +# ${root} has a value like "mmo/version", and ${mmo/version} in turn has the +# value of all of its dependencies (from the %.d files). +# +# This reassigns the *value of the value* of ${root} to be: +# - sorted +# - relative and simplified: it's stripped of any absolute path relative to +# the current directory after being converted to an absolute path. +# This simplifies any construct such as: +# src/mmo/../strings/zstring.tcc +# to: +# src/strings/zstring.tcc +# - only files which either exist (the purpose of the wildcard function), +# or are in the conf-raw directory (the purpose of the filter function). +# This means that if there are any build-time generated files added, this +# needs to be modified to not filter them out. +# +# The end result for each root will look something like: +# mmo/version := conf-raw/int-VENDOR_POINT.h conf-raw/int-VERSION_DEVEL.h [...] +# src/strings/zstring.tcc src/wire/fwd.hpp +$(foreach root,${PATTERN_ROOTS},$(eval \ + ${root} := $(sort $(patsubst ${thisdir}/%,%, \ + $(abspath $(patsubst ${SRC_DIR}/%,%, \ + $(wildcard $(value ${root})) \ + $(filter conf-raw/%.h,$(value ${root}) \ + ))) \ + )) \ +)) + # have to redo what we undid to get it as a variable $(foreach root,${PATTERN_ROOTS},$(eval obj/${root}.ii obj/${root}.ll obj/${root}.bc obj/${root}.s obj/${root}.pdc.o obj/${root}.pic.o obj/${root}.d : $(value ${root})) ) #$(foreach root,${PATTERN_ROOTS},$(info post-root: ${root} := $(value ${root}))$(info )) -- cgit v1.2.3-70-g09d2 From 487db287f8bbc97c794e63a3aea54ba4f25b633a Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 18:32:09 +0000 Subject: real.make: Split dependency sanitization step If we want to be able to filter specific other entries, such as for the sake of more generated files, we'll want to be doing this over a list that has already been made relative and simplified. --- Makefile.in | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Makefile.in b/Makefile.in index a63a589..f9f1fed 100644 --- a/Makefile.in +++ b/Makefile.in @@ -358,15 +358,23 @@ thisdir := $(abspath .) # The end result for each root will look something like: # mmo/version := conf-raw/int-VENDOR_POINT.h conf-raw/int-VERSION_DEVEL.h [...] # src/strings/zstring.tcc src/wire/fwd.hpp + +# Firstly, make the paths relative and simplified. $(foreach root,${PATTERN_ROOTS},$(eval \ ${root} := $(sort $(patsubst ${thisdir}/%,%, \ - $(abspath $(patsubst ${SRC_DIR}/%,%, \ - $(wildcard $(value ${root})) \ - $(filter conf-raw/%.h,$(value ${root}) \ - ))) \ + $(abspath $(patsubst ${SRC_DIR}/%,%, $(value ${root}))) \ )) \ )) +# Secondly, make sure that the files actually exist, or are files we expect to +# generate ourselves. Sort the result for readability. +$(foreach root,${PATTERN_ROOTS},$(eval \ + ${root} := $(sort \ + $(wildcard $(value ${root})) \ + $(filter conf-raw/%.h,$(value ${root})) \ + ) \ +)) + # have to redo what we undid to get it as a variable $(foreach root,${PATTERN_ROOTS},$(eval obj/${root}.ii obj/${root}.ll obj/${root}.bc obj/${root}.s obj/${root}.pdc.o obj/${root}.pic.o obj/${root}.d : $(value ${root})) ) #$(foreach root,${PATTERN_ROOTS},$(info post-root: ${root} := $(value ${root}))$(info )) -- cgit v1.2.3-70-g09d2 From 1beb173f7e876fff48cc09adcc9be2481867abb0 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 16:34:39 +0000 Subject: real.make: Allow generated files not in conf-raw --- Makefile.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index f9f1fed..79fe4ce 100644 --- a/Makefile.in +++ b/Makefile.in @@ -190,6 +190,7 @@ stamp/generated.stamp: false # path lists +GENERATED_FILES := src/conf/version.hpp REAL_SOURCES := $(shell cd ${SRC_DIR}; find src/ -name '*.cpp') REAL_HEADERS := $(shell cd ${SRC_DIR}; find include/ src/ -name '*.hpp' -o -name '*.tcc') PIES := $(shell cd ${SRC_DIR}; find src/ -name '*.py') @@ -351,7 +352,8 @@ thisdir := $(abspath .) # to: # src/strings/zstring.tcc # - only files which either exist (the purpose of the wildcard function), -# or are in the conf-raw directory (the purpose of the filter function). +# are in the conf-raw directory (the first filter function), or +# are listed in the GENERATED_FILES variable (the second filter function). # This means that if there are any build-time generated files added, this # needs to be modified to not filter them out. # @@ -372,6 +374,7 @@ $(foreach root,${PATTERN_ROOTS},$(eval \ ${root} := $(sort \ $(wildcard $(value ${root})) \ $(filter conf-raw/%.h,$(value ${root})) \ + $(filter ${GENERATED_FILES},$(value ${root})) \ ) \ )) -- cgit v1.2.3-70-g09d2 From 185cd48b947c863b9eba9c7134cb205f315a6285 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 18:44:25 +0000 Subject: Fix CI --- .gitlab-ci.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f7c750a..65b8961 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,7 +23,7 @@ re:ubuntu1804:build: image: ubuntu:18.04 variables: <<: *base_vars - INSTALL_PACKAGES: python + INSTALL_PACKAGES: python3 script: - echo "Building TMW Athena $CI_BUILD_NAME" - git submodule update --init @@ -47,9 +47,8 @@ re:ubuntu2204:build: image: ubuntu:22.04 variables: <<: *base_vars - INSTALL_PACKAGES: python2 + INSTALL_PACKAGES: python3 script: - - ln -s /usr/bin/python2 /usr/bin/python - git submodule update --init - git fetch -t - printf "Building TMW Athena version %s\n" "$(git describe --tags HEAD)" @@ -73,7 +72,7 @@ re:ubuntu2204:build: image: ubuntu:18.04 variables: <<: *base_vars - INSTALL_PACKAGES: python gdb + INSTALL_PACKAGES: python3 gdb script: - printf "Testing TMW Athena version %s\n" "$(git describe --tags HEAD)" - make test @@ -84,8 +83,7 @@ re:ubuntu2204:test: image: ubuntu:22.04 variables: <<: *base_vars - INSTALL_PACKAGES: python2 gdb + INSTALL_PACKAGES: python3 gdb script: - - ln -s /usr/bin/python2 /usr/bin/python - printf "Testing TMW Athena version %s\n" "$(git describe --tags HEAD)" - make test -- cgit v1.2.3-70-g09d2 From a9843a189832de03d610ff294e5bc5ba8dd7d9df Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 19:43:45 +0000 Subject: Update attoconf - Correctly handle files in subdirectories in out-of-tree builds - Handle UTF-8 properly - Close file resources properly --- deps/attoconf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/attoconf b/deps/attoconf index f8844ed..a9d44b5 160000 --- a/deps/attoconf +++ b/deps/attoconf @@ -1 +1 @@ -Subproject commit f8844ed8f37189396a3c6589909a33673ce6bc78 +Subproject commit a9d44b5bcbb60076462b40326659de4e07d9bdaf -- cgit v1.2.3-70-g09d2 From d076f79ad35fb9b018b4cc21e27460c5c97e6d49 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 18:44:47 +0000 Subject: CI: Out-of-tree build by default --- .gitlab-ci.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 65b8961..4031978 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,7 +29,9 @@ re:ubuntu1804:build: - git submodule update --init - git fetch -t - printf "Building TMW Athena version %s\n" "$(git describe --tags HEAD)" - - ./configure --user + - mkdir build + - cd build + - ../configure --user - make - whoami - make install @@ -52,7 +54,9 @@ re:ubuntu2204:build: - git submodule update --init - git fetch -t - printf "Building TMW Athena version %s\n" "$(git describe --tags HEAD)" - - ./configure --user + - mkdir build + - cd build + - ../configure --user - make - whoami - make install @@ -75,6 +79,7 @@ re:ubuntu2204:build: INSTALL_PACKAGES: python3 gdb script: - printf "Testing TMW Athena version %s\n" "$(git describe --tags HEAD)" + - cd build - make test re:ubuntu2204:test: @@ -86,4 +91,5 @@ re:ubuntu2204:test: INSTALL_PACKAGES: python3 gdb script: - printf "Testing TMW Athena version %s\n" "$(git describe --tags HEAD)" + - cd build - make test -- cgit v1.2.3-70-g09d2 From cf28576707989b398a0c1acf0560d3b89030fe2b Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 19:20:48 +0000 Subject: CMakeLists.txt: Remove dead code, add TODOs --- CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5981636..1f1e254 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -167,8 +167,6 @@ add_executable(tmwa-admin ${admin_SOURCES} ) target_link_libraries(tmwa-admin tmwa-shared) -#add_executable(tmwa-test ${strtest_SOURCES}) -#target_link_libraries(tmwa-test tmwa-shared) +# TODO: Call make -f ${CMAKE_SOURCE_DIR}/generate.mk clean to clean up the +# generated files. We want this to be run every time we call make clean. -# Call make -f ${CMAKE_SOURCE_DIR}/generate.mk clean to clean up the generated -# files. We want this to be run every time we call make clean. -- cgit v1.2.3-70-g09d2 From 4b374000f7c14d12096d33d9282ccdcb90f8fd6e Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 19:20:58 +0000 Subject: CMakeLists.txt: Add install target --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f1e254..0d5e9d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -170,3 +170,8 @@ target_link_libraries(tmwa-admin tmwa-shared) # TODO: Call make -f ${CMAKE_SOURCE_DIR}/generate.mk clean to clean up the # generated files. We want this to be run every time we call make clean. +# Install targets +install(TARGETS tmwa-login tmwa-char tmwa-map tmwa-admin tmwa-shared + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) -- cgit v1.2.3-70-g09d2 From ab055062fea1a78bf643a13cadece24a5240f298 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 18:45:44 +0000 Subject: CI: Add cmake build --- .gitlab-ci.yml | 44 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4031978..a8b9374 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,9 +15,8 @@ variables: &base_vars - apt-get update - apt-get install -y -qq $INSTALL_PACKAGES $DEBIAN_COMMON_PACKAGES - # Active server OS? -re:ubuntu1804:build: +re:ubuntu1804-attoconf:build: <<: *prerequisites stage: build image: ubuntu:18.04 @@ -39,11 +38,8 @@ re:ubuntu1804:build: untracked: true expire_in: 30 mins - - - # Next server OS? -re:ubuntu2204:build: +re:ubuntu2204-attoconf:build: <<: *prerequisites stage: build image: ubuntu:22.04 @@ -64,13 +60,33 @@ re:ubuntu2204:build: untracked: true expire_in: 30 mins - +# Next server OS, with cmake +re:ubuntu2204:build: + <<: *prerequisites + stage: build + image: ubuntu:22.04 + variables: + <<: *base_vars + INSTALL_PACKAGES: python3 cmake + script: + - git submodule update --init + - git fetch -t + - printf "Building TMW Athena version %s\n" "$(git describe --tags HEAD)" + - mkdir build + - cd build + - cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local .. + - make + - whoami + - make install + artifacts: # required for test stage + untracked: true + expire_in: 30 mins # Disabled. fails with: # (1) GDB failing to resolve a type # (2) /usr/bin/ld: Dwarf Error: Can't find .debug_ranges section. -.re:ubuntu1804:test: +.re:ubuntu1804-attoconf:test: <<: *prerequisites stage: test image: ubuntu:18.04 @@ -82,6 +98,18 @@ re:ubuntu2204:build: - cd build - make test +re:ubuntu2204-attoconf:test: + <<: *prerequisites + stage: test + image: ubuntu:22.04 + variables: + <<: *base_vars + INSTALL_PACKAGES: python3 gdb + script: + - printf "Testing TMW Athena version %s\n" "$(git describe --tags HEAD)" + - cd build + - make test + re:ubuntu2204:test: <<: *prerequisites stage: test -- cgit v1.2.3-70-g09d2 From 36562d847999730634663d8a80c3cfdff36bd027 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 20:05:31 +0000 Subject: python3: Strip old __future__ references --- configure | 2 -- tools/colorize | 2 -- tools/config.py | 2 -- tools/debug-debug-scripts | 1 - tools/indenter | 1 - tools/protocol.py | 2 -- 6 files changed, 10 deletions(-) diff --git a/configure b/configure index 7a7a9ef..31c0c47 100755 --- a/configure +++ b/configure @@ -17,8 +17,6 @@ # You should have received a copy of the GNU General Public License # along with attoconf. If not, see . -from __future__ import print_function, division, absolute_import - import os import sys diff --git a/tools/colorize b/tools/colorize index 849fb61..205a1bc 100755 --- a/tools/colorize +++ b/tools/colorize @@ -1,7 +1,5 @@ #!/usr/bin/env python3 -from __future__ import print_function - import os import sys diff --git a/tools/config.py b/tools/config.py index a2645d8..ce61440 100755 --- a/tools/config.py +++ b/tools/config.py @@ -20,8 +20,6 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -from __future__ import print_function - import glob import os diff --git a/tools/debug-debug-scripts b/tools/debug-debug-scripts index cfdc31f..5ba7ecb 100755 --- a/tools/debug-debug-scripts +++ b/tools/debug-debug-scripts @@ -1,6 +1,5 @@ #!/usr/bin/env python3 # encoding: utf-8 -from __future__ import print_function copyright = ''' // Copyright © 2014 Ben Longbons diff --git a/tools/indenter b/tools/indenter index f7c1657..1d44581 100755 --- a/tools/indenter +++ b/tools/indenter @@ -20,7 +20,6 @@ ## along with this program. If not, see . -from __future__ import print_function from collections import namedtuple import cStringIO diff --git a/tools/protocol.py b/tools/protocol.py index 08c82b2..86515d2 100755 --- a/tools/protocol.py +++ b/tools/protocol.py @@ -20,8 +20,6 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -from __future__ import print_function - import glob import itertools import os -- cgit v1.2.3-70-g09d2 From f5500cd949e6db20813c3bbec9cef66284866209 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 20:08:39 +0000 Subject: python3: Update names - unicode -> str - u'' -> '' - cStringIO -> io Sourced from specing's work on the porting process. See https://git.themanaworld.org/legacy/tmwa/-/merge_requests/256 --- tools/indenter | 4 +- tools/protocol.py | 109 ++++++++++++++++++++++++++---------------------------- 2 files changed, 54 insertions(+), 59 deletions(-) diff --git a/tools/indenter b/tools/indenter index 1d44581..ee000da 100755 --- a/tools/indenter +++ b/tools/indenter @@ -22,7 +22,7 @@ from collections import namedtuple -import cStringIO +import io import string import subprocess import sys @@ -113,7 +113,7 @@ class Reader(object): self._column += 1 def string_reader(s, name='', line=1, column=1): - return Reader(name, cStringIO.StringIO(s), line, column) + return Reader(name, io.StringIO(s), line, column) def take_while(b, r, s): assert isinstance(b, bytearray) diff --git a/tools/protocol.py b/tools/protocol.py index 86515d2..8059c59 100755 --- a/tools/protocol.py +++ b/tools/protocol.py @@ -27,11 +27,6 @@ from pipes import quote from posixpath import relpath from weakref import ref as wr -try: - unicode -except NameError: - unicode = str - ## For various reasons this is all one file, so let's navigate with a ## ## Table of Contents @@ -114,30 +109,30 @@ class OpenWrite(object): # TOC_ def gvq(s): - return u'"%s"' % s.replace(u'"', u'\\"') + return '"%s"' % s.replace('"', '\\"') def gva(d): if d: - return u' [%s]' % u', '.join(u'%s=%s' % (ak, gvq(av)) for (ak, av) in sorted(d.items())) - return u'' + return ' [%s]' % ', '.join('%s=%s' % (ak, gvq(av)) for (ak, av) in sorted(d.items())) + return '' class Attributes(object): - __slots__ = (u'_attributes') + __slots__ = ('_attributes') def __init__(self): self._attributes = {} def __getitem__(self, k): - assert isinstance(k, unicode) + assert isinstance(k, str) return self._attributes[k] def __setitem__(self, k, v): - assert isinstance(k, unicode) - assert isinstance(v, unicode) + assert isinstance(k, str) + assert isinstance(v, str) self._attributes[k] = v def __delitem__(self, k): - assert isinstance(k, unicode) + assert isinstance(k, str) del self._attributes[k] def merge(self, *others): @@ -148,7 +143,7 @@ class Attributes(object): self._attributes.update(other._attributes) class Graph(Attributes): - __slots__ = (u'default_vertex', u'default_edge', u'_vertices', u'_edges', u'_vertex_lookup') + __slots__ = ('default_vertex', 'default_edge', '_vertices', '_edges', '_vertex_lookup') def __init__(self): Attributes.__init__(self) @@ -159,7 +154,7 @@ class Graph(Attributes): self._vertex_lookup = {} def vertex(self, name, insert=True): - assert isinstance(name, unicode) + assert isinstance(name, str) vert = self._vertex_lookup.get(name) if insert and vert is None: vert = Vertex(name) @@ -236,21 +231,21 @@ class Graph(Attributes): def p(*args): for x in args: - out.write(unicode(x)) - out.write(u'\n') - p(u'digraph') - p(u'{') + out.write(str(x)) + out.write('\n') + p('digraph') + p('{') for ak, av in sorted(self._attributes.items()): - p(u' ', ak, u'=', gvq(av), u';') + p(' ', ak, '=', gvq(av), ';') for ak, av in sorted(self.default_vertex._attributes.items()): - p(u' node [', ak, u'=', gvq(av), u'];') + p(' node [', ak, '=', gvq(av), '];') for ak, av in sorted(self.default_edge._attributes.items()): - p(u' edge [', ak, u'=', gvq(av), u'];') + p(' edge [', ak, '=', gvq(av), '];') for n in sorted(self._vertices): - p(u' ', n) + p(' ', n) for _, e in sorted(self._edges.items()): - p(u' ', e) - p(u'}') + p(' ', e) + p('}') def dot_str(self): from io import StringIO @@ -259,18 +254,18 @@ class Graph(Attributes): return out.getvalue() def dot_file(self, name): - with open(name, u'w') as f: + with open(name, 'w') as f: self.dot(f, False) def preview(self, block): from subprocess import Popen, PIPE - proc = Popen([u'dot', u'-Txlib', u'/dev/stdin'], stdin=PIPE, universal_newlines=True) + proc = Popen(['dot', '-Txlib', '/dev/stdin'], stdin=PIPE, universal_newlines=True) self.dot(proc.stdin, True) if block: proc.wait() class Vertex(Attributes): - __slots__ = (u'_key', u'_post', u'_pre', u'__weakref__') + __slots__ = ('_key', '_post', '_pre', '__weakref__') def __init__(self, key): Attributes.__init__(self) @@ -279,13 +274,13 @@ class Vertex(Attributes): self._pre = set() def __str__(self): - return u'%s%s;' % (gvq(self._key), gva(self._attributes)) + return '%s%s;' % (gvq(self._key), gva(self._attributes)) def __lt__(self, other): return self._key < other._key class Edge(Attributes): - __slots__ = (u'_from', u'_to') + __slots__ = ('_from', '_to') def __init__(self, f, t): Attributes.__init__(self) @@ -293,7 +288,7 @@ class Edge(Attributes): self._to = t def __str__(self): - return u'%s -> %s%s;' % (gvq(self._from._key), gvq(self._to._key), gva(self._attributes)) + return '%s -> %s%s;' % (gvq(self._from._key), gvq(self._to._key), gva(self._attributes)) # TOC_TYPES @@ -7177,16 +7172,16 @@ def make_dots(ctx): covered_nodes = sorted(p.pre_set(d, 2) | p.post_set(d, 2)) covered_edges = [(a, b) for a in covered_nodes for b in covered_nodes if b in d[a].post] g = Graph() - g.default_vertex[u'shape'] = u'box' - # g[u'layout'] = u'twopi' - # g[u'root'] = u'0x%04x' % id + g.default_vertex['shape'] = 'box' + # g['layout'] = 'twopi' + # g['root'] = '0x%04x' % id for n in covered_nodes: - v = g.vertex(u'0x%04x' % n) - v[u'label'] = u'Packet \\N: %s' % d[n].name + v = g.vertex('0x%04x' % n) + v['label'] = 'Packet \\N: %s' % d[n].name if n == id: - v[u'style'] = u'filled' + v['style'] = 'filled' for (a, b) in covered_edges: - g.edge(u'0x%04x' % a, u'0x%04x' % b) + g.edge('0x%04x' % a, '0x%04x' % b) for n in covered_nodes: # the center node will be covered specially below if n == id: @@ -7204,10 +7199,10 @@ def make_dots(ctx): # don't show mere siblings unless also ancestor/descendent count += 1 if count: - v = g.vertex(u'0x%04x...pre' % n) - v[u'label'] = u'%d more' % count - v[u'style'] = u'dashed' - g.edge(v, u'0x%04x' % n) + v = g.vertex('0x%04x...pre' % n) + v['label'] = '%d more' % count + v['style'] = 'dashed' + g.edge(v, '0x%04x' % n) # strong forward links count = 0 for p in d[n].post: @@ -7216,36 +7211,36 @@ def make_dots(ctx): elif p not in covered_nodes: count += 1 if count: - v = g.vertex(u'0x%04x...post' % n) - v[u'label'] = u'%d more' % count - v[u'style'] = u'dashed' - g.edge(u'0x%04x' % n, v) + v = g.vertex('0x%04x...post' % n) + v['label'] = '%d more' % count + v['style'] = 'dashed' + g.edge('0x%04x' % n, v) # for the immediate node, also cover specials and weaks for p in d[id].pre: # (there are no weak backward specials) # strong backward specials if isinstance(p, SpecialEventOrigin): - g.edge(unicode(p.name), u'0x%04x' % id) + g.edge(str(p.name), '0x%04x' % id) # weak backward nodes elif id in d[p].xpost: - e = g.edge(u'0x%04x' % p, u'0x%04x' % id) - e[u'style']=u'dashed' - e[u'weight'] = u'0' + e = g.edge('0x%04x' % p, '0x%04x' % id) + e['style']='dashed' + e['weight'] = '0' for p in d[id].post: # strong forward specials if isinstance(p, SpecialEventOrigin): - g.edge(u'0x%04x' % id, unicode(p.name)) + g.edge('0x%04x' % id, str(p.name)) for p in d[id].xpost: # weak forward specials if isinstance(p, SpecialEventOrigin): - e = g.edge(u'0x%04x' % id, unicode(p.name)) - e[u'style'] = u'dashed' - e[u'weight'] = u'0' + e = g.edge('0x%04x' % id, str(p.name)) + e['style'] = 'dashed' + e['weight'] = '0' # weak forward nodes elif p not in covered_nodes: - e = g.edge(u'0x%04x' % id, u'0x%04x' % p) - e[u'style'] = u'dashed' - e[u'weight'] = u'0' + e = g.edge('0x%04x' % id, '0x%04x' % p) + e['style'] = 'dashed' + e['weight'] = '0' g.dot(f, False) -- cgit v1.2.3-70-g09d2 From 9903d45c343fe51309075674c96b4411b6e1a002 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 20:09:57 +0000 Subject: python3: Add explicit list()s for python3.6 This should be reverted once we drop support for Ubuntu 18.04, and therefore python3.6, as it does clutter up the code a bit. Sourced from specing's work on the porting process. See https://git.themanaworld.org/legacy/tmwa/-/merge_requests/256 --- src/main-gdb-head.py | 2 +- src/map/script-parse.py | 2 +- tools/config.py | 6 +++--- tools/protocol.py | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main-gdb-head.py b/src/main-gdb-head.py index a465c97..09e22fe 100644 --- a/src/main-gdb-head.py +++ b/src/main-gdb-head.py @@ -5,7 +5,7 @@ # gdb sticks everything in one scope. # This lets us enumerate what *we* added. -initial_globals = {id(v):v for v in globals().values()} +initial_globals = {id(v):v for v in list(globals().values())} import re diff --git a/src/map/script-parse.py b/src/map/script-parse.py index 199e348..3346b92 100644 --- a/src/map/script-parse.py +++ b/src/map/script-parse.py @@ -106,7 +106,7 @@ class ScriptBuffer(object): code_begin = code['_M_impl']['_M_start'] code_end = code['_M_impl']['_M_finish'] code_size = int(code_end - code_begin) - r = iter(range(code_size)) + r = iter(list(range(code_size))) for i in r: buf = [] for label in labels_dict.get(i, []): diff --git a/tools/config.py b/tools/config.py index ce61440..22ece0b 100755 --- a/tools/config.py +++ b/tools/config.py @@ -257,7 +257,7 @@ class Group(object): short_cpp_name = '%s.cpp' % var_name cpp_name = os.path.join(path, short_cpp_name) - values = sorted(self.options.values(), key=lambda o: o.name) + values = sorted(list(self.options.values()), key=lambda o: o.name) desc = 'Config for %s::%s' % (namespace_name, self.name) with OpenWrite(hpp_name) as hpp, \ @@ -382,7 +382,7 @@ class Realm(object): return rv def dump(self): - for g in self.groups.values(): + for g in list(self.groups.values()): g.dump_in(self.path, self.path.split('/')[-1]) class Everything(object): @@ -399,7 +399,7 @@ class Everything(object): def dump(self): for g in glob.glob('src/*/*_conf.[ch]pp'): os.rename(g, g + '.old') - for v in self.realms.values(): + for v in list(self.realms.values()): v.dump() for g in glob.glob('src/*/*_conf.[ch]pp.old'): print('Obsolete: %s' % g) diff --git a/tools/protocol.py b/tools/protocol.py index 8059c59..b0d46a4 100755 --- a/tools/protocol.py +++ b/tools/protocol.py @@ -7084,7 +7084,7 @@ def partition(d): changed = True while changed: changed = False - for k, vlist in d.items(): + for k, vlist in list(d.items()): if vlist: m = min(leaders[v] for v in vlist) if m < leaders[k]: @@ -7100,9 +7100,9 @@ def partition(d): leaders[v] = m followers = {} - for k, v in leaders.items(): + for k, v in list(leaders.items()): followers.setdefault(v, []).append(k) - return [set(v) for v in followers.values()] + return [set(v) for v in list(followers.values())] def ids_only(vpost): rv = [e for e in vpost if not isinstance(e, SpecialEventOrigin)] @@ -7125,7 +7125,7 @@ def make_dots(ctx): for g in glob.glob('doc-gen/Packet-*.md'): os.rename(g, g + '.old') - for (id, p) in d.items(): + for (id, p) in list(d.items()): md = 'doc-gen/Packet-0x%04x.md' % id dot = 'doc-gen/packets-around-0x%04x.gv' % id with OpenWrite(md) as f: -- cgit v1.2.3-70-g09d2 From c33d3f8efc280a2c4e3e440d065360094151c331 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 20:29:36 +0000 Subject: python3: Add explicit encoding='utf-8' for python3.6 --- tools/protocol.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/protocol.py b/tools/protocol.py index b0d46a4..c4c8657 100755 --- a/tools/protocol.py +++ b/tools/protocol.py @@ -84,7 +84,7 @@ class OpenWrite(object): self.filename = filename def __enter__(self): - self.handle = open(self.filename + '.tmp', 'w') + self.handle = open(self.filename + '.tmp', 'w', encoding='utf-8') return self.handle def __exit__(self, ty, v, tb): -- cgit v1.2.3-70-g09d2 From bf14f1b157333c53cc0578f20627529e5fd3e539 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 21:19:19 +0000 Subject: real.make: Fix out-of-tree builds I appreciate and respect how densely packed Makefile code can be. hahahaahahahaaa --- Makefile.in | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index 79fe4ce..d4334eb 100644 --- a/Makefile.in +++ b/Makefile.in @@ -347,8 +347,10 @@ thisdir := $(abspath .) # - sorted # - relative and simplified: it's stripped of any absolute path relative to # the current directory after being converted to an absolute path. +# This also converts paths from being relative to the build directory to +# being relative to the source directory, if they differ. # This simplifies any construct such as: -# src/mmo/../strings/zstring.tcc +# ../src/mmo/../strings/zstring.tcc # to: # src/strings/zstring.tcc # - only files which either exist (the purpose of the wildcard function), @@ -370,9 +372,13 @@ $(foreach root,${PATTERN_ROOTS},$(eval \ # Secondly, make sure that the files actually exist, or are files we expect to # generate ourselves. Sort the result for readability. +# Note that we re-add and remove the ${SRC_DIR} prefix when testing for +# existence, as we need to test for existence relative to our build directory. $(foreach root,${PATTERN_ROOTS},$(eval \ ${root} := $(sort \ - $(wildcard $(value ${root})) \ + $(patsubst ${SRC_DIR}/%,%,$(wildcard $(addprefix ${SRC_DIR}/, \ + $(value ${root}) \ + ))) \ $(filter conf-raw/%.h,$(value ${root})) \ $(filter ${GENERATED_FILES},$(value ${root})) \ ) \ -- cgit v1.2.3-70-g09d2 From dd024fdf9ca01c02b79371512672f6798468020d Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 22:06:13 +0000 Subject: Create generated files in the build directory Also, just require the use of full paths when #including a generated file. This fixes fresh out-of-tree builds using attoconf, and gets rid of a lot of annoying terminal output when attoconf is tracing dependencies. --- CMakeLists.txt | 13 +++++++------ Makefile.in | 10 +++------- src/mmo/version.cpp | 2 +- src/shared/lib.cpp | 2 +- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d5e9d1..d997b98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,13 +101,14 @@ set(PACKAGEDATADIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/tmwa") set(LOCALSTATEDIR "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}") set(SYSCONFDIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}") -# Generate the install.hpp and version.hpp files in the source directory. -# TODO: Is there a nicer way to handle this so we're still able to make fully -# out-of-tree builds, generating the files in the build directory, but still -# having them found by includes? -configure_file(src/conf/install.hpp.in ${CMAKE_SOURCE_DIR}/src/conf/install.hpp @ONLY) -configure_file(src/conf/version.hpp.in ${CMAKE_SOURCE_DIR}/src/conf/version.hpp @ONLY) +# Generate the install.hpp and version.hpp files. +configure_file(src/conf/install.hpp.in src/conf/install.hpp @ONLY) +configure_file(src/conf/version.hpp.in src/conf/version.hpp @ONLY) set(conf_SOURCES ${conf_SOURCES} src/conf/install.hpp src/conf/version.hpp) +# And have the build search for files in the build directory. +# Note that #includes with generated files should use a path relative to the +# top level source or build directory. +include_directories(${CMAKE_CURRENT_BINARY_DIR}) # Add a shared library: libtmwa-shared.so.0 # When we add_executable later, we need to link against this library. diff --git a/Makefile.in b/Makefile.in index d4334eb..2f62baf 100644 --- a/Makefile.in +++ b/Makefile.in @@ -488,12 +488,8 @@ obj/%.d: src/%.cpp | stamp/generated.stamp -MF $@ $< # -MG takes the include parameter as-is without prepending the path whenever # it's not found, and presumed to be a not-yet generated file. -# This is troublesome, since real.make tends not to be in the same directory. -# We work around this by checking to see if a file doesn't exist, and if it -# doesn't, we prepend the path. - for f in $$(sed -e '1s@$(patsubst obj/%.d,%,$@) := \(.*\)@\1@' $@ | tr ' ' \\n | grep -vFx -e : -e \\); do \ - test -f "$${f}" || sed -i "s|\($${f}\)|src/$(dir $*)\1|" $@; \ - done +# #include statements for generated files should always be relative to the +# source (or build) directory. endif # the above SRC_DIR replacement is not really safe, but it works okayish. obj/%.ii: src/%.cpp @@ -742,7 +738,7 @@ conf-raw/str-%.h: FORCE FORCE:: ; .PHONY: FORCE -override CPPFLAGS += -I . -I ${SRC_DIR}/include +override CPPFLAGS += -I. -I${SRC_DIR}/include # distribution tarballs # this only works from within a git checkout diff --git a/src/mmo/version.cpp b/src/mmo/version.cpp index f91b748..c75c25c 100644 --- a/src/mmo/version.cpp +++ b/src/mmo/version.cpp @@ -20,7 +20,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "../conf/version.hpp" +#include "src/conf/version.hpp" #include "../strings/xstring.hpp" diff --git a/src/shared/lib.cpp b/src/shared/lib.cpp index 0eebf17..563bff4 100644 --- a/src/shared/lib.cpp +++ b/src/shared/lib.cpp @@ -18,7 +18,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "../conf/install.hpp" +#include "src/conf/install.hpp" #include "../strings/literal.hpp" #include "../strings/astring.hpp" -- cgit v1.2.3-70-g09d2 From be3001b079632f5575625043cd0b425f8af5b24b Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 23:43:24 +0000 Subject: configure: srcdir for GTEST_DIR default The default value for GTEST_DIR should be deps/googletest/googletest under the source directory, not under the build directory. The build directory will often not have anything in it at all in the case of an out-of-tree build. This allows some tests to run for out-of-tree builds. --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 31c0c47..468f029 100755 --- a/configure +++ b/configure @@ -88,7 +88,7 @@ class Configuration(Cxx, Install, ConfigHash, Templates): # 2) Modern distros ship gtest-1.13+. It requires C++14+, while # TMWA is currently a C++0x codebase. self.add_option('GTEST_DIR', - init=os.path.join(os.getcwd(), 'deps/googletest/googletest'), + init=os.path.join(os.path.abspath(self.srcdir), 'deps/googletest/googletest'), # http://code.google.com/p/googletest/wiki/FAQ#Why_is_it_not_recommended_to_install_a_pre-compiled_copy_of_Goog type=filepath, check=lambda build, GTEST_DIR: None, help='Location of Google Test sources, must contain src/gtest-all.cc (linking to a precompiled library is NOT supported)', hidden=False) -- cgit v1.2.3-70-g09d2 From f928d23f106f19ab9f2ccd5d57a5728f66ccb17f Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 23:43:58 +0000 Subject: debug-debug: Update deprecated gdb syntax --- tools/debug-debug.gdb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/debug-debug.gdb b/tools/debug-debug.gdb index b50a49b..5bf3a57 100644 --- a/tools/debug-debug.gdb +++ b/tools/debug-debug.gdb @@ -9,7 +9,7 @@ gdb.execute('file %s' % file_to_load) end set logging file /dev/null set logging redirect on -set logging off +set logging enabled off python import re @@ -41,7 +41,7 @@ set print elements 9999 set print frame-arguments none set python print-stack full -set logging on +set logging enabled on # Workaround "Function... not defined in.." (breakpoints not found) (GDB bug) # https://sourceware.org/bugzilla/show_bug.cgi?id=15962 # In some gdb versions rbreak works, in some break does. @@ -55,7 +55,7 @@ if bpoint.pending: gdb.execute("rbreak do_breakpoint") end -set logging off +set logging enabled off commands silent -- cgit v1.2.3-70-g09d2 From 6a3ded9d3c85e54a5a008ba2f125520c63cfb641 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 23:46:21 +0000 Subject: real.make: Permit existant SRC_DIR relative paths This allows files that already exist to be specified relative to SRC_DIR, rather than just relative to the current file. This is used in tests, though it appears not to be used in main tmwa. --- Makefile.in | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index 2f62baf..2b0c632 100644 --- a/Makefile.in +++ b/Makefile.in @@ -372,13 +372,17 @@ $(foreach root,${PATTERN_ROOTS},$(eval \ # Secondly, make sure that the files actually exist, or are files we expect to # generate ourselves. Sort the result for readability. -# Note that we re-add and remove the ${SRC_DIR} prefix when testing for +# Note that we re-add and remove the ${SRC_DIR} prefix when first testing for # existence, as we need to test for existence relative to our build directory. +# The second wildcard test doesn't add a ${SRC_DIR} prefix, but does strip it, +# handling the case where the file is specified relative to the source +# directory (mostly the case in test sources). $(foreach root,${PATTERN_ROOTS},$(eval \ ${root} := $(sort \ $(patsubst ${SRC_DIR}/%,%,$(wildcard $(addprefix ${SRC_DIR}/, \ $(value ${root}) \ ))) \ + $(patsubst ${SRC_DIR}/%,%,$(wildcard ${SRC_DIR})) \ $(filter conf-raw/%.h,$(value ${root})) \ $(filter ${GENERATED_FILES},$(value ${root})) \ ) \ @@ -738,7 +742,7 @@ conf-raw/str-%.h: FORCE FORCE:: ; .PHONY: FORCE -override CPPFLAGS += -I. -I${SRC_DIR}/include +override CPPFLAGS += -I. -I${SRC_DIR} -I${SRC_DIR}/include # distribution tarballs # this only works from within a git checkout -- cgit v1.2.3-70-g09d2 From 4fcaed08178d736205ab14b6fd956ba0f09f445b Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 23:47:39 +0000 Subject: DTEST: Provide LD_LIBRARY_PATH How did this ever work before? Did it expect there to be a previously installed libtmwa-shared.so and run tests against that, rather than what was just built? --- Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 2b0c632..4c12e06 100644 --- a/Makefile.in +++ b/Makefile.in @@ -566,7 +566,7 @@ obj/gtest%.pdc.o: ${GTEST_DIR}/src/gtest%.cc DTEST_OBJS := $(filter obj/debug-debug/%.pdc.o,${PDC_OBJECTS}) DTEST_STAMPS := $(patsubst bin/tests/%.elf,stamp/run-%.stamp,${DTEST_BINARIES}) ${DTEST_OBJS}: override CXXFLAGS += -g -O0 -gdwarf-3 -${DTEST_STAMPS}: override TESTER=${GDB} -return-child-result -nx -batch -ex 'python file_to_load = "$<"' -x ${SRC_DIR}/tools/debug-debug.gdb --args false +${DTEST_STAMPS}: override TESTER=LD_LIBRARY_PATH="./lib" ${GDB} -return-child-result -nx -batch -ex 'python file_to_load = "$<"' -x ${SRC_DIR}/tools/debug-debug.gdb --args false ${DTEST_STAMPS}: tools/debug-debug.gdb test: test-direct -- cgit v1.2.3-70-g09d2 From 43b4957af6f12a3aecde7121b16f34a26b9032ba Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Wed, 5 Jun 2024 23:48:48 +0000 Subject: real.make: rank-fwd: Allow src/conf specification Previously, only ../conf style includes were excluded from expecting a fwd.hpp file to be provided for the directory. Permit src/conf style includes too. --- Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 4c12e06..56d9bce 100644 --- a/Makefile.in +++ b/Makefile.in @@ -596,7 +596,7 @@ test: test-rank-fwd test-rank-fwd: ${CHECK_RANK_FWDS} stamp/%.rank: src/% $(MKDIR_FIRST) - includes=$$(grep '#include.*".*/.*"' $< | sed 's/^[^"]*"//;s/"[^"]*$$//;s:/[^/]*$$::' | sort -u | fgrep -vx -e '..' -e 'conf-raw' -e '../conf'); \ + includes=$$(grep '#include.*".*/.*"' $< | sed 's/^[^"]*"//;s/"[^"]*$$//;s:/[^/]*$$::' | sort -u | fgrep -vx -e '..' -e 'conf-raw' -e '../conf' -e 'src/conf'); \ for inc in $$includes; do if ! test -f ${ Date: Wed, 5 Jun 2024 23:50:40 +0000 Subject: CI: Split attoconf and cmake artifacts Artifacts of the same name from different runs can overwrite each other. This makes sure that tests of the cmake pipeline actually test the cmake artifacts, and similarly for attoconf. --- .gitignore | 4 ++++ .gitlab-ci.yml | 23 ++++++++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index fdc00ac..34afd74 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,7 @@ # generic build /build/ + +# CI build +/build-atto/ +/build-cmake/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a8b9374..f049110 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,8 +28,8 @@ re:ubuntu1804-attoconf:build: - git submodule update --init - git fetch -t - printf "Building TMW Athena version %s\n" "$(git describe --tags HEAD)" - - mkdir build - - cd build + - mkdir build-atto + - cd build-atto - ../configure --user - make - whoami @@ -50,8 +50,8 @@ re:ubuntu2204-attoconf:build: - git submodule update --init - git fetch -t - printf "Building TMW Athena version %s\n" "$(git describe --tags HEAD)" - - mkdir build - - cd build + - mkdir build-atto + - cd build-atto - ../configure --user - make - whoami @@ -72,8 +72,8 @@ re:ubuntu2204:build: - git submodule update --init - git fetch -t - printf "Building TMW Athena version %s\n" "$(git describe --tags HEAD)" - - mkdir build - - cd build + - mkdir build-cmake + - cd build-cmake - cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local .. - make - whoami @@ -90,34 +90,39 @@ re:ubuntu2204:build: <<: *prerequisites stage: test image: ubuntu:18.04 + needs: ["ubuntu1804-attoconf:build"] variables: <<: *base_vars INSTALL_PACKAGES: python3 gdb script: - printf "Testing TMW Athena version %s\n" "$(git describe --tags HEAD)" - - cd build + - cd build-atto - make test + +# Enabled tests re:ubuntu2204-attoconf:test: <<: *prerequisites stage: test image: ubuntu:22.04 + needs: ["re:ubuntu2204-attoconf:build"] variables: <<: *base_vars INSTALL_PACKAGES: python3 gdb script: - printf "Testing TMW Athena version %s\n" "$(git describe --tags HEAD)" - - cd build + - cd build-atto - make test re:ubuntu2204:test: <<: *prerequisites stage: test image: ubuntu:22.04 + needs: ["re:ubuntu2204:build"] variables: <<: *base_vars INSTALL_PACKAGES: python3 gdb script: - printf "Testing TMW Athena version %s\n" "$(git describe --tags HEAD)" - - cd build + - cd build-cmake - make test -- cgit v1.2.3-70-g09d2 From 6be8161162bd82a3d308bece32cbb6b65d3b8b95 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Fri, 7 Jun 2024 12:49:24 +0000 Subject: Use -ggdb everywhere -fvar-tracking and -fvar-tracking-assignments are enabled by default when available, so are not explicitly set here. --- CMakeLists.txt | 2 +- Makefile.in | 2 +- deps/attoconf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d997b98..72f0abd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,7 +76,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -fstack-protector -fno-strict-aliasi # Next, add warnings #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") # Add debug information -#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb") # Vendor Name: String (no newlines, no parentheses) # This is usually one word, and does not (usually) change over time. diff --git a/Makefile.in b/Makefile.in index 56d9bce..075c107 100644 --- a/Makefile.in +++ b/Makefile.in @@ -565,7 +565,7 @@ obj/gtest%.pdc.o: ${GTEST_DIR}/src/gtest%.cc DTEST_OBJS := $(filter obj/debug-debug/%.pdc.o,${PDC_OBJECTS}) DTEST_STAMPS := $(patsubst bin/tests/%.elf,stamp/run-%.stamp,${DTEST_BINARIES}) -${DTEST_OBJS}: override CXXFLAGS += -g -O0 -gdwarf-3 +${DTEST_OBJS}: override CXXFLAGS += -ggdb -O0 ${DTEST_STAMPS}: override TESTER=LD_LIBRARY_PATH="./lib" ${GDB} -return-child-result -nx -batch -ex 'python file_to_load = "$<"' -x ${SRC_DIR}/tools/debug-debug.gdb --args false ${DTEST_STAMPS}: tools/debug-debug.gdb diff --git a/deps/attoconf b/deps/attoconf index a9d44b5..58e75e5 160000 --- a/deps/attoconf +++ b/deps/attoconf @@ -1 +1 @@ -Subproject commit a9d44b5bcbb60076462b40326659de4e07d9bdaf +Subproject commit 58e75e5f1271363a48c2a3417a2851d3b145b3fb -- cgit v1.2.3-70-g09d2 From d004748841972a24413dfd9d0b86a07e319bf8a5 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Tue, 4 Jun 2024 15:17:10 +0000 Subject: README.md: Reword with friendlier language --- README.md | 281 ++++++++++++++++++-------------------------------------------- 1 file changed, 80 insertions(+), 201 deletions(-) diff --git a/README.md b/README.md index 6de796f..6ec6a58 100644 --- a/README.md +++ b/README.md @@ -1,220 +1,99 @@ # The Mana World Athena - ![The Mana World logo](share/tmwa/TheManaWorldLogo.png) +Welcome to The Mana World Athena! This is an MMORPG server used by The Mana World, based on a protocol that was inspired by the project named "Athena". In 2004, it was forked from eAthena, a Ragnarok Online clone. + + +If you are interested in contributing, please take a look at our [wiki](http://wiki.themanaworld.org/index.php/Development:How_to_Develop) for user instructions. It provides detailed information on how to get started. + +**Important note:** Building from a GitHub-generated tarball does not work! You must either build from a git checkout or from a 'make dist' tarball. + +The rest of this file contains information relevant to distributors and contributors. + +## 1. Distributors +### Important notes +- Please read [version.make](version.make) for important version information. +- TMWA requires git to build by default. Use 'make dist' to get a tarball. + +### Platform dependencies +#### Architecture +- Tested: x86, amd64, x32 +- Likely to work: all architectures (patches welcome if they don't) + +#### Operating system +- Known bad: Linux 2.6.26 and earlier +- Maintained: Linux 3.2 and later +- Likely to break: Cygwin, BSD + +#### Filesystem +- Must support symlinks + +### Build dependencies +#### Python +- Required: 2.7.x only, installed in $PATH as 'python' + +#### C library +- Recommended: glibc 2.17 or higher +- Supported: glibc 2.13 +- Known bad: glibc 2.8 or below +- Unsupported: anything that's not glibc + +#### C++ compiler +- Required: g++ 4.7.2 or higher +- Recommended: g++ 4.8.1 or higher +- Not recommended: clang++ 3.3 or higher (all versions have unfixed bugs) -This is TMWA, an MMORPG server used by The Mana World that uses a protocol -based on one of many projects that foolishly chose the name "Athena". -Specifically, it was forked from eAthena, a Ragnarok Online clone, in 2004. - -Take a look at the [wiki](http://wiki.themanaworld.org/index.php/How_to_Develop) for user instructions. - -**Important note:** building from a GitHub-generated tarball does not work! -You must either build from a git checkout or from a 'make dist' tarball. - - -The rest of this file contains information relevant only to: - -1. Distributors. -2. Contributors. - -TMWA has a [bugtracker](https://git.themanaworld.org/legacy/tmwa/-/issues). - -But it's probably worth getting on IRC first: -* Use an IRC client: irc://irc.libera.chat/themanaworld-dev -* Or just use the [webchat](https://web.libera.chat/?channel=#themanaworld-dev). - -Note that this channel is not specific to technical discussion of TMWA (and -attoconf), but for any discussions related to TMW development. - -## 1. Distributors. -### Important notes: - -- Go read [version.mk](version.mk) -- TMWA requires git to build by default, use 'make dist' to get a tarball. - -### Platform dependencies: -#### Architecture: - - tested: x86, amd64, x32 - likely to work: all architectures (patches welcome if they don't) - -#### Operating system: - known bad: Linux 2.6.26 and earlier - maintained: Linux 3.2 and later - likely to break: Cygwin, BSD -#### Filesystem: - must support symlinks - -### Build dependencies: -#### Python: - required: 2.7.x only, installed in $PATH as 'python' -#### C library: - recommended: glibc 2.17 or higher - supported: glibc 2.13 - known bad: glibc 2.8 or below - unsupported: anything that's not glibc -#### C++ compiler: - required: g++ 4.7.2 or higher - recommended: g++ 4.8.1 or higher - not recommended: clang++ 3.3 or higher (all versions have unfixed bugs) -#### C++ library: - recommended: libstdc++ to match g++; may need patch for clang++ - may work: libc++ -#### attoconf: - special: see below -### Runtime dependencies: -#### glibc: - depends on what it was built against -#### libstdc++: - depends on what it was built against -### Instructions: -#### Configuration: - ./configure -_Takes most of the options GNU Autoconf's configure does - I won't - repeat the output of `./configure --help` here._ - -_`--prefix=/usr`, not `--prefix usr`, in order to prevent an ambiguity. - "In the face of ambiguity, refuse the temptation to guess."_ - -_Out-of-tree builds work._ - -_Note that there is no option to disable dependency tracking, as it - is also used to generate link information. There is also no option - to ignore unknown options - I refuse to lie._ -#### Build: - make -jN -#### Build test: - make test - -_Nowhere near complete useful yet. Requires source of Google Test._ +#### C++ library +- Recommended: libstdc++ to match g++; may need patch for clang++ +- May work: libc++ - make format; git diff --exit-code -#### Install: - make install DESTDIR=/whatever - -_See [what is installed](#what-is-installed) below_ -#### Install test: -_not implemented_ -#### Distribution tarballs: - make dist - make bindist - -### Note about attoconf: -TMWA's `./configure` script is implemented using a python package -'attoconf', which I wrote over a weekend after reading GNU autoconf's -documentation and realizing that it was 1. insane, and 2. still trying -to solve the wrong sort of problem. - -Currently, attoconf's API is still in the "experimental" stage, so the -real rule is "does ./configure work?". -When it gets to 1.0, it will start guaranteeing compatibility. - -Attoconf is available at [Github](https://github.com/o11c/attoconf/) and is a -well-behaving python package. - -Attoconf requires Python 2.7; a port to Python 2.6 is doable with a bit -of work, but it is not known if this would benefit anybody. - -If you're Arch - you broke Python for us all, you clean up your own mess. -Patches to call a nonexistent `/usr/bin/python2` will NOT be accepted. - -### What is installed: -#### Overview: -Currently, `make install` installs 5 binaries, along with a handful -of libraries, headers, data files, config files, and debug files, each -of which has a `make install-something` target. - -The 4 main programs below are typically running on the same machine, -though in theory they may be configured to run on different machines -in a fast LAN. Also, the internal protocol between the programs is -subject to change without notice, so they *must* be upgraded -simultaneously. - -These programs currently read most of their files relative to the -current working directory; this was the only thing that makes sense -since the files are dependent on the server-data. However, a migration -to installed files has begun. - -#### tmwa-admin: -Formerly known as `ladmin` ("local"). - -This is an essential tool to maintain the server's flatfile "databases". -It doesn't actually touch the files directly, just connects to -tmwa-login. - -Even when everything is rewritten to use SQL, it will be kept, if just -to keep a consistent interface. In fact, if we use SQLite we *can't* -edit the databases independently. This wouldn't be a problem with -Postgres, but people seem to think it's hard to install (that's not my -experience on Debian though. Did they ever try themselves, or are they -just repeating what they've heard?) - -#### tmwa-login: -Formerly known as `login-server`. - -User-facing server to deal with account checks. - -Also accepts internal connections from `tmwa-admin` and `tmwa-char`, -subject to a plaintext password (and for `tmwa-admin`, also an IP check). - -#### tmwa-char: -Formerly known as `char-server`. - -User-facing server to deal with character persistence. - -Connects to `tmwa-login`; also takes internal connections from `tmwa-map`. +#### attoconf +- Special: see below -Note that it is fully supported for more than one `tmwa-char` to connect -to the same `tmwa-login`; the client will be presented with a list of -"worlds" before leaving the login server. +### Runtime dependencies +#### glibc +- Depends on what it was built against -#### tmwa-map: -Formerly known as `map-server`. +#### libstdc++ +- Depends on what it was built against -Connects to `tmwa-char`. +### Instructions +#### Configuration +- Run `./configure` to configure the build. Most of the options are similar to GNU Autoconf's configure. For example, you can create a `build` directory and run `../configure` from there to keep the source directory clean. -It is technically possible for more than one `tmwa-map` to connect to -a single tmwa-char, but this is poorly supported by our current config -and moderation tools, and there are likely undiscovered bugs. +#### Build +- Run `make -j$(nproc)` to build the project. -#### About server data: -Just having the binaries is not enough: you also need a complete set of -content: config files, game scripts, savefiles, and client updates. +#### Build test +- Run `make test` to run the build tests. This requires Google Test available - it's added here as a submodule. Note that test coverage is not yet complete. +- Run `make format` to format the code. -A web server to serve the updates is also strongly recommended, as even -developers get annoyed when wushin makes us work straight from his -client-data repo. +#### Install +- Run `make install DESTDIR=/whatever` to install the project. See [what is installed](#what-is-installed) below. -Currently, there is only *one* set of server data that is known to be -compatible with TMWA: https://git.themanaworld.org/legacy/serverdata +#### Install test +- Not implemented -The only recommended way of using this is by following the instructions -in the [How to Develop](https://wiki.themanaworld.org/index.php/Dev:How_to_Develop) article. These instructions are only designed -for people contributing to TMW itself, not to people trying to start -a fork - we know all forks are doomed to be unsuccessful anyway, so -please don't split the development effort, and you can't split the -player community. +#### Distribution tarballs +- Run `make dist` or `make bindist` to create distribution tarballs. -In particular, the instructions do NOT provide information on how to -secure a server by changing all the default passwords. +### Note about attoconf +TMWA's `./configure` script is implemented using a python package called 'attoconf'. It provides a simpler alternative to GNU autoconf. Attoconf is available at [Github](https://github.com/o11c/attoconf/) and is a well-behaving python package. Please note that attoconf requires Python 2.7, however efforts to bring it to Python 3 are in progress. -There are 3 other known sets of complete server data: regional ones -for Germany and Brasil, and Evol. Evol requires their own fork of -the tmwa server (for some reason they don't like me to call it evola), -and nobody seems to know of the foreign servers are keeping active. +### What is installed +#### Overview +Currently, `make install` installs 5 binaries, along with libraries, headers, data files, config files, and debug files. Each component has a specific `make install-something` target. -Note also that The Mana World has not investigated the copyright status -of other sets of server data. +The 4 main programs listed below are typically running on the same machine, but they can be configured to run on different machines in a fast LAN. Please note that the internal protocol between the programs may change without notice, so it's important to upgrade them simultaneously. -## 2. Contributors. +- `tmwa-admin`: Formerly known as `ladmin` ("local"). This tool is used to maintain the server's flatfile "databases". It connects to `tmwa-login` to make changes. +- `tmwa-login`: Formerly known as `login-server`. This server handles account checks and accepts internal connections from `tmwa-admin` and `tmwa-char`. +- `tmwa-char`: Formerly known as `char-server`. This server handles character persistence, connects to `tmwa-login`, and accepts connections from `tmwa-map`. Multiple instances of `tmwa-char` can connect to the same `tmwa-login`. If this is the case, the client will be presented with a choice of worlds before leaving the login server. The Mana World sometimes runs a test `tmwa-char` server connected to the main `tmwa-login` for ease of access. +- `tmwa-map`: Formerly known as `map-server`. This server connects to `tmwa-char`. Multiple instances of `tmwa-map` can connect to the same `tmwa-char`, with clients able to switch servers if they move to a map handled by a different map server. This has not been used by The Mana World, and may not work properly. -You're welcome to help maintain this server, but please make sure to -get in touch with the currently active maintainers first. +#### About server data +To run the server, you will need a complete set of content including config files, game scripts, savefiles, and client updates. We strongly recommend setting up a web server to serve the updates. You can find a compatible set of server data at https://git.themanaworld.org/legacy/serverdata. Please follow the instructions in the [How to Develop](https://wiki.themanaworld.org/index.php/Development:How_to_Develop) article for more information. -Remember that this server is what currently keeps The Mana World alive, -so any changes should be made with extreme care. It is important that -each change be tested and reviewed before it goes live. +## 2. Contributors +We welcome contributions from developers like you! If you are interested in maintaining this server, please get in touch with the currently active maintainers first. It's important to make changes with extreme care and ensure that each change is thoroughly tested and reviewed before it goes live. -Finally, if you got yourself somewhat familiar with this code, please -consider sticking around either to fix further issues as they come up -or to help reviewing changes by others. Thanks! +If you have become familiar with the codebase, we encourage you to stick around and help fix issues or review changes made by others. Your contributions are greatly appreciated! -- cgit v1.2.3-70-g09d2 From 0cf90f7214086928fb05232860f50042af484804 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Fri, 7 Jun 2024 12:54:00 +0000 Subject: README.md: Update to reflect renames Note this is not yet updated to reflect the availability of cmake. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6ec6a58..8947def 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ The rest of this file contains information relevant to distributors and contribu ## 1. Distributors ### Important notes -- Please read [version.make](version.make) for important version information. +- Please read [version.mk](version.mk) for important version information. - TMWA requires git to build by default. Use 'make dist' to get a tarball. ### Platform dependencies -- cgit v1.2.3-70-g09d2 From cc5d5d93a1019e1bfd3b327b896368a6dfd544d8 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Wed, 19 Jun 2024 13:10:38 +0200 Subject: CMake: Added install rules for configuration and data --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 72f0abd..79413ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -176,3 +176,10 @@ install(TARGETS tmwa-login tmwa-char tmwa-map tmwa-admin tmwa-shared RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) + +# Install shared configuration and data +install(FILES etc/tmwa/shared.conf DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/tmwa) +install(FILES share/tmwa/shared.data DESTINATION ${CMAKE_INSTALL_DATADIR}/tmwa) + +# Make sure there is a var directory +install(DIRECTORY DESTINATION ${CMAKE_INSTALL_LOCALSTATEDIR}/tmwa) -- cgit v1.2.3-70-g09d2 From 646fbbbef1f70fec0e1717b7993a4c2b4c5bac2f Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Wed, 17 Jul 2024 10:37:37 +0200 Subject: CMake: Include hpp and tcc files in sources list This shouldn't affect the build, but it does make sure that these header files are recognized as part of the project by IDEs. Also removed 'strtest' from the list since there is no such directory. --- CMakeLists.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 79413ee..16e251c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,11 +50,14 @@ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ) # Search through the tree for sources -# For each subfolder in src, add all .cpp files to a subfolder's SOURCES +# For each subfolder in src, add all .cpp, .hpp and .tcc files to a subfolder's SOURCES # variable. set(ALL_SOURCES "") -foreach(dir admin ast char compat conf generic high ints io login map mmo net proto-base range sexpr shared strings tests wire strtest) - file(GLOB_RECURSE ${dir}_SOURCES CONFIGURE_DEPENDS src/${dir}/*.cpp) +foreach(dir admin ast char compat conf generic high ints io login map mmo net proto-base range sexpr shared strings tests wire) + file(GLOB_RECURSE ${dir}_SOURCES CONFIGURE_DEPENDS + src/${dir}/*.cpp + src/${dir}/*.hpp + src/${dir}/*.tcc) # Exclude any _test.cpp files from the build set(ALL_SOURCES ${ALL_SOURCES} ${${dir}_SOURCES}) list(FILTER ${dir}_SOURCES EXCLUDE REGEX ".*_test.cpp") -- cgit v1.2.3-70-g09d2 From ca2a2a4dd1271541017cd6ab382b671c0c893641 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Tue, 15 Oct 2024 20:44:46 +0200 Subject: Use GIT_SUBMODULE_STRATEGY instead of manual updating This way it also applies to all jobs. --- .gitlab-ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f049110..5bfe6a5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,6 +8,7 @@ variables: &base_vars # Depth of clone. If no tag is made after this many commits, then # the git describe call and version header generation will fail. GIT_DEPTH: 100 # Will break again eventually. + GIT_SUBMODULE_STRATEGY: normal .prerequisites: &prerequisites before_script: @@ -25,7 +26,6 @@ re:ubuntu1804-attoconf:build: INSTALL_PACKAGES: python3 script: - echo "Building TMW Athena $CI_BUILD_NAME" - - git submodule update --init - git fetch -t - printf "Building TMW Athena version %s\n" "$(git describe --tags HEAD)" - mkdir build-atto @@ -47,7 +47,6 @@ re:ubuntu2204-attoconf:build: <<: *base_vars INSTALL_PACKAGES: python3 script: - - git submodule update --init - git fetch -t - printf "Building TMW Athena version %s\n" "$(git describe --tags HEAD)" - mkdir build-atto @@ -69,7 +68,6 @@ re:ubuntu2204:build: <<: *base_vars INSTALL_PACKAGES: python3 cmake script: - - git submodule update --init - git fetch -t - printf "Building TMW Athena version %s\n" "$(git describe --tags HEAD)" - mkdir build-cmake -- cgit v1.2.3-70-g09d2 From 0db9190dd147196531b16a050fb7a019dd1873af Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Wed, 16 Oct 2024 09:59:43 +0200 Subject: CI: Disable 'make test' job for CMake project Tests are not supported by the CMake project for now. --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5bfe6a5..0368723 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -112,7 +112,8 @@ re:ubuntu2204-attoconf:test: - cd build-atto - make test -re:ubuntu2204:test: +# Disabled. Tests are not supported yet by the CMake project. +.re:ubuntu2204:test: <<: *prerequisites stage: test image: ubuntu:22.04 -- cgit v1.2.3-70-g09d2