Skip to content

Might we generate llhttp .c/.h without JavaScript? #786

@RodrigoDornelles

Description

@RodrigoDornelles

While the project is a core component of Node.js, like libuv, it is a versatile library that can be used outside the JavaScript ecosystem, such as in Julia or Luvit. Notably, llhttp pairs well with libuv, as it was designed with that integration in mind.

Non-JavaScript projects would only need JavaScript in the toolchain to generate the required .c and .h files, which can be handled with simple scripts.

C++ is a suitable choice: it offers a rich STL, high-level abstractions, and most environments with a C compiler will also have a C++ compiler, allowing generation to be orchestrated directly via CMake.

This approach keeps generator scripts maintainable and allows projects in Go, C, C++, etc., to use llhttp without introducing JavaScript into their toolchain. If integrated via CMakeLists.txt alone, it can be managed as an external project.

FetchContent_Declare(
    llhttp
    GIT_REPOSITORY https://github.com/nodejs/llhttp.git
    GIT_TAG v9.3.0
)

FetchContent_MakeAvailable(llhttp)

target_include_directories(${PROJECT_NAME} PRIVATE ${llhttp_SOURCE_DIR}/include)
target_link_libraries(${PROJECT_NAME} PRIVATE llhttp)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions