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 --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'configure') 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 # -- 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(-) (limited to 'configure') 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 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(-) (limited to 'configure') 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 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(-) (limited to 'configure') 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