{"id":22308696,"url":"https://github.com/lemonrock/bindgen-wrapper","last_synced_at":"2025-03-26T01:28:41.939Z","repository":{"id":137414336,"uuid":"67126229","full_name":"lemonrock/bindgen-wrapper","owner":"lemonrock","description":"A wrapper around bindgen to make it easier to use","archived":false,"fork":false,"pushed_at":"2018-05-03T08:09:34.000Z","size":137,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-30T22:51:24.387Z","etag":null,"topics":["bindgen","bindgen-wrapper","cargo","rust"],"latest_commit_sha":null,"homepage":"https://github.com/lemonrock/bindgen-wrapper","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lemonrock.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":"2016-09-01T11:41:42.000Z","updated_at":"2019-07-15T22:49:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"e796ff99-47ae-4514-8b7b-b82753f17126","html_url":"https://github.com/lemonrock/bindgen-wrapper","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/lemonrock%2Fbindgen-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemonrock%2Fbindgen-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemonrock%2Fbindgen-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemonrock%2Fbindgen-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lemonrock","download_url":"https://codeload.github.com/lemonrock/bindgen-wrapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245571204,"owners_count":20637298,"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":["bindgen","bindgen-wrapper","cargo","rust"],"created_at":"2024-12-03T20:14:58.797Z","updated_at":"2025-03-26T01:28:41.932Z","avatar_url":"https://github.com/lemonrock.png","language":"Shell","readme":"[](This file is part of bindgen-wrapper. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/bindgen-wrapper/master/COPYRIGHT. No part of bindgen-wrapper, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file.)\n[](Copyright © 2016 The developers of bindgen-wrapper. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/bindgen-wrapper/master/COPYRIGHT.)\n\n# bindgen-wrapper\n\nThis small git module makes it easier to generate FFI bindings for rust using [bindgen]. is intended to be used as a git submodule inside a `-sys` module, to make it easier to work with [bindgen] on Mac OS X and with more complex FFI wrappers. It installs all required dependencies using `cargo`, and, on Mac OS X, `brew` (Homebrew), except for Rust, `cargo` and `brew` itself. As a final step, after generating the bindings, it checks they compile.\n\nIt checks for any essential dependencies by looking in the `PATH`; a standard Mac OS X `PATH` with an additional to find binaries installed by cargo should be sufficient.\n\nAs an example, check out [bearssl-sys] on GitHub.\n\n## Dependencies\n\nWe try to automatically install these, but this is brittle at the moment. In the future, we may use a custom .cargo location.\n\n* bindgen\n* rustfmt-nightly\n\n## Installation\n\nAt the terminal, do the following:-\n\n```bash\n# my-crate-repo should already contain a `.git` folder or file\ncd my-crate-repo\n\nmkdir -m 0755 -p tools\ngit submodule add https://github.com/lemonrock/bindgen-wrapper.git tools/bindgen-wrapper\ngit submodule update --init --recursive\nln -s tools/bindgen-wrapper/bindgen-wrapper\n\ncd -\n```\n\n## Configuration\n\nTo use `bindgen-wrapper` we need to create some files.\n\nAt the terminal, do the following:-\n```bash\n# my-crate-repo should already contain a `.git` folder or file\ncd my-crate-repo\n\nmkdir -m 0755 bindgen-wrapper.conf.d\n\n# Place any header (*.h) files in here that add to or replace ones shipped by your library\nmkdir -m 0755 bindgen-wrapper.conf.d/header-overrides\n\n# Rust code snippet prepended to bindgen output. Add crate-level attributes, copyright statements, etc, here\ntouch bindgen-wrapper.conf.d/preamble.rs\n\n# Rust code snippet interjected between `use` statements and remainder of generated code. Place additional `use` statements here\ntouch bindgen-wrapper.conf.d/post-includes.rs\n\n# General configuation (does not need to executable)\ntouch bindgen-wrapper.conf.d/configuration.sh\n```\n\nSee [bearssl-sys] and [libfabric] for examples of `configuration.sh`. As a minimum, you should define `rootIncludeFileName` and `link`. `link` is a space-separated list of lib names (on Unix systems, omit any `lib` prefix, eg `libmbedtls` is `mbedtls`). The functions `preprocess_before_headersFolderPath`, `postprocess_after_generation`, `postprocess_after_rustfmt` and `final_chance_to_tweak` default to empty. The statement `bindgen_wrapper_addTacFallbackIfNotPresent` is only necessary if either `postprocess_after_generation` or `postprocess_after_rustfmt` need to use the `tac` binary. The values `macosXHomebrewPackageName` and `alpineLinuxPackageName` (if known) can be set to a space-separated list of packages to install as prerequisites, perhaps containing header files. `headersFolderPath` can be used to specify a repository-local relative location for headers. To do actions before `headersFolderPath` is used, insert code in `preprocess_before_headersFolderPath`. This can rely on the packages in `macosXHomebrewPackageName` or `alpineLinuxPackageName` having been installed. The variable `clangAdditionalArguments` can be set to pass additional switches to clang via bindgen.\n\nThe following read-only variables are available to `configuration.sh`:-\n\n* `homeFolder` - the root of the git repository, ie `tools/bindgen/../..`.\n* `configurationFolderPath` - the parent folder containing `configuration.sh`\n* `outputFolderPath` - the location of eventual rust code (typically `$homeFolder/src`). Only populated and useful in `final_chance_to_tweak`. Contains files such as `lib.rs`, `enums/\u003csomeEnumName\u003e.rs`, etc. See [libfabric] for examples.\n\nThese values may not be absolute. Do not `cd` inside `configuration.sh`. The [mbedtls-sys] `configuration.sh` uses `homeFolder` to find a local copy of the mbedtls source code included as a git submodule.\n\nThe file `constant.types` allows for remapping of constants defined using `#define` in C to sensible values in Rust. The file `suppress-debug-warnings` lists structs to suppress debug warnings for.\n\n## Known Issues\n\n* This wrapper is untested on anything but Mac OS X El Capitan, but with modification, should work on Alpine Linux, Debian-derivatives and Red Hat derivatives\n* `sed` is somewhat broken on Mac OS X, and we try to work around it.\n\n\n[bearssl-sys]: https://github.com/lemonrock/bearssl-sys \"bearssl-sys GitHub page\"\n[libfabric]: https://github.com/lemonrock/libfabric \"libfabric GitHub page\"\n[bindgen]: https://github.com/Yamakaky/bindgen \"bindgen GitHub page\"\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flemonrock%2Fbindgen-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flemonrock%2Fbindgen-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flemonrock%2Fbindgen-wrapper/lists"}