-
Notifications
You must be signed in to change notification settings - Fork 9
Compilation
Compilation should be working on Linux, Windows with MinGW and Mac OS X. You will need header files of Puredata, as well as libcurl, json-c, and liboauth.
The package uses the Pd library template.
With version 0.11, json-c have changed the library path and name. If your system has an older version of json-c, please use the branch json-c-0.10 for compiling, but this branch is only updated on new releases.
You need build-essentials, header files for puredata, libjson0, 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-essentials puredata-dev libjson0-dev libcurl4-openssl-dev liboauth-dev. If you are not root, prefix the command with sudo.
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.
Install the package devscript with apt-get install devscript.
Remove the file embed-MacOSX-dependencies.sh.
Run make dpkg-deb, you will get a deb file in the parent folder. The resulting package will have the following name structure: pd-purest-json_{version}_{debian_architecture}.deb, e.g. pd-purest-json_0.11_i386.deb. Install this file with dpkg -i pd-purest-json_0.11_i386.deb.
This section is outdated
You need to install MinGW on your computer. Follow the instructions on http://puredata.info/docs/developer/WindowsMinGW leaving out Cygwin. If you do not plan to compile Pd-extended, you may stop after following the instructions for "MinGW extras".
Install the additional packages:
-
pthreads-w32, from the MinGW shell via
mingw-get install pthreads-w32. -
libcurl, from http://curl.haxx.se/download.html#Win32 Choose Win32 generic, libcurl
-
json-c, from http://blog.stranadurakov.com/projects/mingw-libraries/ or use the latest json-c version from github (see above) and build it yourself.
-
(TODO: how-to use liboauth)
Extract the latter zip files and put the contents in the correct MinGW folders.
If you encounter an error with two definition of boolean, delete the line typedef int boolean; from the file %MinGW%/include/json/json_object.h.
Navigate to the folder of purest_json in MinGW Shell and run make. You will get four dll files (json-decode.dll, json-encode.dll, rest-json.dll, libpurest_json.dll).
To use the library, you will also need the dll from the libcurl download, and rename libcurl.dll to libcurl-4.dll. This will not run on current releases (Pd-extended 0.42 or Pd vanilla 0.43), only on Pd-extended 0.43 auto-builds.
I do not have a Mac available, so the following instructions may or may not be correct:
Homebrew looks like the newer and recommended way to get third party libraries on Mac OS X. The dependencies should be installable by running
brew install json-c curl liboauth
After setting up the build environment for Pd, you should be able to build PuREST JSON by running make in the purest_json folder.
If the build succeeded, run ./embed-MacOSX-dependencies.sh to embed the dependencies in the shared library.
You will need to install json-c, libcurl4 and libcurl4-shibs via Fink by running
fink install json-c libcurl4 libcurl4-shibs
You also need liboauth. Download the source code, extract the archive (e.g. from the command line with tar -xf liboauth-1.0.0.tar.gz) and run
./configure
make
make install
to build and install liboauth.
You will need to set up part of the Pd build environment on your computer
Run make in the purest_json folder.
If the build succeeded, run ./embed-MacOSX-dependencies.sh to embed the dependencies in the shared library.
Get the development version of MXE from their Github repository and setup MXE, so that the cross compilation tools are in your PATH environmental variable.
Build the required libraries by running make curl json-c liboauth pthreads.
You will need a source of Pd, and pd.dll from a Windows version. Put them in folders with the following structure:
pd/src/(source files including m_pd.h)
pd/bin/pd.dll
Now run make with some environmental variables to tell the compiler to use the cross compiler, and where to find the Pd source and pd.dll. Here is an example from my setup:
make \
UNAME=MINGW \
CROSS_PATH=/home/thomas/code/mxe/usr/ \
CROSS=i686-pc-mingw32 \
PD_PATH=/home/thomas/code/pd
Good luck.
On the Windows system that runs Pd, you will need SSL certificates to verify the signatures. You can download certificates in PEM format from cURL website. Copy the file cacert.pem in the same directory as rest.dll and oauth.dll, as the library expects the file to reside there.