def install_debian_deps(self): actions = [ self.run( ShellQuoted('apt-get update && apt-get install -yq {deps}').format( deps=shell_join(' ', ( ShellQuoted(dep) for dep in self.debian_deps()))) ), ] gcc_version = self.option('gcc_version') # Make the selected GCC the default before building anything actions.extend([ self.run(ShellQuoted('apt-get install -yq {c} {cpp}').format( c=ShellQuoted('gcc-{v}').format(v=gcc_version), cpp=ShellQuoted('g++-{v}').format(v=gcc_version), )), self.run(ShellQuoted( 'update-alternatives --install /usr/bin/gcc gcc {c} 40 ' '--slave /usr/bin/g++ g++ {cpp}' ).format( c=ShellQuoted('/usr/bin/gcc-{v}').format(v=gcc_version), cpp=ShellQuoted('/usr/bin/g++-{v}').format(v=gcc_version), )), self.run(ShellQuoted('update-alternatives --config gcc')), ]) actions.extend(self.debian_ccache_setup_steps()) return self.step('Install packages for Debian-based OS', actions)
def cmake_install(self, name): cmake_defines = { 'BUILD_SHARED_LIBS': 'ON', 'CMAKE_INSTALL_PREFIX': self.option('prefix'), } cmake_defines.update( self.option('{0}:cmake_defines'.format(name), {}) ) return self.step('Build and install {0}'.format(name), [ self.workdir('build'), self.run(ShellQuoted('cmake {args} ..').format( args=shell_join(' ', ( ShellQuoted('-D{k}={v}').format(k=k, v=v) for k, v in cmake_defines.items() )) )), ] + self.make_and_install())
def configure(self, name=None): autoconf_options = {} if name is not None: autoconf_options.update( self.option('{0}:autoconf_options'.format(name), {}) ) return [ self.run(ShellQuoted( 'LDFLAGS="$LDFLAGS -L"{p}"/lib -Wl,-rpath="{p}"/lib" ' 'CFLAGS="$CFLAGS -I"{p}"/include" ' 'CPPFLAGS="$CPPFLAGS -I"{p}"/include" ' 'PY_PREFIX={p} ' './configure --prefix={p} {args}' ).format( p=self.option('prefix'), args=shell_join(' ', ( ShellQuoted('{k}={v}').format(k=k, v=v) for k, v in autoconf_options.items() )), )), ]
def cmake_configure(self, name): cmake_defines = { 'BUILD_SHARED_LIBS': 'ON', 'CMAKE_INSTALL_PREFIX': self.option('prefix'), } cmake_defines.update( self.option('{0}:cmake_defines'.format(name), {}) ) return [ self.run(ShellQuoted( 'CXXFLAGS="$CXXFLAGS -fPIC -isystem "{p}"/include" ' 'CFLAGS="$CFLAGS -fPIC -isystem "{p}"/include" ' 'cmake {args} ..' ).format( p=self.option('prefix'), args=shell_join(' ', ( ShellQuoted('-D{k}={v}').format(k=k, v=v) for k, v in cmake_defines.items() )), )), ]
def _make_vars(self, make_vars): return shell_join(' ', ( ShellQuoted('{k}={v}').format(k=k, v=v) for k, v in ({} if make_vars is None else make_vars).items() ))
def _render_impl(self, steps): return raw_shell(shell_join('\n', recursively_flatten_list(steps)))
def _make_vars(self, make_vars): return shell_join( ' ', (ShellQuoted('{k}={v}').format(k=k, v=v) for k, v in ({} if make_vars is None else make_vars).items()))