]>
Commit | Line | Data |
---|---|---|
1 | # | |
2 | # TODO: | |
3 | # - IMPORTANT rename: http://www.asterisk.org/zaptel-to-dahdi | |
4 | # | |
5 | # Conditional build: | |
6 | %bcond_without kernel # kernel modules | |
7 | %bcond_with oslec # Open Source Line Echo Canceller | |
8 | %bcond_without xpp # Xorcom Astribank support | |
9 | %bcond_without userspace # userspace packages | |
10 | %bcond_with verbose | |
11 | ||
12 | %ifarch alpha %{ix86} | |
13 | %undefine with_xpp | |
14 | %endif | |
15 | ||
16 | # The goal here is to have main, userspace, package built once with | |
17 | # simple release number, and only rebuild kernel packages with kernel | |
18 | # version as part of release number, without the need to bump release | |
19 | # with every kernel change. | |
20 | %if 0%{?_pld_builder:1} && %{with kernel} && %{with userspace} | |
21 | %{error:kernel and userspace cannot be built at the same time on PLD builders} | |
22 | exit 1 | |
23 | %endif | |
24 | ||
25 | # nothing to be placed to debuginfo package | |
26 | %define _enable_debug_packages 0 | |
27 | ||
28 | %define rel 2 | |
29 | %define pname dahdi-linux | |
30 | %define FIRMWARE_URL http://downloads.digium.com/pub/telephony/firmware/releases | |
31 | Summary: DAHDI telephony device support | |
32 | Summary(pl.UTF-8): Obsługa urządzeń telefonicznych DAHDI | |
33 | Name: %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel} | |
34 | Version: 3.3.0 | |
35 | Release: %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}} | |
36 | License: GPL v2 | |
37 | Group: Base/Kernel | |
38 | Source0: http://downloads.asterisk.org/pub/telephony/dahdi-linux/releases/dahdi-linux-%{version}.tar.gz | |
39 | # Source0-md5: 650e2f9ccae7efb850ce1914c768af83 | |
40 | Source3: %{FIRMWARE_URL}/dahdi-fw-oct6114-064-1.05.01.tar.gz | |
41 | # Source3-md5: 88db9b7a07d8392736171b1b3e6bcc66 | |
42 | Source4: %{FIRMWARE_URL}/dahdi-fw-oct6114-128-1.05.01.tar.gz | |
43 | # Source4-md5: c1f1a18d3e20d283f42c71e580a64b5a | |
44 | Source5: %{FIRMWARE_URL}/dahdi-fw-vpmadt032-1.07.tar.gz | |
45 | # Source5-md5: e1c7231d6225ac999cb18f4e858f66b6 | |
46 | Source6: %{FIRMWARE_URL}/dahdi-fw-tc400m-MR6.12.tar.gz | |
47 | # Source6-md5: 2ea860bb8a9d8ede2858b9557b74ee3c | |
48 | Source7: %{FIRMWARE_URL}/dahdi-fw-hx8-2.06.tar.gz | |
49 | # Source7-md5: a7f3886942bb3e9fed349a41b3390c9f | |
50 | Patch0: kernel-strcpy.patch | |
51 | Patch3: no-xpp.patch | |
52 | URL: http://www.asterisk.org/ | |
53 | %{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:2.6.20.2}} | |
54 | BuildRequires: perl-base | |
55 | BuildRequires: rpmbuild(macros) >= 1.701 | |
56 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
57 | ||
58 | # Rules: | |
59 | # - modules_X: single modules, just name module with no suffix | |
60 | # - modules_X: subdir modules are just directory name with slash like dirname/ | |
61 | # - keep X and X_in in sync | |
62 | # - X is used for actual building (entries separated with space), X_in for pld macros (entries separated with comma) | |
63 | ||
64 | %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 wcaxx.o wcte13xp.o wcte43x.o | |
65 | %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,wcaxx,wcte13xp,wcte43x | |
66 | %define modules_2 voicebus/ oct612x/ wct4xxp/ %{?with_xpp:xpp/} | |
67 | %define modules_2_in voicebus/dahdi_voicebus,oct612x/oct612x,wct4xxp/wct4xxp,%{?with_xpp:xpp/xpd_bri,xpp/xpd_echo,xpp/xpd_fxo,xpp/xpd_fxs,xpp/xpd_pri,xpp/xpp,xpp/xpp_usb} | |
68 | ||
69 | %ifnarch alpha | |
70 | %define modules_nalpha wctc4xxp/ wctdm24xxp/ dahdi_transcode.o wcb4xxp/ | |
71 | %define modules_nalpha_in wctc4xxp/wctc4xxp,wctdm24xxp/wctdm24xxp,dahdi_transcode,wcb4xxp/wcb4xxp | |
72 | %endif | |
73 | %define modules %{modules_1} %{modules_2}%{?modules_nalpha: %{modules_nalpha}} | |
74 | %define modules_in %{modules_1_in},%{modules_2_in}%{?modules_nalpha:,%{modules_nalpha_in}} | |
75 | ||
76 | %description | |
77 | DAHDI telephony device driver. | |
78 | ||
79 | %description -l pl.UTF-8 | |
80 | Sterownik do urządzeń telefonicznych DAHDI. | |
81 | ||
82 | %package devel | |
83 | Summary: Header files for dahdi interface | |
84 | Summary(pl.UTF-8): Pliki nagłówkowe interfejsu dahdi | |
85 | Group: Development/Libraries | |
86 | ||
87 | %description devel | |
88 | Header files for dahdi interface. | |
89 | ||
90 | %description devel -l pl.UTF-8 | |
91 | Pliki nagłówkowe interfejsu dahdi. | |
92 | ||
93 | %define kernel_pkg()\ | |
94 | %package -n kernel%{_alt_kernel}-%{pname}\ | |
95 | Summary: DAHDI Linux kernel driver\ | |
96 | Summary(pl.UTF-8): Sterownik DAHDI dla jądra Linuksa\ | |
97 | Release: %{rel}@%{_kernel_ver_str}\ | |
98 | Group: Base/Kernel\ | |
99 | Requires(post,postun): /sbin/depmod\ | |
100 | %requires_releq_kernel\ | |
101 | Requires(postun): %releq_kernel\ | |
102 | %{?with_oslec:Requires: kernel-misc-oslec = 20070608-0.1@%{_kernel_ver_str}}\ | |
103 | \ | |
104 | %description -n kernel%{_alt_kernel}-%{pname}\ | |
105 | DAHDI telephony Linux kernel driver.\ | |
106 | \ | |
107 | %description -n kernel%{_alt_kernel}-%{pname} -l pl.UTF-8\ | |
108 | Sterownik dla jądra Linuksa do urządzeń telefonicznych DAHDI.\ | |
109 | \ | |
110 | %if %{with kernel}\ | |
111 | %files -n kernel%{_alt_kernel}-%{pname}\ | |
112 | %defattr(644,root,root,755)\ | |
113 | /lib/modules/%{_kernel_ver}/misc/dahdi*.ko*\ | |
114 | /lib/modules/%{_kernel_ver}/misc/wcb4xxp.ko*\ | |
115 | /lib/modules/%{_kernel_ver}/misc/wct4xxp.ko*\ | |
116 | /lib/modules/%{_kernel_ver}/misc/wctc4xxp.ko*\ | |
117 | /lib/modules/%{_kernel_ver}/misc/wctdm24xxp.ko*\ | |
118 | /lib/modules/%{_kernel_ver}/misc/wcte13xp.ko*\ | |
119 | /lib/modules/%{_kernel_ver}/misc/oct612x.ko*\ | |
120 | /lib/modules/%{_kernel_ver}/misc/wcaxx.ko*\ | |
121 | /lib/modules/%{_kernel_ver}/misc/wcte43x.ko*\ | |
122 | %if %{with xpp}\ | |
123 | /lib/modules/%{_kernel_ver}/misc/xpd_*.ko*\ | |
124 | /lib/modules/%{_kernel_ver}/misc/xpp.ko*\ | |
125 | /lib/modules/%{_kernel_ver}/misc/xpp_usb.ko*\ | |
126 | %endif\ | |
127 | %endif\ | |
128 | \ | |
129 | %post -n kernel%{_alt_kernel}-%{pname}\ | |
130 | %depmod %{_kernel_ver}\ | |
131 | \ | |
132 | %postun -n kernel%{_alt_kernel}-%{pname}\ | |
133 | %depmod %{_kernel_ver}\ | |
134 | %{nil} | |
135 | ||
136 | %define build_kernel_pkg()\ | |
137 | %if %{with kernel}\ | |
138 | %build_kernel_modules V=1 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\ | |
139 | cd drivers/dahdi\ | |
140 | %install_kernel_modules -D ../../installed -m %{modules_in} -d misc\ | |
141 | cd ../..\ | |
142 | %endif\ | |
143 | %{nil} | |
144 | ||
145 | %{?with_kernel:%{expand:%create_kernel_packages}} | |
146 | ||
147 | %prep | |
148 | %setup -q -n %{pname}-%{version} | |
149 | %patch0 -p1 | |
150 | %if %{without xpp} | |
151 | %patch3 -p1 | |
152 | %endif | |
153 | ||
154 | for a in %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} %{SOURCE7}; do | |
155 | ln -s $a drivers/dahdi/firmware | |
156 | tar -C drivers/dahdi/firmware -xzf $a | |
157 | done | |
158 | ||
159 | cat > download-logger <<'EOF' | |
160 | #!/bin/sh | |
161 | # keep log of files make wanted to download in firmware/ dir | |
162 | echo "$@" >> download.log | |
163 | EOF | |
164 | chmod a+rx download-logger | |
165 | ||
166 | %build | |
167 | %{__make} include/dahdi/version.h | |
168 | ||
169 | %{?with_kernel:%{expand:%build_kernel_packages}} | |
170 | ||
171 | %install | |
172 | rm -rf $RPM_BUILD_ROOT | |
173 | install -d $RPM_BUILD_ROOT%{_includedir}/dahdi | |
174 | ||
175 | %if %{with userspace} | |
176 | %{__make} install-include \ | |
177 | DESTDIR=$RPM_BUILD_ROOT | |
178 | %endif | |
179 | ||
180 | %if %{with kernel} | |
181 | cp -a installed/* $RPM_BUILD_ROOT | |
182 | %endif | |
183 | ||
184 | %clean | |
185 | rm -rf $RPM_BUILD_ROOT | |
186 | ||
187 | %if %{with userspace} | |
188 | %files devel | |
189 | %defattr(644,root,root,755) | |
190 | %{_includedir}/dahdi | |
191 | %endif |