Making RPM packet for Libmcrypt on CentOS 7 X86_64

1. Pre enviroement

First ,we have to install some necessary tools--rpmdevtools ,just type command as root user:

yum install -y rpmdevtools

2. Setup your directorys

It's so easy to complete that,follow me:

rpmdev-setuptree

You'll find some directorys in /root

/root/rpmbuild/
├── BUILD
├── BUILDROOT
├── RPMS
├── SOURCES
├── SPECS
└── SRPMS

3. Production

Get the source code from link
http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz

Then copy it to /root/rpmbuild/SOURCES and create a spec file libmcrypt-2.5.8.spec

Summary: libmcrypt is a data encryption library.
Name: libmcrypt
Version: 2.5.8
Release: 1
License: LGPL
Source: ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/%{name}-%{version}.tar.gz
Vendor: Nikos Mavroyanopoulos <nmav@gnutls.org>
Group: System Environment/Libraries
Packager: Germano Rizzo <mano@pluto.linux.it>
Buildroot: %{_tmppath}/%{name}-%{version}-root
BuildArch: x86_64
Prefix: /usr

%description
libmcrypt is a data encryption library. The library is thread safe
and provides encryption and decryption functions. This version of the
library supports many encryption algorithms and encryption modes. Some
algorithms which are supported:
SERPENT, RIJNDAEL, 3DES, GOST, SAFER+, CAST-256, RC2, XTEA, 3WAY,
TWOFISH, BLOWFISH, ARCFOUR, WAKE and more.

%package devel
Summary: Development files of the libmcrypt data encryption library.
Group: Development/Libraries
Requires: libmcrypt = %{version}

%description devel
Header file and static libraries of libmcrypt data encryption library.

%prep
%setup

%build
./configure --prefix=%{prefix} --libdir=/usr/lib64

make

%install
rm -rf $RPM_BUILD_ROOT

make DESTDIR=$RPM_BUILD_ROOT install

%clean
rm -rf ${RPM_BUILD_ROOT}

%post
ldconfig

%postun
ldconfig

%files
#%defattr(-, root, root, 0755)
%{_libdir}/libmcrypt.so
%{_libdir}/libmcrypt.so*

%files devel
#%defattr(-, root, root, 0755)
%doc doc/README* doc/example.c AUTHORS ChangeLog KNOWN-BUGS NEWS
%doc THANKS README TODO
%{_libdir}/libmcrypt.la
%{_includedir}/mcrypt.h
%{prefix}/man/man3/mcrypt.*
%{_bindir}/libmcrypt-config
%{_datadir}/aclocal/libmcrypt.m4

%changelog</pre>

The most critical moment coming,just one command,what?can't believe?I'll show you:

rpmbuild -bb /root/rpmbuild/SPECS/libmcrypt-2.5.8.spec

Everything is done! All RPM files are in /root/rpmbuild/RPMS

Let's try to install it.

rpm -ivh /root/rpmbuild/RPMS/x86_64/libmcrypt-2.5.8-1.x86_64.rpm  
rpm -ivh /root/rpmbuild/RPMS/x86_64/libmcrypt-devel-2.5.7-1.x86_64.rpm

2人评论了“Making RPM packet for Libmcrypt on CentOS 7 X86_64”

发表评论

滚动至顶部