allow configuring mandir from commandline.
Autodetect optimal place for man pages if none is specified on command line.
This commit is contained in:
parent
83d466c695
commit
e84e04c307
10
SConstruct
10
SConstruct
|
|
@ -53,6 +53,8 @@ from lamerpack import checkForLamerpack
|
||||||
from debugmode import checkForDebugBuild
|
from debugmode import checkForDebugBuild
|
||||||
from timeout import checkForClientTimeout
|
from timeout import checkForClientTimeout
|
||||||
from relsignals import checkReliableSignals
|
from relsignals import checkReliableSignals
|
||||||
|
from mandir import checkForUserMandir
|
||||||
|
from mandir import autodetectMandir
|
||||||
|
|
||||||
conf = Configure(env,{'checkForCCOption':checkForCCOption,
|
conf = Configure(env,{'checkForCCOption':checkForCCOption,
|
||||||
'MAINTAINER_MODE':checkForMaintainerMode,
|
'MAINTAINER_MODE':checkForMaintainerMode,
|
||||||
|
|
@ -63,7 +65,9 @@ conf = Configure(env,{'checkForCCOption':checkForCCOption,
|
||||||
'checkForLamerPack':checkForLamerpack,
|
'checkForLamerPack':checkForLamerpack,
|
||||||
'checkForDebugBuild':checkForDebugBuild,
|
'checkForDebugBuild':checkForDebugBuild,
|
||||||
'checkForClientTimeout':checkForClientTimeout,
|
'checkForClientTimeout':checkForClientTimeout,
|
||||||
'checkReliableSignals':checkReliableSignals
|
'checkReliableSignals':checkReliableSignals,
|
||||||
|
'checkForUserMandir':checkForUserMandir,
|
||||||
|
'autodetectMandir':autodetectMandir
|
||||||
})
|
})
|
||||||
# check for CC options
|
# check for CC options
|
||||||
for option in Split("""
|
for option in Split("""
|
||||||
|
|
@ -125,6 +129,8 @@ if conf.checkReliableSignals():
|
||||||
conf.checkForLockPrefix()
|
conf.checkForLockPrefix()
|
||||||
PREFIX=conf.checkPrefix(PREFIX)
|
PREFIX=conf.checkPrefix(PREFIX)
|
||||||
conf.env.Append(CPPFLAGS = '-DSYSCONFDIR=\\"'+PREFIX+'/etc\\"')
|
conf.env.Append(CPPFLAGS = '-DSYSCONFDIR=\\"'+PREFIX+'/etc\\"')
|
||||||
|
MANDIR=conf.autodetectMandir(PREFIX)
|
||||||
|
conf.checkForUserMandir(MANDIR)
|
||||||
EFENCE = conf.MAINTAINER_MODE()
|
EFENCE = conf.MAINTAINER_MODE()
|
||||||
if EFENCE == True:
|
if EFENCE == True:
|
||||||
EFENCE=conf.CheckLib("efence","EF_Abort")
|
EFENCE=conf.CheckLib("efence","EF_Abort")
|
||||||
|
|
@ -135,5 +141,5 @@ conf.Finish()
|
||||||
|
|
||||||
env.Append(CPPFLAGS = "-DPACKAGE_VERSION=\\\""+VERSION+"\\\"")
|
env.Append(CPPFLAGS = "-DPACKAGE_VERSION=\\\""+VERSION+"\\\"")
|
||||||
# process build rules
|
# process build rules
|
||||||
Export( Split("env PREFIX"))
|
Export( Split("env PREFIX MANDIR"))
|
||||||
env.SConscript(dirs=Split("doc . bsd_src common server client clients contrib tests man"))
|
env.SConscript(dirs=Split("doc . bsd_src common server client clients contrib tests man"))
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
from os import symlink, unlink
|
from os import symlink, unlink
|
||||||
Import(Split("env PREFIX"))
|
Import(Split("env PREFIX MANDIR"))
|
||||||
|
|
||||||
MANDIR=PREFIX+'/man'
|
|
||||||
|
|
||||||
MAN1=Split("""
|
MAN1=Split("""
|
||||||
fgetcmd.1 fmkdir.1 frmcmd.1 fspd.1
|
fgetcmd.1 fmkdir.1 frmcmd.1 fspd.1
|
||||||
|
|
@ -39,5 +37,3 @@ if 'install' in COMMAND_LINE_TARGETS:
|
||||||
env.Symlink(MANDIR+'/man1/'+pair[1]+'.1.gz',MANDIR+'/man1/'+pair[0]+'.1.gz')
|
env.Symlink(MANDIR+'/man1/'+pair[1]+'.1.gz',MANDIR+'/man1/'+pair[0]+'.1.gz')
|
||||||
|
|
||||||
env.Alias("install",MANDIR)
|
env.Alias("install",MANDIR)
|
||||||
|
|
||||||
Export(Split("MANDIR"))
|
|
||||||
|
|
|
||||||
32
site_scons/mandir.py
Normal file
32
site_scons/mandir.py
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
#
|
||||||
|
# SCons user-supplied mandir configuration
|
||||||
|
#
|
||||||
|
# Version 1.0
|
||||||
|
# 27-Aug-2009
|
||||||
|
#
|
||||||
|
|
||||||
|
from SCons.Script import ARGUMENTS
|
||||||
|
import os.path
|
||||||
|
|
||||||
|
def checkForUserMandir(conf,oldmandir=None):
|
||||||
|
"""Returns mandir specified on command line or oldmandir if none is supplied."""
|
||||||
|
conf.Message("Checking for user supplied mandir... ")
|
||||||
|
lp = ARGUMENTS.get('mandir', 0)
|
||||||
|
if lp:
|
||||||
|
conf.Result(1)
|
||||||
|
return lp
|
||||||
|
else:
|
||||||
|
conf.Result(0)
|
||||||
|
return oldmandir
|
||||||
|
|
||||||
|
def autodetectMandir(conf,prefix):
|
||||||
|
"""Try to autodetect where to put man pages."""
|
||||||
|
SEARCH = [ prefix+'/share/man', prefix+'/man' ]
|
||||||
|
conf.Message("Checking where to install man pages... ")
|
||||||
|
for d in SEARCH:
|
||||||
|
if os.path.isdir(d):
|
||||||
|
conf.Result(d)
|
||||||
|
return d
|
||||||
|
d = prefix + '/man'
|
||||||
|
conf.Result(d)
|
||||||
|
return d
|
||||||
Loading…
Reference in New Issue
Block a user