http://www.ibm.com/developerworks/library/l-rpm1/
You can define some variable at the top, like source and buildroot dir. And then you define the actions should be taken in each stage, for %build/%install/%clean. In the %files section, you need to list all the files that will install into system. The following is an example for GNU hello package(http://www.gnu.org/software/hello/).
Summary: GNU Hello
Name: hello
Version: 2.4
Release: 1
Source0: %{name}-%{version}.tar.gz
License: GPL
Group: Development/Tools
BuildRoot: %{_builddir}/%{name}-root
%description
HelloWorld!
%prep
%setup -q
%build
./configure
make
%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
%clean
# clean up the hard disc after build
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
/usr/local/bin/hello
/usr/local/share/info/dir
/usr/local/share/info/hello.info
/usr/local/share/man/man1/hello.1
/usr/local/share/locale/bg/LC_MESSAGES/hello.mo
/usr/local/share/locale/ca/LC_MESSAGES/hello.mo
/usr/local/share/locale/da/LC_MESSAGES/hello.mo
/usr/local/share/locale/de/LC_MESSAGES/hello.mo
/usr/local/share/locale/el/LC_MESSAGES/hello.mo
/usr/local/share/locale/en@boldquot/LC_MESSAGES/hello.mo
/usr/local/share/locale/en@quot/LC_MESSAGES/hello.mo
/usr/local/share/locale/eo/LC_MESSAGES/hello.mo
/usr/local/share/locale/es/LC_MESSAGES/hello.mo
/usr/local/share/locale/et/LC_MESSAGES/hello.mo
/usr/local/share/locale/eu/LC_MESSAGES/hello.mo
/usr/local/share/locale/fa/LC_MESSAGES/hello.mo
/usr/local/share/locale/fi/LC_MESSAGES/hello.mo
/usr/local/share/locale/fr/LC_MESSAGES/hello.mo
/usr/local/share/locale/ga/LC_MESSAGES/hello.mo
/usr/local/share/locale/gl/LC_MESSAGES/hello.mo
/usr/local/share/locale/he/LC_MESSAGES/hello.mo
/usr/local/share/locale/hr/LC_MESSAGES/hello.mo
/usr/local/share/locale/hu/LC_MESSAGES/hello.mo
/usr/local/share/locale/id/LC_MESSAGES/hello.mo
/usr/local/share/locale/it/LC_MESSAGES/hello.mo
/usr/local/share/locale/ja/LC_MESSAGES/hello.mo
/usr/local/share/locale/ka/LC_MESSAGES/hello.mo
/usr/local/share/locale/ko/LC_MESSAGES/hello.mo
/usr/local/share/locale/lv/LC_MESSAGES/hello.mo
/usr/local/share/locale/ms/LC_MESSAGES/hello.mo
/usr/local/share/locale/nb/LC_MESSAGES/hello.mo
/usr/local/share/locale/nl/LC_MESSAGES/hello.mo
/usr/local/share/locale/nn/LC_MESSAGES/hello.mo
/usr/local/share/locale/pl/LC_MESSAGES/hello.mo
/usr/local/share/locale/pt/LC_MESSAGES/hello.mo
/usr/local/share/locale/pt_BR/LC_MESSAGES/hello.mo
/usr/local/share/locale/rm/LC_MESSAGES/hello.mo
/usr/local/share/locale/ro/LC_MESSAGES/hello.mo
/usr/local/share/locale/ru/LC_MESSAGES/hello.mo
/usr/local/share/locale/sk/LC_MESSAGES/hello.mo
/usr/local/share/locale/sl/LC_MESSAGES/hello.mo
/usr/local/share/locale/sr/LC_MESSAGES/hello.mo
/usr/local/share/locale/sv/LC_MESSAGES/hello.mo
/usr/local/share/locale/th/LC_MESSAGES/hello.mo
/usr/local/share/locale/tr/LC_MESSAGES/hello.mo
/usr/local/share/locale/uk/LC_MESSAGES/hello.mo
/usr/local/share/locale/vi/LC_MESSAGES/hello.mo
/usr/local/share/locale/zh_CN/LC_MESSAGES/hello.mo
/usr/local/share/locale/zh_TW/LC_MESSAGES/hello.mo
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment