Raku: Setting up Raku (for Contributors)

[last revised/updated 2020_09_14]

Foreword

This series of posts on Raku programming attempts to be succinct and useful for folks interested in contributing to Raku. If you find it useful, drop me a note in the comments. -Ofun

Posts in the Series

  1. Try Raku! (work in progress)
  2. Setting up Raku (for Contributors) [this post]
  3. Wading into the Raku community (planned)

Setting up Raku (for Contributors)

When you use Raku and interact with others, your interactions affect the community. Raku is a welcoming community. You are welcome. Pull up a chair and get comfy. These instructions will help you get up and running Raku in a configuration that enables you to contribute back when you are ready.

To enable contributing, we will setup hosted copies ('forks') of the Rakudo, NQP, and MoarVM git repositories on Github. Your changes (when you are ready to make them) will go into your repositories. You will submit requests which allow others to pull your changes upstream into the respective parent repositories.

Rakudo is an implementation of the Raku language. It requires NQP and a backend (MoarVM). Why? Because Rakudo is written in a mixture of Raku and NQP. NQP is a minimal subset of Raku designed to implement a Raku compiler. NQP is bootstrapped. I.e. NQP is written in NQP. The NQP compiler provides virtual machine abstraction layers which allow code to run on different backends such as the MoarVM, JVM, and JavaScript. The most mature backend for Rakudo is MoarVM. MoarVM is written in C.

The source code for Rakudo, NQP, and MoarVM each resides in their own git repository on Github. The Rakudo README.md describes a build method which we DO NOT USE:

$ perl Configure.pl --gen-moar --gen-nqp --backends=moar

Which will automatically clone, build, and install NQP and MoarVM from their respective parent repositories. Because we want to be able to contribute to NQP and MoarVM, we need to configure things to build from our hosted copies of these repositories. 

Let's Get Started

[Click on the '+' sections below for more details as needed]

+ Install Prerequisites: Perl 5.10 or later, git, make, gcc, libssl


Decide where in the filesystem you want to put things. We prefer to isolate everything to do with Raku in $HOME/raku

Create a raku directory in your $HOME

cd ~
mkdir raku

MoarVM: Get, Configure, Build, and Install

cd ~/raku
git clone https://github.com/[Your_Github_Username]/MoarVM.git
cd MoarVM
git remote add upstream https://github.com/MoarVM/MoarVM.git
perl Configure.pl --prefix=$HOME/raku --optimize=0 --debug=3
make
make install

NQP: Get, Configure, Build, Test (Optional), and Install

cd ~/raku
git clone https://github.com/[Your_Github_Username]/nqp.git
cd nqp
git remote add upstream https://github.com/Raku/nqp.git
perl Configure.pl --prefix=$HOME/raku --backends=moar
make
make test
make install

Rakudo: Get, Configure, Build, Test (Optional), and Install

cd ~/raku
git clone https://github.com/[Your_Github_Username]/rakudo.git
cd rakudo
git remote add upstream https://github.com/rakudo/rakudo.git
perl Configure.pl --prefix=$HOME/raku
make
make test
make install

Add the location of raku binaries to PATH

export PATH=$HOME/raku/bin:$HOME/raku/share/perl6/site/bin:$PATH
echo 'PATH=$HOME/raku/bin:$HOME/raku/share/perl6/site/bin:$PATH' >> ~/.bashrc

Execute raku

$ raku -v
This is Rakudo version 2020.08.2-63-gc5cffd40d built on MoarVM version 2020.08-91-g590bac47e
implementing Raku 6.d.
$ raku -e 'say "hello world!";'
hello world!
cd ~/raku
git clone https://github.com/ugexe/zef.git
cd zef
raku -I. bin/zef install .

Familiarize yourself with the Github standard fork and pull request workflow

Afterward

Thank you for reading. If you have any feedback or thoughts you would like to share, please let me know in the comments below. You can see what posts are planned and in progress at Posts in the Series. Check back weekly for new posts.

Comments

Popular posts from this blog

Transcoding video for OLPC XO using VLC on OSX

Book and movie review: Kiln People vs. Surrogates

Perl developers step up to Marvell Mobylize $100K Challenge?