[Distutils] Building ordinary shared library?

René Liebscher R.Liebscher@gmx.de
Mon Oct 7 03:18:02 2002


Pearu Peterson schrieb:
> 
> On Sat, 5 Oct 2002, David Abrahams wrote:
> 
> > Hi,
> >
> > I'm about to release v2 of Boost.Python, and I thought it might be nice to
> > provide a distutils setup for it. We have our own build system, but some
> > Python users might be more comfortable with distutils, and I have a secret
> > hope that distutils will be able to work on a few paltforms we don't have
> > covered such as MacOS X.
> >
> > I'm now kicking myself for throwing them away, but one of my users sent me
> > distutils scripts for Boost.Python a while back as part of a bug report.
> >
> > My problems are twofold:
> >
> > 1. I have to distribute a shared library which is not an extension module.
> > The extension modules I have to distribute (tests and examples) all link to
> > this library.
> 
> Attached is a setup_libbpl2.py file that builds libbpl2.so file containing
> boost.python code. After
>   setup_libbpl2.py install
> it can be used as follows. The setup.py file of the extension module
> contains the following bits:
> 
> from libbpl2 import __file__ as boost_so
> 
> ext = Extension('foo',
>                 sources=[..],
>                 include_dirs=[boost_dir]+..,
>                 ..
>                 extra_objects = [boost_so],
>                 )
> 
> Attachement also includes setup_ginac.py file as a real example of using
> libbpl2 library.
> 
> ...

Is is not necessary to compile it as python module, you can also use the
compiler
classes directly. For example for PyOpenGL we make a TK module this way.

see for example function togl_build in
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/pyopengl/PyOpenGL2/setup/togl_setup.py?rev=1.7&content-type=text/vnd.viewcvs-markup

kind regards
Rene Liebscher