Remove dependency on SDL from wesnothd
This commit is contained in:
parent
78d51032e4
commit
879ab58e39
6 changed files with 45 additions and 43 deletions
27
SConstruct
27
SConstruct
|
@ -347,28 +347,28 @@ if env["prereqs"]:
|
|||
if env['sdl2']:
|
||||
def have_sdl_net():
|
||||
return \
|
||||
conf.CheckSDL(require_version = '2.0.0')
|
||||
conf.CheckSDL(require_version = '2.0.0') & \
|
||||
conf.CheckSDL("SDL2_net", header_file = "SDL_net")
|
||||
|
||||
def have_sdl_other():
|
||||
return \
|
||||
conf.CheckSDL(require_version = '2.0.0') & \
|
||||
conf.CheckSDL("SDL2_ttf", header_file = "SDL_ttf") & \
|
||||
conf.CheckSDL("SDL2_mixer", header_file = "SDL_mixer") & \
|
||||
conf.CheckSDL("SDL2_image", header_file = "SDL_image") & \
|
||||
conf.CheckSDL("SDL2_net", header_file = "SDL_net")
|
||||
conf.CheckSDL("SDL2_image", header_file = "SDL_image")
|
||||
|
||||
else:
|
||||
def have_sdl_net():
|
||||
return \
|
||||
conf.CheckSDL(require_version = '1.2.10')
|
||||
conf.CheckSDL(require_version = '1.2.10') & \
|
||||
conf.CheckSDL('SDL_net')
|
||||
|
||||
def have_sdl_other():
|
||||
return \
|
||||
conf.CheckSDL(require_version = '1.2.10') & \
|
||||
conf.CheckSDL("SDL_ttf", require_version = "2.0.8") & \
|
||||
conf.CheckSDL("SDL_mixer", require_version = '1.2.12') & \
|
||||
conf.CheckSDL("SDL_image", require_version = '1.2.0') & \
|
||||
conf.CheckSDL('SDL_net')
|
||||
conf.CheckSDL("SDL_image", require_version = '1.2.0')
|
||||
|
||||
if env["libintl"]:
|
||||
def have_i18n_prereqs():
|
||||
|
@ -379,7 +379,6 @@ if env["prereqs"]:
|
|||
|
||||
have_server_prereqs = (\
|
||||
conf.CheckCPlusPlus(gcc_version = "3.3") & \
|
||||
have_sdl_net() & \
|
||||
conf.CheckBoost("iostreams", require_version = "1.34.1") & \
|
||||
conf.CheckBoostIostreamsGZip() & \
|
||||
conf.CheckBoostIostreamsBZip2() & \
|
||||
|
@ -392,7 +391,13 @@ if env["prereqs"]:
|
|||
or Warning("WARN: Base prerequisites are not met")
|
||||
|
||||
env = conf.Finish()
|
||||
client_env = env.Clone()
|
||||
|
||||
campaignd_env = env.Clone()
|
||||
conf = campaignd_env.Configure(**configure_args)
|
||||
have_sdl_net()
|
||||
campaignd_env = conf.Finish()
|
||||
|
||||
client_env = campaignd_env.Clone()
|
||||
conf = client_env.Configure(**configure_args)
|
||||
have_client_prereqs = have_server_prereqs & have_sdl_other() & \
|
||||
conf.CheckLib("vorbisfile") & \
|
||||
|
@ -482,7 +487,7 @@ if not env['nls']:
|
|||
#
|
||||
print "---[applying configuration]---"
|
||||
|
||||
for env in [test_env, client_env, env]:
|
||||
for env in [test_env, campaignd_env, client_env, env]:
|
||||
build_root="#/"
|
||||
if os.path.isabs(env["build_dir"]):
|
||||
build_root = ""
|
||||
|
@ -545,7 +550,7 @@ try:
|
|||
except:
|
||||
pass
|
||||
|
||||
Export(Split("env client_env test_env have_client_prereqs have_server_prereqs have_test_prereqs"))
|
||||
Export(Split("env campaignd_env client_env test_env have_client_prereqs have_server_prereqs have_test_prereqs"))
|
||||
SConscript(dirs = Split("po doc packaging/windows packaging/systemd"))
|
||||
|
||||
binaries = Split("wesnoth wesnothd cutter exploder campaignd test")
|
||||
|
@ -559,7 +564,7 @@ builds = {
|
|||
builds["glibcxx_debug"].update(builds["debug"])
|
||||
build = env["build"]
|
||||
|
||||
for env in [test_env, client_env, env]:
|
||||
for env in [test_env, campaignd_env, client_env, env]:
|
||||
env["extra_flags_glibcxx_debug"] = env["extra_flags_debug"]
|
||||
env.AppendUnique(**builds[build])
|
||||
env.Append(CXXFLAGS = Split(os.environ.get('CXXFLAGS', [])), LINKFLAGS = Split(os.environ.get('LDFLAGS', [])))
|
||||
|
|
|
@ -6,7 +6,7 @@ from glob import glob
|
|||
|
||||
Import("*")
|
||||
|
||||
for env in [test_env, client_env, env]:
|
||||
for env in [test_env, campaignd_env, client_env, env]:
|
||||
env.Append(CPPDEFINES = "$EXTRA_DEFINE")
|
||||
|
||||
#color_range.cpp should be removed, but game_config depends on it.
|
||||
|
@ -40,10 +40,10 @@ libwesnoth_core_sources = Split("""
|
|||
tools/schema/tag.cpp
|
||||
""")
|
||||
|
||||
libwesnoth_core_sources.extend(env.Object("network_worker.cpp", EXTRA_DEFINE = env['raw_sockets'] and "NETWORK_USE_RAW_SOCKETS" or None))
|
||||
libwesnoth_core_sources.extend(campaignd_env.Object("network_worker.cpp", EXTRA_DEFINE = env['raw_sockets'] and "NETWORK_USE_RAW_SOCKETS" or None))
|
||||
|
||||
game_config_env = env.Clone()
|
||||
filesystem_env = env.Clone()
|
||||
game_config_env = campaignd_env.Clone()
|
||||
filesystem_env = campaignd_env.Clone()
|
||||
if env["PLATFORM"] != "win32":
|
||||
game_config_env.Append(CPPDEFINES = "WESNOTH_PATH='\"$datadir\"'")
|
||||
if env['localedirname']:
|
||||
|
@ -78,7 +78,7 @@ else:
|
|||
filesystem_env.Object("gettext_boost.cpp")
|
||||
])
|
||||
|
||||
libwesnoth_core = [env.Library("wesnoth_core", libwesnoth_core_sources)]
|
||||
libwesnoth_core = [campaignd_env.Library("wesnoth_core", libwesnoth_core_sources)]
|
||||
|
||||
libwesnoth_sources = Split("""
|
||||
arrow.cpp
|
||||
|
@ -150,11 +150,11 @@ libwesnoth_sources = Split("""
|
|||
|
||||
libwesnoth = client_env.Library("wesnoth", libwesnoth_sources)
|
||||
|
||||
libwesnothd_sources = Split("""
|
||||
dummy_video_sources = Split("""
|
||||
loadscreen_empty.cpp
|
||||
tools/dummy_video.cpp
|
||||
""")
|
||||
libwesnothd = env.Library("wesnothd", libwesnothd_sources)
|
||||
libdummy_video = campaignd_env.Library("dummy_video", dummy_video_sources)
|
||||
|
||||
libcampaignd_sources = Split("""
|
||||
addon/validation.cpp
|
||||
|
@ -665,7 +665,7 @@ def WesnothProgram(env, target, source, can_build, **kw):
|
|||
locals()[target] = bin
|
||||
Export(target)
|
||||
|
||||
for env in [test_env, client_env, env]:
|
||||
for env in [test_env, campaignd_env, client_env, env]:
|
||||
env.AddMethod(WesnothProgram)
|
||||
|
||||
wesnoth_objects = ["wesnoth.cpp", libwesnoth_extras, libwesnoth_core, libwesnoth,
|
||||
|
@ -681,15 +681,14 @@ campaignd_sources = Split("""
|
|||
""")
|
||||
|
||||
if env["PLATFORM"] == "win32": env["fifodir"] = ""
|
||||
campaignd_sources.extend(env.Object("campaign_server/campaign_server.cpp", EXTRA_DEFINE = env['fifodir'] and "FIFODIR='\"$fifodir\"'" or None))
|
||||
campaignd_sources.extend(campaignd_env.Object("campaign_server/campaign_server.cpp", EXTRA_DEFINE = env['fifodir'] and "FIFODIR='\"$fifodir\"'" or None))
|
||||
|
||||
env.WesnothProgram("campaignd", campaignd_sources + [libwesnoth_core, libwesnothd, libcampaignd], have_server_prereqs)
|
||||
campaignd_env.WesnothProgram("campaignd", campaignd_sources + [libwesnoth_core, libdummy_video, libcampaignd], have_server_prereqs)
|
||||
|
||||
wesnothd_sources = Split("""
|
||||
server/ban.cpp
|
||||
server/forum_user_handler.cpp
|
||||
server/game.cpp
|
||||
server/input_stream.cpp
|
||||
server/metrics.cpp
|
||||
server/player.cpp
|
||||
server/player_network.cpp
|
||||
|
@ -701,25 +700,25 @@ wesnothd_sources = Split("""
|
|||
""")
|
||||
wesnothd_sources.extend(env.Object("server/server.cpp", EXTRA_DEFINE = env['fifodir'] and "FIFODIR='\"$fifodir\"'" or None))
|
||||
|
||||
env.WesnothProgram("wesnothd", wesnothd_sources + [libwesnoth_core, libwesnothd, env["wesnothd_res"]], have_server_prereqs)
|
||||
env.WesnothProgram("wesnothd", wesnothd_sources + [libwesnoth_core, env["wesnothd_res"]], have_server_prereqs)
|
||||
|
||||
cutter_sources = Split("""
|
||||
tools/cutter.cpp
|
||||
""")
|
||||
client_env.WesnothProgram("cutter", cutter_sources + [libcutter, libwesnoth_core, libwesnoth_sdl, libwesnothd, libwesnoth], have_client_prereqs, LIBS = ["$LIBS", "png"])
|
||||
client_env.WesnothProgram("cutter", cutter_sources + [libcutter, libwesnoth_core, libwesnoth_sdl, libdummy_video, libwesnoth], have_client_prereqs, LIBS = ["$LIBS", "png"])
|
||||
|
||||
exploder_sources = Split("""
|
||||
tools/exploder.cpp
|
||||
tools/exploder_composer.cpp
|
||||
""")
|
||||
client_env.WesnothProgram("exploder", exploder_sources + [libcutter, libwesnoth_core, libwesnoth_sdl, libwesnothd, libwesnoth], have_client_prereqs, LIBS = ["$LIBS", "png"])
|
||||
client_env.WesnothProgram("exploder", exploder_sources + [libcutter, libwesnoth_core, libwesnoth_sdl, libdummy_video, libwesnoth], have_client_prereqs, LIBS = ["$LIBS", "png"])
|
||||
|
||||
schema_generator_sources = Split("""
|
||||
tools/schema/schema_generator.cpp
|
||||
tools/schema/sourceparser.cpp
|
||||
tools/schema/error_container.cpp
|
||||
""")
|
||||
client_env.WesnothProgram("schema_generator", schema_generator_sources + [libwesnoth_core, libwesnothd], have_client_prereqs)
|
||||
client_env.WesnothProgram("schema_generator", schema_generator_sources + [libwesnoth_core, libdummy_video], have_client_prereqs)
|
||||
|
||||
test_utils_sources = Split("""
|
||||
tests/utils/game_config_manager.cpp
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
#include "config.hpp"
|
||||
#include "log.hpp"
|
||||
#include "filesystem.hpp"
|
||||
#include "serialization/parser.hpp"
|
||||
#include "serialization/binary_or_text.hpp"
|
||||
#include "serialization/string_utils.hpp"
|
||||
|
@ -261,12 +260,12 @@ static lg::log_domain log_server("server");
|
|||
|
||||
void ban_manager::read()
|
||||
{
|
||||
if (filename_.empty() || !filesystem::file_exists(filename_))
|
||||
//if (filename_.empty() || !filesystem::file_exists(filename_))
|
||||
return;
|
||||
LOG_SERVER << "Reading bans from " << filename_ << "\n";
|
||||
config cfg;
|
||||
filesystem::scoped_istream ban_file = filesystem::istream_file(filename_);
|
||||
read_gz(cfg, *ban_file);
|
||||
//filesystem::scoped_istream ban_file = filesystem::istream_file(filename_);
|
||||
//read_gz(cfg, *ban_file);
|
||||
|
||||
BOOST_FOREACH(const config &b, cfg.child_range("ban"))
|
||||
{
|
||||
|
@ -319,9 +318,9 @@ static lg::log_domain log_server("server");
|
|||
(*itor)->write(child);
|
||||
}
|
||||
|
||||
filesystem::scoped_ostream ban_file = filesystem::ostream_file(filename_);
|
||||
/*filesystem::scoped_ostream ban_file = filesystem::ostream_file(filename_);
|
||||
config_writer writer(*ban_file, true);
|
||||
writer.write(cfg);
|
||||
writer.write(cfg);*/
|
||||
}
|
||||
|
||||
bool ban_manager::parse_time(const std::string& duration, time_t* time) const
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
#include "../global.hpp"
|
||||
|
||||
#include "../filesystem.hpp"
|
||||
#include "../game_config.hpp" // game_config::observer_team_name
|
||||
#include "../log.hpp"
|
||||
|
||||
|
@ -1640,12 +1639,13 @@ void game::save_replay() {
|
|||
std::replace(filename.begin(), filename.end(), ' ', '_');
|
||||
filename.erase(std::remove_if(filename.begin(), filename.end(), is_invalid_filename_char), filename.end());
|
||||
DBG_GAME << "saving replay: " << filename << std::endl;
|
||||
filesystem::scoped_ostream os(filesystem::ostream_file(replay_save_path_ + filename));
|
||||
/*filesystem::scoped_ostream os(filesystem::ostream_file(replay_save_path_ + filename));
|
||||
(*os) << replay.output_compressed(true);
|
||||
|
||||
if (!os->good()) {
|
||||
ERR_GAME << "Could not save replay! (" << filename << ")" << std::endl;
|
||||
}
|
||||
*/
|
||||
} catch (simple_wml::error& e) {
|
||||
WRN_CONFIG << __func__ << ": simple_wml error: " << e.message << std::endl;
|
||||
}
|
||||
|
|
|
@ -25,9 +25,7 @@
|
|||
#include "../game_config.hpp"
|
||||
#include "../log.hpp"
|
||||
#include "../map.hpp" // gamemap::MAX_PLAYERS
|
||||
#include "../filesystem.hpp"
|
||||
#include "../multiplayer_error_codes.hpp"
|
||||
#include "../serialization/parser.hpp"
|
||||
#include "../serialization/preprocessor.hpp"
|
||||
#include "../serialization/string_utils.hpp"
|
||||
#include "../serialization/unicode.hpp"
|
||||
|
@ -419,7 +417,6 @@ server::server(int port, bool keep_alive, const std::string& config_file, size_t
|
|||
user_handler_(NULL),
|
||||
games_(),
|
||||
room_list_(player_connections_),
|
||||
input_(),
|
||||
input_path_(),
|
||||
config_file_(config_file),
|
||||
cfg_(read_config()),
|
||||
|
@ -568,6 +565,7 @@ void async_send_warning(socket_ptr socket, const std::string& msg, const char* w
|
|||
|
||||
config server::read_config() const {
|
||||
config configuration;
|
||||
/*
|
||||
if (config_file_ == "") return configuration;
|
||||
try {
|
||||
filesystem::scoped_istream stream = preprocess_file(config_file_);
|
||||
|
@ -578,6 +576,7 @@ config server::read_config() const {
|
|||
ERR_CONFIG << "ERROR: Could not read configuration file: '"
|
||||
<< config_file_ << "': '" << e.message << "'.\n";
|
||||
}
|
||||
*/
|
||||
return configuration;
|
||||
}
|
||||
|
||||
|
@ -597,15 +596,15 @@ void server::load_config() {
|
|||
#endif
|
||||
const std::string fifo_path = (cfg_["fifo_path"].empty() ? std::string(FIFODIR) + "/socket" : std::string(cfg_["fifo_path"]));
|
||||
// Reset (replace) the input stream only if the FIFO path changed.
|
||||
if(fifo_path != input_path_) {
|
||||
/*if(fifo_path != input_path_) {
|
||||
input_.reset(new input_stream(fifo_path));
|
||||
}
|
||||
input_path_ = fifo_path;
|
||||
input_path_ = fifo_path;*/
|
||||
|
||||
save_replays_ = cfg_["save_replays"].to_bool();
|
||||
replay_save_path_ = cfg_["replay_save_path"].str();
|
||||
|
||||
tor_ip_list_ = utils::split(cfg_["tor_ip_list_path"].empty() ? "" : filesystem::read_file(cfg_["tor_ip_list_path"]), '\n');
|
||||
tor_ip_list_ = utils::split(cfg_["tor_ip_list_path"].empty() ? "" : ""/*filesystem::read_file(cfg_["tor_ip_list_path"])*/, '\n');
|
||||
|
||||
admin_passwd_ = cfg_["passwd"].str();
|
||||
motd_ = cfg_["motd"].str();
|
||||
|
@ -2176,7 +2175,7 @@ void server::restart_handler(const std::string& issuer_name, const std::string&
|
|||
graceful_restart = true;
|
||||
// stop listening socket
|
||||
// TODO: Shutdown
|
||||
input_.reset();
|
||||
//input_.reset();
|
||||
// start new server
|
||||
start_new_server();
|
||||
process_command("msg The server has been restarted. You may finish current games but can't start new ones and new players can't join this (old) server instance. (So if a player of your game disconnects you have to save, reconnect and reload the game on the new server instance. It is actually recommended to do that right away.)", issuer_name);
|
||||
|
@ -3542,7 +3541,7 @@ int main(int argc, char** argv) {
|
|||
std::string config_file;
|
||||
|
||||
// setting path to currentworking directory
|
||||
game_config::path = filesystem::get_cwd();
|
||||
game_config::path = ""/*filesystem::get_cwd()*/;
|
||||
|
||||
// show 'info' by default
|
||||
lg::set_log_domain_severity("server", lg::info);
|
||||
|
|
|
@ -121,7 +121,7 @@ private:
|
|||
RoomList room_list_;
|
||||
|
||||
/** server socket/fifo. */
|
||||
boost::scoped_ptr<input_stream> input_;
|
||||
//boost::scoped_ptr<input_stream> input_;
|
||||
std::string input_path_;
|
||||
|
||||
const std::string config_file_;
|
||||
|
|
Loading…
Add table
Reference in a new issue