{"id":20283271,"url":"https://github.com/koreader/ffi-cdecl","last_synced_at":"2025-04-11T08:21:56.724Z","repository":{"id":49595231,"uuid":"53641072","full_name":"koreader/ffi-cdecl","owner":"koreader","description":"Automated C declaration extraction for FFI interfaces","archived":false,"fork":false,"pushed_at":"2024-12-31T14:01:51.000Z","size":32,"stargazers_count":16,"open_issues_count":0,"forks_count":7,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-25T05:51:18.612Z","etag":null,"topics":["automation","gcc-plugin","luajit-ffi"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/koreader.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2016-03-11T05:04:37.000Z","updated_at":"2024-10-09T16:41:17.000Z","dependencies_parsed_at":"2024-11-14T14:24:08.482Z","dependency_job_id":null,"html_url":"https://github.com/koreader/ffi-cdecl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koreader%2Fffi-cdecl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koreader%2Fffi-cdecl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koreader%2Fffi-cdecl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koreader%2Fffi-cdecl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koreader","download_url":"https://codeload.github.com/koreader/ffi-cdecl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248360970,"owners_count":21090793,"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":["automation","gcc-plugin","luajit-ffi"],"created_at":"2024-11-14T14:13:58.963Z","updated_at":"2025-04-11T08:21:56.700Z","avatar_url":"https://github.com/koreader.png","language":"Lua","funding_links":[],"categories":["Lua"],"sub_categories":[],"readme":"ffi-cdecl\n=========\n\nAutomated C declarations extraction tool for FFI interfaces.\n\nCurrently it generates lua header files for LuaJIT FFI, And python header files for cffi.\n\n\nDependencies\n------------\n\n* Development headers for the toolchain on which you plan to use the plugin.\n* gcc-plugin (gcc-x.x-plugin-dev package on ubuntu/debian)\n* Any Lua implementation compatible with Lua 5.1.\n\n\nBuilding\n--------\n\nFirst fetch third party dependencies using `git submodule init` and\n`git submodule update`.\n\nThen just type `make` to build. The default setup builds the plugin\nfor an `arm-none-linux-gnueabi` toolchain located in `/opt/arm-2012.03`,\njust like the default settings used by the koreader nightly build scripts.\n\nHowever, the Makefile should autodetect and adapt to any toolchain given\nthe `CROSS_DIR` or `GCCPLUGIN_DIR` and the `CHOST` or `CROSSCC`/`CROSSCXX`\nvariables.\n\nFor example, if you are running an Ubuntu or Debian system and install the\n`gcc-4.7-plugin-dev` package, you can build a plugin for you standard\n`gcc` executable:\n\n\tmake CROSS_DIR=/usr/lib/gcc CROSSCC=gcc CROSSCXX=g++\n\nAlso, if you install `gcc-4.7-arm-linux-gnueabi`, you can build a plugin\nwhich can be used with that toolchain:\n\n\tmake CROSS_DIR=/usr/lib/gcc CHOST=arm-linux-gnueabi\n\nRead the Makefile for more details.\n\n\nUsage\n-----\n\nSee `test/` directory and [koreader-base][] for examples.\n\nWhen you have the C file ready, run `ffi-cdecl gcc file.c output.lua` or\n`ffi-cdecl g++ file.cpp output.lua` to generate a Lua file containing a\n`ffi.cdef` declaring the desired functions, structs, etc.\n\nFor python cffi, run `ffi-cdecl gcc file.c output.py` or\n`ffi-cdecl g++ file.cpp output.py` to generate a Python file containing a\n`ffi.cdef` declaring the desired functions, structs, etc.\n\nWhen using a cross compiler, you need to replace `gcc` and `g++`\nin these commands with the complete name of the compiler executable of your\ntoolchain, for example `arm-none-linux-gnueabi-gcc` or\n`arm-none-linux-gnueabi-g++`.\n\nYou can also use `CPPFLAGS` environment variable to control build flags, for\nexample:\n\n```\nCPPFLAGS=\"-I. -LSDL2\" ffi-cdecl gcc SDL2_0_decl.c SDL2_0_h.lua\n```\n\n\n[koreader-base]:https://github.com/koreader/koreader-base/tree/master/ffi-cdecl\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoreader%2Fffi-cdecl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoreader%2Fffi-cdecl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoreader%2Fffi-cdecl/lists"}