Friday, July 3, 2009

Cygwin: To Convert Pango Static Libraries to Shared Libraries

Pango is a required component of GTK+ libraries. With Cygwin GCC compiler, I was compiling Pango during GTK+ compilation. But I ran into a problem when only static libraries of Pango were produced. So I had to produce shared libraries of Pango from static ones. Here I show how I did it using dllwrap:



  1. First, create empty directories:

    mkdir pango pangocairo pangoft2 pangowin32

  2. Extract object codes from the static libraries into separate directories:

    cd pango
    ar x /usr/lib/libpango-1.0.a
    cd ../pangocairo/
    ar x /usr/lib/libpangocairo-1.0.a
    cd ../pangoft2/
    ar x /usr/lib/libpangoft2-1.0.a
    cd ../pangowin32/
    ar x /usr/lib/libpangowin32-1.0.a

  3. Create a shared library cygpango-1.0-0.dll and import library libpango-1.0.dll.a from the static library /usr/lib/libpango-1.0.a. The dependencies are gotten from /usr/lib/libpango-1.0.la:

    cd ../pango/

    dllwrap --verbose --export-all-symbols --add-stdcall-alias -o /usr/bin/cygpango-1.0-0.dll --dllname cygpango-1.0-0.dll --output-lib /usr/lib/libpango-1.0.dll.a *.o -L/usr/lib -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -luser32 -lkernel32 -lintl -liconv

  4. Likewise, convert /usr/lib/libpangowin32-1.0.a to a shared library:

    cd ../pangowin32/

    dllwrap --verbose --export-all-symbols --add-stdcall-alias -o /usr/bin/cygpangowin32-1.0-0.dll --dllname cygpangowin32-1.0-0.dll --output-lib /usr/lib/libpangowin32-1.0.dll.a *.o -L/usr/lib -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -luser32 -lkernel32 -lintl -liconv -lgdi32

  5. Likewise, convert /usr/lib/libpangoft2-1.0.a to a shared library:

    cd ../pangoft2/

    dllwrap --verbose --export-all-symbols --add-stdcall-alias -o /usr/bin/cygpangoft2-1.0-0.dll --dllname cygpangoft2-1.0-0.dll --output-lib /usr/lib/libpangoft2-1.0.dll.a *.o -L/usr/lib -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -luser32 -lkernel32 -lintl -lfontconfig -lxml2 -liconv -lfreetype -lz

    If fontconfig was compiled with expat, replace -lxml2 with -lexpat.


  6. Likewise, convert /usr/lib/libpangocairo-1.0.a to a shared library:

    cd ../pangocairo/

    dllwrap --verbose --export-all-symbols --add-stdcall-alias -o /usr/bin/cygpangocairo-1.0-0.dll --dllname cygpangocairo-1.0-0.dll --output-lib /usr/lib/libpangocairo-1.0.dll.a *.o -L/usr/lib -lcairo -lmsimg32 -lpixman-1 -lpng12 -lpangowin32-1.0 -lgdi32 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -luser32 -lkernel32 -lintl -lfontconfig -lxml2 -liconv -lfreetype -lz

    If fontconfig was compiled with expat, replace -lxml2 with -lexpat.



  7. Finally, modify /usr/lib/libpango*.la accordingly. For example, I made the following change to my libpango-1.0.la file:

    dlname='../bin/cygpango-1.0-0.dll'
    library_names='libpango-1.0.dll.a'


This creates shared libraries cygpango-1.0-0.dll, cygpangowin32-1.0-0.dll, cygpangoft2-1.0-0.dll, cygpangocairo-1.0-0.dll and import libraries libpango-1.0.dll.a, libpangowin32-1.0.dll.a, libpangoft2-1.0.dll.a, libpangocairo-1.0.dll.a.

No comments:

Post a Comment

About This Blog

KBlog logo This blog is about current events and issues concerning general population. Thanks for visiting the blog and posting your comments.

© Contents by KBlog

© Blogger template by Emporium Digital 2008

Followers

Total Pageviews

icon
Powered By Blogger