Buildsystem: remove the CCache and DistCC integration (closes: #1438)
Both were added in 12/2008, at a time when the choice of SCons still had to be defended, and neither was ever used in practice. The MD5 based change detection of SCons, in concert with the declarative build dependency tree alleviates the need for "cleaning paranoia" and makes full rebuilds a rare event. Beyond being unused, both tool integrations require to rewrite the `$CXX` construction variable into "wrapper g++", which silently changes what any tool reading the build commands concludes about the compiler in use. That matters for the compilation database, which needs to be added next.
This commit is contained in:
parent
7c35af3717
commit
595bb538be
6 changed files with 28 additions and 162 deletions
|
|
@ -140,39 +140,7 @@ def createPlugins(env, directory, **kw):
|
|||
|
||||
|
||||
|
||||
def checkCommandOption(env, optID, val=None, cmdName=None):
|
||||
""" evaluate and verify an option, which may point at a command.
|
||||
besides specifying a path, the option may read True, yes or 1,
|
||||
denoting that the system default for this command should be used.
|
||||
@return: True, if the key has been expanded and validated,
|
||||
False, if this failed and the key was removed
|
||||
"""
|
||||
if not val:
|
||||
if not env.get(optID): return False
|
||||
else:
|
||||
val = env.get(optID)
|
||||
|
||||
if val=='True' or val=='true' or val=='yes' or val=='1' or val == 1 :
|
||||
if not cmdName:
|
||||
print("WARNING: no default for %s, please specify a full path." % optID)
|
||||
del env[optID]
|
||||
return False
|
||||
else:
|
||||
val = env.WhereIs(cmdName)
|
||||
if not val:
|
||||
print("WARNING: %s not found, please specify a full path" % cmdName)
|
||||
del env[optID]
|
||||
return False
|
||||
|
||||
if not os.path.isfile(val):
|
||||
val = env.WhereIs(val)
|
||||
|
||||
if val and os.path.isfile(val):
|
||||
env[optID] = val
|
||||
return True
|
||||
else:
|
||||
del env[optID]
|
||||
return False
|
||||
# removed 10/2026 : checkCommandOption() "evaluate and verify an option, which may point at a command"
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -44,8 +44,6 @@ class LumieraEnvironment(Environment):
|
|||
self.path = Record (extract_localPathDefs(buildSetup)) # ◁───── e.g. buildExe -> env.path.buildExe
|
||||
self.libInfo = {}
|
||||
self.Tool("BuilderDoxygen")
|
||||
self.Tool("ToolDistCC")
|
||||
self.Tool("ToolCCache")
|
||||
register_LumieraIconBuilder(self)
|
||||
register_LumieraResourceBuilders(self)
|
||||
register_LumieraCustomBuilders(self)
|
||||
|
|
|
|||
|
|
@ -29,8 +29,6 @@ def defineCmdlineVariables(buildVars):
|
|||
('ARCHFLAGS', 'Set architecture-specific compilation flags (passed literally to gcc)','')
|
||||
,('CC', 'Set the C compiler to use.', 'gcc')
|
||||
,('CXX', 'Set the C++ compiler to use.', 'g++')
|
||||
,PathVariable('CCACHE', 'Integrate with CCache', '', PathVariable.PathAccept)
|
||||
,PathVariable('DISTCC', 'Invoke C/C++ compiler commands through DistCC', '', PathVariable.PathAccept)
|
||||
,EnumVariable('BUILDLEVEL', 'NoBug build level for debugging', 'ALPHA', allowed_values=('ALPHA', 'BETA', 'RELEASE'))
|
||||
,BoolVariable('DEBUG', 'Build with debugging information and no optimisations', False)
|
||||
,BoolVariable('OPTIMIZE', 'Build with strong optimisation (-O3)', False)
|
||||
|
|
|
|||
|
|
@ -1,67 +0,0 @@
|
|||
# coding: utf-8
|
||||
##
|
||||
## ToolCCache.py - SCons tool for integrating with CCache compiler cache
|
||||
##
|
||||
|
||||
# Copyright (C) Lumiera.org and FreeOrion.org
|
||||
# 2008, Hermann Vosseler <Ichthyostega@web.de>
|
||||
#
|
||||
# **Lumiera** is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation; either version 2 of the License, or (at your
|
||||
# option) any later version. See the file COPYING for further details.
|
||||
#####################################################################
|
||||
|
||||
# This SCons builder was extracted from http://www.freeorion.org/
|
||||
# FreeOrion is an open-source platform-independent galactic conquest game
|
||||
#
|
||||
# history: 12/2008 adapted for Lumiera build system
|
||||
|
||||
|
||||
import os
|
||||
from Buildhelper import *
|
||||
|
||||
|
||||
def generate(env):
|
||||
""" Modify the environment such as to redirect any
|
||||
C/C++ compiler invocations through CCache, while using
|
||||
CCache config variables found in the os.environment.
|
||||
"""
|
||||
if not exists(env): return
|
||||
|
||||
assert env['CCACHE']
|
||||
if not env['CCACHE'] in env['CC']:
|
||||
env['CC'] = env.subst('$CCACHE $CC')
|
||||
if not env['CCACHE'] in env['CXX']:
|
||||
env['CXX'] = env.subst('$CCACHE $CXX')
|
||||
print(env.subst("* Build using $CCACHE"))
|
||||
|
||||
for i in ['HOME'
|
||||
,'CCACHE_DIR'
|
||||
,'CCACHE_TEMPDIR'
|
||||
,'CCACHE_LOGFILE'
|
||||
,'CCACHE_PATH'
|
||||
,'CCACHE_CC'
|
||||
,'CCACHE_CPP2'
|
||||
,'CCACHE_PREFIX'
|
||||
,'CCACHE_DISABLE'
|
||||
,'CCACHE_READONLY'
|
||||
,'CCACHE_NOSTATS'
|
||||
,'CCACHE_NLEVELS'
|
||||
,'CCACHE_HARDLINK'
|
||||
,'CCACHE_RECACHE'
|
||||
,'CCACHE_UMASK'
|
||||
,'CCACHE_HASHDIR'
|
||||
,'CCACHE_UNIFY'
|
||||
,'CCACHE_EXTENSION'
|
||||
]:
|
||||
if i in os.environ and i not in env:
|
||||
env['ENV'][i] = os.environ[i]
|
||||
|
||||
|
||||
|
||||
def exists(env):
|
||||
""" Ensure CCache is available.
|
||||
"""
|
||||
return checkCommandOption(env, 'CCACHE', cmdName='ccache')
|
||||
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
# coding: utf-8
|
||||
##
|
||||
## ToolDistCC.py - SCons tool for distributed compilation using DistCC
|
||||
##
|
||||
|
||||
# Copyright (C) Lumiera.org and FreeOrion.org
|
||||
# 2008, Hermann Vosseler <Ichthyostega@web.de>
|
||||
#
|
||||
# **Lumiera** is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation; either version 2 of the License, or (at your
|
||||
# option) any later version. See the file COPYING for further details.
|
||||
#####################################################################
|
||||
|
||||
# This SCons builder was extracted from http://www.freeorion.org/
|
||||
# FreeOrion is an open-source platform-independent galactic conquest game
|
||||
#
|
||||
# history: 12/2008 adapted for Lumiera build system
|
||||
|
||||
|
||||
import os
|
||||
from Buildhelper import *
|
||||
|
||||
|
||||
def generate(env):
|
||||
""" Modify the environment such as to redirect any
|
||||
C/C++ compiler invocations through DistCC. Additionally
|
||||
pull in the environment config variables used by DistCC
|
||||
"""
|
||||
if not exists(env): return
|
||||
|
||||
assert env['DISTCC']
|
||||
if not env['DISTCC'] in env['CC']:
|
||||
env['CC'] = env.subst('$DISTCC $CC')
|
||||
if not env['DISTCC'] in env['CXX']:
|
||||
env['CXX'] = env.subst('$DISTCC $CXX')
|
||||
print(env.subst("* Build using $DISTCC"))
|
||||
for i in ['HOME'
|
||||
,'DISTCC_HOSTS'
|
||||
,'DISTCC_VERBOSE'
|
||||
,'DISTCC_FALLBACK'
|
||||
,'DISTCC_LOG'
|
||||
,'DISTCC_MMAP'
|
||||
,'DISTCC_SAVE_TEMPS'
|
||||
,'DISTCC_TCP_CORK'
|
||||
,'DISTCC_SSH'
|
||||
]:
|
||||
if i in os.environ and i not in env:
|
||||
env['ENV'][i] = os.environ[i]
|
||||
|
||||
|
||||
def exists(env):
|
||||
""" Ensure DistCC exists.
|
||||
"""
|
||||
return checkCommandOption(env, 'DISTCC', cmdName='distcc')
|
||||
|
||||
|
|
@ -265,8 +265,33 @@ of the application to be re-built. And of course it means, that you only ever co
|
|||
necessary.
|
||||
|
||||
With SCons, there is no need for the usual ``cleaning paranoia''. Similarly, there is no need
|
||||
for CCache (but using DistCC rocks !). Unfortunately, calculating those MD5 sums requires some
|
||||
time on each build, even if the net result is that nothing will happen at all.
|
||||
for CCache, since the content signatures already prevent any redundant compilation within a
|
||||
working tree. Unfortunately, calculating those MD5 sums requires some time on each build,
|
||||
even if the net result is that nothing will happen at all.
|
||||
|
||||
.CCache and DistCC (removed 10/2026)
|
||||
[NOTE]
|
||||
--
|
||||
Both were supported by the build system from 12/2008 until 10/2026, as options `CCACHE`
|
||||
and `DISTCC`, each redirecting the compiler invocation through a wrapper command.
|
||||
Neither was ever used in practice, and both are considered to be of marginal relevance.
|
||||
|
||||
- *CCache* caches compilation results across working trees and over time. SCons provides a
|
||||
superior solution with content MD5, taking the defined dependency graph into account.
|
||||
CCache would only provide a _secondary, opaque notion_ of ``this is the same compilation'' --
|
||||
and when such a judgement is wrong, the resulting confusion is expensive to diagnose.
|
||||
Furthermore, conditional compilation is also based on the MD5 change detection, and
|
||||
turns out to be highly effective -- to the degree that full rebuilds are rare.
|
||||
- *DistCC* distributes compilation over a network of build hosts. It was added when one
|
||||
contributor had a private build network available; the project has had no such setup for
|
||||
many years. Note also that DistCC needs to ship _preprocessed_ translation units over
|
||||
the wire -- for a template-heavy C++ codebase the payload grows with exactly those
|
||||
units that are slowest, so the benefit is smallest where it would be most welcome.
|
||||
|
||||
Beyond being unused, both carried a concrete liability: each rewrote the `$CXX` construction
|
||||
variable into `wrapper g++` -- a mutation that silently changes what any tool reading the
|
||||
build commands will conclude about the compiler in use.
|
||||
--
|
||||
|
||||
Configuration options
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
Loading…
Reference in a new issue