summaryrefslogtreecommitdiff
path: root/buildtools/wafsamba
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-06-24 16:02:43 +1000
committerAndrew Tridgell <tridge@samba.org>2010-06-24 18:46:57 +1000
commitf6e46ee0fba25efecb78412a61270d7e70bb6f7d (patch)
treeeeed6a50e1e421d48fe9a5f1c75cce4786f2d21c /buildtools/wafsamba
parent4cb423f52737d980132709fe63bc3194b9307880 (diff)
downloadsamba-f6e46ee0fba25efecb78412a61270d7e70bb6f7d.tar.gz
samba-f6e46ee0fba25efecb78412a61270d7e70bb6f7d.tar.bz2
samba-f6e46ee0fba25efecb78412a61270d7e70bb6f7d.zip
build: check if the manpages stylesheet is available locally
this avoids trying to fetch the stylesheet from the internet. If we can't process the stylesheet with --nonet at configure time then don't build manpages. Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'buildtools/wafsamba')
-rw-r--r--buildtools/wafsamba/samba_conftests.py36
-rw-r--r--buildtools/wafsamba/wafsamba.py6
2 files changed, 34 insertions, 8 deletions
diff --git a/buildtools/wafsamba/samba_conftests.py b/buildtools/wafsamba/samba_conftests.py
index c95a88791b..c6f8901718 100644
--- a/buildtools/wafsamba/samba_conftests.py
+++ b/buildtools/wafsamba/samba_conftests.py
@@ -242,7 +242,7 @@ WriteMakefile(
@conf
-def CHECK_COMMAND(conf, cmd, msg=None, define=None, on_target=True):
+def CHECK_COMMAND(conf, cmd, msg=None, define=None, on_target=True, boolean=False):
'''run a command and return result'''
if msg is None:
msg = 'Checking %s' % ' '.join(cmd)
@@ -255,10 +255,15 @@ def CHECK_COMMAND(conf, cmd, msg=None, define=None, on_target=True):
except:
conf.COMPOUND_END(False)
return False
- ret = ret.strip()
- conf.COMPOUND_END(ret)
- if define:
- conf.DEFINE(define, ret, quote=True)
+ if boolean:
+ conf.COMPOUND_END('ok')
+ if define:
+ conf.DEFINE(define, '1')
+ else:
+ ret = ret.strip()
+ conf.COMPOUND_END(ret)
+ if define:
+ conf.DEFINE(define, ret, quote=True)
return ret
@@ -304,4 +309,25 @@ def CHECK_INLINE(conf):
conf.COMPOUND_END(i)
return ret
+@conf
+def CHECK_XSLTPROC_MANPAGES(conf):
+ '''check if xsltproc can run with the given stylesheets'''
+
+ stylesheets='http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'
+ if not conf.CONFIG_SET('XSLTPROC'):
+ conf.find_program('xsltproc', var='XSLTPROC')
+ if not conf.CONFIG_SET('XSLTPROC'):
+ return False
+
+ for s in TO_LIST(stylesheets):
+ if not conf.CONFIG_SET('XSLTPROC_%s' % s):
+ ret = conf.CHECK_COMMAND('%s --nonet %s 2> /dev/null' % (conf.env.XSLTPROC, s),
+ msg='Checking for stylesheet %s' % s,
+ define=None, on_target=False,
+ boolean=True)
+ if not ret:
+ return False
+ conf.env['XSLTPROC_%s' % s] = True
+ conf.env['XSLTPROC_MANPAGES'] = True
+ return True
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index a1718d33ba..5ffe4b8f9b 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -213,7 +213,7 @@ def SAMBA_LIBRARY(bld, libname, source,
if pc_files is not None:
bld.PKG_CONFIG_FILES(pc_files, vnum=vnum)
- if manpages is not None and 'XSLTPROC' in bld.env and bld.env['XSLTPROC']:
+ if manpages is not None and 'XSLTPROC_MANPAGES' in bld.env and bld.env['XSLTPROC_MANPAGES']:
bld.MANPAGES(manpages)
@@ -304,7 +304,7 @@ def SAMBA_BINARY(bld, binname, source,
if subsystem_name is not None:
bld.TARGET_ALIAS(subsystem_name, binname)
- if manpages is not None and 'XSLTPROC' in bld.env and bld.env['XSLTPROC']:
+ if manpages is not None and 'XSLTPROC_MANPAGES' in bld.env and bld.env['XSLTPROC_MANPAGES']:
bld.MANPAGES(manpages)
Build.BuildContext.SAMBA_BINARY = SAMBA_BINARY
@@ -873,7 +873,7 @@ def MANPAGES(bld, manpages):
source=source,
target=m,
group='final',
- rule='${XSLTPROC} -o ${TGT} ${MAN_XSL} ${SRC}'
+ rule='${XSLTPROC} -o ${TGT} --nonet ${MAN_XSL} ${SRC}'
)
bld.INSTALL_FILES('${MANDIR}/man%s' % m[-1], m, flat=True)
Build.BuildContext.MANPAGES = MANPAGES