Skip to content

Unify Compilation Process for Native ExtensionΒ #14

@marcoroth

Description

@marcoroth

Originally posted by @karreiro in #13

Question

The way we currently build the native extension involves two phasesβ€”one with the Makefile in the root and another generated by ext/erbx/extconf.rb. While this setup works, it adds an extra point of failure for users compiling the gem from source.

What do you think about adjusting the directory structure to have a single compilation process based on ext/erbx/extconf.rb? We could move from this:

.
β”œβ”€β”€ Gemfile
β”œβ”€β”€ ext
β”‚   └── erbx
β”‚       β”œβ”€β”€ extconf.rb
β”‚       β”œβ”€β”€ extension.c
β”‚       β”œβ”€β”€ extension.h
β”‚       β”œβ”€β”€ test
β”‚       β”‚   β”œβ”€β”€ lexer_test.rb
β”‚       β”‚   └── test_helper.rb
β”‚       └── test.rb
β”œβ”€β”€ src
β”‚   β”œβ”€β”€ array.c
β”‚   β”œβ”€β”€ ast.c
β”‚   β”œβ”€β”€ buffer.c
β”‚   β”œβ”€β”€ erbx.c
β”‚   β”œβ”€β”€ include
β”‚   β”‚   β”œβ”€β”€ array.h
β”‚   β”‚   β”œβ”€β”€ ...
β”‚   β”‚   └── version.h

To something like this:

.
β”œβ”€β”€ Gemfile
β”œβ”€β”€ ext
β”‚   └── erbx
β”‚       β”œβ”€β”€ erbx.c
β”‚       β”œβ”€β”€ erbx.h
β”‚       β”œβ”€β”€ extconf.rb
β”‚       └── src
β”‚           β”œβ”€β”€ array.c
β”‚           β”œβ”€β”€ ast.c
β”‚           β”œβ”€β”€ ...
β”‚           └── buffer.c
β”œβ”€β”€ lib
β”‚   β”œβ”€β”€ erbx
β”‚   β”‚   β”œβ”€β”€ erbx.bundle
β”‚   β”‚   └── version.rb
β”‚   └── erbx.rb

I think this change could simplify things and make the build process a bit safer. I do like the current style of the repository, but having just one Makefile, based on ext/erbx/extconf.rb seems like a more straightforward convention to follow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions