Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
Platform.py
Go to the documentation of this file.
1# coding: utf-8
2
5
6# Copyright (C)
7# 2012-2025 Hermann Vosseler <Ichthyostega@web.de>
8#
9# **Lumiera** is free software; you can redistribute it and/or modify it
10# under the terms of the GNU General Public License as published by the
11# Free Software Foundation; either version 2 of the License, or (at your
12# option) any later version. See the file COPYING for further details.
13
14
15
16from SCons.Script import Exit
17from Buildhelper import isCleanupOperation, isHelpRequest
18
19
20
21
22def configure(env):
23 """ locate required libraries.
24 setup platform specific options.
25 Abort build in case of failure.
26 """
27 if isCleanupOperation(env) or isHelpRequest():
28 return env # skip configure in these cases
29
30 conf = env.Configure()
31 # run all configuration checks in the build environment defined thus far
32
33 # Perform checks for prerequisites --------------------------------------------
34 problems = []
35 if not conf.TryAction('pkg-config --version > $TARGET')[0]:
36 problems.append('We need pkg-config for including library configurations, exiting.')
37
38 # A special check in case we are compiling with GCC...
39 compiler = env.subst('$CXX')
40 verGCCmin = (14,) # note no trailing zero for version ordering check
41 expectedFeature = 'solid C++23 support'
42 if compiler.startswith("g++"):
43 # verify sufficient compiler version
44 try:
45 import subprocess
46 res = subprocess.check_output([compiler,'-dumpversion'], universal_newlines=True).strip()
47 res = tuple(int(x) for x in res.split('.'))
48 except Exception:
49 res = None
50 #
51 if res and res < verGCCmin:
52 problems.append('The compiler "%s" reports version %s, yet we need at least %s for %s.'
53 % (compiler, res, verGCCmin, expectedFeature))
54
55 if not conf.CheckLibWithHeader('m', 'math.h','C'):
56 problems.append('Did not find math.h / libm.')
57
58 if not conf.CheckLibWithHeader('dl', 'dlfcn.h', 'C'):
59 problems.append('Functions for runtime dynamic loading not available.')
60
61 if not conf.CheckLibWithHeader('pthread', 'pthread.h', 'C'):
62 problems.append('Did not find the pthread lib or pthread.h.')
63 else:
64 conf.env.Append(CPPFLAGS = ' -DHAVE_PTHREAD')
65 conf.env.Append(CCFLAGS = ' -pthread')
66
67 if not conf.CheckLib(symbol='clock_gettime', library='rt'): # note librt is usually installed with libc6
68 problems.append('We expect the POSIX realtime extensions to be available through librt. ' +
69 'Unable to use clock_gettime()')
70
71 if conf.CheckCHeader('execinfo.h'):
72 conf.env.Append(CPPFLAGS = ' -DHAVE_EXECINFO_H')
73
74 if conf.CheckCHeader('valgrind/valgrind.h'):
75 conf.env.Append(CPPFLAGS = ' -DHAVE_VALGRIND_H')
76 else:
77 print('Valgrind not found. The use of Valgrind is optional; building without.')
78
79 if not conf.CheckPkgConfig('nobugmt', 201008.1):
80 problems.append('Did not find NoBug [https://nobug.pipapo.org/].')
81 else:
82 conf.env.mergeConf('nobugmt')
83
84 if not conf.CheckCXXHeader('memory'):
85 problems.append('We rely on the C++11 smart-pointers.')
86
87 if not conf.CheckCXXHeader('functional'):
88 problems.append('We rely on the C++11 functor objects.')
89
90 if not conf.CheckLibWithHeader('stdc++fs', 'filesystem', 'C++'):
91 problems.append('We need the C++17 filesystem support.')
92
93 if not conf.CheckCXXHeader('boost/config.hpp'):
94 problems.append('We need the C++ boost-libraries.')
95 else:
96 if not conf.CheckCXXHeader('boost/lexical_cast.hpp'):
97 problems.append('We need boost::lexical_cast')
98 if not conf.CheckCXXHeader('boost/format.hpp'):
99 problems.append('We need boost::format (header).')
100 if not conf.CheckLibWithHeader('boost_program_options','boost/program_options.hpp','C++'):
101 problems.append('We need boost::program_options (including binary lib for linking).')
102
103
104 if not conf.CheckPkgConfig('gavl', '2.0'):
105 problems.append('Did not find Gmerlin Audio Video Lib [https://github.com/bplaum/gavl].')
106 else:
107 conf.env.mergeConf('gavl')
108
109 if not conf.CheckPkgConfig('alsa', '1.2'):
110 problems.append('Support for ALSA sound output is required')
111
112 if not conf.CheckPkgConfig('gtkmm-3.0', '3.20'):
113 problems.append('Unable to configure the mm-bindings for GTK-3')
114
115 if not conf.CheckPkgConfig('glibmm-2.4', '2.66'):
116 problems.append('Unable to configure the mm-bindings for Glib')
117
118 if not conf.CheckPkgConfig('sigc++-2.0', '2.12'):
119 problems.append('Need the signal-slot-binding library SigC++2')
120
121 if not conf.CheckPkgConfig('glib-2.0', '2.80'):
122 problems.append('Need a suitable Glib version.')
123
124 if not conf.CheckPkgConfig('gthread-2.0', '2.80'):
125 problems.append('Need gthread support lib for Glib based thread handling.')
126
127 if not conf.CheckPkgConfig('cairomm-1.0', '1.14'):
128 problems.append('Unable to configure Cairo--')
129
130 verGDL = '3.40' # now orphaned and thus directly provided from Lumiera.org -> can require latest available
131 verGDLmm = '3.7.3'
132 urlGDLmm = 'git://git.lumiera.org/debian/gdlmm'
133 urlGDLmmDEB = 'http://lumiera.org/debian/'
134 if not conf.CheckPkgConfig('gdl-3.0', verGDL):
135 problems.append('GNOME Docking Library not found. We need at least GDL %s '
136 'and suitable C++ ("mm")-bindings (GDLmm >=%s)' % (verGDL, verGDLmm))
137 if not conf.CheckPkgConfig('gdlmm-3.0', verGDLmm, alias='gdl'):
138 problems.append('We need the C++ bindings for GDL by Fabien Parent: GDLmm >=%s '
139 '(either from %s or use the debian package from %s)' %
140 (verGDLmm, urlGDLmm, urlGDLmmDEB))
141
142 if not conf.CheckPkgConfig('librsvg-2.0', '2.40'):
143 problems.append('Need rsvg Library for rendering icons.')
144
145 if not conf.CheckCHeader(['X11/Xutil.h', 'X11/Xlib.h'],'<>'):
146 problems.append('Xlib.h and Xutil.h required. Please install libx11-dev.')
147
148 # NOTE the following dependencies where for the video displayer widget.
149 # As of 11/2015 this is broken and disabled. Might be obsolete....
150 if not conf.CheckPkgConfig('xv') : problems.append('Need libXv...')
151 if not conf.CheckPkgConfig('x11') : problems.append('Need X-lib...') # for the xvdisplayer widget
152 if not conf.CheckPkgConfig('xext'): problems.append('Need libXext.')
153
154
155 # report missing dependencies
156 if problems:
157 print("*** unable to build due to the following problems:")
158 for isue in problems:
159 print(" * %s" % isue)
160 print("\nbuild aborted.")
161 Exit(1)
162
163 print("** Gathered Library Info: %s" % list(conf.env.libInfo.keys()))
164
165
166 # create new env containing the finished configuration
167 return conf.Finish()
168
configure(env)
locate required libraries.
Definition Platform.py:22