1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
"""Support for NetBSD."""
import os
from rpython.translator.platform import posix
def get_env(key, default):
if key in os.environ:
return os.environ[key]
else:
return default
def get_env_vector(key, default):
string = get_env(key, default)
# XXX: handle quotes
return string.split()
class Netbsd(posix.BasePosix):
name = "netbsd"
link_flags = ['-pthread',
'-Wl,-R' + get_env("LOCALBASE", "/usr/pkg") + '/lib'
] + get_env_vector('LDFLAGS', '')
cflags = ['-O3', '-pthread', '-fomit-frame-pointer'
] + get_env_vector('CFLAGS', '')
standalone_only = []
shared_only = []
so_ext = 'so'
make_cmd = 'gmake'
extra_libs = ('-lrt',)
def __init__(self, cc=None):
if cc is None:
cc = get_env("CC", "gcc")
super(Netbsd, self).__init__(cc)
def _args_for_shared(self, args):
return ['-shared'] + args
def _preprocess_include_dirs(self, include_dirs):
res_incl_dirs = list(include_dirs)
res_incl_dirs.append(os.path.join(get_env("LOCALBASE", "/usr/pkg"), "include"))
return res_incl_dirs
def _preprocess_library_dirs(self, library_dirs):
res_lib_dirs = list(library_dirs)
res_lib_dirs.append(os.path.join(get_env("LOCALBASE", "/usr/pkg"), "lib"))
return res_lib_dirs
def _include_dirs_for_libffi(self):
return [os.path.join(get_env("LOCALBASE", "/usr/pkg"), "include")]
def _library_dirs_for_libffi(self):
return [os.path.join(get_env("LOCALBASE", "/usr/pkg"), "lib")]
class Netbsd_64(Netbsd):
shared_only = ('-fPIC',)
|