Changes between Version 3 and Version 4 of pm-pcfile


Ignore:
Timestamp:
Feb 27, 2011 8:53:09 AM (9 years ago)
Author:
stefan
Comment:

small revision

Legend:

Unmodified
Added
Removed
Modified
  • pm-pcfile

    v3 v4  
    77== Introduction ==
    88
    9 The way it works is that each project provides one or several pkg-config configuration files (so called '''{{{.pc}}} files''') which contain all necessary information to build and link against a particular library, especially compiler flags that specify the location of header files, linker flags that specify location and names of libraries, and a list of dependencies of that this library depends on.
     9The way it works is that each project provides one or several pkg-config configuration files (so called '''{{{.pc}}} files''') which contain all necessary information to build and link against a particular library, especially compiler flags that specify the location of header files, linker flags that specify location and names of libraries, and a list of dependencies of this library.
    1010
    1111For example, the {{{clp.pc}}} file of the Clp library may look like this:
     
    2929
    3030The information from a {{{.pc}}} file can be accessed via the tool {{{pkg-config}}}.
    31 The tool searches the paths given in the '''environment variable {{{PKG_CONFIG_PATH}}}''' for the {{{.pc}}} files that correspond to given package name.[[BR]]
     31The tool searches the paths given in the '''environment variable {{{PKG_CONFIG_PATH}}}''' for the {{{.pc}}} files that correspond to a given package name.[[BR]]
    3232For example, the command
    3333{{{
     
    7575When "{{{make install}}}" is executed, it should be installed together with the {{{Xyz}}} library into the directory {{{$(libdir)/pkgconfig}}} as described [wiki:pm-project-make#TheProjectMainDirectoryMakefile.amFile here].
    7676
    77 == The .pc file an uninstalled COIN-OR project library ==
     77== The .pc file of an uninstalled COIN-OR project library ==
    7878
    79 In the classical setup, a user checks out a COIN-OR base directory of a project with the source of that project ''and all dependencies'', then configures all projects, builds them, and finally installs them.
     79In a classic setup, a user checks out a COIN-OR base directory of a project with the source of that project ''and all dependencies'', then configures all projects, builds them, and finally installs them.
    8080Thus, at the time configure is executed for a project, its dependencies have been configured, but not yet been build and installed.
    8181Therefore, one needs to '''build against an ''uninstalled'' version of a dependency'''.
     
    9999Requires: @XYZLIB_PCREQUIRES@
    100100}}}
    101 In difference to the {{{xyz.pc.in}}} file, the {{{libdir}}} is now not set to the library installation directory {{{@libdir@}}}, but the '''directory where the library is build''': {{{@ABSBUILDDIR@/src}}}. The variable @ABSBUILDDIR@ is automatically setup by configure (in the AC_COIN_FINALIZE macro) to contain the absolute path to the project's build directory.
     101In difference to the {{{xyz.pc.in}}} file, the {{{libdir}}} is now not set to the library installation directory, but to the '''directory where the library is build''': {{{@ABSBUILDDIR@/src}}}. The variable @ABSBUILDDIR@ is automatically setup by configure (in the AC_COIN_FINALIZE macro) to contain the absolute path to the project's build directory.
    102102
    103103In the '''{{{Libs}}} field''', we now do not use {{{-L/-l}}} notation to specify the library path and name, but provide the name of the libraries libtool auxiliary file ({{{.la}}}) with full (absolute) path.
    104104The reason is that this way the value in the {{{Libs}}} field can be used to setup the {{{_DEPENDENCIES}}} variable of a binary in a {{{Makefile.am}}}, see [wiki:pm-source-make#SpecifyingLinkingFlags here].
    105 Since the location of a build library depends on whether a shared or static library is build and since the {{{xyz-uninstalled.pc}}} files are not meant for use outside of COIN-OR, it is ok to specify an {{{.la}}} file here.
     105Since the location of an uninstalled library depends on whether a shared or static library is build and since the {{{xyz-uninstalled.pc}}} files are not meant for use outside of COIN-OR, it is ok to specify an {{{.la}}} file here.
    106106
    107107In the '''{{{Cflags}}} field''', we specify the location of header files before the project is installed.
     
    131131
    132132One requirement when upgrading the build system to use {{{.pc files}}} was that it should still be usable with a basic set of unix tools as before.
    133 I.e., the basic setup where one checks out and builds a project with all its dependencies from source needed to be kept working also if pkg-config is not available or it's use has been disabled by the user ({{{configure --disable-pkg-config}}}).
     133I.e., the classic setup where one checks out and builds a project with all its dependencies from source had to be kept working - also in the case where pkg-config is not available or it's use has been disabled by the user ({{{configure --disable-pkg-config}}}).
    134134
    135135Therefore, the COIN-OR build system contains some '''fallback macros which parse {{{.pc}}} files by simple shell scripting'''.
     
    137137* It is not possible to build against installed versions of other projects, i.e., the macro ignores {{{PKG_CONFIG_PATH}}} and searches only in the configure directories setup by a [wiki:pm-base-config project's base configure file].
    138138
    139 * The syntax in the {{{xyz-uninstalled.pc}}} file that can be processed by the macro may be limited. When the macro wants to retrieve compiler and linker flags, it replaces the string {{{Cflags: }}} and {{{Libs: }}} by an {{{echo}}} command, then eliminates all remaining lines that start with a string of the form {{{[A-Za-z]*:}}}, and finally execute the resulting file as shell script.
     139* The syntax in the {{{xyz-uninstalled.pc}}} file that can be processed by the macro may be limited. (To retrieve compiler and linker flags, the macro replaces the strings {{{Cflags: }}} and {{{Libs: }}} by an {{{echo}}} command, then eliminates all remaining lines that start with a string of the form {{{[A-Za-z]*:}}}, and finally executes the resulting file as shell script.)
    140140
    141141* The Makefiles for examples require the flags to compile and link against the ''installed'' version of a package.
    142142  While in a setup with pkg-config, the .pc files can be processed by pkg-config at the time an example is build, this is not possible in a no-pkg-config setup.
    143   However, since the fallback macro already process {{{xyz-uninstalled.pc}}} files, it has been extended to process also {{{xyz.pc}}} files ''before'' there are installed. This requires that configure writes the {{{xyz.pc}}} files also into the main directory of project xyz.
     143  However, since the fallback macro already process {{{xyz-uninstalled.pc}}} files, it has been extended to process also {{{xyz.pc}}} files ''before'' there are installed. This requires that configure writes the {{{xyz.pc}}} files into the same directory of the {{{xyz-uninstalled.pc}}} files, i.e., the main directory of project xyz.