RPM: from C to rpm package

Source: Internet
Author: User
Tags automake

In the words "Automake: from C to make", I started with a C language source code file and made a standard tar package.


How do I make an RPM package with a bar bag?


I have learned how to make RPM packages by referring to Linuxfans.org's article, "the RPM package principle (update 2010.11.22)". The following will show the process. establish a development environment first need software such as compilers

Yum Groupinstall "Development Tools"

and then do a little bit of the RPM configuration

Echo '%_topdir/home/lophyxp/rpm ' >> ~/.rpmmacros
echo '%debug_package%{nil} ' >> ~/.rpmmacros
Building a directory tree

MKDIR-VP ~/rpm/{sources,specs,build,rpms/x86_64,srpms}

Preparing source code Enter the Automake: from C to make in the directory, generate the TAR package, and copy to the sources directory

CD Hello
./configure make make
dist-xz

mv Hello/hello-0.01.tar.xz rpm/sources/

Prepare spec file

VI rpm/specs/hello.spec
====hello.spec============
#hello. Spec

Summary:hello World rpm package.
Name:hello
version:0.0.1
release:1
Source:%{name}-%{version}.tar.xz
LICENSE:GPL
Packager:lophyxp
group:applications/system
buildroot:%{_tmppath}/%{name}-%{version}-%{relase}- buildroot-% (%{__id_u}-N)%description this are
a software say hello world.

%prep
%setup-n%{name}-%{version}
%configure

%build make
%{?_smp_mflags} optimize= "%{optflags } "

%install
%makeinstall

%clean
%{__rm}-rf%{buildroot}%{__rm}-rf
%{_builddir}/%{name}" -%{version}

%files
%defattr (-,root,root)
%{_bindir}/hello

%changelog
* Sat Oct 08 2016 Lophyxp
-0.0.1-1-
==========================================

Making RPM Packages

Rpmbuild-ba rpm/specs/hello.spec
ls rpm/rpms/x86_64
ls Rpm/srpms
Get the RPM package and src.rpm package.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.