X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=scons%2Fgallium.py;h=b216304170f5ebe8c6a175bb36efbe6f18632939;hb=9076e9f3751341063679eb227116060070549a37;hp=6cb20efcbf4b8c997f6020f2cb0d6650d288bcd5;hpb=cbee1bfb34274668a05995b9d4c78ddec9e5ea4c;p=mesa.git diff --git a/scons/gallium.py b/scons/gallium.py index 6cb20efcbf4..b216304170f 100755 --- a/scons/gallium.py +++ b/scons/gallium.py @@ -29,6 +29,7 @@ Frontend-tool for Gallium3D architecture. # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # +from __future__ import print_function import distutils.version import os @@ -131,7 +132,7 @@ def check_cc(env, cc, expr, cpp_opt = '-E'): sys.stdout.write('Checking for %s ... ' % cc) source = tempfile.NamedTemporaryFile(suffix='.c', delete=False) - source.write('#if !(%s)\n#error\n#endif\n' % expr) + source.write(('#if !(%s)\n#error\n#endif\n' % expr).encode()) source.close() # sys.stderr.write('%r %s %s\n' % (env['CC'], cpp_opt, source.name)); @@ -221,10 +222,6 @@ def generate(env): env['suncc'] = env['platform'] == 'sunos' and os.path.basename(env['CC']) == 'cc' env['icc'] = 'icc' == os.path.basename(env['CC']) - if env['msvc'] and env['toolchain'] == 'default' and env['machine'] == 'x86_64': - # MSVC x64 support is broken in earlier versions of scons - env.EnsurePythonVersion(2, 0) - # shortcuts machine = env['machine'] platform = env['platform'] @@ -240,6 +237,9 @@ def generate(env): hosthost_platform = host_platform.system().lower() if hosthost_platform.startswith('cygwin'): hosthost_platform = 'cygwin' + # Avoid spurious crosscompilation in MSYS2 environment. + if hosthost_platform.startswith('mingw'): + hosthost_platform = 'windows' host_machine = os.environ.get('PROCESSOR_ARCHITEW6432', os.environ.get('PROCESSOR_ARCHITECTURE', host_platform.machine())) host_machine = { 'x86': 'x86', @@ -282,7 +282,7 @@ def generate(env): if env['build'] == 'profile': env['debug'] = False env['profile'] = True - if env['build'] in ('release', 'opt'): + if env['build'] == 'release': env['debug'] = False env['profile'] = False @@ -311,7 +311,20 @@ def generate(env): if env.GetOption('num_jobs') <= 1: env.SetOption('num_jobs', num_jobs()) - env.Decider('MD5-timestamp') + # Speed up dependency checking. See + # - https://github.com/SCons/scons/wiki/GoFastButton + # - https://bugs.freedesktop.org/show_bug.cgi?id=109443 + + # Scons version string has consistently been in this format: + # MajorVersion.MinorVersion.Patch[.alpha/beta.yyyymmdd] + # so this formula should cover all versions regardless of type + # stable, alpha or beta. + # For simplicity alpha and beta flags are removed. + + scons_version = distutils.version.StrictVersion('.'.join(SCons.__version__.split('.')[:3])) + if scons_version < distutils.version.StrictVersion('3.0.2') or \ + scons_version > distutils.version.StrictVersion('3.0.4'): + env.Decider('MD5-timestamp') env.SetOption('max_drift', 60) # C preprocessor options @@ -320,7 +333,7 @@ def generate(env): '__STDC_CONSTANT_MACROS', '__STDC_FORMAT_MACROS', '__STDC_LIMIT_MACROS', - 'HAVE_NO_AUTOCONF', + 'HAVE_SCONS', ] if env['build'] in ('debug', 'checked'): cppdefines += ['DEBUG'] @@ -328,8 +341,6 @@ def generate(env): cppdefines += ['NDEBUG'] if env['build'] == 'profile': cppdefines += ['PROFILE'] - if env['build'] in ('opt', 'profile'): - cppdefines += ['VMX86_STATS'] if env['platform'] in ('posix', 'linux', 'freebsd', 'darwin'): cppdefines += [ '_POSIX_SOURCE', @@ -344,6 +355,7 @@ def generate(env): '_DARWIN_C_SOURCE', 'GLX_USE_APPLEGL', 'GLX_DIRECT_RENDERING', + 'BUILDING_MESA', ] else: cppdefines += [ @@ -360,9 +372,23 @@ def generate(env): if check_functions(env, ['strtod_l', 'strtof_l']): cppdefines += ['HAVE_STRTOD_L'] + if check_functions(env, ['random_r']): + cppdefines += ['HAVE_RANDOM_R'] + if check_functions(env, ['timespec_get']): cppdefines += ['HAVE_TIMESPEC_GET'] + if check_header(env, 'sys/shm.h'): + cppdefines += ['HAVE_SYS_SHM_H'] + + #FIXME: we should really be checking for the major()/minor() + # functions/macros in these headers, but check_functions()'s + # SConf.CheckFunc() doesn't seem to support macros. + if check_header(env, 'sys/mkdev.h'): + cppdefines += ['MAJOR_IN_MKDEV'] + if check_header(env, 'sys/sysmacros.h'): + cppdefines += ['MAJOR_IN_SYSMACROS'] + if platform == 'windows': cppdefines += [ 'WIN32', @@ -388,14 +414,8 @@ def generate(env): ] if env['build'] in ('debug', 'checked'): cppdefines += ['_DEBUG'] - if platform == 'windows': - cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_USER'] if env['embedded']: - cppdefines += ['PIPE_SUBSYSTEM_EMBEDDED'] - if env['texture_float']: - print('warning: Floating-point textures enabled.') - print('warning: Please consult docs/patents.txt with your lawyer before building Mesa.') - cppdefines += ['TEXTURE_FLOAT_ENABLED'] + cppdefines += ['EMBEDDED_DEVICE'] env.Append(CPPDEFINES = cppdefines) # C compiler options @@ -464,7 +484,10 @@ def generate(env): '-fmessage-length=0', # be nice to Eclipse ] cflags += [ - '-Wmissing-prototypes', + '-Werror=implicit-function-declaration', + '-Werror=missing-prototypes', + '-Werror=return-type', + '-Werror=incompatible-pointer-types', '-std=gnu99', ] if icc: @@ -484,7 +507,7 @@ def generate(env): ccflags += [ '/O2', # optimize for speed ] - if env['build'] in ('release', 'opt'): + if env['build'] == 'release': if not env['clang']: ccflags += [ '/GL', # enable whole program optimization @@ -595,7 +618,7 @@ def generate(env): shlinkflags += ['-Wl,--enable-stdcall-fixup'] #shlinkflags += ['-Wl,--kill-at'] if msvc: - if env['build'] in ('release', 'opt') and not env['clang']: + if env['build'] == 'release' and not env['clang']: # enable Link-time Code Generation linkflags += ['/LTCG'] env.Append(ARFLAGS = ['/LTCG']) @@ -685,6 +708,18 @@ def generate(env): env.PkgCheckModules('XF86VIDMODE', ['xxf86vm']) env.PkgCheckModules('DRM', ['libdrm >= 2.4.75']) + if not os.path.exists("src/util/format_srgb.c"): + print("Checking for Python Mako module (>= 0.8.0)... ", end='') + try: + import mako + except ImportError: + print("no") + exit(1) + if distutils.version.StrictVersion(mako.__version__) < distutils.version.StrictVersion('0.8.0'): + print("no") + exit(1) + print("yes") + if env['x11']: env.Append(CPPPATH = env['X11_CPPPATH'])