Index: Makefile.in =================================================================== --- Makefile.in (revision 6464) +++ Makefile.in (working copy) @@ -219,14 +219,15 @@ # clean all but bulky test output, returning to before './configure' was run. fast-distclean: fast-clean rm -f Makefile config.cache config.log config.status libtool \ - svn_private_config.h svn-config + svn_private_config.h svn-config pkg-config/*.pc # clean everything out, returning to before './autogen.sh' was run. local-extraclean: local-distclean rm -f build-outputs.mk svn_private_config.h.in configure \ ac-helpers/config.guess ac-helpers/config.sub \ ac-helpers/libtool.m4 ac-helpers/ltconfig \ - ac-helpers/ltmain.sh + ac-helpers/ltmain.sh \ + pkg-config/*.pc.in pkg-config/pkg-config-substs.m4 # clean everything, including test output. local-clean: fast-clean check-clean Index: build.conf =================================================================== --- build.conf (revision 6464) +++ build.conf (working copy) @@ -100,12 +100,14 @@ # Library needed by all subversion clients [libsvn_client] +description = Library needed by all subversion clients type = lib path = subversion/libsvn_client libs = libsvn_wc libsvn_ra libsvn_delta libsvn_diff libsvn_subr $(SVN_APRUTIL_LIBS) $(SVN_APR_LIBS) # Routines for binary diffing and tree-deltas [libsvn_delta] +description = Routines for binary diffing and tree-deltas type = lib install = base-lib path = subversion/libsvn_delta @@ -113,12 +115,14 @@ # Routines for diffing [libsvn_diff] +description = Routines for diffing type = lib path = subversion/libsvn_diff libs = libsvn_subr $(SVN_APRUTIL_LIBS) $(SVN_APR_LIBS) # The repository filesystem library [libsvn_fs] +description = The repository filesystem library type = lib path = subversion/libsvn_fs sources = *.c bdb/*.c util/*.c @@ -127,6 +131,7 @@ # General API for accessing repositories [libsvn_ra] +description = General API for accessing repositories type = lib path = subversion/libsvn_ra # conditionally link in some more libs @@ -160,6 +165,7 @@ # Routines built on top of libsvn_fs [libsvn_repos] +description = Routines built on top of libsvn_fs type = lib path = subversion/libsvn_repos install = fs-lib @@ -167,6 +173,7 @@ # Low-level grab bag of utilities [libsvn_subr] +description = Low-level grab bag of utilities type = lib install = base-lib path = subversion/libsvn_subr @@ -174,6 +181,7 @@ # Working copy management lib [libsvn_wc] +description = Working copy management lib type = lib path = subversion/libsvn_wc libs = libsvn_delta libsvn_subr libsvn_diff $(SVN_APRUTIL_LIBS) $(SVN_APR_LIBS) Index: configure.in =================================================================== --- configure.in (revision 6464) +++ configure.in (working copy) @@ -266,12 +266,12 @@ # Only add *_APACHE_RULE if we also have db, since mod_dav_svn depends on it. INSTALL_STATIC_RULES="install-bin install-docs" -INSTALL_RULES="install-base-lib install-lib install-include install-static" +INSTALL_RULES="install-base-lib install-lib install-include install-pkg-config install-static" BUILD_RULES="base-lib lib bin test" if test "$svn_lib_berkeley_db" = "yes"; then BUILD_RULES="base-lib fs-lib lib bin fs-bin $BUILD_APACHE_RULE test fs-test" INSTALL_STATIC_RULES="install-bin install-fs-bin install-docs" - INSTALL_RULES="install-base-lib install-fs-lib install-lib install-include install-static $INSTALL_APACHE_RULE" + INSTALL_RULES="install-base-lib install-fs-lib install-lib install-include install-pkg-config install-static $INSTALL_APACHE_RULE" FS_TEST_DEPS="\$(FS_TEST_DEPS)" FS_TEST_PROGRAMS="\$(FS_TEST_PROGRAMS)" fi @@ -520,6 +520,7 @@ dnl Final step: create the Makefile ---------------------------- AC_CONFIG_FILES([Makefile]) +sinclude(pkg-config/pkg-config-substs.m4) SVN_CONFIG_SCRIPT(svn-config) SVN_CONFIG_SCRIPT(tools/backup/hot-backup.py) Index: build/generator/gen_pkg_config.py =================================================================== --- build/generator/gen_pkg_config.py (working copy) +++ build/generator/gen_pkg_config.py (working copy) @@ -0,0 +1,99 @@ +# +# gen_pkg_config.py -- generate pkg-config files +# + +# Problems: Too many assumptions and to much ad-hoc substitution to +# get the right libs and includes. + +import os +import sys +import string +import re + +import gen_base + + +class Generator(gen_base.GeneratorBase): + + # We dont use this, but it has to be here, GeneratorBase accesses it. + _extension_map = { + ('exe', 'target'): '$(EXEEXT)', + ('exe', 'object'): '.o', + ('lib', 'target'): '.la', + ('lib', 'object'): '.lo', + } + + # This generator outputs a number of files, so specifying a + # different output filename to gen-make.py doesn't make sense. + def default_output(self, conf_path): + return None + + def write(self, oname): + ac_file = open('pkg-config/pkg-config-substs.m4', 'w') + ac_file.write('dnl Automatically generated, do not edit\n\n' + 'AC_CONFIG_FILES([\n') + + for target in self.graph.get_all_sources(gen_base.DT_INSTALL): + + # We use getattr to get the install type, since some sources are + # not Target subclasses and thus dont have the install + # attribute. + install = getattr(target, 'install', '') + if not install in [ 'fs-lib', 'base-lib', 'lib' ]: + continue + + # Skip past the ra_modules, we only generate a pkg-config file + # for the svn_ra library. + if getattr(target, 'is_ra_module', 0): + continue + + # Strip 'lib' prefix + short_name = target.name[3:] + + ac_file.write('\tpkg-config/%s-%s.pc\n' % (short_name, self.cfg.version)) + f = open('pkg-config/%s-%s.pc.in' % (short_name, self.cfg.version), 'w') + + f.write('# Automatically generated, do not edit\n\n' + 'prefix=@prefix@\n' + 'exec_prefix=@exec_prefix@\n' + 'libdir=@libdir@\n' + 'includedir=@includedir@\n\n' + 'Name: %s\n' + 'Description: %s\n' % (short_name, target.desc)) + + f.write('Requires:') + for src in self.graph.get_sources(gen_base.DT_LINK, target.name): + if isinstance(src, gen_base.TargetLib): + f.write(' %s-%s' % (src.name[3:], self.cfg.version)) + f.write('\n') + + f.write('Version: @PACKAGE_VERSION@\n') + + f.write('Libs: -L${libdir} -l%s-%s' % (short_name, self.cfg.version)) + for src in self.graph.get_sources(gen_base.DT_LINK, target.name): + if isinstance(src, gen_base.ExternalLibrary): + if src.fname == '$(SVN_RA_LIB_LINK)': + continue + elif src.fname == '$(SVN_APRUTIL_LIBS)': + ac_var = '@SVN_APRUTIL_EXPORT_LIBS@' + elif src.fname == '$(SVN_APR_LIBS)': + ac_var = '@SVN_APR_EXPORT_LIBS@' + else: + ac_var = re.sub('\$\((.*)\)', '@\\1@', src.fname) + f.write(' ' + ac_var) + f.write('\n') + + f.write('Cflags: -I${includedir}/subversion-%s' % self.cfg.version) + for src in self.graph.get_sources(gen_base.DT_LINK, target.name): + if isinstance(src, gen_base.ExternalLibrary): + if src.fname == '$(SVN_RA_LIB_LINK)': + continue + ac_var = re.sub('\$\((.*)_LIBS\)', '@\\1_INCLUDES@', src.fname) + f.write(" " + ac_var) + f.write('\n') + f.close() + + ac_file.write('])\n') + ac_file.close() + +### End of file. Index: build/generator/gen_make.py =================================================================== --- build/generator/gen_make.py (revision 6464) +++ build/generator/gen_make.py (working copy) @@ -187,6 +187,25 @@ % (os.path.join('$(top_srcdir)', file), os.path.join(includedir, os.path.basename(file)))) + + # Generate install rules for pkg-config files + pcdir = '$(DESTDIR)$(libdir)/pkgconfig' + self.ofile.write('\ninstall-pkg-config:\n' + '\t$(MKDIR) %s\n' % pcdir) + for target in self.graph.get_all_sources(gen_base.DT_INSTALL): + if not getattr(target, 'install', '') in [ 'fs-lib', 'base-lib', 'lib' ]: + continue + + # Skip past the ra_modules, we only generate a pkg-config file + # for the svn_ra library. + if getattr(target, 'is_ra_module', 0): + continue + + pcfile = '%s-%s.pc' % (target.name[3:], self.cfg.version) + self.ofile.write('\t$(INSTALL_DATA) pkg-config/%s %s/%s\n' + % (pcfile, pcdir, pcfile)) + + self.ofile.write('\n# handy shortcut targets\n') for target in self.graph.get_all_sources(gen_base.DT_INSTALL): if not isinstance(target, gen_base.TargetScript): Index: autogen.sh =================================================================== --- autogen.sh (revision 6464) +++ autogen.sh (working copy) @@ -126,6 +126,14 @@ exit 1 fi +# Create the pkg-config configuration files. +# For info about pkg-config see: +# http://www.freedesktop.org/software/pkgconfig/ + +echo "Creating pkg-config files..." +./gen-make.py -t pkg-config || gen_failed=1 + + # Produce config.h.in # Do this before the automake (automake barfs if the header isn't available). # Do it after the aclocal command -- automake sets up the header to depend Index: gen-make.py =================================================================== --- gen-make.py (revision 6464) +++ gen-make.py (working copy) @@ -27,6 +27,7 @@ 'nmake-vcnet' : ('gen_vcnet_nmake', '### need description'), 'bpr' : ('gen_bcpp_bpr', '### need description'), 'make-bcpp' : ('gen_bcpp_make', '### need description'), + 'pkg-config' : ('gen_pkg_config', 'Generate .pc files for pkg-config'), } def main(fname, gentype, verfname=None, oname=None,