Kaydet (Commit) 4a11f5c2 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

More hacking on iOS stuff

Get the app bundle directory from Xcode's SCRIPT_OUTPUT_FILE_0.

Copy .rdb, registry, .res files, set up the various rc files.

Don't list a bunch of .component files on the command line, surely
that is not sane.

Change-Id: I6fb8bd4bea8d5afd30900daa1b916defb894e78c
üst 392510d7
...@@ -48,13 +48,85 @@ endif ...@@ -48,13 +48,85 @@ endif
ifneq ($(SCRIPT_OUTPUT_FILE_0),) ifneq ($(SCRIPT_OUTPUT_FILE_0),)
# When run from Xcode, we move the Viewer executable from solver into # When run from Xcode, we move the Viewer executable from solver into
# the Viewer.app directory that Xcode uses. # the Viewer.app directory that Xcode uses. We also set up/copy all
# the run-time configuration etc files that the app needs.
$(call gb_CustomTarget_get_target,ios/Viewer_app) : $(SCRIPT_OUTPUT_FILE_0) $(call gb_CustomTarget_get_target,ios/Viewer_app) : $(SCRIPT_OUTPUT_FILE_0)
appdir=$(dir $(SCRIPT_OUTPUT_FILE_0))
buildid=$(shell git log -1 --format=%H)
$(SCRIPT_OUTPUT_FILE_0) : $(call gb_Executable_get_target,Viewer) $(SCRIPT_OUTPUT_FILE_0) : $(call gb_Executable_get_target,Viewer)
$(call gb_Output_announce,$@,fii,APP,2) $(call gb_Output_announce,$@,fii,APP,2)
mkdir -p `dirname $(SCRIPT_OUTPUT_FILE_0)` mkdir -p $(appdir)/ure
mv $(call gb_Executable_get_target,Viewer) $(SCRIPT_OUTPUT_FILE_0) mv $(call gb_Executable_get_target,Viewer) $(SCRIPT_OUTPUT_FILE_0)
#
# Copy rdb files
#
cp $(OUTDIR)/bin/types.rdb $(appdir)
cp $(OUTDIR)/bin/ure/types.rdb $(appdir)/ure
cp $(OUTDIR)/bin/offapi.rdb $(appdir)
cp $(OUTDIR)/xml/services.rdb $(appdir)
cp $(OUTDIR)/xml/ure/services.rdb $(appdir)/ure
#
# Copy "registry" files
#
mkdir -p $(appdir)/registry/modules $(appdir)/registry/res
cp $(OUTDIR)/xml/*.xcd $(appdir)/registry
mv $(appdir)/registry/fcfg_langpack_en-US.xcd $(appdir)/registry/res
cp -R $(OUTDIR)/xml/registry/* $(appdir)/registry
#
# Copy .res files
#
# program/resource is hardcoded in tools/source/rc/resmgr.cxx. Sure,
# we could set STAR_RESOURCE_PATH instead. sigh...
#
mkdir -p $(appdir)/program/resource
cp $(OUTDIR)/bin/*en-US.res $(appdir)/program/resource
#
# Set up rc, the "inifile". See getIniFileName_Impl().
#
( \
echo '[Bootstrap]' && \
echo 'URE_BOOTSTRAP=file://$$APP_DATA_DIR/fundamentalrc' && \
echo 'HOME=$$APP_DATA_DIR/tmp' && \
: ) > $(appdir)/rc
#
# Set up fundamentalrc, unorc, bootstraprc and versionrc.
#
# Do we really need all these?
#
( \
echo '[Bootstrap]' && \
echo 'BRAND_BASE_DIR=file://$$APP_DATA_DIR' && \
echo 'CONFIGURATION_LAYERS=xcsxcu:$${BRAND_BASE_DIR}/registry module:$${BRAND_BASE_DIR}/registry/modules res:$${BRAND_BASE_DIR}/registry' && \
: ) > $(appdir)/fundamentalrc
#
( \
echo '[Bootstrap]' && \
: UNO_TYPES and UNO_SERVICES are set up in lo-viewer.mm, is that sane? && \
: ) > $(appdir)/unorc
#
# bootstraprc must be in $BRAND_BASE_DIR/program
#
mkdir -p $(appdir)/program
( \
echo '[Bootstrap]' && \
echo 'InstallMode=<installmode>' && \
echo 'ProductKey=LibreOffice Viewer $(PRODUCTVERSION)' && \
echo 'UserInstallation=file://$$APP_DATA_DIR' && \
: ) > $(appdir)/program/bootstraprc
#
# Is this really needed?
#
( \
echo '[Version]' && \
echo 'AllLanguages=en-US' && \
echo 'BuildVersion=' && \
echo 'buildid=$(buildid)' && \
echo 'ProductBuildid=3' && \
echo 'ProductMajor=360' && \
echo 'ProductMinor=1' && \
: ) > $(appdir)/program/versionrc
else else
# When run just from the command line, we don't have any app bundle to # When run just from the command line, we don't have any app bundle to
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#include <postmac.h> #include <postmac.h>
#include <comphelper/processfactory.hxx>
#include <cppuhelper/bootstrap.hxx> #include <cppuhelper/bootstrap.hxx>
#include <osl/detail/ios-bootstrap.h> #include <osl/detail/ios-bootstrap.h>
#include <osl/process.h> #include <osl/process.h>
...@@ -21,14 +22,12 @@ ...@@ -21,14 +22,12 @@
#include <com/sun/star/bridge/XUnoUrlResolver.hpp> #include <com/sun/star/bridge/XUnoUrlResolver.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/registry/XSimpleRegistry.hpp> #include <com/sun/star/registry/XSimpleRegistry.hpp>
using namespace com::sun::star::uno; #include <vcl/svapp.hxx>
using namespace com::sun::star::lang;
using namespace com::sun::star::beans; using namespace com::sun::star;
using namespace com::sun::star::bridge;
using namespace com::sun::star::frame;
using namespace com::sun::star::registry;
using ::rtl::OUString; using ::rtl::OUString;
using ::rtl::OUStringToOString; using ::rtl::OUStringToOString;
...@@ -122,15 +121,10 @@ lo_get_libmap(void) ...@@ -122,15 +121,10 @@ lo_get_libmap(void)
void void
lo_initialize(void) lo_initialize(void)
{ {
// See unotest/source/cpp/bootstrapfixturebase.cxx setenv("SAL_LOG", "+WARN+INFO", 1);
const char *app_root = [[[NSBundle mainBundle] bundlePath] UTF8String];
setenv("SRC_ROOT", app_root, 1);
setenv("OUTDIR_FOR_BUILD", app_root, 1);
setenv("SAL_LOG", "yes", 1);
const char *argv[] = { const char *argv[] = {
"Viewer", "placeholder-exe",
"-env:URE_INTERNAL_LIB_DIR=file:///", "-env:URE_INTERNAL_LIB_DIR=file:///",
"placeholder-uno-types", "placeholder-uno-types",
"placeholder-uno-services" "placeholder-uno-services"
...@@ -138,65 +132,31 @@ lo_initialize(void) ...@@ -138,65 +132,31 @@ lo_initialize(void)
const int argc = sizeof(argv)/sizeof(*argv); const int argc = sizeof(argv)/sizeof(*argv);
argv[0] = [[[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent: @"Viewer"] UTF8String];
NSString *app_root_escaped = [[[NSBundle mainBundle] bundlePath] stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]; NSString *app_root_escaped = [[[NSBundle mainBundle] bundlePath] stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
NSString *uno_types = @"-env:UNO_TYPES="; NSString *uno_types = @"-env:UNO_TYPES=";
uno_types = [uno_types stringByAppendingString: @"file://"]; uno_types = [uno_types stringByAppendingString: @"file://"];
uno_types = [uno_types stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: @"udkapi.rdb"]]; uno_types = [uno_types stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: @"ure/types.rdb"]];
uno_types = [uno_types stringByAppendingString: @" "]; uno_types = [uno_types stringByAppendingString: @" file://"];
uno_types = [uno_types stringByAppendingString: @"file://"];
uno_types = [uno_types stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: @"types.rdb"]]; uno_types = [uno_types stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: @"types.rdb"]];
uno_types = [uno_types stringByAppendingString: @" "]; uno_types = [uno_types stringByAppendingString: @" file://"];
uno_types = [uno_types stringByAppendingString: @"file://"]; uno_types = [uno_types stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: @"offapi.rdb"]];
uno_types = [uno_types stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: @"ure/types.rdb"]];
assert(strcmp(argv[argc-2], "placeholder-uno-types") == 0); assert(strcmp(argv[argc-2], "placeholder-uno-types") == 0);
argv[argc-2] = [uno_types UTF8String]; argv[argc-2] = [uno_types UTF8String];
NSString *uno_services = @"-env:UNO_SERVICES="; NSString *uno_services = @"-env:UNO_SERVICES=";
const char *services[] = { uno_services = [uno_services stringByAppendingString: @"file://"];
"services.rdb", uno_services = [uno_services stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: @"ure/services.rdb"]];
"ComponentTarget/basic/util/sb.component",
"ComponentTarget/chart2/source/controller/chartcontroller.component",
"ComponentTarget/chart2/source/chartcore.component",
"ComponentTarget/comphelper/util/comphelp.component",
"ComponentTarget/eventattacher/source/evtatt.component",
"ComponentTarget/fileaccess/source/fileacc.component",
"ComponentTarget/filter/source/config/cache/filterconfig1.component",
"ComponentTarget/oox/util/oox.component",
"ComponentTarget/package/source/xstor/xstor.component",
"ComponentTarget/package/util/package2.component",
"ComponentTarget/sax/source/expatwrap/expwrap.component",
"ComponentTarget/sax/source/fastparser/fastsax.component",
"ComponentTarget/sc/util/sc.component",
"ComponentTarget/sc/util/scfilt.component",
"ComponentTarget/scaddins/source/analysis/analysis.component",
"ComponentTarget/scaddins/source/datefunc/date.component",
"ComponentTarget/sot/util/sot.component",
"ComponentTarget/svl/util/svl.component",
"ComponentTarget/toolkit/util/tk.component",
"ComponentTarget/ucb/source/ucp/tdoc/ucptdoc1.component",
"ComponentTarget/unotools/util/utl.component",
"ComponentTarget/unoxml/source/rdf/unordf.component",
"ComponentTarget/framework/util/fwk.component",
"ComponentTarget/i18npool/util/i18npool.component",
"ComponentTarget/sfx2/util/sfx.component",
"ComponentTarget/unoxml/source/service/unoxml.component",
"ComponentTarget/configmgr/source/configmgr.component",
"ComponentTarget/ucb/source/core/ucb1.component",
"ComponentTarget/ucb/source/ucp/file/ucpfile1.component"
};
for (unsigned i = 0; i < sizeof(services)/sizeof(services[0]); i++) { uno_services = [uno_services stringByAppendingString: @" file://"];
uno_services = [uno_services stringByAppendingString: @"file://"]; uno_services = [uno_services stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: @"services.rdb"]];
uno_services = [uno_services stringByAppendingString: [app_root_escaped stringByAppendingPathComponent: [NSString stringWithUTF8String: services[i]]]];
if (i < sizeof(services)/sizeof(services[0]) - 1)
uno_services = [uno_services stringByAppendingString: @" "];
}
assert(strcmp(argv[argc-1], "placeholder-uno-services") == 0); assert(strcmp(argv[argc-1], "placeholder-uno-services") == 0);
argv[argc-1] = [uno_services UTF8String]; argv[argc-1] = [uno_services UTF8String];
...@@ -205,15 +165,21 @@ lo_initialize(void) ...@@ -205,15 +165,21 @@ lo_initialize(void)
try { try {
Reference< XComponentContext > xComponentContext(::cppu::defaultBootstrap_InitialComponentContext()); uno::Reference< uno::XComponentContext > xContext(::cppu::defaultBootstrap_InitialComponentContext());
uno::Reference< lang::XMultiComponentFactory > xFactory( xContext->getServiceManager() );
uno::Reference< lang::XMultiServiceFactory > xSM( xFactory, uno::UNO_QUERY_THROW );
comphelper::setProcessServiceFactory( xSM );
Reference< XMultiComponentFactory > xMultiComponentFactoryClient( xComponentContext->getServiceManager() ); InitVCL();
Reference< XInterface > xInterface = uno::Reference< uno::XInterface > xInterface =
xMultiComponentFactoryClient->createInstanceWithContext( OUString("com.sun.star.frame.Desktop"), xFactory->createInstanceWithContext( "com.sun.star.frame.Desktop",
xComponentContext ); xContext );
} }
catch (Exception e) { catch ( uno::Exception e ) {
SAL_WARN("Viewer", e.Message); SAL_WARN("Viewer", e.Message);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment