{"id":25955111,"url":"https://github.com/Samudevv/runic","last_synced_at":"2025-03-04T16:02:10.568Z","repository":{"id":242647329,"uuid":"777662334","full_name":"Samudevv/runic","owner":"Samudevv","description":"Bindings Generator and Intermediate Format for languages using the C-ABI","archived":false,"fork":false,"pushed_at":"2025-01-22T12:25:32.000Z","size":771,"stargazers_count":44,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-22T13:25:59.546Z","etag":null,"topics":["bindings","c","intermediate-language","odin","odin-lang"],"latest_commit_sha":null,"homepage":"","language":"Odin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Samudevv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-26T09:29:02.000Z","updated_at":"2025-01-22T12:24:44.000Z","dependencies_parsed_at":"2024-08-27T09:57:39.989Z","dependency_job_id":"0ffbb778-2c09-463c-b0c1-fbbf5a8de33f","html_url":"https://github.com/Samudevv/runic","commit_stats":null,"previous_names":["samudevv/runic"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Samudevv%2Frunic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Samudevv%2Frunic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Samudevv%2Frunic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Samudevv%2Frunic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Samudevv","download_url":"https://codeload.github.com/Samudevv/runic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241877447,"owners_count":20035403,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bindings","c","intermediate-language","odin","odin-lang"],"created_at":"2025-03-04T16:01:44.653Z","updated_at":"2025-03-04T16:02:10.558Z","avatar_url":"https://github.com/Samudevv.png","language":"Odin","funding_links":[],"categories":["Libraries"],"sub_categories":["Language Tooling"],"readme":"# Runic\n\nBindings Generator and Intermediate Format for programming languages using the C-ABI.\n\n**This project is heavily under development, therefore if you would like to use it, make sure to build directly from the master branch**\n\nThe goal of this project is to allow the developer to freely choose which ever language they desire as long as that language can interact with the C-ABI.\n\nFor example if you would like to use odin in your project but also use a C library you would have a problem. You could either implement the whole library in odin, create bindings manually or look for an entirely different approach which lets you use another library. Therefore you are often bound to the language which you decide to use, which only gets intensified if the language is not that popular. Runic tries to fix this problem by creating an intermediate format from which every language can generate bindings from. Every language can also generate this intermediate format from itself to even allow bindings between languages that are not C.\n\n## Supported Languages\n\n| Language | From | To  |\n| -------- | :--: | :-: |\n| C        |  ✅  | ✅  |\n| Odin     |  ✅  | ✅  |\n\n## Documentation\n\nThere is documentation available on the [wiki](https://github.com/Samudevv/runic/wiki).\n\n## Usage\n\n```console\nrunic [rune file]\n```\n\nRunic is configured through a **rune** file which is a yaml file that contains the language **from** which to generate a **runestone** and (if specified) the language **to** which to write bindings using the generated **runestone**. If no rune file is specified a `rune.yml` file in the current directory is attempted to be opened.\n\nA **runestone** is an intermediate format that contains all symbols and necessary types that are contained inside one library file (e.g. libfoo.a, libfoo.so, foo.lib, foo.dll etc.)\n\n## Build\n\n### Dependencies\n\nFirst make sure that all submodules are checked out. Then following dependencies are required:\n\n- [odin](https://odin-lang.org)\n- [just](https://just.systems/)\n- [libclang](https://clang.llvm.org/docs/LibClang.html) _Preferred is version 18_\n- [libyaml](https://github.com/yaml/libyaml)\n\nArch Linux: `sudo pacman -S --needed --noconfirm base-devel just clang libyaml` \u003cbr\u003e\nUbuntu 24.04: `sudo apt install -y build-essential just libclang-18-dev libyaml-dev` \u003cbr\u003e\nUbuntu 22.04: `sudo apt install -y build-essential libclang-dev libyaml-dev` \u003cbr\u003e _On older Ubuntu systems `libclang-18-dev` does not exist, so the newest version should be installed. The package `just` also does not exist, but a statically linked executable can be downloaded directly from the releases page of the repository_\n\nMacOS: `brew install llvm@18` _libyaml is already packaged into the odin library_ \u003cbr\u003e\nWindows: All dependencies are already provided for the `x86_64` architecture \u003cbr\u003e\n\nYou may need to create a symlink manually called `libclang.so` that points to the correct library file.\n\n### Linux\n\n```console\njust\n```\n\nThis will build a release build of runic and write the resulting binary to `build/runic`\n\n### Windows\n\n```console\n.\\build.cmd\n```\n\nor\n\n```console\njust\n```\n\nThis will build a release build of runic and write the resulting binary to `build\\runic.exe`\n\n## Examples\n\nThis repository contains some examples which show how the tool can be used.\n\n- [olivec](examples/olivec) \u003cbr\u003e This example creates odin bindings to the rendering library [olive.c](https://github.com/tsoding/olive.c) and a program that uses said library to render an example image. Build it using:\n  ```console\n  just example olivec\n  ```\n\n## Runestone\n\n[Runestone Documentation](https://github.com/Samudevv/runic/wiki/Runestone)\n\n```ini\nversion = 0\n\nos = Linux\narch = x86_64\n\n[lib]\nshared = libfoo.so\nstatic = libfoo.a\n\n[symbols]\nfunc.foo1234 = #Untyped a #SInt32 #Attr Ptr 1 #AttrEnd b #SInt32 #Attr Ptr 1 #AttrEnd\nfunc.output_print_name = #SInt32 output output #Attr Ptr 1 #AttrEnd\nfunc.print = #Untyped var_args #Variadic\nfunc.funcy = #RawPtr\nvar.foo_varZZXX6 = #Float32 #Attr Ptr 1 Arr 10 #AttrEnd\nvar.idx = #UInt64\nvar.counter = #UInt8\n\n[remap]\nfoo = foo1234\nfoo_var = foo_varZZXX6\n\n[alias]\noof = foo\n\n[types]\ni32 = #SInt32\nstr = #UInt8 #Attr Ptr 1 #AttrEnd\nanon_0 = #Struct desc str apple #UInt8\noutput = #Struct x #SInt32 y #SInt32 name str pear anon_0\noutput_flags = #Enum #SInt32 SHOWN 0 HIDDEN 1 OFF ARR_CAP ON \"1+2\"\nnumbers = #Float32 #Attr Arr ARR_SIZE #AttrEnd\ntransform = #Float64 #Attr ReadOnly Arr 4 ReadOnly Arr 4 WriteOnly #AttrEnd\nouter = #Float32 #Attr Ptr 1 Arr 2 #AttrEnd\ntimes = #SInt32 #Attr Arr \"5*6/3*(8%9)\" #AttrEnd\nanon_1 = #Struct x #SInt32 y #SInt32\nsuper_ptr = anon_1 #Attr Ptr 1 #AttrEnd\n\n[methods]\noutput.print_name = output_print_name\n\n[constants]\nARR_SIZE = 5 #Untyped\nARR_CAP = 20 #UInt64\nAPP_NAME = \"Hello World\" #SInt8 #Attr Ptr 1 #AttrEnd\nLENGTH = 267.3450000000000273 #Float64\n```\n\nA runestone is a (modified) ini file containing information about the contents of one library file which can either be a static or a shared library. Meant to replace the C header files which are usually used to define the symbols of a library file. The format is meant to be easily parsable even if a parser is written from scratch.\n\n## Rune\n\n[Rune Documentation](https://github.com/Samudevv/runic/wiki/Rune)\n\n```yaml\nversion: 0\nplatforms:\n  - Linux x86_64\n  - Macos x86_64\n  - Windows x86_64\nfrom:\n  language: c\n  static: libolivec.a\n  static.windows: olivec.lib\n  headers: olive.c\n  defines:\n    OLIVECDEF: \"extern\"\n  ignore:\n    macros:\n      - OLIVE_C_\n      - OLIVEC_CANVAS_NULL\nto:\n  language: odin\n  package: olivec\n  trim_prefix:\n    functions: olivec_\n    types: Olivec_\n    constants: OLIVEC_\n  no_build_tag: yes\n  use_when_else: yes\n  ignore_arch: yes\n  out: \"olivec/olivec.odin\n```\n\nThis example rune file is used to generate the bindings of the olivec example. A rune file contains all configuration necessary to generate bindings or runestones. One rune consists of a from and a to section. Each section can either specify a runestone file or a configuration that generates a runestone or bindings respectively.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSamudevv%2Frunic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSamudevv%2Frunic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSamudevv%2Frunic/lists"}