-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to use static libpasta, include native libs.
With this, Java build in libpasta-java repo should be working.
- Loading branch information
1 parent
22a50c5
commit 25a1e59
Showing
7 changed files
with
112 additions
and
34 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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
Cross-language bindings for libpasta | ||
==================================== | ||
|
||
This library is intended for developers wishing to extend or improve the | ||
existing language bindings for [libpasta](https://libpasta.github.io/). | ||
|
||
For existing language bindings, and ways to install in those languages, | ||
please see the information | ||
[here](https://libpasta.github.io/other-languages/overview/). | ||
|
||
SWIG and libpasta | ||
------------------ | ||
|
||
The language bindings produced here are through using | ||
[SWIG](http://www.swig.org/). | ||
|
||
The following logic is used to produce the language bindings: | ||
|
||
We define the C header file in [pasta.h](./pasta.h) which corresponds to the | ||
Rust definitions from the | ||
[libpasta-ffi](https://github.com/libpasta/libpasta-ffi) crate (included as a | ||
submodule for convenience). | ||
|
||
This header file is now compatible with using SWIG, and the [pasta.i](./pasta.i) | ||
file produces basic bindings with just the `%include <pasta.h>` line. | ||
|
||
The rest of the [pasta.i](./pasta.i) file is dedicated to language-specific | ||
requirements, and convenience code, such as automatically deallocating | ||
the Rust `String` objects required to call the library. | ||
|
||
We produce code for each support language using the [Makefile](./Makefile). | ||
In general, this runs SWIG over the definition file to produce wrapper code, | ||
and compiles it into a single `pasta.so` file (name depending on the language | ||
and system preferences), and language-specific code to use this library. | ||
|
||
Current Status | ||
-------------- | ||
|
||
The entire libpasta project is still in an early phase. These bindings are | ||
designed for ease of use, and early testing. | ||
|
||
For now, libpasta is compiled dynamically, and included as a dependency in the | ||
produced wrapper, which means linking all the required shared libraries when | ||
building the wrappers. This step is potentially troublesome. In the future, we | ||
would like libpasta to be a shared system library. | ||
|
||
Currently these bindings are designed for `x86_64-unknown-linux-gnu` | ||
(as per | ||
[Rust platform support](https://forge.rust-lang.org/platform-support.html)), | ||
but we are trying to increase support to other platforms. |
Binary file not shown.
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,34 +1,43 @@ | ||
LD_LIBRARY_PATH="../" | ||
test: | ||
CGO_LDFLAGS="-l pasta -L../" | ||
NATIVE_LIBS=-lcrypto -lc -lm -lc -lutil -lutil -ldl -lrt -lpthread -lgcc_s -lc -lm -lrt -lpthread -lutil | ||
|
||
all: c java javascript go php python ruby | ||
|
||
c: | ||
CGO_LDFLAGS="../libpasta-ffi/target/release/libpasta.a" | ||
|
||
@printf "\nTest C:\n" | ||
gcc -Wall test.c -lpasta -I../ -o test | ||
gcc -Wall test.c ../libpasta-ffi/target/release/libpasta.a -I../ $(NATIVE_LIBS) -o test | ||
chmod +x test | ||
LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) \ | ||
./test | ||
|
||
|
||
java: | ||
@printf "\nTest Java:\n" | ||
javac -cp .:../libpasta.jar test.java | ||
java -cp .:../libpasta.jar test | ||
@echo -e "\e[1;33mJava tests should be performed using the libpasta-java repo.\e[0m" | ||
|
||
# @printf "\nTest Javascript (node.js)\n" | ||
# cd ../javacsript && node-gyp build | ||
javascript: | ||
@printf "\nTest Javascript (node.js)\n" | ||
cd ../javascript && node-gyp build | ||
|
||
@# printf "\nTest Go:\n" | ||
@# go test | ||
go: | ||
@printf "\nTest Go:\n" | ||
go test | ||
|
||
php5 php56 php: | ||
@printf "\nTest PHP:\n" | ||
LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) \ | ||
$(PHP_BIN) test.php | ||
@$(PHP_BIN) test.php || \ | ||
echo -e "\e[1;33mPHP requires either installing libpasta (try: make install_php), or enabling dynamically loaded extensions.\e[0m" | ||
|
||
|
||
python: | ||
@printf "\nTest Python:\n" | ||
LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) \ | ||
python2 test.py | ||
|
||
ruby: | ||
@printf "\nTest Ruby\n" | ||
LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) \ | ||
ruby test.rb | ||
|
||
.PHONY: test | ||
.PHONY: all c java javascript go php python ruby |
This file was deleted.
Oops, something went wrong.