build: pass pkg_config_path to check_cfg() when looking for libndn-cxx

Instead of modifying os.environ

Refs: #5042
Change-Id: If6ac10e5f83a48fa85d9b1dec1a2ae1a59d686ac
diff --git a/.waf-tools/sphinx_build.py b/.waf-tools/sphinx_build.py
index e61da6e..b44a54f 100644
--- a/.waf-tools/sphinx_build.py
+++ b/.waf-tools/sphinx_build.py
@@ -44,28 +44,28 @@
     task.inputs.append(conf)
 
     confdir = conf.parent.abspath()
-    buildername = getattr(self, "builder", "html")
-    srcdir = getattr(self, "srcdir", confdir)
-    outdir = self.path.find_or_declare(getattr(self, "outdir", buildername)).get_bld()
-    doctreedir = getattr(self, "doctreedir", os.path.join(outdir.abspath(), ".doctrees"))
+    buildername = getattr(self, 'builder', 'html')
+    srcdir = getattr(self, 'srcdir', confdir)
+    outdir = self.path.find_or_declare(getattr(self, 'outdir', buildername)).get_bld()
+    doctreedir = getattr(self, 'doctreedir', os.path.join(outdir.abspath(), '.doctrees'))
 
     task.env['BUILDERNAME'] = buildername
     task.env['SRCDIR'] = srcdir
     task.env['DOCTREEDIR'] = doctreedir
     task.env['OUTDIR'] = outdir.abspath()
-    task.env['VERSION'] = "version=%s" % self.VERSION
-    task.env['RELEASE'] = "release=%s" % self.VERSION
+    task.env['VERSION'] = 'version=%s' % self.version
+    task.env['RELEASE'] = 'release=%s' % getattr(self, 'release', self.version)
 
     import imp
     confData = imp.load_source('sphinx_conf', conf.abspath())
 
-    if buildername == "man":
+    if buildername == 'man':
         for i in confData.man_pages:
             target = outdir.find_or_declare('%s.%d' % (i[1], i[4]))
             task.outputs.append(target)
 
             if self.install_path:
-                self.bld.install_files("%s/man%d/" % (self.install_path, i[4]), target)
+                self.bld.install_files('%s/man%d/' % (self.install_path, i[4]), target)
     else:
         task.outputs.append(outdir)
 
diff --git a/PSync.pc.in b/PSync.pc.in
index e72112c..711e4ba 100644
--- a/PSync.pc.in
+++ b/PSync.pc.in
@@ -3,8 +3,7 @@
 includedir=@INCLUDEDIR@
 
 Name: PSync
-Description: PSync library
+Description: NDN PSync library
 Version: @VERSION@
 Libs: -L${libdir} -lPSync
 Cflags: -I${includedir}
-
diff --git a/wscript b/wscript
index 11ae785..8c89ab5 100644
--- a/wscript
+++ b/wscript
@@ -27,9 +27,8 @@
     conf.env.WITH_EXAMPLES = conf.options.with_examples
     conf.env.WITH_TESTS = conf.options.with_tests
 
-    if 'PKG_CONFIG_PATH' not in os.environ:
-        os.environ['PKG_CONFIG_PATH'] = Utils.subst_vars('${LIBDIR}/pkgconfig', conf.env)
-    conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'], uselib_store='NDN_CXX')
+    conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'], uselib_store='NDN_CXX',
+                   pkg_config_path=os.environ.get('PKG_CONFIG_PATH', '%s/pkgconfig' % conf.env.LIBDIR))
 
     boost_libs = ['system', 'iostreams']
     if conf.env.WITH_TESTS:
@@ -56,14 +55,13 @@
     conf.write_config_header('PSync/detail/config.hpp', define_prefix='PSYNC_')
 
 def build(bld):
-    bld.shlib(
-        target='PSync',
-        vnum=VERSION,
-        cnum=VERSION,
-        source=bld.path.ant_glob('PSync/**/*.cpp'),
-        use='BOOST NDN_CXX',
-        includes='.',
-        export_includes='.')
+    bld.shlib(target='PSync',
+              vnum=VERSION,
+              cnum=VERSION,
+              source=bld.path.ant_glob('PSync/**/*.cpp'),
+              use='NDN_CXX BOOST',
+              includes='.',
+              export_includes='.')
 
     if bld.env.WITH_TESTS:
         bld.recurse('tests')
@@ -72,7 +70,8 @@
         bld.recurse('examples')
 
     headers = bld.path.ant_glob('PSync/**/*.hpp')
-    bld.install_files(bld.env['INCLUDEDIR'], headers, relative_trick=True)
+    bld.install_files(bld.env.INCLUDEDIR, headers,
+                      relative_trick=True)
 
     bld.install_files('${INCLUDEDIR}/PSync/detail',
                       bld.path.find_resource('PSync/detail/config.hpp'))
@@ -80,10 +79,8 @@
     bld(features='subst',
         source='PSync.pc.in',
         target='PSync.pc',
-        install_path = '${LIBDIR}/pkgconfig',
-        PREFIX       = bld.env['PREFIX'],
-        INCLUDEDIR   = bld.env['INCLUDEDIR'],
-        VERSION      = VERSION)
+        install_path='${LIBDIR}/pkgconfig',
+        VERSION=VERSION)
 
 def docs(bld):
     from waflib import Options
@@ -121,7 +118,8 @@
         config='docs/conf.py',
         outdir='docs',
         source=bld.path.ant_glob('docs/**/*.rst'),
-        VERSION=VERSION)
+        version=VERSION_BASE,
+        release=VERSION)
 
 def version(ctx):
     # don't execute more than once