3 # - IMPORTANT rename: http://www.asterisk.org/zaptel-to-dahdi
5 # - kernel modules doesn't build
6 # - should more header files be installed?
7 # - Installed (but unpackaged) file(s) found:
8 # /etc/hotplug/usb/xpp_fxloader
9 # /etc/hotplug/usb/xpp_fxloader.usermap
10 # /etc/udev/rules.d/xpp.rules
13 %bcond_without dist_kernel # without distribution kernel
14 %bcond_without kernel # don't build kernel modules
15 %bcond_without userspace # don't build userspace tools
16 %bcond_with oslec # with Open Source Line Echo Canceller
17 %bcond_with bristuff # with bristuff support
18 %bcond_without xpp # without Astribank
29 %undefine with_dist_kernel
31 %if "%{_alt_kernel}" != "%{nil}"
32 %undefine with_userspace
34 %if %{without userspace}
35 # nothing to be placed to debuginfo package
36 %define _enable_debug_packages 0
41 %define FIRMWARE_URL http://downloads.digium.com/pub/telephony/firmware/releases
42 Summary: Zaptel telephony device support
43 Summary(pl.UTF-8): Obsługa urządzeń telefonicznych Zaptel
44 Name: %{pname}%{_alt_kernel}
46 Release: %{rel}%{?with_bristuff:.bristuff}
49 Source0: http://ftp.digium.com/pub/zaptel/releases/%{pname}-%{version}.tar.gz
50 # Source0-md5: 71e83a020b020fa60905edecf70e95a3
51 Source1: %{pname}.init
52 Source2: %{pname}.sysconfig
53 Source3: %{FIRMWARE_URL}/zaptel-fw-oct6114-064-1.05.01.tar.gz
54 # Source3-md5: 18e6e6879070a8d61068e1c87b8c2b22
55 Source4: %{FIRMWARE_URL}/zaptel-fw-oct6114-128-1.05.01.tar.gz
56 # Source4-md5: c46a13f468b53828dc5c78f0eadbefd4
57 Source5: %{FIRMWARE_URL}/zaptel-fw-vpmadt032-1.07.tar.gz
58 # Source5-md5: 7916c630a68fcfd38ead6caf9b55e5a1
59 Source6: %{FIRMWARE_URL}/zaptel-fw-tc400m-MR6.12.tar.gz
60 # Source6-md5: c57f41fae88f129e14fcaf41e4df90dc
61 Patch0: %{pname}-make.patch
62 Patch1: %{pname}-oslec.patch
63 Patch2: %{pname}-bristuff.patch
64 Patch3: %{pname}-sparc.patch
65 Patch4: %{pname}-kernel.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 Conflicts: dahdi-tools
77 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
80 # - modules_X: single modules, just name module with no suffix
81 # - modules_X: subdir modules are just directory name with slash like dirname/
82 # - keep X and X_in in sync
83 # - X is used for actual building (entries separated with space), X_in for pld macros (entries separated with comma)
85 %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
86 %define modules_1_in zaptel,ztd-eth,ztd-loc,pciradio,tor2,torisa,wcfxo,wct1xxp,wctdm,wcte11xp,wcusb,ztdummy,ztdynamic
88 %define modules_2 wct4xxp/ wcte12xp/ %{?with_xpp:xpp/}
89 %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 %define modules_nalpha wctc4xxp/ wctdm24xxp/ zttranscode.o
92 %define modules_nalpha_in wctc4xxp/wctc4xxp,wctdm24xxp/wctdm24xxp,zttranscode
95 %define modules_bristuff cwain/ qozap/ vzaphfc/ zaphfc/ ztgsm/ opvxa1200.o wcopenpci.o
96 %define modules_bristuff_in cwain/cwain,qozap/qozap,vzaphfc/vzaphfc,zaphfc/zaphfc,ztgsm/ztgsm,opvxa1200,wcopenpci
98 %define modules %{modules_1} %{modules_2}%{?modules_nalpha: %{modules_nalpha}}%{?modules_bristuff: %{modules_bristuff}}
99 %define modules_in %{modules_1_in},%{modules_2_in}%{?modules_nalpha:,%{modules_nalpha_in}}%{?modules_bristuff:,%{modules_bristuff_in}}
102 Zaptel telephony device driver.
104 %description -l pl.UTF-8
105 Sterownik do urządzeń telefonicznych Zaptel.
108 Summary: Zaptel development headers
109 Summary(pl.UTF-8): Pliki nagłówkowe Zaptel
110 Group: Development/Libraries
111 Requires: %{pname} = %{version}-%{rel}
112 %{?with_bristuff:Provides: zaptel-devel(bristuff)}
115 Zaptel development headers.
117 %description devel -l pl.UTF-8
118 Pliki nagłówkowe Zaptel.
121 Summary: Zaptel static library
122 Summary(pl.UTF-8): Biblioteka statyczna Zaptel
123 Group: Development/Libraries
124 Requires: %{pname}-devel = %{version}-%{rel}
125 %{?with_bristuff:Provides: zaptel-static(bristuff)}
128 Zaptel static library.
130 %description static -l pl.UTF-8
131 Biblioteka statyczna Zaptel.
134 Summary: Zaptel utility programs
135 Summary(pl.UTF-8): Programy narzędziowe Zaptel
136 Group: Applications/Communications
139 Zaptel card utility programs, mainly for diagnostics.
141 %description utils -l pl.UTF-8
142 Programy narzędziowe do kart Zaptel, służące głównie do diagnostyki.
145 Summary: Zaptel init scripts
146 Summary(pl.UTF-8): Skrypty inicjalizujące Zaptel
147 Group: Applications/Communications
148 Requires(post,preun): /sbin/chkconfig
149 Requires: %{pname}-utils = %{version}-%{rel}
153 Zaptel boot-time initialization.
155 %description init -l pl.UTF-8
156 Inicjalizacja Zaptel w czasie startu systemu.
158 %package -n kernel%{_alt_kernel}-%{pname}
159 Summary: Zaptel Linux kernel driver
160 Summary(pl.UTF-8): Sterownik Zaptel dla jądra Linuksa
161 Release: %{rel}@%{_kernel_ver_str}
163 Requires(post,postun): /sbin/depmod
164 %if %{with dist_kernel}
165 %requires_releq_kernel
166 Requires(postun): %releq_kernel
167 %{?with_oslec:Requires: kernel-misc-oslec = 20070608-0.1@%{_kernel_ver_str}}
170 %description -n kernel%{_alt_kernel}-%{pname}
171 Zaptel telephony Linux kernel driver.
173 %description -n kernel%{_alt_kernel}-%{pname} -l pl.UTF-8
174 Sterownik dla jądra Linuksa do urządzeń telefonicznych Zaptel.
176 %package -n perl-Zaptel
177 Summary: Perl interface to Zaptel
178 Summary(pl.UTF-8): Perlowy interfejs do Zaptela
179 Group: Development/Languages/Perl
180 Requires: %{pname} = %{version}-%{rel}
182 %description -n perl-Zaptel
183 Perl inferface to Zaptel.
185 %description -n perl-Zaptel -l pl.UTF-8
186 Perlowy interfejs do Zaptela.
189 %setup -q -n %{pname}-%{version}
191 %{?with_oslec:%patch1 -p1}
192 %{?with_bristuff:%patch2 -p1}
197 for a in %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6}; do
199 tar -C firmware -xzf $a
202 cat > download-logger <<'EOF'
204 # keep log of files make wanted to download in firmware/ dir
205 echo "$@" >> download.log
207 chmod a+rx download-logger
211 if [ ! -f configure.stamp ]; then
212 rm -f configure.stamp
214 %{__make} prereq zttest \
216 LDFLAGS="%{rpmldflags}" \
217 OPTFLAGS="%{rpmcflags}"
218 touch configure.stamp
222 %build_kernel_modules SUBDIRS=$PWD DOWNLOAD=$PWD/download-logger ZAP="-I$PWD" KSRC=%{_kernelsrcdir} KBUILD_OBJ_M="%{modules}" -m %{modules_in} -C kernel
226 for a in kernel/{*/,}*.ko; do
227 [[ $a = *-dist.ko ]] && continue
228 [[ $a = *-up.ko ]] && continue
229 [[ $a = *-smp.ko ]] && continue
230 echo >&2 "unpackaged module: ${a%.ko}"
234 [ $err = 0 ] || exit 1
239 %if %{with userspace}
240 %{__make} zttool zttest ztmonitor ztspeed sethdlc-new ztcfg \
241 ztcfg-dude fxstest fxotune ztdiag torisatool \
242 %{?with_bristuff:ztpty} libtonezone.so \
243 CC="%{__cc} %{rpmcflags}" \
244 LDFLAGS="%{rpmldflags}" \
245 KSRC=%{_kernelsrcdir}
249 rm -rf $RPM_BUILD_ROOT
253 %install_kernel_modules -m %{modules_in} -d misc
257 %if %{with userspace}
258 install -d $RPM_BUILD_ROOT{/sbin,%{_includedir}/linux,/etc/{rc.d/init.d,sysconfig},%{_sbindir},%{_mandir}/{man1,man8}}
259 %{__make} -o all -o devices -j1 install \
260 LIBDIR="%{_libdir}" \
261 LIB_DIR="%{_libdir}" \
262 INSTALL_PREFIX=$RPM_BUILD_ROOT \
263 DESTDIR=$RPM_BUILD_ROOT \
264 MODCONF=$RPM_BUILD_ROOT/etc/modprobe.conf \
265 KSRC=%{_kernelsrcdir} \
266 PERLLIBDIR=%{perl_vendorlib}
267 install zttool zttest ztmonitor ztspeed sethdlc-new ztcfg ztcfg-dude fxstest fxotune ztdiag torisatool %{?with_bristuff:ztpty} $RPM_BUILD_ROOT%{_sbindir}
268 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/zaptel
269 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/zaptel
270 touch $RPM_BUILD_ROOT/etc/zaptel.conf
272 install kernel/{zconfig.h,ecdis.h,fasthdlc.h,biquad.h} $RPM_BUILD_ROOT/usr/include/zaptel/
276 rm -rf $RPM_BUILD_ROOT
278 %post -n kernel%{_alt_kernel}-%{pname}
279 %depmod %{_kernel_ver}
281 %postun -n kernel%{_alt_kernel}-%{pname}
282 %depmod %{_kernel_ver}
285 /sbin/chkconfig --add %{pname}
286 %service %{pname} restart
289 if [ "$1" = "0" ]; then
290 %service %{pname} stop
291 /sbin/chkconfig --del %{pname}
294 %if %{with userspace}
296 %defattr(644,root,root,755)
298 %attr(600,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zaptel.conf
299 %attr(755,root,root) /sbin/*
300 %attr(755,root,root) %{_libdir}/*.so.*
307 %defattr(644,root,root,755)
308 %attr(754,root,root) /etc/rc.d/init.d/*
309 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/zaptel
312 %defattr(644,root,root,755)
313 %attr(755,root,root) %{_libdir}/*.so
314 %{_includedir}/zaptel
317 %defattr(644,root,root,755)
318 %attr(755,root,root) %{_libdir}/*.a
321 %defattr(644,root,root,755)
322 %attr(755,root,root) %{_sbindir}/*
325 %files -n perl-Zaptel
326 %defattr(644,root,root,755)
327 %{perl_vendorlib}/Zaptel
328 %{perl_vendorlib}/Zaptel.pm
333 %files -n kernel%{_alt_kernel}-%{pname}
334 %defattr(644,root,root,755)
335 /lib/modules/%{_kernel_ver}/misc/*.ko*