Sonntag, 10. Februar 2013

ICU

What is ICU?

ICU is a C Library for working with UTF-8 strings and other internationalization issues in portable programs.

Installation and Quickstart

1. Download library

http://site.icu-project.org/download/50#TOC-ICU4C-Download
File: icu4c-50_1_2-src.zip

2. Configure and compile

# Load the MinGW MSYS Shell (it does not work from the Windows command prompt)
./configure
make

3. Try compiling and running a sample program from the build directory

cd source\samples\date
# set the CPATH and PATH as appropriate to include the include directorie(s)
# into CPATH and the dll directory into the PATH
gcc -c uprint.c
gcc -o date date.c ../../lib/*.dll uprint.o
./date --full

4. Install the headers into a standard place

mkdir "%USERPROFILE%/include/icu/"
cp -v include/*.h "%USERPROFILE%/include/cdk/"

# Create include directory with the same structure as ICU source tree
mkdir $USERPROFILE/include/icu
cd $USERPROFILE/include/icu
mkdir -p common/unicode extra/scrptrun extra/uconv/unicode \
i18n/unicode io layout layoutex/layout \
samples/{cal,date,datefmt,layout,msgfmt,numfmt,translit,uciter8,ucnv} \
tools/ctestfw/unicode \
tools/{gennorm2,genrb,gensprep,gentest,makeconv,pkgdata,toolutil,tzcode}

# Change directory back to the source root
cd -

# Copy all .h files into appropriate places in HOME-based structure
gnufind . -iname '*.h' -exec cp -v '{}' $USERPROFILE/include/icu/'{}' ';'

5. Install libs (only dynamic libs appear to be working)

mkdir "%USERPROFILE%/lib/icu/"
cp -v lib/*.dll "%USERPROFILE%/lib/icu/"

6. Update environment

Add %USERPROFILE%\include\icu\common and %USERPROFILE%\include\icu\i18n to CPATH
Add %USERPROFILE%\lib\icu to LIBRARY_PATH and PATH
Batch file env-icu.bat will be used to define this environment

7. Compile and run the test program outside of the build directory

env-icu
# For convenience, copy the dll files into the local project directory
copy "%USERPROFILE%\lib\icu\*.dll" .
gcc -c uprint.c
gcc -o date date.c *.dll uprint.o
./date --full

Keine Kommentare:

Kommentar veröffentlichen