[sword-devel] Now Announcing: Bindings Magic!
Greg Hellings
greg.hellings at gmail.com
Sun Aug 22 21:17:45 MST 2010
List,
I would like to announce that, in current SVN, is a small amount of
modifications to the SWIG bindings which allow both the Python and the
Perl bindings to be built. They can be built with both CMake and
Autotools. To make them, perform the following steps, based on your
toolset of choice.
Build dependencies are a valid sword build (included in the below
directions) and an installation of swig. I have built against 1.3.40
and possibly against 2.0.0, though I'm not sure about the latter.
CMake with just Python:
<from parallel directory to sources>
cmake -DSWORD_BINDINGS="Python" ../sword-sources/
make -j5 && sudo make install
cd bindings/swig/python
sudo python setup.py install
CMake with just Perl
<from parallel directory to sources>
cmake -DSWORD_BINDINGS="Perl" ../sword-sources/
make -j5 && sudo make install
cd bindings/swig/perl
sudo make install
CMake with both sets of bindings
<from parallel directory to sources>
cmake -DSWORD_BINDINGS="Python Perl" ../sword-sources/
make -j5 && sudo make install
cd bindings/swig/python
sudo python setup.py install
cd ../perl
sudo make install
(I typed those out from memory, so please forgive me if they're slightly off)
Autotools:
<from the source directory>
./autogen.sh
./usrinst.sh
make -j5 && sudo make install
Now, to prepare the bindings for build, do:
cd bindings/swig/package
./autogen.sh
./configure
Now if you want the Python bindings, do
make pythonswig
make python_make
cd python
sudo python setup.py install
And to make the Perl bindings, do
make perlswig
make perl_make
cd perl
sudo make install
There is a sample Perl script at <top sword
dir>/bindings/swig/sword.pl that you can run to confirm that the Perl
bindings are installed and working. To confirm that the Python
bindings are working properly, I used a simpler basic set of testing
scripts for myself, but you can either test it yourself or try running
BPBible. Since I did have to edit the bindings, the BPBible team
should definitely test that I didn't adversely affect their
application. All of my changes to the *.i files _should_ have been
contained inside of a #ifdef pre-compiler directives so that they only
affected when building for Perl. But I can't be absolutely certain of
that.
When building, the bindings throw lots of warning. I have not yet
come across an instance where that can't be handled, but I would love
to learn more about SWIG and see if I can eliminate those. I
currently have no knowledge of SWIG, though, and I wanted to see if
the team from BPBible has a test suite in their application that I
could use to ensure I don't foul up their work if I do tackle cleaning
up the compile of the bindings.
--Greg
More information about the sword-devel
mailing list