summaryrefslogtreecommitdiffstats
path: root/fastlz.spec
blob: 041635a2d547654eb57b0b8bc704154f5f5277fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# spec file for fastlz
#
# Copyright (c) 2014-2018 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#

%global date   20070619
%global svnrev 12
%global abi    0

Name:      fastlz
Summary:   Portable real-time compression library
Version:   0.1.0
Release:   0.9.%{date}svnrev%{svnrev}%{?dist}
License:   MIT
URL:       http://fastlz.org/

# svn export -r 12 http://fastlz.googlecode.com/svn/trunk/ fastlz-12
# tar cjf fastlz-12.tar.bz2 fastlz-12
Source0:   %{name}-%{svnrev}.tar.bz2

BuildRequires: gcc


%description
FastLZ is a lossless data compression library designed for real-time
compression and decompression. It favors speed over compression ratio.
Decompression requires no memory. Decompression algorithm is very simple,
and thus extremely fast.


%package devel
Summary:    Header files and development libraries for %{name}
Requires:   %{name}%{?_isa} = %{version}-%{release}

%description devel
This package contains the header files and development libraries
for %{name}.


%prep
%setup -q -n %{name}-%{svnrev}


%build
# Build the shared library
gcc %optflags -fPIC -c fastlz.c  -o fastlz.o
gcc %optflags -fPIC -shared \
   -Wl,-soname -Wl,lib%{name}.so.%{abi} \
   -o lib%{name}.so.%{abi} fastlz.o
ln -s lib%{name}.so.%{abi} lib%{name}.so

# Build the commands for test
gcc %optflags -fPIC 6pack.c   -L. -l%{name} -o 6pack
gcc %optflags -fPIC 6unpack.c -L. -l%{name} -o 6unpack


%install
install -D -m 0755 lib%{name}.so.%{abi} %{buildroot}%{_libdir}/lib%{name}.so.%{abi}
ln -s lib%{name}.so.%{abi} %{buildroot}%{_libdir}/lib%{name}.so
install -D -pm 0644 %{name}.h           %{buildroot}%{_includedir}/%{name}.h

# Don't install the commands, as we obviously don't need more compression tools


%check
export LD_LIBRARY_PATH=$PWD
cp %{name}.c tmpin
./6pack -v
./6unpack -v

: Compress
./6pack -1 tmpin tmpout1
./6pack -2 tmpin tmpout2

: Uncompress 1
rm tmpin
./6unpack tmpout1
diff %{name}.c tmpin

: Uncompress 2
rm tmpin
./6unpack tmpout2
diff %{name}.c tmpin


%if 0%{?fedora} < 28 && 0%{?rhel} < 8
%post   -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%endif


%files
%{!?_licensedir:%global license %%doc}
%license LICENSE
%{_libdir}/lib%{name}.so.%{abi}

%files devel
%{_libdir}/lib%{name}.so
%{_includedir}/%{name}.h


%changelog
* Tue Feb 20 2018 Remi Collet <remi@remirepo.net> - 0.1.0-0.9.20070619svnrev12
- missing BR on gcc

* Fri Sep  5 2014 Remi Collet <remi@fedoraproject.org> - 0.1-0.1.20070619svnrev12
- Initial RPM