Fix cmake invocation.

This commit is contained in:
Jelmer Vernooij 2021-05-16 16:39:29 +01:00
parent 43222bc91d
commit 6f67102144
3 changed files with 19 additions and 2 deletions

View file

@ -784,7 +784,7 @@ class Meson(BuildSystem):
def _setup(self, session, fixers): def _setup(self, session, fixers):
if not session.exists("build"): if not session.exists("build"):
session.check_call(["mkdir", "build"]) session.mkdir("build")
run_with_build_fixers(session, ["meson", "setup", "build"], fixers) run_with_build_fixers(session, ["meson", "setup", "build"], fixers)
def clean(self, session, resolver, fixers): def clean(self, session, resolver, fixers):
@ -1077,6 +1077,8 @@ class Make(BuildSystem):
elif any([os.path.exists(os.path.join(path, n)) elif any([os.path.exists(os.path.join(path, n))
for n in ['configure.ac', 'configure.in', 'autogen.sh']]): for n in ['configure.ac', 'configure.in', 'autogen.sh']]):
self.name = 'autoconf' self.name = 'autoconf'
elif os.path.exists(os.path.join(path, "CMakeLists.txt")):
self.name = 'cmake'
else: else:
self.name = "make" self.name = "make"
@ -1122,6 +1124,10 @@ class Make(BuildSystem):
): ):
run_with_build_fixers(session, ["qmake"], fixers) run_with_build_fixers(session, ["qmake"], fixers)
if not makefile_exists() and session.exists('CMakeLists.txt'):
session.mkdir('build')
run_with_build_fixers(session, ["cmake", '..'], fixers, cwd='build')
def build(self, session, resolver, fixers): def build(self, session, resolver, fixers):
self.setup(session, resolver, fixers) self.setup(session, resolver, fixers)
self._run_make(session, ["all"], fixers) self._run_make(session, ["all"], fixers)
@ -1141,8 +1147,12 @@ class Make(BuildSystem):
if line.startswith("The project was not configured"): if line.startswith("The project was not configured"):
return True return True
return False return False
if session.exists('build'):
cwd = 'build'
else:
cwd = None
try: try:
run_with_build_fixers(session, ["make"] + args, fixers) run_with_build_fixers(session, ["make"] + args, fixers, cwd=cwd)
except UnidentifiedError as e: except UnidentifiedError as e:
if len(e.lines) < 5 and any([_wants_configure(line) for line in e.lines]): if len(e.lines) < 5 and any([_wants_configure(line) for line in e.lines]):
extra_args = [] extra_args = []

View file

@ -97,6 +97,9 @@ class PlainSession(Session):
def chdir(self, path): def chdir(self, path):
os.chdir(path) os.chdir(path)
def mkdir(self, path):
os.mkdir(path)
def external_path(self, path): def external_path(self, path):
return os.path.abspath(path) return os.path.abspath(path)

View file

@ -199,6 +199,10 @@ class SchrootSession(Session):
fullpath = self.external_path(path) fullpath = self.external_path(path)
return os.scandir(fullpath) return os.scandir(fullpath)
def mkdir(self, path: str):
fullpath = self.external_path(path)
return os.mkdir(fullpath)
def setup_from_vcs( def setup_from_vcs(
self, tree, include_controldir: Optional[bool] = None, subdir="package" self, tree, include_controldir: Optional[bool] = None, subdir="package"
): ):