You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2014/03/05 23:45:49 UTC
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-@SVN_APR_MAJOR_VERSION@
[aprutil]
type = lib
external-lib = $(SVN_APRUTIL_LIBS)
+pkg-config = apr-util-@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
+ 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
Added: subversion/trunk/build/generator/templates/pkg-config.in.ezt
URL: http://svn.apache.org/viewvc/subversion/trunk/build/generator/templates/pkg-config.in.ezt?rev=1574710&view=auto
==============================================================================
--- subversion/trunk/build/generator/templates/pkg-config.in.ezt (added)
+++ subversion/trunk/build/generator/templates/pkg-config.in.ezt Wed Mar 5 22:45:48 2014
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: [lib_name]
+Description: [lib_desc]
+Version: @PACKAGE_VERSION@
+Required: [for lib_required] [lib_required][end]
+Required.private: [for lib_required_private] [lib_required_private][end]
+Libs: -L${libdir} [for lib_deps] [lib_deps][end]
+Cflags: -I${includedir}
Propchange: subversion/trunk/build/generator/templates/pkg-config.in.ezt
------------------------------------------------------------------------------
svn:eol-style = native
Modified: subversion/trunk/configure.ac
URL: http://svn.apache.org/viewvc/subversion/trunk/configure.ac?rev=1574710&r1=1574709&r2=1574710&view=diff
==============================================================================
--- subversion/trunk/configure.ac (original)
+++ subversion/trunk/configure.ac Wed Mar 5 22:45:48 2014
@@ -109,11 +109,14 @@ if test `expr $apr_version : 2` -ne 0; t
AC_SUBST(SVN_APRUTIL_INCLUDES)
AC_SUBST(SVN_APRUTIL_CONFIG, ["$apu_config"])
AC_SUBST(SVN_APRUTIL_LIBS)
+ SVN_APR_MAJOR_VERSION=2
else
svn_lib_ver=0
APU_VER_REGEXES=["1\.[345]\."]
SVN_LIB_APRUTIL($APU_VER_REGEXES)
+ SVN_APR_MAJOR_VERSION=1
fi
+AC_SUBST(SVN_APR_MAJOR_VERSION)
SVN_LT_SOVERSION="-version-info $svn_lib_ver"
AC_SUBST(SVN_LT_SOVERSION)
AC_DEFINE_UNQUOTED(SVN_SOVERSION, $svn_lib_ver,
@@ -1539,6 +1542,12 @@ AC_CONFIG_COMMANDS([svn_private_config.h
SVN_DB_HEADER="$SVN_DB_HEADER"])
AC_CONFIG_FILES([Makefile])
+# Create pkg-config .pc files from .pc.in files
+for pc_in_file in subversion/libsvn_*/*.pc.in; do
+ pc_file="`echo ${pc_in_file} | $SED -e 's/.in$//'`"
+ AC_CONFIG_FILES([${pc_file}])
+done
+
SVN_CONFIG_SCRIPT(tools/backup/hot-backup.py)
SVN_CONFIG_SCRIPT(tools/hook-scripts/commit-access-control.pl)
SVN_CONFIG_SCRIPT(subversion/bindings/swig/perl/native/Makefile.PL)
Propchange: subversion/trunk/subversion/libsvn_auth_gnome_keyring/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Mar 5 22:45:48 2014
@@ -7,3 +7,5 @@ Release
*~
.*~
libsvn_auth_gnome_keyring.def
+libsvn_auth_gnome_keyring.pc.in
+libsvn_auth_gnome_keyring.pc
Propchange: subversion/trunk/subversion/libsvn_auth_kwallet/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Mar 5 22:45:48 2014
@@ -7,3 +7,5 @@ Release
*~
.*~
libsvn_auth_kwallet.def
+libsvn_auth_kwallet.pc.in
+libsvn_auth_kwallet.pc
Propchange: subversion/trunk/subversion/libsvn_client/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Mar 5 22:45:48 2014
@@ -7,3 +7,5 @@ Release
*~
.*~
libsvn_client.def
+libsvn_client.pc.in
+libsvn_client.pc
Propchange: subversion/trunk/subversion/libsvn_delta/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Mar 5 22:45:48 2014
@@ -7,3 +7,5 @@ Release
*~
.*~
libsvn_delta.def
+libsvn_delta.pc.in
+libsvn_delta.pc
Propchange: subversion/trunk/subversion/libsvn_diff/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Mar 5 22:45:48 2014
@@ -7,4 +7,5 @@ Release
*~
.*~
libsvn_diff.def
-
+libsvn_diff.pc.in
+libsvn_diff.pc
Propchange: subversion/trunk/subversion/libsvn_fs/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Mar 5 22:45:48 2014
@@ -8,4 +8,5 @@ Release
*~
.*~
libsvn_fs.def
-
+libsvn_fs.pc.in
+libsvn_fs.pc
Propchange: subversion/trunk/subversion/libsvn_fs_base/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Mar 5 22:45:48 2014
@@ -7,4 +7,5 @@ Release
*.o
*~
.*~
-
+libsvn_fs_base.pc
+libsvn_fs_base.pc.in
Propchange: subversion/trunk/subversion/libsvn_fs_fs/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Mar 5 22:45:48 2014
@@ -9,3 +9,5 @@ Release
.*~
rep-cache-db.h
revprops-db.h
+libsvn_fs_fs.pc.in
+libsvn_fs_fs.pc
Propchange: subversion/trunk/subversion/libsvn_fs_util/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Mar 5 22:45:48 2014
@@ -7,5 +7,5 @@ Debug
*.o
*~
.*~
-
-
+libsvn_fs_util.pc.in
+libsvn_fs_util.pc
Propchange: subversion/trunk/subversion/libsvn_fs_x/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Mar 5 22:45:48 2014
@@ -9,3 +9,5 @@ Release
.*~
rep-cache-db.h
revprops-db.h
+libsvn_fs_x.pc.in
+libsvn_fs_x.pc
Propchange: subversion/trunk/subversion/libsvn_ra/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Mar 5 22:45:48 2014
@@ -7,3 +7,5 @@ Release
*~
.*~
libsvn_ra.def
+libsvn_ra.pc.in
+libsvn_ra.pc
Propchange: subversion/trunk/subversion/libsvn_ra_local/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Mar 5 22:45:48 2014
@@ -7,4 +7,5 @@ Debug
*.o
*~
.*~
-
+libsvn_ra_local.pc.in
+libsvn_ra_local.pc
Propchange: subversion/trunk/subversion/libsvn_ra_serf/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Mar 5 22:45:48 2014
@@ -1 +1,3 @@
.libs
+libsvn_ra_serf.pc.in
+libsvn_ra_serf.pc
Propchange: subversion/trunk/subversion/libsvn_ra_svn/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Mar 5 22:45:48 2014
@@ -7,3 +7,5 @@ Debug
*.o
*~
.*~
+libsvn_ra_svn.pc.in
+libsvn_ra_svn.pc
Propchange: subversion/trunk/subversion/libsvn_repos/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Mar 5 22:45:48 2014
@@ -8,3 +8,5 @@ Release
*~
.*~
libsvn_repos.def
+libsvn_repos.pc.in
+libsvn_repos.pc
Propchange: subversion/trunk/subversion/libsvn_subr/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Mar 5 22:45:48 2014
@@ -10,3 +10,5 @@ Debug
libsvn_subr.def
internal_statements.h
errorcode.inc
+libsvn_subr.pc.in
+libsvn_subr.pc
Propchange: subversion/trunk/subversion/libsvn_wc/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Mar 5 22:45:48 2014
@@ -9,3 +9,5 @@ Release
libsvn_wc.def
wc-checks.h
wc-queries.h
+libsvn_wc.pc.in
+libsvn_wc.pc
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/libs...
Posted by Branko Čibej <br...@wandisco.com>.
On 05.03.2014 23:45, stsp@apache.org wrote:
> 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).
[...]
> Modified: subversion/trunk/configure.ac
> URL: http://svn.apache.org/viewvc/subversion/trunk/configure.ac?rev=1574710&r1=1574709&r2=1574710&view=diff
> ==============================================================================
> --- subversion/trunk/configure.ac (original)
> +++ subversion/trunk/configure.ac Wed Mar 5 22:45:48 2014
> @@ -109,11 +109,14 @@ if test `expr $apr_version : 2` -ne 0; t
> AC_SUBST(SVN_APRUTIL_INCLUDES)
> AC_SUBST(SVN_APRUTIL_CONFIG, ["$apu_config"])
> AC_SUBST(SVN_APRUTIL_LIBS)
> + SVN_APR_MAJOR_VERSION=2
> else
> svn_lib_ver=0
> APU_VER_REGEXES=["1\.[345]\."]
> SVN_LIB_APRUTIL($APU_VER_REGEXES)
> + SVN_APR_MAJOR_VERSION=1
> fi
> +AC_SUBST(SVN_APR_MAJOR_VERSION)
> SVN_LT_SOVERSION="-version-info $svn_lib_ver"
> AC_SUBST(SVN_LT_SOVERSION)
> AC_DEFINE_UNQUOTED(SVN_SOVERSION, $svn_lib_ver,
> @@ -1539,6 +1542,12 @@ AC_CONFIG_COMMANDS([svn_private_config.h
> SVN_DB_HEADER="$SVN_DB_HEADER"])
> AC_CONFIG_FILES([Makefile])
>
> +# Create pkg-config .pc files from .pc.in files
> +for pc_in_file in subversion/libsvn_*/*.pc.in; do
> + pc_file="`echo ${pc_in_file} | $SED -e 's/.in$//'`"
> + AC_CONFIG_FILES([${pc_file}])
> +done
This breaks out-of-tree builds. Should be looking in $abs_srcdir.
-- Brane
--
Branko Čibej | Director of Subversion
WANdisco // Non-Stop Data
e. brane@wandisco.com