WORD PTR

Pointed Development

wordptr.libwpd – Now a Static Library

| Comments

tl;dr wordptr.libwpd can now be linked as a static library.

I spent a few cycles this morning updating wordptr.libwpd to be an actual static library, not an executable. The static library libwpd.la gets built under ./src.

Get the latest.

1
$ git clone git://github.com/jgshort/wordptr.libwpd.git

First, I changed the configuration for autotools. I had to update ./src/Makefile.am to build a library rather than a bin, something like this:

1
2
3
4
5
lib_LTLIBRARIES = libwpd.la
libwpd_la_SOURCES = wp_common.c wp_pool.c wp_string.c wp_configuration.c wp_daemonizer.c
bin_PROGRAMS = wpd
wpd_SOURCES = wpd.c tests/libwpd_tests.c
wpd_LDADD = libwpd.la

… where lib_LTLIBRARIES indicates the output library and libwpd_la_SOURCES indicates the files used to build libwpd.la. I kept an executable around to demonstrate the interface, which I renamed wpd.

Finally, I had to execute libtoolize and autoreconf -i once I made the appropriate changes to the various configuration files. Here’s a rough sketch of the steps I had to take to create the updated library build. I didn’t have libtool, so I had to yum install it, first.

1
2
3
4
5
6
$ sudo yum install libtool
$ aclocal
$ libtoolize
$ autoreconf -i
$ ./configure
$ make

You should now be able to ./configure && make from the wordptr.libwpd folder, link against the libwpd.la static library and daemonize away. There’s yet a lot of work to do to really create a robust library from the sample Linux daemon code from which wordptr.libwpd descends, but the library works, the daemonizer works and it’s (somewhat) pretty clean.

Have fun.

Comments