{"id":13507483,"url":"https://github.com/blt/port_compiler","last_synced_at":"2025-04-14T20:49:31.114Z","repository":{"id":29510237,"uuid":"33048493","full_name":"blt/port_compiler","owner":"blt","description":"A rebar3 port compiler","archived":false,"fork":false,"pushed_at":"2024-10-10T11:04:43.000Z","size":116,"stargazers_count":66,"open_issues_count":11,"forks_count":39,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-31T13:53:57.466Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2015-03-28T20:10:14.000Z","updated_at":"2025-03-18T21:49:02.000Z","dependencies_parsed_at":"2024-05-21T11:58:25.732Z","dependency_job_id":"89f72da3-1b29-4990-84be-205e7d35af31","html_url":"https://github.com/blt/port_compiler","commit_stats":{"total_commits":84,"total_committers":22,"mean_commits":"3.8181818181818183","dds":0.7142857142857143,"last_synced_commit":"c82a9e88a5171b80bcf6b62c151e027b068971cb"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blt%2Fport_compiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blt%2Fport_compiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blt%2Fport_compiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blt%2Fport_compiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blt","download_url":"https://codeload.github.com/blt/port_compiler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247685626,"owners_count":20979085,"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":[],"created_at":"2024-08-01T02:00:34.893Z","updated_at":"2025-04-07T16:08:53.061Z","avatar_url":"https://github.com/blt.png","language":"Erlang","funding_links":[],"categories":["Build Tools","Rebar"],"sub_categories":[],"readme":"port_compiler\n=====\n\nA port compiler for rebar3.\n\nThis plugin is intended to replicate the rebar2 support for compiling native\ncode. It is not a drop-in replacement in terms of command-line interface but the\nexact configuration interface in projects' `rebar.config`s have been preserved.\n\nUse In Your Project\n---------------------\n\nAdd the plugin to your `rebar.config`:\n\n```erlang\n{plugins, [pc]}.\n{provider_hooks,\n [\n  {pre,\n   [\n    {compile, {pc, compile}},\n    {clean, {pc, clean}}\n   ]\n  }\n ]\n}.\n```\n\nIf you want to use tools like clang-tidy, don't forget to enable the compile commands db like this:\n\n```erlang\n{pc_clang_db, true}.\n```\n\nFrom your existing application:\n\n\n    $ rebar3 pc compile\n    ===\u003e Fetching pc\n    ===\u003e Compiling pc\n    ===\u003e Verifying dependencies...\n    Compiling ...\n\nYou should now have native code compiled.\n\nUse with Existing Dependency\n-----------------------------\n\nIf your project depends on a dependency that used the rebar2 port compiler instead of forking and changing the `rebar.config` of that dependency you can use [overrides](http://www.rebar3.org/v3.0/docs/configuration#overrides) to inject the changes from your top level `rebar.config`. Using [jiffy](https://github.com/davisp/jiffy) as an example:\n\n\n```erlang\n{deps, [jiffy]}.\n\n{overrides,\n [{override, jiffy, [\n     {plugins, [pc]},\n     {artifacts, [\"priv/jiffy.so\"]},\n     {provider_hooks, [\n         {post,\n             [\n             {compile, {pc, compile}},\n             {clean, {pc, clean}}\n             ]\n          }]\n      }\n  ]}\n]}.\n```\n\nExample\n---\n\nLooking for an example? See my fork of jiffy here and the changes to its\n`rebar.config`: https://github.com/blt/jiffy/commit/d4a0103daec5a646e71045bdf40f12a3eb82ace5\n\n- - -\n\nBELOW HERE BE DRAGONS\n\n```\n%% Supported configuration variables:\n%%\n%% * port_specs - Erlang list of tuples of the forms\n%%                {ArchRegex, TargetFile, Sources, Options}\n%%                {ArchRegex, TargetFile, Sources}\n%%                {TargetFile, Sources}\n%%\n%%                Note that if you want to use any of the rebar3 variables\n%%                below you must MUST use a ${}-style to get the expansion\n%%                to work. e.g. to expand REBAR_DEPS_DIR, do something like:\n%%\n%%                {port_specs, [{\"priv/nif.so\",\n%%                               [\"c_src/nif.c\",\n%%                                \"${REBAR_DEPS_DIR}/foo/bar.c\"]}]}.\n%%\n%%                This is a _very_ good way to be able to use your code both\n%%                as a top level app and a dependency.\n%%\n%%                CAVEAT! Not using {} is broken for the moment.\n%%\n%% * port_env - Erlang list of key/value pairs which will control\n%%              the environment when running the compiler and linker.\n%%              Variables set in the surrounding system shell are taken\n%%              into consideration when expanding port_env. Note that\n%%              for ERL_LDFLAGS, -lerl_interface is used for only those\n%%              Erlang/OTP versions where it exists (those prior to\n%%              version 23.0).\n%%\n%%              By default, the following variables are defined:\n%%              CC       - C compiler\n%%              CXX      - C++ compiler\n%%              CFLAGS   - C compiler\n%%              CXXFLAGS - C++ compiler\n%%              LDFLAGS  - Link flags\n%%              ERL_CFLAGS  - default -I paths for erts and ei\n%%              ERL_LDFLAGS - default -L and -lerl_interface -lei\n%%              DRV_CFLAGS  - flags that will be used for compiling\n%%              DRV_LDFLAGS - flags that will be used for linking\n%%              EXE_CFLAGS  - flags that will be used for compiling\n%%              EXE_LDFLAGS - flags that will be used for linking\n%%              ERL_EI_LIBDIR - ei library directory\n%%              DRV_CXX_TEMPLATE      - C++ command template\n%%              DRV_CC_TEMPLATE       - C command template\n%%              DRV_LINK_TEMPLATE     - C Linker command template\n%%              DRV_LINK_CXX_TEMPLATE - C++ Linker command template\n%%              EXE_CXX_TEMPLATE      - C++ command template\n%%              EXE_CC_TEMPLATE       - C command template\n%%              EXE_LINK_TEMPLATE     - C Linker command template\n%%              EXE_LINK_CXX_TEMPLATE - C++ Linker command template\n%%\n%%              Note that if you wish to extend (vs. replace) these variables,\n%%              you MUST include a shell-style reference in your definition.\n%%              e.g. to extend CFLAGS, do something like:\n%%\n%%              {port_env, [{\"CFLAGS\", \"$CFLAGS -MyOtherOptions\"}]}\n%%\n%%              It is also possible to specify platform specific options\n%%              by specifying a triplet where the first string is a regex\n%%              that is checked against Erlang's system architecture string.\n%%              e.g. to specify a CFLAG that only applies to x86_64 on linux\n%%              do:\n%%\n%%              {port_env, [{\"x86_64.*-linux\", \"CFLAGS\",\n%%                           \"$CFLAGS -X86Options\"}]}\n%%\n%%              Cross-arch environment variables to configure toolchain:\n%%              GET_ARCH to set the tool chain name to use\n%%              GET_ARCH_WORDSIZE (optional - to determine word size)\"\n%%              word size is 32\n%%              GET_ARCH_VSN (optional - \"\n%%              l version of CC/CXX is requested),\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblt%2Fport_compiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblt%2Fport_compiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblt%2Fport_compiler/lists"}