[Libreoffice-commits] core.git: android/experimental android/.gitignore solenv/bin

Matúš Kukan matus.kukan at collabora.com
Fri Dec 20 04:02:48 PST 2013


 android/.gitignore                                       |    3 
 android/experimental/DocumentLoader/Makefile             |    6 +
 android/experimental/DocumentLoader/native-code.cxx      |   45 -------
 android/experimental/LibreOffice4Android/Makefile        |    5 
 android/experimental/LibreOffice4Android/native-code.cxx |   51 ---------
 android/experimental/desktop/Makefile                    |    6 +
 android/experimental/desktop/native-code.cxx             |   64 -----------
 solenv/bin/native-code.py                                |   85 +++++++++++++++
 8 files changed, 104 insertions(+), 161 deletions(-)

New commits:
commit a17c0950c04693411cc7e46a21c65d45216d8c52
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Thu Dec 19 15:32:54 2013 +0100

    Add tool to generate native-code.cxx for Android.
    
    Should be extended to be helpfull for iOS too.
    
    Change-Id: I862731b6386d5f9cbb508e0c138f45fbe1cb3f46

diff --git a/android/.gitignore b/android/.gitignore
index 9034b98..dca2c57 100644
--- a/android/.gitignore
+++ b/android/.gitignore
@@ -3,4 +3,5 @@ bin
 gen
 libs
 obj
-local.properties
\ No newline at end of file
+local.properties
+native-code.cxx
diff --git a/android/experimental/DocumentLoader/Makefile b/android/experimental/DocumentLoader/Makefile
index 49b2895..5295c80 100644
--- a/android/experimental/DocumentLoader/Makefile
+++ b/android/experimental/DocumentLoader/Makefile
@@ -11,6 +11,12 @@ APP_PACKAGE=org.libreoffice.android.examples
 BOOTSTRAPDIR=../../Bootstrap
 include $(BOOTSTRAPDIR)/Makefile.shared
 
+native-code.cxx: $(SRCDIR)/solenv/bin/native-code.py
+	$< \
+		-f EXTENDED_CORE -f BASE_CORE -f CALC_CORE -f DRAW_CORE -f MATH -f WRITER \
+		-s protocolhandler -s sb \
+		> $@
+
 copy-stuff:
 # Then "assets". Let the directory structure under assets mimic
 # that under solver for now.
diff --git a/android/experimental/DocumentLoader/native-code.cxx b/android/experimental/DocumentLoader/native-code.cxx
deleted file mode 100644
index 7cba377..0000000
--- a/android/experimental/DocumentLoader/native-code.cxx
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- 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/.
- */
-
-#include "osl/detail/android-bootstrap.h"
-
-extern "C"
-__attribute__ ((visibility("default")))
-const lib_to_factory_mapping *
-lo_get_factory_map(void)
-{
-    static lib_to_factory_mapping map[] = {
-        LO_EXTENDED_CORE_FACTORY_MAP
-        LO_BASE_CORE_FACTORY_MAP
-        LO_CALC_CORE_FACTORY_MAP
-        LO_DRAW_CORE_FACTORY_MAP
-        LO_MATH_FACTORY_MAP
-        LO_WRITER_FACTORY_MAP
-        { "libprotocolhandlerlo.a", protocolhandler_component_getFactory },
-        { "libsblo.a", sb_component_getFactory },
-        { NULL, NULL }
-    };
-
-    return map;
-}
-
-extern "C"
-__attribute__ ((visibility("default")))
-const lib_to_constructor_mapping *
-lo_get_constructor_map(void)
-{
-    static lib_to_constructor_mapping map[] = {
-        NON_APP_SPECIFIC_CONSTRUCTOR_MAP
-        { NULL, NULL }
-    };
-
-    return map;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/experimental/LibreOffice4Android/Makefile b/android/experimental/LibreOffice4Android/Makefile
index 9f8dcce..92f0668 100644
--- a/android/experimental/LibreOffice4Android/Makefile
+++ b/android/experimental/LibreOffice4Android/Makefile
@@ -12,6 +12,11 @@ APP_PACKAGE=org.libreoffice
 BOOTSTRAPDIR=../../Bootstrap
 include $(BOOTSTRAPDIR)/Makefile.shared
 
+native-code.cxx: $(SRCDIR)/solenv/bin/native-code.py
+	$< -f EXTENDED_CORE -f BASE_CORE -f CALC_CORE -f DRAW_CORE -f MATH -f WRITER \
+		-s dlgprov -s protocolhandler -s scriptframe -s sb -s stringresource -s vbaswobj -s vbaevents \
+		> $@
+
 copy-stuff:
 # Then "assets". Let the directory structure under assets mimic
 # that under solver for now.
diff --git a/android/experimental/LibreOffice4Android/native-code.cxx b/android/experimental/LibreOffice4Android/native-code.cxx
deleted file mode 100644
index 44cb862..0000000
--- a/android/experimental/LibreOffice4Android/native-code.cxx
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- 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/.
- */
-
-#include "osl/detail/android-bootstrap.h"
-
-extern "C"
-__attribute__ ((visibility("default")))
-const lib_to_factory_mapping *
-lo_get_factory_map(void)
-{
-    static lib_to_factory_mapping map[] = {
-        LO_EXTENDED_CORE_FACTORY_MAP
-        LO_BASE_CORE_FACTORY_MAP
-        LO_CALC_CORE_FACTORY_MAP
-        LO_DRAW_CORE_FACTORY_MAP
-        LO_MATH_FACTORY_MAP
-        LO_WRITER_FACTORY_MAP
-        { "libdlgprovlo.a", dlgprov_component_getFactory },
-        { "libprotocolhandlerlo.a", protocolhandler_component_getFactory },
-        { "libscriptframe.a", scriptframe_component_getFactory },
-        { "libsblo.a", sb_component_getFactory },
-        { "libscriptframe.a", scriptframe_component_getFactory },
-        { "libstringresource.uno.a", stringresource_component_getFactory },
-        { "libvbaswobj.uno.a", vbaswobj_component_getFactory },
-        { "libvbaevents.uno.a", vbaevents_component_getFactory },
-        { NULL, NULL }
-    };
-
-    return map;
-}
-
-extern "C"
-__attribute__ ((visibility("default")))
-const lib_to_constructor_mapping *
-lo_get_constructor_map(void)
-{
-    static lib_to_constructor_mapping map[] = {
-        NON_APP_SPECIFIC_CONSTRUCTOR_MAP
-        { NULL, NULL }
-    };
-
-    return map;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/experimental/desktop/Makefile b/android/experimental/desktop/Makefile
index 145a9fb..610bf87 100644
--- a/android/experimental/desktop/Makefile
+++ b/android/experimental/desktop/Makefile
@@ -11,6 +11,12 @@ APP_PACKAGE=org.libreoffice.experimental.desktop
 BOOTSTRAPDIR=../../Bootstrap
 include $(BOOTSTRAPDIR)/Makefile.shared
 
+native-code.cxx: $(SRCDIR)/solenv/bin/native-code.py
+	$< -j \
+		-f EXTENDED_CORE -f BASE_CORE -f CALC_CORE -f DRAW_CORE -f MATH -f WRITER \
+		-s basprov -s dlgprov -s cui -s protocolhandler -s scriptframe -s sb -s spl -s stringresource -s uui -s vbaswobj -s vbaevents \
+		> $@
+
 # The name of the Bootstrap activity class
 BOOTSTRAP=org.libreoffice.android.Bootstrap
 
diff --git a/android/experimental/desktop/native-code.cxx b/android/experimental/desktop/native-code.cxx
deleted file mode 100644
index 6b8deab..0000000
--- a/android/experimental/desktop/native-code.cxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- 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/.
- */
-
-#include "osl/detail/android-bootstrap.h"
-
-extern "C"
-__attribute__ ((visibility("default")))
-const lib_to_factory_mapping *
-lo_get_factory_map(void)
-{
-    static lib_to_factory_mapping map[] = {
-        LO_EXTENDED_CORE_FACTORY_MAP
-        LO_BASE_CORE_FACTORY_MAP
-        LO_CALC_CORE_FACTORY_MAP
-        LO_DRAW_CORE_FACTORY_MAP
-        LO_MATH_FACTORY_MAP
-        LO_WRITER_FACTORY_MAP
-        { "libbasprovlo.a", basprov_component_getFactory },
-        { "libdlgprovlo.a", dlgprov_component_getFactory },
-        { "libcuilo.a", cui_component_getFactory },
-        { "libprotocolhandlerlo.a", protocolhandler_component_getFactory },
-        { "libscriptframe.a", scriptframe_component_getFactory },
-        { "libsblo.a", sb_component_getFactory },
-        { "libspllo.a", spl_component_getFactory },
-        { "libscriptframe.a", scriptframe_component_getFactory },
-        { "libstringresourcelo.a", stringresource_component_getFactory },
-        { "libuuilo.a", uui_component_getFactory },
-        { "libvbaswobjlo.a", vbaswobj_component_getFactory },
-        { "libvbaeventslo.a", vbaevents_component_getFactory },
-        { NULL, NULL }
-    };
-
-    // Guard against possible function-level link-time pruning of
-    // "unused" code. We need to pull these in, too, as they aren't in
-    // any of the libs we link with -Wl,--whole-archive. Is this necessary?
-    extern void Java_org_libreoffice_android_AppSupport_runMain();
-    volatile void *p = (void *) Java_org_libreoffice_android_AppSupport_runMain;
-
-    extern void Java_org_libreoffice_android_AppSupport_renderVCL();
-    p = (void *) Java_org_libreoffice_android_AppSupport_renderVCL;
-
-    return map;
-}
-
-extern "C"
-__attribute__ ((visibility("default")))
-const lib_to_constructor_mapping *
-lo_get_constructor_map(void)
-{
-    static lib_to_constructor_mapping map[] = {
-        NON_APP_SPECIFIC_CONSTRUCTOR_MAP
-        { NULL, NULL }
-    };
-
-    return map;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
new file mode 100755
index 0000000..99cefb8
--- /dev/null
+++ b/solenv/bin/native-code.py
@@ -0,0 +1,85 @@
+#!/usr/bin/python
+# 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/.
+
+from __future__ import print_function
+from optparse import OptionParser
+
+single_component_map = {
+        'basprov' : '{ "libbasprovlo.a", basprov_component_getFactory },',
+        'cui' : '{ "libcuilo.a", cui_component_getFactory },',
+        'dlgprov' : '{ "libdlgprovlo.a", dlgprov_component_getFactory },',
+        'protocolhandler' : '{ "libprotocolhandlerlo.a", protocolhandler_component_getFactory },',
+        'scriptframe' : '{ "libscriptframe.a", scriptframe_component_getFactory },',
+        'sb' : '{ "libsblo.a", sb_component_getFactory },',
+        'spl' : '{ "libspllo.a", spl_component_getFactory },',
+        'stringresource' :'{ "libstringresourcelo.a", stringresource_component_getFactory },',
+        'uui' : '{ "libuuilo.a", uui_component_getFactory },',
+        'vbaswobj' : '{ "libvbaswobjlo.a", vbaswobj_component_getFactory },',
+        'vbaevents' :'{ "libvbaeventslo.a", vbaevents_component_getFactory },'}
+
+opts = OptionParser()
+opts.add_option("-j", "--java-guard", action="store_true", help="include external java functions", dest="java", default=False)
+opts.add_option("-f", "--factory", action="append", help="list of factory groups to get into lib_to_factory_mapping", dest="factories")
+opts.add_option("-s", "--single-component", action="append", help="list of single getFactories to get into lib_to_factory_mapping", dest="components")
+opts.add_option("-c", "--constructor", action="append", help="list of constructor groups to get into lib_to_constructor_mapping", dest="constructors")
+
+(options, args) = opts.parse_args()
+
+print ("""#include "osl/detail/android-bootstrap.h"
+
+extern "C"
+__attribute__ ((visibility("default")))
+const lib_to_factory_mapping *
+lo_get_factory_map(void)
+{
+    static lib_to_factory_mapping map[] = {""")
+
+if options.factories:
+    for f in options.factories:
+        print ('        LO_' + f + '_FACTORY_MAP')
+
+if options.components:
+    for c in options.components:
+        print ('        ' + single_component_map[c])
+
+print ("""
+        { NULL, NULL }
+    };""")
+
+if options.java:
+    print ("""
+    // Guard against possible function-level link-time pruning of
+    // "unused" code. We need to pull these in, too, as they aren't in
+    // any of the libs we link with -Wl,--whole-archive. Is this necessary?
+    extern void Java_org_libreoffice_android_AppSupport_runMain();
+    volatile void *p = (void *) Java_org_libreoffice_android_AppSupport_runMain;
+
+    extern void Java_org_libreoffice_android_AppSupport_renderVCL();
+    p = (void *) Java_org_libreoffice_android_AppSupport_renderVCL;""")
+
+print ("""
+    return map;
+}
+
+extern "C"
+__attribute__ ((visibility("default")))
+const lib_to_constructor_mapping *
+lo_get_constructor_map(void)
+{
+    static lib_to_constructor_mapping map[] = {
+        NON_APP_SPECIFIC_CONSTRUCTOR_MAP""")
+
+if options.constructors:
+    for c in options.constructors:
+        print (c)
+
+print ("""
+        { NULL, NULL }
+    };
+
+    return map;
+}""")


More information about the Libreoffice-commits mailing list