zoukankan      html  css  js  c++  java
  • 使用rpmbuild制作rpm包

    使用rpmbuild制作rpm包

    这里以制作cmake-3.15.5为例,首先保证环境中安装有rpmbuild,其次下载cmake-3.15.5.tar.gz源代码包。

    1.  在/root目录下生成rpmbuild目录

    mkdir -p ~/rpmbuild/BUILD ~/rpmbuild/RPMS ~/rpmbuild/BUILDROOT ~/rpmbuild/SRPMS ~/rpmbuild/SOURCES ~/rpmbuild/SPECS

    2.  vi ~/rpmbuild/SPECS/cmake.spec 自动生成spec模板文件,并填写相关字段,现给出我的spec文件

    #
    # spec file for package cmake
    #
    # Copyright (c) 2020 SUSE LINUX Products GmbH, Nuernberg, Germany.
    #
    # All modifications and additions to the file contributed by third parties
    # remain the property of their copyright owners, unless otherwise agreed
    # upon. The license for this file, and modifications and additions to the
    # file, is the same license as for the pristine package itself (unless the
    # license for the pristine package is not an Open Source License, in which
    # case the license is the MIT License). An "Open Source License" is a
    # license that conforms to the Open Source Definition (Version 1.9)
    # published by the Open Source Initiative.

    # Please submit bugfixes or comments via http://bugs.opensuse.org/
    #

    %define version 3.15.5
    %define directory /usr/local

    Name: cmake
    Version: %{version}
    Release: 1%{?dist}
    License: GPL
    Summary: cmake tools
    # Url:
    # Group:
    Source: cmake-3.15.5.tar.gz
    # Patch:
    # BuildRequires:
    # PreReq:
    # Provides:
    BuildRoot: %{_tmppath}/%{name}-%{version}-build

    %description

    %prep
    %setup -q

    %build
    ./configure --prefix=%{directory}
    make %{?_smp_mflags}

    %install
    make install DESTDIR=%{buildroot} %{?_smp_mflags}
    %pre

    %preun

    %post

    %postun

    %clean
    rm -rf %{buildroot}

    %files
    %defattr(-,root,root)
    %{directory}/doc
    %{directory}/bin
    %{directory}/share

    %changelog

    3.  执行 rpmbuild -ba ~/rpmbuild/SPECS/cmake.spec

    接下来是比较长的编译和安装过程,执行成功的界面如下:

     以 exit 0 退出表示没有出错,然后在~/rpmbuild/RPMS/目录下可以看到形成了x86_64目录,该目录下有cmake-3.15.5-1.x86_64.rpm安装包:

     在~/rpmbuild/SRPMS/目录下形成了cmake-3.15.5-1.src.rpm安装包:

     到此,由源代码包制作rpm包的流程结束。

    4.  rpm -ivh ~/rpmbuild/RPM/x86_64/cmake-3.15.5-1.x86_64.rpm安装生成的rpm包:

     以上表示安装成功。

    5.  解析rpm包

    rpm –qpl *.rpm    # 列出rpm包包含的内容
    
    rpm2cpio *.rpm | cpio –div    # 解压rpm包
  • 相关阅读:
    递归删除文件夹目录及文件的方法
    委托delegate与Dictionary实现action选择器
    java.lang.NoClassDefFoundError: org/springframework/boot/bind/PropertiesConfigurationFactory
    pom文件找不都
    No qualifying bean of type '***' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations:
    记录一次sql查询union的优化
    countDownLatch问题为0 记录
    mapper文件一次空指针异常记录
    导出excel按照指定格式
    java导出pdf功能记录
  • 原文地址:https://www.cnblogs.com/tongyishu/p/12294523.html
Copyright © 2011-2022 走看看