Skip to content

[rpmbuild] make rpm package

dsindex edited this page Dec 30, 2014 · 1 revision
  • prepare source tarball
package_name-1.0.0.tar.gz
  • make spec file : package_name.spec
Summary: An implementation of .....
Name: package_name
Version: 1.0.0
Release: 1
License: GPL
Group: Development/Libraries/C and C++
Url: http://.....
Source: ac_x-%{version}.tar.gz

%define _topdir         %(echo "$HOME")/rpmbuild

Provides: libname
BuildRequires: make, gcc >= 3
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

%description
package_name is an implementation of .... 

%prep
%setup -q

%build
%configure
make

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT

%post

%preun

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc %{_docdir}/%{name}/COPYING
%doc %{_docdir}/%{name}/ABOUT
....
%doc %{_docdir}/%{name}/README
%{_bindir}/test_lib
%{_includedir}/header.h
%{_libdir}/libname.a
%{_libdir}/libname.la
%{_libdir}/libname.so

%changelog
* Fri Feb 28 2014 author <your@domain.com>
- first build of the package
....
  • make build directories
$ cd ~
$ tree BUILD RPMS SOURCES SPECS SRPMS
$ cp package_name-1.0.0.tar.gz SOURCES
$ cp package_name.spec SPECS
  • rpmbuild
$ rpmbuild -v -bb --clean SPECS/package_name.spec
Clone this wiki locally