Commit de1cd7e3 by Thomas Barabosch

Exchanged Travis CI badge, fixed SCONS to work with dockcross x86

parent aca168b6
# cwe_checker #
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/9dbf158110de427d893b40ba397b94bc)](https://www.codacy.com/app/weidenba/cwe_checker?utm_source=github.com&utm_medium=referral&utm_content=fkie-cad/cwe_checker&utm_campaign=Badge_Grade)
[![Build Status](https://travis-ci.com/fkie-cad/cwe_checker.svg?branch=master)](https://travis-ci.com/fkie-cad/cwe_checker)
[![Build Status](https://travis-ci.org/fkie-cad/cwe_checker.svg?branch=master)](https://travis-ci.org/fkie-cad/cwe_checker)
![Docker-Pulls](https://img.shields.io/docker/pulls/fkiecad/cwe_checker.svg)
## What is cwe_checker? ##
*cwe_checker* detects common bug classes such as use of dangerous functions and simple integer overflows. These bug classes are formally known as [Common Weakness Enumerations](https://cwe.mitre.org/) (CWEs). Its main goal is to aid analysts to quickly find vulnerable code paths.
......
......@@ -10,6 +10,8 @@ c_compilers = {'x64': 'gcc',
'mips': 'mips-linux-gnu-gcc',
'ppc': 'powerpc-linux-gnu-gcc'}
c_linkers = {'x86': './dockcross-linux-x86 gcc -m32'}
cpp_compilers = {'x64': 'g++',
'x86': './dockcross-linux-x86 g++',
'arm': 'arm-linux-gnueabi-g++-5',
......@@ -28,10 +30,15 @@ cpp_flags = {'x64': '-g -fno-stack-protector',
'mips': '-g -fno-stack-protector',
'ppc': '-g -fno-stack-protector'}
cpp_linkers = {'x86': './dockcross-linux-x86 g++ -m32'}
def which(pgm):
path=os.getenv('PATH')
# TODO: check if dockcross containers are installed
if pgm.startswith('.'):
return pgm
path = os.getenv('PATH')
for p in path.split(os.path.pathsep):
p=os.path.join(p,pgm)
p = os.path.join(p,pgm)
if os.path.exists(p) and os.access(p,os.X_OK):
return p
......@@ -53,9 +60,13 @@ def build_c(arch):
if compile_only_on_x64(str(p), arch):
print('Skipping architecture %s for %s' % (arch, str(p)))
continue
env = Environment(CC = c_compilers[arch],
CCFLAGS = c_flags[arch] + optimize(str(p)))
print(str(p))
env = Environment()
env['CC'] = c_compilers[arch]
env['CCFLAGS'] = c_flags[arch] + optimize(str(p))
if arch in c_linkers:
env['LINK'] = c_linkers[arch]
env.Program('%s/%s_%s.out' % (build_path, str(p).split('.')[0], arch),
env.Object(target='%s/%s_%s.o' % (build_path, str(p), arch),
source='%s/%s' % (build_path, str(p))))
......@@ -67,10 +78,15 @@ def build_cpp(arch):
if which(cpp_compilers[arch]) is not None:
cpp_programs = Glob('*.cpp')
for p in cpp_programs:
env = Environment(CC = cpp_compilers[arch],
CCFLAGS = cpp_flags[arch] + optimize(str(p)))
env = Environment()
env['CCP'] = cpp_compilers[arch]
env['CCPFLAGS'] = cpp_flags[arch] + optimize(str(p))
if arch in c_linkers:
env['CPPLINK'] = cpp_linkers[arch]
env.Program('%s/%s_%s.out' % (build_path, str(p).split('.')[0], arch),
'%s/%s' % (build_path, str(p)))
env.Object(target='%s/%s_%s.o' % (build_path, str(p), arch),
source='%s/%s' % (build_path, str(p))))
else:
print('Compiler %s for architecture %s is not installed!' % (cpp_compilers[arch], arch))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment