Support Canadian cross builds on FreeBSD (and other hosts).

Set up the rules to manage the separate host and build setting to
allow a Canadian cross to complete.

Update the scripts to move the build directory and host/build
flags into the defaults so they are common for all build
configurations.
This commit is contained in:
Chris Johns
2013-05-15 12:15:14 +10:00
parent 8a1e7a0ab0
commit db65c6aaf1
12 changed files with 126 additions and 72 deletions

View File

@@ -291,8 +291,7 @@ class build:
self.script.append('echo "==> %build:"')
_build = package.build()
for l in _build:
args = l.split()
self.script.append(' '.join(args))
self.script.append(l)
def install(self, package):
self.script.append('echo "==> %install:"')

View File

@@ -91,6 +91,7 @@ def _check_paths(name, paths):
return True
return False
def host_setup(opts):
""" Basic sanity check. All executables and directories must exist."""
@@ -125,6 +126,10 @@ def host_setup(opts):
return sane
def check_exe(label, exe):
return _check_exe(None, label, exe, None)
def run():
import sys
try:

View File

@@ -47,12 +47,19 @@ def load():
'_usr': ('dir', 'optional', '/usr/local'),
'_var': ('dir', 'optional', '/usr/local/var'),
'_prefix': ('dir', 'optional', '%{_usr}'),
'optflags': ('none', 'none', '-O2'),
'__ldconfig': ('exe', 'none', ''),
'__xz': ('exe', 'required', '%{_usr}/bin/xz'),
'with_zlib': ('none', 'none', '--with-zlib=no'),
'_forced_static': ('none', 'none', '')
}
defines['_build'] = defines['_host']
defines['_build_vendor'] = defines['_host_vendor']
defines['_build_os'] = defines['_host_os']
defines['_build_cpu'] = defines['_host_cpu']
defines['_build_alias'] = defines['_host_alias']
defines['_build_arch'] = defines['_host_arch']
return defines
if __name__ == '__main__':

View File

@@ -27,6 +27,7 @@
import pprint
import os
import check
import execute
def load():
@@ -46,25 +47,44 @@ def load():
if version.find('-') > 0:
version = version.split('-')[0]
defines = {
'_ncpus': ('none', 'none', ncpus),
'_os': ('none', 'none', 'freebsd'),
'_host': ('triplet', 'required', cpu + '-freebsd' + version),
'_host_vendor': ('none', 'none', 'pc'),
'_host_os': ('none', 'none', 'freebsd'),
'_host_cpu': ('none', 'none', cpu),
'_host_alias': ('none', 'none', '%{nil}'),
'_host_arch': ('none', 'none', cpu),
'_usr': ('dir', 'required', '/usr/local'),
'_var': ('dir', 'optional', '/usr/local/var'),
'optflags': ('none', 'none', '-O2 -I/usr/local/include -L/usr/local/lib'),
'__bash': ('exe', 'optional', '/usr/local/bin/bash'),
'__bison': ('exe', 'required', '/usr/local/bin/bison'),
'__git': ('exe', 'required', '/usr/local/bin/git'),
'__svn': ('exe', 'required', '/usr/local/bin/svn'),
'__xz': ('exe', 'optional', '/usr/bin/xz'),
'__make': ('exe', 'required', 'gmake'),
'__patch_opts': ('none', 'none', '-E')
'_ncpus': ('none', 'none', ncpus),
'_os': ('none', 'none', 'freebsd'),
'_host': ('triplet', 'required', cpu + '-freebsd' + version),
'_host_vendor': ('none', 'none', 'pc'),
'_host_os': ('none', 'none', 'freebsd'),
'_host_cpu': ('none', 'none', cpu),
'_host_alias': ('none', 'none', '%{nil}'),
'_host_arch': ('none', 'none', cpu),
'_usr': ('dir', 'required', '/usr/local'),
'_var': ('dir', 'optional', '/usr/local/var'),
'optincludes': ('none', 'none', '-I/usr/local/include -L/usr/local/lib'),
'__bash': ('exe', 'optional', '/usr/local/bin/bash'),
'__bison': ('exe', 'required', '/usr/local/bin/bison'),
'__git': ('exe', 'required', '/usr/local/bin/git'),
'__svn': ('exe', 'required', '/usr/local/bin/svn'),
'__xz': ('exe', 'optional', '/usr/bin/xz'),
'__make': ('exe', 'required', 'gmake'),
'__patch_opts': ('none', 'none', '-E')
}
defines['_build'] = defines['_host']
defines['_build_vendor'] = defines['_host_vendor']
defines['_build_os'] = defines['_host_os']
defines['_build_cpu'] = defines['_host_cpu']
defines['_build_alias'] = defines['_host_alias']
defines['_build_arch'] = defines['_host_arch']
for gv in ['47', '48', '49']:
gcc = '%s-portbld-freebsd%s-gcc%s' % (cpu, version, gv)
if check.check_exe(gcc, gcc):
defines['__cc'] = gcc
break
for gv in ['47', '48', '49']:
gxx = '%s-portbld-freebsd%s-g++%s' % (cpu, version, gv)
if check.check_exe(gxx, gxx):
defines['__cxx'] = gxx
break
return defines
if __name__ == '__main__':

View File

@@ -61,7 +61,6 @@ def load():
'_host_arch': ('none', 'none', cpu),
'_usr': ('dir', 'required', '/usr'),
'_var': ('dir', 'required', '/var'),
'optflags': ('none', 'none', '-O2 -pipe'),
'__bzip2': ('exe', 'required', '/usr/bin/bzip2'),
'__gzip': ('exe', 'required', '/bin/gzip'),
'__tar': ('exe', 'required', '/bin/tar')
@@ -120,6 +119,14 @@ def load():
for v in variations[distro]:
if path.exists(variations[distro][v][2]):
defines[v] = variations[distro][v]
defines['_build'] = defines['_host']
defines['_build_vendor'] = defines['_host_vendor']
defines['_build_os'] = defines['_host_os']
defines['_build_cpu'] = defines['_host_cpu']
defines['_build_alias'] = defines['_host_alias']
defines['_build_arch'] = defines['_host_arch']
return defines
if __name__ == '__main__':

View File

@@ -66,6 +66,11 @@ def load():
'_ncpus': ('none', 'none', ncpus),
'_os': ('none', 'none', 'win32'),
'_build': ('triplet', 'required', build_triple),
'_build_vendor': ('none', 'none', 'microsoft'),
'_build_os': ('none', 'none', 'win32'),
'_build_cpu': ('none', 'none', hosttype),
'_build_alias': ('none', 'none', '%{nil}'),
'_build_arch': ('none', 'none', hosttype),
'_host': ('triplet', 'required', host_triple),
'_host_vendor': ('none', 'none', 'microsoft'),
'_host_os': ('none', 'none', 'win32'),
@@ -111,8 +116,7 @@ def load():
'__unzip': ('exe', 'required', 'unzip'),
'__xz': ('exe', 'required', 'xz'),
'_buildshell': ('exe', 'required', '%{__sh}'),
'___setup_shell': ('exe', 'required', '%{__sh}'),
'optflags': ('none', 'none', '-O2 -pipe'),
'___setup_shell': ('exe', 'required', '%{__sh}')
}
return defines