Skip to content

Instantly share code, notes, and snippets.

@AbigailBuccaneer
Last active January 25, 2016 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AbigailBuccaneer/54fe0d2d2ea11bc60162 to your computer and use it in GitHub Desktop.
Save AbigailBuccaneer/54fe0d2d2ea11bc60162 to your computer and use it in GitHub Desktop.
def glob_recursive(path, pattern, exclude=None):
import SCons.Node.FS
globbed = Dir(path).glob(pattern, exclude=exclude)
sources = []
for source in globbed:
if isinstance(source, SCons.Node.FS.Dir):
childpath = os.path.join(path, os.path.basename(source.path))
sources += glob_recursive(childpath, pattern, exclude=exclude)
else:
sources += [source]
return sources
def build_protoc(root_dir):
import os
sources = glob_recursive(root_dir, '*', exclude=['*.cache', 'usr', '*.o', '*.lo'])
env['protoc'] = File(os.path.join(root_dir, 'usr', 'bin', 'protoc'))
lib_targets = [
'libprotobuf.so.6',
'libprotobuf.so.6.0.0',
'libprotoc.so.6',
'libprotoc.so.6.0.0']
targets = [env['protoc']] + [File(os.path.join('usr', 'lib', x)) for x in lib_targets]
env['protoc_depends'] = targets
env.Command(targets,
sources,
"./autogen.sh && ./configure --prefix='%s' && make && make install" %
Dir(os.path.join(root_dir, 'usr')).abspath,
chdir=Dir(root_dir).abspath)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment