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
12 %bcond_without tor2only
22 %undefine with_dist_kernel
24 %if "%{_alt_kernel}" != "%{nil}"
25 %undefine with_userspace
27 %if %{without userspace}
28 # nothing to be placed to debuginfo package
29 %define _enable_debug_packages 0
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}
39 Release: %{rel}%{?with_bristuff:.bristuff}
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
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)
78 %define _smp_mflags -j1
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)
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
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}}
92 %define modules_nalpha %{?with_wc:wctc4xxp/ wctdm24xxp/} zttranscode.o
93 %define modules_nalpha_in %{?with_wc:wctc4xxp/wctc4xxp,wctdm24xxp/wctdm24xxp,}zttranscode
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
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
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}}
109 Zaptel telephony device driver.
111 %description -l pl.UTF-8
112 Sterownik do urządzeń telefonicznych Zaptel.
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)}
122 Zaptel development headers.
124 %description devel -l pl.UTF-8
125 Pliki nagłówkowe Zaptel.
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)}
135 Zaptel static library.
137 %description static -l pl.UTF-8
138 Biblioteka statyczna Zaptel.
141 Summary: Zaptel utility programs
142 Summary(pl.UTF-8): Programy narzędziowe Zaptel
143 Group: Applications/Communications
146 Zaptel card utility programs, mainly for diagnostics.
148 %description utils -l pl.UTF-8
149 Programy narzędziowe do kart Zaptel, służące głównie do diagnostyki.
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}
160 Zaptel boot-time initialization.
162 %description init -l pl.UTF-8
163 Inicjalizacja Zaptel w czasie startu systemu.
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}
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}
177 %description -n kernel%{_alt_kernel}-%{pname}
178 Zaptel telephony Linux kernel driver.
180 %description -n kernel%{_alt_kernel}-%{pname} -l pl.UTF-8
181 Sterownik dla jądra Linuksa do urządzeń telefonicznych Zaptel.
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}
189 %description -n perl-Zaptel
190 Perl inferface to Zaptel.
192 %description -n perl-Zaptel -l pl.UTF-8
193 Perlowy interfejs do Zaptela.
196 %setup -q -n %{pname}-%{version}
198 %{?with_oslec:%patch1 -p1}
199 %{?with_bristuff:%patch2 -p1}
211 for a in %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6}; do
213 tar -C firmware -xzf $a
216 cat > download-logger <<'EOF'
218 # keep log of files make wanted to download in firmware/ dir
219 echo "$@" >> download.log
221 chmod a+rx download-logger
225 if [ ! -f configure.stamp ]; then
226 rm -f configure.stamp
228 %{__make} prereq zttest \
230 LDFLAGS="%{rpmldflags}" \
231 OPTFLAGS="%{rpmcflags}"
232 touch configure.stamp
236 %build_kernel_modules SUBDIRS=$PWD DOWNLOAD=$PWD/download-logger ZAP="-I$PWD" KSRC=%{_kernelsrcdir} KBUILD_OBJ_M="%{modules}" -m %{modules_in} -C kernel
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}"
248 [ $err = 0 ] || exit 1
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}
263 rm -rf $RPM_BUILD_ROOT
267 %install_kernel_modules -m %{modules_in} -d misc
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
286 install kernel/{zconfig.h,ecdis.h,fasthdlc.h,biquad.h} $RPM_BUILD_ROOT/usr/include/zaptel/
290 rm -rf $RPM_BUILD_ROOT
292 %post -n kernel%{_alt_kernel}-%{pname}
293 %depmod %{_kernel_ver}
295 %postun -n kernel%{_alt_kernel}-%{pname}
296 %depmod %{_kernel_ver}
299 /sbin/chkconfig --add %{pname}
300 %service %{pname} restart
303 if [ "$1" = "0" ]; then
304 %service %{pname} stop
305 /sbin/chkconfig --del %{pname}
308 %if %{with userspace}
310 %defattr(644,root,root,755)
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.*
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
326 %defattr(644,root,root,755)
327 %attr(755,root,root) %{_libdir}/*.so
328 %{_includedir}/zaptel
331 %defattr(644,root,root,755)
332 %attr(755,root,root) %{_libdir}/*.a
335 %defattr(644,root,root,755)
336 %attr(755,root,root) %{_sbindir}/*
339 %files -n perl-Zaptel
340 %defattr(644,root,root,755)
341 %{perl_vendorlib}/Zaptel
342 %{perl_vendorlib}/Zaptel.pm
347 %files -n kernel%{_alt_kernel}-%{pname}
348 %defattr(644,root,root,755)
349 /lib/modules/%{_kernel_ver}/misc/*.ko*