Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Aroop is vala language profile for object-pool-plus library. I hope it is faster than gobject profile for vala.
Vala C Makefile Other

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.md

Aroop

This is compiler backend/profile for vala. It generates C code for given Vala sources. The generated code is targeted for server applications and for the applications that do not want to use gobject-introspection. This library is dependent on own object implementation named Object Pool Plus.

Object Pool Plus

This is a library to manipulate collection of objects and for garbage collection. This library is used in complimentary core library for aroop generated code. This library is an implementation of object pool.

core api

The core api contains string and collection manipulation api.

Building

Requirements

The following projects are needed to build aroopc.

  • autoconf
  • automake
  • libtool
  • valac (If the aroop project does not come with generated C files) (currently it is compiled with vala-26 version)
  • libgee (please install the development version too)
  • C compiler (gnu C compiler for example)

Getting aroop source

Aroop is hosted in github. It can be cloned form https://github.com/kamanashisroy/aroop.git . Or it can be downloaded here.

Compiling aroopc

Aroop uses the same automake tool-chain as vala. If you are compiling a GNU software for the first time, then I strongly suggest you read this document. You may do it using the following commands,

a/aroop$ ./autogen.sh --prefix=/opt/aroop
a/aroop$ make
a/aroop$ ls aroop/compiler/
aroopc-0.1.0
a/aroop$ make install
a/aroop$ ls /opt/aroop/bin
aroopc-0.1.0
If autogen failed to find right vala version

Well if autogen command above fails and it says it needs right version of vala, then the right version of vala needs to be installed first(in my system it is 26). After installation it is needed to carry out the following commands as well,

a/aroop$ export VALAC=/opt/vala-26/bin/valac # skip this if it is installed right version to default location
a/aroop$ cp /opt/vala-26/lib/pkgconfig/libvala-0.26.pc /usr/lib/pkgconfig/ # skip this if it is installed right version to default location
a/aroop$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/vala-26/lib # skip this if it is installed right version to default location
a/aroop$ ldconfig # skip this if it is installed right version to default location

Now that vala is installed successfully, the previous procedures can be carried out starting from autogen.

Compiling hello world

Compiling the code is comprised of two stages. Suppose the target vala file name is hello_world.vala.

using aroop;

class HelloWorld {
    public static void main() {
        print("Hello world\n");
    }
}

Generating C code

At first the aroopc generates C code output. It creates hello_world.c file for the source hello_world.vala.

a/tmp$ /opt/aroop/bin/aroopc-0.1.0 -C hello_world.vala
a/tmp$ ls
hello_world.c

The hello_world.c contains all the instructions in hello_world.vala.

Compiling the C code

Now the the C source can be compiled using C compiler. If gnu C compiler is used then the following command will serve the purpose.

a/tmp$ gcc -I/opt/aroop/include/aroop_core-0.1.0 hello_world.c /opt/aroop/bin/libaroop_core.o -o hello_world.bin # link statically
a/tmp$ gcc -I/opt/aroop/include/aroop_core-0.1.0 hello_world.c /opt/aroop/lib/libaroop_core_static.a  -o hello_world.bin # linking statically
a/tmp$ gcc -I/opt/aroop/include/aroop_core-0.1.0 hello_world.c -L/opt/aroop/lib -laroop_core -o hello_world.bin # link dynamically
a/tmp$ ls
hello_world.bin
a/tmp$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/aroop/lib # you need to set the dynamic library path
a/tmp$ ldconfig # reset library finder
a/tmp$ ./hello_world.bin
Hello world

One step compilation

Once you installed the package file in /usr/lib/pkgconfig, you can compile a source in one step.

a/tmp$ install /opt/aroop/lib/pkgconfig/aroop_core-0.1.0.pc /usr/lib/pkgconfig
a/tmp$ /opt/aroop/bin/aroopc-0.1.0 hello_world.vala -o hello_world.bin
a/tmp$ ./hello_world.bin
Hello world

The above binary will need the shared library to run. You can also build standalone binary using --static-link argument.

a/tmp$ install /opt/aroop/lib/pkgconfig/aroop_core-0.1.0.pc /usr/lib/pkgconfig
a/tmp$ /opt/aroop/bin/aroopc-0.1.0 --static-link hello_world.vala
a/tmp$ ./hello_world.bin
Hello world

You may optionally put a --debug option while doing static linking. This will create a debug build, which you may want to trace and debug. You may learn more about vala code compiling here and here.

Compiling genie

Genie syntax is derived from numerous modern languages like Python, Boo, D and Delphi.

// file hello_world.gs
uses aroop

init
        print "Hello world"

The following commands will compile genie.

a/tmp$ /opt/aroop/bin/aroopc-0.1.0 hello_world.gs
a/tmp$ ./hello_world
Hello world

Compiling a bare metal image for raspberry pi

Details is here.

Compiling HLL

FILLME tools

More

Please refer to vala readme for more information. There are more documents in the talks directory,

Public projects using aroop

TASKS

Tasks

Something went wrong with that request. Please try again.