From 312e4d37cc964bbc5bd4e20fd25500b08dc70268 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Wed, 9 Apr 2014 00:35:55 -0700 Subject: Add @source command to help modified verions satisfy the AGPL --- COPYING | 3 +++ README | 3 +++ src/conf/version.hpp | 7 +++++-- src/map/atcommand.cpp | 21 +++++++++++++++++++++ src/map/pc.cpp | 8 ++++++++ src/mmo/version.cpp | 17 +++++++---------- version.make | 39 +++++++++++++++++++++++++++++++++++---- 7 files changed, 82 insertions(+), 16 deletions(-) diff --git a/COPYING b/COPYING index 70323b9..95e03e3 100644 --- a/COPYING +++ b/COPYING @@ -4,6 +4,9 @@ This software is available under a combination of GPL3+ and AGPL3+. 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. + History: Originally, tmwAthena was forked from eAthena in 2004. diff --git a/README b/README index 9f29971..8a8a2d9 100644 --- a/README +++ b/README @@ -39,6 +39,9 @@ exception, I always tell the content devs who also idle there. 1. Distributors. # random not-quite-YAML +Important notes: + - Go read version.make + - TMWA requires git to build by default, use 'make dist' to get a tarball. platform dependencies: architecture: tested: x86 and (finally!) amd64; possibly x32 diff --git a/src/conf/version.hpp b/src/conf/version.hpp index ab7a3d5..8dd31ed 100644 --- a/src/conf/version.hpp +++ b/src/conf/version.hpp @@ -9,7 +9,10 @@ # include "conf-raw/int-VERSION_PATCH.h" # include "conf-raw/int-VERSION_DEVEL.h" -# include "conf-raw/str-VENDOR.h" -# include "conf-raw/int-VENDOR_VERSION.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" #endif // TMWA_CONF_VERSION_HPP diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp index 78a50ab..4b07a52 100644 --- a/src/map/atcommand.cpp +++ b/src/map/atcommand.cpp @@ -4,6 +4,8 @@ #include #include +#include "../conf/version.hpp" + #include "../compat/nullpo.hpp" #include "../compat/fun.hpp" @@ -4888,6 +4890,22 @@ ATCE atcommand_doomspot(Session *s, dumb_ptr sd, return ATCE::OKAY; } +static +ATCE atcommand_source(Session *s, dumb_ptr, + ZString) +{ + clif_displaymessage(s, + "This server code consists of Free Software under GPL3&AGPL3"); + clif_displaymessage(s, + "This is commit " VERSION_HASH ", also known as " VERSION_FULL); + clif_displaymessage(s, + "The version is " VERSION_STRING); + clif_displaymessage(s, + "For source, see " VENDOR_SOURCE); + + return ATCE::OKAY; +} + // declared extern above @@ -5310,4 +5328,7 @@ Map atcommand_info = {"doomspot", {"", 60, atcommand_doomspot, "Kill all players on the same tile"}}, + {"source", {"", + 0, atcommand_source, + "Legal information about source code (must be a level 0 command!)"}}, }; diff --git a/src/map/pc.cpp b/src/map/pc.cpp index 7077b44..fa633b8 100644 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -789,6 +789,14 @@ int pc_authok(int id, int login_id2, TimeT connect_until_time, // this is far from the only such thing, but most of the others are logs void pc_show_motd(dumb_ptr sd) { + // Attention all forks: DO NOT REMOVE THIS NOTICE. + // It exists to meet legal requirements. + // + // If you remove the sending of this message, + // the license does not permit you to publicly use this software. + + clif_displaymessage(sd->sess, "This server is Free Software, for details type @source in chat or use the tmwa-source tool"); + sd->state.seen_motd = true; io::ReadFile in(motd_txt); if (in.is_open()) diff --git a/src/mmo/version.cpp b/src/mmo/version.cpp index dd18fe1..6f42f11 100644 --- a/src/mmo/version.cpp +++ b/src/mmo/version.cpp @@ -14,7 +14,7 @@ Version CURRENT_VERSION = VERSION_DEVEL, 0, 0, - VENDOR_VERSION, + VENDOR_POINT, }; Version CURRENT_LOGIN_SERVER_VERSION = { @@ -22,7 +22,7 @@ Version CURRENT_LOGIN_SERVER_VERSION = VERSION_DEVEL, 0, TMWA_SERVER_LOGIN, - VENDOR_VERSION, + VENDOR_POINT, }; Version CURRENT_CHAR_SERVER_VERSION = { @@ -30,7 +30,7 @@ Version CURRENT_CHAR_SERVER_VERSION = VERSION_DEVEL, 0, TMWA_SERVER_CHAR | TMWA_SERVER_INTER, - VENDOR_VERSION, + VENDOR_POINT, }; Version CURRENT_MAP_SERVER_VERSION = { @@ -38,18 +38,15 @@ Version CURRENT_MAP_SERVER_VERSION = VERSION_DEVEL, 0, TMWA_SERVER_MAP, - VENDOR_VERSION, + VENDOR_POINT, }; -#define S2(a) #a -#define S(a) S2(a) - -const char CURRENT_VERSION_STRING[] = "TMWA " - S(VERSION_MAJOR) "." S(VERSION_MINOR) "." S(VERSION_PATCH) - " dev" S(VERSION_DEVEL) " (" VENDOR " " S(VENDOR_VERSION) ")"; +const char CURRENT_VERSION_STRING[] = VERSION_STRING; bool extract(XString str, Version *vers) { *vers = {}; + // TODO should I try to extract dev and vend also? + // It would've been useful during the magic migration. return extract(str, record<'.'>(&vers->major, &vers->minor, &vers->patch)); } diff --git a/version.make b/version.make index 7ceea82..f7d5511 100644 --- a/version.make +++ b/version.make @@ -1,7 +1,11 @@ +# These lines are automatically replaced in tarballs generated by 'make dist' 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}) @@ -9,8 +13,35 @@ VERSION_DEVEL := $(word 4,${version_bits}) ifeq "${VERSION_DEVEL}" "" VERSION_DEVEL := 0 endif -# tracking dirty trees is more trouble than it's worth -#VERSION_FULL += $(shell cd ${SRC_DIR}; git diff --quiet HEAD || echo dirty) -VENDOR := Vanilla -VENDOR_VERSION := 0 + + +# 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: + @echo version '${VERSION_STRING}' + @echo based on commit ${VERSION_FULL} aka ${VERSION_HASH} + @echo source ${VENDOR_SOURCE} -- cgit v1.2.3-60-g2f50