" [default: %default]"))
parser.add_option("--src", action="append",
help=("Top-level source directory [default: %default]"))
- parser.add_option("--build", action="append", default=["debug"],
+ parser.add_option("--build", action="append",
help=("Build types to run [default: %default]"))
parser.add_option("--branch", action="append",
help=("Source branch to build [default: %default]"))
help=("Root install directory [default: %default]"))
parser.add_option("--builddir",
help=("Root build directory [default: %default]"))
+ parser.add_option("--extra-llvm-config-flags", default="",
+ help=("Extra flags to pass to llvm configure [default: %default]"))
+ parser.add_option("--extra-llvm-gcc-config-flags", default="",
+ help=("Extra flags to pass to llvm-gcc configure [default: %default]"))
+ parser.add_option("--extra-gcc-config-flags", default="",
+ help=("Extra flags to pass to gcc configure [default: %default]"))
+ parser.add_option("--force-configure", default=False, action="store_true",
+ help=("Force reconfigure of all components"))
return
def check_options(parser, options, valid_builds):
# See if we can find source directories.
for src in options.src:
- for component in ["llvm", "llvm-gcc", "gcc", "dragonegg"]:
+ for component in components:
+ component = component.rstrip("2")
compsrc = src + "/" + component
if (not os.path.isdir(compsrc)):
parser.error("'" + compsrc + "' does not exist")
class ExecutableNotFound(Exception): pass
class FileNotExecutable(Exception): pass
- def __init__(self, work_queue, jobs, cc, cxx, build_abbrev, source_abbrev,
- branch_abbrev, build_prefix, install_prefix):
+ def __init__(self, work_queue, jobs,
+ build_abbrev, source_abbrev, branch_abbrev,
+ options):
super().__init__()
self.work_queue = work_queue
self.jobs = jobs
- self.cc = cc
- self.cxx = cxx
+ self.cc = options.cc
+ self.cxx = options.cxx
self.build_abbrev = build_abbrev
self.source_abbrev = source_abbrev
self.branch_abbrev = branch_abbrev
- self.build_prefix = build_prefix
- self.install_prefix = install_prefix
+ self.build_prefix = options.builddir
+ self.install_prefix = options.prefix
+ self.options = options
self.component_abbrev = dict(
llvm="llvm",
llvm_gcc="lgcc",
configure_flags = dict(
llvm=dict(debug=["--prefix=" + self.install_prefix,
+ "--with-extra-options=-Werror",
+ "--enable-assertions",
+ "--disable-optimized",
"--with-cxx-include-root=" + cxxroot,
"--with-cxx-include-arch=" + cxxarch],
release=["--prefix=" + self.install_prefix,
+ "--with-extra-options=-Werror",
"--enable-optimized",
"--with-cxx-include-root=" + cxxroot,
"--with-cxx-include-arch=" + cxxarch],
paranoid=["--prefix=" + self.install_prefix,
+ "--with-extra-options=-Werror",
+ "--enable-assertions",
"--enable-expensive-checks",
+ "--disable-optimized",
"--with-cxx-include-root=" + cxxroot,
"--with-cxx-include-arch=" + cxxarch]),
llvm_gcc=dict(debug=["--prefix=" + self.install_prefix,
"--enable-checking",
"--program-prefix=llvm-",
"--enable-llvm=" + self.build_prefix + "/llvm/" + build_suffix,
- "--enable-languages=c,c++,fortran"],
+# Fortran install seems to be broken.
+# "--enable-languages=c,c++,fortran"],
+ "--enable-languages=c,c++"],
release=["--prefix=" + self.install_prefix,
"--program-prefix=llvm-",
"--enable-llvm=" + self.build_prefix + "/llvm/" + build_suffix,
- "--enable-languages=c,c++,fortran"],
+# Fortran install seems to be broken.
+# "--enable-languages=c,c++,fortran"],
+ "--enable-languages=c,c++"],
paranoid=["--prefix=" + self.install_prefix,
"--enable-checking",
"--program-prefix=llvm-",
"--enable-llvm=" + self.build_prefix + "/llvm/" + build_suffix,
- "--enable-languages=c,c++,fortran"]),
+# Fortran install seems to be broken.
+# "--enable-languages=c,c++,fortran"]),
+ "--enable-languages=c,c++"]),
llvm2=dict(debug=["--prefix=" + self.install_prefix,
+ "--with-extra-options=-Werror",
+ "--enable-assertions",
+ "--disable-optimized",
"--with-llvmgccdir=" + self.install_prefix + "/bin",
"--with-cxx-include-root=" + cxxroot,
"--with-cxx-include-arch=" + cxxarch],
release=["--prefix=" + self.install_prefix,
+ "--with-extra-options=-Werror",
"--enable-optimized",
"--with-llvmgccdir=" + self.install_prefix + "/bin",
"--with-cxx-include-root=" + cxxroot,
"--with-cxx-include-arch=" + cxxarch],
paranoid=["--prefix=" + self.install_prefix,
+ "--with-extra-options=-Werror",
+ "--enable-assertions",
"--enable-expensive-checks",
+ "--disable-optimized",
"--with-llvmgccdir=" + self.install_prefix + "/bin",
"--with-cxx-include-root=" + cxxroot,
"--with-cxx-include-arch=" + cxxarch]),
release=dict(),
paranoid=dict()))
- for component in ["llvm", "llvm-gcc", "llvm2", "gcc", "dragonegg"]:
+ for component in components:
comp = component[:]
srcdir = source + "/" + comp.rstrip("2")
if (branch is not None):
srcdir += "/" + branch
+ comp_key = comp.replace("-", "_")
+
+ config_args = configure_flags[comp_key][build][:]
+ config_args.extend(getattr(self.options,
+ "extra_" + comp_key.rstrip("2")
+ + "_config_flags").split())
+
self.logger.info("Configuring " + component + " in " + builddir)
self.configure(component, srcdir, builddir,
- configure_flags[comp.replace("-", "_")][build],
- configure_env[comp.replace("-", "_")][build])
+ config_args,
+ configure_env[comp_key][build])
self.logger.info("Building " + component + " in " + builddir)
self.make(component, srcdir, builddir,
- make_flags[comp.replace("-", "_")][build],
- make_env[comp.replace("-", "_")][build])
+ make_flags[comp_key][build],
+ make_env[comp_key][build])
self.logger.info("Installing " + component + " in " + installdir)
self.make(component, srcdir, builddir,
- make_install_flags[comp.replace("-", "_")][build],
- make_install_env[comp.replace("-", "_")][build])
+ make_install_flags[comp_key][build],
+ make_install_env[comp_key][build])
self.logger.info("Testing " + component + " in " + builddir)
self.make(component, srcdir, builddir,
- make_check_flags[comp.replace("-", "_")][build],
- make_check_env[comp.replace("-", "_")][build])
+ make_check_flags[comp_key][build],
+ make_check_env[comp_key][build])
def configure(self, component, srcdir, builddir, flags, env):
+ self.logger.debug("Configure " + str(flags) + " " + str(srcdir) + " -> "
+ + str(builddir))
+
configure_files = dict(
llvm=[(srcdir + "/configure", builddir + "/Makefile")],
llvm_gcc=[(srcdir + "/configure", builddir + "/Makefile"),
(srcdir + "/gcc/configure", builddir + "/gcc/Makefile")],
dragonegg=[()])
+
doconfig = False
for conf, mf in configure_files[component.replace("-", "_")]:
+ if not os.path.exists(conf):
+ return
if os.path.exists(conf) and os.path.exists(mf):
confstat = os.stat(conf)
makestat = os.stat(mf)
doconfig = True
break
- if not doconfig:
+ if not doconfig and not self.options.force_configure:
return
program = srcdir + "/configure"
# Global constants
build_abbrev = dict(debug="dbg", release="opt", paranoid="par")
+#components = ["llvm", "llvm-gcc", "llvm2", "gcc", "dragonegg"]
+components = ["llvm", "llvm2", "gcc", "dragonegg"]
# Parse options
parser = optparse.OptionParser(version="%prog 1.0")
format='%(name)-13s: %(message)s')
source_abbrev = get_path_abbrevs(set(options.src))
-branch_abbrev = get_path_abbrevs(set(options.branch))
+
+branch_abbrev = None
+if options.branch is not None:
+ branch_abbrev = get_path_abbrevs(set(options.branch))
work_queue = queue.Queue()
-for t in range(options.threads):
- jobs = options.jobs // options.threads
- builder = Builder(work_queue, jobs, options.cc.strip(), options.cxx.strip(),
+jobs = options.jobs // options.threads
+if jobs == 0:
+ jobs = 1
+
+numthreads = options.threads
+if jobs < numthreads:
+ numthreads = jobs
+ jobs = 1
+
+for t in range(numthreads):
+ builder = Builder(work_queue, jobs,
build_abbrev, source_abbrev, branch_abbrev,
- options.builddir.strip(), options.prefix.strip())
+ options)
builder.daemon = True
builder.start()