Package ryegen allows the use of Go libraries in the Rye programming language (https://ryelang.org/).
It is an automatic binding generation utility that allows the creation of custom Rye interpreters, which include the functionality of specific Go libraries.
Create a new Go project
mkdir my_ryegen_project
cd my_ryegen_project
go mod init my_ryegen_project
go get -u github.com/refaktor/ryegen@main
go get -u github.com/refaktor/rye@main
Set up ryegen using ryegen-init (replace "fyne" with a name for your library and "fyne.io/fyne/v2" with any Go package)
go run github.com/refaktor/ryegen/cmd/ryegen-init@main fyne fyne.io/fyne/v2
Run the generator
go mod tidy
go generate ./...
go mod tidy
Edit the "config.toml" file to your liking. See https://github.com/refaktor/rye-fyne/blob/main/generate/config.toml and https://github.com/refaktor/rye-ebitengine/blob/main/generate/config.toml for examples.
Optional: Edit "bindings.txt" to exclude specific functions from your bindings.
Re-run go generate ./...
after making any configuration changes.
Build the Rye interpreter with bindings
go build
Re-run ryegen-init with another name and package
go run github.com/refaktor/ryegen/cmd/ryegen-init@main ebiten github.com/hajimehoshi/ebiten
Compile the Rye interpreter with bindings
# Bind both libraries
go build
# Build without fyne
go build -tags "b_no_fyne"
You can customize the bindings' build tag names in their respective config.toml
files.