[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: svn commit: r1574710 - in /subversion/trunk: ./ build/generator/ build/generator/templates/ subversion/libsvn_auth_gnome_keyring/ subversion/libsvn_auth_kwallet/ subversion/libsvn_client/ subversion/libsvn_delta/ subversion/libsvn_diff/ subversion/lib

From: Bert Huijben <bert_at_qqmail.nl>
Date: Thu, 6 Mar 2014 10:13:52 +0100

> -----Original Message-----
> From: stsp_at_apache.org [mailto:stsp_at_apache.org]
> Sent: woensdag 5 maart 2014 23:46
> To: commits_at_subversion.apache.org
> Subject: svn commit: r1574710 - in /subversion/trunk: ./ build/generator/
> build/generator/templates/ subversion/libsvn_auth_gnome_keyring/
> subversion/libsvn_auth_kwallet/ subversion/libsvn_client/
> subversion/libsvn_delta/ subversion/libsvn_diff/ subversion/libs...
>
> Author: stsp
> Date: Wed Mar 5 22:45:48 2014
> New Revision: 1574710
>
> URL: http://svn.apache.org/r1574710
> Log:
> Kick off work on pkg-config support (issue #738, and also #4435).
>
> pkg-config support allows API consumers on UNIX-like systems to link
> to Subversion libraries without having to manually specify the correct
> set of linker flags, including the particular flags for dependencies
> required by a particular build of Subversion (bdb, serf, etc.).
> pkg-config uses libsvn_foo.pc files which describe the set of flags
> required to link to libsvn_foo.
> See http://www.freedesktop.org/wiki/Software/pkg-config/ for more
> information.
>
> Make gen-make.py produce .pc.in files for all Subversion libraries,
> and make the configure script produce .pc files from these .pc.in files.
> Dependency declarations and linker flags are based on information
> parsed from build.conf.
>
> Dependencies of Subversion which support pkg-config can be marked
> as such in build.conf, allowing pkg-config to resolve them. The
> name of the dependency's pkg-config script has to be specified
> without the .pc extension, e.g.:
>
> [gnome-keyring]
> type = lib
> external-lib = $(SVN_GNOME_KEYRING_LIBS)
> pkg-config = gnome-keyring-1
>
> Dependencies not aware of pkg-config are added to linker flags directly.
>
> To illustrate, the generated libsvn_client.pc file on my system contains:
>
> [[[
> prefix=/home/stsp/svn/prefix/svn-trunk
> exec_prefix=${prefix}
> libdir=${exec_prefix}/lib
> includedir=${prefix}/include
>
> Name: libsvn_client
> Description: Subversion Client Library
> Version: 1.9.0
> Required: apr-1
> Required.private:
> Libs: -L${libdir} -lsvn_wc -lsvn_ra -lsvn_delta -lsvn_diff -lsvn_subr
> Cflags: -I${includedir}
> ]]]
>
> There is no support for optional dependencies between Subversion libraries
> yet, however. For instance, libsvn_client might or might not be linked to
> libsvn_ra_serf. Such dependencies are currently omitted. Also, I'm not
> sure yet what to do in cases where a dependency might be statically or
> dynamically linked, e.g. sqlite.
>
> The .pc files are not being installed yet. I don't want to expose these
> files to systems using pkg-config until all outstanding issues are resolved.
>
> * build/generator/gen_make.py
> (Generator.write): Generate .pc.in files.
> (Generator.write_pkg_config_dot_in_files): New helper function.
>
> * build/generator/templates/pkg-config.in.ezt: New file, the .pc.in template.
>
> * build.conf: apr, apr-util, serf, gnome-keyring, and sqlite support pkg-config.
> There may be others (kwallet?) but I haven't investiged more yet.
> I also haven't checked yet if all versions of these dependencies support
> pkg-config. The most recent versions do support it.
>
> * configure.ac
> (SVN_APR_MAJOR_VERSION): Declare. APR's major version number is
> needed
> to select the correct pkg-config script name (e.g. apr-1 or apr-2).
> Generate .pc files from pc.in files.
>
> * subversion/libsvn_auth_gnome_keyring, subversion/libsvn_auth_kwallet,
> subversion/libsvn_client, subversion/libsvn_delta, subversion/libsvn_diff,
> subversion/libsvn_fs, subversion/libsvn_fs_base, subversion/libsvn_fs_fs,
> subversion/libsvn_fs_util, subversion/libsvn_fs_x, subversion/libsvn_ra,
> subversion/libsvn_ra_local, subversion/libsvn_ra_serf,
> subversion/libsvn_ra_svn, subversion/libsvn_repos,
> subversion/libsvn_subr,
> subversion/libsvn_wc: Ignore generated .pc and .pc.in files.
>
> Added:
> subversion/trunk/build/generator/templates/pkg-config.in.ezt (with
> props)
> Modified:
> subversion/trunk/build.conf
> subversion/trunk/build/generator/gen_make.py
> subversion/trunk/configure.ac
> subversion/trunk/subversion/libsvn_auth_gnome_keyring/ (props
> changed)
> subversion/trunk/subversion/libsvn_auth_kwallet/ (props changed)
> subversion/trunk/subversion/libsvn_client/ (props changed)
> subversion/trunk/subversion/libsvn_delta/ (props changed)
> subversion/trunk/subversion/libsvn_diff/ (props changed)
> subversion/trunk/subversion/libsvn_fs/ (props changed)
> subversion/trunk/subversion/libsvn_fs_base/ (props changed)
> subversion/trunk/subversion/libsvn_fs_fs/ (props changed)
> subversion/trunk/subversion/libsvn_fs_util/ (props changed)
> subversion/trunk/subversion/libsvn_fs_x/ (props changed)
> subversion/trunk/subversion/libsvn_ra/ (props changed)
> subversion/trunk/subversion/libsvn_ra_local/ (props changed)
> subversion/trunk/subversion/libsvn_ra_serf/ (props changed)
> subversion/trunk/subversion/libsvn_ra_svn/ (props changed)
> subversion/trunk/subversion/libsvn_repos/ (props changed)
> subversion/trunk/subversion/libsvn_subr/ (props changed)
> subversion/trunk/subversion/libsvn_wc/ (props changed)
>
> Modified: subversion/trunk/build.conf
> URL:
> http://svn.apache.org/viewvc/subversion/trunk/build.conf?rev=1574710&r1
> =1574709&r2=1574710&view=diff
> ==========================================================
> ====================
> --- subversion/trunk/build.conf (original)
> +++ subversion/trunk/build.conf Wed Mar 5 22:45:48 2014
> @@ -1303,10 +1303,12 @@ testing = skip
> type = lib
> external-lib = $(SVN_APR_LIBS)
> msvc-libs = ws2_32.lib rpcrt4.lib mswsock.lib
> +pkg-config = apr-_at_SVN_APR_MAJOR_VERSION@
>
> [aprutil]
> type = lib
> external-lib = $(SVN_APRUTIL_LIBS)
> +pkg-config = apr-util-_at_SVN_APR_MAJOR_VERSION@
>
> [apriconv]
> type = lib
> @@ -1327,6 +1329,7 @@ external-lib = $(SVN_DB_LIBS)
> [gnome-keyring]
> type = lib
> external-lib = $(SVN_GNOME_KEYRING_LIBS)
> +pkg-config = gnome-keyring-1
>
> [kwallet]
> type = lib
> @@ -1363,10 +1366,14 @@ type = lib
> external-lib = $(SVN_SERF_LIBS)
> libs = apr aprutil openssl xml zlib
> msvc-libs = secur32.lib
> +pkg-config = serf-1
> +pkg-config-private = yes
>
> [sqlite]
> type = lib
> external-lib = $(SVN_SQLITE_LIBS)
> +pkg-config = sqlite3
> +pkg-config-private = yes
>
> [xml]
> type = lib
>
> Modified: subversion/trunk/build/generator/gen_make.py
> URL:
> http://svn.apache.org/viewvc/subversion/trunk/build/generator/gen_make
> .py?rev=1574710&r1=1574709&r2=1574710&view=diff
> ==========================================================
> ====================
> --- subversion/trunk/build/generator/gen_make.py (original)
> +++ subversion/trunk/build/generator/gen_make.py Wed Mar 5 22:45:48
> 2014
> @@ -472,6 +472,8 @@ class Generator(gen_base.GeneratorBase):
>
> self.write_transform_libtool_scripts(install_sources)
>
> + self.write_pkg_config_dot_in_files(install_sources)
> +
> def write_standalone(self):
> """Write autogen-standalone.mk"""
>
> @@ -583,6 +585,64 @@ DIR=`pwd`
> libdep_cache[target_name] = sorted(libs)
> return libdep_cache[target_name]
>
> + def write_pkg_config_dot_in_files(self, install_sources):
> + """Write pkg-config .pc.in files for Subversion libraries."""
> + for target_ob in install_sources:
> + if not (isinstance(target_ob, gen_base.TargetLib) and
> + target_ob.path.startswith('subversion/libsvn_')):
> + continue
> +
> + lib_name = target_ob.name
> + lib_path = self.sections[lib_name].options.get('path')
> + lib_deps = self.sections[lib_name].options.get('libs')
> + lib_desc = self.sections[lib_name].options.get('description')
> + output_path = build_path_join(lib_path, lib_name + '.pc.in')
> + template = ezt.Template(os.path.join('build', 'generator', 'templates',
> + 'pkg-config.in.ezt'),
> + compress_whitespace=False)
> + class _eztdata(object):
> + def __init__(self, **kw):
> + vars(self).update(kw)
> +
> + data = _eztdata(
> + lib_name=lib_name,
> + lib_desc=lib_desc,
> + lib_deps=[],
> + lib_required=[],
> + lib_required_private=[],
> + )
> + for lib_dep in lib_deps.split():
> + if lib_dep == 'apriconv':
> + # apriconv is part of apr-util, skip it
> + continue
> + if lib_dep == 'intl':
> + # this library seems to be used only by the windows build, skip it
> + continue

I would guess this is also used on unix when NLS is enabled?

Or is it assumed that gettext is part of the system libraries?

> + external_lib = self.sections[lib_dep].options.get('external-lib')
> + if external_lib:
> + ### Some of Subversion's internal libraries can appear as external
> + ### libs to handle conditional compilation. Skip these for now.
> + if external_lib in ['$(SVN_RA_LIB_LINK)', '$(SVN_FS_LIB_LINK)']:
> + continue
> + # If the external library is known to support pkg-config,
> + # add it to the Required: or Required.private: section.
> + # Otherwise, add the external library to linker flags.
> + pkg_config = self.sections[lib_dep].options.get('pkg-config')
> + if pkg_config:
> + private = self.sections[lib_dep].options.get('pkg-config-private')
> + if private:
> + data.lib_required_private.append(pkg_config)
> + else:
> + data.lib_required.append(pkg_config)
> + else:
> + # $(EXTERNAL_LIB) -> @EXTERNAL_LIB@
> + data.lib_deps.append('@%s@' % external_lib[2:-1])
> + else:
> + # libsvn_foo -> -lsvn_foo
> + data.lib_deps.append('-l%s' % lib_dep.replace('lib', '', 1))
> +
> + template.generate(open(output_path, 'w'), data)
> +
> class UnknownDependency(Exception):
> "We don't know how to deal with the dependent to link it in."
> pass

        Bert
Received on 2014-03-06 10:14:35 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.