Added env.InstallBinary wrapper method and made use of it.
This commit is contained in:
parent
ebe1ae2f40
commit
9721409c98
2 changed files with 19 additions and 13 deletions
15
SConstruct
15
SConstruct
|
@ -459,7 +459,7 @@ env.InstallData("datadir", "wesnoth", map(Dir, installable_subs))
|
|||
env.InstallData("docdir", "wesnoth", Dir("doc/manual"))
|
||||
|
||||
# The game and associated resources
|
||||
env.Alias("install-wesnoth", env.InstallWithSuffix(bindir, wesnoth))
|
||||
env.InstallBinary(wesnoth)
|
||||
InstallManpages(env, "wesnoth")
|
||||
if have_client_prereqs and have_X and env["desktop_entry"]:
|
||||
if sys.platform == "darwin":
|
||||
|
@ -473,23 +473,24 @@ env.InstallData("bindir", "pytools", map(lambda tool: os.path.join("data", "tool
|
|||
env.InstallData("python_site_packages_dir", "pytools", map(lambda module: os.path.join("data", "tools", "wesnoth", module), pythonmodules))
|
||||
|
||||
# Wesnoth MP server install
|
||||
install_wesnothd = env.InstallWithSuffix(bindir, wesnothd)
|
||||
env.Alias("install-wesnothd", install_wesnothd)
|
||||
env.InstallBinary(wesnothd)
|
||||
InstallManpages(env, "wesnothd")
|
||||
if not access(fifodir, F_OK):
|
||||
env.AddPostAction(install_wesnothd, [
|
||||
fifodir = env.Command(fifodir, [], [
|
||||
Mkdir(fifodir),
|
||||
Chmod(fifodir, 0700),
|
||||
Action("chown %s:%s %s" %
|
||||
(env["server_uid"], env["server_gid"], fifodir)),
|
||||
])
|
||||
AlwaysBuild(fifodir)
|
||||
env.Alias("install-wesnothd", fifodir)
|
||||
|
||||
# Wesnoth campaign server
|
||||
env.Alias("install-campaignd", env.InstallWithSuffix(bindir, campaignd))
|
||||
env.InstallBinary(campaignd)
|
||||
|
||||
# And the artists' tools
|
||||
env.Alias("install-cutter", env.InstallWithSuffix(bindir, cutter))
|
||||
env.Alias("install-exploder", env.InstallWithSuffix(bindir, exploder))
|
||||
env.InstallBinary(cutter)
|
||||
env.InstallBinary(exploder)
|
||||
|
||||
# Compute things for default install based on which targets have been created.
|
||||
install = env.Alias('install', [])
|
||||
|
|
|
@ -44,11 +44,6 @@ def InstallFilteredHook(target, source, env):
|
|||
shutil.copy2(str(source), target)
|
||||
return None
|
||||
|
||||
def InstallWithSuffix(env, target, source):
|
||||
if not source:
|
||||
return source
|
||||
return env.InstallAs(os.path.join(target, source[0].name + env["program_suffix"]), source)
|
||||
|
||||
from SCons.Action import ActionFactory
|
||||
from shutil import copy2
|
||||
def hard_link(dest, src, symlink = False):
|
||||
|
@ -69,6 +64,16 @@ def hard_link(dest, src, symlink = False):
|
|||
HardLink = ActionFactory(hard_link,
|
||||
lambda dest, src: 'Hardlinking %s to %s' % (src, dest))
|
||||
|
||||
def InstallBinary(env, source):
|
||||
if not source:
|
||||
return source
|
||||
|
||||
binary = source[0].name
|
||||
installdir = env.subst(os.path.join(env["destdir"], env["bindir"].lstrip("/")))
|
||||
env.Alias("install-" + binary,
|
||||
env.InstallAs(os.path.join(installdir, binary + env["program_suffix"]), source)
|
||||
)
|
||||
|
||||
def InstallData(env, datadir, component, source, subdir = ""):
|
||||
installdir = Dir(env.subst(os.path.join(env["destdir"], env[datadir].lstrip("/"), subdir)))
|
||||
sources = map(Entry, Flatten([source]))
|
||||
|
@ -87,7 +92,7 @@ def InstallData(env, datadir, component, source, subdir = ""):
|
|||
def generate(env):
|
||||
#env.AddMethod(InstallWithSuffix)
|
||||
from SCons.Script.SConscript import SConsEnvironment
|
||||
SConsEnvironment.InstallWithSuffix = InstallWithSuffix
|
||||
SConsEnvironment.InstallBinary = InstallBinary
|
||||
SConsEnvironment.InstallData = InstallData
|
||||
|
||||
env.Append(BUILDERS={'InstallFiltered':Builder(action=InstallFilteredHook)})
|
||||
|
|
Loading…
Add table
Reference in a new issue