1 在rpmbuild/SOURCE中放入
a) tiobench-0.3.3.tgz
b) 在rpmbuild/SOURCE中建立help目录,和tiotest.man文件
tiobench-0.3.3.tgz解压后有如下文件
tar -xvf tiobench-0.3.3.tgz
tiobench-0.3.3/crc32.c
tiobench-0.3.3/tiotest.c
tiobench-0.3.3/crc32.h
tiobench-0.3.3/tiotest.h
tiobench-0.3.3/Makefile
tiobench-0.3.3/COPYING
tiobench-0.3.3/README
tiobench-0.3.3/TODO
tiobench-0.3.3/ChangeLog
tiobench-0.3.3/BUGS
tiobench-0.3.3/tiobench.pl
tiobench-0.3.3/tiosum.pl
tiobench-0.3.3/scripts/
tiobench-0.3.3/scripts/CVS/
tiobench-0.3.3/scripts/CVS/Root
tiobench-0.3.3/scripts/CVS/Repository
tiobench-0.3.3/scripts/CVS/Entries
tiobench-0.3.3/scripts/bigbench.sh
tiobench-0.3.3/scripts/README
tiobench-0.3.3/scripts/makeimages.pl
[root@localhost SOURCES]#
2 spec文件的内容
Name: tiobench
Version: 0.3.3
Release: 1%{?dist}
Summary: tiotest rpm package
Group: Development/Tools
License: qemu
URL:
Source0: %{name}-%{version}.tgz
Source1: tiotest.man
BuildRoot: %{name}-%{version}-root
%description
tiotest rpm package
%prep
%setup -n %{name}-%{version}
%build
make
%install
mkdir -p $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/usr/local/bin
mkdir -p $RPM_BUILD_ROOT/usr/local/doc
cp $RPM_BUILD_DIR/%{name}-%{version}/tiotest $RPM_BUILD_ROOT/usr/local/bin
cp $RPM_BUILD_DIR/%{name}-%{version}/tiobench.pl $RPM_BUILD_ROOT/usr/local/bin
install -m 755 %{SOURCE1} $RPM_BUILD_ROOT/usr/local/doc (%{SOURCE1}为文件/root/rpmbuild/SOURCE/tiotest.man)
tar -c help/ |tar -x -C $RPM_BUILD_ROOT/usr/local/doc (tar的当前为BUILD/tiobench-0.3.3,可以参考以下脚本文件)
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc
/usr/local/bin/*
/usr/local/doc/*
%changelog
* Wed May 6 2015 qemu modify
- add tiotest
3 中间涉及的脚本,在/var/tmp/目录
#!/bin/sh
RPM_SOURCE_DIR="/root/rpmbuild/SOURCES"
RPM_BUILD_DIR="/root/rpmbuild/BUILD"
RPM_OPT_FLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic"
RPM_ARCH="x86_64"
RPM_OS="linux"
export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS
RPM_DOC_DIR="/usr/share/doc"
export RPM_DOC_DIR
RPM_PACKAGE_NAME="tiobench"
RPM_PACKAGE_VERSION="0.3.3"
RPM_PACKAGE_RELEASE="1.el6"
export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE
LANG=C
export LANG
unset CDPATH DISPLAY ||:
RPM_BUILD_ROOT="/root/rpmbuild/BUILDROOT/tiobench-0.3.3-1.el6.x86_64"
export RPM_BUILD_ROOT
PKG_CONFIG_PATH="/usr/lib64/pkgconfig:/usr/share/pkgconfig"
export PKG_CONFIG_PATH
set -x
umask 022
cd "/root/rpmbuild/BUILD"
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"
mkdir -p `dirname "$RPM_BUILD_ROOT"`
mkdir "$RPM_BUILD_ROOT"
cd 'tiobench-0.3.3'
LANG=C
export LANG
unset DISPLAY
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
/usr/lib/rpm/find-debuginfo.sh --strict-build-id "/root/rpmbuild/BUILD/tiobench-0.3.3"
/usr/lib/rpm/check-buildroot
/usr/lib/rpm/redhat/brp-compress
/usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
/usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
/usr/lib/rpm/brp-python-bytecompile
/usr/lib/rpm/redhat/brp-python-hardlink
/usr/lib/rpm/redhat/brp-java-repack-jars