SWIG-3.0.12

Introduction to SWIG

SWIG (Simplified Wrapper and Interface Generator) is a compiler that integrates C and C++ with languages including Perl, Python, Tcl, Ruby, PHP, Java, C#, D, Go, Lua, Octave, R, Scheme, Ocaml, Modula-3, Common Lisp, and Pike. SWIG can also export its parse tree into Lisp s-expressions and XML.

SWIG reads annotated C/C++ header files and creates wrapper code (glue code) in order to make the corresponding C/C++ libraries available to the listed languages, or to extend C/C++ programs with a scripting language.

This package is known to build and work properly using an LFS-8.1 platform.

Package Information

SWIG Dependencies

Required

PCRE-8.41

Optional

Boost-1.64.0 for tests, and any of the languages mentioned in the introduction, as run-time dependencies

User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/swig

Installation of SWIG

If you plan to run the tests, some fixes are needed for using Perl-5.26:

sed -i 's/\$(PERL5_SCRIPT/-I. &/' Examples/Makefile.in &&
sed -i 's/\$command 2/-I. &/' Examples/test-suite/perl5/run-perl-test.pl

Install SWIG by running the following commands:

./configure --prefix=/usr                      \
            --without-clisp                    \
            --without-maximum-compile-warnings &&
make

To test the results, issue: make -k check TCL_INCLUDE= GOGCC=true. The (un)setting of the two variables GOGCC and TCL_INCLUDE is necessary, since they are not correctly set by configure. The tests are only executed for the languages installed on your machine, so the disk space and SBU values given for the tests may vary, and should be considered as mere orders of magnitude. If you have both Python-2.7.13 and Python-3.6.2 installed, the Python-3 tests are not run. You can run tests for Python-3 by issuing PY3=1 make check-python-examples followed by PY3=1 make check-python-test-suite. According to SWIG's documentation, the failure of some tests should not be considered harmful.

Now, as the root user:

make install &&
install -v -m755 -d /usr/share/doc/swig-3.0.12 &&
cp -v -R Doc/* /usr/share/doc/swig-3.0.12

Command Explanations

--without-maximum-compile-warnings: disables compiler ansi conformance enforcement, which triggers errors in the Lua headers (starting with Lua 5.3).

--without-<language>: allows disabling the building of tests and examples for <language>, but all the languages capabilities of SWIG are always built. We use it for Clisp, because the SWIG implementation is very incomplete and a lot of tests fail.

Contents

Installed Programs: swig and ccache-swig
Installed Library: None
Installed Directories: /usr/share/doc/swig-3.0.12 and /usr/share/swig

Short Descriptions

swig

takes an interface file containing C/C++ declarations and SWIG special instructions, and generates the corresponding wrapper code needed to build extension modules.

ccache-swig

is a compiler cache, which speeds up re-compilation of C/C++/SWIG code.

Last updated on 2017-08-26 09:42:24 -0700