Repository navigation
add pkg-config files for some supported libraries - #2486
Conversation
|
Confession: I have no idea how pkg-config works :) How can we add tests for this? |
|
pkg-config is a pretty simple utility. All it does is look under PKG_CONFIG_PATH for .pc files, and the utility allows you to extract CFLAGS, LFLAGS, name, description, and version number of packages. The most important part of pkg-config is that it allows projects to test if a library is present on a system as well. The "emconfigure pkg-config --list-all" comman allows to list the installed packages and if this command works, this means the test "passes". There is no real failure scenario I can't think of - the only possible issue would be if someone commits a .pc files in another folder (different than system/lib/pkgconfig/), or if the .pc file itself is not formatted properly. These failures would be reflected by the command I mentioned. If you still want a test for this, I could craft a script "requiring" all the packages and error out if a package is not found. Let me know your thoughts. |
|
I see. Well, what about the cflags changes in SDL - how did you arrive at those? Should we test that running SDL code with those works? |
|
The CFLAGS are the ones which are provided by the default pkg-config file I had. These CFLAGS would only impact applications which rely on it, and I doubt any application relies on _GNU_SOURCE and _REENTRANT being set. Nonetheless, I left those flags as is, as I didn't want to break existing stuff (which would have been broken already in Emscripten anyway if they relied on it). |
|
Wait, where is the "default pkg-config file I had" from? |
|
This is the sdl.pc I had present on my system (arch linux). This is the same as Ubuntu. Also, here are some references online (this is normally a file built as part of the library):
As you can see, I just copied the #define's. I didn't include the -I flag or LFLAGS, as these wouldn't work for emscripten. |
|
Ok, cool. |
add pkg-config files for some supported libraries
|
@sronsse does it make sense to add one for freetype ? |
The pkg-config tool is widely used in autotools projects as it allows to automatically get CFLAGS for all libraries needed to be linked. When porting projects using Emscripten, most configure.ac files today need to be changed to remove checks using pkg-config. Applying this patch will allow pkg-config to find libraries and therefore autotools projects will now be able to build from vanilla sources.
Please note that the .pc files I imported have been modified from their original counterparts (Emscripten does not require -l, -I, or -L flags for these).
This can easily be tested by calling "emconfigure pkg-config --list-all". It should list the following libraries at this time: