def get_substitution_dict (self, env={}): dict = { 'C_INCLUDE_PATH': '%(tools_prefix)s/include' + misc.append_path (os.environ.get ('C_INCLUDE_PATH', '')), 'CPLUS_INCLUDE_PATH': '%(tools_prefix)s/include' + misc.append_path (os.environ.get ('CPLUS_INCLUDE_PATH', '')), 'LIBRARY_PATH': '%(tools_prefix)s/lib' + misc.append_path (os.environ.get ('LIBRARY_PATH', '')), 'PATH': '%(cross_prefix)s/bin:%(tools_archmatch_prefix)s/bin:%(tools_prefix)s/bin:%(tools_cross_prefix)s/bin:' + os.environ['PATH'], } dict.update (env) d = build.AutoBuild.get_substitution_dict (self, dict).copy () return d
def system (self, logger, cmd, env=os.environ, ignore_errors=False): # UGH, FIXME: # There is loggedos usage that defies any PATH settings tools_bin_dir = os.path.join (os.getcwd (), 'target/tools/root/usr/bin') if not tools_bin_dir in env.get ('PATH', ''): env['PATH'] = tools_bin_dir + misc.append_path (env.get ('PATH', '')) env['SHELLOPTS'] = 'physical' logger.write_log ('COMMAND defies PATH: ' + cmd + '\n', 'command') logger.write_log ('invoking %(cmd)s\n' % locals (), 'command') proc = subprocess.Popen (cmd, bufsize=0, shell=True, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True) line = proc.stdout.readline () while line: if sys.version.startswith ('2'): logger.write_log (line, 'output') else: logger.write_log (line.decode (sys.stdout.encoding), 'output') line = proc.stdout.readline () proc.wait () if proc.returncode: m = 'Command barfed: %(cmd)s\n' % locals () logger.write_log (m, 'error') if not ignore_errors: raise misc.SystemFailed (m) return proc.returncode
def system(self, logger, cmd, env=os.environ, ignore_errors=False): # UGH, FIXME: # There is loggedos usage that defies any PATH settings tools_bin_dir = os.path.join(os.getcwd(), 'target/tools/root/usr/bin') if not tools_bin_dir in env.get('PATH', ''): env['PATH'] = tools_bin_dir + misc.append_path(env.get('PATH', '')) env['SHELLOPTS'] = 'physical' logger.write_log('COMMAND defies PATH: ' + cmd + '\n', 'command') logger.write_log('invoking %(cmd)s\n' % locals(), 'command') proc = subprocess.Popen(cmd, bufsize=0, shell=True, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True) line = proc.stdout.readline() while line: if sys.version.startswith('2'): logger.write_log(line, 'output') else: logger.write_log(line.decode(sys.stdout.encoding), 'output') line = proc.stdout.readline() proc.wait() if proc.returncode: m = 'Command barfed: %(cmd)s\n' % locals() logger.write_log(m, 'error') if not ignore_errors: raise misc.SystemFailed(m) return proc.returncode
def get_substitution_dict(self, env={}): dict = { "C_INCLUDE_PATH": "%(system_prefix)s/include" + misc.append_path(os.environ.get("C_INCLUDE_PATH", "")), "CPLUS_INCLUDE_PATH": "%(system_prefix)s/include" + misc.append_path(os.environ.get("CPLUS_INCLUDE_PATH", "")), "LIBRARY_PATH": "%(system_prefix)s/lib" # 'LIBRESTRICT_IGNORE': '%(system_prefix)s/bin/make:%(system_prefix)s/gcc:%(system_prefix)s/g++:%(system_prefix)s/ld', #etc. + misc.append_path(os.environ.get("LIBRARY_PATH", "")), "PATH": "%(system_prefix)s/bin:%(system_cross_prefix)s/bin:" + os.environ["PATH"], "PERL5LIB": "foo:%(tools_prefix)s/lib/perl5/5.10.0" + ":%(tools_prefix)s/lib/perl5/5.10.0/%(build_architecture)s" + ":%(tools_prefix)s/share/autoconf" + misc.append_path(os.environ.get("PERL5LIB", "")), } dict.update(env) d = build.AutoBuild.get_substitution_dict(self, dict).copy() return d
def get_substitution_dict (self, env={}): dict = { 'C_INCLUDE_PATH': '%(system_prefix)s/include' + misc.append_path (os.environ.get ('C_INCLUDE_PATH', '')), 'CPLUS_INCLUDE_PATH': '%(system_prefix)s/include' + misc.append_path (os.environ.get ('CPLUS_INCLUDE_PATH', '')), 'LIBRARY_PATH': '%(system_prefix)s/lib' # 'LIBRESTRICT_IGNORE': '%(system_prefix)s/bin/make:%(system_prefix)s/gcc:%(system_prefix)s/g++:%(system_prefix)s/ld', #etc. + misc.append_path (os.environ.get ('LIBRARY_PATH', '')), 'PATH': '%(system_prefix)s/bin:%(system_cross_prefix)s/bin:' + os.environ['PATH'], 'PERL5LIB': 'foo:%(tools_prefix)s/lib/perl5/5.10.0' + ':%(tools_prefix)s/lib/perl5/5.10.0/%(build_architecture)s' + ':%(tools_prefix)s/share/autoconf' + misc.append_path (os.environ.get ('PERL5LIB', '')), } dict.update (env) d = build.AutoBuild.get_substitution_dict (self, dict).copy () return d
def get_substitution_dict(self, env={}): dict = { 'C_INCLUDE_PATH': '%(tools_prefix)s/include' + misc.append_path(os.environ.get('C_INCLUDE_PATH', '')), 'CPLUS_INCLUDE_PATH': '%(tools_prefix)s/include' + misc.append_path(os.environ.get('CPLUS_INCLUDE_PATH', '')), 'LIBRARY_PATH': '%(tools_prefix)s/lib' + misc.append_path(os.environ.get('LIBRARY_PATH', '')), 'PATH': '%(cross_prefix)s/bin:%(tools_archmatch_prefix)s/bin:%(tools_prefix)s/bin:%(tools_cross_prefix)s/bin:' + os.environ['PATH'], } dict.update(env) d = build.AutoBuild.get_substitution_dict(self, dict).copy() return d
def get_substitution_dict (self, env={}): dict = { 'AR': '%(toolchain_prefix)sar', 'AS': '%(toolchain_prefix)sas', 'BUILD_CC': 'C_INCLUDE_PATH= CPATH= CPPFLAGS= LIBRARY_PATH= cc', 'CC': '%(toolchain_prefix)sgcc %(target_gcc_flags)s', 'CC_FOR_BUILD': 'C_INCLUDE_PATH= CPATH= CPPFLAGS= LIBRARY_PATH= cc', 'CCLD_FOR_BUILD': 'C_INCLUDE_PATH= CPATH= CPPFLAGS= LIBRARY_PATH= cc', 'LDFLAGS_FOR_BUILD': '', 'C_INCLUDE_PATH': '', 'CPATH': '', 'CPLUS_INCLUDE_PATH': '', 'CXX':'%(toolchain_prefix)sg++ %(target_gcc_flags)s', 'LIBRARY_PATH': '', 'LDFLAGS': '', 'LD': '%(toolchain_prefix)sld', 'NM': '%(toolchain_prefix)snm', 'PKG_CONFIG_PATH': '%(system_prefix)s/lib/pkgconfig', 'PATH': '%(cross_prefix)s/bin:%(tools_prefix)s/bin:%(tools_cross_prefix)s/bin:' + os.environ['PATH'], 'PERL5LIB': 'foo:%(tools_prefix)s/lib/perl5/5.10.0' + ':%(tools_prefix)s/lib/perl5/5.10.0/%(build_architecture)s' + ':%(tools_prefix)s/share/autoconf' + misc.append_path (os.environ.get ('PERL5LIB', '')), 'PKG_CONFIG': '''pkg-config \ --define-variable prefix=%(system_prefix)s \ --define-variable includedir=%(system_prefix)s/include \ --define-variable libdir=%(system_prefix)s/lib \ ''', 'RANLIB': '%(toolchain_prefix)sranlib', 'SED': 'sed', # libtool (expat mingw) fixup } if 'stat' in misc.librestrict (): dict['PATH'] = '%(cross_prefix)s/bin:%(tools_prefix)s/bin:%(tools_cross_prefix)s/bin:%(cross_prefix)s/%(target_architecture)s/bin' dict['CC_FOR_BUILD'] = 'C_INCLUDE_PATH= CPATH= CPPFLAGS= LIBRARY_PATH= PATH=/usr/bin:$PATH cc' dict['CCLD_FOR_BUILD'] = 'C_INCLUDE_PATH= CPATH= CPPFLAGS= LIBRARY_PATH=/usr/bin:$PATH cc' # FIXME: usr/bin and w32api belongs to mingw/cygwin; but overriding is broken # FIXME: how to move this to cygwin.py/mingw.py? # Hmm, better to make wrappers for gcc/c++/g++ that add options; # see (gub-samco branch) linux-arm-vfp.py? if self.settings.platform in ('cygwin', 'mingw'): dict['LDFLAGS'] += '-L%(system_prefix)s/lib -L%(system_prefix)s/bin -L%(system_prefix)s/lib/w32api' #FIXME: how to move this to arm.py? if self.settings.target_architecture == 'armv5te-softfloat-linux': dict['CFLAGS'] = '-O' dict.update (env) d = build.AutoBuild.get_substitution_dict (self, dict).copy () return d
def get_substitution_dict(self, env={}): dict = { 'C_INCLUDE_PATH': '%(system_prefix)s/include' + misc.append_path(os.environ.get('C_INCLUDE_PATH', '')), 'CPLUS_INCLUDE_PATH': '%(system_prefix)s/include' + misc.append_path(os.environ.get('CPLUS_INCLUDE_PATH', '')), 'LIBRARY_PATH': '%(system_prefix)s/lib' # 'LIBRESTRICT_IGNORE': '%(system_prefix)s/bin/make:%(system_prefix)s/gcc:%(system_prefix)s/g++:%(system_prefix)s/ld', #etc. + misc.append_path(os.environ.get('LIBRARY_PATH', '')), 'PATH': '%(system_prefix)s/bin:%(system_cross_prefix)s/bin:' + os.environ['PATH'], 'PERL5LIB': 'foo:%(tools_prefix)s/lib/perl5/5.10.0' + ':%(tools_prefix)s/lib/perl5/5.10.0/%(build_architecture)s' + ':%(tools_prefix)s/share/autoconf' + misc.append_path(os.environ.get('PERL5LIB', '')), } dict.update(env) d = build.AutoBuild.get_substitution_dict(self, dict).copy() return d
def get_env(self): env = os.environ # Hmm, Repository.system and .read_pipe are used in # build.Build.__init__ () [read: GIT] when no # get_substitution_dict expansion is allowed. Use settings to # sneak in correct paths. if self.settings: tools_dir = self.settings.alltargetdir + "/tools" + self.settings.root_dir tools_bin = tools_dir + self.settings.prefix_dir + "/bin" tools_lib = tools_dir + self.settings.prefix_dir + "/lib" return { "PATH": tools_bin + ":" + os.environ["PATH"], "LD_LIBRARY_PATH": tools_lib + misc.append_path(os.environ.get("LD_LIBRARY_PATH", "")), } return os.environ
def LD_LIBRARY_PATH(self): return '%(tools_prefix)s/lib' + misc.append_path( os.environ.get('LD_LIBRARY_PATH', ''))
def get_substitution_dict(self, env={}): dict = { 'AR': '%(toolchain_prefix)sar', 'AS': '%(toolchain_prefix)sas', 'BUILD_CC': 'C_INCLUDE_PATH= CPATH= CPPFLAGS= LIBRARY_PATH= cc', 'CC': '%(toolchain_prefix)sgcc %(target_gcc_flags)s', 'CC_FOR_BUILD': 'C_INCLUDE_PATH= CPATH= CPPFLAGS= LIBRARY_PATH= cc', 'CCLD_FOR_BUILD': 'C_INCLUDE_PATH= CPATH= CPPFLAGS= LIBRARY_PATH= cc', 'LDFLAGS_FOR_BUILD': '', 'C_INCLUDE_PATH': '', 'CPATH': '', 'CPLUS_INCLUDE_PATH': '', 'CXX': '%(toolchain_prefix)sg++ %(target_gcc_flags)s', 'LIBRARY_PATH': '', 'LDFLAGS': '', 'LD': '%(toolchain_prefix)sld', 'NM': '%(toolchain_prefix)snm', 'PKG_CONFIG_PATH': '%(system_prefix)s/lib/pkgconfig', 'PATH': '%(cross_prefix)s/bin:%(tools_archmatch_prefix)s/bin:%(tools_prefix)s/bin:%(tools_cross_prefix)s/bin:' + os.environ['PATH'], 'PERL5LIB': 'foo:%(tools_prefix)s/lib/perl5/5.10.0' + ':%(tools_prefix)s/lib/perl5/5.10.0/%(build_architecture)s' + ':%(tools_prefix)s/share/autoconf' + misc.append_path(os.environ.get('PERL5LIB', '')), 'PKG_CONFIG': '''pkg-config \ --define-variable prefix=%(system_prefix)s \ --define-variable includedir=%(system_prefix)s/include \ --define-variable libdir=%(system_prefix)s/lib \ ''', 'RANLIB': '%(toolchain_prefix)sranlib', 'SED': 'sed', # libtool (expat mingw) fixup } if 'stat' in misc.librestrict(): dict[ 'PATH'] = '%(cross_prefix)s/bin:%(tools_prefix)s/bin:%(tools_cross_prefix)s/bin:%(cross_prefix)s/%(target_architecture)s/bin' dict[ 'CC_FOR_BUILD'] = 'C_INCLUDE_PATH= CPATH= CPPFLAGS= LIBRARY_PATH= PATH=/usr/bin:$PATH cc' dict[ 'CCLD_FOR_BUILD'] = 'C_INCLUDE_PATH= CPATH= CPPFLAGS= LIBRARY_PATH=/usr/bin:$PATH cc' # FIXME: usr/bin and w32api belongs to mingw/cygwin; but overriding is broken # FIXME: how to move this to cygwin.py/mingw.py? # Hmm, better to make wrappers for gcc/c++/g++ that add options; # see (gub-samco branch) linux-arm-vfp.py? if self.settings.platform in ('cygwin', 'mingw'): dict[ 'LDFLAGS'] += '-L%(system_prefix)s/lib -L%(system_prefix)s/bin -L%(system_prefix)s/lib/w32api' #FIXME: how to move this to arm.py? if self.settings.target_architecture == 'armv5te-softfloat-linux': dict['CFLAGS'] = '-O' dict.update(env) d = build.AutoBuild.get_substitution_dict(self, dict).copy() return d
def LD_LIBRARY_PATH (self): return '%(tools_prefix)s/lib' + misc.append_path (os.environ.get ('LD_LIBRARY_PATH', ''))