pkgconf / pkgconf

package compiler and linker metadata toolkit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to encode options with square brackets and double quotes?

madebr opened this issue · comments

For SDL's emscripten audio backend, you need to link the application with -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE=["$autoResumeAudioContext","$dynCall"].
This makes sure these symbols are included in the final javascript bundle.

I'm currently trying to encode this information in sdl3.pc, but am unable to:
pkgconf keeps escaping the [ and ], and removes the double quotes.

Is there a method to pass the string above 1:1 to the linker?

Try '-sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE=["$autoResumeAudioContext","$dynCall"]'.

pkgconf still prints backslashes.
Emscripten expects a pure Python list as argument.

/tmp/dummy.pc

Name: dummy
Description:
Version:
Libs.private: '-sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE=
$ echo $(PKG_CONFIG_PATH=/tmp pkgconf --static --libs dummy)
-sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE=\[\"$autoResumeAudioContext\",\"$dynCall\"\]

In the mean time, we learned about EM_JS_DEPS.
So we (=SDL project) don't need to add these options to sdl3.pc and SDL3Config.cmake anymore.