mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-29 13:58:51 +03:00
Merge pull request #8701 from Kolcha/musl-support
Allow to disable Stacktrace support
This commit is contained in:
commit
7e4b62c68d
9 changed files with 117 additions and 44 deletions
|
@ -43,13 +43,13 @@ option(GUI "Allows to disable GUI for headless running. Disables QtDBus and the
|
||||||
|
|
||||||
option(WEBUI "Allows to disable the WebUI." ON)
|
option(WEBUI "Allows to disable the WebUI." ON)
|
||||||
|
|
||||||
if (WIN32)
|
option(STACKTRACE "Enable stacktrace feature" ON)
|
||||||
option(STACKTRACE_WIN "")
|
|
||||||
else (WIN32)
|
if (UNIX)
|
||||||
cmake_dependent_option(SYSTEMD "Install the systemd service file (headless only)" OFF
|
cmake_dependent_option(SYSTEMD "Install the systemd service file (headless only)" OFF
|
||||||
"NOT GUI" OFF)
|
"NOT GUI" OFF)
|
||||||
cmake_dependent_option(DBUS "Enable use of QtDBus (GUI only)" ON "GUI" OFF)
|
cmake_dependent_option(DBUS "Enable use of QtDBus (GUI only)" ON "GUI" OFF)
|
||||||
endif(WIN32)
|
endif(UNIX)
|
||||||
|
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
44
configure
vendored
44
configure
vendored
|
@ -717,6 +717,7 @@ enable_dependency_tracking
|
||||||
enable_silent_rules
|
enable_silent_rules
|
||||||
with_qtsingleapplication
|
with_qtsingleapplication
|
||||||
enable_debug
|
enable_debug
|
||||||
|
enable_stacktrace
|
||||||
enable_gui
|
enable_gui
|
||||||
enable_systemd
|
enable_systemd
|
||||||
enable_webui
|
enable_webui
|
||||||
|
@ -1382,6 +1383,7 @@ Optional Features:
|
||||||
--enable-silent-rules less verbose build output (undo: "make V=1")
|
--enable-silent-rules less verbose build output (undo: "make V=1")
|
||||||
--disable-silent-rules verbose build output (undo: "make V=0")
|
--disable-silent-rules verbose build output (undo: "make V=0")
|
||||||
--enable-debug Enable debug build
|
--enable-debug Enable debug build
|
||||||
|
--enable-stacktrace Enable stacktrace feature (default=auto)
|
||||||
--disable-gui Disable the GUI for headless running. Disables
|
--disable-gui Disable the GUI for headless running. Disables
|
||||||
QtDBus and the GeoIP Database.
|
QtDBus and the GeoIP Database.
|
||||||
--enable-systemd Install the systemd service file (headless only).
|
--enable-systemd Install the systemd service file (headless only).
|
||||||
|
@ -4189,6 +4191,14 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Check whether --enable-stacktrace was given.
|
||||||
|
if test "${enable_stacktrace+set}" = set; then :
|
||||||
|
enableval=$enable_stacktrace;
|
||||||
|
else
|
||||||
|
enable_stacktrace=auto
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Check whether --enable-gui was given.
|
# Check whether --enable-gui was given.
|
||||||
if test "${enable_gui+set}" = set; then :
|
if test "${enable_gui+set}" = set; then :
|
||||||
enableval=$enable_gui;
|
enableval=$enable_gui;
|
||||||
|
@ -4389,6 +4399,39 @@ $as_echo "$enable_debug" >&6; }
|
||||||
as_fn_error $? "Unknown option \"$enable_debug\". Use either \"yes\" or \"no\"." "$LINENO" 5 ;;
|
as_fn_error $? "Unknown option \"$enable_debug\". Use either \"yes\" or \"no\"." "$LINENO" 5 ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable the stacktrace feature" >&5
|
||||||
|
$as_echo_n "checking whether to enable the stacktrace feature... " >&6; }
|
||||||
|
|
||||||
|
case "x$enable_stacktrace" in #(
|
||||||
|
"xno") :
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||||
|
$as_echo "no" >&6; }
|
||||||
|
QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG stacktrace" ;; #(
|
||||||
|
"xyes") :
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||||
|
$as_echo "yes" >&6; }
|
||||||
|
QBT_ADD_CONFIG="$QBT_ADD_CONFIG stacktrace" ;; #(
|
||||||
|
"xauto") :
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
#include <execinfo.h>
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_cxx_try_compile "$LINENO"; then :
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||||
|
$as_echo "yes" >&6; }
|
||||||
|
QBT_ADD_CONFIG="$QBT_ADD_CONFIG stacktrace"
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||||
|
$as_echo "no" >&6; }
|
||||||
|
QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG stacktrace"
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; #(
|
||||||
|
*) :
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_stacktrace" >&5
|
||||||
|
$as_echo "$enable_stacktrace" >&6; }
|
||||||
|
as_fn_error $? "Unknown option \"$enable_stacktrace\". Use either \"yes\" or \"no\"." "$LINENO" 5 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable the GUI" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable the GUI" >&5
|
||||||
$as_echo_n "checking whether to enable the GUI... " >&6; }
|
$as_echo_n "checking whether to enable the GUI... " >&6; }
|
||||||
case "x$enable_gui" in #(
|
case "x$enable_gui" in #(
|
||||||
|
@ -4636,7 +4679,6 @@ esac
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Check whether --with-boost was given.
|
# Check whether --with-boost was given.
|
||||||
if test "${with_boost+set}" = set; then :
|
if test "${with_boost+set}" = set; then :
|
||||||
withval=$with_boost;
|
withval=$with_boost;
|
||||||
|
|
23
configure.ac
23
configure.ac
|
@ -24,6 +24,12 @@ AC_ARG_ENABLE(debug,
|
||||||
[],
|
[],
|
||||||
[enable_debug=no])
|
[enable_debug=no])
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(stacktrace,
|
||||||
|
[AS_HELP_STRING([--enable-stacktrace],
|
||||||
|
[Enable stacktrace feature (default=auto)])],
|
||||||
|
[],
|
||||||
|
[enable_stacktrace=auto])
|
||||||
|
|
||||||
AC_ARG_ENABLE(gui,
|
AC_ARG_ENABLE(gui,
|
||||||
[AS_HELP_STRING([--disable-gui],
|
[AS_HELP_STRING([--disable-gui],
|
||||||
[Disable the GUI for headless running. Disables QtDBus and the GeoIP Database.])],
|
[Disable the GUI for headless running. Disables QtDBus and the GeoIP Database.])],
|
||||||
|
@ -80,6 +86,23 @@ AS_CASE(["x$enable_debug"],
|
||||||
[AC_MSG_RESULT([$enable_debug])
|
[AC_MSG_RESULT([$enable_debug])
|
||||||
AC_MSG_ERROR([Unknown option "$enable_debug". Use either "yes" or "no".])])
|
AC_MSG_ERROR([Unknown option "$enable_debug". Use either "yes" or "no".])])
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([whether to enable the stacktrace feature])
|
||||||
|
AS_CASE(["x$enable_stacktrace"],
|
||||||
|
["xno"],
|
||||||
|
[AC_MSG_RESULT([no])
|
||||||
|
QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG stacktrace"],
|
||||||
|
["xyes"],
|
||||||
|
[AC_MSG_RESULT([yes])
|
||||||
|
QBT_ADD_CONFIG="$QBT_ADD_CONFIG stacktrace"],
|
||||||
|
["xauto"],
|
||||||
|
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <execinfo.h>]])],
|
||||||
|
[AC_MSG_RESULT([yes])
|
||||||
|
QBT_ADD_CONFIG="$QBT_ADD_CONFIG stacktrace"],
|
||||||
|
[AC_MSG_RESULT([no])
|
||||||
|
QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG stacktrace"])],
|
||||||
|
[AC_MSG_RESULT([$enable_stacktrace])
|
||||||
|
AC_MSG_ERROR([Unknown option "$enable_stacktrace". Use either "yes" or "no".])])
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to enable the GUI])
|
AC_MSG_CHECKING([whether to enable the GUI])
|
||||||
AS_CASE(["x$enable_gui"],
|
AS_CASE(["x$enable_gui"],
|
||||||
["xyes"],
|
["xyes"],
|
||||||
|
|
|
@ -51,9 +51,9 @@ if (NOT WEBUI)
|
||||||
add_definitions(-DDISABLE_WEBUI)
|
add_definitions(-DDISABLE_WEBUI)
|
||||||
endif (NOT WEBUI)
|
endif (NOT WEBUI)
|
||||||
|
|
||||||
if (STACKTRACE_WIN)
|
if (STACKTRACE)
|
||||||
add_definitions(-DSTACKTRACE_WIN)
|
add_definitions(-DSTACKTRACE)
|
||||||
endif(STACKTRACE_WIN)
|
endif(STACKTRACE)
|
||||||
# nogui {
|
# nogui {
|
||||||
# TARGET = qbittorrent-nox
|
# TARGET = qbittorrent-nox
|
||||||
# } else {
|
# } else {
|
||||||
|
|
|
@ -53,16 +53,16 @@ if (WIN32)
|
||||||
list(APPEND QBT_APP_SOURCES ../qbittorrent.exe.manifest)
|
list(APPEND QBT_APP_SOURCES ../qbittorrent.exe.manifest)
|
||||||
endif (WIN32)
|
endif (WIN32)
|
||||||
|
|
||||||
if (UNIX)
|
if (STACKTRACE)
|
||||||
list(APPEND QBT_APP_HEADERS stacktrace.h)
|
if (UNIX)
|
||||||
endif (UNIX)
|
list(APPEND QBT_APP_HEADERS stacktrace.h)
|
||||||
|
else (UNIX)
|
||||||
if (STACKTRACE_WIN)
|
list(APPEND QBT_APP_HEADERS stacktrace_win.h)
|
||||||
list(APPEND QBT_APP_HEADERS stacktrace_win.h)
|
if (GUI)
|
||||||
if (GUI)
|
list(APPEND QBT_APP_HEADERS stacktrace_win_dlg.h)
|
||||||
list(APPEND QBT_APP_HEADERS stacktrace_win_dlg.h)
|
endif (GUI)
|
||||||
endif (GUI)
|
endif (UNIX)
|
||||||
endif (STACKTRACE_WIN)
|
endif (STACKTRACE)
|
||||||
|
|
||||||
# usesystemqtsingleapplication {
|
# usesystemqtsingleapplication {
|
||||||
# nogui {
|
# nogui {
|
||||||
|
|
|
@ -25,12 +25,16 @@ SOURCES += \
|
||||||
$$PWD/filelogger.cpp \
|
$$PWD/filelogger.cpp \
|
||||||
$$PWD/main.cpp
|
$$PWD/main.cpp
|
||||||
|
|
||||||
unix: HEADERS += $$PWD/stacktrace.h
|
stacktrace {
|
||||||
strace_win {
|
unix {
|
||||||
HEADERS += $$PWD/stacktrace_win.h
|
HEADERS += $$PWD/stacktrace.h
|
||||||
!nogui {
|
}
|
||||||
HEADERS += $$PWD/stacktrace_win_dlg.h
|
else {
|
||||||
FORMS += $$PWD/stacktrace_win_dlg.ui
|
HEADERS += $$PWD/stacktrace_win.h
|
||||||
|
!nogui {
|
||||||
|
HEADERS += $$PWD/stacktrace_win_dlg.h
|
||||||
|
FORMS += $$PWD/stacktrace_win_dlg.ui
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,17 +57,15 @@ Q_IMPORT_PLUGIN(QICOPlugin)
|
||||||
#endif
|
#endif
|
||||||
#endif // DISABLE_GUI
|
#endif // DISABLE_GUI
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
|
#ifdef STACKTRACE
|
||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_OS_UNIX
|
||||||
#include <signal.h>
|
|
||||||
#include <execinfo.h>
|
|
||||||
#include "stacktrace.h"
|
#include "stacktrace.h"
|
||||||
#endif // Q_OS_UNIX
|
#else
|
||||||
|
|
||||||
#ifdef STACKTRACE_WIN
|
|
||||||
#include <signal.h>
|
|
||||||
#include "stacktrace_win.h"
|
#include "stacktrace_win.h"
|
||||||
#include "stacktrace_win_dlg.h"
|
#include "stacktrace_win_dlg.h"
|
||||||
#endif //STACKTRACE_WIN
|
#endif // Q_OS_UNIX
|
||||||
|
#endif //STACKTRACE
|
||||||
|
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
#include "base/profile.h"
|
#include "base/profile.h"
|
||||||
|
@ -77,9 +75,10 @@ Q_IMPORT_PLUGIN(QICOPlugin)
|
||||||
#include "upgrade.h"
|
#include "upgrade.h"
|
||||||
|
|
||||||
// Signal handlers
|
// Signal handlers
|
||||||
#if defined(Q_OS_UNIX) || defined(STACKTRACE_WIN)
|
|
||||||
void sigNormalHandler(int signum);
|
void sigNormalHandler(int signum);
|
||||||
|
#ifdef STACKTRACE
|
||||||
void sigAbnormalHandler(int signum);
|
void sigAbnormalHandler(int signum);
|
||||||
|
#endif
|
||||||
// sys_signame[] is only defined in BSD
|
// sys_signame[] is only defined in BSD
|
||||||
const char *sysSigName[] = {
|
const char *sysSigName[] = {
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
|
@ -94,7 +93,6 @@ const char *sysSigName[] = {
|
||||||
"SIGPWR", "SIGUNUSED"
|
"SIGPWR", "SIGUNUSED"
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined Q_OS_WIN && !defined Q_OS_HAIKU
|
#if !defined Q_OS_WIN && !defined Q_OS_HAIKU
|
||||||
void reportToUser(const char* str);
|
void reportToUser(const char* str);
|
||||||
|
@ -255,9 +253,9 @@ int main(int argc, char *argv[])
|
||||||
showSplashScreen();
|
showSplashScreen();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_UNIX) || defined(STACKTRACE_WIN)
|
|
||||||
signal(SIGINT, sigNormalHandler);
|
signal(SIGINT, sigNormalHandler);
|
||||||
signal(SIGTERM, sigNormalHandler);
|
signal(SIGTERM, sigNormalHandler);
|
||||||
|
#ifdef STACKTRACE
|
||||||
signal(SIGABRT, sigAbnormalHandler);
|
signal(SIGABRT, sigAbnormalHandler);
|
||||||
signal(SIGSEGV, sigAbnormalHandler);
|
signal(SIGSEGV, sigAbnormalHandler);
|
||||||
#endif
|
#endif
|
||||||
|
@ -281,7 +279,6 @@ void reportToUser(const char* str)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_UNIX) || defined(STACKTRACE_WIN)
|
|
||||||
void sigNormalHandler(int signum)
|
void sigNormalHandler(int signum)
|
||||||
{
|
{
|
||||||
#if !defined Q_OS_WIN && !defined Q_OS_HAIKU
|
#if !defined Q_OS_WIN && !defined Q_OS_HAIKU
|
||||||
|
@ -295,6 +292,7 @@ void sigNormalHandler(int signum)
|
||||||
qApp->exit(); // unsafe, but exit anyway
|
qApp->exit(); // unsafe, but exit anyway
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef STACKTRACE
|
||||||
void sigAbnormalHandler(int signum)
|
void sigAbnormalHandler(int signum)
|
||||||
{
|
{
|
||||||
const char *sigName = sysSigName[signum];
|
const char *sigName = sysSigName[signum];
|
||||||
|
@ -307,16 +305,18 @@ void sigAbnormalHandler(int signum)
|
||||||
reportToUser(sigName);
|
reportToUser(sigName);
|
||||||
reportToUser("\n");
|
reportToUser("\n");
|
||||||
print_stacktrace(); // unsafe
|
print_stacktrace(); // unsafe
|
||||||
#endif // !defined Q_OS_WIN && !defined Q_OS_HAIKU
|
#endif
|
||||||
#ifdef STACKTRACE_WIN
|
|
||||||
|
#if defined Q_OS_WIN
|
||||||
StraceDlg dlg; // unsafe
|
StraceDlg dlg; // unsafe
|
||||||
dlg.setStacktraceString(QLatin1String(sigName), straceWin::getBacktrace());
|
dlg.setStacktraceString(QLatin1String(sigName), straceWin::getBacktrace());
|
||||||
dlg.exec();
|
dlg.exec();
|
||||||
#endif // STACKTRACE_WIN
|
#endif
|
||||||
|
|
||||||
signal(signum, SIG_DFL);
|
signal(signum, SIG_DFL);
|
||||||
raise(signum);
|
raise(signum);
|
||||||
}
|
}
|
||||||
#endif // defined(Q_OS_UNIX) || defined(STACKTRACE_WIN)
|
#endif // STACKTRACE
|
||||||
|
|
||||||
#if !defined(DISABLE_GUI)
|
#if !defined(DISABLE_GUI)
|
||||||
void showSplashScreen()
|
void showSplashScreen()
|
||||||
|
|
12
src/src.pro
12
src/src.pro
|
@ -33,13 +33,17 @@ nogui {
|
||||||
LIBS += -lobjc
|
LIBS += -lobjc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nowebui {
|
nowebui {
|
||||||
DEFINES += DISABLE_WEBUI
|
DEFINES += DISABLE_WEBUI
|
||||||
}
|
}
|
||||||
strace_win {
|
|
||||||
DEFINES += STACKTRACE_WIN
|
stacktrace {
|
||||||
DEFINES += STACKTRACE_WIN_PROJECT_PATH=$$PWD
|
DEFINES += STACKTRACE
|
||||||
DEFINES += STACKTRACE_WIN_MAKEFILE_PATH=$$OUT_PWD
|
win32 {
|
||||||
|
DEFINES += STACKTRACE_WIN_PROJECT_PATH=$$PWD
|
||||||
|
DEFINES += STACKTRACE_WIN_MAKEFILE_PATH=$$OUT_PWD
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CONFIG(debug, debug|release): message(Project is built in DEBUG mode.)
|
CONFIG(debug, debug|release): message(Project is built in DEBUG mode.)
|
||||||
|
|
|
@ -55,7 +55,7 @@ else {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Stack trace support can be enabled in 'conf.pri'
|
# Stack trace support can be enabled in 'conf.pri'
|
||||||
strace_win {
|
stacktrace {
|
||||||
win32-g++* {
|
win32-g++* {
|
||||||
contains(QMAKE_HOST.arch, x86) {
|
contains(QMAKE_HOST.arch, x86) {
|
||||||
# i686 arch requires frame pointer preservation
|
# i686 arch requires frame pointer preservation
|
||||||
|
|
Loading…
Reference in a new issue