Users of the VFX Forth Professional and Mission editions have all the source code and tools needed to rebuild the system. VFX Forth Mission includes the source code for the tools as well as the Forth source code.
The source code is found in the Sources directory. Tools are in the Tools directory. The build process is controlled by a set of shell scripts in the Sources directory itself. Some of these scripts may contain hard-coded paths and should be checked and edited before running the scripts. The resulting executables will be placed in the directory Sources\Images.
In order to perform a full rebuild of VFX Forth for Mac, you need the following software installed.
www.tug.org/mactex
.Up to OS X 10.6 Snow Leopard, the VFX Forth executable was self-contained -the Mach-O headers were built in the Forth source code. From OS X 10.7 Lion, changes in the Mach-O file format rules, and more particularly in the program loader, mean that we cannot use public developer information to build OS X executable files.
In order to reduce our devlopment load when Apple change the rules again, a small stub written in assembler is used. This stub is bound to the Forth image with some address and memory manipulation to produce the final executable.
To rebuild the stub, make sure that you have the Apple version of nasm and gcc installed. Switch to the Kernel/386OSX folder and type:
./bstubosx.sh
You may have to edit the binary file paths according to your installations. Some developer Macs have more than one version of nasm and gcc installed.
The following source files in Kernel/386OSX must match for the stub and Forth to run correctly:
SAVE
in VFX Forth for Mac.The Forth source files rely particularly on data
copied from the stub into the Forth image. The Forth variable
EntryESP
holds an address in the entry stack which is
used by the Forth Image. EntryESP
is set in startup.fth,
which also references OS X functions to handle shared libraries.
The full build is performed by executing
./RebuildOsx32.sh
from the Sources directory.
The build is performed in three stages:
Short cuts are available through shell scripts described later.
The core kernel is cross-compiled from the Sources/Kernel folder by executing
./mosx.sh
which runs the cross compiler twice to produce the kernel vfxkern.mo.
The second part of the build produces the base version of VFX Forth. This part of the build occurs in Sources/VFXBase. Run:
./mosx32.sh
It compiles the second stage builds to produce vfxosx in the the Sources/Images directory.
To be defined
The PDF and HTML manuals are produced by DocGen in a separate pass. DocGen produces .tex files which are used to produce the PDF manual using Tex. DocGen produces the HTML file directly. The current DocGen file is Lib\DocGen4.fth.
Make sure that you have a suitable version of TeX available for building the PDF manual. A suitable place to start is
http://tug.org/begin.html
You'll need the full installation with:
texinfo
texindex
The HTML and PDF manuals are produced by DocGen. Change to the Sources\Manual directory and run
./MakeOsx.sh
The tools source code supplied with the Mission edition will be found in the Tools\src directory. Each subdirectory will contain a make file makefile or a script make.sh. Tools written in C will have been compiled by gcc.
The two shared libraries, libmpeparser.0.dylib for INI files and vfxsupp.1.0.1.dylib for OS X constants, very rarely need rebuilding.
The INI file support library enables persistent storage of configuration data using Windows-style INI files. The code accesses a derivative of the iniParser v3.0b shared library published by Nicholas Devillard at http://ndevilla.free.fr/iniparser/, where the latest version may be found. Note that the MPE versions differ from this version, but are upward compatible. We have submitted our changes to the author.
The source code for the MPE versions (Linux and Windows) are in Sources/Tools/iniparser3.0b. For the Linux version, use Makefile in the root of the directory. For the Windows version, switch to the src.win folder and run make.bat which is for use with VC6.
The vfxsupp library allows the Forth system to look up Linux constants from header files without applications having to be bloated by a vast number of headers. The number handling mechanism in VFX Forth searches the library if the text cannot converted as a number.
The sources are in Tools/VfxSupport/Osx32. The library is built using Makefile. If you get an error, especially after adding a new header file to headerlist.h, it is nearly always because the constant cannot be correctly evaluated by the Forth application, e.g. because it is a pointer to a text string. In this case, add the item to headerlist.exclude and rebuild. Keep going until there are no more errors.
The essence of the process is that the header files are run through the C pre-processor to produce headerlist.i.orig, filtered by an awk script to produce headerlist.i, and then incorporated into the shared library.
At present, packaging is just creating a tarball, which is done in ReleaseOsx32.sh.
When we ship a bundle, everything will be done by PackageOsx32.sh.
The Mission edition of VFX Forth contains source code and tools for everything to do with VFX Forth, including the full build, release and packaging scripts used by MPE to issue the software. Assuming that the Mission release is in directory called VfxCommunity, the complete process is performed by changing to that directory and running:
./FullOsx32.sh
The script FullOsx32.sh calls many other scripts