diff --git a/build.py b/build.py index e970e18..fd1d6c6 100644 --- a/build.py +++ b/build.py @@ -19,13 +19,30 @@ def get_app_name(text): def get_qt_path(): try: - return str(subprocess.check_output(["qtpaths", "--binaries-dir"]), 'utf-8').strip() + return str(subprocess.check_output(["qtpaths6", "--binaries-dir"]), 'utf-8').strip() except: - print("A direct call to 'qtpaths' has failed so automatic retrieval of the QT bin folder is not possible.") + print("A direct call to 'qtpaths6' has failed so automatic retrieval of the QT bin folder is not possible.") return input("Please enter the QT bin path (leave blank to cancel the build): ") +def get_qt_lib_path(): + output = str(subprocess.check_output(["qtpaths6", "--query"]), 'utf-8').strip() + lines = output.split("\n") + ret = "" + + for line in lines: + if line.startswith("QT_HOST_LIBS:"): + ret = line[13:] + + if ret == "": + print("failed automatic retrieval of the QT lib folder.") + + return input("Please enter the QT lib path (leave blank to cancel the build): ") + + else: + return ret + def get_qt_from_cli(): for arg in sys.argv: if arg == "-qt_dir": @@ -90,7 +107,7 @@ def verbose_copy(src, dst): else: print("wrn: " + src + " does not exists. skipping.") -def linux_build_app_dir(app_ver, app_name, app_target, qt_bin): +def linux_build_app_dir(app_ver, app_name, app_target, qt_bin, qt_lib): if not os.path.exists("app_dir/lib"): os.makedirs("app_dir/lib") @@ -118,12 +135,8 @@ def linux_build_app_dir(app_ver, app_name, app_target, qt_bin): file_name = os.path.basename(src_file) verbose_copy(src_file, "app_dir/lib/" + file_name) - - if "/usr/lib/x86_64-linux-gnu/qt6/bin" == qt_bin: - verbose_copy(qt_bin + "/../../libQt6DBus.so.6", "app_dir/lib/libQt6DBus.so.6") - - else: - verbose_copy(qt_bin + "/../lib/libQt6DBus.so.6", "app_dir/lib/libQt6DBus.so.6") + + verbose_copy(qt_lib + "/libQt6DBus.so.6", "app_dir/lib/libQt6DBus.so.6") verbose_copy("templates/linux_run_script.sh", "app_dir/" + app_target + ".sh") verbose_copy("templates/linux_uninstall.sh", "app_dir/uninstall.sh") @@ -183,7 +196,7 @@ def platform_setup(): ins_packages = list_installed_packages() like_distro = get_like_distro() dep_pkgs_a = ["pkg-config", "make", "g++"] - dep_pkgs_b = ["ffmpeg", "libfuse-dev", "fuse3", "imagemagick"] + dep_pkgs_b = ["ffmpeg", "libfuse-dev", "fuse3", "imagemagick", "qt6-base-dev"] if not list_of_words_in_text(dep_pkgs_a, ins_packages) or not list_of_words_in_text(dep_pkgs_b, ins_packages): if ("ubuntu" in like_distro) or ("debian" in like_distro) or ("linuxmint" in like_distro): @@ -218,10 +231,16 @@ def main(): qt_bin = get_qt_path() if qt_bin != "": + qt_lib = get_qt_lib_path() + + if qt_lib == "": + exit(1) + print("app_target = " + app_target) print("app_version = " + app_ver) print("app_name = " + app_name) print("qt_bin = " + qt_bin) + print("qt_lib = " + qt_lib) cd() @@ -241,7 +260,7 @@ def main(): info_file.write(app_ver + "\n") info_file.write(app_name + "\n") - linux_build_app_dir(app_ver, app_name, app_target, qt_bin) + linux_build_app_dir(app_ver, app_name, app_target, qt_bin, qt_lib) if __name__ == "__main__":