Bug 1832205 - Only check perl when we need it. r=firefox-build-system-reviewers,sergesanspaille

... which turns out to be limited to configurations that build libopus,
libtheora and libvpx for ARM with GNU as. Nothing else in the tree
remains that is actively using the PERL variable.

Those uses might actually not even need a full perl installation, but
for now, let's go with what's easy.

Differential Revision: https://phabricator.services.mozilla.com/D177579
This commit is contained in:
Mike Hommey 2023-05-10 22:12:49 +00:00
Родитель b7269e3835
Коммит aafce08fe1
2 изменённых файлов: 50 добавлений и 43 удалений

Просмотреть файл

@ -498,49 +498,6 @@ def awk_for_old_configure(value):
add_old_configure_assignment("AWK", awk_for_old_configure)
# Perl detection
# ==============================================================
perl = check_prog("PERL", ("perl5", "perl"))
@template
def perl_version_check(min_version):
@depends(perl)
@checking("for minimum required perl version >= %s" % min_version)
def get_perl_version(perl):
return Version(
check_cmd_output(
perl,
"-e",
"print $]",
onerror=lambda: die("Failed to get perl version."),
)
)
@depends(get_perl_version)
def check_perl_version(version):
if version < min_version:
die("Perl %s or higher is required.", min_version)
@depends(perl)
@checking("for full perl installation")
@imports("subprocess")
def has_full_perl_installation(perl):
ret = subprocess.call([perl, "-e", "use Config; exit(!-d $Config{archlib})"])
return ret == 0
@depends(has_full_perl_installation)
def require_full_perl_installation(has_full_perl_installation):
if not has_full_perl_installation:
die(
"Cannot find Config.pm or $Config{archlib}. "
"A full perl installation is required."
)
perl_version_check("5.006")
# GNU make detection
# ==============================================================
option(env="MAKE", nargs=1, help="Path to GNU make")

Просмотреть файл

@ -3313,3 +3313,53 @@ set_config(
"STL_FLAGS",
depends(build_environment.dist)(lambda dist: [f"-I{dist}/stl_wrappers"]),
)
# Perl detection
# ==============================================================
@depends(target)
def need_perl(target):
# Ideally, we'd also depend on gnu_as here, but that adds complications.
return target.cpu == "arm"
perl = check_prog("PERL", ("perl5", "perl"), when=need_perl)
@template
def perl_version_check(min_version):
@depends(perl)
@checking("for minimum required perl version >= %s" % min_version)
def get_perl_version(perl):
return Version(
check_cmd_output(
perl,
"-e",
"print $]",
onerror=lambda: die("Failed to get perl version."),
)
)
@depends(get_perl_version)
def check_perl_version(version):
if version < min_version:
die("Perl %s or higher is required.", min_version)
@depends(perl)
@checking("for full perl installation")
@imports("subprocess")
def has_full_perl_installation(perl):
ret = subprocess.call([perl, "-e", "use Config; exit(!-d $Config{archlib})"])
return ret == 0
@depends(has_full_perl_installation)
def require_full_perl_installation(has_full_perl_installation):
if not has_full_perl_installation:
die(
"Cannot find Config.pm or $Config{archlib}. "
"A full perl installation is required."
)
with only_when(need_perl):
perl_version_check("5.006")