-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from JumpLink/master
new valabind examples
- Loading branch information
Showing
43 changed files
with
331 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,133 @@ | ||
export LD_LIBRARY_PATH := $(shell pwd) | ||
export GI_TYPELIB_PATH := $(shell pwd) | ||
|
||
all: vala-object.so ValaObject-0.1.typelib | ||
RUBY1.8_HEADERS=-I/usr/lib/ruby/1.8/x86_64-linux/ -I/usr/lib/ruby/1.8/i686-linux/ | ||
RUBY1.9.1_HEADERS=-I/usr/lib/ruby/1.9.1/x86_64-linux/ -I/usr/lib/ruby/1.9.1/i686-linux/ | ||
PHP_HEADERS=`php-config --includes` | ||
|
||
run: all run-ruby run-python run-php run-lua run-gnome-js run-node-js | ||
all: libobject.so ValaObject-0.1.typelib c-source | ||
|
||
run-ruby: all | ||
ruby langs/ruby/test.rb | ||
run: run-gir | ||
|
||
run-python: all | ||
python langs/python/test.py | ||
run-gir: run-gir-ruby run-gir-python run-gir-php run-gir-lua run-gir-gnome-js run-gir-nodejs | ||
|
||
run-php: all | ||
php langs/php/test.php | ||
run-valabind: run-valabind-ruby run-valabind-python run-valabind-php run-valabind-lua run-gir-nodejs | ||
|
||
run-perl: all | ||
perl langs/perl/test.pl | ||
########## test gir bingings ########## | ||
|
||
run-lua: all | ||
lua langs/lua/test.lua | ||
luajit-2.0.0-beta9 langs/lua/test.lua | ||
run-ruby-gir: | ||
-ruby gir/ruby/test.rb | ||
|
||
run-gnome-js: all | ||
gjs langs/javascript/test.gnome.js | ||
seed langs/javascript/test.gnome.js | ||
run-python-gir: | ||
-python gir/python/test.py | ||
|
||
run-node-js: all | ||
cd langs/javascript && npm install && node test.node.js | ||
run-php-gir: | ||
-php gir/php/test.php | ||
|
||
run-perl-gir: | ||
-perl gir/perl/test.pl | ||
|
||
run-lua-gir: | ||
-lua gir/lua/test.lua | ||
-luajit-2.0.0-beta9 gir/lua/test.lua | ||
|
||
run-gnome-js: | ||
-gjs gir/javascript/test.gnome.js | ||
-seed gir/javascript/test.gnome.js | ||
|
||
run-nodejs-gir: | ||
-node gir/javascript/test.node.js | ||
|
||
########## test generated bindings with Valabind and valabind ########## | ||
|
||
# TODO | ||
run-ruby-valabind: | ||
-make run -C valabind/ruby | ||
|
||
# TODO | ||
run-python-valabind: | ||
-python valabind/python/test.py | ||
|
||
run-php-valabind: | ||
-make run -C valabind/php | ||
|
||
# TODO | ||
run-perl-valabind: | ||
-perl valabind/perl/test.pl | ||
|
||
# TODO | ||
run-lua-valabind: | ||
-lua valabind/lua/test.lua | ||
|
||
run-nodejs-valabind: | ||
-make run -C valabind/javascript | ||
|
||
run-java-valabind: | ||
-make run -C valabind/java | ||
|
||
run-d-valabind: | ||
-make run -C valabind/dlang | ||
|
||
########## generate bindings with Valabind ########## | ||
|
||
# TODO | ||
ruby-valabind: libobject.so c-source | ||
-make bind -C valabind/ruby | ||
|
||
# TODO | ||
python-valabind: libobject.so c-source | ||
valabind-cc python pythonobject -NValaObject libobject.vapi -I. `pkg-config --cflags --libs gobject-2.0` -I/usr/include -L. -lobject -x | ||
|
||
php-valabind: | ||
-make bind -C valabind/php | ||
|
||
# TODO | ||
perl-valabind: libobject.so c-source | ||
valabind-cc perl perlobject -NValaObject libobject.vapi -I. `pkg-config --cflags --libs gobject-2.0` -I/usr/include -L. -lobject -x | ||
|
||
# TODO | ||
lua-valabind: libobject.so c-source | ||
valabind-cc lua luaobject -NValaObject libobject.vapi -I. `pkg-config --cflags --libs gobject-2.0` -I/usr/include -L. -lobject -x | ||
|
||
nodejs-valabind: | ||
-make bind -C valabind/javascript | ||
|
||
java-valabind: | ||
-make bind -C valabind/java | ||
|
||
d-valabind-swig: | ||
-make swig -C valabind/dlang | ||
|
||
d-valabind: | ||
-make bind -C valabind/dlang | ||
|
||
########## Vala Stuff ########## | ||
|
||
c-source: | ||
valac --ccode object.vala | ||
valac -H object.h -C --vapi=object.vapi --library=libobject object.vala | ||
|
||
vala-object.so: | ||
libobject.so: | ||
valac \ | ||
--enable-experimental \ | ||
-X -fPIC -X -shared \ | ||
--library=vala-object \ | ||
--library=libobject \ | ||
--gir=ValaObject-0.1.gir \ | ||
-o vala-object.so \ | ||
-o libobject.so \ | ||
object.vala | ||
|
||
ValaObject-0.1.typelib: | ||
g-ir-compiler \ | ||
--shared-library=vala-object.so \ | ||
--shared-library=libobject.so \ | ||
--output=ValaObject-0.1.typelib \ | ||
ValaObject-0.1.gir | ||
|
||
########## Other ########## | ||
|
||
clean: | ||
rm -fr $(shell cat .gitignore) | ||
make clean -C valabind/javascript | ||
make clean -C valabind/php | ||
make clean -C valabind/ruby | ||
make clean -C valabind/java | ||
make clean -C valabind/dlang | ||
make clean -C valabind/c++ |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "ValaObject", | ||
"version": "0.0.1", | ||
"url": "https://github.com/antono/vala-object", | ||
"description": "", | ||
"repository" : {"type": "git", "url": "[email protected]:antono/vala-object.git"}, | ||
"dependencies": { | ||
"ref-struct": "0.0.4", | ||
"ref": "~0.1.3", | ||
"ffi": "~1.2.0", | ||
"gir": "*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export LD_LIBRARY_PATH:=$(shell cd ../.. && pwd) | ||
|
||
GOBJECT_HEADERS=`pkg-config --cflags --libs gobject-2.0` | ||
LANGUAGE=cxx | ||
|
||
run: build | ||
|
||
bind: c-source libobject.so | ||
valabind --$(LANGUAGE) -m vala_cpp_object -N ValaObject -V ../.. object -x | ||
|
||
swig: c-source libobject.so | ||
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 | ||
|
||
build: | ||
gcc test.cpp vala_cpp_object.cxx -I. -I../../ -I/usr/include $(GOBJECT_HEADERS) -L../.. -lobject | ||
#gcc test.cpp | ||
|
||
c-source: | ||
make c-source -C ../../ | ||
|
||
libobject.so: | ||
make libobject.so -C ../../ | ||
|
||
clean: | ||
rm -fr *.so *.i *.cxx object.d object_im.d *.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sudo apt-get install libtclcl1-dev tcl8.6-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include "vala_cpp_object.cxx" | ||
|
||
int main( ) { | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
export LD_LIBRARY_PATH:=$(shell cd ../.. && pwd):$(shell pwd) | ||
export SWIGFLAGS=-d2 | ||
|
||
GOBJECT_HEADERS=`pkg-config --cflags --libs gobject-2.0` | ||
LANGUAGE=dlang | ||
|
||
run: build-swig | ||
./test | ||
|
||
# TODO | ||
bind: c-source libobject.so | ||
valabind --$(LANGUAGE) -m object -N ValaObject -V ../.. object -o vala_d_object.d | ||
|
||
swig: c-source libobject.so | ||
valabind-cc d vala_d_object -NValaObject ../../object.vapi -I. -I../../ $(GOBJECT_HEADERS) -I/usr/include -L../.. -lobject -x | ||
mv vala_d_object.so libvala_d_object_wrap.so | ||
|
||
build-swig: | ||
dmd test.d vala_d_object_im.d vala_d_object.d | ||
|
||
c-source: | ||
make c-source -C ../../ | ||
|
||
libobject.so: | ||
make libobject.so -C ../../ | ||
|
||
clean: | ||
rm -fr *.so *.i *.cxx *.o vala_d_object.d vala_d_object_im.d test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Install D Compiler and Libraries | ||
=============== | ||
|
||
Just install D2: http://dlang.org/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import std.stdio; | ||
import std.conv; | ||
import vala_d_object; | ||
|
||
void main() { | ||
//say_hello_to ("Java"); | ||
auto vala_object = new ValaClass(); | ||
writefln (vala_object.append_to_name ("called from D")); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export LD_LIBRARY_PATH:=$(shell cd ../.. && pwd) | ||
|
||
GOBJECT_HEADERS=`pkg-config --cflags --libs gobject-2.0` | ||
HEADERS=-I/usr/lib/jvm/java-7-openjdk-amd64/include/ -I/usr/lib/jvm/java-7-openjdk-amd64/include/linux | ||
LANGUAGE=java | ||
|
||
run: *.class | ||
java -Djava.library.path=. Test | ||
|
||
bind: c-source libobject.so | ||
valabind-cc $(LANGUAGE) libobject -NValaObject ../../object.vapi -I. -I../../ $(HEADERS) $(GOBJECT_HEADERS) -I/usr/include -L../.. -lobject -x | ||
|
||
*.class: | ||
javac *.java | ||
|
||
c-source: | ||
make c-source -C ../../ | ||
|
||
libobject.so: | ||
make libobject.so -C ../../ | ||
|
||
clean: | ||
rm -fr *.typelib *.so *.gir *.vapi *.c *.h *.i *.cxx *.class ValaClass.java libobjectJNI.java libobject.java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
apt-get install default-jdk | ||
|
||
?libxt-doc openjdk-7-demo openjdk-7-source visualvm? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* Run: java -Djava.library.path=. TestRBin */ | ||
import java.util.*; | ||
|
||
class Test { | ||
static { | ||
System.loadLibrary("object"); | ||
} | ||
public static void main (String args[]) { | ||
|
||
// say_hello_to ("Java"); | ||
|
||
ValaClass vala_object; | ||
vala_object = new ValaClass (); | ||
System.out.printf (vala_object.append_to_name ("called from Java")); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export LD_LIBRARY_PATH:=$(shell cd ../.. && pwd) | ||
|
||
GOBJECT_HEADERS=`pkg-config --cflags --libs gobject-2.0` | ||
|
||
run: | ||
node test.node.js | ||
|
||
bind: c-source libobject.so node_modules | ||
valabind --node-ffi -m object -N ValaObject -V ../.. object -o vala_node_object.js | ||
|
||
c-source: | ||
make c-source -C ../../ | ||
|
||
libobject.so: | ||
make libobject.so -C ../../ | ||
|
||
node_modules: | ||
npm install | ||
|
||
clean: | ||
rm -fr *.typelib *.so *.gir *.vapi *.c *.h *.i *.cxx vala_node_object.js node_modules |
Oops, something went wrong.