]> git.pld-linux.org Git - SPECS.git/blob - zaptel.spec
SPECS updated Sat 31 Jul 20:26:02 CEST 2021
[SPECS.git] / zaptel.spec
1 #
2 # TODO:
3 # - IMPORTANT rename: http://www.asterisk.org/zaptel-to-dahdi
4 #
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
11 #
12 # Conditional build:
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
19 %bcond_with     verbose
20
21 %ifarch sparc
22 %undefine       with_smp
23 %endif
24 %ifarch alpha
25 %undefine       with_xpp
26 %endif
27
28 %if %{without kernel}
29 %undefine       with_dist_kernel
30 %endif
31 %if "%{_alt_kernel}" != "%{nil}"
32 %undefine       with_userspace
33 %endif
34 %if %{without userspace}
35 # nothing to be placed to debuginfo package
36 %define         _enable_debug_packages  0
37 %endif
38
39 %define         rel     32
40 %define         pname   zaptel
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}
45 Version:        1.4.12.1
46 Release:        %{rel}%{?with_bristuff:.bristuff}
47 License:        GPL
48 Group:          Base/Kernel
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
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 Conflicts:      dahdi-tools
77 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
78
79 # Rules:
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)
84
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
87
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}}
90 %ifnarch alpha
91 %define modules_nalpha  wctc4xxp/ wctdm24xxp/ zttranscode.o
92 %define modules_nalpha_in       wctc4xxp/wctc4xxp,wctdm24xxp/wctdm24xxp,zttranscode
93 %endif
94 %if %{with bristuff}
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
97 %endif
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}}
100
101 %description
102 Zaptel telephony device driver.
103
104 %description -l pl.UTF-8
105 Sterownik do urządzeń telefonicznych Zaptel.
106
107 %package devel
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)}
113
114 %description devel
115 Zaptel development headers.
116
117 %description devel -l pl.UTF-8
118 Pliki nagłówkowe Zaptel.
119
120 %package static
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)}
126
127 %description static
128 Zaptel static library.
129
130 %description static -l pl.UTF-8
131 Biblioteka statyczna Zaptel.
132
133 %package utils
134 Summary:        Zaptel utility programs
135 Summary(pl.UTF-8):      Programy narzędziowe Zaptel
136 Group:          Applications/Communications
137
138 %description utils
139 Zaptel card utility programs, mainly for diagnostics.
140
141 %description utils -l pl.UTF-8
142 Programy narzędziowe do kart Zaptel, służące głównie do diagnostyki.
143
144 %package init
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}
150 Requires:       rc-scripts
151
152 %description init
153 Zaptel boot-time initialization.
154
155 %description init -l pl.UTF-8
156 Inicjalizacja Zaptel w czasie startu systemu.
157
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}
162 Group:          Base/Kernel
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}}
168 %endif
169
170 %description -n kernel%{_alt_kernel}-%{pname}
171 Zaptel telephony Linux kernel driver.
172
173 %description -n kernel%{_alt_kernel}-%{pname} -l pl.UTF-8
174 Sterownik dla jądra Linuksa do urządzeń telefonicznych Zaptel.
175
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}
181
182 %description -n perl-Zaptel
183 Perl inferface to Zaptel.
184
185 %description -n perl-Zaptel -l pl.UTF-8
186 Perlowy interfejs do Zaptela.
187
188 %prep
189 %setup -q -n %{pname}-%{version}
190 %patch0 -p1
191 %{?with_oslec:%patch1 -p1}
192 %{?with_bristuff:%patch2 -p1}
193 %patch3 -p1
194 %patch4 -p1
195
196 %if %{with kernel}
197 for a in %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6}; do
198         ln -s $a firmware
199         tar -C firmware -xzf $a
200 done
201
202 cat > download-logger <<'EOF'
203 #!/bin/sh
204 # keep log of files make wanted to download in firmware/ dir
205 echo "$@" >> download.log
206 EOF
207 chmod a+rx download-logger
208 %endif
209
210 %build
211 if [ ! -f configure.stamp ]; then
212         rm -f configure.stamp
213         %configure
214         %{__make} prereq zttest \
215                 CC="%{__cc}" \
216                 LDFLAGS="%{rpmldflags}" \
217                 OPTFLAGS="%{rpmcflags}"
218         touch configure.stamp
219 fi
220
221 %if %{with kernel}
222 %build_kernel_modules SUBDIRS=$PWD DOWNLOAD=$PWD/download-logger ZAP="-I$PWD" KSRC=%{_kernelsrcdir} KBUILD_OBJ_M="%{modules}" -m %{modules_in} -C kernel
223
224 check_modules() {
225         err=0
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}"
231                 err=1
232         done
233
234         [ $err = 0 ] || exit 1
235 }
236 check_modules
237 %endif
238
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}
246 %endif
247
248 %install
249 rm -rf $RPM_BUILD_ROOT
250
251 %if %{with kernel}
252 cd kernel
253 %install_kernel_modules -m %{modules_in} -d misc
254 cd ..
255 %endif
256
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
271
272 install kernel/{zconfig.h,ecdis.h,fasthdlc.h,biquad.h} $RPM_BUILD_ROOT/usr/include/zaptel/
273 %endif
274
275 %clean
276 rm -rf $RPM_BUILD_ROOT
277
278 %post -n kernel%{_alt_kernel}-%{pname}
279 %depmod %{_kernel_ver}
280
281 %postun -n kernel%{_alt_kernel}-%{pname}
282 %depmod %{_kernel_ver}
283
284 %post init
285 /sbin/chkconfig --add %{pname}
286 %service %{pname} restart
287
288 %preun init
289 if [ "$1" = "0" ]; then
290         %service %{pname} stop
291         /sbin/chkconfig --del %{pname}
292 fi
293
294 %if %{with userspace}
295 %files
296 %defattr(644,root,root,755)
297 %doc README
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.*
301 %if %{with xpp}
302 %{_datadir}/zaptel
303 %endif
304 %{_mandir}/man8/*
305
306 %files init
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
310
311 %files devel
312 %defattr(644,root,root,755)
313 %attr(755,root,root) %{_libdir}/*.so
314 %{_includedir}/zaptel
315
316 %files static
317 %defattr(644,root,root,755)
318 %attr(755,root,root) %{_libdir}/*.a
319
320 %files utils
321 %defattr(644,root,root,755)
322 %attr(755,root,root) %{_sbindir}/*
323
324 %if %{with xpp}
325 %files -n perl-Zaptel
326 %defattr(644,root,root,755)
327 %{perl_vendorlib}/Zaptel
328 %{perl_vendorlib}/Zaptel.pm
329 %endif
330 %endif
331
332 %if %{with kernel}
333 %files -n kernel%{_alt_kernel}-%{pname}
334 %defattr(644,root,root,755)
335 /lib/modules/%{_kernel_ver}/misc/*.ko*
336 %endif
This page took 0.342283 seconds and 3 git commands to generate.