skip build perl if correct verison of perl install locally

This commit is contained in:
boypt
2025-02-21 14:42:21 +08:00
parent b3080da624
commit ee89f8b007

View File

@@ -118,7 +118,7 @@ PreReq: initscripts >= 5.00
%else
Requires: initscripts >= 5.20
%endif
BuildRequires: perl
#BuildRequires: perl
#%if ! %{without_openssl}
#BuildRequires: openssl-devel >= 1.1.1
#%endif
@@ -213,14 +213,29 @@ into and executing commands on a remote machine. This package contains
an X11 passphrase dialog for OpenSSH and the GNOME GUI desktop
environment.
%prep
%global perl_version_ok %( \
if command -v perl >/dev/null 2>&1; then \
perl -e ' \
if ($] >= 5.010) { \
print "1"; \
} else { \
print "0"; \
}; \
' \
else \
echo "0"; \
fi \
)
%prep
%if ! %{no_x11_askpass}
%setup -q -a 1
%else
%setup -q
%endif
# Applay a patch if glibc version is 2.5, not sure about other versions
%global glibc_version %(ldd --version 2>&1 | head -n1 | grep -oP '[0-9.]+')
echo "GLIBC version: %{glibc_version}"
%if "%{glibc_version}" <= "2.5"
@@ -228,7 +243,11 @@ echo "GLIBC version: %{glibc_version}"
%endif
%if ! %{no_build_openssl}
# Add install perl to ensure OpenSSL can be used.
# the OpenSSL build require perl version >= 5.10.0
# the EL5 perl in repo is 5.8, have to build our own.
%if "%{expand:%{perl_version_ok}}" == "0"
%define perl_dir %{_builddir}/%{name}-%{version}/perl
mkdir -p perl
tar xfz %{SOURCE4} --strip-components=1 -C perl
@@ -237,11 +256,14 @@ pushd perl
mkdir -p perlbin
./configure.gnu --prefix=$PWD/perlbin
make %{?_smp_mflags}
make install
make installperl
export PATH=$PWD/perlbin/bin:$PATH
popd
# Add content below to use source code of OpenSSL
# end of building perl
%endif
# Build OpenSSL
%define openssl_dir %{_builddir}/%{name}-%{version}/openssl
mkdir -p openssl
tar xfz %{SOURCE3} --strip-components=1 -C openssl
@@ -249,6 +271,8 @@ pushd openssl
./config shared zlib -fPIC
make %{?_smp_mflags}
popd
# end of ! %{no_build_openssl}
%endif
%build