Space MOOSE

spaceflight, technology, anime, politics, and whatever else I feel like writing about

Building Rakudo (Perl 6) on Termux

Rakudo is an implementation of Raku, which used to be called Perl 6. Termux is an Android app environment that gives you a Debian-ish GNU/apt/dpkg environment on top of Android without root. These two things should go well together, and they do, but the documentation for setting this up is deeply lacking. This page is intended as a walkthrough for the process.

Prerequisites

This will install a shitload of packages so don't do it if your phone's internal storage is near full.

$ apt install perl clang libuv libuv-static

Setup

For convention, we will assume all git repositories are stored in $HOME/src.

$ cd ~/src
$ git clone https://github.com/MoarVM/MoarVM
$ git clone https://github.com/Raku/nqp
$ git clone https://github.com/rakudo/rakudo
$ git clone https://github.com/ugexe/zef
$ mkdir -p ~/.local/{bin,lib,include,share}

If $HOME/.local/bin and $HOME/.local/share/perl6/site/bin are not added to your PATH, do so now.

Building

This must be done in a specific order.

MoarVM

$ cd ~/src/MoarVM
$ CC=clang ./Configure.pl --prefix=$HOME/.local --has-libuv --cc=clang

This will probably throw an error because "android" is not a well-known system type, but it generates a usable Makefile, so we'll continue.

$ make
$ make install

NQP

$ cd ~/src/nqp
$ export CC=clang
$ ./Configure.pl --backends=moar --prefix=$HOME/.local
$ make
$ make install

Rakudo

Finally, the part you actually give a shit about.

$ cd ~/src/rakudo
$ export CC=clang
$ ./Configure.pl --backends=moar --prefix=$HOME/.local
$ make
$ make install

This doesn't install a module manager or terminal line editing for the interpreter, so let's do that now.

Zef and Linenoise

$ cd ~/src/zef
$ raku -I. bin/zef install .
$ zef install Linenoise

Now you should be able to run raku from a Termux shell and get the expected experience.

blog entries

Like my work? Donate here.