Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setup(flamegraph_directory, flamegraph_path, perf_map_agent_path, java_home):
"""Setup deps for flamegraph"""
# Create the flamegraph directory and clean the directory
if not os.path.exists(flamegraph_directory):
os.mkdir(flamegraph_directory)
for f in os.listdir(flamegraph_directory):
file_path = os.path.join(flamegraph_directory, f)
sh.sudo.rm(file_path)
if not os.path.exists(perf_map_agent_path):
sh.git('clone', 'https://github.com/jrudolph/perf-map-agent', perf_map_agent_path)
sh.cmake('.', _cwd=perf_map_agent_path, _env={'JAVA_HOME': java_home})
sh.make(_cwd=perf_map_agent_path)
if not os.path.exists(flamegraph_path):
sh.git('clone', 'https://github.com/brendangregg/FlameGraph', flamegraph_path)
def build_arch(self, arch):
super(LibSecp256k1Recipe, self).build_arch(arch)
env = self.get_recipe_env(arch)
with current_directory(self.get_build_dir(arch.arch)):
if not exists('configure'):
shprint(sh.Command('./autogen.sh'), _env=env)
shprint(sh.Command('./configure'), '--host=' + arch.toolchain_prefix,
'--prefix=' + self.ctx.get_python_install_dir(),
'--enable-shared',
'--enable-module-recovery',
'--enable-experimental',
'--enable-module-ecdh',
_env=env)
shprint(sh.make, '-j' + str(cpu_count()), _env=env)
libs = ['.libs/libsecp256k1.so']
self.install_libs(arch, *libs)
def recompile(pset):
"""Overwrite params.h and recompiles the speedbenchmark code"""
with open("../src/params.h", "w") as f:
f.write(str(pset))
sh.cd("speedbenchmark")
sh.make("clean")
sh.make()
sh.cd("../")
def recompile(pset):
"""Overwrite params.h and recompiles the speedbenchmark code"""
with open("../src/params.h", "w") as f:
f.write(str(pset))
sh.cd("speedbenchmark")
sh.make("clean")
sh.make()
sh.cd("../")
'-DCMAKE_CXX_COMPILER={toolchain}/bin/clang++'.format(
toolchain=env['TOOLCHAIN']),
'-DCMAKE_BUILD_TYPE=Release',
'-DCMAKE_INSTALL_PREFIX=./install',
'-DCMAKE_TOOLCHAIN_FILE=' + toolchain_file,
'-DANDROID_ABI={arch}'.format(arch=arch.arch),
'-DANDROID_ARM_NEON=ON',
'-DENABLE_NEON=ON',
# '-DREQUIRE_SIMD=1',
# Force disable shared, with the static ones is enough
'-DENABLE_SHARED=0',
'-DENABLE_STATIC=1',
_env=env)
shprint(sh.make, _env=env)
# copy static libs to libs collection
for lib in glob(join(build_dir, '*.a')):
shprint(sh.cp, '-L', lib, self.ctx.libs_dir)
'--host=' + arch.toolchain_prefix,
'--target=' + arch.toolchain_prefix,
'--prefix=' + self.ctx.get_python_install_dir(),
# Python bindings are compiled in a separated recipe
'--with-python=no',
'--with-gtk=no',
'--with-qt=no',
'--with-x=no',
'--with-jpeg=no',
'--with-imagemagick=no',
'--enable-pthread=no',
'--enable-video=no',
'--enable-shared=yes',
'--enable-static=no',
_env=env)
shprint(sh.make, '-j' + str(cpu_count()), _env=env)
libs = ['zbar/.libs/libzbar.so']
self.install_libs(arch, *libs)
mongo_c_driver = os.path.join(directory, "mongo-c-driver")
rm("-r", "-f", mongo_c_driver)
autogen_location = os.path.join(mongo_c_driver, "autogen.sh")
git.clone("https://github.com/mongodb/mongo-c-driver.git",
mongo_c_driver,
branch="1.1.5",
depth="1",
_out=write_output,
)
cd(mongo_c_driver)
autogen = sh.Command(autogen_location)
autogen(prefix="/usr", _out=write_output, _env=install_env)
make(_out=write_output, _env=install_env)
if os.environ.get("ZMAP_TRAVIS_BUILD", None):
print("Installing...")
with sudo:
make.install(_out=write_output, _env=install_env)
print("Done.")
def build_arch(self, arch):
env = self.get_recipe_env(arch)
with current_directory(self.get_build_dir(arch.arch)):
configure = sh.Command('./configure')
shprint(configure, '--without-readline', '--host=arm-linux',
_env=env)
shprint(sh.make, 'submake-libpq', _env=env)
shprint(sh.cp, '-a', 'src/interfaces/libpq/libpq.a',
self.ctx.get_libs_dir(arch.arch))
# libsodium_dir, 'src', 'libsodium', '.libs'))
curdir = self.get_build_dir(arch.arch)
prefix = join(curdir, "install")
with current_directory(curdir):
bash = sh.Command('sh')
shprint(
bash, './configure',
'--host={}'.format(arch.command_prefix),
'--without-documentation',
'--prefix={}'.format(prefix),
'--with-libsodium=no',
'--disable-libunwind',
_env=env)
shprint(sh.make, _env=env)
shprint(sh.make, 'install', _env=env)
def build_arch(self, arch):
env = self.get_recipe_env(arch)
with current_directory(self.get_build_dir(arch.arch)):
if not exists('configure'):
shprint(sh.Command('./autogen.sh'), _env=env)
shprint(sh.Command('autoreconf'), '-vif', _env=env)
shprint(sh.Command('./configure'),
'--host=' + arch.command_prefix,
'--prefix=' + self.get_build_dir(arch.arch),
'--disable-builddir',
'--enable-shared', _env=env)
shprint(sh.make, '-j', str(cpu_count()), 'libffi.la', _env=env)
host_build = self.get_build_dir(arch.arch)
ensure_dir(self.ctx.get_libs_dir(arch.arch))
shprint(sh.cp,
join(host_build, '.libs', 'libffi.so'),
self.ctx.get_libs_dir(arch.arch))