native icon indicating copy to clipboard operation
native copied to clipboard

Target-specific user defines?

Open simolus3 opened this issue 3 weeks ago • 1 comments

User defines are typically used to control how a hook compiles native code. Sometimes, one might want to use different options depending on the target operating system or architecture. So it would potentially be helpful to have a unified system for OS or ABI-specific user defines, e.g.

# Expect sqlite3 to be linked statically, except on Android where we should load it.
hooks:
  user_defines:
    sqlite3:
      source: executable
  on_platform:
    - os: android
      user_defines:
        source: system

Of course, hooks could implement a similar mechanism on their own. But given that this could come up frequently, maybe implementing it in hooks_runner would be a more elegant solution.

simolus3 avatar Nov 13 '25 07:11 simolus3

I believe this is a similar ask as:

  • https://github.com/dart-lang/native/issues/2480

And another use case for the

Option 5: Pre-build-hook

which would enable scripting user-defines.

dcharkes avatar Nov 13 '25 21:11 dcharkes