3 # - IMPORTANT rename: http://www.asterisk.org/zaptel-to-dahdi
6 # unpackaged module: drivers/dahdi/xpp/xpd_bri
7 # unpackaged module: drivers/dahdi/xpp/xpd_fxo
8 # unpackaged module: drivers/dahdi/xpp/xpd_fxs
9 # unpackaged module: drivers/dahdi/xpp/xpd_pri
10 # unpackaged module: drivers/dahdi/xpp/xpp
11 # unpackaged module: drivers/dahdi/xpp/xpp_usb
14 %bcond_without dist_kernel # without distribution kernel
15 %bcond_without kernel # don't build kernel modules
16 %bcond_with oslec # with Open Source Line Echo Canceller
17 %bcond_without xpp # without Astribank
18 %bcond_without userspace # don't build userspace packages
26 %undefine with_dist_kernel
29 # The goal here is to have main, userspace, package built once with
30 # simple release number, and only rebuild kernel packages with kernel
31 # version as part of release number, without the need to bump release
32 # with every kernel change.
33 %if 0%{?_pld_builder:1} && %{with kernel} && %{with userspace}
34 %{error:kernel and userspace cannot be built at the same time on PLD builders}
38 %if "%{_alt_kernel}" != "%{nil}"
39 %if 0%{?build_kernels:1}
40 %{error:alt_kernel and build_kernels are mutually exclusive}
43 %undefine with_userspace
44 %global _build_kernels %{alt_kernel}
46 %global _build_kernels %{?build_kernels:,%{?build_kernels}}
49 %if %{without userspace}
50 # nothing to be placed to debuginfo package
51 %define _enable_debug_packages 0
54 %define kbrs %(echo %{_build_kernels} | tr , '\\n' | while read n ; do echo %%undefine alt_kernel ; [ -z "$n" ] || echo %%define alt_kernel $n ; echo "BuildRequires:kernel%%{_alt_kernel}-module-build >= 3:2.6.20.2" ; done)
55 %define kpkg %(echo %{_build_kernels} | tr , '\\n' | while read n ; do echo %%undefine alt_kernel ; [ -z "$n" ] || echo %%define alt_kernel $n ; echo %%kernel_pkg ; done)
56 %define bkpkg %(echo %{_build_kernels} | tr , '\\n' | while read n ; do echo %%undefine alt_kernel ; [ -z "$n" ] || echo %%define alt_kernel $n ; echo %%build_kernel_pkg ; done)
59 %define pname dahdi-linux
60 %define FIRMWARE_URL http://downloads.digium.com/pub/telephony/firmware/releases
61 Summary: DAHDI telephony device support
62 Summary(pl.UTF-8): Obsługa urządzeń telefonicznych DAHDI
63 Name: %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel}
65 Release: %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}}
68 Source0: http://downloads.asterisk.org/pub/telephony/dahdi-linux/releases/dahdi-linux-%{version}.tar.gz
69 # Source0-md5: 8050688193b2a41d6d5dbc6755b1e76d
70 Source3: %{FIRMWARE_URL}/dahdi-fw-oct6114-064-1.05.01.tar.gz
71 # Source3-md5: 88db9b7a07d8392736171b1b3e6bcc66
72 Source4: %{FIRMWARE_URL}/dahdi-fw-oct6114-128-1.05.01.tar.gz
73 # Source4-md5: c1f1a18d3e20d283f42c71e580a64b5a
74 Source5: %{FIRMWARE_URL}/dahdi-fw-vpmadt032-1.07.tar.gz
75 # Source5-md5: e1c7231d6225ac999cb18f4e858f66b6
76 Source6: %{FIRMWARE_URL}/dahdi-fw-tc400m-MR6.12.tar.gz
77 # Source6-md5: 2ea860bb8a9d8ede2858b9557b74ee3c
78 Source7: %{FIRMWARE_URL}/dahdi-fw-hx8-2.06.tar.gz
79 # Source7-md5: a7f3886942bb3e9fed349a41b3390c9f
80 URL: http://www.asterisk.org/
81 BuildRequires: rpmbuild(macros) >= 1.678
82 %{?with_dist_kernel:%{expand:%kbrs}}
83 BuildRequires: perl-base
84 BuildRequires: rpmbuild(macros) >= 1.379
85 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
88 # - modules_X: single modules, just name module with no suffix
89 # - modules_X: subdir modules are just directory name with slash like dirname/
90 # - keep X and X_in in sync
91 # - X is used for actual building (entries separated with space), X_in for pld macros (entries separated with comma)
93 %define modules_1 dahdi.o dahdi_dynamic.o dahdi_dynamic_eth.o dahdi_dynamic_ethmf.o dahdi_dynamic_loc.o dahdi_echocan_jpah.o dahdi_echocan_kb1.o dahdi_echocan_mg2.o dahdi_echocan_sec.o dahdi_echocan_sec2.o pciradio.o tor2.o wcfxo.o wct1xxp.o wctdm.o wcte11xp.o
94 %define modules_1_in dahdi,dahdi_dynamic,dahdi_dynamic_eth,dahdi_dynamic_ethmf,dahdi_dynamic_loc,dahdi_echocan_jpah,dahdi_echocan_kb1,dahdi_echocan_mg2,dahdi_echocan_sec,dahdi_echocan_sec2,pciradio,tor2,wcfxo,wct1xxp,wctdm,wcte11xp
95 %define modules_2 voicebus/ wct4xxp/ wcte12xp/ %{?with_xpp:xpp/}
96 %define modules_2_in voicebus/dahdi_voicebus,wct4xxp/wct4xxp,wcte12xp/wcte12xp,%{?with_xpp:xpp/xpd_bri,xpp/xpd_echo,xpp/xpd_fxo,xpp/xpd_fxs,xpp/xpd_pri,xpp/xpp,xpp/xpp_usb}
98 %define modules_nalpha wctc4xxp/ wctdm24xxp/ dahdi_transcode.o wcb4xxp/
99 %define modules_nalpha_in wctc4xxp/wctc4xxp,wctdm24xxp/wctdm24xxp,dahdi_transcode,wcb4xxp/wcb4xxp
101 %define modules %{modules_1} %{modules_2}%{?modules_nalpha: %{modules_nalpha}}
102 %define modules_in %{modules_1_in},%{modules_2_in}%{?modules_nalpha:,%{modules_nalpha_in}}
105 DAHDI telephony device driver.
107 %description -l pl.UTF-8
108 Sterownik do urządzeń telefonicznych DAHDI.
111 Summary: Header files for dahdi interface
112 Summary(pl.UTF-8): Pliki nagłówkowe interfejsu dahdi
113 Group: Development/Libraries
116 Header files for dahdi interface.
118 %description devel -l pl.UTF-8
119 Pliki nagłówkowe interfejsu dahdi.
121 %define kernel_pkg()\
122 %package -n kernel%{_alt_kernel}-%{pname}\
123 Summary: DAHDI Linux kernel driver\
124 Summary(pl.UTF-8): Sterownik DAHDI dla jądra Linuksa\
125 Release: %{rel}@%{_kernel_ver_str}\
127 Requires(post,postun): /sbin/depmod\
128 %if %{with dist_kernel}\
129 %requires_releq_kernel\
130 Requires(postun): %releq_kernel\
131 %{?with_oslec:Requires: kernel-misc-oslec = 20070608-0.1@%{_kernel_ver_str}}\
134 %description -n kernel%{_alt_kernel}-%{pname}\
135 DAHDI telephony Linux kernel driver.\
137 %description -n kernel%{_alt_kernel}-%{pname} -l pl.UTF-8\
138 Sterownik dla jądra Linuksa do urządzeń telefonicznych DAHDI.\
141 %files -n kernel%{_alt_kernel}-%{pname}\
142 %defattr(644,root,root,755)\
143 /lib/modules/%{_kernel_ver}/misc/dahdi*.ko*\
144 /lib/modules/%{_kernel_ver}/misc/pciradio.ko*\
145 /lib/modules/%{_kernel_ver}/misc/tor2.ko*\
146 /lib/modules/%{_kernel_ver}/misc/wcb4xxp.ko*\
147 /lib/modules/%{_kernel_ver}/misc/wcfxo.ko*\
148 /lib/modules/%{_kernel_ver}/misc/wct1xxp.ko*\
149 /lib/modules/%{_kernel_ver}/misc/wct4xxp.ko*\
150 /lib/modules/%{_kernel_ver}/misc/wctc4xxp.ko*\
151 /lib/modules/%{_kernel_ver}/misc/wctdm.ko*\
152 /lib/modules/%{_kernel_ver}/misc/wctdm24xxp.ko*\
153 /lib/modules/%{_kernel_ver}/misc/wcte11xp.ko*\
154 /lib/modules/%{_kernel_ver}/misc/wcte12xp.ko*\
156 /lib/modules/%{_kernel_ver}/misc/xpd_*.ko*\
157 /lib/modules/%{_kernel_ver}/misc/xpp.ko*\
158 /lib/modules/%{_kernel_ver}/misc/xpp_usb.ko*\
162 %post -n kernel%{_alt_kernel}-%{pname}\
163 %depmod %{_kernel_ver}\
165 %postun -n kernel%{_alt_kernel}-%{pname}\
166 %depmod %{_kernel_ver}\
169 %define build_kernel_pkg()\
171 # hack: build library first (using explicit "lib" target), then modules without cleaning (-c)\
172 #build_kernel_modules lib SUBDIRS=$PWD/drivers/dahdi DAHDI_BUILD_ALL=m HOTPLUG_FIRMWARE=yes DAHDI_MODULES_EXTRA=" " -m %{modules_in} KSRC=$PWD/o -C drivers/dahdi/oct612x DAHDI_INCLUDE=$PWD/../../../include\
173 %build_kernel_modules SUBDIRS=$PWD/drivers/dahdi DAHDI_BUILD_ALL=m HOTPLUG_FIRMWARE=yes DAHDI_MODULES_EXTRA=" " -m %{modules_in} KSRC=$PWD/o -C drivers/dahdi DAHDI_INCLUDE=$PWD/../../include -c\
175 %install_kernel_modules -D ../../installed -m %{modules_in} -d misc\
180 %{?with_kernel:%{expand:%kpkg}}
183 %setup -q -n %{pname}-%{version}
185 for a in %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} %{SOURCE7}; do
186 ln -s $a drivers/dahdi/firmware
187 tar -C drivers/dahdi/firmware -xzf $a
190 cat > download-logger <<'EOF'
192 # keep log of files make wanted to download in firmware/ dir
193 echo "$@" >> download.log
195 chmod a+rx download-logger
198 %{__make} include/dahdi/version.h
200 %{?with_kernel:%{expand:%bkpkg}}
203 rm -rf $RPM_BUILD_ROOT
204 install -d $RPM_BUILD_ROOT%{_includedir}/dahdi
206 %if %{with userspace}
207 %{__make} install-include \
208 DESTDIR=$RPM_BUILD_ROOT
212 cp -a installed/* $RPM_BUILD_ROOT
216 rm -rf $RPM_BUILD_ROOT
218 %if %{with userspace}
220 %defattr(644,root,root,755)