Update vendor/libarchive/dist to b2c3ee7e2907511533eeb2a0f2ceecc1faa73185
[freebsd.git] / contrib / libarchive.spec
1 Name:           {{{ git_name }}}
2 Version:        {{{ git_version lead=3 follow=5 }}}
3 Release:        1%{?dist}
4 Summary:        A library for handling streaming archive formats
5
6 License:        BSD
7 URL:            http://www.libarchive.org/
8 Source:         {{{ git_pack }}}
9
10 VCS:            {{{ git_vcs }}}
11
12 BuildRequires:  automake
13 BuildRequires:  bison
14 BuildRequires:  bzip2-devel
15 BuildRequires:  e2fsprogs-devel
16 BuildRequires:  gcc
17 BuildRequires:  libacl-devel
18 BuildRequires:  libattr-devel
19 BuildRequires:  libtool
20 BuildRequires:  libxml2-devel
21 BuildRequires:  libzstd-devel
22 BuildRequires:  lz4-devel
23 BuildRequires:  lzo-devel
24 BuildRequires:  openssl-devel
25 BuildRequires:  sharutils
26 BuildRequires:  xz-devel
27 BuildRequires:  zlib-devel
28
29 %description
30 Libarchive is a programming library that can create and read several different
31 streaming archive formats, including most popular tar variants, several cpio
32 formats, and both BSD and GNU ar variants. It can also write shar archives and
33 read ISO9660 CDROM images and ZIP archives.
34
35
36 %package devel
37 Summary:        Development files for %{name}
38 Requires:       %{name}%{?_isa} = %{version}-%{release}
39
40 %description devel
41 The %{name}-devel package contains libraries and header files for
42 developing applications that use %{name}.
43
44
45 %package -n bsdtar
46 Summary:        Manipulate tape archives
47 Requires:       %{name}%{?_isa} = %{version}-%{release}
48
49 %description -n bsdtar
50 The bsdtar package contains standalone bsdtar utility split off regular
51 libarchive packages.
52
53
54 %package -n bsdcpio
55 Summary:        Copy files to and from archives
56 Requires:       %{name}%{?_isa} = %{version}-%{release}
57
58 %description -n bsdcpio
59 The bsdcpio package contains standalone bsdcpio utility split off regular
60 libarchive packages.
61
62
63 %package -n bsdcat
64 Summary:        Expand files to standard output
65 Requires:       %{name}%{?_isa} = %{version}-%{release}
66
67 %description -n bsdcat
68 The bsdcat program typically takes a filename as an argument or reads standard
69 input when used in a pipe.  In both cases decompressed data it written to
70 standard output.
71
72
73 %prep
74 {{{ git_setup_macro }}}
75 %autosetup -p1
76
77
78 %build
79 build/autogen.sh
80 %configure --disable-static --without-nettle LT_SYS_LIBRARY_PATH=%_libdir
81 %make_build
82
83
84 %install
85 make install DESTDIR=$RPM_BUILD_ROOT
86 find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
87
88 # rhbz#1294252
89 replace ()
90 {
91     filename=$1
92     file=`basename "$filename"`
93     binary=${file%%.*}
94     pattern=${binary##bsd}
95
96     awk "
97         # replace the topic
98         /^.Dt ${pattern^^} 1/ {
99             print \".Dt ${binary^^} 1\";
100             next;
101         }
102         # replace the first occurence of \"$pattern\" by \"$binary\"
103         !stop && /^.Nm $pattern/ {
104             print \".Nm $binary\" ;
105             stop = 1 ;
106             next;
107         }
108         # print remaining lines
109         1;
110     " "$filename" > "$filename.new"
111     mv "$filename".new "$filename"
112 }
113
114 for manpage in bsdtar.1 bsdcpio.1
115 do
116     installed_manpage=`find "$RPM_BUILD_ROOT" -name "$manpage"`
117     replace "$installed_manpage"
118 done
119
120
121 %check
122 %if %{with check}
123 logfiles ()
124 {
125     find -name '*_test.log' -or -name test-suite.log
126 }
127
128 tempdirs ()
129 {
130     cat `logfiles` \
131         | awk "match(\$0, /[^[:space:]]*`date -I`[^[:space:]]*/) { print substr(\$0, RSTART, RLENGTH); }" \
132         | sort | uniq
133 }
134
135 cat_logs ()
136 {
137     for i in `logfiles`
138     do
139         echo "=== $i ==="
140         cat "$i"
141     done
142 }
143
144 run_testsuite ()
145 {
146     rc=0
147     %make_build check -j1 || {
148         # error happened - try to extract in koji as much info as possible
149         cat_logs
150
151         for i in `tempdirs`; do
152             if test -d "$i" ; then
153                 find $i -printf "%p\n    ~> a: %a\n    ~> c: %c\n    ~> t: %t\n    ~> %s B\n"
154                 cat $i/*.log
155             fi
156         done
157         return 1
158     }
159     cat_logs
160 }
161
162 # On a ppc/ppc64 is some race condition causing 'make check' fail on ppc
163 # when both 32 and 64 builds are done in parallel on the same machine in
164 # koji.  Try to run once again if failed.
165 %ifarch ppc
166 run_testsuite || run_testsuite
167 %else
168 run_testsuite
169 %endif
170 %endif
171
172
173 %files
174 %{!?_licensedir:%global license %%doc}
175 %license COPYING
176 %doc NEWS README.md
177 %{_libdir}/libarchive.so.13*
178 %{_mandir}/*/cpio.*
179 %{_mandir}/*/mtree.*
180 %{_mandir}/*/tar.*
181
182 %files devel
183 %{_includedir}/*.h
184 %{_mandir}/*/archive*
185 %{_mandir}/*/libarchive*
186 %{_libdir}/libarchive.so
187 %{_libdir}/pkgconfig/libarchive.pc
188
189 %files -n bsdtar
190 %{!?_licensedir:%global license %%doc}
191 %license COPYING
192 %doc NEWS README.md
193 %{_bindir}/bsdtar
194 %{_mandir}/*/bsdtar*
195
196 %files -n bsdcpio
197 %{!?_licensedir:%global license %%doc}
198 %license COPYING
199 %doc NEWS README.md
200 %{_bindir}/bsdcpio
201 %{_mandir}/*/bsdcpio*
202
203 %files -n bsdcat
204 %{!?_licensedir:%global license %%doc}
205 %license COPYING
206 %doc NEWS README.md
207 %{_bindir}/bsdcat
208 %{_mandir}/*/bsdcat*
209
210
211
212 %changelog
213 * Thu Mar 28 2019 Pavel Raiskup <praiskup@redhat.com> - 3.3.3-7
214 - simplify libtool hacks
215
216 {{ git_changelog }}