Agar

   <-- Back to Documentation

Installing Agar on BSD-like platforms

This guide describes how to compile and install the Agar library under BSD-like platforms such as FreeBSD, NetBSD and OpenBSD. Before compiling, you might want to search the ports/packages collection for an Agar package. However, if an available package is outdated compared to the most recent release of Agar, we recommend installing from source instead.

Prerequisites

Agar works best with OpenGL and the FreeType font engine installed. Provided that you have a working X.org installation (such as x11/xorg on FreeBSD), those components should be already installed on your system.

Agar uses the native X.org API by default, but Agar applications can be made to work over SDL 1.2 as well. If you need SDL support, make sure the sdl package is installed. Some optional Agar features also make use of the jpeg, png and iconv libraries if those are available.

Installation Procedure

First download the Agar source package and unpack it to a temporary location:

  $ wget http://stable.hypertriton.com/agar/agar-1.5.0.tar.gz
  $ tar -xzf agar-1.5.0.tar.gz
  $ cd agar-1.5.0.tar.gz

Then configure and compile the sources. There are a number of build options available (see ./configure --help), but the defaults should be fine unless you have specific requirements. The --enable-debug option is recommended for developers, since it enables assertions and type safety checking in event handler arguments.

  $ ./configure --prefix=$HOME		# Install to some alternate location
  $ ./configure --enable-debug		# For developers
  $ ./configure --enable-nls		# Enable native language support
  $ make depend all

Finally, install the library. This will install under the /usr/local by default (you can use the configure option --prefix to install to an alternate location).

  # make install
Testing Agar

You can test that Agar is working using a simple hello.c program like so:

  #include <agar/core.h>
  #include <agar/gui.h>
  
  int
  main(int argc, char *argv)
  {
          AG_Window *win;
          
          if (AG_InitCore(NULL, 0) == -1 ||
              AG_InitGraphics(0) == -1) {
		fprintf(stderr, "Init failed: %s\n", AG_GetError());
		return (1);
	  }
          win = AG_WindowNew(0);
          AG_LabelNew(win, 0, "Hello, world!");
          AG_WindowShow(win);
          AG_EventLoop();
          return (0);
  }

Compile this example using:

  $ cc -o hello `agar-config --cflags` hello.c `agar-config --libs`

Csoft.net ElectronTubeStore.com