Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

Close

About lgob

Description

lgob provides bindings of GObject-based libraries (like like GTK+ and WebKitGTK+), for Lua 5.1. It consists of a compiler that parses GObject-Instrospection gir files and generates Lua modules. lgob ships with bindings for GTK+, pango, cairo, vte, WebKitGtk, GtkTextView, and others.

lgob can be compiled and used in MS-Windows. There are official builds in 2. There are packages for Ubuntu 13.10 on ppa:lucashnegri/lua.

Sample usage (included modules)

Hello GTK+

require('lgob.gtk')

local window = gtk.Window.new(gtk.WINDOW_TOPLEVEL)
window:connect('delete-event', gtk.main_quit)

local button = gtk.Button.new_with_label("Click me")
button:connect('clicked', function() print("clicked") end )

window:add(button)
window:show_all()
gtk.main()

Usage (as a compiler)

Basic

lgob-gir-parser.lua -i myinput.gir -o mydef.def -l mylog1
lgob-generator.lua  -i mydef.def   -o myiface.c -l mylog2 -v 3.2

Definition files

The files used as input to the compiler. You can use convert .gir files to .def files using lgob-gir-parser.

It's possible to merge definition files by doing a simple dofile('name.def').

Versioning

The .def files can carry 'since' and 'deprecated' version information, to allow the code generation target a specific version (passing -v 3.2, would generate code for functions available from 3.0 to 3.2, excluding the functions deprecated between 3.0 and 3.2.

The gobject-instrospection .gir format does not gives version information on classes and enums, and not all functions have version annotations. For that, it's possible to override some information with the .ovr files.

License

LGPL v3.

Install

You can build and install lgob by calling

$ make
# make install PREFIX=/usr/local

You may need to adjust config.lua to change compiler and environment options.

You can also select what modules to compile (or compile individual modules) by using/editing the build.lua and build_all.lua scripts located in the root directory.

The first version of lgob was released around 2008. lgob works only with Lua 5.1. Porting it to Lua 5.2 would mainly require removing access to LUA_GLOBALSINDEX (some work) and renaming lua_objlen to lua_rawlen (straightforward).

Dependencies

On Debian/Ubuntu you will need the following packages to compile all lgob modules:

liblua5.1-0-dev, libgtk-3-dev, libgtk-3-dev, libgstreamer0.10-dev, libgstreamer-plugins-base0.10-dev, libwebkitgtk-3.0-dev, libvte-2.90-dev, libpoppler-glib-dev, libpango1.0-dev, libgtksourceview-3.0-dev, libglib2.0-dev, libcairo2-dev, libpango1.0-dev, libpoppler-dev, libatk1.0-dev

Recent activity

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.