Linux HOWTOs

About | Home | Search


ERROR: Slooooow dooooown... this page load was delayed.

HOWTO: swig
Description: Generates wrapper c/c++ code for other languages
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# SWIG 2.0.10 (Simplified Wrapper and Interface Generator)
# ===========
# Prerequisites:
# PCRE
# boost >= 1.20.0
# SWILL (optional; I don't have it...)
# XFree86 or X.org (optional)
# TCL (optional)
# Python (optional)
# Perl (optional)
# Java (optional)
# Guile (optional)
# mzscheme (optional)
# Ruby (optional)
# PHP (optional) (here is my apache 1.x howto, here is my apache 2.x howto)
# OCaml (optional)
# pike (optional)
# chicken (optional)
# Mono (optional)
# Lua (optional)
# ...
# zlib

# Get it
cd
test -f installed/swig-2.0.10.tar.gz &&
 mv installed/swig-2.0.10.tar.gz .
test ! -f swig-2.0.10.tar.gz &&
 wget http://downloads.sf.net/swig/swig-2.0.10.tar.gz

# Extract the source
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "swig-*" -exec rm -r {} \;
tar xzvf ~/swig-2.0.10.tar.gz
cd swig-2.0.10
test $UID = 0 && chown -R root:root .

# Configure the build and build it
./configure --mandir=/usr/local/man
make

# Test it (takes a while)
make -k check

# Become root to install it
su

# If this is an upgrade, you may want to clean up /usr/local/share/swig/*
# directories from older versions

# Install it
make install

# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .

# Become your non-root user again
exit

# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/swig-*.tar.*
mv swig-2.0.10.tar.gz installed/


# If you ever want to uninstall SWIG, this should do it:
cd
su
test -d src/swig-* && ( cd src/swig-* ; make uninstall )
( cd /usr/local/bin ; ccache-swig swig )
rm -f /usr/local/man/man1/ccache-swig.1
test -d /usr/local/share/swig && rm -r /usr/local/share/swig
exit
find ~/src -maxdepth 1 -type d -name "swig-*" -exec rm -r {} \;
rm -f ~/installed/swig-*.tar.*

Back to the list


Last updated: Tue, 07 Aug 2018 12:06:17 -0400
Jason Englander <jason at englanders dot us>