Using SCons to build Eiffel systems

From the  SCons FAQ question "What is SCons?":

SCons is a software construction tool--that is, a superior alternative to the classic "Make"
build tool that we all know and love.

SCons is implemented as a Python script and set of modules, and SCons "configuration files"
are actually executed as Python scripts. This gives SCons many powerful capabilities not 
found in other software build tools. 

SCons has built in support for handling many different types of tools for many different languages. Unfortunately there is no default tool in SCons for compiling Eiffel systems with EiffelStudio or with the Gobo Eiffel Compiler. However Peter Gummer has written a nice SCons Tool for EiffelStudio that can be easily added to a SCons installation enabling you to use SCons for your Eiffel systems as well as all your other build tasks.

Peter Gummer's EiffelStudio tool: Eiffel.py

Peter Gummer's  EiffelStudio SCons Tool is implemented in a single 'Eiffel.py' file and is typically registered as a SCons Builder with the name "Eiffel". Note that the EiffelStudio Tool assumes you have SCons 1.1.0. See the link for more information on the Tool and how to use it.

The version of SCons included in the standard Ubuntu 8.04 Hardy Heron package repository is 0.97.0d20071203. The EiffelStudio Tool will not work with that version. Attached to this page you can find an older version of the EiffelStudio Tool that works with SCons 0.97.0d20071203.

Here we have a modified version of the 'Eiffel.py' file. This modified version takes care of generating .map files for the GNU linker 'ld' that solves the EiffelStudio problem of exported symbols in shared libraries on Linux/ELF systems. The file can be found here.

Installation on Ubuntu Linux is simply done by placing the file 'Eiffel.py' here:

/usr/lib/scons/SCons/Tool/Eiffel.py

Here is a simple example of a SConstruct file for finalizing a fictive Eiffel system "foobar", assuming the SConstruct file is located in the same directory as the .ecf file:

# Create a SCons environment that has the SCons Eiffel Tool
env = Environment(ENV = os.environ, tools = ['default', 'Eiffel'])

# Finalize the foobar system, target is the returned target node, eg: "EIFGENs/foobar/F_code/foobar"
target = env.Eiffel ("foobar", "foobar.ecf")

Attachments