├── .gitignore ├── Makefile ├── README.md ├── gir ├── javascript │ ├── README.md │ ├── env.sh │ ├── gnome-run.sh │ ├── node-run.sh │ ├── test.gnome.js │ └── test.node.js ├── lua │ ├── README.md │ ├── run.sh │ └── test.lua ├── perl │ ├── README.md │ ├── run.sh │ └── test.pl ├── php │ ├── README.md │ ├── run.sh │ └── test.php ├── python │ ├── README.md │ ├── run.sh │ └── test.py └── ruby │ ├── README.md │ ├── run.sh │ ├── subclassing_test.rb │ └── test.rb ├── object.vala ├── objects.jpg ├── package.json └── valabind ├── c++ ├── Makefile ├── README.md └── test.cpp ├── dlang ├── Makefile ├── README.md └── test.d ├── java ├── Makefile ├── README.md └── Test.java ├── node-webkit ├── Makefile ├── README.md ├── index.html └── package.json ├── node.js ├── Makefile ├── package.json └── test.js ├── php ├── Makefile ├── README.md └── test.php └── ruby ├── Makefile ├── README.md └── test.rb /.gitignore: -------------------------------------------------------------------------------- 1 | *.typelib 2 | *.so 3 | *.gir 4 | *.vapi 5 | *.c 6 | *.h 7 | *.i 8 | *.cxx 9 | *.php 10 | *.py 11 | *.js 12 | .c9/ 13 | node_modules 14 | !gir/*/* 15 | !valabind/*/* 16 | !valabind/node.js 17 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | export LD_LIBRARY_PATH := $(shell pwd) 2 | export GI_TYPELIB_PATH := $(shell pwd) 3 | 4 | RUBY1.8_HEADERS=-I/usr/lib/ruby/1.8/x86_64-linux/ -I/usr/lib/ruby/1.8/i686-linux/ 5 | RUBY1.9.1_HEADERS=-I/usr/lib/ruby/1.9.1/x86_64-linux/ -I/usr/lib/ruby/1.9.1/i686-linux/ 6 | PHP_HEADERS=`php-config --includes` 7 | 8 | all: libobject.so ValaObject-0.1.typelib c-source 9 | 10 | run: run-gir run-valabind 11 | 12 | run-gir: run-gir-ruby run-gir-python run-gir-php run-gir-lua run-gir-gnome-js run-gir-nodejs 13 | 14 | run-valabind: run-valabind-ruby run-valabind-python run-valabind-php run-valabind-lua run-gir-nodejs run-node-webkit-valabind 15 | 16 | ########## test gir bingings ########## 17 | 18 | run-ruby-gir: 19 | -ruby gir/ruby/test.rb 20 | 21 | run-python-gir: 22 | -python gir/python/test.py 23 | 24 | run-php-gir: 25 | -php gir/php/test.php 26 | 27 | run-perl-gir: 28 | -perl gir/perl/test.pl 29 | 30 | run-lua-gir: 31 | -lua gir/lua/test.lua 32 | -luajit-2.0.0-beta9 gir/lua/test.lua 33 | 34 | run-gnome-js: 35 | -gjs gir/javascript/test.gnome.js 36 | -seed gir/javascript/test.gnome.js 37 | 38 | run-nodejs-gir: 39 | -node gir/javascript/test.node.js 40 | 41 | ########## test generated bindings with Valabind and valabind ########## 42 | 43 | # TODO 44 | run-ruby-valabind: 45 | -make run -C valabind/ruby 46 | 47 | # TODO 48 | run-python-valabind: 49 | -python valabind/python/test.py 50 | 51 | run-php-valabind: 52 | -make run -C valabind/php 53 | 54 | # TODO 55 | run-perl-valabind: 56 | -perl valabind/perl/test.pl 57 | 58 | # TODO 59 | run-lua-valabind: 60 | -lua valabind/lua/test.lua 61 | 62 | run-nodejs-valabind: 63 | -make run -C valabind/node.js 64 | 65 | run-node-webkit-valabind: 66 | -make run -C valabind/node-webkit 67 | 68 | run-java-valabind: 69 | -make run -C valabind/java 70 | 71 | run-d-valabind: 72 | -make run -C valabind/dlang 73 | 74 | ########## generate bindings with Valabind ########## 75 | 76 | # TODO 77 | ruby-valabind: libobject.so c-source 78 | -make bind -C valabind/ruby 79 | 80 | # TODO 81 | python-valabind: libobject.so c-source 82 | valabind-cc python pythonobject -NValaObject libobject.vapi -I. `pkg-config --cflags --libs gobject-2.0` -I/usr/include -L. -lobject -x 83 | 84 | php-valabind: 85 | -make bind -C valabind/php 86 | 87 | # TODO 88 | perl-valabind: libobject.so c-source 89 | valabind-cc perl perlobject -NValaObject libobject.vapi -I. `pkg-config --cflags --libs gobject-2.0` -I/usr/include -L. -lobject -x 90 | 91 | # TODO 92 | lua-valabind: libobject.so c-source 93 | valabind-cc lua luaobject -NValaObject libobject.vapi -I. `pkg-config --cflags --libs gobject-2.0` -I/usr/include -L. -lobject -x 94 | 95 | nodejs-valabind: 96 | -make bind -C valabind/node.js 97 | 98 | node-webkit-valabind: 99 | -make bind -C valabind/node-webkit 100 | 101 | java-valabind: 102 | -make bind -C valabind/java 103 | 104 | d-valabind-swig: 105 | -make swig -C valabind/dlang 106 | 107 | d-valabind: 108 | -make bind -C valabind/dlang 109 | 110 | ########## Vala Stuff ########## 111 | 112 | c-source: 113 | valac -H object.h -C --vapi=object.vapi --library=libobject object.vala 114 | 115 | libobject.so: 116 | valac \ 117 | --enable-experimental \ 118 | -X -fPIC -X -shared \ 119 | --library=libobject \ 120 | --gir=ValaObject-0.1.gir \ 121 | -o libobject.so \ 122 | object.vala 123 | 124 | ValaObject-0.1.typelib: 125 | g-ir-compiler \ 126 | --shared-library=libobject.so \ 127 | --output=ValaObject-0.1.typelib \ 128 | ValaObject-0.1.gir 129 | 130 | ########## Other ########## 131 | 132 | clean: 133 | rm -fr $(shell cat .gitignore) 134 | make clean -C valabind/node.js 135 | make clean -C valabind/node-webkit 136 | make clean -C valabind/php 137 | make clean -C valabind/ruby 138 | make clean -C valabind/java 139 | make clean -C valabind/dlang 140 | make clean -C valabind/c++ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Use Vala for your next library, %username% 2 | 3 |  4 | 5 | Write your next library in [Vala][Vala] and get bindings for free! 6 | 7 | Here is example how to use functions and objects from vala 8 | in your favorite language. 9 | 10 | ## Why Vala? 11 | 12 | - Vala is [very][VBench] [fast][VBenchNew] 13 | - Vala manages memory for you 14 | - Write in Vala, (re)use from any 15 | [%lang%](https://live.gnome.org/GObjectIntrospection/Users) 16 | 17 | ## Setup Vala 18 | 19 | ### Debian/Ubuntu 20 | 21 | sudo apt-get install valac gobject-introspection libgirepository1.0-dev 22 | 23 | ### Fedora 24 | 25 | sudo yum install vala gobject-introspection-devel 26 | 27 | ### OSX 28 | 29 | brew install vala gobject-introspection 30 | 31 | ## Make shared library 32 | 33 | Source file for shared library is `object.vala`. 34 | 35 | Run in shell: 36 | 37 | make 38 | 39 | You should get `vala-object.so` and `ValaObject-0.1.typelib` and 40 | some other files. `.so` and `.typelib` are required for next examples. 41 | 42 | If you want more details - read about 43 | [GObject Introspection](https://live.gnome.org/GObjectIntrospection/) and it's 44 | [architecture](https://live.gnome.org/GObjectIntrospection/Architecture). 45 | Otherwise just skip to next step :) 46 | 47 | ## Bindings HOWTO (really easy and automagical) 48 | 49 | - [Ruby](gir/ruby/README.md) (Ruby 1.9.1, JRuby and Rubinius) 50 | - [Python](gir/python/README.md) 51 | - [Perl](gir/perl/README.md) 52 | - [Lua](gir/lua/README.md) (Lua 5.1 and LuaJIT 5.1) 53 | - [JavaScript](gir/javascript/README.md) (Node.js, seed and gjs) 54 | - [PHP](gir/php/README.md) 55 | - [Other languages](https://live.gnome.org/GObjectIntrospection/Users) 56 | 57 | ## Questions? 58 | 59 | - Mailing list: [vala](https://mail.gnome.org/mailman/listinfo/vala-list) 60 | - IRC: #introspection and #vala at irc.gnome.org 61 | - [Documentation](https://live.gnome.org/Vala/Documentation) 62 | - [Google+ page](https://plus.google.com/115393489934129239313/posts) 63 | 64 | [Vala]: https://live.gnome.org/Vala/ 65 | [VBench]: http://code.google.com/p/vala-benchmarks/wiki/BenchResults 66 | [VBenchNew]: http://jpaflacerda.wordpress.com/2011/11/08/vala-benchmarking/ 67 | -------------------------------------------------------------------------------- /gir/javascript/README.md: -------------------------------------------------------------------------------- 1 | # GObjects for JavaScript 2 | 3 | You can use [GObjects](http://en.wikipedia.org/wiki/GObject) 4 | from any of 3 js intrepreters: 5 | 6 | - [Node.js](http://nodejs.org/) via [gir.js](https://github.com/creationix/node-gir) 7 | - [seed](https://live.gnome.org/Seed) with native GObject support 8 | - [gjs](https://live.gnome.org/Seed) with native GObject support 9 | 10 | ## Node.js setup 11 | 12 | You will need Node.js >= 0.6.0 and recent [npm](https://github.com/isaacs/npm) 13 | 14 | cd gir/javascript/ 15 | npm install kapouer/node-gir 16 | ./node-run.sh test.node.js 17 | 18 | ## Seed or gjs 19 | 20 | cd gir/javascript/ 21 | sudo apt-get install gjs seed 22 | ./gnome-run.sh test.gnome.js 23 | -------------------------------------------------------------------------------- /gir/javascript/env.sh: -------------------------------------------------------------------------------- 1 | # path to vala-object.so 2 | export LD_LIBRARY_PATH=../../ 3 | # path to ValaObject-0.1.typelib 4 | export GI_TYPELIB_PATH=../../ 5 | -------------------------------------------------------------------------------- /gir/javascript/gnome-run.sh: -------------------------------------------------------------------------------- 1 | source ./env.sh 2 | 3 | seed $1 4 | gjs $1 5 | -------------------------------------------------------------------------------- /gir/javascript/node-run.sh: -------------------------------------------------------------------------------- 1 | source ./env.sh 2 | 3 | node $1 4 | -------------------------------------------------------------------------------- /gir/javascript/test.gnome.js: -------------------------------------------------------------------------------- 1 | // This example should work for both 2 | // seed and gjs 3 | var ValaObject = imports.gi.ValaObject; 4 | 5 | ValaObject.say_hello_to('JavaScript') 6 | 7 | var instance = new ValaObject.ValaClass() 8 | 9 | print(instance.append_to_name("called from JS")) 10 | -------------------------------------------------------------------------------- /gir/javascript/test.node.js: -------------------------------------------------------------------------------- 1 | // Install gir.js: npm install gir@latest 2 | // more infos on: https://github.com/creationix/node-gir 3 | 4 | var gir = require("gir"); 5 | gir.init(); 6 | var ValaObject = gir.load('ValaObject'); 7 | 8 | ValaObject.say_hello_to('Node.js'); 9 | 10 | var inst = new ValaObject.ValaClass(); 11 | console.log(inst); // => {} 12 | console.log(inst.append_to_name('called from Node.js')); 13 | -------------------------------------------------------------------------------- /gir/lua/README.md: -------------------------------------------------------------------------------- 1 | # GObject for Lua 2 | 3 | Lua uses GObjects via [lgi](https://github.com/pavouk/lgi). 4 | Kudos to [Pavel Holejsovsky](https://github.com/pavouk). 5 | 6 | sudo apt-get install lua5.1 luarocks 7 | luarocks install lgi 8 | ./run.sh test.lua 9 | 10 | -------------------------------------------------------------------------------- /gir/lua/run.sh: -------------------------------------------------------------------------------- 1 | # path to vala-object.so 2 | export LD_LIBRARY_PATH=../../ 3 | # path to ValaObject-0.1.typelib 4 | export GI_TYPELIB_PATH=../../ 5 | 6 | lua $1 7 | -------------------------------------------------------------------------------- /gir/lua/test.lua: -------------------------------------------------------------------------------- 1 | -- sudo apt-get install lua5.1 luarocks 2 | -- luarocks install lgi 3 | 4 | require 'luarocks/loader' 5 | 6 | ValaObject = require('lgi').ValaObject 7 | ValaObject.say_hello_to('Lua') 8 | 9 | local table = ValaObject.ValaClass() 10 | local str = table.append_to_name(table, "called from lua") 11 | 12 | print(str) 13 | -------------------------------------------------------------------------------- /gir/perl/README.md: -------------------------------------------------------------------------------- 1 | # GObjects for Perl 2 | 3 | You have to install [perl-Glib-Object-Introspection](https://live.gnome.org/GTK2-Perl/Introspection) 4 | 5 | ./run.sh test.pl 6 | -------------------------------------------------------------------------------- /gir/perl/run.sh: -------------------------------------------------------------------------------- 1 | # path to vala-object.so 2 | export LD_LIBRARY_PATH=../../ 3 | # path to ValaObject-0.1.typelib 4 | export GI_TYPELIB_PATH=../../ 5 | 6 | perl $1 7 | -------------------------------------------------------------------------------- /gir/perl/test.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use Glib::Object::Introspection; 4 | 5 | Glib::Object::Introspection->setup( 6 | basename => 'ValaObject', 7 | version => '0.1', 8 | package => 'ValaObject', 9 | search_path => 'build' 10 | ); 11 | 12 | ValaObject->say_hello_to("Perl"); 13 | 14 | my $instance = ValaObject::ValaClass->new(); 15 | print $instance->append_to_name("called from Perl\n"); -------------------------------------------------------------------------------- /gir/php/README.md: -------------------------------------------------------------------------------- 1 | # GObjects for PHP 2 | 3 | You have to install [gobject-for-php](https://github.com/megous/gobject-for-php) and load the php gobject extension into your php.ini: 4 | 5 | printf "\n%s%s%s\n" "extension=" $(php-config --extension-dir) "/gobject.so" >> /etc/php5/cli/php.ini 6 | 7 | Now you can run the script with 8 | 9 | ./run.sh test.php 10 | -------------------------------------------------------------------------------- /gir/php/run.sh: -------------------------------------------------------------------------------- 1 | # path to vala-object.so 2 | export LD_LIBRARY_PATH=../../ 3 | # path to ValaObject-0.1.typelib 4 | export GI_TYPELIB_PATH=../../ 5 | 6 | php $1 7 | -------------------------------------------------------------------------------- /gir/php/test.php: -------------------------------------------------------------------------------- 1 | append_to_name("called from PHP"); 13 | } else { 14 | print ":-(\n"; 15 | } 16 | 17 | ?> -------------------------------------------------------------------------------- /gir/python/README.md: -------------------------------------------------------------------------------- 1 | # GObjects for Python 2 | 3 | ./run.sh test.py 4 | 5 | # Links 6 | 7 | - [One more example](https://github.com/tliron/pygobject-example) 8 | - Video: [Talk about PyGObject, GObject, Vala and more at the Chicago Python group](https://www.youtube.com/watch?v=6QrGmA_RR4E) 9 | -------------------------------------------------------------------------------- /gir/python/run.sh: -------------------------------------------------------------------------------- 1 | # path to vala-object.so 2 | export LD_LIBRARY_PATH=../../ 3 | # path to ValaObject-0.1.typelib 4 | export GI_TYPELIB_PATH=../../ 5 | 6 | python $1 7 | -------------------------------------------------------------------------------- /gir/python/test.py: -------------------------------------------------------------------------------- 1 | from gi.repository import ValaObject 2 | 3 | ValaObject.say_hello_to('Python') 4 | 5 | instance = ValaObject.ValaClass() 6 | print instance.append_to_name("called from Python") 7 | -------------------------------------------------------------------------------- /gir/ruby/README.md: -------------------------------------------------------------------------------- 1 | # GObjects for Ruby 2 | 3 | Ruby uses [GObject](http://en.wikipedia.org/wiki/GObject) 4 | via [GirFFI](https://github.com/mvz/ruby-gir-ffi) gem. 5 | It should work with ANY ruby implementation. 6 | 7 | Kudos to [@mvz](https://github.com/mvz/ruby-gir-ffi)!!! 8 | 9 | # Running examples 10 | 11 | gem install gir_ffi 12 | run.sh test.rb 13 | 14 | `run.sh` is just to setup paths to `vala-object.so` and `ValaObject-1.0.typelib` 15 | -------------------------------------------------------------------------------- /gir/ruby/run.sh: -------------------------------------------------------------------------------- 1 | # path to vala-object.so 2 | export LD_LIBRARY_PATH=../../ 3 | # path to ValaObject-0.1.typelib 4 | export GI_TYPELIB_PATH=../../ 5 | 6 | ruby $1 7 | -------------------------------------------------------------------------------- /gir/ruby/subclassing_test.rb: -------------------------------------------------------------------------------- 1 | require 'gir_ffi' 2 | 3 | GirFFI.setup(:ValaObject) 4 | 5 | class MyValaClass < ValaObject::ValaClass 6 | def append_to_name(suffix) 7 | super + ' (subclassed) ' + suffix 8 | end 9 | end 10 | 11 | instance = MyValaClass.new 12 | puts instance.append_to_name("called from Ruby") 13 | -------------------------------------------------------------------------------- /gir/ruby/test.rb: -------------------------------------------------------------------------------- 1 | require 'object.so' # gem install gir_ffi 2 | 3 | ValaObject.say_hello_to('Ruby') 4 | 5 | instance = ValaObject::ValaClass.new 6 | 7 | puts instance.append_to_name("called from Ruby") 8 | -------------------------------------------------------------------------------- /object.vala: -------------------------------------------------------------------------------- 1 | namespace ValaObject { 2 | public void say_hello_to (string lang) { 3 | print(@"I love You, $lang!!!\n"); 4 | print("-- Vala\n\n"); 5 | } 6 | 7 | public class ValaClass : Object { 8 | public string name = "Vala Class"; 9 | 10 | public string append_to_name (string suffix) { 11 | return @"$name $suffix"; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /objects.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antono/vala-object/29cd70cf0d4711530625228244968665bb76079c/objects.jpg -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ValaObject", 3 | "version": "0.0.1", 4 | "url": "https://github.com/antono/vala-object", 5 | "description": "", 6 | "repository" : {"type": "git", "url": "git@github.com:antono/vala-object.git"}, 7 | "dependencies": { 8 | "ref-struct": "0.0.4", 9 | "ref": "~0.1.3", 10 | "ffi": "~1.2.0", 11 | "gir": "*" 12 | } 13 | } -------------------------------------------------------------------------------- /valabind/c++/Makefile: -------------------------------------------------------------------------------- 1 | export LD_LIBRARY_PATH:=$(shell cd ../.. && pwd) 2 | 3 | GOBJECT_HEADERS=`pkg-config --cflags --libs gobject-2.0` 4 | LANGUAGE=cxx 5 | 6 | run: build 7 | 8 | bind: c-source libobject.so 9 | valabind --$(LANGUAGE) -m vala_cpp_object -N ValaObject -V ../.. object -x 10 | 11 | swig: c-source libobject.so 12 | valabind-cc $(LANGUAGE) libobject -NValaObject ../../object.vapi -I. -I../../ -I/usr/include -I/usr/include/tcl8.6 $(GOBJECT_HEADERS) -L../.. -L/usr/lib/ -L/usr/local/lib -lobject -x 13 | 14 | build: 15 | gcc test.cpp vala_cpp_object.cxx -I. -I../../ -I/usr/include $(GOBJECT_HEADERS) -L../.. -lobject 16 | #gcc test.cpp 17 | 18 | c-source: 19 | make c-source -C ../../ 20 | 21 | libobject.so: 22 | make libobject.so -C ../../ 23 | 24 | clean: 25 | rm -fr *.so *.i *.cxx object.d object_im.d *.out -------------------------------------------------------------------------------- /valabind/c++/README.md: -------------------------------------------------------------------------------- 1 | sudo apt-get install libtclcl1-dev tcl8.6-dev -------------------------------------------------------------------------------- /valabind/c++/test.cpp: -------------------------------------------------------------------------------- 1 | #include "vala_cpp_object.cxx" 2 | 3 | int main( ) { 4 | 5 | return 0; 6 | } -------------------------------------------------------------------------------- /valabind/dlang/Makefile: -------------------------------------------------------------------------------- 1 | export LD_LIBRARY_PATH:=$(shell cd ../.. && pwd):$(shell pwd) 2 | export SWIGFLAGS=-d2 3 | 4 | GOBJECT_HEADERS=`pkg-config --cflags --libs gobject-2.0` 5 | LANGUAGE=dlang 6 | 7 | run: build-swig 8 | ./test 9 | 10 | # TODO 11 | bind: c-source libobject.so 12 | valabind --$(LANGUAGE) -m object -N ValaObject -V ../.. object -o vala_d_object.d 13 | 14 | swig: c-source libobject.so 15 | valabind-cc d vala_d_object -NValaObject ../../object.vapi -I. -I../../ $(GOBJECT_HEADERS) -I/usr/include -L../.. -lobject -x 16 | mv vala_d_object.so libvala_d_object_wrap.so 17 | 18 | build-swig: 19 | dmd test.d vala_d_object_im.d vala_d_object.d 20 | 21 | c-source: 22 | make c-source -C ../../ 23 | 24 | libobject.so: 25 | make libobject.so -C ../../ 26 | 27 | clean: 28 | rm -fr *.so *.i *.cxx *.o vala_d_object.d vala_d_object_im.d test -------------------------------------------------------------------------------- /valabind/dlang/README.md: -------------------------------------------------------------------------------- 1 | Install D Compiler and Libraries 2 | =============== 3 | 4 | Just install D2: http://dlang.org/ -------------------------------------------------------------------------------- /valabind/dlang/test.d: -------------------------------------------------------------------------------- 1 | import std.stdio; 2 | import std.conv; 3 | import vala_d_object; 4 | 5 | void main() { 6 | //say_hello_to ("Java"); 7 | auto vala_object = new ValaClass(); 8 | writefln (vala_object.append_to_name ("called from D")); 9 | } -------------------------------------------------------------------------------- /valabind/java/Makefile: -------------------------------------------------------------------------------- 1 | export LD_LIBRARY_PATH:=$(shell cd ../.. && pwd) 2 | 3 | GOBJECT_HEADERS=`pkg-config --cflags --libs gobject-2.0` 4 | HEADERS=-I/usr/lib/jvm/java-7-openjdk-amd64/include/ -I/usr/lib/jvm/java-7-openjdk-amd64/include/linux 5 | LANGUAGE=java 6 | 7 | run: *.class 8 | java -Djava.library.path=. Test 9 | 10 | bind: c-source libobject.so 11 | valabind-cc $(LANGUAGE) libobject -NValaObject ../../object.vapi -I. -I../../ $(HEADERS) $(GOBJECT_HEADERS) -I/usr/include -L../.. -lobject -x 12 | 13 | *.class: 14 | javac *.java 15 | 16 | c-source: 17 | make c-source -C ../../ 18 | 19 | libobject.so: 20 | make libobject.so -C ../../ 21 | 22 | clean: 23 | rm -fr *.typelib *.so *.gir *.vapi *.c *.h *.i *.cxx *.class ValaClass.java libobjectJNI.java libobject.java -------------------------------------------------------------------------------- /valabind/java/README.md: -------------------------------------------------------------------------------- 1 | apt-get install default-jdk 2 | 3 | ?libxt-doc openjdk-7-demo openjdk-7-source visualvm? -------------------------------------------------------------------------------- /valabind/java/Test.java: -------------------------------------------------------------------------------- 1 | /* Run: java -Djava.library.path=. TestRBin */ 2 | import java.util.*; 3 | 4 | class Test { 5 | static { 6 | System.loadLibrary("object"); 7 | } 8 | public static void main (String args[]) { 9 | 10 | // say_hello_to ("Java"); 11 | 12 | ValaClass vala_object; 13 | vala_object = new ValaClass (); 14 | System.out.printf (vala_object.append_to_name ("called from Java")); 15 | 16 | } 17 | } -------------------------------------------------------------------------------- /valabind/node-webkit/Makefile: -------------------------------------------------------------------------------- 1 | export LD_LIBRARY_PATH:=$(shell cd ../.. && pwd) 2 | 3 | run: 4 | nw . 5 | 6 | bind: c-source libobject.so node_modules ref ffi 7 | valabind --node-ffi -m object -N ValaObject -V ../.. object -o vala_node_object.js 8 | 9 | c-source: 10 | make c-source -C ../../ 11 | 12 | libobject.so: 13 | make libobject.so -C ../../ 14 | 15 | node_modules: 16 | npm install 17 | 18 | ref: node_modules 19 | cd node_modules/ref; \ 20 | node-gyp clean; \ 21 | ../nw-gyp/bin/nw-gyp.js configure --target=0.6.2; \ 22 | ../nw-gyp/bin/nw-gyp.js build 23 | 24 | ffi: node_modules 25 | cd node_modules/ffi; \ 26 | node-gyp clean; \ 27 | ../nw-gyp/bin/nw-gyp.js configure --target=0.6.2; \ 28 | ../nw-gyp/bin/nw-gyp.js build 29 | 30 | clean: 31 | rm -fr *.typelib *.so *.gir *.vapi *.c *.h *.i *.cxx vala_node_object.js node_modules -------------------------------------------------------------------------------- /valabind/node-webkit/README.md: -------------------------------------------------------------------------------- 1 | # Call Vala directly from DOM and enable a new way of writing applications with all Web technologies. 2 | 3 | - Install [node-webkit](langs/ruby/README.md) 4 | - Replace ```--target=0.6.2``` in Makefile with your node-webkit version -------------------------------------------------------------------------------- /valabind/node-webkit/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |