Changes between Version 2 and Version 3 of pm-switch


Ignore:
Timestamp:
Oct 26, 2010 7:48:18 PM (9 years ago)
Author:
tkr
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • pm-switch

    v2 v3  
    126126}}}
    127127
     128== {{{Root/Xxx/xxx.pc.in}}}==
     129
     130This is the template for the pkg-config file that will be produced at configure time. It has a very simple form something like the following.
     131{{{
     132prefix=@prefix@
     133exec_prefix=@exec_prefix@
     134libdir=@libdir@/coin
     135includedir=@includedir@/coin
     136
     137Name: Xxx
     138Description: Xxx does nothing useful
     139Version: @PACKAGE_VERSION@
     140Libs: -L${libdir} -lXxx @XXXLIB_PCLIBS@
     141Cflags: -I${includedir}
     142Requires: @XXXLIB_PCREQUIRES@
     143}}}
     144
     145== {{{Root/Xxx/xxx-uninstalled.pc.in}}}==
     146
     147This the pkg-config file for finding uninstalled versions of a given library built from source. It's almost identical to the above with just a few path differences.
     148{{{
     149prefix=@prefix@
     150libdir=@ABSBUILDDIR@/src
     151includedir=@abs_source_dir@/src
     152
     153Name: Xxx
     154Description: Xxx does nothing useful
     155Version: @PACKAGE_VERSION@
     156Libs: -L${libdir} -lXxx @XXXLIB_PCLIBS@
     157Cflags: -I${includedir} -I@ABSBUILDDIR@/inc
     158Requires: @XXXLIB_PCREQUIRES@
     159}}}
     160
     161== {{{Root/Xxx/src/Makefile.am}}} ==
     162
     163The main difference in the construction of the various {{{Makefile.am}}} files is that not so much work has to be done now to build up the command lines and lists of dependent libraries. This is all done automatically. For each package Yyy defined in {{{configure.ac}}}, there are now two variables: {{{YYY_CFLAGS}}} and {{{YYY_LIBS}}} that hold the command line for compiling individual C and C++ files (i.e., the include paths, etc.) and the link line for linking to dependent libraries, respectively. The situation will be slightly different for each project, but for the most part, we can replace blocks like
     164{{{
     165AM_CPPFLAGS = \
     166        -I`$(CYGPATH_W) $(COINUTILSSRCDIR)/src` \
     167        -I`$(CYGPATH_W) $(COINUTILSOBJDIR)/inc` \
     168        -I`$(CYGPATH_W) $(OSISRCDIR)/src`       \
     169        -I`$(CYGPATH_W) $(OSISRCDIR)/inc`
     170        -I`$(CYGPATH_W) $(CLPSRCDIR)/src` \
     171        -I`$(CYGPATH_W) $(OSISRCDIR)/src/OsiClp`   \
     172        -I`$(CYGPATH_W) $(CLPOBJDIR)/inc`
     173LDADD = $(COINUTILSOBJDIR)/src/libCoinUtils.la    \
     174        $(OSIOBJDIR)/src/libOsi.la    \
     175        $(OSIOBJDIR)/src/OsiClp/libOsiClp.la    \
     176        $(CLPOBJDIR)/src/libClp.la
     177}}}
     178with something simpler like this:
     179{{{
     180AM_CPPFLAGS = $(COINDEPEND_CFLAGS)
     181LDADD = $(COINDEPEND_CFLAGS)
     182}}}
     183Note that the names of the variables correspond exactly to the names given to the libraries and binaries in the third argument {{{AC_COIN_HAS_PACKAGE()}}}, as described in the section on the {{{Root/Xxx/configure.ac}}} file above. Hence, the command {{{AC_COIN_HAS_PACKAGE(CoinDepend, [coinutils = trunk osi = trunk alps = trunk], [XxxLib])}}} will result in the libraries and flags for each of those dependencies being put into variables called {{{XXXLIB_LIBS}}} and {{{XXXLIB_CFLAGS}}} respectively. One curcial difference between these two variables, though, is that the {{{LIBS}}} variable includes secondary and tertiary dependencies, whereas the {{{CFLAGS}}} variable does not. So there's a little more work involved in building up the flags than the libraries. We will try to change this.
     184
     185A final different is that there is no longer any need to use the {{{ADDLIBS}}} variable at all (it is not even defined), as the additional libraries are all included as dependencies when the lists of libraries are built up.
     186
     187== {{{Root/Xxx/test/Makefile.am}}} ==
     188
     189The changes here are similar to those described above.
     190
     191== {{{Root/Xxx/examples}}} ==
     192
     193Again, the main difference here is that one has to build from the new set of variables defined above in linking to the installed libraries. Alternatively, if you would like to check for or assume the presence of pkg-config on the system the examples will be buitl on, the most ideal thing would be to build your example Makefiles to show to use pkg-config, as this is the exact use case we are attempting to support.