code: def build(src_dir, parallel_build=True):
      
      # TODO: use Gentoo or deb buildsystem
      config_script = os.path.join(src_dir, "configure")
      if os.path.isfile(config_script) and os.access(config_script, os.X_OK):
          logger.debug("Running ./configure in {cwd}".format(cwd=os.path.abspath(src_dir)))
          try:
              subprocess.check_call([config_script])
          except subprocess.CalledProcessError as e:
              raise AppBuilderException("./configure in target directory failed with exit code %d" % (e.returncode,))
      if os.path.isfile(os.path.join(src_dir, "Makefile")) \
          or os.path.isfile(os.path.join(src_dir, "makefile")) \
          or os.path.isfile(os.path.join(src_dir, "GNUmakefile")):
          if parallel_build:
              make_shortcmd = "make -j%d" % (NUM_CORES,)
          else:
              make_shortcmd = "make"
          logger.debug("Building with {make} in {cwd}".format(make=make_shortcmd, cwd=os.path.abspath(src_dir)))
          try:
              make_cmd = ["make", "-C", src_dir]
              if parallel_build:
                  make_cmd.append("-j" + str(NUM_CORES))
              subprocess.check_call(make_cmd)
          except subprocess.CalledProcessError as e:
              raise AppBuilderException("%s in target directory failed with exit code %d" % (make_shortcmd, e.returncode))
docs: Runs any build scripts that are found in the specified directory.
  
      In particular, runs ``./configure`` if it exists, followed by ``make -jN``
      if it exists (building with as many parallel tasks as there are CPUs on the
      system).