| 1 |
"""Support for Linux.""" |
| 2 |
|
| 3 |
import os |
| 4 |
import platform |
| 5 |
import sys |
| 6 |
from rpython.translator.platform.posix import BasePosix |
| 7 |
|
| 8 |
class Linux(BasePosix): |
| 9 |
name = "linux" |
| 10 |
|
| 11 |
link_flags = tuple( |
| 12 |
['-pthread',] |
| 13 |
+ os.environ.get('LDFLAGS', '').split()) |
| 14 |
extra_libs = ('-lrt',) |
| 15 |
cflags = tuple( |
| 16 |
['-O3', '-pthread', '-fomit-frame-pointer', |
| 17 |
'-Wall', '-Wno-unused', '-Wno-address', |
| 18 |
'-Wno-discarded-qualifiers', |
| 19 |
|
| 20 |
'-Wno-duplicate-decl-specifier', |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
] |
| 25 |
+ os.environ.get('CFLAGS', '').split()) |
| 26 |
standalone_only = () |
| 27 |
shared_only = ('-fPIC',) |
| 28 |
so_ext = 'so' |
| 29 |
|
| 30 |
if platform.machine() == 's390x': |
| 31 |
from rpython.translator.platform.arch import s390x |
| 32 |
cflags = s390x.update_cflags(cflags) |
| 33 |
|
| 34 |
def _args_for_shared(self, args, **kwds): |
| 35 |
return ['-shared'] + args |
| 36 |
|
| 37 |
def _include_dirs_for_libffi(self): |
| 38 |
return self._pkg_config("libffi", "--cflags-only-I", |
| 39 |
['/usr/include/libffi'], |
| 40 |
check_result_dir=True) |
| 41 |
|
| 42 |
def _library_dirs_for_libffi(self): |
| 43 |
return self._pkg_config("libffi", "--libs-only-L", |
| 44 |
['/usr/lib/libffi'], |
| 45 |
check_result_dir=True) |