]>
Commit | Line | Data |
---|---|---|
563fc4ec | 1 | # |
2 | # TODO: | |
f50e30c4 | 3 | # - IMPORTANT rename: http://www.asterisk.org/zaptel-to-dahdi |
cc9ccfe5 | 4 | # - Fix --without xpp: |
5 | # + check_modules | |
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 | |
563fc4ec | 12 | # |
563fc4ec | 13 | # Conditional build: |
14 | %bcond_without dist_kernel # without distribution kernel | |
f3ae6389 | 15 | %bcond_without kernel # don't build kernel modules |
563fc4ec | 16 | %bcond_with oslec # with Open Source Line Echo Canceller |
563fc4ec | 17 | %bcond_without xpp # without Astribank |
56c839b0 | 18 | %bcond_without userspace # don't build userspace packages |
563fc4ec | 19 | %bcond_with verbose |
20 | ||
563fc4ec | 21 | %ifarch alpha |
22 | %undefine with_xpp | |
23 | %endif | |
228a18e7 | 24 | |
f3ae6389 | 25 | %if %{without kernel} |
26 | %undefine with_dist_kernel | |
27 | %endif | |
563fc4ec | 28 | |
228a18e7 JR |
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} | |
35 | exit 1 | |
36 | %endif | |
37 | ||
38 | %if "%{_alt_kernel}" != "%{nil}" | |
39 | %if 0%{?build_kernels:1} | |
40 | %{error:alt_kernel and build_kernels are mutually exclusive} | |
41 | exit 1 | |
42 | %endif | |
43 | %undefine with_userspace | |
44 | %global _build_kernels %{alt_kernel} | |
45 | %else | |
46 | %global _build_kernels %{?build_kernels:,%{?build_kernels}} | |
47 | %endif | |
48 | ||
49 | %if %{without userspace} | |
50 | # nothing to be placed to debuginfo package | |
51 | %define _enable_debug_packages 0 | |
52 | %endif | |
53 | ||
54 | %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) | |
55 | %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) | |
56 | ||
57 | %define rel 11 | |
563fc4ec | 58 | %define pname dahdi-linux |
59 | %define FIRMWARE_URL http://downloads.digium.com/pub/telephony/firmware/releases | |
60 | Summary: DAHDI telephony device support | |
61 | Summary(pl.UTF-8): Obsługa urządzeń telefonicznych DAHDI | |
62 | Name: %{pname}%{_alt_kernel} | |
2c402d2b | 63 | Version: 2.7.0.1 |
228a18e7 | 64 | Release: %{rel}%{?with_kernel:@%{_kernel_ver_str}} |
c792012c | 65 | License: GPL v2 |
563fc4ec | 66 | Group: Base/Kernel |
64471470 | 67 | Source0: http://downloads.asterisk.org/pub/telephony/dahdi-linux/releases/dahdi-linux-%{version}.tar.gz |
2c402d2b | 68 | # Source0-md5: bd91e46c60b6cdcdee95d7b0fec45e32 |
563fc4ec | 69 | Source3: %{FIRMWARE_URL}/dahdi-fw-oct6114-064-1.05.01.tar.gz |
70 | # Source3-md5: 88db9b7a07d8392736171b1b3e6bcc66 | |
71 | Source4: %{FIRMWARE_URL}/dahdi-fw-oct6114-128-1.05.01.tar.gz | |
72 | # Source4-md5: c1f1a18d3e20d283f42c71e580a64b5a | |
73 | Source5: %{FIRMWARE_URL}/dahdi-fw-vpmadt032-1.07.tar.gz | |
74 | # Source5-md5: e1c7231d6225ac999cb18f4e858f66b6 | |
75 | Source6: %{FIRMWARE_URL}/dahdi-fw-tc400m-MR6.12.tar.gz | |
76 | # Source6-md5: 2ea860bb8a9d8ede2858b9557b74ee3c | |
d2a401d3 | 77 | Source7: %{FIRMWARE_URL}/dahdi-fw-hx8-2.06.tar.gz |
78 | # Source7-md5: a7f3886942bb3e9fed349a41b3390c9f | |
563fc4ec | 79 | URL: http://www.asterisk.org/ |
228a18e7 JR |
80 | BuildRequires: rpmbuild(macros) >= 1.678 |
81 | %{?with_dist_kernel:BuildRequires: kernel%{_alt_kernel}-module-build >= 3:2.6.20.2} | |
563fc4ec | 82 | BuildRequires: perl-base |
563fc4ec | 83 | BuildRequires: rpmbuild(macros) >= 1.379 |
563fc4ec | 84 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
85 | ||
86 | # Rules: | |
87 | # - modules_X: single modules, just name module with no suffix | |
88 | # - modules_X: subdir modules are just directory name with slash like dirname/ | |
89 | # - keep X and X_in in sync | |
90 | # - X is used for actual building (entries separated with space), X_in for pld macros (entries separated with comma) | |
91 | ||
8be0f738 | 92 | %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 |
93 | %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 | |
d2a401d3 | 94 | %define modules_2 voicebus/ wct4xxp/ wcte12xp/ %{?with_xpp:xpp/} |
141723f4 | 95 | %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} |
563fc4ec | 96 | %ifnarch alpha |
97 | %define modules_nalpha wctc4xxp/ wctdm24xxp/ dahdi_transcode.o wcb4xxp/ | |
98 | %define modules_nalpha_in wctc4xxp/wctc4xxp,wctdm24xxp/wctdm24xxp,dahdi_transcode,wcb4xxp/wcb4xxp | |
563fc4ec | 99 | %endif |
b800683f | 100 | %define modules %{modules_1} %{modules_2}%{?modules_nalpha: %{modules_nalpha}} |
101 | %define modules_in %{modules_1_in},%{modules_2_in}%{?modules_nalpha:,%{modules_nalpha_in}} | |
563fc4ec | 102 | |
103 | %description | |
104 | DAHDI telephony device driver. | |
105 | ||
106 | %description -l pl.UTF-8 | |
107 | Sterownik do urządzeń telefonicznych DAHDI. | |
108 | ||
109 | %package devel | |
110 | Summary: Header files for dahdi interface | |
3f765485 | 111 | Summary(pl.UTF-8): Pliki nagłówkowe interfejsu dahdi |
563fc4ec | 112 | Group: Development/Libraries |
563fc4ec | 113 | |
114 | %description devel | |
115 | Header files for dahdi interface. | |
116 | ||
3f765485 JB |
117 | %description devel -l pl.UTF-8 |
118 | Pliki nagłówkowe interfejsu dahdi. | |
119 | ||
b448351d | 120 | %package udev |
121 | Summary: udev rules for DAHDI kernel modules | |
122 | Summary(pl.UTF-8): Reguły udev dla modułów jądra Linuksa dla DAHDI | |
123 | Release: %{rel} | |
124 | Group: Base/Kernel | |
6e3c0f33 | 125 | Requires: dahdi-tools >= 2.2.0 |
b448351d | 126 | Requires: udev-core |
127 | ||
128 | %description udev | |
129 | udev rules for DAHDI kernel modules. | |
130 | ||
131 | %description udev -l pl.UTF-8 | |
132 | Reguły udev dla modułów jądra Linuksa dla DAHDI. | |
133 | ||
228a18e7 JR |
134 | %define kernel_pkg()\ |
135 | %package -n kernel%{_alt_kernel}-%{pname}\ | |
136 | Summary: DAHDI Linux kernel driver\ | |
137 | Summary(pl.UTF-8): Sterownik DAHDI dla jądra Linuksa\ | |
138 | Release: %{rel}@%{_kernel_ver_str}\ | |
139 | Group: Base/Kernel\ | |
140 | Requires(post,postun): /sbin/depmod\ | |
141 | %if %{with dist_kernel}\ | |
142 | %requires_releq_kernel\ | |
143 | Requires(postun): %releq_kernel\ | |
144 | %{?with_oslec:Requires: kernel-misc-oslec = 20070608-0.1@%{_kernel_ver_str}}\ | |
145 | %endif\ | |
146 | \ | |
147 | %description -n kernel%{_alt_kernel}-%{pname}\ | |
148 | DAHDI telephony Linux kernel driver.\ | |
149 | \ | |
150 | %description -n kernel%{_alt_kernel}-%{pname} -l pl.UTF-8\ | |
151 | Sterownik dla jądra Linuksa do urządzeń telefonicznych DAHDI.\ | |
152 | \ | |
153 | %if %{with kernel}\ | |
154 | %files -n kernel%{_alt_kernel}-%{pname}\ | |
155 | %defattr(644,root,root,755)\ | |
156 | /lib/modules/%{_kernel_ver}/misc/dahdi*.ko*\ | |
157 | /lib/modules/%{_kernel_ver}/misc/pciradio.ko*\ | |
158 | /lib/modules/%{_kernel_ver}/misc/tor2.ko*\ | |
159 | /lib/modules/%{_kernel_ver}/misc/wcb4xxp.ko*\ | |
160 | /lib/modules/%{_kernel_ver}/misc/wcfxo.ko*\ | |
161 | /lib/modules/%{_kernel_ver}/misc/wct1xxp.ko*\ | |
162 | /lib/modules/%{_kernel_ver}/misc/wct4xxp.ko*\ | |
163 | /lib/modules/%{_kernel_ver}/misc/wctc4xxp.ko*\ | |
164 | /lib/modules/%{_kernel_ver}/misc/wctdm.ko*\ | |
165 | /lib/modules/%{_kernel_ver}/misc/wctdm24xxp.ko*\ | |
166 | /lib/modules/%{_kernel_ver}/misc/wcte11xp.ko*\ | |
167 | /lib/modules/%{_kernel_ver}/misc/wcte12xp.ko*\ | |
168 | %if %{with xpp}\ | |
169 | /lib/modules/%{_kernel_ver}/misc/xpd_*.ko*\ | |
170 | /lib/modules/%{_kernel_ver}/misc/xpp.ko*\ | |
171 | /lib/modules/%{_kernel_ver}/misc/xpp_usb.ko*\ | |
172 | %endif\ | |
173 | %endif\ | |
174 | \ | |
175 | %post -n kernel%{_alt_kernel}-%{pname}\ | |
176 | %depmod %{_kernel_ver}\ | |
177 | \ | |
178 | %postun -n kernel%{_alt_kernel}-%{pname}\ | |
179 | %depmod %{_kernel_ver}\ | |
180 | %{nil} | |
181 | ||
182 | %define build_kernel_pkg()\ | |
183 | %if %{with kernel}\ | |
184 | # hack: build library first (using explicit "lib" target), then modules without cleaning (-c)\ | |
185 | %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\ | |
186 | %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\ | |
187 | cd drivers/dahdi\ | |
188 | %install_kernel_modules -D ../../installed -m %{modules_in} -d misc\ | |
189 | cd ../..\ | |
190 | %endif\ | |
191 | %{nil} | |
192 | ||
193 | %{?with_kernel:%{expand:%kpkg}} | |
563fc4ec | 194 | |
195 | %prep | |
196 | %setup -q -n %{pname}-%{version} | |
197 | ||
d2a401d3 | 198 | for a in %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} %{SOURCE7}; do |
563fc4ec | 199 | ln -s $a drivers/dahdi/firmware |
200 | tar -C drivers/dahdi/firmware -xzf $a | |
201 | done | |
202 | ||
203 | cat > download-logger <<'EOF' | |
204 | #!/bin/sh | |
205 | # keep log of files make wanted to download in firmware/ dir | |
206 | echo "$@" >> download.log | |
207 | EOF | |
208 | chmod a+rx download-logger | |
209 | ||
210 | %build | |
211 | %{__make} include/dahdi/version.h | |
212 | ||
228a18e7 | 213 | %{?with_kernel:%{expand:%bkpkg}} |
563fc4ec | 214 | |
215 | %install | |
216 | rm -rf $RPM_BUILD_ROOT | |
228a18e7 | 217 | install -d $RPM_BUILD_ROOT%{_includedir}/dahdi |
563fc4ec | 218 | |
56c839b0 | 219 | %if %{with userspace} |
b448351d | 220 | install -d $RPM_BUILD_ROOT/etc/udev/rules.d |
221 | ||
3f765485 JB |
222 | %{__make} install-devices install-include \ |
223 | DESTDIR=$RPM_BUILD_ROOT | |
56c839b0 | 224 | %endif |
563fc4ec | 225 | |
228a18e7 JR |
226 | %if %{with kernel} |
227 | cp -a installed/* $RPM_BUILD_ROOT | |
228 | %endif | |
229 | ||
563fc4ec | 230 | %clean |
231 | rm -rf $RPM_BUILD_ROOT | |
232 | ||
56c839b0 | 233 | %if %{with userspace} |
563fc4ec | 234 | %files devel |
b603dc42 | 235 | %defattr(644,root,root,755) |
563fc4ec | 236 | %{_includedir}/dahdi |
237 | ||
b448351d | 238 | %files udev |
239 | %defattr(644,root,root,755) | |
240 | %config(noreplace) %verify(not md5 mtime size) /etc/udev/rules.d/dahdi.rules | |
241 | %config(noreplace) %verify(not md5 mtime size) /etc/udev/rules.d/xpp.rules | |
56c839b0 | 242 | %endif |