Skip to content

Conversation

@henderkes
Copy link
Collaborator

What does this PR do?

Checklist before merging

If your PR involves the changes mentioned below and completed the action, please tick the corresponding option.
If a modification is not involved, please skip it directly.

  • If you modified *.php or *.json, run them locally to ensure your changes are valid:
    • composer cs-fix
    • composer analyse
    • composer test
    • bin/spc dev:sort-config
  • If it's an extension or dependency update, please ensure the following:
    • Add your test combination to src/globals/test-extensions.php.
    • If adding new or fixing bugs, add commit message containing extension test or test extensions to trigger full test suite.

@henderkes henderkes marked this pull request as ready for review August 27, 2025 09:27
@henderkes henderkes requested a review from crazywhalecc August 27, 2025 09:27
@crazywhalecc
Copy link
Owner

crazywhalecc commented Aug 31, 2025

Building in pkg is not recommended if not necessary. Generally, the build things should be library type.

Because we already support building from source and releasing weekly, there's no need to modify existing code. Simply modify the dependencies and install the package in Doctor with one click.

# Conflicts:
#	src/globals/test-extensions.php
@henderkes
Copy link
Collaborator Author

We're keeping it in lib.json and in unix/library/pkgconfig too? What's the point in erroring out if it's not found then?

@crazywhalecc
Copy link
Owner

We're keeping it in lib.json and in unix/library/pkgconfig too?

Yeah, since we still need a location to build own pkg-config, I think the best option is to keep the current state. But for backward compatibility and to achieve this (avoid building pkg-config every time), downloading our existing pre-built content is decent.

What's the point in erroring out if it's not found then?

You mean auto-fix in afterInit?

@crazywhalecc crazywhalecc changed the title turn pkg-config into a package instead of a library turn pkg-config into a package Aug 31, 2025
if (($found = PkgConfigUtil::findPkgConfig()) === null) {
throw new WrongUsageException('Cannot find pkg-config executable. Please run `doctor` to fix this.');
}
GlobalEnvManager::putenv("PKG_CONFIG={$found}");
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes here, when it's still a library it could be automatically built if someone forgot to build it with the doctor fix.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't recommend building libraries in pkg; they should simply involve downloading and installing whenever possible.

As for the "auto-repair if pkg-config not found" in afterInit in GlobalEnv, I don't think it should be downloaded here, at least for now. People should run bin/spc doctor in new environments anyway.

But I think we could package the pkg-config prebuilt binary into a single spc file, automatically extracting it to pkgroot/bin if it's not found there. And then do this in the setup-runtime method, since it's always required to be installed.

@henderkes henderkes merged commit 5583677 into main Aug 31, 2025
33 checks passed
@henderkes henderkes deleted the pkg-config-pkg branch August 31, 2025 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants