Copyright: clarify and simplify the file headers
* Lumiera source code always was copyrighted by individual contributors
* there is no entity "Lumiera.org" which holds any copyrights
* Lumiera source code is provided under the GPL Version 2+
== Explanations ==
Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above.
For this to become legally effective, the ''File COPYING in the root directory is sufficient.''
The licensing header in each file is not strictly necessary, yet considered good practice;
attaching a licence notice increases the likeliness that this information is retained
in case someone extracts individual code files. However, it is not by the presence of some
text, that legally binding licensing terms become effective; rather the fact matters that a
given piece of code was provably copyrighted and published under a license. Even reformatting
the code, renaming some variables or deleting parts of the code will not alter this legal
situation, but rather creates a derivative work, which is likewise covered by the GPL!
The most relevant information in the file header is the notice regarding the
time of the first individual copyright claim. By virtue of this initial copyright,
the first author is entitled to choose the terms of licensing. All further
modifications are permitted and covered by the License. The specific wording
or format of the copyright header is not legally relevant, as long as the
intention to publish under the GPL remains clear. The extended wording was
based on a recommendation by the FSF. It can be shortened, because the full terms
of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
|
|
|
|
# coding: utf-8
|
2012-01-09 04:10:00 +01:00
|
|
|
|
##
|
|
|
|
|
|
## Setup.py - SCons build: setup, definitions and compiler flags
|
|
|
|
|
|
##
|
|
|
|
|
|
|
Copyright: clarify and simplify the file headers
* Lumiera source code always was copyrighted by individual contributors
* there is no entity "Lumiera.org" which holds any copyrights
* Lumiera source code is provided under the GPL Version 2+
== Explanations ==
Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above.
For this to become legally effective, the ''File COPYING in the root directory is sufficient.''
The licensing header in each file is not strictly necessary, yet considered good practice;
attaching a licence notice increases the likeliness that this information is retained
in case someone extracts individual code files. However, it is not by the presence of some
text, that legally binding licensing terms become effective; rather the fact matters that a
given piece of code was provably copyrighted and published under a license. Even reformatting
the code, renaming some variables or deleting parts of the code will not alter this legal
situation, but rather creates a derivative work, which is likewise covered by the GPL!
The most relevant information in the file header is the notice regarding the
time of the first individual copyright claim. By virtue of this initial copyright,
the first author is entitled to choose the terms of licensing. All further
modifications are permitted and covered by the License. The specific wording
or format of the copyright header is not legally relevant, as long as the
intention to publish under the GPL remains clear. The extended wording was
based on a recommendation by the FSF. It can be shortened, because the full terms
of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
|
|
|
|
# Copyright (C)
|
2025-11-25 02:14:21 +01:00
|
|
|
|
# 2012-2025 Hermann Vosseler <Ichthyostega@web.de>
|
2012-01-09 04:10:00 +01:00
|
|
|
|
#
|
Copyright: clarify and simplify the file headers
* Lumiera source code always was copyrighted by individual contributors
* there is no entity "Lumiera.org" which holds any copyrights
* Lumiera source code is provided under the GPL Version 2+
== Explanations ==
Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above.
For this to become legally effective, the ''File COPYING in the root directory is sufficient.''
The licensing header in each file is not strictly necessary, yet considered good practice;
attaching a licence notice increases the likeliness that this information is retained
in case someone extracts individual code files. However, it is not by the presence of some
text, that legally binding licensing terms become effective; rather the fact matters that a
given piece of code was provably copyrighted and published under a license. Even reformatting
the code, renaming some variables or deleting parts of the code will not alter this legal
situation, but rather creates a derivative work, which is likewise covered by the GPL!
The most relevant information in the file header is the notice regarding the
time of the first individual copyright claim. By virtue of this initial copyright,
the first author is entitled to choose the terms of licensing. All further
modifications are permitted and covered by the License. The specific wording
or format of the copyright header is not legally relevant, as long as the
intention to publish under the GPL remains clear. The extended wording was
based on a recommendation by the FSF. It can be shortened, because the full terms
of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
|
|
|
|
# **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.
|
2012-01-09 04:10:00 +01:00
|
|
|
|
#####################################################################
|
|
|
|
|
|
|
2012-01-10 05:09:32 +01:00
|
|
|
|
from SCons.Script import EnsurePythonVersion, EnsureSConsVersion, Variables, Decider
|
|
|
|
|
|
|
|
|
|
|
|
from LumieraEnvironment import *
|
|
|
|
|
|
from Buildhelper import *
|
|
|
|
|
|
import Options
|
2012-01-09 04:10:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-01-10 05:09:32 +01:00
|
|
|
|
#-------------------------------------------------------Configuration
|
2012-01-09 04:10:00 +01:00
|
|
|
|
TARGDIR = 'target'
|
2025-07-21 03:23:45 +02:00
|
|
|
|
VERSION = '0.pre.04~rc.1'
|
2012-01-09 04:10:00 +01:00
|
|
|
|
TOOLDIR = './admin/scons' # SCons plugins
|
2025-06-07 23:59:57 +02:00
|
|
|
|
OPTCACHE = 'optcache'
|
2012-01-09 04:10:00 +01:00
|
|
|
|
CUSTOPTFILE = 'custom-options'
|
|
|
|
|
|
|
|
|
|
|
|
# these are accessible via env.path.xxxx
|
2025-11-19 22:40:08 +01:00
|
|
|
|
buildExe = '$TARGDIR'
|
|
|
|
|
|
buildLib = '$TARGDIR/modules'
|
|
|
|
|
|
buildPlug = '$TARGDIR/modules'
|
|
|
|
|
|
buildIcon = '$TARGDIR/gui/icons' # for IconResource() and IconRender()
|
|
|
|
|
|
buildUIRes = '$TARGDIR/gui/' # for GuiResource()
|
|
|
|
|
|
buildConf = '$TARGDIR/config' # for ConfigData()
|
|
|
|
|
|
installExe = '$DESTDIR/lib/lumiera'
|
|
|
|
|
|
installLib = '$DESTDIR/lib/lumiera/modules'
|
|
|
|
|
|
installPlug = '$DESTDIR/lib/lumiera/modules'
|
|
|
|
|
|
installIcon = '$DESTDIR/share/lumiera/icons'
|
|
|
|
|
|
installUIRes = '$DESTDIR/share/lumiera/'
|
|
|
|
|
|
installConf = '$DESTDIR/lib/lumiera/config'
|
|
|
|
|
|
installDoc = '$DESTDIR/share/doc/lumiera/'
|
2012-01-09 04:10:00 +01:00
|
|
|
|
|
2012-01-10 05:09:32 +01:00
|
|
|
|
#-------------------------------------------------------Configuration
|
2025-11-15 19:08:23 +01:00
|
|
|
|
|
2012-01-10 05:09:32 +01:00
|
|
|
|
buildSetup = Record(locals())
|
2025-11-15 19:08:23 +01:00
|
|
|
|
# passed to LumieraEnvironment() -> env.path.xxxx
|
2012-01-09 04:10:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-01-10 05:09:32 +01:00
|
|
|
|
def defineBuildEnvironment():
|
|
|
|
|
|
""" create a custom build environment,
|
|
|
|
|
|
define the basic compiler and linker flags,
|
|
|
|
|
|
define locations in source and target tree,
|
|
|
|
|
|
parse the commandline and pick up options
|
2012-01-09 04:10:00 +01:00
|
|
|
|
"""
|
2013-10-06 05:20:22 +02:00
|
|
|
|
EnsureSConsVersion(2,0)
|
|
|
|
|
|
EnsurePythonVersion(2,6)
|
Build: chase down and solve spurious SVG icon rebuilds
Many years ago, I integrated the IconSvgRenderer (written by Joel Holdsworth)
directly into the SCons build by means of a custom builder with an ''emitter function''.
The build as such works fine and automatically determines which icons can be
generated from a given SVG source. However, those SVG icons tend to be rebuilt
very frequently, even while none of the SVG sources has changed.
Basically this was more of an annoyance, since we have now about 15 icons
and the rendering is really fast ... it is just ugly, especially on
incremental builds (and it could become a problem once we have a
massive amount of graphics to process.
So I took the opportunity to take close look now, since I am doing
uninspiring clean-up work since several weeks now. But that problem
turned out to be quite insidious and hard to spot.
First, AI set me off into a completely wrong angle, since it is ''not''
caused by a missing string representation of the custom Action class.
However, from there I went to watching the target checks with the debugger,
and this eventually got me to realise, that SCons mistakenly detects
a change in the Executor / the Action class.
The root cause is, that we invoke Python code from an external Module,
IconSvgRenderer.py, and this is »materialised« by SCons automatically
into a string representation, which includes memory addresses of functions
in that module. And that yields a signature, that is, quite obviously,
not stable, even while you end up sometimes with loading the code to
the same memory location.
As a solution / workaround, we now subclass the standard implementation
from SCons and override the signature function; instead of fingerprinting
the binary code, we just compute a MD5 over the python source file,
which can be easily achieved with the help of the File-Node from SCons.
Essential resources:
https://scons.org/doc/4.8.0/HTML/scons-user.html#chap-builders-writing
...and the Reference / Manpage of SCons
https://scons.org/doc/4.8.0/HTML/scons-man.html#action_objects
SCons/Action.py
SCons/Node/__init__.py
2025-11-27 02:08:50 +01:00
|
|
|
|
Decider('content-timestamp') # detect changed files by timestamp, then do a MD5
|
2012-01-09 04:10:00 +01:00
|
|
|
|
|
2012-01-10 05:09:32 +01:00
|
|
|
|
buildVars = Variables([OPTCACHE, CUSTOPTFILE])
|
|
|
|
|
|
Options.defineCmdlineVariables(buildVars)
|
|
|
|
|
|
env = LumieraEnvironment(buildSetup, buildVars)
|
2012-01-09 04:10:00 +01:00
|
|
|
|
|
|
|
|
|
|
env.Replace( CPPPATH =["#src"] # used to find includes, "#" means always absolute to build-root
|
|
|
|
|
|
, CPPDEFINES=['LUMIERA_VERSION='+VERSION ] # note: it's a list to append further defines
|
2015-11-03 03:06:24 +01:00
|
|
|
|
, CCFLAGS='-Wall -Wextra -Wformat-security'
|
2025-06-18 16:50:19 +02:00
|
|
|
|
, CXXFLAGS='-std=gnu++23 -Wno-enum-compare'
|
2025-06-07 23:59:57 +02:00
|
|
|
|
, CFLAGS='-std=gnu99'
|
2012-01-09 04:10:00 +01:00
|
|
|
|
)
|
2013-11-02 23:59:13 +01:00
|
|
|
|
env.Append(LINKFLAGS='-Wl,--no-undefined') # require every dependency is given on link, in the right order
|
2025-06-07 23:59:57 +02:00
|
|
|
|
env.Append(LINKFLAGS='-Wl,--as-needed') # by default only link against dependencies actually needed to resolve symbols
|
2012-01-10 05:09:32 +01:00
|
|
|
|
handleVerboseMessages(env)
|
2012-01-09 04:10:00 +01:00
|
|
|
|
handleNoBugSwitches(env)
|
|
|
|
|
|
|
|
|
|
|
|
env.Append(CPPDEFINES = '_GNU_SOURCE')
|
|
|
|
|
|
appendCppDefine(env,'DEBUG','DEBUG', 'NDEBUG')
|
|
|
|
|
|
# appendCppDefine(env,'OPENGL','USE_OPENGL')
|
|
|
|
|
|
appendVal(env,'ARCHFLAGS','CCFLAGS') # for both C and C++
|
|
|
|
|
|
appendVal(env,'OPTIMIZE', 'CCFLAGS', val=' -O3')
|
|
|
|
|
|
appendVal(env,'DEBUG', 'CCFLAGS', val=' -ggdb')
|
|
|
|
|
|
|
2025-11-16 02:09:24 +01:00
|
|
|
|
# NOTE: could define optional copile features here....
|
2012-01-09 04:10:00 +01:00
|
|
|
|
|
2012-01-10 05:09:32 +01:00
|
|
|
|
Options.prepareOptionsHelp(buildVars,env)
|
|
|
|
|
|
buildVars.Save(OPTCACHE, env)
|
2012-01-09 04:10:00 +01:00
|
|
|
|
return env
|
|
|
|
|
|
|
2012-01-10 05:09:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
2012-01-09 04:10:00 +01:00
|
|
|
|
def appendCppDefine(env,var,cppVar, elseVal=''):
|
|
|
|
|
|
if env[var]:
|
|
|
|
|
|
env.Append(CPPDEFINES = env.subst(cppVar) )
|
|
|
|
|
|
elif elseVal:
|
|
|
|
|
|
env.Append(CPPDEFINES = env.subst(elseVal))
|
|
|
|
|
|
|
|
|
|
|
|
def appendVal(env,var,targetVar,val=None):
|
|
|
|
|
|
if env[var]:
|
|
|
|
|
|
env.Append( **{targetVar: env.subst(val) or env[var]})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def handleNoBugSwitches(env):
|
2025-06-07 23:59:57 +02:00
|
|
|
|
""" set the build level for NoBug.
|
2012-01-09 04:10:00 +01:00
|
|
|
|
Release builds imply no DEBUG
|
|
|
|
|
|
whereas ALPHA and BETA require DEBUG
|
|
|
|
|
|
"""
|
|
|
|
|
|
level = env['BUILDLEVEL']
|
|
|
|
|
|
if level in ['ALPHA', 'BETA']:
|
|
|
|
|
|
if not env['DEBUG']:
|
2022-09-05 23:02:29 +02:00
|
|
|
|
print('Warning: NoBug ALPHA or BETA builds requires DEBUG=yes, switching DEBUG on!')
|
2012-01-09 04:10:00 +01:00
|
|
|
|
env.Replace( DEBUG = 1 )
|
|
|
|
|
|
env.Append(CPPDEFINES = 'EBUG_'+level)
|
|
|
|
|
|
elif level == 'RELEASE':
|
|
|
|
|
|
env.Replace( DEBUG = 0 )
|
|
|
|
|
|
|
2012-01-10 05:09:32 +01:00
|
|
|
|
|
2012-01-09 04:10:00 +01:00
|
|
|
|
def handleVerboseMessages(env):
|
|
|
|
|
|
""" toggle verbose build output """
|
|
|
|
|
|
if not env['VERBOSE']:
|
2012-01-09 04:58:21 +01:00
|
|
|
|
# SetOption('silent', True)
|
|
|
|
|
|
env['CCCOMSTR'] = env['SHCCCOMSTR'] = " Compiling $SOURCE"
|
|
|
|
|
|
env['CXXCOMSTR'] = env['SHCXXCOMSTR'] = " Compiling++ $SOURCE"
|
|
|
|
|
|
env['LINKCOMSTR'] = " Linking --> $TARGET"
|
|
|
|
|
|
env['LDMODULECOMSTR'] = " creating module [ $TARGET ]"
|
2012-01-09 04:10:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|