mirror of
https://github.com/cahirwpz/amigaos-cross-toolchain
synced 2025-11-21 10:15:10 +00:00
Close #23
This commit is contained in:
34
common.py
34
common.py
@ -451,34 +451,30 @@ def make(name, target=None, **makevars):
|
||||
execute('make', *args)
|
||||
|
||||
|
||||
def require_header(header, lang, msg = '', symbol = False, value = False):
|
||||
def require_header(header, lang, msg='', symbol=None, value=None):
|
||||
debug('require_header "%s"', header)
|
||||
|
||||
cmd = {'c':'{cc}', 'c++':'{cxx}'}[lang]
|
||||
cmd = fill_in(cmd).split() + ['-fsyntax-only', '-x', lang, '-']
|
||||
proc = subprocess.Popen(cmd, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
|
||||
cmd = {'c': '{cc}', 'c++': '{cxx}'}[lang]
|
||||
cmd = fill_in(cmd).split()
|
||||
proc = subprocess.Popen(cmd + ['-fsyntax-only', '-x', lang, '-'],
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
|
||||
stdin_line = '#include <' + header + '>'
|
||||
proc_stdin = ['#include <%s>' % header]
|
||||
if symbol:
|
||||
if value:
|
||||
stdin_line += """\n#if %s != %s
|
||||
#error
|
||||
#endif """ % (symbol, value)
|
||||
proc_stdin.append("#if %s != %s" % (symbol, value))
|
||||
else:
|
||||
stdin_line += """\n#ifndef %s
|
||||
#error
|
||||
#endif """ % (symbol)
|
||||
proc_stdin.append("#ifndef %s" % symbol)
|
||||
proc_stdin.append("#error")
|
||||
proc_stdin.append("#endif")
|
||||
|
||||
(result_stdout, result_stderr) = proc.communicate(stdin_line)
|
||||
proc_stdout, proc_stderr = proc.communicate('\n'.join(proc_stdin))
|
||||
proc.wait()
|
||||
|
||||
cmd = ' '.join(cmd)
|
||||
|
||||
if proc.returncode == 0:
|
||||
debug('output from "%s":\n%s', cmd, result_stdout)
|
||||
else:
|
||||
debug('error output from "%s":\n%s', cmd, result_stderr)
|
||||
panic('require_header failed: %s', msg)
|
||||
if proc.returncode:
|
||||
panic(msg)
|
||||
|
||||
|
||||
__all__ = ['setvar', 'panic', 'cmpver', 'find_executable', 'chmod', 'execute',
|
||||
|
||||
@ -197,12 +197,6 @@ def build():
|
||||
environ['LANG'] = 'C'
|
||||
environ['TERM'] = 'xterm'
|
||||
|
||||
find_executable('perl')
|
||||
find_executable('patch')
|
||||
find_executable('make')
|
||||
find_executable('git')
|
||||
find_executable('yacc')
|
||||
|
||||
with cwd('{archives}'):
|
||||
for url in URLS:
|
||||
if type(url) == tuple:
|
||||
@ -211,9 +205,6 @@ def build():
|
||||
name = path.basename(url)
|
||||
fetch(name, url)
|
||||
|
||||
unpack('python-lha', work_dir='{build}')
|
||||
python_setup('python-lha')
|
||||
|
||||
add_site_dir('{host}')
|
||||
|
||||
"""
|
||||
@ -241,14 +232,29 @@ def build():
|
||||
path.join('{host}', 'bin'),
|
||||
environ['PATH']])
|
||||
|
||||
setvar(cc = environ['CC'], cxx = environ['CXX'])
|
||||
setvar(cc=environ['CC'], cxx=environ['CXX'])
|
||||
|
||||
"""
|
||||
When we have a working compiler in our path, we can also check if the
|
||||
required headers/libraries are present.
|
||||
When we have a working compiler in our path, we shoule also check if the
|
||||
required programs, headers and libraries are present.
|
||||
"""
|
||||
|
||||
require_header('ncurses.h', 'c', 'libncurses-dev 5.x missing', 'NCURSES_VERSION_MAJOR', 5)
|
||||
find_executable('perl')
|
||||
find_executable('patch')
|
||||
find_executable('make')
|
||||
find_executable('git')
|
||||
find_executable('yacc')
|
||||
|
||||
require_header('ncurses.h', 'c', 'libncurses5-dev package missing',
|
||||
'NCURSES_VERSION_MAJOR', 5)
|
||||
|
||||
py_ver = 'python%d.%d' % (sys.version_info.major, sys.version_info.minor)
|
||||
|
||||
require_header(path.join(py_ver, 'Python.h'), 'c',
|
||||
'python-dev package missing')
|
||||
|
||||
unpack('python-lha', work_dir='{build}')
|
||||
python_setup('python-lha')
|
||||
|
||||
unpack('{m4}')
|
||||
configure('{m4}', '--prefix={host}')
|
||||
|
||||
Reference in New Issue
Block a user