美文网首页
制作Cenots7 x86 openssl 3.1.2 spec

制作Cenots7 x86 openssl 3.1.2 spec

作者: 醉眼看人间_个个都温柔 | 来源:发表于2023-09-18 12:30 被阅读0次
    #!/bin/bash
    set -e
    set -v
    
    
    #wget https://www.openssl.org/source/openssl-3.1.2.tar.gz --no-check-certificate
    mkdir ~/openssl && cd ~/openssl
    yum -y install \
    curl \
    which \
    make \
    gcc \
    perl \
    perl-WWW-Curl \
    rpm-build \
    perl-IPC-Cmd
    
    
    # Get openssl tarball
    #cp /root/openssl-3.1.2.tar.gz ./
    
    
    # SPEC file
    cat << 'EOF' > ~/openssl/openssl.spec
    Summary: OpenSSL 3.1.2 for CentOS
    Name: openssl
    Version: %{?version}%{!?version:3.1.2}
    Release: 1%{?dist}
    Obsoletes: %{name} <= %{version}
    Provides: %{name} = %{version}
    URL: https://www.openssl.org/
    License: GPLv2+
    Vendor: YanShunwen
    
    
    Source: https://www.openssl.org/source/%{name}-%{version}.tar.gz
    
    
    BuildRequires: make gcc perl perl-WWW-Curl perl-IPC-Cmd
    BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
    %global openssldir /usr/openssl
    
    
    %description
    OpenSSL RPM for version 3.1.2 on CentOS
    
    
    %package devel
    Summary: Development files for programs which will use the openssl library
    Group: Development/Libraries
    Requires: %{name} = %{version}-%{release}
    
    
    %description devel
    OpenSSL RPM for version 3.1.2 on CentOS (development package)
    
    
    %prep
    %setup -q
    
    
    %build
    ./config --prefix=%{openssldir} --openssldir=%{openssldir}
    make
    
    
    %install
    [ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
    %make_install
    
    
    mkdir -p %{buildroot}%{_bindir}
    mkdir -p %{buildroot}%{_libdir}
    ln -sf %{openssldir}/lib/libssl.so.3 %{buildroot}%{_libdir}
    ln -sf %{openssldir}/lib/libcrypto.so.3 %{buildroot}%{_libdir}
    ln -sf %{openssldir}/bin/openssl %{buildroot}%{_bindir}
    
    
    %clean
    [ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
    
    
    %files
    %{openssldir}
    %defattr(-,root,root)
    /usr/bin/openssl
    /usr/lib64/libcrypto.so.3
    /usr/lib64/libssl.so.3
    
    
    %files devel
    %{openssldir}/include/*
    %defattr(-,root,root)
    
    
    %post
    /usr/bin/cat /etc/ld.so.conf | grep -wq '/lib'  >/dev/null 2>&1 || echo  "/lib" >> /etc/ld.so.conf
    /usr/bin/cat /etc/ld.so.conf | grep -wq '/lib64'  >/dev/null 2>&1 || echo "/lib64" >> /etc/ld.so.conf
    /usr/bin/cat /etc/ld.so.conf | grep -wq '/usr/lib'  >/dev/null 2>&1 || echo "/usr/lib" >> /etc/ld.so.conf
    /usr/bin/cat /etc/ld.so.conf | grep -wq '/usr/lib64'  >/dev/null 2>&1 || echo "/usr/lib64" >> /etc/ld.so.conf
    /usr/bin/cat /etc/ld.so.conf | grep -wq '/usr/openssl/lib'  >/dev/null 2>&1 || echo "/usr/openssl/lib" >> /etc/ld.so.conf
    /usr/bin/cat /etc/ld.so.conf | grep -wq '/usr/openssl/lib64'  >/dev/null 2>&1 || echo "/usr/openssl/lib64" >> /etc/ld.so.conf
    /usr/bin/cat /etc/ld.so.conf | grep -wq '/usr/local/lib'  >/dev/null 2>&1 || echo "/usr/local/lib" >> /etc/ld.so.conf
    /usr/bin/cat /etc/ld.so.conf | grep -wq '/usr/local/lib64'  >/dev/null 2>&1 || echo "/usr/local/lib64" >> /etc/ld.so.conf
    /usr/bin/cat /etc/ld.so.conf | grep -wq '/var/lib'  >/dev/null 2>&1 || echo "/var/lib" >> /etc/ld.so.conf
    /sbin/ldconfig
    
    
    %postun -p /sbin/ldconfig
    EOF
    
    mkdir -p /root/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
    cp ~/openssl/openssl.spec /root/rpmbuild/SPECS/openssl.spec
    
    
    mv openssl-3.1.2.tar.gz /root/rpmbuild/SOURCES
    cd /root/rpmbuild/SPECS && \
    rpmbuild \
    -D "version 3.1.2" \
    -ba openssl.spec
    
    

    相关文章

      网友评论

          本文标题:制作Cenots7 x86 openssl 3.1.2 spec

          本文链接:https://www.haomeiwen.com/subject/dusgvdtx.html