Skip to content

Commit

Permalink
reverted some changes from #158
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Piskun <[email protected]>
  • Loading branch information
bigcat88 committed Nov 4, 2023
1 parent b2bf274 commit 163760f
Showing 1 changed file with 30 additions and 9 deletions.
39 changes: 30 additions & 9 deletions libheif/linux_build_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ def is_musllinux() -> bool:
return False


def is_library_installed(name: str) -> bool:
if name.find("main") != -1 and name.find("reference") != -1:
raise Exception("`name` param can not contain `main` and `reference` substrings.")
_r = run(f"gcc -l{name}".split(), stdout=PIPE, stderr=STDOUT, check=False)
if _r.stdout:
_ = _r.stdout.decode("utf-8")
if _.find("main") != -1 and _.find("reference") != -1:
return True
return False


def run_print_if_error(args) -> None:
_ = run(args, stdout=PIPE, stderr=STDOUT, check=False)
if _.returncode != 0:
Expand Down Expand Up @@ -202,15 +213,25 @@ def build_libs() -> None:
_original_dir = getcwd()
try:
if not tool_check_version("cmake", "3.13.4"):
raise ValueError("Can not find `cmake` with version >=3.13.4")
if not PH_LIGHT_VERSION:
if not check_install_nasm("2.15.05"):
raise ValueError("Can not find/install `nasm` with version >=2.15.05")
build_lib_linux(LIBX265_URL, "x265")
if not check_install_nasm("2.15.05"):
raise ValueError("Can not find/install `nasm` with version >=2.15.05")
build_lib_linux(LIBAOM_URL, "aom")
build_lib_linux(LIBDE265_URL, "libde265")
raise ValueError("Can not find `cmake` with version >=3.16.3")
if not is_library_installed("x265"):
if not PH_LIGHT_VERSION:
if not check_install_nasm("2.15.05"):
raise ValueError("Can not find/install `nasm` with version >=2.15.05")
build_lib_linux(LIBX265_URL, "x265")
else:
print("x265 already installed.")
if not is_library_installed("aom"):
if not PH_LIGHT_VERSION:
if not check_install_nasm("2.15.05"):
raise ValueError("Can not find/install `nasm` with version >=2.15.05")
build_lib_linux(LIBAOM_URL, "aom")
else:
print("aom already installed.")
if not is_library_installed("libde265") and not is_library_installed("de265"):
build_lib_linux(LIBDE265_URL, "libde265")
else:
print("libde265 already installed.")
build_lib_linux(LIBHEIF_URL, "libheif")
finally:
chdir(_original_dir)
Expand Down

0 comments on commit 163760f

Please sign in to comment.