1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

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>
This commit is contained in:
Andrew Tridgell 2010-06-24 16:02:43 +10:00
parent 4cb423f527
commit f6e46ee0fb
2 changed files with 34 additions and 8 deletions

View File

@ -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

View File

@ -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