]> git.pld-linux.org Git - SPECS.git/blob - zaptel-alt.spec
SPECS updated Wed 28 Jul 14:48:01 CEST 2021
[SPECS.git] / zaptel-alt.spec
1
2 # Conditional build:
3 %bcond_without  dist_kernel     # without distribution kernel
4 %bcond_without  kernel          # don't build kernel modules
5 %bcond_without  userspace       # don't build userspace tools
6 # remember to set echotraining=no or you will hear silence
7 %bcond_without  oslec           # with Open Source Line Echo Canceller
8 %bcond_with     bristuff        # with bristuff support
9 %bcond_without  xpp             # without Astribank
10 %bcond_without  wc
11 %bcond_with     verbose
12 %bcond_without  tor2only
13
14 %ifarch sparc
15 %undefine       with_smp
16 %endif
17 %ifarch alpha
18 %undefine       with_xpp
19 %endif
20
21 %if %{without kernel}
22 %undefine       with_dist_kernel
23 %endif
24 %if "%{_alt_kernel}" != "%{nil}"
25 %undefine       with_userspace
26 %endif
27 %if %{without userspace}
28 # nothing to be placed to debuginfo package
29 %define         _enable_debug_packages  0
30 %endif
31
32 %define         rel     1.1
33 %define         pname   zaptel
34 %define         FIRMWARE_URL http://downloads.digium.com/pub/telephony/firmware/releases
35 Summary:        Zaptel telephony device support
36 Summary(pl.UTF-8):      Obsługa urządzeń telefonicznych Zaptel
37 Name:           %{pname}-alt%{_alt_kernel}
38 Version:        1.4.12.1
39 Release:        %{rel}%{?with_bristuff:.bristuff}
40 License:        GPL
41 Group:          Base/Kernel
42 # there are also E400 and T400 (beside TE400) different drivers
43 Source0:        http://te400p.pbxhardware.com/driver/%{pname}-%{version}.tar.gz
44 # Source0-md5:  611bf60e2de8c1cacb0e2629af4bcd8f
45 Source1:        %{pname}.init
46 Source2:        %{pname}.sysconfig
47 Source3:        %{FIRMWARE_URL}/zaptel-fw-oct6114-064-1.05.01.tar.gz
48 # Source3-md5:  18e6e6879070a8d61068e1c87b8c2b22
49 Source4:        %{FIRMWARE_URL}/zaptel-fw-oct6114-128-1.05.01.tar.gz
50 # Source4-md5:  c46a13f468b53828dc5c78f0eadbefd4
51 Source5:        %{FIRMWARE_URL}/zaptel-fw-vpmadt032-1.07.tar.gz
52 # Source5-md5:  7916c630a68fcfd38ead6caf9b55e5a1
53 Source6:        %{FIRMWARE_URL}/zaptel-fw-tc400m-MR6.12.tar.gz
54 # Source6-md5:  c57f41fae88f129e14fcaf41e4df90dc
55 Patch0:         %{name}-make.patch
56 # http://svn.astfin.org/software/oslec/trunk/kernel/zaptel-1.4.12.1.patch
57 Patch1:         zaptel-1.4.12.1.patch
58 Patch2:         %{name}-bristuff.patch
59 Patch3:         %{name}-sparc.patch
60 Patch4:         %{name}-kernel.patch
61 # in theory this patch is wrong but my E-only card works fine with both T and E modes with this patch
62 Patch5:         %{name}-pciid.patch
63 Patch6:         %{name}-ec.patch
64 Patch7:         zaptel-alt-kernel2.patch
65 Patch8:         zaptel-alt-kernel3.patch
66 URL:            http://www.asterisk.org/
67 %if %{with kernel} && %{with dist_kernel}
68 BuildRequires:  kernel%{_alt_kernel}-module-build
69 BuildRequires:  module-init-tools
70 %endif
71 BuildRequires:  newt-devel
72 BuildRequires:  perl-base
73 BuildRequires:  perl-tools-pod
74 BuildRequires:  rpmbuild(macros) >= 1.379
75 %{?with_bristuff:Provides:      zaptel(bristuff)}
76 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
77
78 %define         _smp_mflags     -j1
79
80 # Rules:
81 # - modules_X: single modules, just name module with no suffix
82 # - modules_X: subdir modules are just directory name with slash like dirname/
83 # - keep X and X_in in sync
84 # - X is used for actual building (entries separated with space), X_in for pld macros (entries separated with comma)
85
86 %define modules_1       zaptel.o ztd-eth.o ztd-loc.o pciradio.o tor2.o torisa.o wcfxo.o wct1xxp.o wctdm.o wcte11xp.o wcusb.o ztdummy.o ztdynamic.o
87 %define modules_1_in    zaptel,ztd-eth,ztd-loc,pciradio,tor2,torisa,wcfxo,wct1xxp,wctdm,wcte11xp,wcusb,ztdummy,ztdynamic
88
89 %define modules_2       wct4xxp/ wcte12xp/ %{?with_xpp:xpp/}
90 %define modules_2_in    wct4xxp/wct4xxp,wcte12xp/wcte12xp%{?with_xpp:,xpp/{%{?with_bristuff:xpd_bri,}xpd_fxo,xpd_fxs,xpd_pri,xpp,xpp_usb}}
91 %ifnarch alpha
92 %define modules_nalpha  %{?with_wc:wctc4xxp/ wctdm24xxp/} zttranscode.o
93 %define modules_nalpha_in       %{?with_wc:wctc4xxp/wctc4xxp,wctdm24xxp/wctdm24xxp,}zttranscode
94 %endif
95 %if %{with bristuff}
96 %define modules_bristuff cwain/ qozap/ vzaphfc/ zaphfc/ ztgsm/ opvxa1200.o wcopenpci.o
97 %define modules_bristuff_in     cwain/cwain,qozap/qozap,vzaphfc/vzaphfc,zaphfc/zaphfc,ztgsm/ztgsm,opvxa1200,wcopenpci
98 %endif
99
100 %if %{with tor2only}
101 %define modules         zaptel.o ztd-eth.o ztd-loc.o tor2.o ztdummy.o ztdynamic.o
102 %define modules_in      zaptel,ztd-eth,ztd-loc,tor2,ztdummy,ztdynamic
103 %else
104 %define modules         %{modules_1} %{modules_2}%{?modules_nalpha: %{modules_nalpha}}%{?modules_bristuff: %{modules_bristuff}}
105 %define modules_in      %{modules_1_in},%{modules_2_in}%{?modules_nalpha:,%{modules_nalpha_in}}%{?modules_bristuff:,%{modules_bristuff_in}}
106 %endif
107
108 %description
109 Zaptel telephony device driver.
110
111 %description -l pl.UTF-8
112 Sterownik do urządzeń telefonicznych Zaptel.
113
114 %package devel
115 Summary:        Zaptel development headers
116 Summary(pl.UTF-8):      Pliki nagłówkowe Zaptel
117 Group:          Development/Libraries
118 Requires:       %{name} = %{version}-%{rel}
119 %{?with_bristuff:Provides:      zaptel-devel(bristuff)}
120
121 %description devel
122 Zaptel development headers.
123
124 %description devel -l pl.UTF-8
125 Pliki nagłówkowe Zaptel.
126
127 %package static
128 Summary:        Zaptel static library
129 Summary(pl.UTF-8):      Biblioteka statyczna Zaptel
130 Group:          Development/Libraries
131 Requires:       %{name}-devel = %{version}-%{rel}
132 %{?with_bristuff:Provides:      zaptel-static(bristuff)}
133
134 %description static
135 Zaptel static library.
136
137 %description static -l pl.UTF-8
138 Biblioteka statyczna Zaptel.
139
140 %package utils
141 Summary:        Zaptel utility programs
142 Summary(pl.UTF-8):      Programy narzędziowe Zaptel
143 Group:          Applications/Communications
144
145 %description utils
146 Zaptel card utility programs, mainly for diagnostics.
147
148 %description utils -l pl.UTF-8
149 Programy narzędziowe do kart Zaptel, służące głównie do diagnostyki.
150
151 %package init
152 Summary:        Zaptel init scripts
153 Summary(pl.UTF-8):      Skrypty inicjalizujące Zaptel
154 Group:          Applications/Communications
155 Requires(post,preun):   /sbin/chkconfig
156 Requires:       %{name}-utils = %{version}-%{rel}
157 Requires:       rc-scripts
158
159 %description init
160 Zaptel boot-time initialization.
161
162 %description init -l pl.UTF-8
163 Inicjalizacja Zaptel w czasie startu systemu.
164
165 %package -n kernel%{_alt_kernel}-%{pname}
166 Summary:        Zaptel Linux kernel driver
167 Summary(pl.UTF-8):      Sterownik Zaptel dla jądra Linuksa
168 Release:        %{rel}@%{_kernel_ver_str}
169 Group:          Base/Kernel
170 Requires(post,postun):  /sbin/depmod
171 %if %{with dist_kernel}
172 %requires_releq_kernel
173 Requires(postun):       %releq_kernel
174 %{?with_oslec:Requires: kernel-misc-oslec}
175 %endif
176
177 %description -n kernel%{_alt_kernel}-%{pname}
178 Zaptel telephony Linux kernel driver.
179
180 %description -n kernel%{_alt_kernel}-%{pname} -l pl.UTF-8
181 Sterownik dla jądra Linuksa do urządzeń telefonicznych Zaptel.
182
183 %package -n perl-Zaptel
184 Summary:        Perl interface to Zaptel
185 Summary(pl.UTF-8):      Perlowy interfejs do Zaptela
186 Group:          Development/Languages/Perl
187 Requires:       %{name} = %{version}-%{rel}
188
189 %description -n perl-Zaptel
190 Perl inferface to Zaptel.
191
192 %description -n perl-Zaptel -l pl.UTF-8
193 Perlowy interfejs do Zaptela.
194
195 %prep
196 %setup -q -n %{pname}-%{version}
197 %patch0 -p1
198 %{?with_oslec:%patch1 -p1}
199 %{?with_bristuff:%patch2 -p1}
200 %patch3 -p1
201 %patch4 -p1
202 %patch5 -p1
203 cd kernel
204 %patch5 -p1
205 cd ..
206 %patch6 -p1
207 %patch7 -p1
208 %patch8 -p1
209
210 %if %{with kernel}
211 for a in %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6}; do
212         ln -s $a firmware
213         tar -C firmware -xzf $a
214 done
215
216 cat > download-logger <<'EOF'
217 #!/bin/sh
218 # keep log of files make wanted to download in firmware/ dir
219 echo "$@" >> download.log
220 EOF
221 chmod a+rx download-logger
222 %endif
223
224 %build
225 if [ ! -f configure.stamp ]; then
226         rm -f configure.stamp
227         %configure
228         %{__make} prereq zttest \
229                 CC="%{__cc}" \
230                 LDFLAGS="%{rpmldflags}" \
231                 OPTFLAGS="%{rpmcflags}"
232         touch configure.stamp
233 fi
234
235 %if %{with kernel}
236 %build_kernel_modules SUBDIRS=$PWD DOWNLOAD=$PWD/download-logger ZAP="-I$PWD" KSRC=%{_kernelsrcdir} KBUILD_OBJ_M="%{modules}" -m %{modules_in} -C kernel
237
238 check_modules() {
239         err=0
240         for a in kernel/{*/,}*.ko; do
241                 [[ $a = *-dist.ko ]] && continue
242                 [[ $a = *-up.ko ]] && continue
243                 [[ $a = *-smp.ko ]] && continue
244                 echo >&2 "unpackaged module: ${a%.ko}"
245                 err=1
246         done
247
248         [ $err = 0 ] || exit 1
249 }
250 #check_modules
251 %endif
252
253 %if %{with userspace}
254 %{__make} zttool zttest ztmonitor ztspeed sethdlc-new ztcfg \
255         ztcfg-dude fxstest fxotune ztdiag torisatool \
256         %{?with_bristuff:ztpty} libtonezone.so \
257         CC="%{__cc} %{rpmcflags}" \
258         LDFLAGS="%{rpmldflags}" \
259         KSRC=%{_kernelsrcdir}
260 %endif
261
262 %install
263 rm -rf $RPM_BUILD_ROOT
264
265 %if %{with kernel}
266 cd kernel
267 %install_kernel_modules -m %{modules_in} -d misc
268 cd ..
269 %endif
270
271 %if %{with userspace}
272 install -d $RPM_BUILD_ROOT{/sbin,%{_includedir}/linux,/etc/{rc.d/init.d,sysconfig},%{_sbindir},%{_mandir}/{man1,man8}}
273 %{__make} -o all -o devices -j1 install \
274         LIBDIR="%{_libdir}" \
275         LIB_DIR="%{_libdir}" \
276         INSTALL_PREFIX=$RPM_BUILD_ROOT \
277         DESTDIR=$RPM_BUILD_ROOT \
278         MODCONF=$RPM_BUILD_ROOT/etc/modprobe.conf \
279         KSRC=%{_kernelsrcdir} \
280         PERLLIBDIR=%{perl_vendorlib}
281 install zttool zttest ztmonitor ztspeed sethdlc-new ztcfg ztcfg-dude fxstest fxotune ztdiag torisatool %{?with_bristuff:ztpty} $RPM_BUILD_ROOT%{_sbindir}
282 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/zaptel
283 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/zaptel
284 touch $RPM_BUILD_ROOT/etc/zaptel.conf
285
286 install kernel/{zconfig.h,ecdis.h,fasthdlc.h,biquad.h} $RPM_BUILD_ROOT/usr/include/zaptel/
287 %endif
288
289 %clean
290 rm -rf $RPM_BUILD_ROOT
291
292 %post -n kernel%{_alt_kernel}-%{pname}
293 %depmod %{_kernel_ver}
294
295 %postun -n kernel%{_alt_kernel}-%{pname}
296 %depmod %{_kernel_ver}
297
298 %post init
299 /sbin/chkconfig --add %{pname}
300 %service %{pname} restart
301
302 %preun init
303 if [ "$1" = "0" ]; then
304         %service %{pname} stop
305         /sbin/chkconfig --del %{pname}
306 fi
307
308 %if %{with userspace}
309 %files
310 %defattr(644,root,root,755)
311 %doc README
312 %attr(600,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zaptel.conf
313 %attr(755,root,root) /sbin/*
314 %attr(755,root,root) %{_libdir}/*.so.*
315 %if %{with xpp}
316 %{_datadir}/zaptel
317 %endif
318 %{_mandir}/man8/*
319
320 %files init
321 %defattr(644,root,root,755)
322 %attr(754,root,root) /etc/rc.d/init.d/*
323 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/zaptel
324
325 %files devel
326 %defattr(644,root,root,755)
327 %attr(755,root,root) %{_libdir}/*.so
328 %{_includedir}/zaptel
329
330 %files static
331 %defattr(644,root,root,755)
332 %attr(755,root,root) %{_libdir}/*.a
333
334 %files utils
335 %defattr(644,root,root,755)
336 %attr(755,root,root) %{_sbindir}/*
337
338 %if %{with xpp}
339 %files -n perl-Zaptel
340 %defattr(644,root,root,755)
341 %{perl_vendorlib}/Zaptel
342 %{perl_vendorlib}/Zaptel.pm
343 %endif
344 %endif
345
346 %if %{with kernel}
347 %files -n kernel%{_alt_kernel}-%{pname}
348 %defattr(644,root,root,755)
349 /lib/modules/%{_kernel_ver}/misc/*.ko*
350 %endif
This page took 1.909055 seconds and 3 git commands to generate.