ICU 3.6 stub static libsicudata.a library

View: New views
3 Messages — Rating Filter:   Alert me  

ICU 3.6 stub static libsicudata.a library

by Rand Childs :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is it possible to build and install a stub version of the static ICU  
data library (libsicudata.a) and have ICU use the memory mapped  
package file icudt36b.dat using ICU_DATA environment variable instead  
of statically linking in 10MB of data in every program on a Unix system?

I tried building with

--enable-static=yes
--with-data-packaging=files

but the installed libsicudata.a apparently still contained 10MB of  
data which was statically linked into every program.  Is there some  
option I'm missing or not specifying correctly to build and install a  
stub libsicudata.a file?

Thanks

Rand


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
icu-support mailing list - icu-support@...
To Un/Subscribe: https://lists.sourceforge.net/lists/listinfo/icu-support

Re: ICU 3.6 stub static libsicudata.a library

by George Rhoten :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The problem is due to the following lines in icu/source/data/Makefile.in,
which always builds all the data into a static library.  It should
actually build the static data library when ENABLE_STATIC is YES, and
PKGDATA_MODE is dll.  You can submit a bug at
http://icu-project.org/bugs.html to request a fix.  General purpose
patches are welcome :-)

packagedata: icupkg.inc $(PKGDATA_LIST) build-local
ifneq ($(ENABLE_STATIC),)
        $(PKGDATA_INVOKE) $(PKGDATA) -e $(ICUDATA_ENTRY_POINT) -T
$(OUTTMPDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBSTATICNAME) -m static
$(PKGDATA_LIST)
endif
ifneq ($(ICUDATA_SOURCE_IS_NATIVE_TARGET),YES)
        $(PKGDATA_INVOKE) $(PKGDATA) -e $(ICUDATA_ENTRY_POINT) -T
$(OUTTMPDIR) -p $(ICUDATA_NAME) -m $(PKGDATA_MODE) $(PKGDATA_VERSIONING)
$(PKGDATA_LIBNAME) $(PKGDATA_LIST)
else
        $(INSTALL_DATA) $(ICUDATA_SOURCE_ARCHIVE) $(OUTDIR)
endif

## Install ICU data.
install-local: $(PKGDATA_LIST) ./icupkg.inc packagedata $(OS390INSTALL)
        $(MKINSTALLDIRS) $(TMPDATADIR) $(DESTDIR)$(ICUPKGDATA_DIR)
ifneq ($(ENABLE_STATIC),)
        $(PKGDATA_INVOKE) $(PKGDATA) -m static -e $(ICUDATA_ENTRY_POINT)
-T $(OUTTMPDIR) -s $(BUILDDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBSTATICNAME)
$(PKGDATA_LIST) -I $(ICUPKGDATA_INSTALL_LIBDIR)
endif
ifneq ($(ICUDATA_SOURCE_IS_NATIVE_TARGET),YES)
        $(PKGDATA_INVOKE) $(PKGDATA) -m $(PKGDATA_MODE)
$(PKGDATA_VERSIONING) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -s
$(BUILDDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBNAME) $(PKGDATA_LIST) -I
$(ICUPKGDATA_INSTALL_DIR)
else
        $(INSTALL_DATA) $(ICUDATA_SOURCE_ARCHIVE)
$(DESTDIR)$(ICUPKGDATA_DIR)
endif

George Rhoten
IBM Globalization Center of Competency/ICU  San José, CA, USA
http://www.icu-project.org/



Rand Childs <randchilds@...>
Sent by: icu-support-bounces@...
05/12/2007 05:14 AM
Please respond to
ICU support mailing list <icu-support@...>


To
icu-support@...
cc

Subject
[icu-support] ICU 3.6 stub static libsicudata.a library






Is it possible to build and install a stub version of the static ICU
data library (libsicudata.a) and have ICU use the memory mapped
package file icudt36b.dat using ICU_DATA environment variable instead
of statically linking in 10MB of data in every program on a Unix system?

I tried building with

--enable-static=yes
--with-data-packaging=files

but the installed libsicudata.a apparently still contained 10MB of
data which was statically linked into every program.  Is there some
option I'm missing or not specifying correctly to build and install a
stub libsicudata.a file?

Thanks

Rand


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
icu-support mailing list - icu-support@...
To Un/Subscribe: https://lists.sourceforge.net/lists/listinfo/icu-support



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
icu-support mailing list - icu-support@...
To Un/Subscribe: https://lists.sourceforge.net/lists/listinfo/icu-support

Re: ICU 3.6 stub static libsicudata.a library

by Glenn-22 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Is it possible to build and install a stub version of the static ICU  
> data library (libsicudata.a) and have ICU use the memory mapped  
> package file icudt36b.dat using ICU_DATA environment variable instead  
> of statically linking in 10MB of data in every program on a Unix system?
>
> I tried building with
>
> --enable-static=yes
> --with-data-packaging=files
>
> but the installed libsicudata.a apparently still contained 10MB of  
> data which was statically linked into every program.  Is there some  
> option I'm missing or not specifying correctly to build and install a  
> stub libsicudata.a file?

I faced a similar problem, in that my usage of ICU is restricted to only
certain time-formatting issues, so all I needed was the U.S. locale and
the set of world timezones.  I didn't want to link in 10 MB of stuff I
don't need.  I was starting with the source code distribution which
did not include an easy mechanism to regenerate the data library, so I
figured out how to cut down the existing library.  What was required
was a patch (already applied to the code, post-3.6) to icupkg, and a
change to a Makefile.in file so the built library only contains the
particular components I'm interested in.  Sure, this is a hack, but
perhaps it will lead someone to think about how to generalize this
capability into something officially supported.  The two patches are
supplied below, modulo some potential line-wrap damage from the email
client and some probable conversion of tabs to spaces as I copy the
patches here.

% cat icu4c-3_6.patch0
*** icu4c-3_6/source/tools/icupkg/icupkg.cpp.orig       2006-07-21
14:17:52.000000000 -0700
--- icu4c-3_6/source/tools/icupkg/icupkg.cpp    2007-04-28 20:36:31.000000000
-0700
***************
*** 504,510 ****
          listPkg=readList(sourcePath, options[OPT_ADD_LIST].value, TRUE);
          if(listPkg!=NULL) {
              pkg->addItems(*listPkg);
-             delete listPkg;
              isModified=TRUE;
          } else {
              printUsage(pname, FALSE);
--- 504,509 ----

% cat icu4c-3_6.patch1
*** icu4c-3_6/source/data/Makefile.in.orig      2006-08-11 15:22:24.000000000
-0700
--- icu4c-3_6/source/data/Makefile.in   2007-04-28 21:57:36.000000000 -0700
***************
*** 344,350 ****
  ifneq ($(ICUDATA_SOURCE_IS_NATIVE_TARGET),YES)
        @echo "Unpacking $(ICUDATA_SOURCE_ARCHIVE) and generating $@ (list of
data files)"
        @-$(RMV) $@
!       $(INVOKE) $(BINDIR)/icupkg -d $(BUILDDIR) --list -x \*
$(ICUDATA_SOURCE_ARCHIVE) > $@
  else
        @echo "$@" > $@
  endif
--- 344,355 ----
  ifneq ($(ICUDATA_SOURCE_IS_NATIVE_TARGET),YES)
        @echo "Unpacking $(ICUDATA_SOURCE_ARCHIVE) and generating $@ (list of
data files)"
        @-$(RMV) $@
!       # Just choose the resource components we actually need for our
application.
!       echo res_index.res >  $@
!       echo root.res      >> $@
!       echo en_US.res     >> $@
!       echo zoneinfo.res  >> $@
!       $(INVOKE) $(BINDIR)/icupkg -d $(BUILDDIR) -x $@
$(ICUDATA_SOURCE_ARCHIVE)
  else
        @echo "$@" > $@
  endif

After applying the patches and rebuilding, I have:

-rw-r--r-- 1 user  group   165830 Apr 28 22:16 ./source/lib/libsicudata.a

which is a reasonable size.

The trick in this sort of thing is to understand exactly which library
components you really need.  What I selected is a guess that seems to
work for my needs; YMMV.


       
____________________________________________________________________________________Ready for the edge of your seat?
Check out tonight's top picks on Yahoo! TV.
http://tv.yahoo.com/

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
icu-support mailing list - icu-support@...
To Un/Subscribe: https://lists.sourceforge.net/lists/listinfo/icu-support