aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/cmake/DBusGlib.cmake4
-rw-r--r--linden/indra/newview/CMakeLists.txt1
-rwxr-xr-xlinden/indra/newview/linux_tools/handle_secondlifeprotocol.sh6
-rw-r--r--linden/indra/newview/llappviewerlinux.cpp58
-rw-r--r--linden/indra/newview/llappviewerlinux_api.xml14
-rw-r--r--linden/indra/newview/llappviewerlinux_api_dbus.cpp132
-rw-r--r--linden/indra/newview/llappviewerlinux_api_dbus.h50
-rw-r--r--linden/indra/newview/llappviewerlinux_api_dbus_syms_raw.inc9
8 files changed, 15 insertions, 259 deletions
diff --git a/linden/indra/cmake/DBusGlib.cmake b/linden/indra/cmake/DBusGlib.cmake
index cfc4ccd..dfda0ad 100644
--- a/linden/indra/cmake/DBusGlib.cmake
+++ b/linden/indra/cmake/DBusGlib.cmake
@@ -12,9 +12,9 @@ elseif (LINUX)
12 set(DBUSGLIB_INCLUDE_DIRS 12 set(DBUSGLIB_INCLUDE_DIRS
13 ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/glib-2.0 13 ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/glib-2.0
14 ) 14 )
15 # We don't need to explicitly link against dbus-glib itself, because 15
16 # the viewer probes for the system's copy at runtime.
17 set(DBUSGLIB_LIBRARIES 16 set(DBUSGLIB_LIBRARIES
17 dbus-glib-1
18 gobject-2.0 18 gobject-2.0
19 glib-2.0 19 glib-2.0
20 ) 20 )
diff --git a/linden/indra/newview/CMakeLists.txt b/linden/indra/newview/CMakeLists.txt
index d5b50cf..f522f44 100644
--- a/linden/indra/newview/CMakeLists.txt
+++ b/linden/indra/newview/CMakeLists.txt
@@ -939,7 +939,6 @@ endif (DARWIN)
939 939
940if (LINUX) 940if (LINUX)
941 LIST(APPEND viewer_SOURCE_FILES llappviewerlinux.cpp) 941 LIST(APPEND viewer_SOURCE_FILES llappviewerlinux.cpp)
942 LIST(APPEND viewer_SOURCE_FILES llappviewerlinux_api_dbus.cpp)
943 LIST(APPEND CMAKE_EXE_LINKER_FLAGS -Wl,--as-needed) 942 LIST(APPEND CMAKE_EXE_LINKER_FLAGS -Wl,--as-needed)
944 943
945 set(viewer_LIBRARIES 944 set(viewer_LIBRARIES
diff --git a/linden/indra/newview/linux_tools/handle_secondlifeprotocol.sh b/linden/indra/newview/linux_tools/handle_secondlifeprotocol.sh
index 3613070..422d4dd 100755
--- a/linden/indra/newview/linux_tools/handle_secondlifeprotocol.sh
+++ b/linden/indra/newview/linux_tools/handle_secondlifeprotocol.sh
@@ -13,5 +13,7 @@ fi
13RUN_PATH=`dirname "$0" || echo .` 13RUN_PATH=`dirname "$0" || echo .`
14cd "${RUN_PATH}" 14cd "${RUN_PATH}"
15 15
16exec ./imprudence -url \'"${URL}"\' 16#yeah, why just send a dbus message if we can spawn a whole new instance of the viewer just for sending the message?
17 17#exec ./imprudence -url \'"${URL}"\'
18#</sarcasm>
19exec dbus-send --type=method_call --dest=com.secondlife.ViewerAppAPIService /com/secondlife/ViewerAppAPI com.secondlife.ViewerAppAPI.GoSLURL string:"$1"
diff --git a/linden/indra/newview/llappviewerlinux.cpp b/linden/indra/newview/llappviewerlinux.cpp
index 4956e9d..d2ed5d2 100644
--- a/linden/indra/newview/llappviewerlinux.cpp
+++ b/linden/indra/newview/llappviewerlinux.cpp
@@ -64,14 +64,7 @@
64#endif 64#endif
65 65
66#if LL_DBUS_ENABLED 66#if LL_DBUS_ENABLED
67# include "llappviewerlinux_api_dbus.h" 67#include "llappviewerlinux_api.h"
68
69// regrettable hacks to give us better runtime compatibility with older systems inside llappviewerlinux_api.h:
70#define llg_return_if_fail(COND) do{if (!(COND)) return;}while(0)
71#undef g_return_if_fail
72#define g_return_if_fail(COND) llg_return_if_fail(COND)
73// The generated API
74# include "llappviewerlinux_api.h"
75#endif 68#endif
76 69
77namespace 70namespace
@@ -372,29 +365,6 @@ static void viewerappapi_class_init(ViewerAppAPIClass *klass);
372 365
373/// 366///
374 367
375// regrettable hacks to give us better runtime compatibility with older systems in general
376static GType llg_type_register_static_simple_ONCE(GType parent_type,
377 const gchar *type_name,
378 guint class_size,
379 GClassInitFunc class_init,
380 guint instance_size,
381 GInstanceInitFunc instance_init,
382 GTypeFlags flags)
383{
384 static GTypeInfo type_info;
385 memset(&type_info, 0, sizeof(type_info));
386
387 type_info.class_size = class_size;
388 type_info.class_init = class_init;
389 type_info.instance_size = instance_size;
390 type_info.instance_init = instance_init;
391
392 return g_type_register_static(parent_type, type_name, &type_info, flags);
393}
394#define llg_intern_static_string(S) (S)
395#define g_intern_static_string(S) llg_intern_static_string(S)
396#define g_type_register_static_simple(parent_type, type_name, class_size, class_init, instance_size, instance_init, flags) llg_type_register_static_simple_ONCE(parent_type, type_name, class_size, class_init, instance_size, instance_init, flags)
397
398G_DEFINE_TYPE(ViewerAppAPI, viewerappapi, G_TYPE_OBJECT); 368G_DEFINE_TYPE(ViewerAppAPI, viewerappapi, G_TYPE_OBJECT);
399 369
400void viewerappapi_class_init(ViewerAppAPIClass *klass) 370void viewerappapi_class_init(ViewerAppAPIClass *klass)
@@ -411,18 +381,18 @@ void viewerappapi_init(ViewerAppAPI *server)
411 { 381 {
412 GError *error = NULL; 382 GError *error = NULL;
413 383
414 server->connection = lldbus_g_bus_get(DBUS_BUS_SESSION, &error); 384 server->connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
415 if (server->connection) 385 if (server->connection)
416 { 386 {
417 lldbus_g_object_type_install_info(viewerappapi_get_type(), &dbus_glib_viewerapp_object_info); 387 dbus_g_object_type_install_info(viewerappapi_get_type(), &dbus_glib_viewerapp_object_info);
418 388
419 lldbus_g_connection_register_g_object(server->connection, VIEWERAPI_PATH, G_OBJECT(server)); 389 dbus_g_connection_register_g_object(server->connection, VIEWERAPI_PATH, G_OBJECT(server));
420 390
421 DBusGProxy *serverproxy = lldbus_g_proxy_new_for_name(server->connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); 391 DBusGProxy *serverproxy = dbus_g_proxy_new_for_name(server->connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
422 392
423 guint request_name_ret_unused; 393 guint request_name_ret_unused;
424 // akin to org_freedesktop_DBus_request_name 394 // akin to org_freedesktop_DBus_request_name
425 if (lldbus_g_proxy_call(serverproxy, "RequestName", &error, G_TYPE_STRING, VIEWERAPI_SERVICE, G_TYPE_UINT, 0, G_TYPE_INVALID, G_TYPE_UINT, &request_name_ret_unused, G_TYPE_INVALID)) 395 if (dbus_g_proxy_call(serverproxy, "RequestName", &error, G_TYPE_STRING, VIEWERAPI_SERVICE, G_TYPE_UINT, 0, G_TYPE_INVALID, G_TYPE_UINT, &request_name_ret_unused, G_TYPE_INVALID))
426 { 396 {
427 // total success. 397 // total success.
428 dbus_server_init = true; 398 dbus_server_init = true;
@@ -472,11 +442,6 @@ gboolean viewer_app_api_GoSLURL(ViewerAppAPI *obj, gchar *slurl, gboolean **succ
472//virtual 442//virtual
473bool LLAppViewerLinux::initSLURLHandler() 443bool LLAppViewerLinux::initSLURLHandler()
474{ 444{
475 if (!grab_dbus_syms(DBUSGLIB_DYLIB_DEFAULT_NAME))
476 {
477 return false; // failed
478 }
479
480 g_type_init(); 445 g_type_init();
481 446
482 //ViewerAppAPI *api_server = (ViewerAppAPI*) 447 //ViewerAppAPI *api_server = (ViewerAppAPI*)
@@ -488,25 +453,20 @@ bool LLAppViewerLinux::initSLURLHandler()
488//virtual 453//virtual
489bool LLAppViewerLinux::sendURLToOtherInstance(const std::string& url) 454bool LLAppViewerLinux::sendURLToOtherInstance(const std::string& url)
490{ 455{
491 if (!grab_dbus_syms(DBUSGLIB_DYLIB_DEFAULT_NAME))
492 {
493 return false; // failed
494 }
495
496 bool success = false; 456 bool success = false;
497 DBusGConnection *bus; 457 DBusGConnection *bus;
498 GError *error = NULL; 458 GError *error = NULL;
499 459
500 g_type_init(); 460 g_type_init();
501 461
502 bus = lldbus_g_bus_get (DBUS_BUS_SESSION, &error); 462 bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
503 if (bus) 463 if (bus)
504 { 464 {
505 gboolean rtn = FALSE; 465 gboolean rtn = FALSE;
506 DBusGProxy *remote_object = 466 DBusGProxy *remote_object =
507 lldbus_g_proxy_new_for_name(bus, VIEWERAPI_SERVICE, VIEWERAPI_PATH, VIEWERAPI_INTERFACE); 467 dbus_g_proxy_new_for_name(bus, VIEWERAPI_SERVICE, VIEWERAPI_PATH, VIEWERAPI_INTERFACE);
508 468
509 if (lldbus_g_proxy_call(remote_object, "GoSLURL", &error, 469 if (dbus_g_proxy_call(remote_object, "GoSLURL", &error,
510 G_TYPE_STRING, url.c_str(), G_TYPE_INVALID, 470 G_TYPE_STRING, url.c_str(), G_TYPE_INVALID,
511 G_TYPE_BOOLEAN, &rtn, G_TYPE_INVALID)) 471 G_TYPE_BOOLEAN, &rtn, G_TYPE_INVALID))
512 { 472 {
diff --git a/linden/indra/newview/llappviewerlinux_api.xml b/linden/indra/newview/llappviewerlinux_api.xml
deleted file mode 100644
index fac35b7..0000000
--- a/linden/indra/newview/llappviewerlinux_api.xml
+++ /dev/null
@@ -1,14 +0,0 @@
1<?xml version="1.0" encoding="UTF-8" ?>
2
3<!-- dbus-binding-tool -mode=glib-server llappviewerlinux_api.xml -prefix=viewerapp -output=llappviewerlinux_api.h -->
4
5<node name="/com/secondlife/ViewerAppAPI">
6 <interface name="com.secondlife.ViewerAppAPI">
7 <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="viewer_app_api"/>
8 <method name="GoSLURL">
9 <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="viewer_app_api_GoSLURL"/>
10 <arg type="s" name="slurl" direction="in" />
11 <arg type="b" name="success_ret" direction="out" />
12 </method>
13 </interface>
14</node>
diff --git a/linden/indra/newview/llappviewerlinux_api_dbus.cpp b/linden/indra/newview/llappviewerlinux_api_dbus.cpp
deleted file mode 100644
index ee160d0..0000000
--- a/linden/indra/newview/llappviewerlinux_api_dbus.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
1/**
2 * @file llappviewerlinux_api_dbus.cpp
3 * @brief dynamic DBus symbol-grabbing code
4 *
5 * $LicenseInfo:firstyear=2008&license=viewergpl$
6 *
7 * Copyright (c) 2008-2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#if LL_DBUS_ENABLED
34
35#include "linden_common.h"
36
37extern "C" {
38#include <dbus/dbus-glib.h>
39
40#include "apr_pools.h"
41#include "apr_dso.h"
42}
43
44#define DEBUGMSG(...) lldebugs << llformat(__VA_ARGS__) << llendl
45#define INFOMSG(...) llinfos << llformat(__VA_ARGS__) << llendl
46#define WARNMSG(...) llwarns << llformat(__VA_ARGS__) << llendl
47
48#define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) RTN (*ll##DBUSSYM)(__VA_ARGS__) = NULL
49#include "llappviewerlinux_api_dbus_syms_raw.inc"
50#undef LL_DBUS_SYM
51
52static bool sSymsGrabbed = false;
53static apr_pool_t *sSymDBUSDSOMemoryPool = NULL;
54static apr_dso_handle_t *sSymDBUSDSOHandleG = NULL;
55
56bool grab_dbus_syms(std::string dbus_dso_name)
57{
58 if (sSymsGrabbed)
59 {
60 // already have grabbed good syms
61 return TRUE;
62 }
63
64 bool sym_error = false;
65 bool rtn = false;
66 apr_status_t rv;
67 apr_dso_handle_t *sSymDBUSDSOHandle = NULL;
68
69#define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) do{rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll##DBUSSYM, sSymDBUSDSOHandle, #DBUSSYM); if (rv != APR_SUCCESS) {INFOMSG("Failed to grab symbol: %s", #DBUSSYM); if (REQUIRED) sym_error = true;} else DEBUGMSG("grabbed symbol: %s from %p", #DBUSSYM, (void*)ll##DBUSSYM);}while(0)
70
71 //attempt to load the shared library
72 apr_pool_create(&sSymDBUSDSOMemoryPool, NULL);
73
74 if ( APR_SUCCESS == (rv = apr_dso_load(&sSymDBUSDSOHandle,
75 dbus_dso_name.c_str(),
76 sSymDBUSDSOMemoryPool) ))
77 {
78 INFOMSG("Found DSO: %s", dbus_dso_name.c_str());
79
80#include "llappviewerlinux_api_dbus_syms_raw.inc"
81
82 if ( sSymDBUSDSOHandle )
83 {
84 sSymDBUSDSOHandleG = sSymDBUSDSOHandle;
85 sSymDBUSDSOHandle = NULL;
86 }
87
88 rtn = !sym_error;
89 }
90 else
91 {
92 INFOMSG("Couldn't load DSO: %s", dbus_dso_name.c_str());
93 rtn = false; // failure
94 }
95
96 if (sym_error)
97 {
98 WARNMSG("Failed to find necessary symbols in DBUS-GLIB libraries.");
99 }
100#undef LL_DBUS_SYM
101
102 sSymsGrabbed = rtn;
103 return rtn;
104}
105
106
107void ungrab_dbus_syms()
108{
109 // should be safe to call regardless of whether we've
110 // actually grabbed syms.
111
112 if ( sSymDBUSDSOHandleG )
113 {
114 apr_dso_unload(sSymDBUSDSOHandleG);
115 sSymDBUSDSOHandleG = NULL;
116 }
117
118 if ( sSymDBUSDSOMemoryPool )
119 {
120 apr_pool_destroy(sSymDBUSDSOMemoryPool);
121 sSymDBUSDSOMemoryPool = NULL;
122 }
123
124 // NULL-out all of the symbols we'd grabbed
125#define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) do{ll##DBUSSYM = NULL;}while(0)
126#include "llappviewerlinux_api_dbus_syms_raw.inc"
127#undef LL_DBUS_SYM
128
129 sSymsGrabbed = false;
130}
131
132#endif // LL_DBUS_ENABLED
diff --git a/linden/indra/newview/llappviewerlinux_api_dbus.h b/linden/indra/newview/llappviewerlinux_api_dbus.h
deleted file mode 100644
index 1f5468b..0000000
--- a/linden/indra/newview/llappviewerlinux_api_dbus.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/**
2 * @file llappviewerlinux_api_dbus.h
3 * @brief DBus-glib symbol handling
4 *
5 * $LicenseInfo:firstyear=2008&license=viewergpl$
6 *
7 * Copyright (c) 2008-2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#include "linden_common.h"
34
35#if LL_DBUS_ENABLED
36
37extern "C" {
38#include <dbus/dbus-glib.h>
39}
40
41#define DBUSGLIB_DYLIB_DEFAULT_NAME "libdbus-glib-1.so.2"
42
43bool grab_dbus_syms(std::string dbus_dso_name);
44void ungrab_dbus_syms();
45
46#define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) extern RTN (*ll##DBUSSYM)(__VA_ARGS__)
47#include "llappviewerlinux_api_dbus_syms_raw.inc"
48#undef LL_DBUS_SYM
49
50#endif // LL_DBUS_ENABLED
diff --git a/linden/indra/newview/llappviewerlinux_api_dbus_syms_raw.inc b/linden/indra/newview/llappviewerlinux_api_dbus_syms_raw.inc
deleted file mode 100644
index c0548e2..0000000
--- a/linden/indra/newview/llappviewerlinux_api_dbus_syms_raw.inc
+++ /dev/null
@@ -1,9 +0,0 @@
1
2// required symbols to grab
3LL_DBUS_SYM(true, dbus_g_bus_get, DBusGConnection*, DBusBusType, GError**);
4LL_DBUS_SYM(true, dbus_g_proxy_new_for_name, DBusGProxy*, DBusGConnection*, const char *, const char*, const char*);
5LL_DBUS_SYM(true, dbus_g_proxy_call, gboolean, DBusGProxy*, const char*, GError**, GType, ...);
6LL_DBUS_SYM(true, dbus_g_object_type_install_info, void, GType, const DBusGObjectInfo*);
7LL_DBUS_SYM(true, dbus_g_connection_register_g_object, void, DBusGConnection*, const char*, GObject*);
8
9// optional symbols to grab