Skip to content

Replace $(shell) with portable $(python)#22

Merged
jserv merged 1 commit intomainfrom
portable-kconfig
Mar 1, 2026
Merged

Replace $(shell) with portable $(python)#22
jserv merged 1 commit intomainfrom
portable-kconfig

Conversation

@jserv
Copy link
Contributor

@jserv jserv commented Mar 1, 2026

This migrates all $(shell,...) preprocessor calls in the toolchain detection section to portable $(python,...) built-in from Kconfiglib, eliminating POSIX shell dependency (2>/dev/null, ||, &&) and enables Windows-compatible builds.

  • CC_IS_EMCC/CLANG/GCC: use run() with sys.executable for shell-free subprocess execution under the same Python interpreter
  • COMPILER_TYPE: derive from CC_IS_* booleans via conditional defaults, eliminating a redundant subprocess call entirely
  • HAVE_EMCC: use in-process shutil.which() with no subprocess
  • HAVE_SDL2: guard with shutil.which('pkg-config') to silently return n when pkg-config is absent, then run() for the check

Summary by cubic

Replaced all $(shell,...) calls in toolchain detection with Kconfiglib’s $(python,...) to remove the POSIX shell dependency and enable Windows builds. Simplified compiler type and dependency checks.

  • Refactors
    • CC_IS_EMCC/CLANG/GCC use run(sys.executable, ...) for shell-free checks.
    • COMPILER_TYPE is derived from CC_IS_* via conditional defaults.
    • HAVE_EMCC uses shutil.which('emcc'); HAVE_SDL2 guards with shutil.which('pkg-config') then runs the pkg-config check.

Written for commit 8615a31. Summary will update on new commits.

This migrates all $(shell,...) preprocessor calls in the toolchain
detection section to portable $(python,...) built-in from Kconfiglib,
eliminating POSIX shell dependency (2>/dev/null, ||, &&) and enables
Windows-compatible builds.
- CC_IS_EMCC/CLANG/GCC: use run() with sys.executable for shell-free
  subprocess execution under the same Python interpreter
- COMPILER_TYPE: derive from CC_IS_* booleans via conditional
  defaults, eliminating a redundant subprocess call entirely
- HAVE_EMCC: use in-process shutil.which() with no subprocess
- HAVE_SDL2: guard with shutil.which('pkg-config') to silently
  return n when pkg-config is absent, then run() for the check
@jserv jserv merged commit ee80bf1 into main Mar 1, 2026
11 checks passed
@jserv jserv deleted the portable-kconfig branch March 1, 2026 04:20
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

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.

1 participant