Lumiera  0.pre.03
»edit your freedom«
Platform.py
1 # -*- python -*-
2 
5 
6 # Copyright (C) Lumiera.org
7 # 2012, Hermann Vosseler <Ichthyostega@web.de>
8 #
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation; either version 2 of
12 # the License, or (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 
23 
24 
25 from SCons.Script import Exit
26 from Buildhelper import isCleanupOperation, isHelpRequest
27 
28 
29 
30 
31 def configure(env):
32  """ locate required libraries.
33  setup platform specific options.
34  Abort build in case of failure.
35  """
36  if isCleanupOperation(env) or isHelpRequest():
37  return env # skip configure in these cases
38 
39  conf = env.Configure()
40  # run all configuration checks in the build environment defined thus far
41 
42  # Perform checks for prerequisites --------------------------------------------
43  problems = []
44  if not conf.TryAction('pkg-config --version > $TARGET')[0]:
45  problems.append('We need pkg-config for including library configurations, exiting.')
46 
47  if not conf.CheckLibWithHeader('m', 'math.h','C'):
48  problems.append('Did not find math.h / libm.')
49 
50  if not conf.CheckLibWithHeader('dl', 'dlfcn.h', 'C'):
51  problems.append('Functions for runtime dynamic loading not available.')
52 
53  if not conf.CheckLibWithHeader('pthread', 'pthread.h', 'C'):
54  problems.append('Did not find the pthread lib or pthread.h.')
55  else:
56  conf.env.Append(CPPFLAGS = ' -DHAVE_PTHREAD')
57  conf.env.Append(CCFLAGS = ' -pthread')
58 
59  if not conf.CheckLib(symbol='clock_gettime', library='rt'): # note librt is usually installed with libc6
60  problems.append('We expect the POSIX realtime extensions to be available through librt. ' +
61  'Unable to use clock_gettime()')
62 
63  if conf.CheckCHeader('execinfo.h'):
64  conf.env.Append(CPPFLAGS = ' -DHAVE_EXECINFO_H')
65 
66  if conf.CheckCHeader('valgrind/valgrind.h'):
67  conf.env.Append(CPPFLAGS = ' -DHAVE_VALGRIND_H')
68  else:
69  print 'Valgrind not found. The use of Valgrind is optional; building without.'
70 
71  if not conf.CheckPkgConfig('nobugmt', 201008.1):
72  problems.append('Did not find NoBug [http://nobug.pipapo.org/].')
73  else:
74  conf.env.mergeConf('nobugmt')
75 
76  if not conf.CheckCXXHeader('memory'):
77  problems.append('We rely on the C++11 smart-pointers.')
78 
79  if not conf.CheckCXXHeader('functional'):
80  problems.append('We rely on the C++11 functor objects.')
81 
82  if not conf.CheckLibWithHeader('stdc++fs', 'filesystem', 'C++'):
83  problems.append('We need the C++17 filesystem support.')
84 
85  if not conf.CheckCXXHeader('boost/config.hpp'):
86  problems.append('We need the C++ boost-libraries.')
87  else:
88  if not conf.CheckCXXHeader('boost/lexical_cast.hpp'):
89  problems.append('We need boost::lexical_cast')
90  if not conf.CheckCXXHeader('boost/format.hpp'):
91  problems.append('We need boost::format (header).')
92  if not conf.CheckLibWithHeader('boost_program_options','boost/program_options.hpp','C++'):
93  problems.append('We need boost::program_options (including binary lib for linking).')
94  if not conf.CheckLibWithHeader('boost_system','boost/system/error_code.hpp','C++'):
95  problems.append('We need the boost::system support library (including binary lib).')
96  if not conf.CheckLibWithHeader('boost_filesystem','boost/filesystem.hpp','C++'):
97  problems.append('We need the boost::filesystem lib (including binary lib for linking).')
98 
99 
100  if not conf.CheckPkgConfig('gavl', '1.4'):
101  problems.append('Did not find Gmerlin Audio Video Lib [http://gmerlin.sourceforge.net/gavl.html].')
102  else:
103  conf.env.mergeConf('gavl')
104 
105  if not conf.CheckPkgConfig('alsa', '1.0.23'):
106  problems.append('Support for ALSA sound output is required')
107 
108  if not conf.CheckPkgConfig('gtkmm-3.0', '3.10'):
109  problems.append('Unable to configure the mm-bindings for GTK-3')
110 
111  if not conf.CheckPkgConfig('glibmm-2.4', '2.39'):
112  problems.append('Unable to configure the mm-bindings for Glib')
113 
114  if not conf.CheckPkgConfig('sigc++-2.0', '2.2.10'):
115  problems.append('Need the signal-slot-binding library SigC++2')
116 
117  if not conf.CheckPkgConfig('glib-2.0', '2.40'):
118  problems.append('Need a suitable Glib version.')
119 
120  if not conf.CheckPkgConfig('gthread-2.0', '2.40'):
121  problems.append('Need gthread support lib for Glib based thread handling.')
122 
123  if not conf.CheckPkgConfig('cairomm-1.0', '1.10'):
124  problems.append('Unable to configure Cairo--')
125 
126  verGDL = '3.8' # lowered requirements to allow building on Ubuntu/Trusty & Mint (was originally '3.12')
127  verGDLmm = '3.7.3'
128  urlGDLmm = 'http://ftp.gnome.org/pub/GNOME/sources/gdlmm/'
129  urlGDLmmDEB = 'http://lumiera.org/debian/'
130  if not conf.CheckPkgConfig('gdl-3.0', verGDL):
131  problems.append('GNOME Docking Library not found. We need at least GDL %s '
132  'and suitable C++ ("mm")-bindings (GDLmm >=%s)' % (verGDL, verGDLmm))
133  if not conf.CheckPkgConfig('gdlmm-3.0', verGDLmm, alias='gdl'):
134  problems.append('We need the C++ bindings for GDL by Fabien Parent: GDLmm >=%s '
135  '(either from GNOME %s or use the debian package from %s)' %
136  (verGDLmm, urlGDLmm, urlGDLmmDEB))
137 
138  if not conf.CheckPkgConfig('librsvg-2.0', '2.30'):
139  problems.append('Need rsvg Library for rendering icons.')
140 
141  if not conf.CheckCHeader(['X11/Xutil.h', 'X11/Xlib.h'],'<>'):
142  problems.append('Xlib.h and Xutil.h required. Please install libx11-dev.')
143 
144  # NOTE the following dependencies where for the video displayer widget.
145  # As of 11/2015 this is broken and disabled. Might be obsolete....
146  if not conf.CheckPkgConfig('xv') : problems.append('Need libXv...')
147  if not conf.CheckPkgConfig('x11') : problems.append('Need X-lib...') # for the xvdisplayer widget
148  if not conf.CheckPkgConfig('xext'): problems.append('Need libXext.')
149 
150 
151  # report missing dependencies
152  if problems:
153  print "*** unable to build due to the following problems:"
154  for isue in problems:
155  print " * %s" % isue
156  print
157  print "build aborted."
158  Exit(1)
159 
160  print "** Gathered Library Info: %s" % conf.env.libInfo.keys()
161 
162 
163  # create new env containing the finished configuration
164  return conf.Finish()
165