summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej.hunt@collabora.com>2014-06-09 11:33:25 +0100
committerMichael Meeks <michael.meeks@collabora.com>2014-06-11 21:36:45 +0100
commit7d210d6b32dc28bb2725983ffb66d8f153299c01 (patch)
treeba41f29945a8783cf3ffa14849826b550a49b0a9 /libreofficekit
parent99d3e778d8896d72a5733ded8d1f3c304bae8d9c (diff)
Move liblibreoffice into LibreOfficeKit.
Conflicts: include/LibreOfficeKit/LibreOfficeKit.hxx Change-Id: Ib2754a77be470faaa6f9b27644a1d8dd082ed2b8
Diffstat (limited to 'libreofficekit')
-rw-r--r--libreofficekit/Library_libreofficekit.mk31
-rw-r--r--libreofficekit/Makefile14
-rw-r--r--libreofficekit/Module_libreofficekit.mk18
-rw-r--r--libreofficekit/source/shim.c67
4 files changed, 130 insertions, 0 deletions
diff --git a/libreofficekit/Library_libreofficekit.mk b/libreofficekit/Library_libreofficekit.mk
new file mode 100644
index 000000000000..b0699ff8cba2
--- /dev/null
+++ b/libreofficekit/Library_libreofficekit.mk
@@ -0,0 +1,31 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+$(eval $(call gb_StaticLibrary_StaticLibrary,libreofficekit))
+
+$(eval $(call gb_StaticLibrary_set_include,libreofficekit,\
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_StaticLibrary_add_libs,libreofficekit,\
+ $(if $(filter $(OS),LINUX), \
+ -ldl \
+ -lpthread \
+ ) \
+))
+
+$(eval $(call gb_StaticLibrary_use_libraries,libreofficekit,\
+ $(gb_UWINAPI) \
+))
+
+$(eval $(call gb_StaticLibrary_add_cobjects,libreofficekit,\
+ libreofficekit/source/shim \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/libreofficekit/Makefile b/libreofficekit/Makefile
new file mode 100644
index 000000000000..0997e628485b
--- /dev/null
+++ b/libreofficekit/Makefile
@@ -0,0 +1,14 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/libreofficekit/Module_libreofficekit.mk b/libreofficekit/Module_libreofficekit.mk
new file mode 100644
index 000000000000..d78a9c35c401
--- /dev/null
+++ b/libreofficekit/Module_libreofficekit.mk
@@ -0,0 +1,18 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+$(eval $(call gb_Module_Module,libreofficekit))
+
+ifeq ($(OS),LINUX)
+$(eval $(call gb_Module_add_targets,libreofficekit,\
+ Library_libreofficekit \
+))
+endif
+
+# vim: set ts=4 sw=4 et:
diff --git a/libreofficekit/source/shim.c b/libreofficekit/source/shim.c
new file mode 100644
index 000000000000..e863dd516b85
--- /dev/null
+++ b/libreofficekit/source/shim.c
@@ -0,0 +1,67 @@
+/* -*- 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 <stdio.h>
+#include <string.h>
+
+#include <osl/module.h>
+#include <sal/types.h>
+#include <LibreOfficeKit/LibreOfficeKit.h>
+
+#include <dlfcn.h>
+#ifdef AIX
+# include <sys/ldr.h>
+#endif
+
+#define TARGET_LIB SAL_MODULENAME( "sofficeapp" )
+
+typedef LibreOffice *(HookFunction)(void);
+
+SAL_DLLPUBLIC_EXPORT LibreOffice *lo_init( const char *install_path )
+{
+ char *imp_lib;
+ void *dlhandle;
+ HookFunction *pSym;
+
+ if( !install_path )
+ return NULL;
+ if( !( imp_lib = (char *) malloc( strlen (install_path) + sizeof( TARGET_LIB ) + 2 ) ) )
+ {
+ fprintf( stderr, "failed to open library : not enough memory\n");
+ return NULL;
+ }
+
+ strcpy( imp_lib, install_path );
+ strcat( imp_lib, "/" );
+ strcat( imp_lib, TARGET_LIB );
+
+ if( !( dlhandle = dlopen( imp_lib, RTLD_LAZY ) ) )
+ {
+ fprintf( stderr, "failed to open library '%s'\n", imp_lib );
+ free( imp_lib );
+ return NULL;
+ }
+
+ pSym = (HookFunction *) dlsym( dlhandle, "liblibreoffice_hook" );
+ if( !pSym ) {
+ fprintf( stderr, "failed to find hook in library '%s'\n", imp_lib );
+ dlclose( dlhandle );
+ free( imp_lib );
+ return NULL;
+ }
+
+ free( imp_lib );
+ return pSym();
+}
+
+#endif // not LINUX => port me !
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */