[Libreoffice-commits] core.git: 4 commits - bin/lo-all-static-libs external/icu ios/experimental ios/lo.xcconfig.in

Tor Lillqvist tml at collabora.com
Sat Apr 12 10:35:30 PDT 2014


 bin/lo-all-static-libs                                                       |   21 ++++--
 external/icu/ExternalProject_icu.mk                                          |    4 -
 ios/experimental/TiledLibreOffice/TiledLibreOffice.xcodeproj/project.pbxproj |   23 ++++++
 ios/experimental/TiledLibreOffice/TiledLibreOffice/lo.mm                     |   35 ++++++++++
 ios/lo.xcconfig.in                                                           |    1 
 5 files changed, 76 insertions(+), 8 deletions(-)

New commits:
commit eb6bf90a87b50c60efb3df0f0659e7de3e250ba0
Author: Tor Lillqvist <tml at collabora.com>
Date:   Sat Apr 12 20:29:47 2014 +0300

    Mmap in the ICU data file and pass it to udata_setCommonData()
    
    Now done in TiledLibreOffice's lo_initialize(), but should probably be
    done in common LO code instead.
    
    Change-Id: I398a703943d13c6d715e4c88ead2a629955fb7c9

diff --git a/ios/experimental/TiledLibreOffice/TiledLibreOffice/lo.mm b/ios/experimental/TiledLibreOffice/TiledLibreOffice/lo.mm
index 4f60d05..8a55107 100644
--- a/ios/experimental/TiledLibreOffice/TiledLibreOffice/lo.mm
+++ b/ios/experimental/TiledLibreOffice/TiledLibreOffice/lo.mm
@@ -7,6 +7,8 @@
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #include <stdlib.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
 
 #include <premac.h>
 #import <UIKit/UIKit.h>
@@ -15,6 +17,9 @@
 #include <osl/process.h>
 #include <touch/touch.h>
 
+#include <unicode/udata.h>
+#include <unicode/ucnv.h>
+
 // generated by solenv/bin/native-code.py:
 #include "native-code.mm"
 
@@ -45,6 +50,36 @@ extern "C" void lo_initialize(NSString *documentPath)
     NSString *uno_types = createPaths(@"-env:UNO_TYPES=", app_root_escaped, @[@"offapi.rdb", @"oovbaapi.rdb", @"types.rdb"]);
     NSString *uno_services = createPaths(@"-env:UNO_SERVICES=", app_root_escaped, @[@"ure/services.rdb", @"services.rdb"]);
 
+    int fd = open([[bundlePath stringByAppendingPathComponent:@U_ICUDATA_NAME".dat"] UTF8String], O_RDONLY);
+    if (fd != -1) {
+        struct stat st;
+        if (fstat(fd, &st) != -1
+            && st.st_size < (size_t)-1) {
+            void *icudata = mmap(0, (size_t) st.st_size, PROT_READ, MAP_FILE|MAP_PRIVATE, fd, 0);
+            if (icudata == MAP_FAILED) {
+#if OSL_DEBUG_LEVEL > 0
+                NSLog(@"mmap failed:%s", strerror(errno));
+#endif
+            } else {
+                UErrorCode icuStatus = U_ZERO_ERROR;
+                udata_setCommonData(icudata, &icuStatus);
+                if (U_FAILURE(icuStatus))
+                    NSLog(@"udata_setCommonData failed");
+                else {
+#if OSL_DEBUG_LEVEL > 0
+                    // Test that ICU works...
+                    UConverter *cnv = ucnv_open("iso-8859-3", &icuStatus);
+                    NSLog(@"ucnv_open(iso-8859-3)-> %p, err = %s, name=%s",
+                          (void *)cnv, u_errorName(icuStatus), (!cnv)?"?":ucnv_getName(cnv,&icuStatus));
+                    if (U_SUCCESS(icuStatus))
+                        ucnv_close(cnv);
+#endif
+                }
+            }
+        }
+        close(fd);
+    }
+
     const char *argv[] = {
         [[[NSBundle mainBundle] executablePath] UTF8String],
         "-env:URE_INTERNAL_LIB_DIR=file:///",
commit 11842c66432ffda87e7326d6f0d8342d484bfcbb
Author: Tor Lillqvist <tml at collabora.com>
Date:   Sat Apr 12 20:29:12 2014 +0300

    Copy the ICU data file into the TiledLibreOffice app
    
    Change-Id: I7f259c96dd9ab0ec833cefd2142682d08b7255b1

diff --git a/ios/experimental/TiledLibreOffice/TiledLibreOffice.xcodeproj/project.pbxproj b/ios/experimental/TiledLibreOffice/TiledLibreOffice.xcodeproj/project.pbxproj
index 3c5d9d0..e8dcc42 100644
--- a/ios/experimental/TiledLibreOffice/TiledLibreOffice.xcodeproj/project.pbxproj
+++ b/ios/experimental/TiledLibreOffice/TiledLibreOffice.xcodeproj/project.pbxproj
@@ -7,6 +7,7 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
+		BE03BF9318F9A7CC00620DC7 /* icudt52l.dat in Resources */ = {isa = PBXBuildFile; fileRef = BE03BF9218F9A7CC00620DC7 /* icudt52l.dat */; };
 		BE55B06D18D87CC600950228 /* DocumentTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BE55B06C18D87CC600950228 /* DocumentTableViewController.m */; };
 		BE82BD7618218E2E00A447B5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE82BD7518218E2E00A447B5 /* Foundation.framework */; };
 		BE82BD7818218E2E00A447B5 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE82BD7718218E2E00A447B5 /* CoreGraphics.framework */; };
@@ -38,6 +39,7 @@
 
 /* Begin PBXFileReference section */
 		BE03BF9118F9648F00620DC7 /* udata.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = udata.cpp; path = ../../../workdir/UnpackedTarball/icu/source/common/udata.cpp; sourceTree = "<group>"; };
+		BE03BF9218F9A7CC00620DC7 /* icudt52l.dat */ = {isa = PBXFileReference; lastKnownFileType = file; name = "icudt$(LO_ICU_MAJOR)l.dat"; path = ../../../../workdir/UnpackedTarball/icu/source/data/in/icudt52l.dat; sourceTree = "<group>"; };
 		BE0898E81860D42B0021A679 /* brand.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = brand.cxx; path = ../../../vcl/source/app/brand.cxx; sourceTree = "<group>"; };
 		BE0898E91860D42B0021A679 /* dbggui.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = dbggui.cxx; path = ../../../vcl/source/app/dbggui.cxx; sourceTree = "<group>"; };
 		BE0898EA1860D42B0021A679 /* dndhelp.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = dndhelp.cxx; path = ../../../vcl/source/app/dndhelp.cxx; sourceTree = "<group>"; };
@@ -1687,6 +1689,7 @@
 				BEEEFDFE1860A82C00FBDE67 /* unorc */,
 				BEEE02D01860ABB700FBDE67 /* ure */,
 				BEEEF9691860A25400FBDE67 /* test1.odt */,
+				BE03BF9218F9A7CC00620DC7 /* icudt52l.dat */,
 			);
 			name = Resources;
 			path = TiledLibreOffice;
@@ -1752,6 +1755,7 @@
 				BEEEFE041860A89100FBDE67 /* rc in Resources */,
 				BEEEFE051860A89100FBDE67 /* services.rdb in Resources */,
 				BEEE02D21860ABDB00FBDE67 /* share in Resources */,
+				BE03BF9318F9A7CC00620DC7 /* icudt52l.dat in Resources */,
 				BEEEFE061860A89100FBDE67 /* types.rdb in Resources */,
 				BEEEFE071860A89100FBDE67 /* unorc in Resources */,
 				BEEE02D31860ABDB00FBDE67 /* ure in Resources */,
@@ -1829,6 +1833,7 @@
 					"$(LO_SRCDIR)/include",
 					"$(LO_WORKDIR)/UnoApiHeadersTarget/udkapi/comprehensive",
 					"$(LO_WORKDIR)/UnoApiHeadersTarget/offapi/comprehensive",
+					"$(LO_WORKDIR)/UnpackedTarball/icu/source/common",
 				);
 				IPHONEOS_DEPLOYMENT_TARGET = 6.1;
 				ONLY_ACTIVE_ARCH = YES;
diff --git a/ios/lo.xcconfig.in b/ios/lo.xcconfig.in
index 60e228e..26299fa 100644
--- a/ios/lo.xcconfig.in
+++ b/ios/lo.xcconfig.in
@@ -16,6 +16,7 @@ LO_BUILDDIR = @BUILDDIR@
 LO_INSTDIR = @INSTDIR@
 LO_SRCDIR = @SRC_ROOT@
 LO_WORKDIR = @WORKDIR@
+LO_ICU_MAJOR = @ICU_MAJOR@
 
 // These are actual Xcode-known settings. The corresponding autoconf
 // variables are prefixed with XCODE_ to make it clear in configure.ac
commit 4867d022d56e2f870f544a139a021e5afcb17312
Author: Tor Lillqvist <tml at collabora.com>
Date:   Sat Apr 12 20:27:41 2014 +0300

    Don't create an icudata library for iOS
    
    The intent being that the data file will be used instead.
    
    To avoid linking error, correspondingly include the ICU stubdata
    library in the list of static libraries to link with.
    
    Change-Id: I0f223fcce89dfbe283aaa2fcd2d5a58ea36ba364

diff --git a/bin/lo-all-static-libs b/bin/lo-all-static-libs
index e1d6e0d..5a71eae 100755
--- a/bin/lo-all-static-libs
+++ b/bin/lo-all-static-libs
@@ -34,17 +34,24 @@ for var in EBOOK_LIBS FREEHAND_LIBS HARFBUZZ_LIBS HUNSPELL_LIBS HYPHEN_LIB MYTHE
     done
 done
 
-androidlibs=
-if test "$OS" = ANDROID; then
-    androidlibs="$WORKDIR/UnpackedTarball/curl/lib/.libs/*.a"
-    androidlibs="$androidlibs $WORKDIR/UnpackedTarball/fontconfig/src/.libs/libfontconfig.a"
-    androidlibs="$androidlibs $WORKDIR/UnpackedTarball/freetype/objs/.libs/libfreetype.a"
-fi
+case $OS in
+ANDROID)
+    oslibs="$WORKDIR/UnpackedTarball/curl/lib/.libs/*.a"
+    oslibs="$oslibs $WORKDIR/UnpackedTarball/fontconfig/src/.libs/libfontconfig.a"
+    oslibs="$oslibs $WORKDIR/UnpackedTarball/freetype/objs/.libs/libfreetype.a"
+    ;;
+IOS)
+    oslibs="$WORKDIR/UnpackedTarball/icu/source/stubdata/*.a"
+    ;;
+*)
+    oslibs=
+    ;;
+esac
 
 echo $INSTDIR/$LIBO_LIB_FOLDER/lib*.a \
      $foolibs \
      $WORKDIR/LinkTarget/StaticLibrary/lib*.a \
-     $androidlibs \
+     $oslibs \
      $WORKDIR/UnpackedTarball/glew/lib/*.a \
      $WORKDIR/UnpackedTarball/icu/source/lib/*.a \
      $WORKDIR/UnpackedTarball/lcms2/src/.libs/*.a \
diff --git a/external/icu/ExternalProject_icu.mk b/external/icu/ExternalProject_icu.mk
index 78e57ac..4450260 100644
--- a/external/icu/ExternalProject_icu.mk
+++ b/external/icu/ExternalProject_icu.mk
@@ -84,7 +84,9 @@ $(call gb_ExternalProject_get_state_target,icu,build) :
 				--enable-static --disable-shared,\
 				--disable-static --enable-shared $(if $(filter ANDROID,$(OS)),--with-library-suffix=lo)) \
 			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)\
-				--with-cross-build=$(WORKDIR_FOR_BUILD)/UnpackedTarball/icu/source)\
+				--with-cross-build=$(WORKDIR_FOR_BUILD)/UnpackedTarball/icu/source) \
+			$(if $(filter IOS,$(OS)), \
+				--with-data-packaging=archive) \
 		&& $(MAKE) \
 		$(if $(filter MACOSX,$(OS)),&& $(PERL) \
 			$(SRCDIR)/solenv/bin/macosx-change-install-names.pl shl OOO \
commit a2adff554052cb3e2561dd7672e532411cb710bb
Author: Tor Lillqvist <tml at collabora.com>
Date:   Sat Apr 12 16:03:41 2014 +0300

    Add udata.cpp from ICU for easy breakpoint setting
    
    Change-Id: Ic830275479ef68af50e4df738d9f5d252bb1cdf0

diff --git a/ios/experimental/TiledLibreOffice/TiledLibreOffice.xcodeproj/project.pbxproj b/ios/experimental/TiledLibreOffice/TiledLibreOffice.xcodeproj/project.pbxproj
index 4d9ce0c..3c5d9d0 100644
--- a/ios/experimental/TiledLibreOffice/TiledLibreOffice.xcodeproj/project.pbxproj
+++ b/ios/experimental/TiledLibreOffice/TiledLibreOffice.xcodeproj/project.pbxproj
@@ -37,6 +37,7 @@
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
+		BE03BF9118F9648F00620DC7 /* udata.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = udata.cpp; path = ../../../workdir/UnpackedTarball/icu/source/common/udata.cpp; sourceTree = "<group>"; };
 		BE0898E81860D42B0021A679 /* brand.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = brand.cxx; path = ../../../vcl/source/app/brand.cxx; sourceTree = "<group>"; };
 		BE0898E91860D42B0021A679 /* dbggui.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = dbggui.cxx; path = ../../../vcl/source/app/dbggui.cxx; sourceTree = "<group>"; };
 		BE0898EA1860D42B0021A679 /* dndhelp.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = dndhelp.cxx; path = ../../../vcl/source/app/dndhelp.cxx; sourceTree = "<group>"; };
@@ -730,6 +731,22 @@
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+		BE03BF8F18F9641D00620DC7 /* External library sources */ = {
+			isa = PBXGroup;
+			children = (
+				BE03BF9018F9642F00620DC7 /* icu */,
+			);
+			name = "External library sources";
+			sourceTree = "<group>";
+		};
+		BE03BF9018F9642F00620DC7 /* icu */ = {
+			isa = PBXGroup;
+			children = (
+				BE03BF9118F9648F00620DC7 /* udata.cpp */,
+			);
+			name = icu;
+			sourceTree = "<group>";
+		};
 		BE0898E61860D3CD0021A679 /* LibreOffice source files */ = {
 			isa = PBXGroup;
 			children = (
@@ -1273,6 +1290,7 @@
 		BE82BD6918218E2E00A447B5 = {
 			isa = PBXGroup;
 			children = (
+				BE03BF8F18F9641D00620DC7 /* External library sources */,
 				BE0898E61860D3CD0021A679 /* LibreOffice source files */,
 				BE82BD7B18218E2E00A447B5 /* TiledLibreOffice */,
 				BEEEF9681860A21F00FBDE67 /* Resources */,


More information about the Libreoffice-commits mailing list