Although online access to Medley Interlisp is convenient and prebuilt binaries are available for all major operating system, it's also possible to compile it from source.
I first built Medley from source when I wanted to run it on my Raspberry Pi 400 and no ARM64 binaries were available. I later built Medley on Linux to try other options such as SDL2 support instead of X11. Since the build process is simple and fast, even on low-end devices such as the Pi 400, now I often do it on Linux.
There are some compilation instructions and notes for Maiko and Medley (see also the scripts README) but not a full build guide, so I fleshed out the details with the help of the project team.
I initially didn't write down the process as I relied on memory, which sometimes made me take wrong turns and waste time. This post finally puts together all the required steps and information for my own reference, and I hope it will be useful to you too.
Building Medley involves downloading the sources, configuring the environment, compiling the Maiko Virtual Machine, and generating the Medley system image.
What to build
Medley provides a number of compilation options, such as SDL2 support as an alternative to X11, with configurations that range from a minimal system to a complete build that includes all the Lisp applications like NoteCards.
These instructions cover building the complete system, which Medley veterans frequently refer to as the “apps sysout” as a sysout is a Lisp image.
Assumptions
The process I describe assumes you'll build the system on Linux using Clang. If you prefer Gcc the Maiko README file explains what to do. In addition I assume you're familiar with the Unix C toolchain and the shell.
Although the instructions may work on similar platforms, if you're not on Linux you'll need to adapt them to your setup.
The setup
The tools to compile Medley are the same as for C development on Linux, with a few additional dependencies. Make sure the following packages are installed on your system:
- Clang:
clang
- Make:
make
- X11 development libraries:
libx11-dev
- SDL2 development libraries (optional):
libsdl2-dev
libsdl2-dev
is needed only if you want SDL2 instead of X11.
I store the Medley sources under ~/interlisp
and the build instructions assume this location. Change to the ~/interlisp
directory and download the required files.
The Medley Interlisp project automatically publishes weekly binary builds whereas the project repositories hold the source tree. Since there is really no stable source release per se, these instructions assume you use git
to download the sources of Maiko, Medley, and NoteCards:
$ cd ~/interlisp
$ git clone https://github.com/Interlisp/maiko.git
$ git clone https://github.com/Interlisp/medley.git
$ git clone https://github.com/Interlisp/notecards.git
The repos are pretty large, so to save space and bandwidth you may want to run git
with the --depth 1
option.
After the download the source directory will contain the following subdirectories:
.
├── maiko
├── medley
└── notecards
The build steps
The Medley system consists of two layers, Maiko and the Medley environment.
The bottom layer is the Maiko Virtual Machine, written in C, which implements the evolution of the microcode of the Xerox workstations that ran Interlisp-D in the 1980s. The rest of the system in the top layer, the actual Medley environment the user interacts with, is written in Lisp.
The build process reflects this layered organization. You first compile Maiko with the C toolchain, then run the scripts that drive the Lisp environment to compile the Lisp sources and produce a loadable image, i.e. a sysout.
Building Maiko
Start by changing to the maiko/bin
directory of your source tree. To build Maiko for X11 clean up any leftovers from prior invocations and run the build:
$ cd ~/interlisp/maiko/bin
$ ./makeright x cleanup
$ ./makeright x
Next, build the ldeinit
Maiko tool required for producing the apps sysout:
$ ./makeright init
These steps create the executable files lde
, ldex
, and ldeinit
under ../ostype.cputype
, e.g. ../linux.x86_64
on typical Linux systems. Move the lde*
programs to or symlink them from somewhere in your executable path.
If you want the SDL2 version instead of X11 substitute sdl
for x
in the above build commands:
$ ./makeright sdl cleanup
$ ./makeright sdl
$ ./makeright init
On my Linux system these compilation steps collectively take a dozen seconds of runtime.
Doing the loadup
The final step is to make the apps loadup.
A “load up”, or just “loadup”, is a platform independent Lisp image generated by the Lisp side of the build process. Historically, building the Medley sysout was called “doing a loadup”. Along with an image, doing the loadup produces a set of compiled Lisp and supporting files.
To do the loadup change to the Medley directory ~/interlisp/medley
, remove the loadups
subdirectory to clean up any leftovers from prior builds, and launch the driver script loadup-all.sh
in the scripts
subdirectory:
$ cd ~/interlisp/medley
$ ./scripts/loadup-all.sh -apps
The Medley graphical environment will open several times and print log messages on the files it is compiling or other status information.
During this step it is amazing to watch the Medley window and log messages zip by in seconds in a process that took many hours back in the day. On my Linux system this step completes in about 3 minutes and 10 seconds.
Testing the build
Your environment is already set up for building Medley and no additional steps are required for installing and running it.
When the build ends, test Medley by launching the medley
command. For example, execute medley
with the -a
option to load the applications, -e
to start an Interlisp Exec, and -n
to remove the screen scroll bars that are not much useful:
$ cd ~/interlisp/medley
$ ./medley -a -e -n &
Execute ./medley --help
to get a brief help message with a list of the command line options, and ./medley -z
to read the manual page.
#Interlisp #Lisp
Discuss...
Email | Reply @amoroso@fosstodon.org