Skip to content

[Linux] Dynamically link to system libraries, such as gtk4/webkitgtk? #910

@happystraw

Description

@happystraw

Thanks to the SPC team for providing such powerful tool!

I have developed a PHP extension happystraw/php-ext-webview, which is used to build simple cross-platform desktop applications.

On Windows and macOS, the extension uses the system’s built-in Webview component, while on Linux it depends on gtk/webkit2gtk.

With the following configuration and using SPC to build, both cli/micro work perfectly on Windows and macOS.

config
// config/ext.json
{
    // ...
    {
        "webview": {
        "type": "external",
        "source": "webview",
        "frameworks": [
            "WebKit"
        ],
        "cpp-extension": true
    },
    // ...
}
// config/sources.json
{
  // ...
  {
    "type": "git",
    "path": "php-src/ext/webview",
    "rev": "dev",
    "url": "https://github.com/happystraw/php-ext-webview",
    "license": {
      "type": "file",
        "path": "LICENSE"
      }
  }
  // ...
}

However, on Linux, gtk/webkit2gtk is either unsuitable or very difficult to compile as a static library. Currently, SPC uses its own pkg-config tool and restricts the PKG_CONFIG_PATH, so it cannot find the system-level pkg-config file for webkit2gtk, resulting in a build failure.

I would like to ask if there is any way to solve this problem with the current SPC? Or could future versions consider supporting linking to other libraries, such as gtk/webkit2gtk?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions