[Libreoffice-commits] core.git: Branch 'feature/liblibo' - desktop/Library_libreoffice.mk desktop/Library_sofficeapp.mk desktop/source

Michael Meeks michael.meeks at suse.com
Tue Mar 5 07:22:40 PST 2013


 desktop/Library_libreoffice.mk |   21 ----------------
 desktop/Library_sofficeapp.mk  |    5 +++
 desktop/source/lib/init.cxx    |    9 +++++++
 desktop/source/lib/shim.cxx    |   52 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 67 insertions(+), 20 deletions(-)

New commits:
commit d712f7e5433cc3e1b4d5e5c5c798b882ec99e517
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Tue Mar 5 15:21:42 2013 +0000

    liblibo: re-factor to have a completely dependency-free client.
    
    Change-Id: I6217019dbee9b53b9638efd61b842db2540da0e2

diff --git a/desktop/Library_libreoffice.mk b/desktop/Library_libreoffice.mk
index bea7f2f..a40bbd7 100644
--- a/desktop/Library_libreoffice.mk
+++ b/desktop/Library_libreoffice.mk
@@ -14,31 +14,12 @@ $(eval $(call gb_Library_set_include,libreoffice,\
     -I$(SRCDIR)/desktop/inc \
 ))
 
-$(eval $(call gb_Library_use_external,libreoffice,boost_headers))
-
-$(eval $(call gb_Library_use_sdk_api,libreoffice))
-
 $(eval $(call gb_Library_use_libraries,libreoffice,\
-    comphelper \
-    cppu \
-    cppuhelper \
-    deploymentmisc \
-    i18nisolang1 \
-    sal \
-    salhelper \
-    sfx \
-    svl \
-    svt \
-    tk \
-    tl \
-    ucbhelper \
-    utl \
-    vcl \
 	$(gb_UWINAPI) \
 ))
 
 $(eval $(call gb_Library_add_exception_objects,libreoffice,\
-    desktop/source/lib/init \
+    desktop/source/lib/shim \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk
index 2a635b5..5ae66d2 100644
--- a/desktop/Library_sofficeapp.mk
+++ b/desktop/Library_sofficeapp.mk
@@ -90,6 +90,11 @@ $(eval $(call gb_Library_add_exception_objects,sofficeapp,\
     desktop/source/migration/migration \
 ))
 
+# liblibreoffice bits
+$(eval $(call gb_Library_add_exception_objects,sofficeapp,\
+	desktop/source/lib/init \
+))
+
 ifeq ($(ENABLE_TELEPATHY),TRUE)
 $(eval $(call gb_Library_use_libraries,sofficeapp,tubes))
 endif
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 8f96dbe..5aab66b 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -126,5 +126,14 @@ lo_initialize( const char *app_path )
     return bInitialized;
 }
 
+extern "C" {
+    SAL_DLLPUBLIC_EXPORT LibLibreOffice *liblibreoffice_hook(void);
+}
+
+LibLibreOffice *liblibreoffice_hook(void)
+{
+    return new LibLibreOffice();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 
diff --git a/desktop/source/lib/shim.cxx b/desktop/source/lib/shim.cxx
new file mode 100644
index 0000000..c57803e
--- /dev/null
+++ b/desktop/source/lib/shim.cxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifdef LINUX
+
+#include <sal/types.h>
+#include <liblibreoffice.h>
+
+#include <dlfcn.h>
+#ifdef AIX
+#  include <sys/ldr.h>
+#endif
+
+#define TARGET_LIB SAL_MODULENAME( "sofficeapp" )
+
+extern "C" {
+    typedef LibLibreOffice *(HookFunction)(void);
+};
+
+extern LibLibreOffice *lo_init( const char *install_path )
+{
+    if( !install_path )
+        return NULL;
+    char *impl_lib = malloc( strlen (install_path) + sizeof( TARGET_LIB ) + 2 );
+    strcpy( imp_lib, install_path );
+    strcat( imp_lib, "/" );
+    strcat( imp_lib, TARGET_LIB );
+    void *dlhandle = dlopen( imp_lib, RTLD_LAZY );
+    if( !dlhandle )
+    {
+        fprintf( stderr, "failed to open library '%s'\n", imp_lib );
+        return NULL;
+    }
+    free( imp_lib );
+
+    HookFunction *pSym = dlsym( dlhandle, "liblibreoffice_hook" );
+    if( !pSym ) {
+        fprintf( stderr, "failed to find hook in library '%s'\n", imp_lib );
+        return NULL;
+    }
+    return pSym();
+}
+
+#endif // LINUX - port me !
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list