Skip to content

add pkg-config files for some supported libraries - #2486

Merged
kripken merged 1 commit into
emscripten-core:incomingfrom
sronsse:pkg-config
Jul 11, 2014
Merged

kripken merged 1 commit into
emscripten-core:incomingfrom
sronsse:pkg-config

Conversation

@sronsse

@sronsse sronsse commented Jul 5, 2014

Copy link
Copy Markdown
Contributor

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:

  • egl
  • zlib
  • libpng
  • sdl
  • glesv2

@kripken

kripken commented Jul 7, 2014

Copy link
Copy Markdown
Member

Confession: I have no idea how pkg-config works :)

How can we add tests for this?

@sronsse

sronsse commented Jul 7, 2014

Copy link
Copy Markdown
Contributor Author

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.

@kripken

kripken commented Jul 8, 2014

Copy link
Copy Markdown
Member

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?

@sronsse

sronsse commented Jul 8, 2014

Copy link
Copy Markdown
Contributor Author

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).

@kripken

kripken commented Jul 11, 2014

Copy link
Copy Markdown
Member

Wait, where is the "default pkg-config file I had" from?

@sronsse

sronsse commented Jul 11, 2014

Copy link
Copy Markdown
Contributor Author

@kripken

kripken commented Jul 11, 2014

Copy link
Copy Markdown
Member

Ok, cool.

kripken added a commit that referenced this pull request Jul 11, 2014
add pkg-config files for some supported libraries
@kripken
kripken merged commit 69c2dc2 into emscripten-core:incoming Jul 11, 2014
@clementperon

Copy link
Copy Markdown
Contributor

@sronsse does it make sense to add one for freetype ?

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.

3 participants