I followed their instructions:
You need build-essentials, header files for puredata, libjson-c, libcurl4, liboauth. If you have Debian or a derivative (e.g. Ubuntu, Linux Mint), you can install the build utils and needed headers with apt-get install build-essential puredata-dev libjson-c-dev libcurl4-openssl-dev liboauth-dev
. If you are not root, prefix the command with sudo.
If the board is connected to the internet, this is straightforward. Just run apt-get install build-essential libjson-c-dev libcurl4-openssl-dev liboauth-dev
(note that I removed puredata-dev
as we already have libpd on the board). If it is not, I just put together this script the other day that will do just that (tested on Mac, should work on Linux, possibly on Windows): https://github.com/giuliomoro/bela-random/blob/master/cross-apt-get-install.sh . Using this script, I run
./cross-apt-get-install.sh libjson-c-dev libcurl4-openssl-dev liboauth-dev
make sure this is successful.
Back to their instructions:
Drop the sources in a directory and run make. You will get files with a suffix of pd_linux for each object (json-decode.pd_linux, json-encode.pd_linux, rest.pd_linux, oauth.pd_linux). These are needed to use the library.
So I clone the repo on the host:
git clone --recursive https://github.com/residuum/PuRestJson
(I need the --recursive
because it has some subrepo) and then I copy this across to the board:
scp -r PuRestJson root@192.168.7.2
Then I go back on the board and, as instructed, I run make
:
ssh root@192.168.7.2
(Note that all the commands after this will be run on the board.)
cd PuRestJson
make
in less than one minute, I obtain a message : target all in lib purest_json completed
. This gives me hope. Then I run ls
and I see that the .pd_linux
files have indeed been generated. Seems like success!
Testing:
I have no idea what these files are supposed to do, so I just make sure they get loaded.
First: copy somewhere where they can be found. According to the Bela wiki I can just copy these files to the ~/Bela/projects/pd-externals
folder in order for al the projects to be able to discover them. So, first I create such folder:
mkdir -p ~/Bela/projects/pd-externals
and then I copy the files there:
cp ~/PuRestJson/*.pd_linux ~/Bela/projects/pd-externals
Last, I create a Pd patch on my computer which uses these externals, then create a new Pd project in the Bela IDE, and I drag the newly created patch on it. I run the project and... there are no errors on the console, which means everything went fine: the objects are correctly loaded! There are also some lines that show that they were indeed loaded correctly.

Now, whether they work or not, I have no idea. You shall find out. If they don't do things cleverly and they run non-realtime code in the audio thread (as it's commonplace in Pd) then bad news: you may have to rewrite part of them. But maybe they don't and everything is nice!
(It really takes 5 minutes to do all the above. It took me about 30 minutes writing it down, though).