1+ /*
2+ Copyright (c) 2025, 2026 acrion innovations GmbH
3+ Authors: Stefan Zipproth, s.zipproth@acrion.ch
4+
5+ This file is part of zelph, see https://github.com/acrion/zelph and https://zelph.org
6+
7+ zelph is offered under a commercial and under the AGPL license.
8+ For commercial licensing, contact us at https://acrion.ch/sales. For AGPL licensing, see below.
9+
10+ AGPL licensing:
11+
12+ zelph is free software: you can redistribute it and/or modify
13+ it under the terms of the GNU Affero General Public License as published by
14+ the Free Software Foundation, either version 3 of the License, or
15+ (at your option) any later version.
16+
17+ zelph is distributed in the hope that it will be useful,
18+ but WITHOUT ANY WARRANTY; without even the implied warranty of
19+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+ GNU Affero General Public License for more details.
21+
22+ You should have received a copy of the GNU Affero General Public License
23+ along with zelph. If not, see <https://www.gnu.org/licenses/>.
24+ */
25+
26+ #include " versions.hpp"
27+
28+ #include " interactive.hpp"
29+ #include " script_engine.hpp"
30+
31+ #include < ankerl/unordered_dense.h>
32+ #include < bzlib.h>
33+ #include < capnp/common.h>
34+
35+ #if __has_include(<mimalloc.h>)
36+ #include < mimalloc.h>
37+ #endif
38+
39+ #include < sstream>
40+
41+ namespace zelph
42+ {
43+ std::string get_version_description ()
44+ {
45+ std::ostringstream oss;
46+
47+ // 1. zelph Version
48+ oss << " zelph " << console::Interactive::get_version () << " \n\n " ;
49+
50+ // 2. Third-party software
51+ oss << " zelph incorporates the following third-party software:\n " ;
52+ oss << " ------------------------------------------------------\n " ;
53+
54+ // Janet
55+ oss << " Janet (v" << ScriptEngine::get_janet_version () << " ) - MIT License\n " ;
56+
57+ // unordered_dense
58+ oss << " unordered_dense (v"
59+ << ANKERL_UNORDERED_DENSE_VERSION_MAJOR << " ."
60+ << ANKERL_UNORDERED_DENSE_VERSION_MINOR << " ."
61+ << ANKERL_UNORDERED_DENSE_VERSION_PATCH << " ) - MIT License\n " ;
62+
63+ // Cap'n Proto
64+ oss << " Cap'n Proto (v"
65+ << CAPNP_VERSION_MAJOR << " ."
66+ << CAPNP_VERSION_MINOR << " ."
67+ << CAPNP_VERSION_MICRO << " ) - MIT License\n " ;
68+
69+ // bzip2
70+ std::string bz2_full = BZ2_bzlibVersion ();
71+ size_t bz2_comma_pos = bz2_full.find (' ,' );
72+ std::string bz2_version = (bz2_comma_pos != std::string::npos) ? bz2_full.substr (0 , bz2_comma_pos) : bz2_full;
73+ oss << " bzip2 (v" << bz2_version << " ) - bzip2 License (BSD-style)\n " ;
74+
75+ // mimalloc
76+ #if defined(MI_MALLOC_VERSION)
77+ int mi_major = MI_MALLOC_VERSION / 1000 ;
78+ int mi_minor = (MI_MALLOC_VERSION / 100 ) % 10 ;
79+ int mi_patch = MI_MALLOC_VERSION % 100 ;
80+ oss << " mimalloc (v" << mi_major << " ." << mi_minor << " ." << mi_patch << " ) - MIT License\n " ;
81+ #endif
82+
83+ oss << " ------------------------------------------------------\n " ;
84+ oss << " For full license texts and copyright notices, please refer to the\n " ;
85+ oss << " documentation or the source code repositories." ;
86+
87+ return oss.str ();
88+ }
89+ }
0 commit comments