2
0
mirror of https://frontier.innolan.net/github/amigaos-cross-toolchain6.git synced 2024-10-19 10:29:55 +00:00

Verify prerequisites

This commit is contained in:
leffmann
2016-01-18 19:14:54 +01:00
parent 0af4d2589f
commit a2ff468955
2 changed files with 33 additions and 2 deletions

View File

@ -3,7 +3,7 @@
from fnmatch import fnmatch from fnmatch import fnmatch
from glob import glob from glob import glob
from logging import debug, info, error from logging import debug, info, error
from os import path from os import path, environ
import contextlib import contextlib
import distutils.spawn import distutils.spawn
import os import os
@ -450,8 +450,31 @@ def make(name, target=None, **makevars):
execute('make', *args) execute('make', *args)
def require_header(header, symbol = False, value = False):
debug('require_header "%s"', header)
cmd = environ['CC'].split() + ['-fsyntax-only', '-x', 'c', '-']
proc = subprocess.Popen(cmd, stdin = subprocess.PIPE, env = environ)
stdin_line = '#include ' + header
if symbol:
if value:
stdin_line += """\n#if %s != %s
#error
#endif """ % (symbol, value)
else:
stdin_line += """\n#ifndef %s
#error
#endif """ % (symbol)
proc.communicate(stdin_line)
proc.wait()
if proc.returncode != 0:
panic('require_header "%s" failed', header)
__all__ = ['setvar', 'panic', 'cmpver', 'find_executable', 'chmod', 'execute', __all__ = ['setvar', 'panic', 'cmpver', 'find_executable', 'chmod', 'execute',
'rmtree', 'mkdir', 'copy', 'copytree', 'unarc', 'fetch', 'cwd', 'rmtree', 'mkdir', 'copy', 'copytree', 'unarc', 'fetch', 'cwd',
'symlink', 'remove', 'move', 'find', 'textfile', 'env', 'path', 'symlink', 'remove', 'move', 'find', 'textfile', 'env', 'path',
'add_site_dir', 'python_setup', 'recipe', 'unpack', 'patch', 'add_site_dir', 'python_setup', 'recipe', 'unpack', 'patch',
'configure', 'make'] 'configure', 'make', 'require_header']

View File

@ -241,6 +241,14 @@ def build():
path.join('{host}', 'bin'), path.join('{host}', 'bin'),
environ['PATH']]) environ['PATH']])
"""
When we have a working compiler in our path, we can also check if the
required headers/libraries are present.
"""
require_header('<python2.7/python.h>')
require_header('<ncurses.h>', symbol = 'NCURSES_VERSION_MAJOR', value = 5)
unpack('{m4}') unpack('{m4}')
configure('{m4}', '--prefix={host}') configure('{m4}', '--prefix={host}')
make('{m4}') make('{m4}')