Humanizing the Build Process with SCons

Yes, writing build files can be as much fun as coding in Python.

Atul Varma

Humanized, Inc.

The Complexities of Building Software

GNU Make's Approach

Make is Pretty Low-Level

Where Automake and Autoconf Lead Us.

AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)])

# get rid of the -export-dynamic stuff from the configure flags ...
export_dynamic=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`

# cairo
PKG_CHECK_MODULES(CAIRO, cairo >= cairo_required_version)
if test -n "$export_dynamic"; then
  CAIRO_LIBS=`echo $CAIRO_LIBS | sed -e "s/$export_dynamic//"`
fi

# cairo + cairo-xlib + gtk + pygtk
if test x"$with_pygtk" = xyes; then
  # was cairo compiled with cairo-xlib enabled?
  save_LIBS="$LIBS"
  LIBS="$CAIRO_LIBS"
  AC_CHECK_LIB([cairo], [cairo_xlib_surface_create], [], [with_pygtk=no])
  LIBS="$save_LIBS"
fi
This is a configure.ac file from the PyCairo distribution. The GNU Autotools essentially use it to convert it into an incredibly complicated Makefile, which (hopefully) no one has the misfortune of ever having to read.

Um...

Introducing SCons

Okay, Calm Down.

The SCons Builder Object

Batteries Included!

The SCons File Node Object

The SCons Environment Object

The CPPDEFINES Environment variable is used by the SCons Program builder to pass the defines on to the C/C++ compiler.

Some Environment Caveats

Other Cool Stuff SCons Supports...

Where now?