Skip to content

Commit ec8c6f8

Browse files
committed
Build library using CMake
Signed-off-by: Bence Szépkúti <[email protected]>
1 parent 5926f58 commit ec8c6f8

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

scripts/mbedtls_framework/abi_check.py

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def __init__(self, old_version, new_version, configuration):
138138
self.check_storage_tests = configuration.check_storage
139139
self.brief = configuration.brief
140140
self.git_command = "git"
141-
self.make_command = "make"
141+
self.cmake_command = "cmake"
142142

143143
def _setup_logger(self):
144144
self.log = logging.getLogger()
@@ -150,6 +150,7 @@ def _setup_logger(self):
150150

151151
@staticmethod
152152
def check_abi_tools_are_installed():
153+
return
153154
for command in ["abi-dumper", "abi-compliance-checker"]:
154155
if not shutil.which(command):
155156
raise Exception("{} not installed, aborting".format(command))
@@ -211,23 +212,30 @@ def _update_git_submodules(self, git_worktree_path, version):
211212

212213
def _build_shared_libraries(self, git_worktree_path, version):
213214
"""Build the shared libraries in the specified worktree."""
214-
my_environment = os.environ.copy()
215-
my_environment["CFLAGS"] = "-g -Og"
216-
my_environment["SHARED"] = "1"
217-
218-
if os.path.exists(os.path.join(git_worktree_path, "scripts", "legacy.make")):
219-
command = [self.make_command, "-f", "scripts/legacy.make", "lib"]
220-
else:
221-
command = [self.make_command, "lib"]
215+
build_dir = os.path.join(git_worktree_path, "build")
216+
os.mkdir(build_dir)
217+
configure_output = subprocess.check_output(
218+
[
219+
self.cmake_command, "..",
220+
"-DCMAKE_BUILD_TYPE=Debug",
221+
"-DENABLE_TESTING=OFF",
222+
"-DENABLE_PROGRAMS=OFF",
223+
"-DUSE_SHARED_MBEDTLS_LIBRARY=ON",
224+
"-DUSE_STATIC_MBEDTLS_LIBRARY=OFF",
225+
"-DUSE_SHARED_TF_PSA_CRYPTO_LIBRARY=ON",
226+
"-DUSE_STATIC_TF_PSA_CRYPTO_LIBRARY=OFF",
227+
],
228+
cwd=build_dir,
229+
stderr=subprocess.STDOUT
230+
)
231+
self.log.debug(configure_output.decode("utf-8"))
222232

223-
make_output = subprocess.check_output(
224-
command,
225-
env=my_environment,
226-
cwd=git_worktree_path,
233+
build_output = subprocess.check_output(
234+
[self.cmake_command, "--build", build_dir],
227235
stderr=subprocess.STDOUT
228236
)
229-
self.log.debug(make_output.decode("utf-8"))
230-
for root, _dirs, files in os.walk(git_worktree_path):
237+
self.log.debug(build_output.decode("utf-8"))
238+
for root, _dirs, files in os.walk(build_dir):
231239
for file in fnmatch.filter(files, "*.so"):
232240
version.modules[os.path.splitext(file)[0]] = (
233241
os.path.join(root, file)
@@ -370,6 +378,7 @@ def _get_storage_format_tests(self, version, git_worktree_path):
370378

371379
def _cleanup_worktree(self, git_worktree_path):
372380
"""Remove the specified git worktree."""
381+
return
373382
shutil.rmtree(git_worktree_path)
374383
submodule_output = subprocess.check_output(
375384
[self.git_command, "submodule", "foreach", "--recursive",

0 commit comments

Comments
 (0)