From 9fa32d834408c1b899626a79b239f3f80658f2ba Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Sat, 17 Dec 2022 22:30:13 -0500
Subject: [PATCH] Use crashpad on linux and update sentry to 0.5.3

---
 autobuild.xml                      | 12 ++++++------
 indra/cmake/Copy3rdPartyLibs.cmake |  4 ++++
 indra/cmake/Sentry.cmake           |  3 +--
 indra/newview/llappviewerlinux.cpp |  3 +++
 indra/newview/viewer_manifest.py   | 18 ++++++++++++++++++
 5 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/autobuild.xml b/autobuild.xml
index 6685b0ff258..07fd1dc20d3 100644
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -1994,11 +1994,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>f5681cad63d011ed1bad37ca72cea58d153b858927d2b74808de06c94a363ac853016a8f8fbdccc04f341b6aeadf7ef417d256ed46038e3943f4c61729127b0f</string>
+              <string>4059aaff847174e3be09e877334c77e98d5e2f606eeef4ab2c5f83b8863795663d7fc5f7ef29e9e4219f613b5cf00ed1ef47cfb03a8024b2a526c919ccbc7d07</string>
               <key>hash_algorithm</key>
               <string>blake2b</string>
               <key>url</key>
-              <string>https://git.alchemyviewer.org/api/v4/projects/164/packages/generic/sentry/7.31.3-0.5.2.1740/sentry-7.31.3-0.5.2-darwin64-1740.tar.zst</string>
+              <string>https://git.alchemyviewer.org/api/v4/projects/164/packages/generic/sentry/7.31.3-0.5.2.1789/sentry-7.31.3-0.5.2-darwin64-1789.tar.zst</string>
             </map>
             <key>name</key>
             <string>darwin64</string>
@@ -2008,11 +2008,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>7536b86455efe0176150082ec4f931d7e16ca0b5fab0a28d4d017d50a9327e58e30d5a947816f325a39580f8930af00fb9c28e5449844128f4238591192487b7</string>
+              <string>861adfdf3fd98b09720f562c8e2e7aa9e819245c3bbf6585743516dbc1ac954a6102eb58522f4a0acaee22069dbe06ce40cb0f7de5d5d7b120c756ff9ac4a5d3</string>
               <key>hash_algorithm</key>
               <string>blake2b</string>
               <key>url</key>
-              <string>https://git.alchemyviewer.org/api/v4/projects/164/packages/generic/sentry/7.31.3-0.5.2.1740/sentry-7.31.3-0.5.2-linux64-1740.tar.zst</string>
+              <string>https://git.alchemyviewer.org/api/v4/projects/164/packages/generic/sentry/7.31.3-0.5.2.1789/sentry-7.31.3-0.5.2-linux64-1789.tar.zst</string>
             </map>
             <key>name</key>
             <string>linux64</string>
@@ -2022,11 +2022,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>5aa22a78081626e935f7f6220b5e16ab80880ac8e0b043904c1878ce53227f7be7cca1657e5904ad10e5d2c3f82adc532b15c16a49bb9050dd35f6264889457c</string>
+              <string>d3e280fe277d3fe928f6da83b381a2a025979bebf4dc4972f0d1bad84e2ea367b2d33e4210fba1d820d31b2b599498492514f40aa5ea85a66c446f64e5c02ee7</string>
               <key>hash_algorithm</key>
               <string>blake2b</string>
               <key>url</key>
-              <string>https://git.alchemyviewer.org/api/v4/projects/164/packages/generic/sentry/7.31.3-0.5.2.1740/sentry-7.31.3-0.5.2-windows64-1740.tar.zst</string>
+              <string>https://git.alchemyviewer.org/api/v4/projects/164/packages/generic/sentry/7.31.3-0.5.2.1789/sentry-7.31.3-0.5.2-windows64-1789.tar.zst</string>
             </map>
             <key>name</key>
             <string>windows64</string>
diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake
index ea7052ea87a..b9c99f09d2a 100644
--- a/indra/cmake/Copy3rdPartyLibs.cmake
+++ b/indra/cmake/Copy3rdPartyLibs.cmake
@@ -256,6 +256,10 @@ elseif(LINUX)
         libjpeg.so.8.2.2
        )
 
+    if (USE_SENTRY)
+      list(APPEND release_files libsentry.so)
+    endif ()
+
     if (USE_FMODSTUDIO)
       list(APPEND debug_files libfmodL.so)
       list(APPEND release_files libfmod.so)
diff --git a/indra/cmake/Sentry.cmake b/indra/cmake/Sentry.cmake
index d76d47fb648..7354cfb8b33 100644
--- a/indra/cmake/Sentry.cmake
+++ b/indra/cmake/Sentry.cmake
@@ -18,8 +18,7 @@ if (USE_SENTRY)
             include(OpenSSL)
             include(ZLIBNG)
             set(SENTRY_LIBRARIES 
-                ${ARCH_PREBUILT_DIRS_RELEASE}/libsentry.a
-                ${ARCH_PREBUILT_DIRS_RELEASE}/libbreakpad_client.a
+                ${ARCH_PREBUILT_DIRS_RELEASE}/libsentry.so
                 ${CURL_LIBRARIES}
                 ${NGHTTP2_LIBRARIES}
                 ${OPENSSL_LIBRARIES}
diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp
index 7a8ecb0ada1..9d41463e5bf 100644
--- a/indra/newview/llappviewerlinux.cpp
+++ b/indra/newview/llappviewerlinux.cpp
@@ -364,6 +364,9 @@ void LLAppViewerLinux::initCrashReporting(bool reportFreeze)
 	sentry_options_set_dsn(options, SENTRY_DSN);
 	sentry_options_set_release(options, LL_VIEWER_CHANNEL_AND_VERSION);
 
+	std::string crashpad_path = gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE, "crashpad_handler");
+	sentry_options_set_handler_pathw(options, crashpad_path.c_str());
+
 	std::string database_path = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "sentry");
 	sentry_options_set_database_path(options, database_path.c_str());
 
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 5c4f6b1ab9e..12c2b62105f 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -1224,12 +1224,21 @@ def construct(self):
             if self.args['fmodstudio'] == 'ON' or self.args['fmodstudio'] == 'TRUE':
                 self.path("libfmod.so*")
 
+            # Sentry
+            if self.args['sentry'] == 'ON' or self.args['sentry'] == 'TRUE':
+                self.path("libsentry.so")
+
             if self.args['discord'] == 'ON' or self.args['discord'] == 'TRUE':
                 self.path("libdiscord_game_sdk.so")
 
         # Vivox runtimes
         with self.prefix(src=os.path.join(pkgdir, 'bin', 'release'), dst="bin"):
             self.path("SLVoice")
+
+            # Sentry
+            if self.args['sentry'] == 'ON' or self.args['sentry'] == 'TRUE':
+                self.path("crashpad_handler")
+
         with self.prefix(src=relpkgdir, dst="lib"):
             self.path("libortp.so")
             self.path("libsndfile.so.1")
@@ -1265,12 +1274,21 @@ def construct(self):
             if self.args['fmodstudio'] == 'ON' or self.args['fmodstudio'] == 'TRUE':
                 self.path("libfmod.so*")
 
+            # Sentry
+            if self.args['sentry'] == 'ON' or self.args['sentry'] == 'TRUE':
+                self.path("libsentry.so")
+
             if self.args['discord'] == 'ON' or self.args['discord'] == 'TRUE':
                 self.path("libdiscord_game_sdk.so")
 
         # Vivox runtimes
         with self.prefix(src=os.path.join(pkgdir, 'bin', 'release'), dst="bin"):
             self.path("SLVoice")
+
+            # Sentry
+            if self.args['sentry'] == 'ON' or self.args['sentry'] == 'TRUE':
+                self.path("crashpad_handler")
+
         with self.prefix(src=relpkgdir, dst="lib"):
             self.path("libortp.so")
             self.path("libsndfile.so.1")
-- 
GitLab