Amalgamation¶
Lexbor can be built as a single-header/single-source amalgamation for easy integration into your project without managing multiple files or dependencies.
The amalgamation combines all selected modules and their dependencies into one .h file, making it simple to drop into any C/C++ project.
Generate Amalgamation¶
Use the single.pl script from the repository root to generate an amalgamated version:
# Generate amalgamation with all modules
perl single.pl --all > lexbor_single.h
# Generate amalgamation for specific modules (dependencies are included automatically)
perl single.pl html css > lexbor_html_css_single.h
# Generate with exported symbols (for dynamic linking)
perl single.pl --with-export-symbols html > lexbor_html_single.h
# Use a different port (default: posix)
perl single.pl --port=windows_nt html > lexbor_html_single.h
Available Options¶
Basic Options¶
Option |
Description |
|---|---|
|
Show help message |
|
Include all modules if no modules specified |
|
Specify platform port to use (default: |
|
Export symbols (for building shared libraries) |
Information Options¶
Option |
Description |
|---|---|
|
Print all available modules |
|
Print detailed dependencies of specified modules |
|
Print dependency graph as a tree |
|
Print statistics about module dependencies |
|
Print reverse dependencies (which modules depend on specified ones) |
|
Print size information (lines of code, file counts) |
|
Show minimal set of dependencies |
|
Print version information for modules |
|
Print Lexbor version |
Validation Options¶
Option |
Description |
|---|---|
|
Check for cyclic dependencies |
|
Validate that all dependencies exist |
|
Compare dependencies between two modules |
Export Options¶
Option |
Description |
|---|---|
|
Export dependency graph in DOT format (Graphviz) |
|
Export dependency structure to JSON |
|
Export dependency structure to YAML |
Usage Example¶
Generate the amalgamation file with the HTML module:
perl single.pl html > lexbor_html_single.h
Then include the generated file in your project:
#include "lexbor_html_single.h"
int
main(void)
{
lxb_html_document_t *document;
lxb_status_t status;
const lxb_char_t html[] = "<div>Hello!</div>";
document = lxb_html_document_create();
if (document == NULL) {
return EXIT_FAILURE;
}
status = lxb_html_document_parse(document, (const lxb_char_t *) html,
sizeof(html) - 1);
if (status != LXB_STATUS_OK) {
return EXIT_FAILURE;
}
lxb_html_document_destroy(document);
return EXIT_SUCCESS;
}
Compile without any additional dependencies:
gcc -o myapp myapp.c