Skip to content

Commit c36c3f9

Browse files
committed
Merge branch 'master' of github.com:cahirwpz/amigaos-cross-toolchain
2 parents a5fd817 + aa692fe commit c36c3f9

File tree

2 files changed

+42
-3
lines changed

2 files changed

+42
-3
lines changed

common.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,38 @@ def make(name, target=None, **makevars):
451451
execute('make', *args)
452452

453453

454+
def require_header(header, lang, msg = '', symbol = False, value = False):
455+
debug('require_header "%s"', header)
456+
457+
cmd = {'c':'{cc}', 'c++':'{cxx}'}[lang]
458+
cmd = fill_in(cmd).split() + ['-fsyntax-only', '-x', lang, '-']
459+
proc = subprocess.Popen(cmd, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
460+
461+
stdin_line = '#include <' + header + '>'
462+
if symbol:
463+
if value:
464+
stdin_line += """\n#if %s != %s
465+
#error
466+
#endif """ % (symbol, value)
467+
else:
468+
stdin_line += """\n#ifndef %s
469+
#error
470+
#endif """ % (symbol)
471+
472+
(result_stdout, result_stderr) = proc.communicate(stdin_line)
473+
proc.wait()
474+
475+
cmd = ' '.join(cmd)
476+
477+
if proc.returncode == 0:
478+
debug('output from "%s":\n%s', cmd, result_stdout)
479+
else:
480+
debug('error output from "%s":\n%s', cmd, result_stderr)
481+
panic('require_header failed: %s', msg)
482+
483+
454484
__all__ = ['setvar', 'panic', 'cmpver', 'find_executable', 'chmod', 'execute',
455485
'rmtree', 'mkdir', 'copy', 'copytree', 'unarc', 'fetch', 'cwd',
456486
'symlink', 'remove', 'move', 'find', 'textfile', 'env', 'path',
457487
'add_site_dir', 'python_setup', 'recipe', 'unpack', 'patch',
458-
'configure', 'make']
488+
'configure', 'make', 'require_header']

toolchain-m68k

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ def build_vbcc():
117117
'n', 'y', 'unsigned short',
118118
'n', 'y', 'signed int',
119119
'n', 'y', 'unsigned int',
120-
'n', 'y', 'signed long',
121-
'n', 'y', 'unsigned long',
120+
'n', 'y', 'signed long long',
121+
'n', 'y', 'unsigned long long',
122122
'n', 'y', 'float',
123123
'n', 'y', 'double')
124124
make('vbcc', TARGET='m68k', ETCDIR='\\"{target}/etc/\\"', CONFIG=config)
@@ -241,6 +241,15 @@ def build():
241241
path.join('{host}', 'bin'),
242242
environ['PATH']])
243243

244+
setvar(cc = environ['CC'], cxx = environ['CXX'])
245+
246+
"""
247+
When we have a working compiler in our path, we can also check if the
248+
required headers/libraries are present.
249+
"""
250+
251+
require_header('ncurses.h', 'c', 'libncurses-dev 5.x missing', 'NCURSES_VERSION_MAJOR', 5)
252+
244253
unpack('{m4}')
245254
configure('{m4}', '--prefix={host}')
246255
make('{m4}')

0 commit comments

Comments
 (0)