title: Distributing a shared library and some C code with a Cython extension module
body: <p>I'm trying to take some functions from a large C++ shared library (libbig.so) and expose them to Python via Cython. To do so, I've got a little C++ file (small.cpp) that provides a thin wrapper around the functionality from the shared library that I need, in a way that makes it easy to call via Cython (pysmall.pyx).</p>
  
  <p>libbig.so -> small.cpp, small.h -> libsmall.so -> pysmall.pyx -> pysmall.cpp -> pysmall.so</p>
  
  <p>I can build and run this extension module on my own computer: I just compile small.cpp into libsmall.so, and then say "libraries=['small']" in the Extension object in setup.py to build the extension module pysmall.so.</p>
  
  <p>I'm now trying to distribute this extension module, and I am having a hard time tracking down resources that describe setup.py best practices for distributing a Cython module as well as C source and shared libraries. I've read through "<a href="http://docs.python.org/install/index.html">Installing Python Modules</a>",  "<a href="http://docs.python.org/distutils/index.html">Distributing Python Modules</a>", and "<a href="http://docs.cython.org/src/userguide/source_files_and_compilation.html#distributing-cython-modules">Distributing Cython Modules</a>". I understand how to distribute an extension module on its own. I'm less certain about the best way to distribute the dependencies of the extension module.</p>
  
  <p>The Cython documentation indicates that you should include the generated .cpp files as well as the .pyx files, in case Cython is not present, yet it does not provide code to demonstrate how to best handle each situation. It also does not mention how to distribute the shared libraries on which the Cython module depends.</p>
  
  <p>I'm digging through the setup.py scripts from pandas, lxml, pyzmq, h5py, and more, and there's quite a bit of extraneous work happening. If anyone has pointers or example code that might accelerate this process, I'd certainly appreciate it!</p>