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)
|
|
|
|
|
|
# 2012, 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'
|
2015-11-02 21:31:01 +01:00
|
|
|
|
VERSION = '0.pre.03'
|
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
|
|
|
|
|
|
buildExe = '#$TARGDIR'
|
|
|
|
|
|
buildLib = '#$TARGDIR/modules'
|
|
|
|
|
|
buildPlug = '#$TARGDIR/modules'
|
Global-Layer-Renaming: fix handling of GuiResources in the build
the new structure causes them now to be installed into $TARGET/stage
which is simply not what I want. I still consider $TARGET/gui the better choice,
since an administrator or packager is not aware of our layer namings.
The existing solution was half baked anyway, it did not really replicate the source tree.
On the other hand, I want to retain the location of the CSS files within the GUI tree,
since I consider it a good practice, to keep "code-like" resources with the actual code,
and not far away in some arcane "data" directory.
No I've noticed, that the env.GuiResource() function is only used once, for this very task.
So, for the time being, we can keep it simple and deditaced to that task, i.e
we pick up all CSS files we find and install it into a single target directory.
NOTE: this issue has brought to my attention two further, completely unrelated issues
* Ticket #1192 (Lumiera hangs on failed GUI start)
* The ProcDispatcher does an idle wait, due to an error in timed-wait implementation
2018-11-16 18:18:33 +01:00
|
|
|
|
buildIcon = '#$TARGDIR/gui/icons' # for IconResource() and IconRender()
|
|
|
|
|
|
buildUIRes = '#$TARGDIR/gui/' # for GuiResource()
|
|
|
|
|
|
buildConf = '#$TARGDIR/config' # for ConfigData()
|
2012-01-09 04:10:00 +01:00
|
|
|
|
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'
|
|
|
|
|
|
|
2012-01-10 05:09:32 +01:00
|
|
|
|
#-------------------------------------------------------Configuration
|
|
|
|
|
|
buildSetup = Record(locals())
|
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)
|
2012-01-10 05:09:32 +01:00
|
|
|
|
Decider('MD5-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')
|
|
|
|
|
|
|
|
|
|
|
|
# setup search path for Lumiera plugins
|
|
|
|
|
|
appendCppDefine(env,'PKGLIBDIR','LUMIERA_PLUGIN_PATH=\\"$PKGLIBDIR/:ORIGIN/modules\\"'
|
2025-06-07 23:59:57 +02:00
|
|
|
|
,'LUMIERA_PLUGIN_PATH=\\"ORIGIN/modules\\"')
|
2012-01-09 04:10:00 +01:00
|
|
|
|
appendCppDefine(env,'PKGDATADIR','LUMIERA_CONFIG_PATH=\\"$PKGLIBDIR/:.\\"'
|
2025-06-07 23:59:57 +02:00
|
|
|
|
,'LUMIERA_CONFIG_PATH=\\"$DESTDIR/share/lumiera/:.\\"')
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|