summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/experimental/DocumentLoader/Makefile2
-rw-r--r--android/experimental/LibreOffice4Android/Makefile2
-rw-r--r--android/experimental/desktop/Makefile2
-rwxr-xr-xsolenv/bin/native-code.py216
4 files changed, 189 insertions, 33 deletions
diff --git a/android/experimental/DocumentLoader/Makefile b/android/experimental/DocumentLoader/Makefile
index 5295c8086bcd..092292d5f266 100644
--- a/android/experimental/DocumentLoader/Makefile
+++ b/android/experimental/DocumentLoader/Makefile
@@ -13,7 +13,7 @@ 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 \
+ -g extended_core -g base_core -g calc_core -g draw_core -g math -g writer \
-s protocolhandler -s sb \
> $@
diff --git a/android/experimental/LibreOffice4Android/Makefile b/android/experimental/LibreOffice4Android/Makefile
index 92f0668b906e..4eadb651b971 100644
--- a/android/experimental/LibreOffice4Android/Makefile
+++ b/android/experimental/LibreOffice4Android/Makefile
@@ -13,7 +13,7 @@ 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 \
+ $< -g extended_core -g base_core -g calc_core -g draw_core -g math -g writer \
-s dlgprov -s protocolhandler -s scriptframe -s sb -s stringresource -s vbaswobj -s vbaevents \
> $@
diff --git a/android/experimental/desktop/Makefile b/android/experimental/desktop/Makefile
index 610bf874e1f8..a6618258f6ba 100644
--- a/android/experimental/desktop/Makefile
+++ b/android/experimental/desktop/Makefile
@@ -13,7 +13,7 @@ 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 \
+ -g extended_core -g base_core -g calc_core -g draw_core -g math -g writer \
-s basprov -s dlgprov -s cui -s protocolhandler -s scriptframe -s sb -s spl -s stringresource -s uui -s vbaswobj -s vbaevents \
> $@
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 99cefb8050af..ebdd5dba9004 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -8,46 +8,205 @@
from __future__ import print_function
from optparse import OptionParser
+# foo_component_getFactory functions are split into groups, so that you could
+# choose e.g. 'extended_core' and 'writer' functionality and through factory_map,
+# relevant function sections will be referenced in lo_get_factory_map().
+# That prevents garbage collector to ignore them as unused.
+
+# We need the same groups for new constructor functions, started in
+# ae3a0c8da50b36db395984637f5ad74d3b4887bc
+# For now, there are only constructor functions for implementations in 'core'
+# group, so no need for other groups, core_constructor_list is enough.
+# (These functions are referenced in lo_get_constructor_map().)
+
+core_factory_list = [
+ ("libembobj.a", "embobj_component_getFactory"),
+ ("libemboleobj.a", "emboleobj_component_getFactory"),
+ ("libintrospectionlo.a", "introspection_component_getFactory"),
+ ("libreflectionlo.a", "reflection_component_getFactory"),
+ ("libstocserviceslo.a", "stocservices_component_getFactory"),
+ ("libcomphelper.a", "comphelp_component_getFactory"),
+ ("libconfigmgrlo.a", "configmgr_component_getFactory"),
+ ("libdeployment.a", "deployment_component_getFactory"),
+ ("libevtattlo.a", "evtatt_component_getFactory"),
+ ("libfilterconfiglo.a", "filterconfig1_component_getFactory"),
+ ("libfsstoragelo.a", "fsstorage_component_getFactory"),
+ ("libfwklo.a", "fwk_component_getFactory"),
+ ("libfwllo.a", "fwl_component_getFactory"),
+ ("libhyphenlo.a", "hyphen_component_getFactory"),
+ ("libi18npoollo.a", "i18npool_component_getFactory"),
+ ("liblnglo.a", "lng_component_getFactory"),
+ ("liblnthlo.a", "lnth_component_getFactory"),
+ ("liblocalebe1lo.a", "localebe1_component_getFactory"),
+ ("libooxlo.a", "oox_component_getFactory"),
+ ("libpackage2.a", "package2_component_getFactory"),
+ ("libsfxlo.a", "sfx_component_getFactory"),
+ ("libsotlo.a", "sot_component_getFactory"),
+ ("libspelllo.a", "spell_component_getFactory"),
+ ("libsvllo.a", "svl_component_getFactory"),
+ ("libsvtlo.a", "svt_component_getFactory"),
+ ("libsvxlo.a", "svx_component_getFactory"),
+ ("libtklo.a", "tk_component_getFactory"),
+ ("libucb1.a", "ucb_component_getFactory"),
+ ("libucpexpand1lo.a", "ucpexpand1_component_getFactory"),
+ ("libucpfile1.a", "ucpfile_component_getFactory"),
+ ("libunordflo.a", "unordf_component_getFactory"),
+ ("libunoxmllo.a", "unoxml_component_getFactory"),
+ ("libutllo.a", "utl_component_getFactory"),
+ ("libvcllo.a", "vcl_component_getFactory"),
+ ("libxmlsecurity.a", "xmlsecurity_component_getFactory"),
+ ("libxolo.a", "xo_component_getFactory"),
+ ("libxoflo.a", "xof_component_getFactory"),
+ ("libxstor.a", "xstor_component_getFactory"),
+ ]
+
+extended_core_factory_list = core_factory_list + [
+ ("libanimcorelo.a", "animcore_component_getFactory"),
+ ("libavmedialo.a", "avmedia_component_getFactory"),
+ ("libchartcorelo.a", "chartcore_component_getFactory"),
+ ("libfilterconfiglo.a", "filterconfig1_component_getFactory"),
+ ("libfrmlo.a", "frm_component_getFactory"),
+ ("libfwklo.a", "fwk_component_getFactory"),
+ ("libfwmlo.a", "fwm_component_getFactory"),
+ ("libsvxcorelo.a", "svxcore_component_getFactory"),
+ ("libtextfdlo.a", "textfd_component_getFactory"),
+ ("libtklo.a", "tk_component_getFactory"),
+ ("libucppkg1.a", "ucppkg1_component_getFactory"),
+ ("libxmlfdlo.a", "xmlfd_component_getFactory"),
+ ]
+
+base_core_factory_list = [
+ ("libdbalo.a", "dba_component_getFactory"),
+ ("libdbaxmllo.a", "dbaxml_component_getFactory"),
+ ]
+
+calc_core_factory_list = [
+ ("libscdlo.a", "scd_component_getFactory"),
+ ("libscfiltlo.a", "scfilt_component_getFactory"),
+ ("libsclo.a", "sc_component_getFactory"),
+ ]
+
+calc_factory_list = calc_core_factory_list + [
+ ("libanalysislo.a", "analysis_component_getFactory"),
+ ("libdatelo.a", "date_component_getFactory"),
+ ("libpricinglo.a", "pricing_component_getFactory"),
+ ]
+
+draw_core_factory_list = [
+ ("libsddlo.a", "sdd_component_getFactory"),
+ ("libsdlo.a", "sd_component_getFactory"),
+ ("libsvgfilterlo.a", "svgfilter_component_getFactory"),
+ ("libwpftdrawlo.a", "wpftdraw_component_getFactory"),
+ ]
+
+math_factory_list = [
+ ("libsmdlo.a", "smd_component_getFactory"),
+ ("libsmlo.a", "sm_component_getFactory"),
+ ]
+
+writer_core_factory_list = [
+ ("libswdlo.a", "swd_component_getFactory"),
+ ("libswlo.a", "sw_component_getFactory"),
+ ("libwriterfilterlo.a", "writerfilter_component_getFactory"),
+ ]
+
+writer_factory_list = writer_core_factory_list + [
+ ("libhwplo.a", "hwp_component_getFactory"),
+ ("libt602filterlo.a", "t602filter_component_getFactory"),
+ ("libwpftwriterlo.a", "wpftwriter_component_getFactory"),
+ ]
+
+factory_map = {
+ 'core' : core_factory_list,
+ 'extended_core' : extended_core_factory_list,
+ 'base_core' : base_core_factory_list,
+ 'calc_core' : calc_core_factory_list,
+ 'calc' : calc_factory_list,
+ 'draw_core' : draw_core_factory_list,
+ 'math' : math_factory_list,
+ 'writer_core' : writer_core_factory_list,
+ 'writer' : writer_factory_list,
+ }
+
+core_constructor_list = [
+# sax/source/expatwrap/expwrap.component
+ "com_sun_star_comp_extensions_xml_sax_ParserExpat",
+ "com_sun_star_comp_extensions_xml_sax_FastParser",
+ "com_sun_star_extensions_xml_sax_Writer",
+# stoc/util/bootstrap.component
+ "com_sun_star_comp_stoc_DLLComponentLoader",
+ "com_sun_star_comp_stoc_ImplementationRegistration",
+ "com_sun_star_comp_stoc_NestedRegistry",
+ "com_sun_star_comp_stoc_ORegistryServiceManager",
+ "com_sun_star_comp_stoc_OServiceManager",
+ "com_sun_star_comp_stoc_OServiceManagerWrapper",
+ "com_sun_star_comp_stoc_SimpleRegistry",
+ "com_sun_star_security_comp_stoc_AccessController",
+ "com_sun_star_security_comp_stoc_FilePolicy",
+ ]
+
+# Components which are not in any group yet:
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 },'}
+ '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("-g", "--group", action="append", help="group of implementations to make available in application", dest="groups")
+# TODO: components from single_component_map should be put into
+# one of the groups too and --single-component should die.
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"
+print ("""
+#include <osl/detail/component-mapping.h>
+
+extern "C" {
+""")
+
+if options.groups:
+ for factory_group in options.groups:
+ for (factory_name,factory_function) in factory_map[factory_group]:
+ print ('void * '+factory_function+'( const char* , void* , void* );')
+
+if options.components:
+ for c in options.components:
+ (c_name, c_function) = single_component_map[c]
+ print ('void * '+c_function+'( const char* , void* , void* );')
-extern "C"
-__attribute__ ((visibility("default")))
+print ('')
+for constructor in core_constructor_list:
+ print ('void * '+constructor+'( void *, void * );')
+
+print ("""
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.groups:
+ for factory_group in options.groups:
+ for (factory_name,factory_function) in factory_map[factory_group]:
+ print (' { "'+factory_name+'", '+factory_function+' },')
if options.components:
for c in options.components:
- print (' ' + single_component_map[c])
+ (c_name, c_function) = single_component_map[c]
+ print (' { "'+c_name+'", '+c_function+' },')
print ("""
- { NULL, NULL }
+ { 0, 0 }
};""")
if options.java:
@@ -65,21 +224,18 @@ 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)
+ static lib_to_constructor_mapping map[] = {""")
+for constructor in core_constructor_list:
+ print (' { "' +constructor+ '", ' +constructor+ ' },')
print ("""
- { NULL, NULL }
+ { 0, 0 }
};
return map;
+}
+
}""")