2. Building the Self system¶
Last updated 23 September 2024 for Self 2024.1
It is relatively easy to build the two key components of Self, the Self World and the Self Virtual Machine. They both start from downloading the Self sources from the GitHub repository by the following git command:
git clone https://github.com/russellallen/self/
and then follow the instructions below.
2.1. Building a VM¶
2.1.1. Requirements¶
In general, you will generally need the appropriate libraries for Git, CMake, a GCC or Clang toolchain, X and Ncurses. Self is a 32bit program at the moment, so you will need all libraries in 32bit versions.
On Fedora 19 you will need: git cmake gcc gcc-c++ glibc-devel.i686 libstdc++-devel libstdc++-devel.i686 libX11-devel.i686 libXt-devel.i686 libXext-devel.i686 libXrender-devel.i686 libXau-devel.i686 libxcb-devel.i686 ncurses-devel.i686 ncurses-libs.i686
On Ubuntu 16.04 you will need: git cmake g++ gcc-multilib g++-multilib libx11-dev:i386 libxext-dev:i386 libncurses-dev:i386 libtinfo-dev:i386
2.1.2. Building¶
You can do an in-tree build with:
cmake .
cmake --build .
or an out-of-tree build with:
mkdir -p $YOU_BUILD_DIRECTORY; cd $YOU_BUILD_DIRECTORY
cmake $DIRECTORY_OF_SELF_CHECKOUT
cmake --build $YOU_BUILD_DIRECTORY
CMake respects your environment variables, so to build Self with Clang, configure it like this:
CC=clang CXX=clang++ cmake $DIRECTORY_OF_SELF_CHECKOUT
On Mac OS X with Xcode, you can use the Xcode generator of CMake like this:
cmake -GXcode $DIRECTORY_OF_SELF_CHECKOUT
On 64bit Linux, you may want to explicitly use 32bit compilation:
CC="gcc -m32" CXX="g++ -m32" cmake $DIRECTORY_OF_SELF_CHECKOUT
The same holds for Clang.
You may wish to use ccmake
or the CMake GUI (cmake-gui
) to configure available features like Release/Debug/Profiled builds or to enable experimental features.
2.1.3. VM Builder Script¶
There is a python script for building the VM in various OS instances using QEMU at https://github.com/russellallen/Self-VM-Builder which may provide help on how to build the VM.
2.2. How to build the world¶
Should you need to reconstruct a world from the source files, here’s how to do it. This section describes
how to create a default object world by reading in the Self source code distributed through the GitHub repository. You can also do this after writing the world out using the transporter (transporter fileOut fileOutAll
).
2.2.1. From within the main Self tree¶
To create the default object world, change your current working directory to the objects
subdirectory of the Self source release and follow these steps:
Start the Self VM:
% Self Self Virtual Machine Version 4.1.13, Sat 04 Jan 14 12:17:37 Mac OS X i386 (4.4-268-g58a0717) Copyright 1989-2003: The Self Group (type _Credits for credits) VM#
(Optional, but recommended.) Start the spy so you can watch the world fill up with objects:
VM# _Spy: true
Note
You must use the primitive to do this because the world is empty.
Read in the default world. To do this, ask Self to read expressions from a file:
VM# 'worldBuilder.self' _RunScript
2.2.2. From outside the main tree¶
When developing applications which aren’t part of the main Self distribution, it is often convenient to build a Self world from a directory other than the default directory. You can specify on the command line where the main Self distribution is and the options. For example the below builds the world with morphic and also ui1. Use -o none
to build without any graphics.
% Self -f /path/to/Self/objects/worldBuilder.self \ -b /path/to/Self/objects \ -o morphic,ui1
2.2.3. Finishing the build¶
Once you have started the worldBuilder.self
script, you will be given options as to which features you would like in your new world.
Unless you have asked Self not to print script names, you should see something like:
Reading worldBuilder.self... reading ./core/init.self... reading ./core/allCore.self... reading ./core/systemStructure.self... . . .
Unless you have specified the options on the command line, then at various places, you will be asked if you wish to add optional additions to the base system, such as the morphic user interface (UI2) or the earlier UI1 (which requires X11 to run):
Load UI2 (Morphic)? (y/N) > y
After all the files have been read in, Self will start the process scheduler, initialize its module cache, and print:
“Self 0”
That last line is the Self prompt indicating that the system is ready to read and evaluate expressions.
If you have loaded Morphic, you may wish to open up a window:
"Self 0" desktop open Adjusting VM for better UI2 performance: _MaxPICSize: 25 _Flush The ui2 desktop is now running. Type: "desktop stop" to suspend it, "desktop go" to resume it after stopping, and "desktop close" to close it. desktop "Self 1"