core: set WeeChat home to empty string by default in CMake and autotools (issue #1285)

This commit is contained in:
Sébastien Helleu 2021-04-18 10:20:42 +02:00
parent e07221d7c5
commit 5361722699
4 changed files with 11 additions and 22 deletions

View File

@ -134,11 +134,8 @@ if(ENABLE_TESTS AND NOT ENABLE_HEADLESS)
endif()
# option WEECHAT_HOME
if(NOT DEFINED WEECHAT_HOME OR "${WEECHAT_HOME}" STREQUAL "")
set(WEECHAT_HOME "~/.weechat")
endif()
set(WEECHAT_HOME "${WEECHAT_HOME}" CACHE
STRING "WeeChat home directory for config, logs, scripts.. (default is \"~/.weechat\")"
STRING "Force a single WeeChat home directory for config, logs, scripts, etc."
FORCE)
mark_as_advanced(CLEAR WEECHAT_HOME)

View File

@ -134,7 +134,7 @@ AH_VERBATIM([PLUGIN_XFER], [#undef PLUGIN_XFER])
AH_VERBATIM([TESTS], [#undef TESTS])
AH_VERBATIM([MAN], [#undef MAN])
AH_VERBATIM([DOC], [#undef DOC])
AH_VERBATIM([WEECHAT_HOME], [#define WEECHAT_HOME "~/.weechat"])
AH_VERBATIM([WEECHAT_HOME], [#define WEECHAT_HOME ""])
AH_VERBATIM([CA_FILE], [#define CA_FILE "/etc/ssl/certs/ca-certificates.crt"])
# Arguments for ./configure
@ -172,12 +172,9 @@ AC_ARG_ENABLE(tests, [ --enable-tests turn on build of tests (d
AC_ARG_ENABLE(man, [ --enable-man turn on build of man page (default=not built)],enable_man=$enableval,enable_man=no)
AC_ARG_ENABLE(doc, [ --enable-doc turn on build of documentation (default=not built)],enable_doc=$enableval,enable_doc=no)
AC_ARG_VAR(WEECHAT_HOME, [WeeChat home directory for config, logs, scripts.. (default is "~/.weechat")])
AC_ARG_VAR(WEECHAT_HOME, [Force a single WeeChat home directory for config, logs, scripts, etc.])
AC_ARG_VAR(CA_FILE, [File containing the certificate authorities (default is "/etc/ssl/certs/ca-certificates.crt"). This is the default value of option "weechat.network.gnutls_ca_file".])
if test "x$WEECHAT_HOME" = "x" ; then
WEECHAT_HOME="~/.weechat"
fi
AC_DEFINE_UNQUOTED(WEECHAT_HOME, "$WEECHAT_HOME")
if test "x$CA_FILE" = "x" ; then
@ -1562,8 +1559,10 @@ if test "x$not_asked" != "x" || test "x$not_found" != "x"; then
fi
echo ""
echo "WeeChat home directory is ${WEECHAT_HOME}"
echo ""
if test "x$WEECHAT_HOME" != "x" ; then
echo "WeeChat home directory is forced by default to: ${WEECHAT_HOME}"
echo ""
fi
eval echo "WeeChat will be installed in $bindir"
echo ""
echo "configure complete, now type 'make' to build WeeChat $VERSION"

View File

@ -591,6 +591,7 @@ void
debug_directories ()
{
char *extra_libdir;
const char *ptr_home = WEECHAT_HOME;
extra_libdir = getenv (WEECHAT_EXTRA_LIBDIR);
@ -601,7 +602,7 @@ debug_directories ()
(weechat_home_temp) ? " " : "",
(weechat_home_temp) ? _("(TEMPORARY, deleted on exit)") : "");
gui_chat_printf (NULL, _(" (default: %s)"),
WEECHAT_HOME);
(ptr_home && ptr_home[0]) ? ptr_home : "~/.weechat");
gui_chat_printf (NULL, " lib: %s", WEECHAT_LIBDIR);
gui_chat_printf (NULL, " lib (extra): %s",
(extra_libdir && extra_libdir[0]) ? extra_libdir : "-");

View File

@ -496,16 +496,8 @@ weechat_create_home_dir ()
if (!weechat_home)
{
config_weechat_home = WEECHAT_HOME;
if (!config_weechat_home[0])
{
string_fprintf (stderr,
_("Error: WEECHAT_HOME is undefined, check build "
"options\n"));
weechat_shutdown (EXIT_FAILURE, 0);
/* make C static analyzer happy (never executed) */
return;
}
weechat_set_home_path (config_weechat_home);
weechat_set_home_path (
(config_weechat_home[0] ? config_weechat_home : "~/.weechat"));
}
/* if home already exists, it has to be a directory */