def _lo_triplets(self, opt, macro, value): # # This is a target triplet. Run it past config.sub to make make sure it # is ok. The target triplet is 'cpu-vendor-os'. # e = execute.capture_execution() config_sub = path.join(self.command_path, basepath, 'config.sub') exit_code, proc, output = e.shell(config_sub + ' ' + value) if exit_code == 0: value = output self.defaults[macro] = ('triplet', 'none', value) self.opts[opt[2:]] = value _cpu = macro + '_cpu' _arch = macro + '_arch' _vendor = macro + '_vendor' _os = macro + '_os' _arch_value = '' _vendor_value = '' _os_value = '' dash = value.find('-') if dash >= 0: _arch_value = value[:dash] value = value[dash + 1:] dash = value.find('-') if dash >= 0: _vendor_value = value[:dash] value = value[dash + 1:] if len(value): _os_value = value self.defaults[_cpu] = _arch_value self.defaults[_arch] = _arch_value self.defaults[_vendor] = _vendor_value self.defaults[_os] = _os_value
def run(self, command, shell_opts = '', cwd = None): e = execute.capture_execution(log = log.default, dump = self.opts.quiet()) cmd = self.config.expand('%{___build_shell} -ex ' + shell_opts + ' ' + command) log.output('run: ' + cmd) exit_code, proc, output = e.shell(cmd, cwd = path.host(cwd)) if exit_code != 0: raise error.general('shell cmd failed: %s' % (cmd))
def run(self, command, shell_opts='', cwd=None): e = execute.capture_execution(log=log.default, dump=self.opts.quiet()) cmd = self.config.expand('%{___build_shell} -ex ' + shell_opts + ' ' + command) log.output('run: ' + cmd) exit_code, proc, output = e.shell(cmd, cwd=path.host(cwd)) if exit_code != 0: raise error.general('shell cmd failed: %s' % (cmd))
def run(self, command, shell_opts="", cwd=None): e = execute.capture_execution(log=log.default, dump=self.opts.quiet()) cmd = self.config.expand("%{___build_shell} -ex " + shell_opts + " " + command) log.output("run: " + cmd) exit_code, proc, output = e.shell(cmd, cwd=path.host(cwd)) if exit_code != 0: log.output("shell cmd failed: %s" % (cmd)) raise error.general("building %s" % (self.macros["buildname"]))
def load(): uname = os.uname() sysctl = '/sbin/sysctl ' e = execute.capture_execution() exit_code, proc, output = e.shell(sysctl + 'hw.ncpu') if exit_code == 0: ncpus = output.split(' ')[1].strip() else: ncpus = '1' if uname[4] == 'amd64': cpu = 'x86_64' else: cpu = uname[4] version = uname[2] if version.find('-') > 0: version = version.split('-')[0] defines = { '_ncpus': ('none', 'none', '1'), '_os': ('none', 'none', 'netbsd'), '_host': ('triplet', 'required', cpu + '-netbsd' + version), '_host_vendor': ('none', 'none', 'pc'), '_host_os': ('none', 'none', 'netbsd'), '_host_os_version': ('none', 'none', version), '_host_cpu': ('none', 'none', cpu), '_host_alias': ('none', 'none', '%{nil}'), '_host_arch': ('none', 'none', cpu), '_usr': ('dir', 'required', '/usr'), '_var': ('dir', 'optional', '/var'), 'optincludes_build': ('none', 'none', '-I/usr/pkg/include -L/usr/pkg/lib'), '__bash': ('exe', 'optional', '/usr/pkg/bin/bash'), '__bison': ('exe', 'required', '/usr/pkg/bin/bison'), '__git': ('exe', 'required', '/usr/pkg/bin/git'), '__svn': ('exe', 'required', '/usr/pkg/bin/svn'), '__xz': ('exe', 'optional', '/usr/pkg/bin/xz'), '__make': ('exe', 'required', 'gmake'), '__patch_opts': ('none', 'none', '-E') } defines['_build'] = defines['_host'] defines['_build_vendor'] = defines['_host_vendor'] defines['_build_os'] = defines['_host_os'] defines['_build_cpu'] = defines['_host_cpu'] defines['_build_alias'] = defines['_host_alias'] defines['_build_arch'] = defines['_host_arch'] for gv in ['47', '48', '49']: gcc = '%s-portbld-netbsd%s-gcc%s' % (cpu, version, gv) if check.check_exe(gcc, gcc): defines['__cc'] = gcc break for gv in ['47', '48', '49']: gxx = '%s-portbld-netbsd%s-g++%s' % (cpu, version, gv) if check.check_exe(gxx, gxx): defines['__cxx'] = gxx break return defines
def cpus(): psrinfo = '/sbin/psrinfo|wc -l' e = execute.capture_execution() exit_code, proc, output = e.shell(psrinfo) if exit_code == 0: ncpus = int(output) else: ncpus = 1 return ncpus
def cpus(): sysctl = '/usr/sbin/sysctl ' e = execute.capture_execution() exit_code, proc, output = e.shell(sysctl + 'hw.ncpu') if exit_code == 0: ncpus = int(output.split(' ')[1].strip()) else: ncpus = 1 return ncpus
def load(): uname = os.uname() sysctl = "/sbin/sysctl " e = execute.capture_execution() exit_code, proc, output = e.shell(sysctl + "hw.ncpu") if exit_code == 0: ncpus = output.split(" ")[1].strip() else: ncpus = "1" if uname[4] == "amd64": cpu = "x86_64" else: cpu = uname[4] version = uname[2] if version.find("-") > 0: version = version.split("-")[0] defines = { "_ncpus": ("none", "none", "1"), "_os": ("none", "none", "netbsd"), "_host": ("triplet", "required", cpu + "-netbsd" + version), "_host_vendor": ("none", "none", "pc"), "_host_os": ("none", "none", "netbsd"), "_host_os_version": ("none", "none", version), "_host_cpu": ("none", "none", cpu), "_host_alias": ("none", "none", "%{nil}"), "_host_arch": ("none", "none", cpu), "_usr": ("dir", "required", "/usr"), "_var": ("dir", "optional", "/var"), "optincludes_build": ("none", "none", "-I/usr/pkg/include -L/usr/pkg/lib"), "__bash": ("exe", "optional", "/usr/pkg/bin/bash"), "__bison": ("exe", "required", "/usr/pkg/bin/bison"), "__git": ("exe", "required", "/usr/pkg/bin/git"), "__svn": ("exe", "required", "/usr/pkg/bin/svn"), "__xz": ("exe", "optional", "/usr/pkg/bin/xz"), "__make": ("exe", "required", "gmake"), "__patch_opts": ("none", "none", "-E"), } defines["_build"] = defines["_host"] defines["_build_vendor"] = defines["_host_vendor"] defines["_build_os"] = defines["_host_os"] defines["_build_cpu"] = defines["_host_cpu"] defines["_build_alias"] = defines["_host_alias"] defines["_build_arch"] = defines["_host_arch"] for gv in ["47", "48", "49"]: gcc = "%s-portbld-netbsd%s-gcc%s" % (cpu, version, gv) if check.check_exe(gcc, gcc): defines["__cc"] = gcc break for gv in ["47", "48", "49"]: gxx = "%s-portbld-netbsd%s-g++%s" % (cpu, version, gv) if check.check_exe(gxx, gxx): defines["__cxx"] = gxx break return defines
def _run(self, args, check=False): e = execute.capture_execution() if path.exists(self.path): cwd = self.path else: cwd = None cmd = [self.git] + args log.trace('cmd: (%s) %s' % (str(cwd), ' '.join(cmd))) exit_code, proc, output = e.spawn(cmd, cwd=path.host(cwd)) log.trace(output) if check: self._git_exit_code(exit_code) return exit_code, output
def _run(self, args, check = False): e = execute.capture_execution() if path.exists(self.path): cwd = self.path else: cwd = None cmd = [self.git] + args log.trace('cmd: (%s) %s' % (str(cwd), ' '.join(cmd))) exit_code, proc, output = e.spawn(cmd, cwd = path.host(cwd)) log.trace(output) if check: self._git_exit_code(exit_code) return exit_code, output
def _run(self, args, check = False, cwd = None): e = execute.capture_execution() if cwd is None: cwd = path.join(self.path, self.prefix) if not path.exists(cwd): raise error.general('cvs path needs to exist: %s' % (cwd)) cmd = [self.cvs, '-z', '9', '-q'] + args log.output('cmd: (%s) %s' % (str(cwd), ' '.join(cmd))) exit_code, proc, output = e.spawn(cmd, cwd = path.host(cwd)) log.trace(output) if check: self._cvs_exit_code(cmd, exit_code, output) return exit_code, output
def load(): uname = os.uname() psrinfo = '/sbin/psrinfo|wc -l' e = execute.capture_execution() exit_code, proc, output = e.shell(psrinfo) if exit_code == 0: ncpus = output else: ncpus = '1' if uname[4] == 'i86pc': cpu = 'i386' else: cpu = uname[4] version = uname[2] if version.find('-') > 0: version = version.split('-')[0] defines = { '_ncpus': ('none', 'none', ncpus), '_os': ('none', 'none', 'solaris'), '_host': ('triplet', 'required', cpu + '-pc-solaris2'), '_host_vendor': ('none', 'none', 'pc'), '_host_os': ('none', 'none', 'solaris'), '_host_os_version': ('none', 'none', version), '_host_cpu': ('none', 'none', cpu), '_host_alias': ('none', 'none', '%{nil}'), '_host_arch': ('none', 'none', cpu), '_usr': ('dir', 'required', '/usr'), '_var': ('dir', 'optional', '/var'), '__bash': ('exe', 'optional', '/usr/bin/bash'), '__bison': ('exe', 'required', '/usr/bin/bison'), '__git': ('exe', 'required', '/usr/bin/git'), '__svn': ('exe', 'required', '/usr/bin/svn'), '__cvs': ('exe', 'optional', '/usr/bin/cvs'), '__xz': ('exe', 'optional', '/usr/bin/xz'), '__make': ('exe', 'required', 'gmake'), '__patch_opts': ('none', 'none', '-E'), '__chown': ('exe', 'required', '/usr/bin/chown'), '__install': ('exe', 'required', '/usr/bin/ginstall'), '__cc': ('exe', 'required', '/usr/bin/gcc'), '__cxx': ('exe', 'required', '/usr/bin/g++'), 'with_iconv': ('none', 'none', '0') } defines['_build'] = defines['_host'] defines['_build_vendor'] = defines['_host_vendor'] defines['_build_os'] = defines['_host_os'] defines['_build_cpu'] = defines['_host_cpu'] defines['_build_alias'] = defines['_host_alias'] defines['_build_arch'] = defines['_host_arch'] return defines
def load(): uname = os.uname() sysctl = '/usr/sbin/sysctl ' e = execute.capture_execution() exit_code, proc, output = e.shell(sysctl + 'hw.ncpu') if exit_code == 0: ncpus = output.split(' ')[1].strip() else: ncpus = '1' version = uname[2] if version.find('.'): version = version.split('.')[0] defines = { '_ncpus': ('none', 'none', ncpus), '_os': ('none', 'none', 'darwin'), '_host': ('triplet', 'required', uname[4] + '-apple-darwin' + uname[2]), '_host_vendor': ('none', 'none', 'apple'), '_host_os': ('none', 'none', 'darwin'), '_host_os_version': ('none', 'none', version), '_host_cpu': ('none', 'none', uname[4]), '_host_alias': ('none', 'none', '%{nil}'), '_host_arch': ('none', 'none', uname[4]), '_usr': ('dir', 'optional', '/usr/local'), '_var': ('dir', 'optional', '/usr/local/var'), '_prefix': ('dir', 'optional', '%{_usr}'), '__ldconfig': ('exe', 'none', ''), '__cmake': ('exe', 'optional', 'cmake'), '__cvs': ('exe', 'optional', 'cvs'), '__xz': ('exe', 'required', 'xz'), 'with_zlib': ('none', 'none', '--with-zlib=no'), '_forced_static': ('none', 'none', ''), '_ld_library_path': ('none', 'none', 'DYLD_LIBRARY_PATH') } if version.find('.'): version = version.split('.')[0] if int(version) >= 13: defines['__cc'] = ('exe', 'required', '/usr/bin/cc') defines['__cxx'] = ('exe', 'required', '/usr/bin/c++') defines['build_cflags'] = '-O2 -pipe -fbracket-depth=1024' defines['build_cxxflags'] = '-O2 -pipe -fbracket-depth=1024' defines['_build'] = defines['_host'] defines['_build_vendor'] = defines['_host_vendor'] defines['_build_os'] = defines['_host_os'] defines['_build_cpu'] = defines['_host_cpu'] defines['_build_alias'] = defines['_host_alias'] defines['_build_arch'] = defines['_host_arch'] return defines
def load(): uname = os.uname() psrinfo = '/sbin/psrinfo|wc -l' e = execute.capture_execution() exit_code, proc, output = e.shell(psrinfo) if exit_code == 0: ncpus = output else: ncpus = '1' if uname[4] == 'i86pc': cpu = 'i386' else: cpu = uname[4] version = uname[2] if version.find('-') > 0: version = version.split('-')[0] defines = { '_ncpus': ('none', 'none', ncpus), '_os': ('none', 'none', 'solaris'), '_host': ('triplet', 'required', cpu + '-pc-solaris2'), '_host_vendor': ('none', 'none', 'pc'), '_host_os': ('none', 'none', 'solaris'), '_host_os_version': ('none', 'none', version), '_host_cpu': ('none', 'none', cpu), '_host_alias': ('none', 'none', '%{nil}'), '_host_arch': ('none', 'none', cpu), '_usr': ('dir', 'required', '/usr'), '_var': ('dir', 'optional', '/var'), '__bash': ('exe', 'optional', '/usr/bin/bash'), '__bison': ('exe', 'required', '/usr/bin/bison'), '__git': ('exe', 'required', '/usr/bin/git'), '__svn': ('exe', 'required', '/usr/bin/svn'), '__cvs': ('exe', 'required', '/usr/bin/cvs'), '__xz': ('exe', 'optional', '/usr/bin/xz'), '__make': ('exe', 'required', 'gmake'), '__patch_opts': ('none', 'none', '-E'), '__chown': ('exe', 'required', '/usr/bin/chown'), '__install': ('exe', 'required', '/usr/bin/ginstall'), '__cc': ('exe', 'required', '/usr/bin/gcc'), '__cxx': ('exe', 'required', '/usr/bin/g++'), 'with_iconv': ('none', 'none', '0') } defines['_build'] = defines['_host'] defines['_build_vendor'] = defines['_host_vendor'] defines['_build_os'] = defines['_host_os'] defines['_build_cpu'] = defines['_host_cpu'] defines['_build_alias'] = defines['_host_alias'] defines['_build_arch'] = defines['_host_arch'] return defines
def cpus(): processors = '/bin/grep processor /proc/cpuinfo' e = execute.capture_execution() exit_code, proc, output = e.shell(processors) ncpus = 0 if exit_code == 0: try: for l in output.split('\n'): count = l.split(':')[1].strip() if int(count) > ncpus: ncpus = int(count) except: pass return ncpus + 1
def load(): uname = os.uname() sysctl = '/usr/sbin/sysctl ' e = execute.capture_execution() exit_code, proc, output = e.shell(sysctl + 'hw.ncpu') if exit_code == 0: ncpus = output.split(' ')[1].strip() else: ncpus = '1' version = uname[2] if version.find('.'): version = version.split('.')[0] defines = { '_ncpus': ('none', 'none', ncpus), '_os': ('none', 'none', 'darwin'), '_host': ('triplet', 'required', uname[4] + '-apple-darwin' + uname[2]), '_host_vendor': ('none', 'none', 'apple'), '_host_os': ('none', 'none', 'darwin'), '_host_os_version': ('none', 'none', version), '_host_cpu': ('none', 'none', uname[4]), '_host_alias': ('none', 'none', '%{nil}'), '_host_arch': ('none', 'none', uname[4]), '_usr': ('dir', 'optional', '/usr/local'), '_var': ('dir', 'optional', '/usr/local/var'), '_prefix': ('dir', 'optional', '%{_usr}'), '__ldconfig': ('exe', 'none', ''), '__cvs': ('exe', 'optional', 'cvs'), '__xz': ('exe', 'required', '%{_usr}/bin/xz'), 'with_zlib': ('none', 'none', '--with-zlib=no'), '_forced_static': ('none', 'none', ''), '_ld_library_path': ('none', 'none', 'DYLD_LIBRARY_PATH') } if version.find('.'): version = version.split('.')[0] if int(version) >= 13: defines['__cc'] = ('exe', 'required', '/usr/bin/cc') defines['__cxx'] = ('exe', 'required', '/usr/bin/c++') defines['build_cflags'] = '-O2 -pipe -fbracket-depth=1024' defines['build_cxxflags'] = '-O2 -pipe -fbracket-depth=1024' defines['_build'] = defines['_host'] defines['_build_vendor'] = defines['_host_vendor'] defines['_build_os'] = defines['_host_os'] defines['_build_cpu'] = defines['_host_cpu'] defines['_build_alias'] = defines['_host_alias'] defines['_build_arch'] = defines['_host_arch'] return defines
def _shell(self, line): sl = self.sf.findall(line) if len(sl): e = execute.capture_execution() for s in sl: if options.host_windows: cmd = '%s -c "%s"' % (self.macros.expand('%{__sh}'), s[2:-1]) else: cmd = s[2:-1] exit_code, proc, output = e.shell(cmd) if exit_code == 0: line = line.replace(s, output) else: raise error.general('shell macro failed: %s:%d: %s' % (s, exit_code, output)) return line
def _exec(shell_macro): output = '' if len(shell_macro) > 3: e = execute.capture_execution() if options.host_windows: cmd = '%s -c "%s"' % (macros.expand('%{__sh}'), shell_macro[2:-1]) else: cmd = shell_macro[2:-1] exit_code, proc, output = e.shell(cmd) log.trace('shell-output: %d %s' % (exit_code, output)) if exit_code != 0: raise error.general('shell macro failed: %s: %d: %s' % (cmd, exit_code, output)) return output
def load(): uname = os.uname() sysctl = "/usr/sbin/sysctl " e = execute.capture_execution() exit_code, proc, output = e.shell(sysctl + "hw.ncpu") if exit_code == 0: ncpus = output.split(" ")[1].strip() else: ncpus = "1" version = uname[2] if version.find("."): version = version.split(".")[0] defines = { "_ncpus": ("none", "none", ncpus), "_os": ("none", "none", "darwin"), "_host": ("triplet", "required", uname[4] + "-apple-darwin" + uname[2]), "_host_vendor": ("none", "none", "apple"), "_host_os": ("none", "none", "darwin"), "_host_os_version": ("none", "none", version), "_host_cpu": ("none", "none", uname[4]), "_host_alias": ("none", "none", "%{nil}"), "_host_arch": ("none", "none", uname[4]), "_usr": ("dir", "optional", "/usr/local"), "_var": ("dir", "optional", "/usr/local/var"), "_prefix": ("dir", "optional", "%{_usr}"), "__ldconfig": ("exe", "none", ""), "__cvs": ("exe", "required", "cvs"), "__xz": ("exe", "required", "%{_usr}/bin/xz"), "with_zlib": ("none", "none", "--with-zlib=no"), "_forced_static": ("none", "none", ""), "_ld_library_path": ("none", "none", "DYLD_LIBRARY_PATH"), } if version.find("."): version = version.split(".")[0] if int(version) >= 13: defines["__cc"] = ("exe", "required", "/usr/bin/cc") defines["__cxx"] = ("exe", "required", "/usr/bin/c++") defines["_build"] = defines["_host"] defines["_build_vendor"] = defines["_host_vendor"] defines["_build_os"] = defines["_host_os"] defines["_build_cpu"] = defines["_host_cpu"] defines["_build_alias"] = defines["_host_alias"] defines["_build_arch"] = defines["_host_arch"] return defines
def load(): uname = os.uname() sysctl = '/usr/sbin/sysctl ' e = execute.capture_execution() exit_code, proc, output = e.shell(sysctl + 'hw.ncpu') if exit_code == 0: ncpus = output.split(' ')[1].strip() else: ncpus = '1' defines = { '_ncpus': ('none', 'none', ncpus), '_os': ('none', 'none', 'darwin'), '_host': ('triplet', 'required', uname[4] + '-apple-darwin' + uname[2]), '_host_vendor': ('none', 'none', 'apple'), '_host_os': ('none', 'none', 'darwin'), '_host_cpu': ('none', 'none', uname[4]), '_host_alias': ('none', 'none', '%{nil}'), '_host_arch': ('none', 'none', uname[4]), '_host_prefix': ('dir', 'optional', '%{_usr}'), '_usr': ('dir', 'optional', '/usr/local'), '_var': ('dir', 'optional', '/usr/local/var'), '__ldconfig': ('exe', 'none', ''), '__cvs': ('exe', 'required', 'cvs'), '__xz': ('exe', 'required', '%{_usr}/bin/xz'), 'with_zlib': ('none', 'none', '--with-zlib=no'), '_forced_static': ('none', 'none', '') } defines['_build'] = defines['_host'] defines['_build_vendor'] = defines['_host_vendor'] defines['_build_os'] = defines['_host_os'] defines['_build_cpu'] = defines['_host_cpu'] defines['_build_alias'] = defines['_host_alias'] defines['_build_arch'] = defines['_host_arch'] return defines
def load(): uname = os.uname() sysctl = '/sbin/sysctl ' e = execute.capture_execution() exit_code, proc, output = e.shell(sysctl + 'hw.ncpu') if exit_code == 0: ncpus = output.split(' ')[1].strip() else: ncpus = '1' if uname[4] == 'amd64': cpu = 'x86_64' else: cpu = uname[4] version = uname[2] if version.find('-') > 0: version = version.split('-')[0] defines = { '_ncpus': ('none', 'none', ncpus), '_os': ('none', 'none', 'freebsd'), '_host': ('triplet', 'required', cpu + '-freebsd' + version), '_host_vendor': ('none', 'none', 'pc'), '_host_os': ('none', 'none', 'freebsd'), '_host_os_version': ('none', 'none', version), '_host_cpu': ('none', 'none', cpu), '_host_alias': ('none', 'none', '%{nil}'), '_host_arch': ('none', 'none', cpu), '_usr': ('dir', 'required', '/usr/local'), '_var': ('dir', 'optional', '/usr/local/var'), '__bash': ('exe', 'optional', '/usr/local/bin/bash'), '__bison': ('exe', 'required', '/usr/local/bin/bison'), '__git': ('exe', 'required', '/usr/local/bin/git'), '__svn': ('exe', 'required', '/usr/local/bin/svn'), '__xz': ('exe', 'optional', '/usr/bin/xz'), '__make': ('exe', 'required', 'gmake'), '__patch_opts': ('none', 'none', '-E') } defines['_build'] = defines['_host'] defines['_build_vendor'] = defines['_host_vendor'] defines['_build_os'] = defines['_host_os'] defines['_build_cpu'] = defines['_host_cpu'] defines['_build_alias'] = defines['_host_alias'] defines['_build_arch'] = defines['_host_arch'] # FreeBSD 10 and above no longer have /usr/bin/cvs, but it can (e.g.) be # installed to /usr/local/bin/cvs through the devel/cvs port if int(float(version)) >= 10: # # FreeBSD has switched to clang plus gcc. On 10.0 cc is gcc based and # clang is provided however it is not building binutils-2.24. # cc = '/usr/bin/cc' if check.check_exe(cc, cc): defines['__cc'] = cc else: cc = '/usr/bin/clang' if not check.check_exe(cc, cc): raise error.general('no valid cc found') cxx = '/usr/bin/c++' if check.check_exe(cxx, cxx): defines['__cxx'] = cxx else: cxx = '/usr/bin/clang++' if check.check_exe(cxx, cxx): raise error.general('no valid c++ found') # # Assume the compiler is clang and so we need to increase # bracket depth build build the gcc ARM compiler. # defines['build_cflags'] = '-O2 -pipe -fbracket-depth=1024' defines['build_cxxflags'] = '-O2 -pipe -fbracket-depth=1024' cvs = 'cvs' if check.check_exe(cvs, cvs): defines['__cvs'] = cvs # # Fix the mess iconv is on FreeBSD 10.0. # defines['iconv_includes'] = ('none', 'none', '-I/usr/local/include -L/usr/local/lib') else: for gv in ['49', '48', '47']: gcc = '%s-portbld-freebsd%s-gcc%s' % (cpu, version, gv) if check.check_exe(gcc, gcc): defines['__cc'] = gcc break for gv in ['49', '48', '47']: gxx = '%s-portbld-freebsd%s-g++%s' % (cpu, version, gv) if check.check_exe(gxx, gxx): defines['__cxx'] = gxx break return defines
def load(): uname = os.uname() sysctl = "/sbin/sysctl " e = execute.capture_execution() exit_code, proc, output = e.shell(sysctl + "hw.ncpu") if exit_code == 0: ncpus = output.split(" ")[1].strip() else: ncpus = "1" if uname[4] == "amd64": cpu = "x86_64" else: cpu = uname[4] version = uname[2] if version.find("-") > 0: version = version.split("-")[0] defines = { "_ncpus": ("none", "none", ncpus), "_os": ("none", "none", "freebsd"), "_host": ("triplet", "required", cpu + "-freebsd" + version), "_host_vendor": ("none", "none", "pc"), "_host_os": ("none", "none", "freebsd"), "_host_os_version": ("none", "none", version), "_host_cpu": ("none", "none", cpu), "_host_alias": ("none", "none", "%{nil}"), "_host_arch": ("none", "none", cpu), "_usr": ("dir", "required", "/usr/local"), "_var": ("dir", "optional", "/usr/local/var"), "__bash": ("exe", "optional", "/usr/local/bin/bash"), "__bison": ("exe", "required", "/usr/local/bin/bison"), "__git": ("exe", "required", "/usr/local/bin/git"), "__svn": ("exe", "required", "/usr/local/bin/svn"), "__xz": ("exe", "optional", "/usr/bin/xz"), "__make": ("exe", "required", "gmake"), "__patch_opts": ("none", "none", "-E"), } defines["_build"] = defines["_host"] defines["_build_vendor"] = defines["_host_vendor"] defines["_build_os"] = defines["_host_os"] defines["_build_cpu"] = defines["_host_cpu"] defines["_build_alias"] = defines["_host_alias"] defines["_build_arch"] = defines["_host_arch"] # FreeBSD 10 and above no longer have /usr/bin/cvs, but it can (e.g.) be # installed to /usr/local/bin/cvs through the devel/cvs port if int(float(version)) >= 10: # # FreeBSD has switched to clang plus gcc. On 10.0 cc is gcc based and # clang is provided however it is not building binutils-2.24. # cc = "/usr/bin/cc" if check.check_exe(cc, cc): defines["__cc"] = cc else: cc = "/usr/bin/clang" if not check.check_exe(cc, cc): raise error.general("no valid cc found") cxx = "/usr/bin/c++" if check.check_exe(cxx, cxx): defines["__cxx"] = cxx else: cxx = "/usr/bin/clang++" if check.check_exe(cxx, cxx): raise error.general("no valid c++ found") # # Assume the compiler is clang and so we need to increase # bracket depth build build the gcc ARM compiler. # defines["build_cflags"] = "-O2 -pipe -fbracket-depth=1024" defines["build_cxxflags"] = "-O2 -pipe -fbracket-depth=1024" cvs = "cvs" if check.check_exe(cvs, cvs): defines["__cvs"] = cvs # # Fix the mess iconv is on FreeBSD 10.0. # defines["iconv_includes"] = ("none", "none", "-I/usr/local/include -L/usr/local/lib") else: for gv in ["49", "48", "47"]: gcc = "%s-portbld-freebsd%s-gcc%s" % (cpu, version, gv) if check.check_exe(gcc, gcc): defines["__cc"] = gcc break for gv in ["49", "48", "47"]: gxx = "%s-portbld-freebsd%s-g++%s" % (cpu, version, gv) if check.check_exe(gxx, gxx): defines["__cxx"] = gxx break return defines
def load(): # Default to the native Windows Python. uname = 'win32' if 'PROCESSOR_ARCHITECTURE' in os.environ: if os.environ['PROCESSOR_ARCHITECTURE'] == 'AMD64': hosttype = 'x86_64' machsize = '64' else: hosttype = 'i686' machsize = '32' else: hosttype = 'x86_64' machsize = '32' uname = 'mingw32' machine = 'w%s' % (machsize) # See if this is actually MSYS2/Cygwin Python if os.name == 'posix': _uname = os.uname() if _uname[0].startswith('MINGW'): pass elif _uname[0].startswith('CYGWIN'): hosttype = _uname[4] uname = 'cygwin' machine = 'pc' else: raise error.general('invalid POSIX python for Windows') host_triple = '%s-%s-%s' % (hosttype, machine, uname) build_triple = '%s-%s-%s' % (hosttype, machine, uname) if 'NUMBER_OF_PROCESSORS' in os.environ: ncpus = os.environ['NUMBER_OF_PROCESSORS'] else: ncpus = '1' if 'MSYSTEM' in os.environ: os.environ.pop('NUMBER_OF_PROCESSORS') version = uname[2] defines = { '_ncpus': ('none', 'none', ncpus), '_os': ('none', 'none', 'win32'), '_build': ('triplet', 'required', build_triple), '_build_vendor': ('none', 'none', 'microsoft'), '_build_os': ('none', 'none', 'win32'), '_build_os_version': ('none', 'none', version), '_build_cpu': ('none', 'none', hosttype), '_build_alias': ('none', 'none', '%{nil}'), '_build_arch': ('none', 'none', hosttype), '_host': ('triplet', 'required', host_triple), '_host_vendor': ('none', 'none', 'microsoft'), '_host_os': ('none', 'none', 'win32'), '_host_cpu': ('none', 'none', hosttype), '_host_alias': ('none', 'none', '%{nil}'), '_host_arch': ('none', 'none', hosttype), '_usr': ('dir', 'optional', '/opt/local'), '_var': ('dir', 'optional', '/opt/local/var'), '__bash': ('exe', 'required', 'bash'), '__bzip2': ('exe', 'required', 'bzip2'), '__bison': ('exe', 'required', 'bison'), '__cat': ('exe', 'required', 'cat'), '__cc': ('exe', 'required', 'gcc'), '__chgrp': ('exe', 'required', 'chgrp'), '__chmod': ('exe', 'required', 'chmod'), '__chown': ('exe', 'required', 'chown'), '__cp': ('exe', 'required', 'cp'), '__cvs': ('exe', 'optional', 'cvs'), '__cxx': ('exe', 'required', 'g++'), '__flex': ('exe', 'required', 'flex'), '__git': ('exe', 'required', 'git'), '__grep': ('exe', 'required', 'grep'), '__gzip': ('exe', 'required', 'gzip'), '__id': ('exe', 'required', 'id'), '__install': ('exe', 'required', 'install'), '__install_info': ('exe', 'required', 'install-info'), '__ld': ('exe', 'required', 'ld'), '__ldconfig': ('exe', 'none', ''), '__makeinfo': ('exe', 'required', 'makeinfo'), '__mkdir': ('exe', 'required', 'mkdir'), '__mv': ('exe', 'required', 'mv'), '__nm': ('exe', 'required', 'nm'), '__nm': ('exe', 'required', 'nm'), '__objcopy': ('exe', 'required', 'objcopy'), '__objdump': ('exe', 'required', 'objdump'), '__patch': ('exe', 'required', 'patch'), '__patch_bin': ('exe', 'required', 'patch'), '__rm': ('exe', 'required', 'rm'), '__sed': ('exe', 'required', 'sed'), '__sh': ('exe', 'required', 'sh'), '__tar': ('exe', 'required', 'bsdtar'), '__touch': ('exe', 'required', 'touch'), '__unzip': ('exe', 'required', 'unzip'), '__xz': ('exe', 'required', 'xz'), '_buildshell': ('exe', 'required', '%{__sh}'), '___setup_shell': ('exe', 'required', '%{__sh}') } # # Locate a suitable python to use with GDB. Python Windows is more # complicated than most hosts. There are 7 possible pythons on Windows and # we can use only 4 which are split on machine size. The types are: # # 1. Python27 - python.org, cannot use cause built with MSVC. # 2. Python35 - python.org, cannot use cause built with MSVC. # 3. MSYS/Python - MSYS2, cannot use cause it is a MSYS executable. # 4. W64/Python2 - Ok if machsize is 64 # 5. W64/Python3 - gdb-7.9 needs python2. # 6. W64/Python2 - Ok if machsize is 32 # 7. W64/Python3 - gdb-7.9 needs python2. # if sys.platform == 'win32' and 'MSC' in sys.version: raise error.general( 'python.org Pythons are built with MSC and cannot be linked with GDB' ) # # Search the MSYS2 install tree for a suitable python. # if sys.platform == 'msys': e = execute.capture_execution() exit_code, proc, output = e.shell("sh -c mount") if exit_code != 0: raise error.general('cannot get MSYS mount points') install_point = None for l in output.split('\n'): if ' on / ' in l: install_point = l.split()[0] break if install_point is None: raise error.general('cannot locate MSYS root mount point') if install_point[1] != ':': raise error.general('invalid MSYS root mount point: %s' % install_point) install_point = '/%s%s' % (install_point[0], install_point[2:]) bin = '/mingw%s/bin' % (machsize) bin_list = os.listdir(bin) exe = None for python in ['python2.exe']: for f in bin_list: if f == python: exe = install_point + os.path.join(bin, f) break if exe is not None: break if exe is None: raise error.general( 'no valid python found; you need a mingw%s python2 installed' % (machsize)) defines['with_python_path'] = exe return defines
def load(): # Default to the native Windows Python. uname = 'win32' if 'PROCESSOR_ARCHITECTURE' in os.environ: if os.environ['PROCESSOR_ARCHITECTURE'] == 'AMD64': hosttype = 'x86_64' machsize = '64' else: hosttype = 'i686' machsize = '32' else: hosttype = 'x86_64' machsize = '32' uname = 'mingw32' machine = 'w%s' % (machsize) # Set the C/C++ compilers we want to use. cc = '%s-%s-%s-gcc' % (hosttype, machine, uname) cxx = '%s-%s-%s-g++' % (hosttype, machine, uname) # See if this is actually MSYS2/Cygwin Python if os.name == 'posix': _uname = os.uname() if _uname[0].startswith('MINGW'): pass elif _uname[0].startswith('CYGWIN'): hosttype = _uname[4] uname = 'cygwin' machine = 'pc' cc = 'gcc' cxx = 'g++' else: raise error.general('invalid POSIX python for Windows') host_triple = '%s-%s-%s' % (hosttype, machine, uname) build_triple = '%s-%s-%s' % (hosttype, machine, uname) if 'NUMBER_OF_PROCESSORS' in os.environ: ncpus = os.environ['NUMBER_OF_PROCESSORS'] else: ncpus = '1' if 'MSYSTEM' in os.environ: os.environ.pop('NUMBER_OF_PROCESSORS') version = uname[2] defines = { '_ncpus': ('none', 'none', ncpus), '_os': ('none', 'none', 'win32'), '_build': ('triplet', 'required', build_triple), '_build_vendor': ('none', 'none', 'microsoft'), '_build_os': ('none', 'none', 'win32'), '_build_os_version': ('none', 'none', version), '_build_cpu': ('none', 'none', hosttype), '_build_alias': ('none', 'none', '%{nil}'), '_build_arch': ('none', 'none', hosttype), '_host': ('triplet', 'required', host_triple), '_host_vendor': ('none', 'none', 'microsoft'), '_host_os': ('none', 'none', 'win32'), '_host_cpu': ('none', 'none', hosttype), '_host_alias': ('none', 'none', '%{nil}'), '_host_arch': ('none', 'none', hosttype), '_usr': ('dir', 'optional', '/opt/local'), '_var': ('dir', 'optional', '/opt/local/var'), '__bash': ('exe', 'required', 'bash'), '__bzip2': ('exe', 'required', 'bzip2'), '__bison': ('exe', 'required', 'bison'), '__cat': ('exe', 'required', 'cat'), '__cc': ('exe', 'required', cc), '__chgrp': ('exe', 'required', 'chgrp'), '__chmod': ('exe', 'required', 'chmod'), '__chown': ('exe', 'required', 'chown'), '__cp': ('exe', 'required', 'cp'), '__cvs': ('exe', 'optional', 'cvs'), '__cxx': ('exe', 'required', cxx), '__flex': ('exe', 'required', 'flex'), '__git': ('exe', 'required', 'git'), '__grep': ('exe', 'required', 'grep'), '__gzip': ('exe', 'required', 'gzip'), '__id': ('exe', 'required', 'id'), '__install': ('exe', 'required', 'install'), '__install_info': ('exe', 'required', 'install-info'), '__ld': ('exe', 'required', 'ld'), '__ldconfig': ('exe', 'none', ''), '__makeinfo': ('exe', 'required', 'makeinfo'), '__mkdir': ('exe', 'required', 'mkdir'), '__mv': ('exe', 'required', 'mv'), '__nm': ('exe', 'required', 'nm'), '__nm': ('exe', 'required', 'nm'), '__objcopy': ('exe', 'required', 'objcopy'), '__objdump': ('exe', 'required', 'objdump'), '__patch': ('exe', 'required', 'patch'), '__patch_bin': ('exe', 'required', 'patch'), '__rm': ('exe', 'required', 'rm'), '__sed': ('exe', 'required', 'sed'), '__sh': ('exe', 'required', 'sh'), '__tar': ('exe', 'required', 'bsdtar'), '__touch': ('exe', 'required', 'touch'), '__unzip': ('exe', 'required', 'unzip'), '__xz': ('exe', 'required', 'xz'), '_buildshell': ('exe', 'required', '%{__sh}'), '___setup_shell': ('exe', 'required', '%{__sh}') } # # Locate a suitable python to use with GDB. Python Windows is more # complicated than most hosts. There are 7 possible pythons on Windows and # we can use only 4 which are split on machine size. The types are: # # 1. Python27 - python.org, cannot use cause built with MSVC. # 2. Python35 - python.org, cannot use cause built with MSVC. # 3. MSYS/Python - MSYS2, cannot use cause it is a MSYS executable. # 4. W64/Python2 - Ok if machsize is 64 # 5. W64/Python3 - gdb-7.9 needs python2. # 6. W64/Python2 - Ok if machsize is 32 # 7. W64/Python3 - gdb-7.9 needs python2. # if sys.platform == 'win32' and 'MSC' in sys.version: raise error.general('python.org Pythons are built with MSC and cannot be linked with GDB') # # Search the MSYS2 install tree for a suitable python. # if sys.platform == 'msys': e = execute.capture_execution() exit_code, proc, output = e.shell("sh -c mount") if exit_code != 0: raise error.general('cannot get MSYS mount points') install_point = None for l in output.split('\n'): if ' on / ' in l: install_point = l.split()[0] break if install_point is None: raise error.general('cannot locate MSYS root mount point') if install_point[1] != ':': raise error.general('invalid MSYS root mount point: %s' % install_point) install_point = '/%s%s' % (install_point[0], install_point[2:]) bin = '/mingw%s/bin' % (machsize) bin_list = os.listdir(bin) exe = None for python in ['python2.exe']: for f in bin_list: if f == python: exe = install_point + os.path.join(bin, f) break; if exe is not None: break if exe is None: raise error.general('no valid python found; you need a mingw%s python2 installed' % (machsize)) defines['with_python_path'] = exe return defines
def load(): uname = os.uname() smp_mflags = '' processors = '/bin/grep processor /proc/cpuinfo' e = execute.capture_execution() exit_code, proc, output = e.shell(processors) ncpus = 0 if exit_code == 0: try: for l in output.split('\n'): count = l.split(':')[1].strip() if int(count) > ncpus: ncpus = int(count) except: pass ncpus = str(ncpus + 1) if uname[4].startswith('arm'): cpu = 'arm' else: cpu = uname[4] version = uname[2] defines = { '_ncpus': ('none', 'none', ncpus), '_os': ('none', 'none', 'linux'), '_host': ('triplet', 'required', cpu + '-linux-gnu'), '_host_vendor': ('none', 'none', 'gnu'), '_host_os': ('none', 'none', 'linux'), '_host_os_version': ('none', 'none', version), '_host_cpu': ('none', 'none', cpu), '_host_alias': ('none', 'none', '%{nil}'), '_host_arch': ('none', 'none', cpu), '_usr': ('dir', 'required', '/usr'), '_var': ('dir', 'required', '/var'), '__bzip2': ('exe', 'required', '/usr/bin/bzip2'), '__gzip': ('exe', 'required', '/bin/gzip'), '__tar': ('exe', 'required', '/bin/tar') } # Works for LSB distros try: distro = platform.dist()[0] distro_ver = float(platform.dist()[1]) except ValueError: # Non LSB distro found, use failover" pass # Non LSB - fail over to issue if distro == '': try: issue = open('/etc/issue').read() distro = issue.split(' ')[0] distro_ver = float(issue.split(' ')[2]) except: pass # Manage distro aliases if distro in ['centos']: distro = 'redhat' elif distro in ['fedora']: if distro_ver < 17: distro = 'redhat' elif distro in ['centos', 'fedora']: distro = 'redhat' elif distro in ['Ubuntu', 'ubuntu', 'LinuxMint', 'linuxmint']: distro = 'debian' elif distro in ['Arch']: distro = 'arch' elif distro in ['SuSE']: distro = 'suse' variations = { 'debian' : { '__bzip2': ('exe', 'required', '/bin/bzip2'), '__chgrp': ('exe', 'required', '/bin/chgrp'), '__chown': ('exe', 'required', '/bin/chown'), '__grep': ('exe', 'required', '/bin/grep'), '__sed': ('exe', 'required', '/bin/sed') }, 'redhat' : { '__bzip2': ('exe', 'required', '/bin/bzip2'), '__chgrp': ('exe', 'required', '/bin/chgrp'), '__chown': ('exe', 'required', '/bin/chown'), '__install_info': ('exe', 'required', '/sbin/install-info'), '__grep': ('exe', 'required', '/bin/grep'), '__sed': ('exe', 'required', '/bin/sed'), '__touch': ('exe', 'required', '/bin/touch') }, 'fedora' : { '__chown': ('exe', 'required', '/usr/bin/chown'), '__install_info': ('exe', 'required', '/usr/sbin/install-info') }, 'arch' : { '__gzip': ('exe', 'required', '/usr/bin/gzip'), '__chown': ('exe', 'required', '/usr/bin/chown') }, 'suse' : { '__chgrp': ('exe', 'required', '/usr/bin/chgrp'), '__chown': ('exe', 'required', '/usr/sbin/chown') }, } if variations.has_key(distro): for v in variations[distro]: if path.exists(variations[distro][v][2]): defines[v] = variations[distro][v] defines['_build'] = defines['_host'] defines['_build_vendor'] = defines['_host_vendor'] defines['_build_os'] = defines['_host_os'] defines['_build_cpu'] = defines['_host_cpu'] defines['_build_alias'] = defines['_host_alias'] defines['_build_arch'] = defines['_host_arch'] return defines
def load(): # Default to the native Windows Python. uname = 'win32' if 'PROCESSOR_ARCHITECTURE' in os.environ: if os.environ['PROCESSOR_ARCHITECTURE'] == 'AMD64': hosttype = 'x86_64' machsize = '64' else: hosttype = 'i686' machsize = '32' else: hosttype = 'x86_64' machsize = '32' uname = 'mingw32' machine = 'w%s' % (machsize) # Set the C/C++ compilers we want to use. cc = '%s-%s-%s-gcc' % (hosttype, machine, uname) cxx = '%s-%s-%s-g++' % (hosttype, machine, uname) # See if this is actually MSYS2/Cygwin Python if os.name == 'posix': _uname = os.uname() if _uname[0].startswith('MINGW'): pass elif _uname[0].startswith('CYGWIN'): hosttype = _uname[4] uname = 'cygwin' machine = 'pc' cc = 'gcc' cxx = 'g++' else: raise error.general('invalid POSIX python for Windows') host_triple = '%s-%s-%s' % (hosttype, machine, uname) build_triple = '%s-%s-%s' % (hosttype, machine, uname) if 'NUMBER_OF_PROCESSORS' in os.environ: ncpus = os.environ['NUMBER_OF_PROCESSORS'] else: ncpus = '1' if 'MSYSTEM' in os.environ: os.environ.pop('NUMBER_OF_PROCESSORS') version = uname[2] defines = { '_ncpus': ('none', 'none', ncpus), '_os': ('none', 'none', 'win32'), '_windows_os': ('none', 'none', uname), '_build': ('triplet', 'required', build_triple), '_build_vendor': ('none', 'none', 'microsoft'), '_build_os': ('none', 'none', 'win32'), '_build_os_version': ('none', 'none', version), '_build_cpu': ('none', 'none', hosttype), '_build_alias': ('none', 'none', '%{nil}'), '_build_arch': ('none', 'none', hosttype), '_host': ('triplet', 'required', host_triple), '_host_vendor': ('none', 'none', 'microsoft'), '_host_os': ('none', 'none', 'win32'), '_host_cpu': ('none', 'none', hosttype), '_host_alias': ('none', 'none', '%{nil}'), '_host_arch': ('none', 'none', hosttype), '_usr': ('dir', 'optional', '/opt/local'), '_var': ('dir', 'optional', '/opt/local/var'), '__bash': ('exe', 'required', 'bash'), '__bzip2': ('exe', 'required', 'bzip2'), '__bison': ('exe', 'required', 'bison'), '__cat': ('exe', 'required', 'cat'), '__cc': ('exe', 'required', cc), '__chgrp': ('exe', 'required', 'chgrp'), '__chmod': ('exe', 'required', 'chmod'), '__chown': ('exe', 'required', 'chown'), '__cp': ('exe', 'required', 'cp'), '__cvs': ('exe', 'optional', 'cvs'), '__cxx': ('exe', 'required', cxx), '__flex': ('exe', 'required', 'flex'), '__git': ('exe', 'required', 'git'), '__grep': ('exe', 'required', 'grep'), '__gzip': ('exe', 'required', 'gzip'), '__id': ('exe', 'required', 'id'), '__install': ('exe', 'required', 'install'), '__install_info': ('exe', 'required', 'install-info'), '__ld': ('exe', 'required', 'ld'), '__ldconfig': ('exe', 'none', ''), '__makeinfo': ('exe', 'required', 'makeinfo'), '__mkdir': ('exe', 'required', 'mkdir'), '__mv': ('exe', 'required', 'mv'), '__nm': ('exe', 'required', 'nm'), '__nm': ('exe', 'required', 'nm'), '__objcopy': ('exe', 'required', 'objcopy'), '__objdump': ('exe', 'required', 'objdump'), '__patch': ('exe', 'required', 'patch'), '__patch_bin': ('exe', 'required', 'patch'), '__rm': ('exe', 'required', 'rm'), '__sed': ('exe', 'required', 'sed'), '__sh': ('exe', 'required', 'sh'), '__tar': ('exe', 'required', 'bsdtar'), '__touch': ('exe', 'required', 'touch'), '__unzip': ('exe', 'required', 'unzip'), '__xz': ('exe', 'required', 'xz'), '_buildshell': ('exe', 'required', '%{__sh}'), '___setup_shell': ('exe', 'required', '%{__sh}') } # # Locate a suitable python to use with GDB. Python Windows is more # complicated than most hosts. There are 7 possible pythons on Windows and # we can use only 4 which are split on machine size. The types are: # # 1. Python27 - python.org, cannot use cause built with MSVC. # 2. Python35 - python.org, cannot use cause built with MSVC. # 3. MSYS/Python - MSYS2, cannot use cause it is a MSYS executable. # 4. W64/Python2 - Ok if machsize is 64 # 5. W64/Python3 - gdb-7.9 needs python2. # 6. W64/Python2 - Ok if machsize is 32 # 7. W64/Python3 - gdb-7.9 needs python2. # # Find a suitable python2 and python3. # for p in os.environ['PATH'].split(os.pathsep): sh = os.path.join(p, 'sh.exe') if os.path.exists(sh) and os.path.isfile(sh): break sh = None if sh is None: raise error.general('cannot find a shell (sh.exe) in the PATH') # # Search the MSYS2 install tree for a suitable python. # if sys.platform == 'msys': e = execute.capture_execution() exit_code, proc, output = e.shell("sh -c mount") if exit_code != 0: raise error.general('cannot get MSYS mount points') install_point = None for l in output.split('\n'): if ' on / ' in l: install_point = l.split()[0] break if install_point is None: raise error.general('cannot locate MSYS root mount point') if install_point[1] != ':': raise error.general('invalid MSYS root mount point: %s' % install_point) install_point = path.shell(install_point) mingw = path.join(install_point, 'mingw%s' % (machsize)) if not path.exists(mingw) or not path.isdir(mingw): raise error.general('cannot find MinGW install: %s' % (path.host(mingw))) for version in ['2', '3']: python = 'python%s' % (version) exe = path.join(mingw, 'bin', '%s.exe' % (python)) if not path.exists(exe) or not path.isdir(exe): defines['gdb_python%s' % (version)] = exe header = path.join(mingw, python) return defines
def load(): uname = os.uname() sysctl = '/sbin/sysctl ' e = execute.capture_execution() exit_code, proc, output = e.shell(sysctl + 'hw.ncpu') if exit_code == 0: ncpus = output.split(' ')[1].strip() else: ncpus = '1' if uname[4] == 'amd64': cpu = 'x86_64' else: cpu = uname[4] version = uname[2] if version.find('-') > 0: version = version.split('-')[0] defines = { '_ncpus': ('none', 'none', ncpus), '_os': ('none', 'none', 'freebsd'), '_host': ('triplet', 'required', cpu + '-freebsd' + version), '_host_vendor': ('none', 'none', 'pc'), '_host_os': ('none', 'none', 'freebsd'), '_host_os_version': ('none', 'none', version), '_host_cpu': ('none', 'none', cpu), '_host_alias': ('none', 'none', '%{nil}'), '_host_arch': ('none', 'none', cpu), '_usr': ('dir', 'required', '/usr/local'), '_var': ('dir', 'optional', '/usr/local/var'), '__bash': ('exe', 'optional', '/usr/local/bin/bash'), '__bison': ('exe', 'required', '/usr/local/bin/bison'), '__git': ('exe', 'required', '/usr/local/bin/git'), '__svn': ('exe', 'required', '/usr/local/bin/svn'), '__xz': ('exe', 'optional', '/usr/bin/xz'), '__make': ('exe', 'required', 'gmake'), '__patch_opts': ('none', 'none', '-E') } defines['_build'] = defines['_host'] defines['_build_vendor'] = defines['_host_vendor'] defines['_build_os'] = defines['_host_os'] defines['_build_cpu'] = defines['_host_cpu'] defines['_build_alias'] = defines['_host_alias'] defines['_build_arch'] = defines['_host_arch'] # FreeBSD 10 and above no longer have /usr/bin/cvs, but it can (e.g.) be # installed to /usr/local/bin/cvs through the devel/cvs port if int(float(version)) >= 10: # # FreeBSD has switched to clang plus gcc. On 10.0 cc is gcc based and # clang is provided however it is not building binutils-2.24. # cc = '/usr/bin/cc' if check.check_exe(cc, cc): defines['__cc'] = cc else: cc = '/usr/bin/clang' if not check.check_exe(cc, cc): raise error.general('no valid cc not found') cxx = '/usr/bin/c++' if check.check_exe(cxx, cxx): defines['__cxx'] = cxx else: cxx = '/usr/bin/clang++' if check.check_exe(cxx, cxx): raise error.general('no valid c++ not found') defines['optflags_build'] = '-O2 -pipe -fbracket-depth=1024' cvs = 'cvs' if check.check_exe(cvs, cvs): defines['__cvs'] = cvs # # Fix the mess iconv is on FreeBSD 10.0. # defines['iconv_optincludes'] = ('none', 'none', '-I/usr/local/include -L/usr/local/lib') for gv in ['47', '48', '49']: gcc = '%s-portbld-freebsd%s-gcc%s' % (cpu, version, gv) if check.check_exe(gcc, gcc): defines['__cc'] = gcc break for gv in ['47', '48', '49']: gxx = '%s-portbld-freebsd%s-g++%s' % (cpu, version, gv) if check.check_exe(gxx, gxx): defines['__cxx'] = gxx break return defines