Tamarin Build Documentation
From MDC
Contents |
[edit] Supported platforms
Tamarin currently runs on 32-bit Windows, Linux, and OS X (PPC, mactel). The source code of a prototype port to the ARM processor is available, but it is incomplete and has not been thoroughly tested.
[edit] Getting the Tamarin source
The Tamarin source resides in Mercurial at Tamarin Central. Use the following command to create a copy of the Tamarin repository:
$ hg clone http://hg.mozilla.org/tamarin-central tamarin-central
[edit] Building Tamarin
Building Tamarin will create all the libraries for the AVMPlus and garbage collector (MMgc), and create a standalone executable, avmplus, for executing files in the ABC file format. The name of the avmplus executable and its location will vary according the the build system and the configuration parameters. Running avmplus without any arguments will list the available options. Note that additional command-line arguments are only available in the debug configuration.
The Tamarin codebase contains two independent build systems for Microsoft Visual Studio and Apple XCode. In addition, there is a cross-platform build system for Mozilla developers.
The Tamarin codebase has the ability to build additional code which supports debugging hooks. In the XCode project, this is the Debug_Debugger and Release_Debugger configurations. The Flash Player builds Tamarin with the debugging hooks off for codesize reasons, but the Mozilla client will build Tamarin with the debugging hooks on.
[edit] Cross-platform build
First, you must have the Mozilla build prerequisites for your platform. Additionally, you need Python 2.4 or later and GNU make 3.81 or later. (GNU make 3.80 does not work. Nor does any other brand of make.)
With the right prerequisites, use these commands to build Tamarin:
$ hg clone http://hg.mozilla.org/tamarin-central $ cd tamarin-central $ mkdir objdir-debug $ cd objdir-debug $ python ../configure.py --enable-shell $ make
That's all.
For verbose build of Tamarin, you can pass CPPFLAGS to make.
$ make CPPFLAGS=-DAVMPLUS_VERBOSE
[edit] Microsoft Visual Studio
Visual Studio 2005 (VS2005) is the preferred Windows build environment. To build Tamarin using Microsoft Visual Studio 2005, open the Tamarin project file platform/win32/avmplus_8.sln. Visual Studio 2003 is still supported using the project file platform/win32/avmplus.sln, but support may be dropped in the future.
The Windows builds currently require that you manually sync mozilla-central/modules/zlib and copy the modules/zlib directory to parent directory of tamarin-central. This will be corrected in a future build system. Execute the following commands in the same directory that contains your Tamarin repository created above.
$ hg clone http://hg.mozilla.org/mozilla-central mozilla-central $ mkdir ../modules $ cp -r mozilla-central/modules/zlib ../modules/zlib
[edit] Apple XCode
The project files are designed for XCode 2.3 and 2.4. See platform/mac/avmplus/avmplus.xcodeproj/. XCode 2.2 will not work.
The project file builds a macintel executable by default.
Execute the following command to build a PowerPC Tamarin:
$ cd tamarin-central $ xcodebuild ARCHS=ppc -project platform/mac/shell/shell.xcodeproj
For a debug build, add -configuration Debug (note the capital D). Additional configurations are: Debug_Debugger, Release, Release_Debugger.
Intel Macs build correctly by setting ARCHS=i386.
The resulting executable is built at platform/mac/shell/build/Release/shell. (Note: Some libraries are built under tamarin-central/../platform/mac/flash/Builds/Release, outside the root tamarin-central directory. This is probably a bug.)
Note: CodeWarrior project files are provided but not supported. They are provided as a courtesy for anyone working on a legacy codebase that requires them.
[edit] Linux and Unix
Tamarin is untested on Linux or other Unix flavors. Nonetheless, it is possible to build Tamarin on Unix. You need to download zlib sources from http://zlib.net/ (or use a source package available in your distro).
Execute the following commands to build:
$ cd tamarin-central/platform/unix $ make ZLIB_ROOT=/path/to/zlib/sources
The resulting executable "avmplus" is built in the current directory.
[edit] Compiling and running applications
Currently the only compiler for Tamarin is the Adobe ActionScript compiler. The source code for the ActionScript compiler, asc, has been open sourced as part of Adobe Flex®. This compiler is written in Java and will require the installation of a Java™ 1.4 or later JDK.
A prototype self-hosting ECMAScript Edition 4 compiler, esc, is provided with Tamarin but it is not yet capable of bootstrapping itself or building applications. esc is under active development and will be able to generate Tamarin applications later this year.
Use the following steps to build and install the ActionScript compiler.
- Download and build the asc source code using the subversion client
$ svn co http://opensource.adobe.com/svn/opensource/flex/sdk/trunk/modules/asc <local-directory> $ cd asc/build/java $ ant ... jar: [jar] Building jar asc\lib\asc.jar $ java -jar asc.jar # shows usage
You should now copy asc.jar into tamarin-central/utils. asc.jar can be used to compile the builtin.abc file. The builtin.abc file provides internal information about the built-in classes (Object, Array, etc). This file is located in the core directory; you shouldn't normally need to rebuild it, unless you edit any of the ActionScript source for the built-in classes. To rebuild it, use the builtin.py script:
$ cd tamarin-central/core $ export ASC=../utils/asc.jar # builtin.py uses this to find asc.jar $ python builtin.py building builtin.abc, builtin.cpp, builtin.h builtin: 26795 Files: 6 Time: 1709ms
You can now use asc.jar to compile applications.
$ cd tamarin-central
$ echo 'print("hello, world")' > hello.as
$ java -jar ./utils/asc.jar -import ./core/builtin.abc hello.as
hello.abc, 86 bytes written
Use the avmplus standalone executable built previously to run the application:
$ avmplus hello.abc hello, world
Use the -help options of asc.jar and avmplus for more details.
[edit] Running Tamarin compliance tests
The Tamarin compliance tests can now be used to verify your installation . Running the Tamarin test suite requires the following steps:
- Set the
AVMenvironment variable to the path of theavmplusexecutable. - If you want to use the pre-compiled
.abctest files, extract tamarin-test-abcs.tar.gz into thetamarin-central/test/acceptancedirectory. If you want to compile the tests, set$ASCto the location ofasc.jarand$GLOBALABCto the location ofbuiltin.abc. - Execute the test Python script
test/acceptance/runtests.py.
$ cd tamarin-central/test/acceptance $ python runtests.py -f Writing results to /home/kaitlin/tamarin-central/test/acceptance/2007-12-04.3.html Tamarin tests started: 2007/12/04 15:30:37 Executing 1791 tests against vm: /home/kaitlin/tamarin-central/platform/mac/shell/build/Debug/shell 1790 running /home/kaitlin/tamarin-central/test/acceptance/as3/AbcDecoder/useNS.as PASSED passes:3 fails:0 1789 running /home/kaitlin/tamarin-central/test/acceptance/as3/AbcDecoder/typeAnnotation.as PASSED passes:2 fails:0 1788 running /home/kaitlin/tamarin-central/test/acceptance/as3/AbcDecoder/simple.as PASSED passes:2 fails:0 1787 running /home/kaitlin/tamarin-central/test/acceptance/as3/AbcDecoder/inheritClass.as PASSED passes:3 fails:0 ...
The -f flag tells runtests.py to force recompilation of all the scripts. For help on runtests.py options, use python runtests.py -h.
If the avmplus reports that the .abc file is invalid, ensure that you've used a binary transfer protocol for the files download in step 2 above.