Currently, libstemmer is only available as a bundled library directly within app-misc/sphinx. It would be very handy to have an ebuild akin to the "libstemmer-dev" package in Debian that contains a shared library for libstemmer to include in other projects and/or future ebuilds more easily.
Looking into this more, upstream does not build a shared library by default. The source for the Debian package (http://packages.debian.org/wheezy/libstemmer-dev) includes a patch to snowball's GNUmakefile to build libstemmer.so instead of libstemmer.o. I think for Gentoo it might be easier to use the same tgz we've got (mirror://gentoo/libstemmer_c-20091122.tgz) and build the shared library directly in the ebuild since the patch to the snowball makefile simply adds a few lines to build a shared library from the single source file. I'm definitely not an expert on ebuild best practices though, so I'm relaying my research and ideas in case they're helpful.
This is on my todo list because the last sphinx release allows building against an out-of-tree libstemmer. Not sure when I'll get to it, so patches welcome :-)
Created attachment 332330 [details, diff] libstemmer_c-shared-library.patch
Created attachment 332332 [details] libstemmer-20091122.ebuild Please don't judge my ebuild skills too harshly, but I would absolutely love input on how I could or should improve. :)
Oh, I guess I ought to mention that I've put my ebuild in "dev-libs/libstemmer". I'm not positive if that is the appropriate place (but I did look around to make sure it's at least similar to what's in dev-libs). Also, as evidenced by the comments in the ebuild, I'm not sure if this should be called "libstemmer_c", or if this one ebuild should instead handle both "libstemmer_c" and "libstemmer_java". We're concerned with having libstemmer_c, so that's all I've worked on here. :)
I had a quick visual look at the ebuild, and it looks good in general. In EAPI=5 you can install header files with doheader. Also, we could use a static-libs USE flag here to control building the .a version of the library. Also, I'm wondering if we should not call this dev-libs/snowball, or dev-libs/snowball-stemmer.
Ah, static-libs makes sense, and I'm glad to see we get doheader in EAPI=5. I'll switch over to 5 and use that. :) My concern with calling it "snowball" is that we aren't actually packaging snowball itself, just its stemmer, so I definitely would vote for "snowball-stemmer" (I went with libstemmer to match Debian, which really doesn't matter much :P). That doesn't answer the question of whether it ought to also include the Java version, though. With a generic name like that, I would guess that it probably should, but I've never even looked at a java-including ebuild before, so I wouldn't even know where to try putting the files, or whether they'd need to be compiled. :) I'll make a few tweaks based on your input here and reupload. :)
Created attachment 332384 [details] snowball-stemmer-20091122.ebuild Ok, here's a tweaked version of the ebuild. I still need to adapt my patch to allow for conditional building of the .a file (right now, we just build both and only install the .a if the static-libs use flag is enabled).
Created attachment 332422 [details, diff] libstemmer_c-shared-library.patch Updated patch to support building the shared library and the static library individually. Updated ebuild will follow shortly.
Created attachment 332424 [details] snowball-stemmer-20091122.ebuild Updated ebuild with proper conditional building, only doing as much work as requested. :)
Created attachment 332426 [details, diff] libstemmer_c-shared-library.patch Sorry for the multiple posting, this should be the final one for this bit. This is a slight update to the patch to make the final Makefile more complete with a proper "clean" target, in case we need that working correctly later or someone else borrows the patch.
I've now added this to the tree as snowball-stemmer 0.20091122. Thanks for providing the ebuild and patch.