Page MenuHomeWildfire Games

Use pkg-config instead of hard-coding or library-specific programs
Needs ReviewPublic

Authored by s0600204 on Aug 16 2018, 12:11 AM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Trac Tickets
#5157
Summary

With continued problems in #5157, this time with regards to Slackware Linux, this revision expands on the scope of D1582 and tries to use pkg-config where possible.

For example, the X11 include-paths had been hard-coded as a list of possible locations, some of which existed on some distros, but not on others. This then presented a problem when some of those paths were soft-links to other paths, ie. /usr/X11R6/include is equivalent to /usr/include on Slackware.

As another example, gloox has its own config program: gloox-config. When run with the appropriate argument (--cflags) this was returning /usr/include, a directory that is included by default by gcc anyway and, as mentioned in D1582, a directory that if included too early causes problems.

In both instances, and in fact all instances below, a call to pkg-config has been used instead where possible. Unlike the hard-coding and (most) library-specific programs, pkg-config appears to take into account system headers included by gcc, thus preventing over-inclusion of certain files.

Depends on D1582


An earlier version of this changeset was confirmed to permit successful compilation on Slackware-current by @andy5995 over at #5157

Test Plan
  • As with its dependency D1582, this should be tested on various Linux distros. (And on BSD if anyone uses that...)
  • It should probably be tested on OSX, just to make sure there's been no breakages.
  • It should not need testing on Windows as there is no change to the logic-path used for that system.

Run make clean, update-workspaces.sh, then make in the appropriate folders.

Running clean-workspaces.sh should not be necessary.

Please report linux distro name & version, gcc version, and whether you're using the premake4 or premake5 script.

Diff Detail

Repository
rP 0 A.D. Public Repository
Branch
pkg-config
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 6334
Build 10509: Vulcan BuildJenkins
Build 10508: arc lint + arc unit

Event Timeline

s0600204 created this revision.Aug 16 2018, 12:11 AM
s0600204 created this object with visibility "s0600204".
s0600204 created this object with edit policy "s0600204".
Owners added a subscriber: Restricted Owners Package.Aug 16 2018, 12:11 AM
s0600204 updated this revision to Diff 6855.Aug 16 2018, 6:09 PM
s0600204 edited the summary of this revision. (Show Details)
s0600204 edited the test plan for this revision. (Show Details)
s0600204 changed the visibility from "s0600204" to "Public (No Login Required)".
s0600204 changed the edit policy from "s0600204" to "All Users".

Single-line most of the logic. Add icu support for the heck of it. Add explanatory comment to the wxwidgets section.

Vulcan added a subscriber: Vulcan.Aug 16 2018, 6:10 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/differential/717/display/redirect

(arcanist seems to have lost the ability to apply dependencies before applying dependants.)

andy5995 added a comment.EditedAug 17 2018, 7:40 PM

I applied D1582 and then this patch (@s0600204 said it's dependent on D1582) and I got a complete build on Slackware64-current with gcc 8.2

Also builds on Debian 9 using gcc 6.3

Thanks for confirming that this works. Good to know!

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/differential/718/display/redirect

I tested this patch using Travis..

https://travis-ci.org/andy5995/0ad/builds/417846934

So I can confirm it builds on Ubuntu trusty using gcc 4.8, 5, 6, 7, 8 and clang 5 and 6.

@Itms @s0600204 The ticket where this build failure is reported is on the a23 milestone and I'm not sure if this irrelevant enough to be pushed. There was another bugreport on Nov 20th on the lobby:

Maanyavar: 0ad doesnt work on slackware 14.2

Secondly this is also a gloox premake patch, so this might or might not influence D1654 and vice versa:

gloox has its own config program: gloox-config. When run with the appropriate argument (--cflags) this was returning /usr/include, a directory that is included by default by gcc anyway and, as mentioned in D1582, a directory that if included too early causes problems.

In D1611#66598, @elexis wrote:

Secondly this is also a gloox premake patch, so this might or might not influence D1654 and vice versa:

gloox has its own config program: gloox-config. When run with the appropriate argument (--cflags) this was returning /usr/include, a directory that is included by default by gcc anyway and, as mentioned in D1582, a directory that if included too early causes problems.

They'll no doubt be a merge conflict, but nothing further - the OSX build method continues to use the GLOOX_CONFIG override before and after both this and that patch, so changing other *nix-type systems to use pkg-config in this patch should have no effect on the logic of that patch.