From 9bfc343e3b4860b93a7d00779ebf3966d868b776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois-Simon=20Fauteux-Chapleau?= <francois-simon.fauteux-chapleau@savoirfairelinux.com> Date: Fri, 22 Mar 2024 17:07:33 -0400 Subject: [PATCH] build: update build directories for RESTinio and OpenDHT The build.py script was not using the intended build directories for RESTinio and OpenDHT, and as a result many of the files created during the build process were not ignored by Git even though they should have been. Change-Id: Iba1d2447cf35dd3a7de7cd1de81955440cf83dfd --- dependencies/build.py | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/dependencies/build.py b/dependencies/build.py index eeadb07..e3c3499 100755 --- a/dependencies/build.py +++ b/dependencies/build.py @@ -27,8 +27,12 @@ restinio_dir = "restinio" install_dir = os.path.abspath("install") def build_and_install_restinio(): + # Setting flush=True because this script is called by CMake via the + # execute_process function, which by default doesn't print the content + # of standard output until the executed process returns. + print("\nBuilding and installing RESTinio...", flush=True) try: - restino_build_dir = restinio_dir + "/dev/" + restino_build_dir = os.path.join(restinio_dir, "dev", "cmake_build") cmake_command = [ "cmake", f"-DCMAKE_INSTALL_PREFIX={install_dir}", @@ -40,23 +44,25 @@ def build_and_install_restinio(): "-DRESTINIO_FIND_DEPS=ON", "-DRESTINIO_ALLOW_SOBJECTIZER=Off", "-DRESTINIO_USE_BOOST_ASIO=none", - "." + ".." ] + os.makedirs(restino_build_dir, exist_ok=True) subprocess.run(cmake_command, cwd=restino_build_dir, check=True) subprocess.run(["make", "-j8"], cwd=restino_build_dir, check=True) subprocess.run(["make", "install"], cwd=restino_build_dir, check=True) - print("restinio built and installed successfully.") + print("RESTinio built and installed successfully.") return True - except subprocess.CalledProcessError as e: - print("Error building or installing restinio: %s", e) + except (subprocess.CalledProcessError, OSError) as e: + print("Error building or installing restinio:", e) return False def build_and_install_opendht(): - print("Building and installing OpenDHT...") + print("\nBuilding and installing OpenDHT...", flush=True) try: - # Configure OpenDHT with CMake - subprocess.run(["cmake", ".", + opendht_build_dir = os.path.join(opendht_dir, "build") + cmake_command = [ + "cmake", "..", "-DCMAKE_INSTALL_PREFIX=" + install_dir, "-DCMAKE_PREFIX_PATH=" + install_dir, # For finding restinio "-DCMAKE_BUILD_TYPE=Release", @@ -67,18 +73,18 @@ def build_and_install_opendht(): "-DOPENDHT_DOCUMENTATION=OFF", "-DOPENDHT_HTTP=ON", "-DOPENDHT_PROXY_CLIENT=ON", - ], cwd=opendht_dir, check=True) - - # Build and install OpenDHT - subprocess.run(["make", "install"], cwd=opendht_dir, check=True) + ] + os.makedirs(opendht_build_dir, exist_ok=True) + subprocess.run(cmake_command, cwd=opendht_build_dir, check=True) + subprocess.run(["make", "install"], cwd=opendht_build_dir, check=True) print("OpenDHT installed successfully.") return True - except subprocess.CalledProcessError as e: - print("Error building or installing OpenDHT: %s", e) + except (subprocess.CalledProcessError, OSError) as e: + print("Error building or installing OpenDHT:", e) return False def build_and_install_pjproject(): - # Build PJSIP libraries + print("\nBuilding and installing PJSIP...", flush=True) try: configure_command = [ "./configure", -- GitLab