Obyx can be compiled from code using a small number of supporting libraries. This documentation explains what libraries are necessary and how the code can be compiled to get a working version of Obyx.

System Requirements

Obyx is loosely based on the LAMP architecture. Basic Requirements:
  • OS (e.g. Linux Debian)
  • HTTP Server (e.g. Apache 2)
  • Database (e.g. MySQL or PostgreSQL)
Although it may be installed on a number of configurations, this documentation is based on installation for Linux Debian server. It is assumed that Apache and MySQL are already available, configured and running.

Installation Process

This installation guide consists of the following steps:
  • 1. Preparation of host: Application support installation
  • 2. Preparation of host: Library installations
  • 3. Set up server file structure
  • 4. Setup compile settings
  • 5. Download source code (SVN)
  • 6. Compile obyx.cgi binary
  • 7. Configure HTTP server
  • 8. Test

Preparation of host: Application support installation

It is assumed MySQL/PostgreSQL and Apache are already installed and working. The Obyx source code is C++ and requires gcc/g++ compiler to compile. The source code is stored in a SVN repository, so svn is necessary to get it. Installation of these can be used with aptitude or similar.
g++ Compiler (>= 4.1)
The obyx source code is C++ and requires the g++ or compatible compiler to compile.
g++ 
sudo aptitude install build-essential
svn
Used for svn access. Not necessary if you prefer to download tarballs.
subversion 
sudo aptitude install subversion-tools

Preparation of host: Compile-time Library installations

Obyx relies on a number of supporting libraries at compilation time. Installation here is provided using the aptitude tool as an example. In most cases the development version of libraries is required. With the runtime libraries, there is still need for headers. Compile-time
xercesc 3.0.1 or above
http://xerces.apache.org/xerces-c
http://xerces.apache.org/xerces-c/download.cgi
xqilla 2.2.4 or above
http://xqilla.sourceforge.net/HomePage
http://sourceforge.net/projects/xqilla/files

For FastCGI only:

fastcgi 2.4+
http://www.fastcgi.com/drupal/
http://www.fastcgi.com/drupal/node/5
Or debian package libfcgi-dev.
Run-time
libpcre
This library is used to handle regular expressions within obyx.
libpcre3-dev 
sudo aptitude install libpcre3-dev
libcurl
This library provides network access utilities
libcurl3-dev 
sudo aptitude install libcurl3-dev
libmysql
This library provides database connectivity with MySQL. This can be enabled at runtime by defining ALLOW_MYSQL.
libmysqlclient15-dev 
sudo aptitude install libmysqlclient15-dev
libpq
This library provides database connectivity with PostGre. This can be enabled at runtime by defining ALLOW_POSTGRESQL.
postgresql-server-dev-8.3
sudo aptitude install postgresql-server-dev-8.3
libgmp
This library provides support for arbitrary precision integers. This can be disabled at runtime by defining DISALLOW_GMP.
libgmp3-dev 
sudo aptitude install libgmp3-dev

For FastCGI only:

mod_fcgid 2.2+
http://httpd.apache.org/mod_fcgid/
http://httpd.apache.org/download.cgi#mod_fcgid
Or debian package libapache2-mod-fcgid.
)

Set up server file structure

The structure and location of files on the host server is flexible and controlled by configuration files. However, the following is suggested and used in this installation:
  • /WWW_ROOT/public - location of publicly accessible .html, .css, .obyx files.
  • /WWW_ROOT/scripts - location of Obyx run script files
  • /WWW_ROOT/cgi - location of Obyx binary and any other cgi scripts
  • /WWW_ROOT/source - location of Obyx source code

Download source code (SVN)

The Obyx source code is currently available in a SVN repository. To checkout the source code do the following from the /WWW_ROOT/source directory:
$cd /WWW_ROOT/source
$svn co http://svn.obyx.org/obyx/supported/version1 obyx
To update the source files any later time
$cd /WWW_ROOT/source/obyx
$svn update

Set up compile settings

Before trying to compile the code some settings need to be setup. The file local.cfg contains compile settings specific to your setup. local.cfg should be at /WWW_ROOT/source/local.cfg local.cfg Before trying to compile the code some settings need to be setup. This file contains compile settings specific to your setup. Create this file in the RSapps directory, amending where necessary: These values can be defined elsewhere, but the file should exist.
MYSQL_INC
Should point to the mysql include directory.
CC_INCLUDES
Any additional include directories needed for the compilation.
CC_PATH
The path to gcc or g++
MYSQL_INC
Should point to the mysql include directory.
CC_DB
These are defines used to include or exclude compilation of the mysql or postgresql code. If you do not have postgresql or mysql, remove the -DALLOW flag for the salient item to prevent headers from not being found.
CC_FLAGS
The normal set of additional gcc flags used for this compilation.
RPATH
The full path to the root directory of the www files as mentioned above. Importantly, this only MUST be the parent of the cgi directory to install to.
CGIDIR
The relative path to the cgi directory. It must be underneath RPATH.
/WWW_ROOT/source/local.cfg:
MYSQL_INC   = /usr/include/mysql
CC_INCLUDES = -I$(MYSQL_INC)
CC_PATH     = /usr/bin/
CC_OBYX     = -DALLOW_MYSQL -DALLOW_POSTGRESQL -DDISALLOW_GMP #use these in accordance to your needs.
CC_FLAGS    = -x c++ -funsigned-char $(CC_OBYX)
RPATH       = /WWW_ROOT
CGIDIR      = cgi

Compile obyx.cgi binary

$cd /WWW_ROOT/source/obyx
$make /WWW_ROOT/cgi/obyx.cgi
To check that the linking is correct one can do:
$ldd /WWW_ROOT/cgi/obyx.cgi

Compile obyx.fcgi binary

If you are creating the fast cgi binary and you have the required libs installed you can create the fastcgi binary with minimum effort. However, you cannot use obyx as a command-line tool if it is compiled as fast-cgi.

append the following on to CC_FLAGS in local.cfg
-DFAST

Http (Apache2) Configuration

Please see the documentation on configuration.

Test

Example Obyx Hello World The two following files may be used to test that Obyx is working. It uses both an SQL connection and a filesystem include to test some basic functionality. The files should go into your public directory (e.g. /WWW_ROOT/public ): Run the hello world example by going to http://www.yourdomain.com/hello_world.obyx You should simply see the words "Hello World" in a valid html page.
hello_world.obyx
<instruction xmlns="http://www.obyx.org" >
   <input>
       <instruction note="load view">
           <output space="store" value="v" />
           <input space="file" value="hello_world.html" />
       </instruction>
       <iteration operation="sql" note="get model">
           <output space="store" value="v#//*[@id='msg']/text()" />
           <control value="select 'Hello World' as message" />
           <body space="field" value="message" />
       </iteration>
       <instruction note="display view">
           <input space="store" value="v" release="true" />
       </instruction>      
   </input>
</instruction>
hello_world.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<title>Hello World View</title>
</head>
<body><div id="msg">Message</div></body>
</html>



Last Modified: Thu, 15 Jan 2015