# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+from __future__ import print_function
import os
import sys
import shutil
def package(self, project, checkout):
tree = globals.trees.get(project, checkout, self)
tree.build_dependencies()
- tree.build(tree)
+ tree.build()
return tree.call('package', tree.version), tree.git_commit
def test(self, tree):
self.set('CXXFLAGS', '-I%s/include' % self.directory)
self.set('CPPFLAGS', '')
self.set('LINKFLAGS', '-L%s/lib' % self.directory)
- self.set('PKG_CONFIG_PATH', '%s/lib/pkgconfig:/usr/local/lib/pkgconfig' % self.directory)
+ self.set('PKG_CONFIG_PATH', '%s/lib/pkgconfig:%s/lib64/pkgconfig:/usr/local/lib/pkgconfig' % (self.directory, self.directory))
self.set('PATH', '/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin')
class ChrootTarget(LinuxTarget):
if len(p) != 3:
raise Error("Bad Linux target name `%s'; must be something like ubuntu-12.04-32 (i.e. distro-version-bits)" % s)
target = ChrootTarget(p[0], p[1], int(p[2]), work)
+ elif s.startswith('arch-'):
+ p = s.split('-')
+ if len(p) != 2:
+ raise Error("Bad Arch target name `%s'; must be arch-32 or arch-64")
+ target = ChrootTarget(p[0], None, p[1], work)
elif s == 'raspbian':
target = ChrootTarget(s, None, None, work)
elif s == 'host':
+ if command_and_read('uname -m').read().strip() == 'x86_64':
+ bits = 64
+ else:
+ bits = 32
try:
f = open('/etc/fedora-release', 'r')
l = f.readline().strip().split()
- if command_and_read('uname -m').read().strip() == 'x86_64':
- bits = 64
- else:
- bits = 32
target = HostTarget("fedora", l[2], bits, work)
except Exception as e:
- raise Error("could not identify distribution for `host' target (%s)" % e)
+ if os.path.exists('/etc/arch-release'):
+ target = HostTarget("arch", None, bits, work)
+ else:
+ raise Error("could not identify distribution for `host' target (%s)" % e)
elif s.startswith('osx-'):
target = OSXSingleTarget(int(s.split('-')[1]), work)
elif s == 'osx':
proj = '%s/src/%s' % (target.directory, self.name)
self.cscript = {}
- execfile('%s/cscript' % proj, self.cscript)
+ exec(open('%s/cscript' % proj).read(), self.cscript)
if os.path.exists('%s/wscript' % proj):
v = read_wscript_variable(proj, "VERSION");
with TreeDirectory(self):
return self.cscript[function](self.target, *args)
- def build_dependencies(self):
+ def build_dependencies(self, options=None):
if 'dependencies' in self.cscript:
- for d in self.cscript['dependencies'](self.target):
+ if len(inspect.getargspec(self.cscript['dependencies']).args) == 2:
+ deps = self.call('dependencies', options)
+ else:
+ deps = self.call('dependencies')
+
+ for d in deps:
log('Building dependency %s %s of %s' % (d[0], d[1], self.name))
dep = globals.trees.get(d[0], d[1], self.target)
- dep.build_dependencies()
# Make the options to pass in from the option_defaults of the thing
# we are building and any options specified by the parent.
for k, v in d[2].items():
options[k] = v
+ dep.build_dependencies(options)
dep.build(options)
def build(self, options=None):