OpenTTD

Tasklist

FS#6614 - Preserve PKG_CONFIG_PATH and PKG_CONFIG_LIBDIR environment variables in config.cache

Attached to Project: OpenTTD
Opened by Grzegorz Duczyński (adf88) - Saturday, 19 August 2017, 19:29 GMT
Last edited by Grzegorz Duczyński (adf88) - Sunday, 27 August 2017, 16:10 GMT
Type Patch
Category Build system
Status Closed
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Preserve PKG_CONFIG_PATH and PKG_CONFIG_LIBDIR environment variables in 'config.cache' file, just like other variables CFLAGS, LDFLGS etc.

OpenTTD almost entirely moved to pkg-config utility for detecting libraries. There are two substantial environment variables that pkg-config use - PKG_CONFIG_PATH and PKG_CONFIG_LIBDIR. They allow to deal with non-standard library locations (useful e.g. when cross-compiling). This patch will cause them to be preserved in 'config.cache' file so they are "visible" when OpenTTD re-configures itself.

Note: libraries that OpenTTD use usually also have this feature in their build systems, probably thanks to the autotools.

In addition, the patch allows these variables to be passed as options to 'configure' script (just like CFLAGS, LDFLGS etc.) e.g.

./configure PKG_CONFIG_PATH=path
./configure --PKG_CONFIG_PATH=path
./configure --PKG-CONFIG-PATH=path
This task depends upon

Closed by  Grzegorz Duczyński (adf88)
Sunday, 27 August 2017, 16:10 GMT
Reason for closing:  Implemented
Additional comments about closing:  In r27902
Comment by Grzegorz Duczyński (adf88) - Saturday, 19 August 2017, 21:08 GMT
Now not joking ;)
Comment by andythenorth (andythenorth) - Thursday, 24 August 2017, 17:08 GMT
Out of interest, tested patch against vanilla OS X compile (r27896).

make clean
./configure
make run

Worked for me. I'm not the right person to comment more ;)
Comment by Grzegorz Duczyński (adf88) - Sunday, 27 August 2017, 08:10 GMT
One of ways to test the patch (without installing libraries in unusual paths):

1.
unset PKG_CONFIG_LIBDIR # make sure it's not set
./configure

This should successfully find all libraries in their default paths (usually in /usr/lib etc.).

2.
export PKG_CONFIG_LIBDIR=/invalidpath
make reconfigure

Searching for libraries will fail without the patch, it should succeed with the patch. The patch should cause 'reconfigure' to ignore current value of PKG_CONFIG_LIBDIR (=/invalidpath) and use one that was set during the first './configure' (it was unset so 'reconfigure' will unset it).

Loading...