Lumiera  0.pre.03
»edit your freedom«
Platform.py
1 # coding: utf-8
2 
5 
6 # Copyright (C)
7 # 2012, 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 
16 from SCons.Script import Exit
17 from Buildhelper import isCleanupOperation, isHelpRequest
18 
19 
20 
21 
22 def 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  if not conf.CheckLibWithHeader('m', 'math.h','C'):
39  problems.append('Did not find math.h / libm.')
40 
41  if not conf.CheckLibWithHeader('dl', 'dlfcn.h', 'C'):
42  problems.append('Functions for runtime dynamic loading not available.')
43 
44  if not conf.CheckLibWithHeader('pthread', 'pthread.h', 'C'):
45  problems.append('Did not find the pthread lib or pthread.h.')
46  else:
47  conf.env.Append(CPPFLAGS = ' -DHAVE_PTHREAD')
48  conf.env.Append(CCFLAGS = ' -pthread')
49 
50  if not conf.CheckLib(symbol='clock_gettime', library='rt'): # note librt is usually installed with libc6
51  problems.append('We expect the POSIX realtime extensions to be available through librt. ' +
52  'Unable to use clock_gettime()')
53 
54  if conf.CheckCHeader('execinfo.h'):
55  conf.env.Append(CPPFLAGS = ' -DHAVE_EXECINFO_H')
56 
57  if conf.CheckCHeader('valgrind/valgrind.h'):
58  conf.env.Append(CPPFLAGS = ' -DHAVE_VALGRIND_H')
59  else:
60  print 'Valgrind not found. The use of Valgrind is optional; building without.'
61 
62  if not conf.CheckPkgConfig('nobugmt', 201008.1):
63  problems.append('Did not find NoBug [http://nobug.pipapo.org/].')
64  else:
65  conf.env.mergeConf('nobugmt')
66 
67  if not conf.CheckCXXHeader('memory'):
68  problems.append('We rely on the C++11 smart-pointers.')
69 
70  if not conf.CheckCXXHeader('functional'):
71  problems.append('We rely on the C++11 functor objects.')
72 
73  if not conf.CheckLibWithHeader('stdc++fs', 'filesystem', 'C++'):
74  problems.append('We need the C++17 filesystem support.')
75 
76  if not conf.CheckCXXHeader('boost/config.hpp'):
77  problems.append('We need the C++ boost-libraries.')
78  else:
79  if not conf.CheckCXXHeader('boost/lexical_cast.hpp'):
80  problems.append('We need boost::lexical_cast')
81  if not conf.CheckCXXHeader('boost/format.hpp'):
82  problems.append('We need boost::format (header).')
83  if not conf.CheckLibWithHeader('boost_program_options','boost/program_options.hpp','C++'):
84  problems.append('We need boost::program_options (including binary lib for linking).')
85  if not conf.CheckLibWithHeader('boost_system','boost/system/error_code.hpp','C++'):
86  problems.append('We need the boost::system support library (including binary lib).')
87  if not conf.CheckLibWithHeader('boost_filesystem','boost/filesystem.hpp','C++'):
88  problems.append('We need the boost::filesystem lib (including binary lib for linking).')
89 
90 
91  if not conf.CheckPkgConfig('gavl', '1.4'):
92  problems.append('Did not find Gmerlin Audio Video Lib [http://gmerlin.sourceforge.net/gavl.html].')
93  else:
94  conf.env.mergeConf('gavl')
95 
96  if not conf.CheckPkgConfig('alsa', '1.0.23'):
97  problems.append('Support for ALSA sound output is required')
98 
99  if not conf.CheckPkgConfig('gtkmm-3.0', '3.10'):
100  problems.append('Unable to configure the mm-bindings for GTK-3')
101 
102  if not conf.CheckPkgConfig('glibmm-2.4', '2.39'):
103  problems.append('Unable to configure the mm-bindings for Glib')
104 
105  if not conf.CheckPkgConfig('sigc++-2.0', '2.2.10'):
106  problems.append('Need the signal-slot-binding library SigC++2')
107 
108  if not conf.CheckPkgConfig('glib-2.0', '2.40'):
109  problems.append('Need a suitable Glib version.')
110 
111  if not conf.CheckPkgConfig('gthread-2.0', '2.40'):
112  problems.append('Need gthread support lib for Glib based thread handling.')
113 
114  if not conf.CheckPkgConfig('cairomm-1.0', '1.10'):
115  problems.append('Unable to configure Cairo--')
116 
117  verGDL = '3.8' # lowered requirements to allow building on Ubuntu/Trusty & Mint (was originally '3.12')
118  verGDLmm = '3.7.3'
119  urlGDLmm = 'http://ftp.gnome.org/pub/GNOME/sources/gdlmm/'
120  urlGDLmmDEB = 'http://lumiera.org/debian/'
121  if not conf.CheckPkgConfig('gdl-3.0', verGDL):
122  problems.append('GNOME Docking Library not found. We need at least GDL %s '
123  'and suitable C++ ("mm")-bindings (GDLmm >=%s)' % (verGDL, verGDLmm))
124  if not conf.CheckPkgConfig('gdlmm-3.0', verGDLmm, alias='gdl'):
125  problems.append('We need the C++ bindings for GDL by Fabien Parent: GDLmm >=%s '
126  '(either from GNOME %s or use the debian package from %s)' %
127  (verGDLmm, urlGDLmm, urlGDLmmDEB))
128 
129  if not conf.CheckPkgConfig('librsvg-2.0', '2.30'):
130  problems.append('Need rsvg Library for rendering icons.')
131 
132  if not conf.CheckCHeader(['X11/Xutil.h', 'X11/Xlib.h'],'<>'):
133  problems.append('Xlib.h and Xutil.h required. Please install libx11-dev.')
134 
135  # NOTE the following dependencies where for the video displayer widget.
136  # As of 11/2015 this is broken and disabled. Might be obsolete....
137  if not conf.CheckPkgConfig('xv') : problems.append('Need libXv...')
138  if not conf.CheckPkgConfig('x11') : problems.append('Need X-lib...') # for the xvdisplayer widget
139  if not conf.CheckPkgConfig('xext'): problems.append('Need libXext.')
140 
141 
142  # report missing dependencies
143  if problems:
144  print "*** unable to build due to the following problems:"
145  for isue in problems:
146  print " * %s" % isue
147  print
148  print "build aborted."
149  Exit(1)
150 
151  print "** Gathered Library Info: %s" % conf.env.libInfo.keys()
152 
153 
154  # create new env containing the finished configuration
155  return conf.Finish()
156