Last active
January 25, 2016 14:38
-
-
Save AbigailBuccaneer/54fe0d2d2ea11bc60162 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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