This commit is contained in:
Alexandre Jörgensen 2025-11-04 16:39:28 +01:00
parent 8365ae1c10
commit cf91c6b139
5 changed files with 22 additions and 23 deletions

View file

@ -224,7 +224,8 @@ endforeach()
# CRASHPAD
################################################################
if (ENABLE_CRASH_HANDLER)
# In a first time, set-up only crashpad for Windows and Linux
if (ENABLE_CRASH_HANDLER AND NOT APPLE) # TODO : peut-être que windows
find_package(Python3 REQUIRED)
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
@ -264,24 +265,10 @@ if (ENABLE_CRASH_HANDLER)
# Sync crashpad repo content with gclient
##########################################
# set(GCLIENT_SPEC "solutions = [{\\\"name\\\": \\\"crashpad\\\", \\\"url\\\": \\\"https://chromium.googlesource.com/crashpad/crashpad\\\", \\\"managed\\\": False}]")
# execute_process(
# COMMAND "${CMAKE_BINARY_DIR}/depot_tools/gclient" config "--spec=${GCLIENT_SPEC}"
# ENVIRONMENT "PATH=${CMAKE_BINARY_DIR}/depot_tools:$ENV{PATH}"
# WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
# RESULT_VARIABLE gclient_config_result
# OUTPUT_VARIABLE gclient_config_output
# ERROR_VARIABLE gclient_config_error
# )
# if(gclient_config_result)
# message(FATAL_ERROR "Failed configuring crashpad with gclient: ${gclient_config_result} ${gclient_config_output} ${gclient_config_error}")
# endif()
# --- Write a .gclient file directly (avoid gclient config quoting issues) ---
set(GCLIENT_CONTENT "solutions = [{\"name\": \"crashpad\", \"url\": \"https://chromium.googlesource.com/crashpad/crashpad\", \"managed\": False}]")
file(WRITE "${CMAKE_BINARY_DIR}/.gclient" "${GCLIENT_CONTENT}\n")
message(STATUS "Wrote ${CMAKE_BINARY_DIR}/.gclient with content:\n${GCLIENT_CONTENT}")
message(STATUS "Wrote ${CMAKE_BINARY_DIR}/.gclient file")
execute_process(
COMMAND "${DEPOT_TOOLS_DIR}/gclient" sync --nohooks --shallow
@ -331,7 +318,6 @@ if (ENABLE_CRASH_HANDLER)
execute_process(
# COMMAND ${CMAKE_BINARY_DIR}/gn/out/gn gen -C out
COMMAND ${CMAKE_BINARY_DIR}/gn/out/gn gen out
# ENVIRONMENT "PATH=${CMAKE_BINARY_DIR}/depot_tools:$ENV{PATH}"
RESULT_VARIABLE crashpad_gen_result
OUTPUT_VARIABLE crashpad_gen_output
ERROR_VARIABLE crashpad_gen_error
@ -345,8 +331,7 @@ if (ENABLE_CRASH_HANDLER)
# Build crashpad client
##########################################
execute_process(
COMMAND ninja -C out
# ENVIRONMENT "PATH=${CMAKE_BINARY_DIR}/depot_tools:$ENV{PATH}"
COMMAND ninja -C out # Target install ?
RESULT_VARIABLE crashpad_build_result
OUTPUT_VARIABLE crashpad_build_output
ERROR_VARIABLE crashpad_build_error

View file

@ -139,6 +139,10 @@ static inline QString getAppPackagePluginsDirPath() {
return getAppPackageDir().absolutePath() + Constants::PathPlugins;
}
static inline QString getAppBinDirPath() {
return getAppPackageDir().absolutePath() + Constants::PathBin;
}
static inline QString getAppAssistantConfigDirPath() {
return getAppPackageDataDirPath() + Constants::PathAssistantConfig;
}
@ -342,6 +346,10 @@ QString Paths::getZrtpSecretsFilePath() {
Constants::PathZrtpSecrets);
}
QString Paths::getCrashpadHandlerBinFilePath() {
return getAppBinDirPath() + Constants::PathCrashpadHandler;
}
// -----------------------------------------------------------------------------
void Paths::migrate() {

View file

@ -57,6 +57,7 @@ QString getToolsDirPath();
QString getUserCertificatesDirPath();
QString getZrtpDataFilePath();
QString getZrtpSecretsFilePath();
QString getCrashpadHandlerBinFilePath();
void migrate();
} // namespace Paths

View file

@ -69,11 +69,12 @@ int main(int argc, char *argv[]) {
lDebug() << "[Main] Creating application";
auto app = QSharedPointer<App>::create(argc, argv);
#ifndef APPLE // In a first time, set-up only crashpad for Windows and Linux
// Set up Crashpad
std::vector<std::string> arguments;
base::FilePath handler_path("/home/parallels/Projects/linphone-desktop/build/" // TODO change this
"crashpad/out/crashpad_handler");
base::FilePath handler_path(
Utils::appStringToCoreString(Paths::getCrashpadHandlerBinFilePath())); // Aller le chercher dans bin
base::FilePath database_path(Utils::appStringToCoreString(Paths::getLogsDirPath()));
base::FilePath metrics_path(Utils::appStringToCoreString(Paths::getMetricsDirPath()));
@ -82,14 +83,15 @@ int main(int argc, char *argv[]) {
annotations["version"] = (Utils::appStringToCoreString(app->getShortApplicationVersion()));
crashpad::CrashpadClient crashpad_client;
if (!crashpad_client.StartHandler(handler_path, database_path, metrics_path,
"https://files.linphone.org:443/http-file-transfer-server/hft.php", annotations,
if (!crashpad_client.StartHandler(handler_path, database_path, metrics_path, Constants::DefaultUploadLogsServer,
annotations, // TODO use core->getLogCollectionUploadServerUrl
arguments, true, true, {})) {
lWarning() << "Failed to start Crashpad handler. Crashes will not be logged.";
} else {
lDebug() << "Started Crashpad handler";
}
// End set up crashpad
#endif
#ifdef ACCESSBILITY_WORKAROUND
QAccessible::installUpdateHandler(DummyUpdateHandler);

View file

@ -153,9 +153,12 @@ public:
static constexpr char PathPlugins[] = "/plugins/";
#endif
static constexpr char PathPluginsApp[] = "app/";
static constexpr char PathBin[] = "/bin/";
static constexpr char PathSounds[] = "/sounds/linphone";
static constexpr char PathUserCertificates[] = "/usr-crt/";
static constexpr char PathCrashpadHandler[] = "crashpad_handler";
static constexpr char PathCallHistoryList[] = "/call-history.db";
static constexpr char PathConfig[] = "/linphonerc";
static constexpr char PathDatabase[] = "/linphone.db";