mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-21 08:09:35 +08:00
Merge pull request #8701 from Kolcha/musl-support
Allow to disable Stacktrace support
This commit is contained in:
commit
7e4b62c68d
@ -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)
|
||||
|
||||
if (WIN32)
|
||||
option(STACKTRACE_WIN "")
|
||||
else (WIN32)
|
||||
option(STACKTRACE "Enable stacktrace feature" ON)
|
||||
|
||||
if (UNIX)
|
||||
cmake_dependent_option(SYSTEMD "Install the systemd service file (headless only)" OFF
|
||||
"NOT GUI" OFF)
|
||||
cmake_dependent_option(DBUS "Enable use of QtDBus (GUI only)" ON "GUI" OFF)
|
||||
endif(WIN32)
|
||||
endif(UNIX)
|
||||
|
||||
|
||||
add_subdirectory(src)
|
||||
|
44
configure
vendored
44
configure
vendored
@ -717,6 +717,7 @@ enable_dependency_tracking
|
||||
enable_silent_rules
|
||||
with_qtsingleapplication
|
||||
enable_debug
|
||||
enable_stacktrace
|
||||
enable_gui
|
||||
enable_systemd
|
||||
enable_webui
|
||||
@ -1382,6 +1383,7 @@ Optional Features:
|
||||
--enable-silent-rules less verbose build output (undo: "make V=1")
|
||||
--disable-silent-rules verbose build output (undo: "make V=0")
|
||||
--enable-debug Enable debug build
|
||||
--enable-stacktrace Enable stacktrace feature (default=auto)
|
||||
--disable-gui Disable the GUI for headless running. Disables
|
||||
QtDBus and the GeoIP Database.
|
||||
--enable-systemd Install the systemd service file (headless only).
|
||||
@ -4189,6 +4191,14 @@ else
|
||||
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.
|
||||
if test "${enable_gui+set}" = set; then :
|
||||
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 ;;
|
||||
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_n "checking whether to enable the GUI... " >&6; }
|
||||
case "x$enable_gui" in #(
|
||||
@ -4636,7 +4679,6 @@ esac
|
||||
|
||||
|
||||
|
||||
|
||||
# Check whether --with-boost was given.
|
||||
if test "${with_boost+set}" = set; then :
|
||||
withval=$with_boost;
|
||||
|
23
configure.ac
23
configure.ac
@ -24,6 +24,12 @@ AC_ARG_ENABLE(debug,
|
||||
[],
|
||||
[enable_debug=no])
|
||||
|
||||
AC_ARG_ENABLE(stacktrace,
|
||||
[AS_HELP_STRING([--enable-stacktrace],
|
||||
[Enable stacktrace feature (default=auto)])],
|
||||
[],
|
||||
[enable_stacktrace=auto])
|
||||
|
||||
AC_ARG_ENABLE(gui,
|
||||
[AS_HELP_STRING([--disable-gui],
|
||||
[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_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])
|
||||
AS_CASE(["x$enable_gui"],
|
||||
["xyes"],
|
||||
|
@ -51,9 +51,9 @@ if (NOT WEBUI)
|
||||
add_definitions(-DDISABLE_WEBUI)
|
||||
endif (NOT WEBUI)
|
||||
|
||||
if (STACKTRACE_WIN)
|
||||
add_definitions(-DSTACKTRACE_WIN)
|
||||
endif(STACKTRACE_WIN)
|
||||
if (STACKTRACE)
|
||||
add_definitions(-DSTACKTRACE)
|
||||
endif(STACKTRACE)
|
||||
# nogui {
|
||||
# TARGET = qbittorrent-nox
|
||||
# } else {
|
||||
|
@ -53,16 +53,16 @@ if (WIN32)
|
||||
list(APPEND QBT_APP_SOURCES ../qbittorrent.exe.manifest)
|
||||
endif (WIN32)
|
||||
|
||||
if (UNIX)
|
||||
list(APPEND QBT_APP_HEADERS stacktrace.h)
|
||||
endif (UNIX)
|
||||
|
||||
if (STACKTRACE_WIN)
|
||||
list(APPEND QBT_APP_HEADERS stacktrace_win.h)
|
||||
if (GUI)
|
||||
list(APPEND QBT_APP_HEADERS stacktrace_win_dlg.h)
|
||||
endif (GUI)
|
||||
endif (STACKTRACE_WIN)
|
||||
if (STACKTRACE)
|
||||
if (UNIX)
|
||||
list(APPEND QBT_APP_HEADERS stacktrace.h)
|
||||
else (UNIX)
|
||||
list(APPEND QBT_APP_HEADERS stacktrace_win.h)
|
||||
if (GUI)
|
||||
list(APPEND QBT_APP_HEADERS stacktrace_win_dlg.h)
|
||||
endif (GUI)
|
||||
endif (UNIX)
|
||||
endif (STACKTRACE)
|
||||
|
||||
# usesystemqtsingleapplication {
|
||||
# nogui {
|
||||
|
@ -25,12 +25,16 @@ SOURCES += \
|
||||
$$PWD/filelogger.cpp \
|
||||
$$PWD/main.cpp
|
||||
|
||||
unix: HEADERS += $$PWD/stacktrace.h
|
||||
strace_win {
|
||||
HEADERS += $$PWD/stacktrace_win.h
|
||||
!nogui {
|
||||
HEADERS += $$PWD/stacktrace_win_dlg.h
|
||||
FORMS += $$PWD/stacktrace_win_dlg.ui
|
||||
stacktrace {
|
||||
unix {
|
||||
HEADERS += $$PWD/stacktrace.h
|
||||
}
|
||||
else {
|
||||
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 // DISABLE_GUI
|
||||
|
||||
#include <signal.h>
|
||||
#ifdef STACKTRACE
|
||||
#ifdef Q_OS_UNIX
|
||||
#include <signal.h>
|
||||
#include <execinfo.h>
|
||||
#include "stacktrace.h"
|
||||
#endif // Q_OS_UNIX
|
||||
|
||||
#ifdef STACKTRACE_WIN
|
||||
#include <signal.h>
|
||||
#else
|
||||
#include "stacktrace_win.h"
|
||||
#include "stacktrace_win_dlg.h"
|
||||
#endif //STACKTRACE_WIN
|
||||
#endif // Q_OS_UNIX
|
||||
#endif //STACKTRACE
|
||||
|
||||
#include "application.h"
|
||||
#include "base/profile.h"
|
||||
@ -77,9 +75,10 @@ Q_IMPORT_PLUGIN(QICOPlugin)
|
||||
#include "upgrade.h"
|
||||
|
||||
// Signal handlers
|
||||
#if defined(Q_OS_UNIX) || defined(STACKTRACE_WIN)
|
||||
void sigNormalHandler(int signum);
|
||||
#ifdef STACKTRACE
|
||||
void sigAbnormalHandler(int signum);
|
||||
#endif
|
||||
// sys_signame[] is only defined in BSD
|
||||
const char *sysSigName[] = {
|
||||
#if defined(Q_OS_WIN)
|
||||
@ -94,7 +93,6 @@ const char *sysSigName[] = {
|
||||
"SIGPWR", "SIGUNUSED"
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
#if !defined Q_OS_WIN && !defined Q_OS_HAIKU
|
||||
void reportToUser(const char* str);
|
||||
@ -255,9 +253,9 @@ int main(int argc, char *argv[])
|
||||
showSplashScreen();
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_UNIX) || defined(STACKTRACE_WIN)
|
||||
signal(SIGINT, sigNormalHandler);
|
||||
signal(SIGTERM, sigNormalHandler);
|
||||
#ifdef STACKTRACE
|
||||
signal(SIGABRT, sigAbnormalHandler);
|
||||
signal(SIGSEGV, sigAbnormalHandler);
|
||||
#endif
|
||||
@ -281,7 +279,6 @@ void reportToUser(const char* str)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_UNIX) || defined(STACKTRACE_WIN)
|
||||
void sigNormalHandler(int signum)
|
||||
{
|
||||
#if !defined Q_OS_WIN && !defined Q_OS_HAIKU
|
||||
@ -295,6 +292,7 @@ void sigNormalHandler(int signum)
|
||||
qApp->exit(); // unsafe, but exit anyway
|
||||
}
|
||||
|
||||
#ifdef STACKTRACE
|
||||
void sigAbnormalHandler(int signum)
|
||||
{
|
||||
const char *sigName = sysSigName[signum];
|
||||
@ -307,16 +305,18 @@ void sigAbnormalHandler(int signum)
|
||||
reportToUser(sigName);
|
||||
reportToUser("\n");
|
||||
print_stacktrace(); // unsafe
|
||||
#endif // !defined Q_OS_WIN && !defined Q_OS_HAIKU
|
||||
#ifdef STACKTRACE_WIN
|
||||
#endif
|
||||
|
||||
#if defined Q_OS_WIN
|
||||
StraceDlg dlg; // unsafe
|
||||
dlg.setStacktraceString(QLatin1String(sigName), straceWin::getBacktrace());
|
||||
dlg.exec();
|
||||
#endif // STACKTRACE_WIN
|
||||
#endif
|
||||
|
||||
signal(signum, SIG_DFL);
|
||||
raise(signum);
|
||||
}
|
||||
#endif // defined(Q_OS_UNIX) || defined(STACKTRACE_WIN)
|
||||
#endif // STACKTRACE
|
||||
|
||||
#if !defined(DISABLE_GUI)
|
||||
void showSplashScreen()
|
||||
|
12
src/src.pro
12
src/src.pro
@ -33,13 +33,17 @@ nogui {
|
||||
LIBS += -lobjc
|
||||
}
|
||||
}
|
||||
|
||||
nowebui {
|
||||
DEFINES += DISABLE_WEBUI
|
||||
}
|
||||
strace_win {
|
||||
DEFINES += STACKTRACE_WIN
|
||||
DEFINES += STACKTRACE_WIN_PROJECT_PATH=$$PWD
|
||||
DEFINES += STACKTRACE_WIN_MAKEFILE_PATH=$$OUT_PWD
|
||||
|
||||
stacktrace {
|
||||
DEFINES += STACKTRACE
|
||||
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.)
|
||||
|
@ -55,7 +55,7 @@ else {
|
||||
}
|
||||
|
||||
# Stack trace support can be enabled in 'conf.pri'
|
||||
strace_win {
|
||||
stacktrace {
|
||||
win32-g++* {
|
||||
contains(QMAKE_HOST.arch, x86) {
|
||||
# i686 arch requires frame pointer preservation
|
||||
|
Loading…
Reference in New Issue
Block a user