Sunday, June 13, 2010

Comment for a customized spec file

Recently I need to build .rpm for ming-0.4.2. There is a perl-ext in the source tree and I need include it in .rpm:


[sean@Build-64bit SPECS]$ ./configure --prefix=/usr/local --enable-perl --disable-cpp


For C part, the original spec file is just fine, but for Perl part, I got "Installed but not packaged" error. After added missing files to spec %files section, I got working version. This is final version of ming.spec:


1 # Some distributions name their Freetype 2 package "freetype", while others
2 # name it "freetype2". You can define the name your distribution uses here.
3 %define freetype2 freetype
4
5 Summary: A SWF output library
6 Name: nMetrics-ming
7 Version: 0.4.2
8 Release: 1
9 License: LGPL
10 Group: System Environment/Libraries
11 Source: http://prdownloads.sourceforge.net/ming/nMetrics-ming-%{version}.tar.gz
12 URL: http://ming.sourceforge.net/
13 BuildRoot: %{_tmppath}/%{name}-%{version}-root
14 BuildRequires: %{freetype2}-devel zlib-devel giflib-devel libpng-devel
15 Requires: %{freetype2} zlib giflib libpng
16
17 %description
18 Ming is a C library for generating SWF ("Flash") format movies, plus a set of wrappers for using the library from C++ and popular script ing languages like PHP, Perl, Python, and Ruby.
19
20 %package devel
21 Summary: A SWF output library
22 Group: Development/Libraries
23 Requires: %{name} = %{version}
24 Requires: %{freetype2}-devel zlib-devel giflib-devel libpng-devel
25
26 %description devel
27 The ming-devel package includes the static libraries,
28 header files, and developer docs for the ming package.
29
30 Install ming-devel if you want to develop programs which
31 will use ming.
32
33 %prep
34 %setup -q
35
36 %build
37 %configure --enable-perl --disable-cpp
38 %__make %{?_smp_mflags}
39
40 %install
41 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
42 %__make %{?_smp_mflags} \
43 DESTDIR=$RPM_BUILD_ROOT \
44 docdir=$RPM_BUILD_ROOT%{_docdir}/%{name} \
45 pkgconfigdir=%{_libdir}/pkgconfig \
46 install
47
48 %clean
49 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
50
51 %post -p /sbin/ldconfig
52
53 %postun -p /sbin/ldconfig
54
55 %files
56 %defattr(-, root, root)
57 %doc README AUTHORS COPYING ChangeLog
58 %{_libdir}/libming*.so.*
59 %{_bindir}/*
60 %{_mandir}/man1/*
61 /usr/local/lib64/perl5/5.8.8/x86_64-linux-thread-multi/perllocal.pod
62 /usr/local/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/SWF.pm
63 /usr/local/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/SWF
64 /usr/local/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/SWF
65 /usr/local/share/man/man3/SWF*
66
67 %files devel
68 %defattr(-, root, root)
69 %{_includedir}/*
70 %{_libdir}/*.a
71 %{_libdir}/*.la
72 %{_libdir}/libming.so
73 %{_libdir}/pkgconfig
74 %{_mandir}/man3/*
75
76 %changelog
77 * Tue Sep 02 2006 John Ellson
78 - Initial changelog entry


This is the diff output between this version and original version:


6c6
< Name: nMetrics-ming
---
> Name: ming
11c11
< Source: http://prdownloads.sourceforge.net/ming/nMetrics-ming-%{version}.tar.gz
---
> Source: http://prdownloads.sourceforge.net/ming/ming-%{version}.tar.gz
37c37
< %configure --enable-perl --disable-cpp
---
> %configure
61,65d60
< /usr/local/lib64/perl5/5.8.8/x86_64-linux-thread-multi/perllocal.pod
< /usr/local/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/SWF.pm
< /usr/local/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/SWF
< /usr/local/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/SWF
< /usr/local/share/man/man3/SWF*


Comments:
1. I changed "Name:" tag(Line 6). And of course I changed tarball from ming-0.4.2.tar.gz to nMetrics-ming-0.4.2.tar.gz as you can see in the "Source:" tag(Line 11)
2. Add build options to "%configure" macro
3. Add files to "%files" section
4. The last thing not in spec file is that I changed "%{_prefix}" from default(/usr) to (/usr/local) by type this:


[sean@Build-64bit SPECS]$ rpmbuild -bb ming.spec --define '_prefix /usr/local'

No comments:

Post a Comment