]>
Commit | Line | Data |
---|---|---|
d955ef1b ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without tests # build without tests | |
4 | ||
5 | %define rel 1 | |
6 | %define rdate 20070619 | |
7 | %define svnrev 12 | |
8 | Summary: Portable real-time compression library | |
9 | Name: fastlz | |
10 | Version: 0.1.0 | |
11 | Release: 0.r%{svnrev}.%{rdate}.%{rel} | |
12 | License: MIT | |
13 | Group: Libraries | |
14 | # svn export -r 12 http://fastlz.googlecode.com/svn/trunk/ fastlz-12 | |
15 | # tar cjf fastlz-12.tar.bz2 fastlz-12 | |
16 | Source0: http://pkgs.fedoraproject.org/repo/pkgs/fastlz/%{name}-%{svnrev}.tar.bz2/592bdf20af83c0124f19b55d0346f266/%{name}-%{svnrev}.tar.bz2 | |
17 | # Source0-md5: 592bdf20af83c0124f19b55d0346f266 | |
18 | URL: http://fastlz.org/ | |
19 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
20 | ||
21 | %define abi 0 | |
22 | ||
23 | %description | |
24 | FastLZ is a lossless data compression library designed for real-time | |
25 | compression and decompression. It favors speed over compression ratio. | |
26 | Decompression requires no memory. Decompression algorithm is very | |
27 | simple, and thus extremely fast. | |
28 | ||
29 | %package devel | |
30 | Summary: Header files and development libraries for %{name} | |
31 | Group: Development/Libraries | |
32 | Requires: %{name} = %{version}-%{release} | |
33 | ||
34 | %description devel | |
35 | This package contains the header files and development libraries for | |
36 | %{name}. | |
37 | ||
38 | %prep | |
39 | %setup -q -n %{name}-%{svnrev} | |
40 | ||
41 | %build | |
42 | # Build the shared library | |
43 | %{__cc} %{rpmcflags} -fPIC -c fastlz.c -o fastlz.o | |
44 | %{__cc} %{rpmcflags} -fPIC -shared -Wl,-soname -Wl,lib%{name}.so.%{abi} -o lib%{name}.so.%{abi} fastlz.o | |
45 | ln -s lib%{name}.so.%{abi} lib%{name}.so | |
46 | ||
47 | # Build the commands for test | |
48 | %{__cc} %{rpmcflags} -fPIC 6pack.c -L. -l%{name} -o 6pack | |
49 | %{__cc} %{rpmcflags} -fPIC 6unpack.c -L. -l%{name} -o 6unpack | |
50 | ||
51 | %if %{with tests} | |
52 | export LD_LIBRARY_PATH=$PWD | |
53 | cp %{name}.c tmpin | |
54 | ./6pack -v | |
55 | ./6unpack -v | |
56 | ||
57 | : Compress | |
58 | ./6pack -1 tmpin tmpout1 | |
59 | ./6pack -2 tmpin tmpout2 | |
60 | ||
61 | : Uncompress 1 | |
62 | rm tmpin | |
63 | ./6unpack tmpout1 | |
64 | diff %{name}.c tmpin | |
65 | ||
66 | : Uncompress 2 | |
67 | rm tmpin | |
68 | ./6unpack tmpout2 | |
69 | diff %{name}.c tmpin | |
70 | %endif | |
71 | ||
72 | %install | |
73 | rm -rf $RPM_BUILD_ROOT | |
74 | install -d $RPM_BUILD_ROOT{%{_libdir},%{_includedir}} | |
75 | ||
76 | install -p lib%{name}.so.%{abi} $RPM_BUILD_ROOT%{_libdir} | |
77 | ln -s lib%{name}.so.%{abi} $RPM_BUILD_ROOT%{_libdir}/lib%{name}.so | |
78 | cp -p %{name}.h $RPM_BUILD_ROOT%{_includedir} | |
79 | ||
80 | # Don't install the commands, as we obviously don't need more compression tools | |
81 | ||
82 | %clean | |
83 | rm -rf $RPM_BUILD_ROOT | |
84 | ||
85 | %post -p /sbin/ldconfig | |
86 | %postun -p /sbin/ldconfig | |
87 | ||
88 | %files | |
89 | %defattr(644,root,root,755) | |
90 | %doc LICENSE | |
91 | %attr(755,root,root) %{_libdir}/libfastlz.so.0 | |
92 | ||
93 | %files devel | |
94 | %defattr(644,root,root,755) | |
95 | %{_libdir}/libfastlz.so | |
96 | %{_includedir}/fastlz.h |