summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStéphane Cerveau <scerveau@collabora.com>2020-05-18 18:20:10 +0200
committerTim-Philipp Müller <tim@centricular.com>2021-06-07 19:04:14 +0100
commit89378d039dceec57d735ef9c7ea021f2d7a05792 (patch)
tree430c41bfb7e266aff528419d81f4b7c55518503e
parent4d47bb5003afba2f5b806f37f7335a6778060c15 (diff)
build: fix the cmake template
In order to support a different build folder from a src folder where srcdir is not the root of the package folder, we need to to differentiate these 3 variables. -H will use make_dir(where cmakelist.txt is) -B will use build_dir where the build will be performed. make_dir after build_dir after configure because the Makefile is actually in the build_dir. Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/707>
-rw-r--r--cerbero/build/build.py14
-rw-r--r--cerbero/build/recipe.py4
2 files changed, 10 insertions, 8 deletions
diff --git a/cerbero/build/build.py b/cerbero/build/build.py
index 59a14027..34461181 100644
--- a/cerbero/build/build.py
+++ b/cerbero/build/build.py
@@ -405,12 +405,11 @@ class MakefilesBase (Build, ModifyEnvBase):
if not self.using_msvc():
self.setup_buildtype_env_ops()
- self.config_src_dir = os.path.abspath(os.path.join(self.build_dir,
- self.srcdir))
if self.requires_non_src_build:
self.make_dir = os.path.join (self.config_src_dir, "cerbero-build-dir")
else:
- self.make_dir = self.config_src_dir
+ self.make_dir = os.path.abspath(os.path.join(self.config_src_dir,
+ self.srcdir))
self.make = self.make or ['make', 'V=1']
self.make_install = self.make_install or ['make', 'install']
@@ -618,8 +617,8 @@ class CMake (MakefilesBase):
config_sh_needs_shell = False
config_sh = 'cmake'
configure_tpl = '%(config-sh)s -DCMAKE_INSTALL_PREFIX=%(prefix)s ' \
- '-H%(build_dir)s ' \
- '-B%(make_dir)s ' \
+ '-H%(make_dir)s ' \
+ '-B%(build_dir)s ' \
'-DCMAKE_LIBRARY_OUTPUT_PATH=%(libdir)s ' \
'-DCMAKE_INSTALL_LIBDIR=lib ' \
'-DCMAKE_INSTALL_BINDIR=bin ' \
@@ -630,7 +629,8 @@ class CMake (MakefilesBase):
def __init__(self):
MakefilesBase.__init__(self)
- self.make_dir = os.path.join(self.build_dir, '_builddir')
+ self.build_dir = os.path.join(self.build_dir, '_builddir')
+
@modify_environment
async def configure(self):
@@ -679,6 +679,8 @@ class CMake (MakefilesBase):
shutil.rmtree(cmake_files)
self.make += ['VERBOSE=1']
await MakefilesBase.configure(self)
+ # as build_dir is different from source dir, makefile location will be in build_dir.
+ self.make_dir = self.build_dir
MESON_FILE_TPL = \
'''
diff --git a/cerbero/build/recipe.py b/cerbero/build/recipe.py
index d4c4125f..3dfa8d76 100644
--- a/cerbero/build/recipe.py
+++ b/cerbero/build/recipe.py
@@ -258,8 +258,8 @@ SOFTWARE LICENSE COMPLIANCE.\n\n'''
self.repo_dir = os.path.join(self.config.local_sources,
self.package_name)
self.repo_dir = os.path.abspath(self.repo_dir)
- self.build_dir = os.path.join(self.config.sources, self.package_name)
- self.build_dir = os.path.abspath(self.build_dir)
+ self.build_dir = os.path.abspath(os.path.join(self.config.sources, self.package_name))
+ self.config_src_dir = self.build_dir
self.deps = self.deps or []
if self.config.prefix_is_build_tools():
if self.btype == build.BuildType.MESON: