Project

General

Profile

Feature #393 » 0036-Meson-Add-appimage-option.patch

S3_2 - Marko Lindqvist, 04/01/2024 03:26 PM

View differences:

doc/INSTALL.meson
means that freeciv-web version will be built instead of
the regular server.
appimage (boolean):
Make build suitable for AppImage packaging. This affects paths from
which various resources are looked from, and produces build that
doesn't work outside AppImage.
gen-packets-args (array):
Aditional packet generator arguments passed to common/generate_packets.py.
gen_headers/meson_freeciv_config.h.in
/* Is this freeciv-web instead of regular build */
#mesondefine FREECIV_WEB
/* Is this appimage build instead of regular one */
#mesondefine FREECIV_APPIMAGE
/* Version tag to follow */
#mesondefine FOLLOWTAG
meson.build
emscripten = false
endif
if get_option('appimage')
pub_conf_data.set('FREECIV_APPIMAGE', 1)
endif
# From this, at least the _WIN32_WINNT must be set before
# trying to find the functions.
if host_system == 'windows'
meson_options.txt
value: 'enabled',
description: 'What kind of server should be build, if any')
option('appimage',
type: 'boolean',
value: false,
description: 'Make a build suitable for AppImage packaging')
option('gen-packets-args',
type: 'array',
value: [],
utility/shared.c
if (NULL == data_dir_names) {
const char *path;
#ifdef FREECIV_APPIMAGE
char default_data_path[5000];
fc_snprintf(default_data_path, sizeof(default_data_path),
FREECIV_STORAGE_DIR DIR_SEPARATOR DATASUBDIR
PATH_SEPARATOR
"%s/usr/share/freeciv",
getenv("APPDIR"));
#else /* FREECIV_APPIMAGE */
#define default_data_path DEFAULT_DATA_PATH
#endif /* FREECIV_APPIMAGE */
if ((path = getenv(FREECIV_DATA_PATH)) && '\0' == path[0]) {
/* TRANS: <FREECIV_DATA_PATH> configuration error */
log_error(_("\"%s\" is set but empty; using default \"%s\" "
"data directories instead."),
FREECIV_DATA_PATH, DEFAULT_DATA_PATH);
FREECIV_DATA_PATH, default_data_path);
path = NULL;
}
data_dir_names = base_get_dirs(NULL != path ? path : DEFAULT_DATA_PATH);
data_dir_names = base_get_dirs(NULL != path ? path : default_data_path);
strvec_remove_duplicate(data_dir_names, strcmp); /* Don't set a path both. */
strvec_iterate(data_dir_names, dirname) {
log_verbose("Data path component: %s", dirname);
......
if (NULL == scenario_dir_names) {
const char *path;
#ifdef FREECIV_APPIMAGE
char default_scenario_path[5000];
fc_snprintf(default_scenario_path, sizeof(default_scenario_path),
FREECIV_STORAGE_DIR DIR_SEPARATOR DATASUBDIR DIR_SEPARATOR "scenarios"
PATH_SEPARATOR
FREECIV_STORAGE_DIR DIR_SEPARATOR "scenarios"
PATH_SEPARATOR
"%s/usr/share/freeciv/scenarios",
getenv("APPDIR"));
#else /* FREECIV_APPIMAGE */
#define default_scenario_path DEFAULT_SCENARIO_PATH
#endif /* FREECIV_APPIMAGE */
if ((path = getenv(FREECIV_SCENARIO_PATH)) && '\0' == path[0]) {
/* TRANS: <FREECIV_SCENARIO_PATH> configuration error */
log_error( _("\"%s\" is set but empty; using default \"%s\" "
"scenario directories instead."),
FREECIV_SCENARIO_PATH, DEFAULT_SCENARIO_PATH);
FREECIV_SCENARIO_PATH, default_scenario_path);
path = NULL;
}
scenario_dir_names = base_get_dirs(NULL != path ? path : DEFAULT_SCENARIO_PATH);
scenario_dir_names = base_get_dirs(NULL != path ? path : default_scenario_path);
strvec_remove_duplicate(scenario_dir_names, strcmp); /* Don't set a path both. */
strvec_iterate(scenario_dir_names, dirname) {
log_verbose("Scenario path component: %s", dirname);
(2-2/3)