Skip to content

sp3d/3d-bindgen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

3d-bindgen is a project to write a GObject Introspection binding generator for the Rust programming language (<http://www.rust-lang.org/>).

3d-bindgen is released under the WTFPL; licenses of related components such as grust, GLib, or Rust itself may be more restrictive.

The plan for the project follows two phases:

First, a precursor written in C, "2d-bindgen", will be a proof of concept and testing ground for creating a binding to the GIR library, which allows access to information about GObject-based libraries such as itself and the rest of the GNOME stack.

Then, using the bindings generated by 2d-bindgen, a Rust port of 2d-bindgen (known as 3d-bindgen) will be written, which should be a fully self-hosting solution for generating bindings to GObject-Introspection-compatible libraries for Rust.

The design of the bindings themselves (i.e., the conceptual machinery involved in generating wrapper functions, types, traits, and libraries) is based on those of the grust project by mzabaluev (<https://github.com/mzabaluev/grust/>), which inspired this effort (and with which 3d-bindgen can hopefully be considered collaborative).

To compile this code, it is first necessary to check out and compile the accompanying fork of grust from <https://github.com/sp3d/grust/>. This fork tracks Rust master and serves as the target for 2d-bindgen; 3d-bindgen, once written, will both target and depend upon grust. Once the binding generator begins to depend on more extensive support from grust, the last known working grust commit will be discoverable by running:
	git log | fgrep "grust commit"
Similarly, the last known working rustc commit (though at any time HEAD *should* work) can be found with:
	git log | fgrep "rustc commit"

Current status:
	2d-bindgen (the bootstrap binding generator) is a work in progress.
	2d-bindgen currently produces a 'raw' stub module exposing the FFI interface; this needs a safe wrapper to be generated around it to idiomatically expose object types to Rust.
	2d-bindgen does not yet bind objects, functions, and methods with safe, idiomatic wrappers, but can already be used for unsafely accessing the functions and other definitions from GIR libraries instead of writing manual bindings to do so.
	No work which will be viable in the long term has yet been done on 3d-bindgen (the self-hosted binding generator).

Compilation:
	Run "make" in the 2d-bindgen directory, pointing it to the "grust/.libs" dir of the grust repo.
		make GRUST_LIBS="-L /path/to/grust/build/grust/.libs/"
	Run "make generate-compile" to test binding generation and compilation of a GIR library.
	Run "make bin-test" to test a rust program making use of an automatically-bound GIR library.

About

a GObject Introspection binding generator for Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published