1. Oiki Yukio
  2. orchid

Source

orchid /

Filename Size Date modified Message
lib
67 B
1.5 KB
3.8 KB
3.8 KB
383 B

Orchid

Orchid is a build tool for Vala. Actually, it's a task library for the most amazing build tool on the world: Rake.

It is fairly simple to use (assuming you have Ruby and Rake installed):

First, you need to install the Gem.

sudo gem install orchid

Then, create a new directory where your project will live, create a beautiful Rakefile and fill it with stuff like this:

require 'rubygems'
require 'orchid'

Orchid::App.new("app") do |app, compiler|
  app.src = "./src"
  app.build = "./build"
end

That's it. Now you can run <code>rake build:[your_project_name_here]</code> or <code>rake build:all</code>. The <code>install:</code> tasks aren't yet finished... so don't run those. :)

On Dependencies

Orchid makes a distinction between two types of dependencies: packages and dependencies. The idea is that packages are system-installed libraries (a.k.a. the blend of .vapi and .so), and dependencies are projects that work together, i.e. a library that is part of a project is used by the Application that is primary to the project.

Consider this <code>Rakefile</code>:

require 'rubygems'
require 'orchid'

Orchid::Library("ProjectLibrary").new

Orchid::App("ProjectApplication").new do |app, compiler|
  app.packages = "gtk+-2.0 >= 2.16", "gee-2.0"
  app.dependencies << "ProjectLibrary"
end

This makes <code>ProjectApplication</code> dependant on <code>ProjectLibrary</code>. Also, as you can see versioned packages are also supported. Just add a "=> MAJOR.MINOR[.MICRO]" to the package string and you're all set to go. No version information means use any version.

On Targets

Orchid distinguishes two types of targets: debug, and release. You can assign these to any task. For example: <code>rake build:app[debug]</code> will build the "app" project for debugging. debug is also the default, so you would only have to use release when ready to build it system wide.

Another thing that one might need to know is that whenever debug, Orchid automagically defines a "DEBUG" symbol and turns on the debug valac switch.

Orchid always defines a "ORCHID" symbol.

The Common Project Layout

Projects, by default, are layed out like so:

/ - Project
  | - INFO # project info files such as README, LICENSE...
  | - Rakefile
  | - Orchid::Project
    | - src
      | - ProjectSources.vala
    | - res
      | - SomeImage.img
      | - SomeUI.ui
  | - Orchid::Project
    | - src
      | - AnotherSourceFile.vala
    | - res
      | - AVeryImportantTextFile.txt
  | - build
    | - Orchid::Project
      | - out.bin
      | - out.vapi # if it's a library...
      | - SomeImage.img
      | - SomeUI.ui
    | - Orchid::Project
      | - anotherout.bin
      | - AVeryImportantTextFile.txt

[*]: Note that Orchid::Project denotes every subclass of that semi-abstract class.

This layout can be easily changed by modifying the properties of the Project (the first block argument, <code>app</code>).

License

Orchid is licensed under the MIT License. Orchid uses <code>pkg-config.rb</code> as part of it's distribution as to remove dependencies on the ruby-gnome2 bindings. The <code>pkg-config.rb</code> file is licensed under the GNU Lesser General Public License version 2.1, as is the whole Ruby-GNOME2 Project. The MIT License is compatible with the GNU LGPL v. 2.1 License.

Address the <code>LICENSE</code> file included in this distribution for more information.